/[PAMELA software]/PamCut/TrkCuts/TrkNucleiZCut/TrkNucleiZCut.cpp
ViewVC logotype

Contents of /PamCut/TrkCuts/TrkNucleiZCut/TrkNucleiZCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed May 27 13:30:08 2009 UTC (15 years, 6 months ago) by pam-fi
Branch: MAIN
Branch point for: DEV
Initial revision

1 /*
2 * TrkNucleiZCut.cpp
3 *
4 * Created on: 10-mag-2009
5 * Author: Nicola Mori
6 */
7
8 /*! @file TrkNucleiZCut.cpp The TrkNucleiZCut class implementation file */
9 #ifndef NO_TRKNUCLEI
10
11 #include "TrkNucleiZCut.h"
12
13 const float TrkNucleiZCut::_sigmaZ[] = { 0.09, 0.1, 0.17, 0.34, 0.44, 0.59 }; // the charge-width in a layer for Z=1..6
14
15
16 int TrkNucleiZCut::Check(PamLevel2 *event) {
17
18 if (_Z < 1 || _Z > 6)
19 return TRKNUCLEIZ_ILLEGALZ;
20
21 // ******** Check if TrkNuclei has already been initialized ********
22 if (_trkNuclei == NULL)
23 _trkNuclei = new TrkNuclei();
24 _trkNuclei->Set(event->GetTrack(0)->GetTrkTrack());
25
26 // ******** First of all, check if the minimum number of planes is matched. ********
27 // NOTE: in current implementation a plane is considered valid if it is tagged as good in Tracker level 2
28 // routines. This should correspond to a valid charge.
29 // TODO Check the above statement.
30
31 // Prepare the valid charges counter
32 unsigned int nValid = 0;
33 for (unsigned int ip = 0; ip < 6; ip++) {
34 if (_trkNuclei->GetTrkTrack()->XGood(ip) && _trkNuclei->GetTrkTrack()->XGood(ip))
35 nValid++;
36 }
37 if (nValid < _minLayers)
38 return TRKNUCLEIZ_TOOFEWLAYERS;
39
40 // ******** Check the mean charge value ********
41 if (_howToCheck == TRKNUCLEIZ_CHECKMEAN) {
42
43 Float_t charge;
44 switch (_method) {
45 case TRKNUCLEIZ_DEFL:
46 charge = _trkNuclei->GetZ_Rigidity();
47 break;
48 case TRKNUCLEIZ_BETA:
49 charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]);
50 break;
51 }
52
53 if ((charge > _Z + _upperLimit * _sigmaZ[_Z - 1]) || (charge < _Z - _lowerLimit * _sigmaZ[_Z - 1])) {
54 return TRKNUCLEIZ_OUTOFBOUNDS;
55 }
56
57 }
58 // ******** Check the charge value from each plane ********
59 // NB. In current implementation only 2 check methods (mean and single values) are used, so an "else" statement
60 // is sufficient. Implement an "if" cascade or a "switch" if another check method is necessary.
61
62 else {
63 Float_t charge[6] = { 0., 0., 0., 0., 0., 0. };
64 nValid = 0;
65 switch (_method) {
66 case TRKNUCLEIZ_DEFL:
67 for (int ip = 0; ip < 6; ip++) {
68 charge[ip] = _trkNuclei->GetZ_Rigidity(ip);
69 if (charge[ip] > 0.) {
70 nValid++;
71 }
72 }
73 break;
74 case TRKNUCLEIZ_BETA:
75 for (int ip = 0; ip < 6; ip++) {
76 charge[ip] = _trkNuclei->GetZ_Beta(ip, event->GetTrack(0)->GetToFTrack()->beta[12]);
77 if (charge[ip] > 0.) {
78 nValid++;
79 }
80 }
81 break;
82 }
83
84 for (int ip = 0; ip < 6; ip++) {
85 if (charge[ip] > 0.) // Check only good layers
86 if ((charge[ip] > _Z + _upperLimit * _sigmaZ[_Z - 1]) || (charge[ip] < _Z - _lowerLimit * _sigmaZ[_Z - 1])) {
87 return TRKNUCLEIZ_OUTOFBOUNDS;
88 }
89 }
90 }
91
92 return CUTOK;
93
94 }
95
96 #endif /* NO_TRKNUCLEI */

  ViewVC Help
Powered by ViewVC 1.1.23