1 |
/* |
2 |
* CaloGeomCut.cpp |
3 |
* |
4 |
* Created on: 19-mar-2009 |
5 |
* Author: Sergio Ricciarini, Nicola Mori |
6 |
*/ |
7 |
|
8 |
/*! @file CaloGeomCut.cpp The CaloCrossCut class implementation file */ |
9 |
|
10 |
#ifndef NO_CALOAXIS |
11 |
|
12 |
#include "CaloGeomCut.h" |
13 |
const Int_t CaloGeomCut::_nPoint = TrkParams::nGF + 1; |
14 |
const Float_t CaloGeomCut::_zCaloTop = -26.181; |
15 |
|
16 |
CaloGeomCut::CaloGeomCut(const char *cutName, CaloAxis *xCaloAxis, CaloAxis *yCaloAxis, UInt_t iMethod, |
17 |
Float_t xTolCaloTrack, Float_t yTolCaloTrack, Float_t mass, Float_t resMax, Float_t qualCut, Float_t chi2Cut) : |
18 |
PamCut(cutName), _xCaloAxis(xCaloAxis), _yCaloAxis(yCaloAxis), _iMethod(iMethod), _xTolCaloTrack(xTolCaloTrack), _yTolCaloTrack( |
19 |
yTolCaloTrack), _mass(mass), _resMax(resMax), _qualCut(qualCut), _chi2Cut(chi2Cut), _traj(NULL), _zIn(_nPoint) { |
20 |
|
21 |
if (_iMethod == 1) { |
22 |
_traj = (Trajectory*) new Trajectory(_nPoint); |
23 |
|
24 |
for (Int_t igf = 0; igf < TrkParams::nGF; igf++) { |
25 |
_zIn[igf] = TrkParams::zGF[igf]; |
26 |
} |
27 |
_zIn[TrkParams::nGF] = _zCaloTop; |
28 |
|
29 |
} |
30 |
} |
31 |
|
32 |
/*! @brief Destructor. */ |
33 |
CaloGeomCut::~CaloGeomCut() { |
34 |
|
35 |
delete _traj; |
36 |
} |
37 |
|
38 |
int CaloGeomCut::Check(PamLevel2 *event) { |
39 |
|
40 |
Float_t xCaloTrack = 0.; |
41 |
Float_t yCaloTrack = 0.; |
42 |
|
43 |
Double_t tanx, tany, beta; |
44 |
Float_t alCaloTop[5]; // MUST be Float_t |
45 |
|
46 |
tanx = _xCaloAxis->par[1]; |
47 |
tany = _yCaloAxis->par[1]; |
48 |
|
49 |
if (_iMethod == 0) { |
50 |
} |
51 |
else if (_iMethod == 1) { // curved track in the Pamela acceptance (back-propagated starting from the straight track in the calorimeter, evaluated at the top of calorimeter, which is of course better than at higher z coordinates) |
52 |
|
53 |
alCaloTop[0] = _xCaloAxis->GetYfit(_zCaloTop); // Yfit [xCaloTop] |
54 |
alCaloTop[1] = _yCaloAxis->GetYfit(_zCaloTop); // Yfit [yCaloTop] |
55 |
alCaloTop[2] = sin(atan(sqrt(pow(tanx, 2) + pow(tany, 2)))); // [sintheta] |
56 |
alCaloTop[3] = TMath::Pi() + atan2(tany, tanx); // [phi] |
57 |
|
58 |
beta = event->GetToFLevel2()->CalcBeta(0, _resMax, _qualCut, _chi2Cut); // TOF stand-alone beta |
59 |
alCaloTop[4] = 1. / (_mass * beta / sqrt(1. - pow(beta, 2))); // [etaP] [rho = (m/Z)*(beta/(sqrt(1-beta^2)))] |
60 |
|
61 |
_traj->DoTrack(alCaloTop, _zCaloTop); |
62 |
|
63 |
} |
64 |
else { |
65 |
return 1; |
66 |
} |
67 |
|
68 |
for (Int_t igf = 0; igf < TrkParams::nGF; igf++) { |
69 |
|
70 |
if (_iMethod == 0) { // straight track |
71 |
// NOTE: par[0] is the x (y) coordinate on plane z=0 in PAMELA reference (magnet centre) |
72 |
xCaloTrack = _xCaloAxis->par[0] + tanx * TrkParams::zGF[igf]; // cm |
73 |
yCaloTrack = _yCaloAxis->par[0] + tany * TrkParams::zGF[igf]; // cm |
74 |
} |
75 |
else if (_iMethod == 1) { |
76 |
xCaloTrack = _traj->x[igf]; |
77 |
yCaloTrack = _traj->y[igf]; |
78 |
} |
79 |
|
80 |
if (!(TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack |
81 |
&& xCaloTrack < TrkParams::xGF_max[igf] - _xTolCaloTrack)) { |
82 |
return 0; |
83 |
} |
84 |
|
85 |
if (!(TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack |
86 |
&& yCaloTrack < TrkParams::yGF_max[igf] - _yTolCaloTrack)) { |
87 |
return 0; |
88 |
} |
89 |
|
90 |
} |
91 |
|
92 |
return CUTOK; |
93 |
|
94 |
} |
95 |
|
96 |
#endif /* NO_CALOAXIS */ |