1 |
pam-de |
1.14 |
/** |
2 |
|
|
* \file ToFLevel2.h |
3 |
|
|
* \author Gianfranca DeRosa / Wolfgang Menn |
4 |
|
|
*/ |
5 |
|
|
|
6 |
mocchiut |
1.1 |
#ifndef ToFLevel2_h |
7 |
|
|
#define ToFLevel2_h |
8 |
|
|
// |
9 |
|
|
#include <TObject.h> |
10 |
mocchiut |
1.4 |
#include <TArrayI.h> |
11 |
|
|
#include <TArrayF.h> |
12 |
mocchiut |
1.1 |
#include <TClonesArray.h> |
13 |
pam-fi |
1.6 |
|
14 |
mocchiut |
1.18 |
#include <math.h> // EMILIANO |
15 |
|
|
|
16 |
pam-fi |
1.6 |
#include <ToFStruct.h> |
17 |
pam-de |
1.14 |
|
18 |
|
|
|
19 |
mocchiut |
1.1 |
// |
20 |
|
|
// class which contains track related variables |
21 |
|
|
// |
22 |
|
|
#define ZTOF11 53.74 |
23 |
|
|
#define ZTOF12 53.04 |
24 |
|
|
#define ZTOF21 23.94 |
25 |
|
|
#define ZTOF22 23.44 |
26 |
|
|
#define ZTOF31 -23.49 |
27 |
|
|
#define ZTOF32 -24.34 |
28 |
|
|
|
29 |
mocchiut |
1.4 |
|
30 |
pam-de |
1.14 |
/** |
31 |
|
|
* \brief Class which contains the PMT data |
32 |
|
|
* |
33 |
pam-de |
1.15 |
* If there is a valid ADC or a TDC value (value<4095) for a PMT, both ADC and TDC data |
34 |
|
|
* are stored in the PMT class. |
35 |
|
|
* Look in the ToFLevel2Ex.cxx example in the repository how to read the PMT class. |
36 |
pam-de |
1.14 |
*/ |
37 |
mocchiut |
1.4 |
class ToFPMT : public TObject { |
38 |
pam-de |
1.14 |
|
39 |
mocchiut |
1.4 |
private: |
40 |
|
|
|
41 |
|
|
public: |
42 |
pam-de |
1.14 |
Int_t pmt_id; ///<the identification number of the PMT from 0 to 47 |
43 |
pam-de |
1.15 |
Float_t adc; ///<raw ADC value for this PMT |
44 |
mocchiut |
1.17 |
Float_t tdc; ///<raw TDC value for this PMT |
45 |
pam-de |
1.15 |
Float_t tdc_tw; ///<time-walk corrected TDC value for this PMT |
46 |
mocchiut |
1.4 |
// |
47 |
|
|
ToFPMT(); |
48 |
|
|
ToFPMT(const ToFPMT&); |
49 |
|
|
// |
50 |
|
|
ToFPMT* GetToFPMT(){return this;}; |
51 |
mocchiut |
1.19 |
void Clear(Option_t *t=""); |
52 |
mocchiut |
1.4 |
|
53 |
pam-de |
1.14 |
|
54 |
mocchiut |
1.13 |
|
55 |
mocchiut |
1.17 |
ClassDef(ToFPMT,2); |
56 |
mocchiut |
1.4 |
}; |
57 |
|
|
|
58 |
|
|
|
59 |
pam-de |
1.14 |
/** |
60 |
pam-de |
1.15 |
* \brief Class which contains the tracker related variables |
61 |
pam-de |
1.14 |
* |
62 |
pam-de |
1.15 |
* We can use the ToF standalone to find hitted paddles, calculate beta, etc.. |
63 |
|
|
* These results are then stored with the "trkseqno" = -1. |
64 |
|
|
* If we use the track from the tracker, then the penetration points in the |
65 |
|
|
* scintillators are calculated, which defines the hitted paddles. For these paddles |
66 |
|
|
* we calculate then all the output. |
67 |
|
|
* Note: The artificial ADC values are stored as dEdx in the output, the dEdx will be |
68 |
|
|
* by definition = 1. However, the artificial TDC values are just used internally |
69 |
|
|
* and not stored in the output. But one can see in both cases which PMT has artificial |
70 |
|
|
* values using "adcflag" and "tdcflag". |
71 |
|
|
* Look in the ToFLevel2Ex.cxx example in the repository how to read the tracker related |
72 |
|
|
* variables. |
73 |
pam-de |
1.14 |
*/ |
74 |
mocchiut |
1.1 |
class ToFTrkVar : public TObject { |
75 |
pam-de |
1.14 |
|
76 |
mocchiut |
1.1 |
private: |
77 |
|
|
|
78 |
|
|
public: |
79 |
mocchiut |
1.13 |
// |
80 |
pam-de |
1.14 |
Int_t trkseqno; ///< tracker sequ. number: -1=ToF standalone, 0=first Tracker track, ... |
81 |
mocchiut |
1.1 |
// |
82 |
pam-de |
1.15 |
Int_t npmttdc; ///<number of the TDC measurements used to evaluate beta |
83 |
|
|
TArrayI pmttdc; ///<contains the ID (0..47) for the PMT used to evaluate beta |
84 |
|
|
TArrayI tdcflag; ///<flag for artificial TDC, "0" if normal TDC value |
85 |
|
|
|
86 |
|
|
/** |
87 |
mocchiut |
1.20 |
* \brief beta, 12 measurements for the 12 combinations, beta[13] is modified weighted mean |
88 |
pam-de |
1.15 |
* |
89 |
|
|
* The 12 measurements are S11-S31, S11-S32, S12-S31, S12-S32, and then analogue for |
90 |
|
|
* S2-S3 and S1-S2. |
91 |
mocchiut |
1.20 |
* The calculation of beta[13] is now modified: |
92 |
|
|
* We check the individual weights for artificial TDC values, then calculate |
93 |
|
|
* am mean beta for the first time. In a second step we loop again through |
94 |
|
|
* the single measurements, checking for the residual from the mean |
95 |
|
|
* The cut on the residual reject measurements > "x"-sigma. A chi2 value is |
96 |
|
|
* calculated, furthermore a "quality" value by adding the weights which |
97 |
|
|
* are finally used. If all measurements are taken, "quality" will be = 505. |
98 |
|
|
* A chi2 cut around 3-4 and a quality-cut > 400 is needed for clean beta |
99 |
|
|
* The Level2 beta[12] which is derived in the fortran routines uses: 10.,200.,20. |
100 |
|
|
* This is not a very high quality measurement. One can re-calculate a new beta[13] |
101 |
|
|
* using the L2-method "CalcBeta" |
102 |
pam-de |
1.15 |
*/ |
103 |
|
|
Float_t beta[13]; |
104 |
|
|
// |
105 |
|
|
Int_t npmtadc; ///<number of the ADC measurements used for dEdx evaluation |
106 |
|
|
TArrayI pmtadc; ///<contains the ID (0..47) for the PMT used to evaluate dEdx |
107 |
|
|
TArrayI adcflag; ///<flag for artificial ADCs, "0" if normal ADC value |
108 |
|
|
TArrayF dedx; ///<energy loss for this PMT in mip |
109 |
mocchiut |
1.4 |
// |
110 |
pam-de |
1.15 |
Float_t xtofpos[3]; ///<x-measurement using the TDC values and the calibration from S12, S21, S32 |
111 |
|
|
Float_t ytofpos[3]; ///<x-measurement using the TDC values and the calibration from S11, S22, S31 |
112 |
mocchiut |
1.16 |
// |
113 |
|
|
Float_t xtr_tof[6]; ///<x-measurement in the ToF layers from tracker |
114 |
|
|
Float_t ytr_tof[6]; ///<x-measurement in the ToF layers from tracker |
115 |
mocchiut |
1.1 |
// |
116 |
|
|
ToFTrkVar(); |
117 |
|
|
ToFTrkVar(const ToFTrkVar&); |
118 |
pam-de |
1.14 |
|
119 |
mocchiut |
1.1 |
ToFTrkVar* GetToFTrkVar(){return this;}; |
120 |
mocchiut |
1.19 |
void Clear(Option_t *t=""); |
121 |
mocchiut |
1.4 |
|
122 |
mocchiut |
1.1 |
ClassDef(ToFTrkVar,1); |
123 |
|
|
// |
124 |
|
|
}; |
125 |
|
|
|
126 |
pam-de |
1.14 |
/** |
127 |
|
|
* \brief Class to describe ToF LEVEL2 data |
128 |
|
|
* |
129 |
|
|
*/ |
130 |
|
|
|
131 |
mocchiut |
1.1 |
class ToFLevel2 : public TObject { |
132 |
|
|
private: |
133 |
pam-de |
1.14 |
|
134 |
mocchiut |
1.1 |
public: |
135 |
mocchiut |
1.4 |
// |
136 |
pam-de |
1.14 |
TClonesArray *PMT; ///<class needed to store PMT hit informations |
137 |
|
|
TClonesArray *ToFTrk; ///<track related variable class |
138 |
|
|
Int_t tof_j_flag[6]; ///<number of hitted paddle(s) for each ToF layer: flag = flag + 2**(paddlenumber-1) |
139 |
mocchiut |
1.17 |
// |
140 |
|
|
Int_t unpackError;///< zero if no error presente |
141 |
|
|
Int_t default_calib; ///< one if the default calibration has been used to process the data, zero otherwise |
142 |
mocchiut |
1.1 |
// |
143 |
mocchiut |
1.16 |
Float_t GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl); // gf Apr 07 |
144 |
mocchiut |
1.20 |
|
145 |
|
|
Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut); // wm feb 08 |
146 |
|
|
|
147 |
|
|
// |
148 |
|
|
// Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t chi2cut, Float_t qualitycut); // wm feb 08 |
149 |
mocchiut |
1.1 |
// |
150 |
|
|
// methods to make life simplier during the analysis, returns a pointer to the ToFTrkVar class containing track related variables |
151 |
|
|
// |
152 |
|
|
Int_t ntrk(){return ToFTrk->GetEntries();}; |
153 |
mocchiut |
1.4 |
Int_t npmt(){return PMT->GetEntries();}; |
154 |
pam-de |
1.14 |
|
155 |
mocchiut |
1.1 |
// |
156 |
pam-fi |
1.6 |
void GetLevel2Struct(cToFLevel2 *) const; |
157 |
|
|
// |
158 |
pam-de |
1.14 |
ToFTrkVar *GetToFTrkVar(Int_t notrack); |
159 |
|
|
ToFPMT *GetToFPMT(Int_t nohit); |
160 |
mocchiut |
1.4 |
Int_t GetPMTid(Int_t gg, Int_t hh); |
161 |
|
|
TString GetPMTName(Int_t ind); |
162 |
mocchiut |
1.16 |
|
163 |
mocchiut |
1.4 |
Int_t GetPlaneIndex(Int_t pmt_id); |
164 |
|
|
void GetMatrix(Int_t notrack, Float_t adc[4][12], Float_t tdc[4][12]); |
165 |
mocchiut |
1.5 |
void GetPMTIndex(Int_t pmt_id, Int_t &gg, Int_t &hh); |
166 |
mocchiut |
1.16 |
|
167 |
|
|
// gf Apr 07 |
168 |
|
|
void GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning); // gf Apr 07 |
169 |
|
|
TString GetPMTName(Int_t ind, Int_t &iplane, Int_t &ipaddle,Int_t &ipmt); |
170 |
|
|
Int_t GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane); // gf Apr 07 |
171 |
|
|
void GetPMTPaddle(Int_t pmt_id, Int_t &plane, Int_t &paddle); // gf Apr 07 |
172 |
|
|
void GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright); // gf Apr 07 |
173 |
|
|
void GetPaddleGeometry(Int_t plane, Int_t paddle, Float_t &xleft, Float_t &xright, Float_t &yleft, Float_t &yright); // gf Apr 07 |
174 |
|
|
Int_t GetPaddleid(Int_t plane, Int_t paddle); |
175 |
|
|
void GetPaddlePlane(Int_t padid, Int_t &plane, Int_t &paddle); |
176 |
|
|
Int_t GetNPaddle(Int_t plane); |
177 |
|
|
// |
178 |
mocchiut |
1.20 |
// |
179 |
mocchiut |
1.16 |
|
180 |
mocchiut |
1.1 |
// |
181 |
|
|
// constructor |
182 |
|
|
// |
183 |
|
|
ToFLevel2(); |
184 |
mocchiut |
1.13 |
~ToFLevel2(){Delete();}; //ELENA |
185 |
mocchiut |
1.19 |
void Delete(Option_t *t=""); //ELENA |
186 |
mocchiut |
1.13 |
void Set();//ELENA |
187 |
mocchiut |
1.1 |
// |
188 |
|
|
// |
189 |
|
|
ToFLevel2* GetToFLevel2(){return this;}; |
190 |
pam-de |
1.14 |
|
191 |
|
|
/** |
192 |
pam-de |
1.15 |
* Method to get the z-position of the 6 TOF layers from the plane ID |
193 |
pam-de |
1.14 |
* @param plane_id Plane ID (11 12 21 22 31 32) |
194 |
|
|
*/ |
195 |
mocchiut |
1.4 |
Float_t GetZTOF(Int_t plane_id){ |
196 |
mocchiut |
1.1 |
switch(plane_id){ |
197 |
|
|
case 11: return ZTOF11; |
198 |
|
|
case 12: return ZTOF12; |
199 |
|
|
case 21: return ZTOF21; |
200 |
|
|
case 22: return ZTOF22; |
201 |
|
|
case 31: return ZTOF31; |
202 |
|
|
case 32: return ZTOF32; |
203 |
|
|
default: return 0.; |
204 |
|
|
}; |
205 |
mocchiut |
1.4 |
}; |
206 |
pam-de |
1.14 |
|
207 |
mocchiut |
1.1 |
// |
208 |
|
|
// Paddles position |
209 |
|
|
// |
210 |
|
|
/* |
211 |
|
|
S11 8 paddles 33.0 x 5.1 cm |
212 |
|
|
S12 6 paddles 40.8 x 5.5 cm |
213 |
|
|
S21 2 paddles 18.0 x 7.5 cm |
214 |
|
|
S22 2 paddles 15.0 x 9.0 cm |
215 |
|
|
S31 3 paddles 15.0 x 6.0 cm |
216 |
|
|
S32 3 paddles 18.0 x 5.0 cm |
217 |
|
|
*/ |
218 |
pam-de |
1.14 |
|
219 |
mocchiut |
1.1 |
Int_t GetToFPlaneID(Int_t ip); |
220 |
|
|
Int_t GetToFPlaneIndex(Int_t plane_id); |
221 |
|
|
Bool_t HitPaddle(Int_t ,Int_t); |
222 |
|
|
Int_t GetNHitPaddles(Int_t plane); |
223 |
mocchiut |
1.19 |
void Clear(Option_t *t=""); |
224 |
mocchiut |
1.1 |
// |
225 |
mocchiut |
1.17 |
ClassDef(ToFLevel2,3); |
226 |
mocchiut |
1.1 |
}; |
227 |
|
|
|
228 |
|
|
#endif |
229 |
pam-de |
1.14 |
|