1 |
pam-fi |
1.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 |
|
|
#include "CaloGeomCut.h" |
11 |
|
|
|
12 |
|
|
int CaloGeomCut::Check(PamLevel2 *event) { |
13 |
|
|
|
14 |
pam-fi |
1.2 |
Float_t xCaloTrack; |
15 |
|
|
Float_t yCaloTrack; |
16 |
|
|
|
17 |
|
|
Double_t tanx, tany, beta; |
18 |
|
|
Float_t alCaloTop[5]; // MUST be Float_t |
19 |
|
|
Int_t nPoint = TrkParams::nGF+1; // MUST be Int_t |
20 |
|
|
Float_t zIn[nPoint]; // MUST be Float_t |
21 |
|
|
|
22 |
|
|
Trajectory* traj = NULL; |
23 |
|
|
|
24 |
|
|
static const Float_t zCaloTop=-26.181; // cm MUST Float_t |
25 |
|
|
|
26 |
|
|
tanx=_xCaloAxis->par[1]; |
27 |
|
|
tany=_yCaloAxis->par[1]; |
28 |
|
|
|
29 |
|
|
if (_iMethod==0) { |
30 |
|
|
} |
31 |
|
|
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) |
32 |
|
|
for (Int_t igf = 0; igf < TrkParams::nGF; igf++) { |
33 |
|
|
zIn[igf]=TrkParams::zGF[igf]; |
34 |
|
|
} |
35 |
|
|
zIn[TrkParams::nGF]=zCaloTop; |
36 |
|
|
|
37 |
|
|
traj = (Trajectory*) new Trajectory(nPoint,zIn); |
38 |
|
|
|
39 |
|
|
alCaloTop[0]=_xCaloAxis->GetYfit(zCaloTop); // Yfit [xCaloTop] |
40 |
|
|
alCaloTop[1]=_yCaloAxis->GetYfit(zCaloTop); // Yfit [yCaloTop] |
41 |
|
|
alCaloTop[2]=sin(atan(sqrt(pow(tanx,2)+pow(tany,2)))); // [sintheta] |
42 |
|
|
alCaloTop[3]=TMath::Pi()+atan2(tany,tanx); // [phi] |
43 |
|
|
|
44 |
|
|
beta = event->GetToFLevel2()->CalcBeta(0,_resMax,_qualCut,_chi2Cut); // TOF stand-alone beta |
45 |
|
|
alCaloTop[4] = 1./(_mass*beta/sqrt(1.-pow(beta,2))); // [etaP] [rho = (m/Z)*(beta/(sqrt(1-beta^2)))] |
46 |
|
|
|
47 |
|
|
traj->DoTrack(alCaloTop,zCaloTop); |
48 |
|
|
|
49 |
|
|
} |
50 |
|
|
else { |
51 |
|
|
return 1; |
52 |
|
|
} |
53 |
pam-fi |
1.1 |
|
54 |
|
|
for (Int_t igf = 0; igf < TrkParams::nGF; igf++) { |
55 |
pam-fi |
1.2 |
|
56 |
|
|
if (_iMethod==0) { // straight track |
57 |
|
|
// NOTE: par[0] is the x (y) coordinate on plane z=0 in PAMELA reference (magnet centre) |
58 |
|
|
xCaloTrack = _xCaloAxis->par[0] + tanx * TrkParams::zGF[igf]; // cm |
59 |
|
|
yCaloTrack = _yCaloAxis->par[0] + tany * TrkParams::zGF[igf]; // cm |
60 |
|
|
} |
61 |
|
|
else if (_iMethod==1) { |
62 |
|
|
xCaloTrack = traj->x[igf]; |
63 |
|
|
yCaloTrack = traj->y[igf]; |
64 |
|
|
} |
65 |
|
|
|
66 |
pam-fi |
1.1 |
if (! (TrkParams::xGF_min[igf] + _xTolCaloTrack < xCaloTrack && xCaloTrack < TrkParams::xGF_max[igf] |
67 |
|
|
- _xTolCaloTrack) ) { |
68 |
|
|
return 0; |
69 |
|
|
} |
70 |
|
|
|
71 |
|
|
if (! (TrkParams::yGF_min[igf] + _yTolCaloTrack < yCaloTrack && yCaloTrack < TrkParams::yGF_max[igf] |
72 |
|
|
- _yTolCaloTrack) ) { |
73 |
|
|
return 0; |
74 |
|
|
} |
75 |
pam-fi |
1.2 |
|
76 |
pam-fi |
1.1 |
} |
77 |
|
|
|
78 |
|
|
return CUTOK; |
79 |
pam-fi |
1.2 |
|
80 |
pam-fi |
1.1 |
} |