PamCut: TrkCuts/TrkNucleiZCut/TrkNucleiZCut.cpp Source File

- Main Page
- Classes
- Files

- File List
- File Members

# TrkCuts/TrkNucleiZCut/TrkNucleiZCut.cpp

Go to the documentation of this file.

    00001 /*
    00002  * TrkNucleiZCut.cpp
    00003  *
    00004  *  Created on: 10-mag-2009
    00005  *      Author: Nicola Mori
    00006  */
    00007
    00009 #ifndef NO_TRKNUCLEI
    00010
    00011 #include "TrkNucleiZCut.h"
    00012
    00013 const float TrkNucleiZCut::_meanRigMean[] = { .992, 1.99, 3., 4., 5., 6. }; // the charge distribution peak for Z=1..6
    00014 const float TrkNucleiZCut::_sigmaRigMean[] = { 0.06, 0.1, 0.17, 0.34, 0.44, 0.59 }; // the charge-width for Z=1..6
    00015
    00016 const float TrkNucleiZCut::_meanBetaMean[] = { 1., 2., 3., 4., 5., 6. }; // the charge distribution peak for Z=1..6
    00017 const float TrkNucleiZCut::_sigmaBetaMean[] = { 0.09, 0.1, 0.17, 0.34, 0.44, 0.59 }; // the charge-width for Z=1..6
    00018
    00019
    00020 int TrkNucleiZCut::Check(PamLevel2 *event) {
    00021
    00022   if (_Z < 1 || _Z > 6)
    00023     return TRKNUCLEIZ_ILLEGALZ;
    00024
    00025   // ******** Check if TrkNuclei has already been initialized ********
    00026   if (_trkNuclei == NULL)
    00027     _trkNuclei = new TrkNuclei();
    00028   _trkNuclei->Set(event->GetTrack(0)->GetTrkTrack());
    00029
    00030   // ******** First of all, check if the minimum number of planes is matched. ********
    00031   // NOTE: in current implementation a plane is considered valid if it is tagged as good in Tracker level 2
    00032   //       routines. This should correspond to a valid charge.
    00033   // TODO Check the above statement.
    00034
    00035   // Prepare the valid charges counter
    00036   unsigned int nValid = 0;
    00037   for (unsigned int ip = 0; ip < 6; ip++) {
    00038     if (_trkNuclei->GetTrkTrack()->XGood(ip) && _trkNuclei->GetTrkTrack()->XGood(ip))
    00039       nValid++;
    00040   }
    00041   if (nValid < _minLayers)
    00042     return TRKNUCLEIZ_TOOFEWLAYERS;
    00043
    00044   // ******** Check the mean charge value ********
    00045   if (_howToCheck == TRKNUCLEIZ_CHECKMEAN) {
    00046
    00047     Float_t charge, meanZ, sigmaZ;
    00048     switch (_method) {
    00049     case TRKNUCLEIZ_RIG:
    00050       charge = _trkNuclei->GetZ_Rigidity();
    00051       meanZ = _meanRigMean[_Z-1];
    00052       sigmaZ = _sigmaRigMean[_Z-1];
    00053       break;
    00054     case TRKNUCLEIZ_BETA:
    00055       charge = _trkNuclei->GetZ_Beta(event->GetTrack(0)->GetToFTrack()->beta[12]);
    00056       meanZ = _meanBetaMean[_Z-1];
    00057       sigmaZ = _sigmaBetaMean[_Z-1];
    00058       break;
    00059     }
    00060
    00061     if ((charge > meanZ + _upperLimit * sigmaZ) || (charge < meanZ - _lowerLimit * sigmaZ)) {
    00062       return TRKNUCLEIZ_OUTOFBOUNDS;
    00063     }
    00064
    00065   }
    00066   // ******** Check the charge value from each plane ********
    00067   // NB. In current implementation only 2 check methods (mean and single values) are used, so an "else" statement
    00068   //     is sufficient. Implement an "if" cascade or a "switch" if another check method is necessary.
    00069
    00070   else {
    00071     Float_t charge[6] = { 0., 0., 0., 0., 0., 0. };
    00072     nValid = 0;
    00073     switch (_method) {
    00074     case TRKNUCLEIZ_RIG:
    00075       for (int ip = 0; ip < 6; ip++) {
    00076         charge[ip] = _trkNuclei->GetZ_Rigidity(ip);
    00077         if (charge[ip] > 0.) {
    00078           nValid++;
    00079         }
    00080       }
    00081       break;
    00082     case TRKNUCLEIZ_BETA:
    00083       for (int ip = 0; ip < 6; ip++) {
    00084         charge[ip] = _trkNuclei->GetZ_Beta(ip, event->GetTrack(0)->GetToFTrack()->beta[12]);
    00085         if (charge[ip] > 0.) {
    00086           nValid++;
    00087         }
    00088       }
    00089       break;
    00090     }
    00091
    00092     for (int ip = 0; ip < 6; ip++) {
    00093       if (charge[ip] > 0.) // Check only good layers
    00094         // Currently, no calibration for single layers is available. Z is used as a mean value, while for sigma
    00095         // we use the standard values use for mean dE/dx Vs. beta.
    00096         if ((charge[ip] > _Z + _upperLimit * _sigmaBetaMean[_Z - 1]) || (charge[ip] < _Z - _lowerLimit * _sigmaBetaMean[_Z - 1])) {
    00097           return TRKNUCLEIZ_OUTOFBOUNDS;
    00098         }
    00099     }
    00100   }
    00101
    00102   return CUTOK;
    00103
    00104 }
    00105
    00106 #endif /* NO_TRKNUCLEI */