1 |
/* |
2 |
* CaloGeomYSensCut.cpp |
3 |
* |
4 |
* Created on: 13-apr-2010 |
5 |
* Author: S. Ricciarini |
6 |
*/ |
7 |
|
8 |
/*! @file CaloGeomYSensCut.cpp The CaloGeomYSens class implementation file */ |
9 |
|
10 |
#include "CaloGeomYSensCut.h" |
11 |
|
12 |
int CaloGeomYSensCut::Check(PamLevel2 *event) { |
13 |
|
14 |
Float_t ySensBorder=-0.25; // cm for TRK planes T1-T5 |
15 |
Float_t ySensBorderT6=+0.25; // cm for TRK plane T6 |
16 |
|
17 |
Float_t xCaloTrack = 0.; |
18 |
Float_t yCaloTrack = 0.; |
19 |
|
20 |
Double_t tanx, tany, beta; |
21 |
Float_t alCaloTop[5]; // MUST be Float_t |
22 |
Int_t nPoint = TrkParams::nGF+1; // MUST be Int_t |
23 |
Float_t zIn[nPoint]; // MUST be Float_t |
24 |
|
25 |
Trajectory* traj = NULL; |
26 |
|
27 |
static const Float_t zCaloTop=-26.181; // cm MUST Float_t |
28 |
|
29 |
tanx=_xCaloAxis->par[1]; |
30 |
tany=_yCaloAxis->par[1]; |
31 |
|
32 |
if (_iMethod==0) { |
33 |
} |
34 |
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) |
35 |
for (Int_t igf = 0; igf < TrkParams::nGF; igf++) { |
36 |
zIn[igf]=TrkParams::zGF[igf]; |
37 |
} |
38 |
zIn[TrkParams::nGF]=zCaloTop; |
39 |
|
40 |
traj = (Trajectory*) new Trajectory(nPoint,zIn); |
41 |
|
42 |
alCaloTop[0]=_xCaloAxis->GetYfit(zCaloTop); // Yfit [xCaloTop] |
43 |
alCaloTop[1]=_yCaloAxis->GetYfit(zCaloTop); // Yfit [yCaloTop] |
44 |
alCaloTop[2]=sin(atan(sqrt(pow(tanx,2)+pow(tany,2)))); // [sintheta] |
45 |
alCaloTop[3]=TMath::Pi()+atan2(tany,tanx); // [phi] |
46 |
|
47 |
beta = event->GetToFLevel2()->CalcBeta(0,_resMax,_qualCut,_chi2Cut); // TOF stand-alone beta |
48 |
alCaloTop[4] = 1./(_mass*beta/sqrt(1.-pow(beta,2))); // [etaP] [rho = (m/Z)*(beta/(sqrt(1-beta^2)))] |
49 |
|
50 |
traj->DoTrack(alCaloTop,zCaloTop); |
51 |
|
52 |
} |
53 |
else { |
54 |
return 1; |
55 |
} |
56 |
|
57 |
for (Int_t igf = 0; igf < TrkParams::nGF; igf++) { |
58 |
|
59 |
if (_iMethod==0) { // straight track |
60 |
// NOTE: par[0] is the x (y) coordinate on plane z=0 in PAMELA reference (magnet centre) |
61 |
xCaloTrack = _xCaloAxis->par[0] + tanx * TrkParams::zGF[igf]; // cm |
62 |
yCaloTrack = _yCaloAxis->par[0] + tany * TrkParams::zGF[igf]; // cm |
63 |
} |
64 |
else if (_iMethod==1) { |
65 |
xCaloTrack = traj->x[igf]; |
66 |
yCaloTrack = traj->y[igf]; |
67 |
} |
68 |
|
69 |
if (! (TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack && xCaloTrack < TrkParams::xGF_max[igf] |
70 |
- _xTolCaloTrack) ) { |
71 |
return 0; |
72 |
} |
73 |
|
74 |
if (! (TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack && yCaloTrack < TrkParams::yGF_max[igf] |
75 |
- _yTolCaloTrack) ) { |
76 |
return 0; |
77 |
} |
78 |
|
79 |
if (_ySens==0) { |
80 |
if (igf==4 || (6<=igf && igf<=9) ) { // T1-T5 |
81 |
// cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorder << endl; |
82 |
if (! (yCaloTrack < ySensBorder) ) { |
83 |
// cout << "NO" << endl; |
84 |
return 0; |
85 |
} |
86 |
} |
87 |
else if (igf==11) { // T6 |
88 |
// cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorderT6 << endl; |
89 |
if (! (yCaloTrack < ySensBorderT6) ) { |
90 |
// cout << "NO" << endl; |
91 |
return 0; |
92 |
} |
93 |
} |
94 |
} |
95 |
else if (_ySens==1) { |
96 |
if (igf==4 || (6<=igf && igf<=9) ) { // T1-T5 |
97 |
// cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorder << endl; |
98 |
if (! (yCaloTrack > ySensBorder) ) { |
99 |
// cout << "NO" << endl; |
100 |
return 0; |
101 |
} |
102 |
} |
103 |
else if (igf==11) { // T6 |
104 |
// cout << "igf " << igf << " yCaloTrack " << yCaloTrack << " " << ySensBorderT6 << endl; |
105 |
if (! (yCaloTrack > ySensBorderT6) ) { |
106 |
// cout << "NO" << endl; |
107 |
return 0; |
108 |
} |
109 |
} |
110 |
} |
111 |
else { |
112 |
return 0; |
113 |
} |
114 |
|
115 |
} |
116 |
|
117 |
return CUTOK; |
118 |
|
119 |
} |