PamCut: TofCuts/TofNucleiZCut/TofNucleiZCut.cpp Source File

- Main Page
- Classes
- Files

- File List
- File Members

# TofCuts/TofNucleiZCut/TofNucleiZCut.cpp

Go to the documentation of this file.

    00001 /*
    00002  * TofNucleiZCut.cpp
    00003  *
    00004  *  Created on: 21-apr-2009
    00005  *      Author: Nicola Mori
    00006  */
    00007
    00008 #ifndef NO_TOFNUCLEI
    00009
    00012 #include "TofNucleiZCut.h"
    00013
    00014 const float TofNucleiZCut::_sigmaZdefault[] = { 0.12, 0.15, 0.20, 0.25, 0.32, 0.40, 0.45, 0.50 }; // the charge-width in a layer for Z=1..8
    00015 const unsigned int TofNucleiZCut::_maskArray[] = { TOFNUCLEIZ_S11, TOFNUCLEIZ_S12, TOFNUCLEIZ_S21, TOFNUCLEIZ_S22,
    00016     TOFNUCLEIZ_S31, TOFNUCLEIZ_S32 }; //The layer - mask code association
    00017
    00018
    00019 TofNucleiZCut::TofNucleiZCut(const char *cutName, unsigned int Z, float lowerLimit, float upperLimit, unsigned int minLayers,
    00020       unsigned int layersMask) :
    00021     PamCut(cutName), _Z(Z), _mean(8, 6), _sigma(8, 6), _lowerLimit(lowerLimit), _upperLimit(upperLimit), _minLayers(
    00022         minLayers), _layersMask(layersMask), _tofNuclei(NULL) {
    00023
    00024     //TODO Put calibration parameters on a file; load only those parameters needed for the current Z.
    00025
    00026     // Hard-coded calibrations
    00027     // H
    00028     _mean[0][0] = 0.987; // S11 peak
    00029     _sigma[0][0] = 0.11; // S11 sigma
    00030     _mean[0][1] = 0.988; // S12 peak
    00031     _sigma[0][1] = 0.12; // S12 sigma
    00032     _mean[0][2] = 0.961; // S21 peak
    00033     _sigma[0][2] = 0.083;// S21 sigma
    00034     _mean[0][3] = 0.966; // S22 peak
    00035     _sigma[0][3] = 0.10; // S22 sigma
    00036     _mean[0][4] = 0.981; // S31 peak
    00037     _sigma[0][4] = 0.092;// S31 sigma
    00038     _mean[0][5] = 0.979; // S32 peak
    00039     _sigma[0][5] = 0.095;// S32 sigma
    00040
    00041     // He
    00042     _mean[1][0] = 1.96; // S11 peak
    00043     _sigma[1][0] = 0.12;// S11 sigma
    00044     _mean[1][1] = 1.95; // S12 peak
    00045     _sigma[1][1] = 0.14;// S12 sigma
    00046     _mean[1][2] = 1.95; // S21 peak
    00047     _sigma[1][2] = 0.13;// S21 sigma
    00048     _mean[1][3] = 1.96; // S22 peak
    00049     _sigma[1][3] = 0.14;// S22 sigma
    00050     _mean[1][4] = 1.99; // S31 peak
    00051     _sigma[1][4] = 0.14;// S31 sigma
    00052     _mean[1][5] = 2.00; // S32 peak
    00053     _sigma[1][5] = 0.15;// S32 sigma
    00054
    00055     // Heavier nuclei are not calibrated yet; using default values
    00056     for (unsigned int z = 3; z < 9; z++) {
    00057       for (int i = 0; i < 6; i++) {
    00058         _mean[z - 1][i] = z;
    00059         _sigma[z - 1][i] = _sigmaZdefault[z - 1];
    00060       }
    00061     }
    00062
    00063 #ifdef DEBUGPAMCUT
    00064
    00065     TString hId;
    00066     TString hTitle;
    00067
    00068     for (UInt_t j = 0; j < 12; j++) {
    00069       hId.Form("h_tof_z_vs_beta_%i", j);
    00070       hTitle.Form("TOF Z vs beta (%i)", j);
    00071       h_tof_z_beta[j] = new TH2F(hId.Data(), hTitle.Data(), 50, 0, 1, 50, 0, 10);
    00072     }
    00073
    00074 #endif
    00075
    00076   }
    00077
    00078 int TofNucleiZCut::Check(PamLevel2 *event) {
    00079
    00080   if (_Z < 1 || _Z > 8)
    00081     return TOFNUCLEIZ_ILLEGALZ;
    00082
    00083   // Check if ToFNuclei has already been initialized
    00084   if (_tofNuclei == NULL)
    00085     _tofNuclei = new ToFNuclei(event);
    00086
    00087   Float_t *charge = _tofNuclei->Get_Charge_ToF_std_layer(); //Returns a 6 elements array
    00088   unsigned int nGood = 0;
    00089   bool good[6];
    00090
    00091 #ifdef DEBUGPAMCUT
    00092   Int_t seqno = event->GetTrack(0)->GetTrkTrack()->GetSeqNo();
    00093   Int_t ntrack_tof = 0;
    00094   for (Int_t i=0; i<event->GetToFLevel2()->ntrk(); i++) {
    00095     if ( event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == seqno ) ntrack_tof = i;
    00096   }
    00097   Float_t beta=event->GetToFLevel2()->CalcBeta(ntrack_tof,10.,10.,20.); // beta[12]
    00098 #endif
    00099
    00100 #ifdef DEBUGPAMCUT
    00101   for (int i = 0; i < 6; i++) {
    00102     h_tof_z_beta[i]->Fill(beta, charge[i]);
    00103   }
    00104 #endif
    00105
    00106   for (int i = 0; i < 6; i++) { // determine good, non-masked layers
    00107     if ((charge[i] < 1000) && (charge[i] > 0) && ((_maskArray[i] & _layersMask) != _maskArray[i])) {
    00108       good[i] = true;
    00109       nGood++;
    00110     }
    00111     else {
    00112       good[i] = false;
    00113     }
    00114   }
    00115
    00116   if (nGood < _minLayers) {
    00117     return TOFNUCLEIZ_TOOFEWLAYERS;
    00118   }
    00119
    00120   for (int i = 0; i < 6; i++) { // check done only for good, non-masked layers
    00121     if (good[i]) {
    00122       if ((charge[i] > _mean[_Z - 1][i] + _upperLimit * _sigma[_Z - 1][i]) || ((charge[i] < _mean[_Z - 1][i]
    00123           - _lowerLimit * _sigma[_Z - 1][i]))) {
    00124         return TOFNUCLEIZ_OUTOFBOUNDS;
    00125       }
    00126     }
    00127   }
    00128
    00129 #ifdef DEBUGPAMCUT
    00130   for (int i = 0; i < 6; i++) {
    00131     h_tof_z_beta[6+i]->Fill(beta, charge[i]);
    00132   }
    00133 #endif
    00134
    00135   return CUTOK;
    00136
    00137 }
    00138
    00139 #endif /* NO_TOFNUCLEI */