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

Contents of /PamCut/TofCuts/TofNucleiZCut/TofNucleiZCut.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed May 27 13:30:09 2009 UTC (15 years, 6 months ago) by pam-fi
Branch: MAIN
Branch point for: DEV
Initial revision

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

  ViewVC Help
Powered by ViewVC 1.1.23