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