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

Diff of /PamCut/TrkCuts/TrkNucleiZCut/TrkNucleiZCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by pam-fi, Fri May 29 10:10:18 2009 UTC revision 1.4 by pam-fi, Wed Aug 5 17:04:49 2009 UTC
# Line 19  const float TrkNucleiZCut::_sigmaBetaMea Line 19  const float TrkNucleiZCut::_sigmaBetaMea
19    
20  int TrkNucleiZCut::Check(PamLevel2 *event) {  int TrkNucleiZCut::Check(PamLevel2 *event) {
21    
22    if (_Z < 1 || _Z > 6)    if (_lowZ < 1 || _lowZ > 6) {
23      return TRKNUCLEIZ_ILLEGALZ;      return TRKNUCLEIZ_ILLEGALLOWZ;
24      }
25      if ((_highZ < (int) _lowZ && _highZ != -1) || _highZ > 6) {
26        return TRKNUCLEIZ_ILLEGALLOWZ;
27      }
28    
29      /* Check if we must perform a range selection */
30      bool range = false;
31      if (_highZ != -1)
32        range = true;
33    
34    // ******** Check if TrkNuclei has already been initialized ********    // ******** Check if TrkNuclei has already been initialized ********
35    if (_trkNuclei == NULL)    if (_trkNuclei == NULL)
# Line 44  int TrkNucleiZCut::Check(PamLevel2 *even Line 53  int TrkNucleiZCut::Check(PamLevel2 *even
53    // ******** Check the mean charge value ********    // ******** Check the mean charge value ********
54    if (_howToCheck == TRKNUCLEIZ_CHECKMEAN) {    if (_howToCheck == TRKNUCLEIZ_CHECKMEAN) {
55    
56      Float_t charge, meanZ, sigmaZ;      Float_t charge = 0., meanLowZ = 0., sigmaLowZ = 0., meanHighZ = 0., sigmaHighZ = 0.;
57        ;
58      switch (_method) {      switch (_method) {
59      case TRKNUCLEIZ_RIG:      case TRKNUCLEIZ_RIG:
60        charge = _trkNuclei->GetZ_Rigidity();        charge = _trkNuclei->GetZ_Rigidity();
61        meanZ = _meanRigMean[_Z-1];        meanLowZ = _meanRigMean[_lowZ - 1];
62        sigmaZ = _sigmaRigMean[_Z-1];        sigmaLowZ = _sigmaRigMean[_lowZ - 1];
63          if (range) {
64            meanHighZ = _meanRigMean[_highZ - 1];
65            sigmaHighZ = _sigmaRigMean[_highZ - 1];
66          }
67        break;        break;
68      case TRKNUCLEIZ_BETA:      case TRKNUCLEIZ_BETA:
69        charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]);        charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]);
70        meanZ = _meanBetaMean[_Z-1];        meanLowZ = _meanBetaMean[_lowZ - 1];
71        sigmaZ = _sigmaBetaMean[_Z-1];        sigmaLowZ = _sigmaBetaMean[_lowZ - 1];
72          if (range) {
73            meanHighZ = _meanBetaMean[_highZ - 1];
74            sigmaHighZ = _sigmaBetaMean[_highZ - 1];
75          }
76    
77        break;        break;
78      }      }
79    
80      if ((charge > meanZ + _upperLimit * sigmaZ) || (charge < meanZ - _lowerLimit * sigmaZ)) {      if (!range) {
81        return TRKNUCLEIZ_OUTOFBOUNDS;        if ((charge > meanLowZ + _upperLimit * sigmaLowZ) || (charge < meanLowZ - _lowerLimit * sigmaLowZ)) {
82            return TRKNUCLEIZ_OUTOFBOUNDS;
83          }
84        }
85        else {
86          if ((charge > meanHighZ + _upperLimit * sigmaHighZ) || (charge < meanLowZ - _lowerLimit * sigmaLowZ)) {
87            return TRKNUCLEIZ_OUTOFBOUNDS;
88          }
89      }      }
   
90    }    }
91    // ******** Check the charge value from each plane ********    // ******** Check the charge value from each plane ********
92    // NB. In current implementation only 2 check methods (mean and single values) are used, so an "else" statement    // NB. In current implementation only 2 check methods (mean and single values) are used, so an "else" statement
# Line 90  int TrkNucleiZCut::Check(PamLevel2 *even Line 115  int TrkNucleiZCut::Check(PamLevel2 *even
115      }      }
116    
117      for (int ip = 0; ip < 6; ip++) {      for (int ip = 0; ip < 6; ip++) {
118        if (charge[ip] > 0.) // Check only good layers        if (charge[ip] > 0.) { // Check only good layers
119          // Currently, no calibration for single layers is available. Z is used as a mean value, while for sigma          // Currently, no calibration for single layers is available. Z is used as a mean value, while for sigma
120          // we use the standard values use for mean dE/dx Vs. beta.          // we use the standard values use for mean dE/dx Vs. beta.
121          if ((charge[ip] > _Z + _upperLimit * _sigmaBetaMean[_Z - 1]) || (charge[ip] < _Z - _lowerLimit * _sigmaBetaMean[_Z - 1])) {          if (!range) {
122            return TRKNUCLEIZ_OUTOFBOUNDS;            if ((charge[ip] > _lowZ + _upperLimit * _sigmaBetaMean[_lowZ - 1]) || (charge[ip] < _lowZ - _lowerLimit
123                  * _sigmaBetaMean[_lowZ - 1])) {
124                return TRKNUCLEIZ_OUTOFBOUNDS;
125              }
126            }
127            else {
128              if ((charge[ip] > _highZ + _upperLimit * _sigmaBetaMean[_highZ - 1]) || (charge[ip] < _lowZ - _lowerLimit
129                  * _sigmaBetaMean[_lowZ - 1])) {
130                return TRKNUCLEIZ_OUTOFBOUNDS;
131              }
132          }          }
133          }
134      }      }
135    }    }
136    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.23