--- PamCut/TrkCuts/TrkNucleiZCut/TrkNucleiZCut.cpp 2009/05/27 13:30:08 1.1.1.1 +++ PamCut/TrkCuts/TrkNucleiZCut/TrkNucleiZCut.cpp 2009/08/05 17:04:49 1.4 @@ -10,13 +10,26 @@ #include "TrkNucleiZCut.h" -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 +const float TrkNucleiZCut::_meanRigMean[] = { .992, 1.99, 3., 4., 5., 6. }; // the charge distribution peak for Z=1..6 +const float TrkNucleiZCut::_sigmaRigMean[] = { 0.06, 0.1, 0.17, 0.34, 0.44, 0.59 }; // the charge-width for Z=1..6 + +const float TrkNucleiZCut::_meanBetaMean[] = { 1., 2., 3., 4., 5., 6. }; // the charge distribution peak for Z=1..6 +const float TrkNucleiZCut::_sigmaBetaMean[] = { 0.09, 0.1, 0.17, 0.34, 0.44, 0.59 }; // the charge-width for Z=1..6 int TrkNucleiZCut::Check(PamLevel2 *event) { - if (_Z < 1 || _Z > 6) - return TRKNUCLEIZ_ILLEGALZ; + if (_lowZ < 1 || _lowZ > 6) { + return TRKNUCLEIZ_ILLEGALLOWZ; + } + if ((_highZ < (int) _lowZ && _highZ != -1) || _highZ > 6) { + return TRKNUCLEIZ_ILLEGALLOWZ; + } + + /* Check if we must perform a range selection */ + bool range = false; + if (_highZ != -1) + range = true; // ******** Check if TrkNuclei has already been initialized ******** if (_trkNuclei == NULL) @@ -40,20 +53,40 @@ // ******** Check the mean charge value ******** if (_howToCheck == TRKNUCLEIZ_CHECKMEAN) { - Float_t charge; + Float_t charge = 0., meanLowZ = 0., sigmaLowZ = 0., meanHighZ = 0., sigmaHighZ = 0.; + ; switch (_method) { - case TRKNUCLEIZ_DEFL: + case TRKNUCLEIZ_RIG: charge = _trkNuclei->GetZ_Rigidity(); + meanLowZ = _meanRigMean[_lowZ - 1]; + sigmaLowZ = _sigmaRigMean[_lowZ - 1]; + if (range) { + meanHighZ = _meanRigMean[_highZ - 1]; + sigmaHighZ = _sigmaRigMean[_highZ - 1]; + } break; case TRKNUCLEIZ_BETA: charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]); + meanLowZ = _meanBetaMean[_lowZ - 1]; + sigmaLowZ = _sigmaBetaMean[_lowZ - 1]; + if (range) { + meanHighZ = _meanBetaMean[_highZ - 1]; + sigmaHighZ = _sigmaBetaMean[_highZ - 1]; + } + break; } - if ((charge > _Z + _upperLimit * _sigmaZ[_Z - 1]) || (charge < _Z - _lowerLimit * _sigmaZ[_Z - 1])) { - return TRKNUCLEIZ_OUTOFBOUNDS; + if (!range) { + if ((charge > meanLowZ + _upperLimit * sigmaLowZ) || (charge < meanLowZ - _lowerLimit * sigmaLowZ)) { + return TRKNUCLEIZ_OUTOFBOUNDS; + } + } + else { + if ((charge > meanHighZ + _upperLimit * sigmaHighZ) || (charge < meanLowZ - _lowerLimit * sigmaLowZ)) { + return TRKNUCLEIZ_OUTOFBOUNDS; + } } - } // ******** Check the charge value from each plane ******** // NB. In current implementation only 2 check methods (mean and single values) are used, so an "else" statement @@ -63,7 +96,7 @@ Float_t charge[6] = { 0., 0., 0., 0., 0., 0. }; nValid = 0; switch (_method) { - case TRKNUCLEIZ_DEFL: + case TRKNUCLEIZ_RIG: for (int ip = 0; ip < 6; ip++) { charge[ip] = _trkNuclei->GetZ_Rigidity(ip); if (charge[ip] > 0.) { @@ -82,10 +115,22 @@ } for (int ip = 0; ip < 6; ip++) { - if (charge[ip] > 0.) // Check only good layers - if ((charge[ip] > _Z + _upperLimit * _sigmaZ[_Z - 1]) || (charge[ip] < _Z - _lowerLimit * _sigmaZ[_Z - 1])) { - return TRKNUCLEIZ_OUTOFBOUNDS; + if (charge[ip] > 0.) { // Check only good layers + // Currently, no calibration for single layers is available. Z is used as a mean value, while for sigma + // we use the standard values use for mean dE/dx Vs. beta. + if (!range) { + if ((charge[ip] > _lowZ + _upperLimit * _sigmaBetaMean[_lowZ - 1]) || (charge[ip] < _lowZ - _lowerLimit + * _sigmaBetaMean[_lowZ - 1])) { + return TRKNUCLEIZ_OUTOFBOUNDS; + } + } + else { + if ((charge[ip] > _highZ + _upperLimit * _sigmaBetaMean[_highZ - 1]) || (charge[ip] < _lowZ - _lowerLimit + * _sigmaBetaMean[_lowZ - 1])) { + return TRKNUCLEIZ_OUTOFBOUNDS; + } } + } } }