/[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.2 - (show annotations) (download)
Fri May 29 10:10:18 2009 UTC (15 years, 6 months ago) by pam-fi
Branch: MAIN
Changes since 1.1: +16 -6 lines
Previous commit was outdated; fixed.

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::_meanRigMean[] = { .992, 1.99, 3., 4., 5., 6. }; // the charge distribution peak for Z=1..6
14 const float TrkNucleiZCut::_sigmaRigMean[] = { 0.06, 0.1, 0.17, 0.34, 0.44, 0.59 }; // the charge-width for Z=1..6
15
16 const float TrkNucleiZCut::_meanBetaMean[] = { 1., 2., 3., 4., 5., 6. }; // the charge distribution peak for Z=1..6
17 const float TrkNucleiZCut::_sigmaBetaMean[] = { 0.09, 0.1, 0.17, 0.34, 0.44, 0.59 }; // the charge-width for Z=1..6
18
19
20 int TrkNucleiZCut::Check(PamLevel2 *event) {
21
22 if (_Z < 1 || _Z > 6)
23 return TRKNUCLEIZ_ILLEGALZ;
24
25 // ******** Check if TrkNuclei has already been initialized ********
26 if (_trkNuclei == NULL)
27 _trkNuclei = new TrkNuclei();
28 _trkNuclei->Set(event->GetTrack(0)->GetTrkTrack());
29
30 // ******** First of all, check if the minimum number of planes is matched. ********
31 // NOTE: in current implementation a plane is considered valid if it is tagged as good in Tracker level 2
32 // routines. This should correspond to a valid charge.
33 // TODO Check the above statement.
34
35 // Prepare the valid charges counter
36 unsigned int nValid = 0;
37 for (unsigned int ip = 0; ip < 6; ip++) {
38 if (_trkNuclei->GetTrkTrack()->XGood(ip) && _trkNuclei->GetTrkTrack()->XGood(ip))
39 nValid++;
40 }
41 if (nValid < _minLayers)
42 return TRKNUCLEIZ_TOOFEWLAYERS;
43
44 // ******** Check the mean charge value ********
45 if (_howToCheck == TRKNUCLEIZ_CHECKMEAN) {
46
47 Float_t charge, meanZ, sigmaZ;
48 switch (_method) {
49 case TRKNUCLEIZ_RIG:
50 charge = _trkNuclei->GetZ_Rigidity();
51 meanZ = _meanRigMean[_Z-1];
52 sigmaZ = _sigmaRigMean[_Z-1];
53 break;
54 case TRKNUCLEIZ_BETA:
55 charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]);
56 meanZ = _meanBetaMean[_Z-1];
57 sigmaZ = _sigmaBetaMean[_Z-1];
58 break;
59 }
60
61 if ((charge > meanZ + _upperLimit * sigmaZ) || (charge < meanZ - _lowerLimit * sigmaZ)) {
62 return TRKNUCLEIZ_OUTOFBOUNDS;
63 }
64
65 }
66 // ******** Check the charge value from each plane ********
67 // NB. In current implementation only 2 check methods (mean and single values) are used, so an "else" statement
68 // is sufficient. Implement an "if" cascade or a "switch" if another check method is necessary.
69
70 else {
71 Float_t charge[6] = { 0., 0., 0., 0., 0., 0. };
72 nValid = 0;
73 switch (_method) {
74 case TRKNUCLEIZ_RIG:
75 for (int ip = 0; ip < 6; ip++) {
76 charge[ip] = _trkNuclei->GetZ_Rigidity(ip);
77 if (charge[ip] > 0.) {
78 nValid++;
79 }
80 }
81 break;
82 case TRKNUCLEIZ_BETA:
83 for (int ip = 0; ip < 6; ip++) {
84 charge[ip] = _trkNuclei->GetZ_Beta(ip, event->GetTrack(0)->GetToFTrack()->beta[12]);
85 if (charge[ip] > 0.) {
86 nValid++;
87 }
88 }
89 break;
90 }
91
92 for (int ip = 0; ip < 6; ip++) {
93 if (charge[ip] > 0.) // Check only good layers
94 // Currently, no calibration for single layers is available. Z is used as a mean value, while for sigma
95 // we use the standard values use for mean dE/dx Vs. beta.
96 if ((charge[ip] > _Z + _upperLimit * _sigmaBetaMean[_Z - 1]) || (charge[ip] < _Z - _lowerLimit * _sigmaBetaMean[_Z - 1])) {
97 return TRKNUCLEIZ_OUTOFBOUNDS;
98 }
99 }
100 }
101
102 return CUTOK;
103
104 }
105
106 #endif /* NO_TRKNUCLEI */

  ViewVC Help
Powered by ViewVC 1.1.23