| 10 |
|
|
| 11 |
#include "TrkNucleiZCut.h" |
#include "TrkNucleiZCut.h" |
| 12 |
|
|
| 13 |
const float TrkNucleiZCut::_meanRigMean[] = { .992, 1.99, 3., 4., 5., 6. }; // the charge distribution peak for Z=1..6 |
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 |
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 |
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 |
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) { |
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 < _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= -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) |
| 36 |
_trkNuclei = new TrkNuclei(); |
_trkNuclei = new TrkNuclei(); |
| 37 |
_trkNuclei->Set(event->GetTrack(0)->GetTrkTrack()); |
_trkNuclei->Set(event->GetTrack(0)->GetTrkTrack()); |
| 38 |
|
|
| 39 |
// ******** First of all, check if the minimum number of planes is matched. ******** |
// ******** First of all, check if the minimum number of planes is matched. ******** |
| 45 |
unsigned int nValid = 0; |
unsigned int nValid = 0; |
| 46 |
for (unsigned int ip = 0; ip < 6; ip++) { |
for (unsigned int ip = 0; ip < 6; ip++) { |
| 47 |
if (_trkNuclei->GetTrkTrack()->XGood(ip) && _trkNuclei->GetTrkTrack()->XGood(ip)) |
if (_trkNuclei->GetTrkTrack()->XGood(ip) && _trkNuclei->GetTrkTrack()->XGood(ip)) |
| 48 |
nValid++; |
nValid++; |
| 49 |
} |
} |
| 50 |
if (nValid < _minLayers) |
if (nValid < _minLayers) |
| 51 |
return TRKNUCLEIZ_TOOFEWLAYERS; |
return TRKNUCLEIZ_TOOFEWLAYERS; |
| 52 |
|
|
| 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 |
switch (_method) { |
switch (_method) { |
| 58 |
case TRKNUCLEIZ_RIG: |
case TRKNUCLEIZ_RIG: |
| 59 |
charge = _trkNuclei->GetZ_Rigidity(); |
charge = _trkNuclei->GetZ_Rigidity(); |
| 60 |
meanZ = _meanRigMean[_Z-1]; |
meanLowZ = _meanRigMean[_lowZ-1]; |
| 61 |
sigmaZ = _sigmaRigMean[_Z-1]; |
sigmaLowZ = _sigmaRigMean[_lowZ-1]; |
| 62 |
|
if(range) { |
| 63 |
|
meanHighZ = _meanRigMean[_highZ-1]; |
| 64 |
|
sigmaHighZ = _sigmaRigMean[_highZ-1]; |
| 65 |
|
} |
| 66 |
break; |
break; |
| 67 |
case TRKNUCLEIZ_BETA: |
case TRKNUCLEIZ_BETA: |
| 68 |
charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]); |
charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]); |
| 69 |
meanZ = _meanBetaMean[_Z-1]; |
meanLowZ = _meanBetaMean[_Z-1]; |
| 70 |
sigmaZ = _sigmaBetaMean[_Z-1]; |
sigmaLowZ = _sigmaBetaMean[_Z-1]; |
| 71 |
|
if(range) { |
| 72 |
|
meanHighZ = _meanBetaMean[_highZ-1]; |
| 73 |
|
sigmaHighZ = _sigmaBetaMean[_highZ-1]; |
| 74 |
|
} |
| 75 |
|
|
| 76 |
break; |
break; |
| 77 |
} |
} |
| 78 |
|
|
| 79 |
if ((charge > meanZ + _upperLimit * sigmaZ) || (charge < meanZ - _lowerLimit * sigmaZ)) { |
if(!range) { |
| 80 |
return TRKNUCLEIZ_OUTOFBOUNDS; |
if ((charge > meanLowZ + _upperLimit * sigmaLowZ) || (charge < meanLowZ - _lowerLimit * sigmaLowZ)) { |
| 81 |
|
return TRKNUCLEIZ_OUTOFBOUNDS; |
| 82 |
|
} |
| 83 |
|
} |
| 84 |
|
else { |
| 85 |
|
if ((charge > meanHighZ + _upperLimit * sigmaHighZ) || (charge < meanLowZ - _lowerLimit * sigmaLowZ)) { |
| 86 |
|
return TRKNUCLEIZ_OUTOFBOUNDS; |
| 87 |
|
} |
| 88 |
} |
} |
|
|
|
| 89 |
} |
} |
| 90 |
// ******** Check the charge value from each plane ******** |
// ******** Check the charge value from each plane ******** |
| 91 |
// 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 |
| 92 |
// is sufficient. Implement an "if" cascade or a "switch" if another check method is necessary. |
// is sufficient. Implement an "if" cascade or a "switch" if another check method is necessary. |
| 93 |
|
|
| 94 |
else { |
else { |
| 95 |
Float_t charge[6] = { 0., 0., 0., 0., 0., 0. }; |
Float_t charge[6] = {0., 0., 0., 0., 0., 0.}; |
| 96 |
nValid = 0; |
nValid = 0; |
| 97 |
switch (_method) { |
switch (_method) { |
| 98 |
case TRKNUCLEIZ_RIG: |
case TRKNUCLEIZ_RIG: |
| 99 |
for (int ip = 0; ip < 6; ip++) { |
for (int ip = 0; ip < 6; ip++) { |
| 100 |
charge[ip] = _trkNuclei->GetZ_Rigidity(ip); |
charge[ip] = _trkNuclei->GetZ_Rigidity(ip); |
| 101 |
if (charge[ip] > 0.) { |
if (charge[ip] > 0.) { |
| 103 |
} |
} |
| 104 |
} |
} |
| 105 |
break; |
break; |
| 106 |
case TRKNUCLEIZ_BETA: |
case TRKNUCLEIZ_BETA: |
| 107 |
for (int ip = 0; ip < 6; ip++) { |
for (int ip = 0; ip < 6; ip++) { |
| 108 |
charge[ip] = _trkNuclei->GetZ_Beta(ip, event->GetTrack(0)->GetToFTrack()->beta[12]); |
charge[ip] = _trkNuclei->GetZ_Beta(ip, event->GetTrack(0)->GetToFTrack()->beta[12]); |
| 109 |
if (charge[ip] > 0.) { |
if (charge[ip] > 0.) { |
| 115 |
|
|
| 116 |
for (int ip = 0; ip < 6; ip++) { |
for (int ip = 0; ip < 6; ip++) { |
| 117 |
if (charge[ip] > 0.) // Check only good layers |
if (charge[ip] > 0.) // Check only good layers |
| 118 |
// 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 |
| 119 |
// we use the standard values use for mean dE/dx Vs. beta. |
// we use the standard values use for mean dE/dx Vs. beta. |
| 120 |
if ((charge[ip] > _Z + _upperLimit * _sigmaBetaMean[_Z - 1]) || (charge[ip] < _Z - _lowerLimit * _sigmaBetaMean[_Z - 1])) { |
if(!range) { |
| 121 |
|
if ((charge[ip] > _lowZ + _upperLimit * _sigmaBetaMean[_lowZ - 1]) || (charge[ip] < _lowZ - _lowerLimit * _sigmaBetaMean[_lowZ - 1])) { |
| 122 |
return TRKNUCLEIZ_OUTOFBOUNDS; |
return TRKNUCLEIZ_OUTOFBOUNDS; |
| 123 |
} |
} |
| 124 |
|
} |
| 125 |
|
else { |
| 126 |
|
if ((charge[ip] > _highZ + _upperLimit * _sigmaBetaMean[_highZ - 1]) || (charge[ip] < _lowZ - _lowerLimit * _sigmaBetaMean[_lowZ - 1])) { |
| 127 |
|
return TRKNUCLEIZ_OUTOFBOUNDS; |
| 128 |
|
} |
| 129 |
|
} |
| 130 |
} |
} |
| 131 |
} |
} |
| 132 |
|
|