/[PAMELA software]/PamCut/TofCuts/TofNucleiZCut/TofNucleiZCut.cpp
ViewVC logotype

Annotation of /PamCut/TofCuts/TofNucleiZCut/TofNucleiZCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations) (download)
Wed Aug 5 14:05:34 2009 UTC (15 years, 4 months ago) by pam-fi
Branch: MAIN
CVS Tags: Root_V8, MergedToHEAD_1, nuclei_reproc, MergedFromV8_1, BeforeMergingFromV8_1, V9, HEAD
Branch point for: V8
Changes since 1.1: +51 -52 lines
Layers' codes now are taken from CommonDefs.h

1 pam-fi 1.1 /*
2     * TofNucleiZCut.cpp
3     *
4     * Created on: 21-apr-2009
5     * Author: Nicola Mori
6     */
7    
8     #ifndef NO_TOFNUCLEI
9    
10     /*! @file TofNucleiZCut.cpp The TofNucleiZCut class implementation file */
11    
12     #include "TofNucleiZCut.h"
13    
14     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
15 pam-fi 1.2 const unsigned int TofNucleiZCut::_maskArray[] = { S11, S12, S21, S22, S31, S32 }; //The layer - mask code association
16 pam-fi 1.1
17    
18 pam-fi 1.2 TofNucleiZCut::TofNucleiZCut(const char *cutName, unsigned int Z, float lowerLimit, float upperLimit,
19     unsigned int minLayers, unsigned int layersMask) :
20     PamCut(cutName), _Z(Z), _mean(8, 6), _sigma(8, 6), _lowerLimit(lowerLimit), _upperLimit(upperLimit), _minLayers(
21     minLayers), _layersMask(layersMask), _tofNuclei(NULL) {
22    
23     //TODO Put calibration parameters on a file; load only those parameters needed for the current Z.
24    
25     // Hard-coded calibrations
26     // H
27     _mean[0][0] = 0.987; // S11 peak
28     _sigma[0][0] = 0.11; // S11 sigma
29     _mean[0][1] = 0.988; // S12 peak
30     _sigma[0][1] = 0.12; // S12 sigma
31     _mean[0][2] = 0.961; // S21 peak
32     _sigma[0][2] = 0.083;// S21 sigma
33     _mean[0][3] = 0.966; // S22 peak
34     _sigma[0][3] = 0.10; // S22 sigma
35     _mean[0][4] = 0.981; // S31 peak
36     _sigma[0][4] = 0.092;// S31 sigma
37     _mean[0][5] = 0.979; // S32 peak
38     _sigma[0][5] = 0.095;// S32 sigma
39    
40     // He
41     _mean[1][0] = 1.96; // S11 peak
42     _sigma[1][0] = 0.12;// S11 sigma
43     _mean[1][1] = 1.95; // S12 peak
44     _sigma[1][1] = 0.14;// S12 sigma
45     _mean[1][2] = 1.95; // S21 peak
46     _sigma[1][2] = 0.13;// S21 sigma
47     _mean[1][3] = 1.96; // S22 peak
48     _sigma[1][3] = 0.14;// S22 sigma
49     _mean[1][4] = 1.99; // S31 peak
50     _sigma[1][4] = 0.14;// S31 sigma
51     _mean[1][5] = 2.00; // S32 peak
52     _sigma[1][5] = 0.15;// S32 sigma
53    
54     // Heavier nuclei are not calibrated yet; using default values
55     for (unsigned int z = 3; z < 9; z++) {
56     for (int i = 0; i < 6; i++) {
57     _mean[z - 1][i] = z;
58     _sigma[z - 1][i] = _sigmaZdefault[z - 1];
59 pam-fi 1.1 }
60 pam-fi 1.2 }
61 pam-fi 1.1
62     #ifdef DEBUGPAMCUT
63    
64 pam-fi 1.2 TString hId;
65     TString hTitle;
66 pam-fi 1.1
67 pam-fi 1.2 for (UInt_t j = 0; j < 12; j++) {
68     hId.Form("h_tof_z_vs_beta_%i", j);
69     hTitle.Form("TOF Z vs beta (%i)", j);
70     h_tof_z_beta[j] = new TH2F(hId.Data(), hTitle.Data(), 50, 0, 1, 50, 0, 10);
71     }
72 pam-fi 1.1
73     #endif
74    
75 pam-fi 1.2 }
76 pam-fi 1.1
77     int TofNucleiZCut::Check(PamLevel2 *event) {
78    
79     if (_Z < 1 || _Z > 8)
80     return TOFNUCLEIZ_ILLEGALZ;
81    
82     // Check if ToFNuclei has already been initialized
83     if (_tofNuclei == NULL)
84     _tofNuclei = new ToFNuclei(event);
85    
86     Float_t *charge = _tofNuclei->Get_Charge_ToF_std_layer(); //Returns a 6 elements array
87     unsigned int nGood = 0;
88     bool good[6];
89    
90     #ifdef DEBUGPAMCUT
91     Int_t seqno = event->GetTrack(0)->GetTrkTrack()->GetSeqNo();
92     Int_t ntrack_tof = 0;
93     for (Int_t i=0; i<event->GetToFLevel2()->ntrk(); i++) {
94     if ( event->GetToFLevel2()->GetToFTrkVar(i)->trkseqno == seqno ) ntrack_tof = i;
95     }
96     Float_t beta=event->GetToFLevel2()->CalcBeta(ntrack_tof,10.,10.,20.); // beta[12]
97     #endif
98    
99     #ifdef DEBUGPAMCUT
100     for (int i = 0; i < 6; i++) {
101     h_tof_z_beta[i]->Fill(beta, charge[i]);
102     }
103     #endif
104    
105     for (int i = 0; i < 6; i++) { // determine good, non-masked layers
106     if ((charge[i] < 1000) && (charge[i] > 0) && ((_maskArray[i] & _layersMask) != _maskArray[i])) {
107     good[i] = true;
108     nGood++;
109     }
110     else {
111     good[i] = false;
112     }
113     }
114    
115     if (nGood < _minLayers) {
116     return TOFNUCLEIZ_TOOFEWLAYERS;
117     }
118    
119     for (int i = 0; i < 6; i++) { // check done only for good, non-masked layers
120     if (good[i]) {
121     if ((charge[i] > _mean[_Z - 1][i] + _upperLimit * _sigma[_Z - 1][i]) || ((charge[i] < _mean[_Z - 1][i]
122     - _lowerLimit * _sigma[_Z - 1][i]))) {
123     return TOFNUCLEIZ_OUTOFBOUNDS;
124     }
125     }
126     }
127    
128     #ifdef DEBUGPAMCUT
129     for (int i = 0; i < 6; i++) {
130     h_tof_z_beta[6+i]->Fill(beta, charge[i]);
131     }
132     #endif
133    
134     return CUTOK;
135    
136     }
137    
138     #endif /* NO_TOFNUCLEI */

  ViewVC Help
Powered by ViewVC 1.1.23