1 |
/** |
/** |
2 |
* \file ToFLevel2.h |
* \file ToFLevel2.h |
3 |
* \author Gianfranca DeRosa / Wolfgang Menn |
* \author Gianfranca DeRosa / Wolfgang Menn / Rita Carbone with E. M. supervision |
4 |
*/ |
*/ |
5 |
|
|
6 |
#ifndef ToFLevel2_h |
#ifndef ToFLevel2_h |
12 |
#include <TClonesArray.h> |
#include <TClonesArray.h> |
13 |
|
|
14 |
#include <math.h> // EMILIANO |
#include <math.h> // EMILIANO |
15 |
|
#include <iostream> // from ToFLevel2.cpp |
16 |
|
#include <fstream> // Emiliano |
17 |
|
#include <sstream> // Emiliano |
18 |
|
#include <string> // Emiliano |
19 |
|
|
20 |
|
|
21 |
#include <ToFStruct.h> |
#include <ToFStruct.h> |
22 |
|
|
23 |
|
#include <TrkLevel2.h> // Emiliano |
24 |
|
#include <TrigLevel2.h> // Emiliano |
25 |
|
#include <GLTables.h> // Emiliano |
26 |
|
#include <OrbitalInfo.h> // Emiliano |
27 |
|
#include <ToFCore.h> // Emiliano |
28 |
|
#include <physics/tof/TofEvent.h> |
29 |
|
|
30 |
|
// |
31 |
|
// Declaration of the core fortran routines |
32 |
|
// |
33 |
|
#define tofl2com tofl2com_ |
34 |
|
extern "C" int tofl2com(); |
35 |
|
#define toftrk toftrk_ |
36 |
|
extern "C" int toftrk(); |
37 |
|
#define rdtofcal rdtofcal_ |
38 |
|
//extern "C" int rdtofcal(char [], int *); |
39 |
|
extern "C" int rdtofcal(const char *, int *); |
40 |
|
|
41 |
// |
// |
42 |
// class which contains track related variables |
// class which contains track related variables |
49 |
#define ZTOF32 -24.34 |
#define ZTOF32 -24.34 |
50 |
|
|
51 |
|
|
52 |
|
class ToFGeom : public TObject { |
53 |
|
|
54 |
|
private: |
55 |
|
TArrayI ePlane, eXY; |
56 |
|
|
57 |
|
public: |
58 |
|
ToFGeom() { |
59 |
|
int plane[24] = { |
60 |
|
0, 0, 0, 0, 0, 0, 0, 0, |
61 |
|
1, 1, 1, 1, 1, 1, |
62 |
|
2, 2, |
63 |
|
3, 3, |
64 |
|
4, 4, 4, |
65 |
|
5, 5, 5 |
66 |
|
}; |
67 |
|
int plXY[6]= { 2, 1, 1, 2, 2, 1 }; // X==1, Y==2 */ |
68 |
|
ePlane.Set(24,plane); |
69 |
|
eXY.Set(6,plXY); |
70 |
|
} |
71 |
|
|
72 |
|
int GetPad( int idpmt) { return (int)((idpmt+0.5)/2.); } |
73 |
|
int GetPlane( int idpmt) { return ePlane[ GetPad(idpmt) ]; } |
74 |
|
int GetXY( int idpmt) { return eXY[ GetPlane(idpmt) ]; } |
75 |
|
|
76 |
|
ClassDef(ToFGeom,1); |
77 |
|
|
78 |
|
}; |
79 |
|
|
80 |
|
|
81 |
/** |
/** |
82 |
* \brief Class which contains the PMT data |
* \brief Class which contains the PMT data |
83 |
* |
* |
91 |
|
|
92 |
public: |
public: |
93 |
Int_t pmt_id; ///<the identification number of the PMT from 0 to 47 |
Int_t pmt_id; ///<the identification number of the PMT from 0 to 47 |
94 |
Float_t adc; ///<raw ADC value for this PMT |
Float_t adc; ///<raw ADC value for this PMT |
95 |
Float_t tdc; ///<raw TDC value for this PMT |
Float_t tdc; ///<raw TDC value for this PMT |
96 |
Float_t tdc_tw; ///<time-walk corrected TDC value for this PMT |
Float_t tdc_tw; ///<time-walk corrected TDC value for this PMT |
97 |
// |
// |
99 |
ToFPMT(const ToFPMT&); |
ToFPMT(const ToFPMT&); |
100 |
// |
// |
101 |
ToFPMT* GetToFPMT(){return this;}; |
ToFPMT* GetToFPMT(){return this;}; |
102 |
void Clear(); |
void Clear(Option_t *t=""); |
103 |
|
|
104 |
|
ClassDef(ToFPMT,2); |
105 |
|
}; |
106 |
|
|
107 |
|
/** |
108 |
|
* \brief Class used to calibrate adc to dEdx for each PMT |
109 |
|
* |
110 |
|
* Class used to calibrate adc to dEdx for each PMT |
111 |
|
*/ |
112 |
|
class ToFdEdx : public TObject { |
113 |
|
|
114 |
ClassDef(ToFPMT,2); |
private: |
115 |
|
// |
116 |
|
ToFGeom eGeom; // ToF geometry |
117 |
|
// |
118 |
|
Float_t adc_he; |
119 |
|
TArrayF *eDEDXpmt; // 0-47 pmt dEdx |
120 |
|
// parameters: |
121 |
|
TArrayF PMTsat; // 0-47 saturation parameters |
122 |
|
Float_t adc[48]; |
123 |
|
// |
124 |
|
|
125 |
|
TArrayF parAtt[48]; // 48 x 6 |
126 |
|
TArrayF parPos[48]; // 48 x 4 |
127 |
|
TArrayF parDesatBB[48]; // 48 x 3 |
128 |
|
TArrayF parBBneg[48]; // 48 x 3 |
129 |
|
TArrayF parBBpos; // 48 x 1 |
130 |
|
|
131 |
|
double f_adcPC( float x ); |
132 |
|
double f_BB( TArrayF &p, float x ); |
133 |
|
double f_BB5B( float x ); |
134 |
|
double f_att( TArrayF &p, float x ) ; |
135 |
|
double f_att5B( float x ); |
136 |
|
double f_desatBB( TArrayF &p, float x ); |
137 |
|
double f_desatBB5B( float x ); |
138 |
|
double f_pos( TArrayF &p, float x ); |
139 |
|
double f_pos5B( float x ); |
140 |
|
float Get_adc_he( int id, float pl_x[6], float pl_y[6]); |
141 |
|
|
142 |
|
Bool_t conn[12]; |
143 |
|
|
144 |
|
UInt_t ts[12]; |
145 |
|
UInt_t te[12]; |
146 |
|
|
147 |
|
|
148 |
|
public: |
149 |
|
ToFdEdx(); // class constructor |
150 |
|
~ToFdEdx(); // class distructor |
151 |
|
// |
152 |
|
void Clear(Option_t *option=""); |
153 |
|
void Delete(Option_t *option=""); |
154 |
|
|
155 |
|
void Init(pamela::tof::TofEvent *tofl0 ); // init parameters |
156 |
|
void Init(Int_t i, Int_t j, Float_t adce); |
157 |
|
void Define_PMTsat(); |
158 |
|
|
159 |
|
void ReadParAtt( const char *fname ); |
160 |
|
void ReadParPos( const char *fname ); |
161 |
|
void ReadParBBneg( const char *fname ); |
162 |
|
void ReadParBBpos( const char *fname ); |
163 |
|
void ReadParDesatBB( const char *fname ); |
164 |
|
|
165 |
|
void CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc); |
166 |
|
|
167 |
|
void Process( UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat=-1); // |
168 |
|
void Print(Option_t *option=""); |
169 |
|
|
170 |
|
// Float_t GetdEdx_pmt(Int_t ipmt) { return (Float_t)eDEDXpmt[ipmt]; } // 0-47 dEdx for each PMT for tracked events |
171 |
|
Float_t GetdEdx_pmt(Int_t ipmt) { return eDEDXpmt->At(ipmt); } // 0-47 dEdx for each PMT for tracked events |
172 |
|
// |
173 |
|
ToFdEdx* GetToFdEdx(){return this;}; |
174 |
|
ClassDef(ToFdEdx,3); |
175 |
}; |
}; |
176 |
|
|
177 |
|
|
203 |
TArrayI tdcflag; ///<flag for artificial TDC, "0" if normal TDC value |
TArrayI tdcflag; ///<flag for artificial TDC, "0" if normal TDC value |
204 |
|
|
205 |
/** |
/** |
206 |
* \brief beta, 12 measurements for the 12 combinations, beta[13] is weighted mean |
* \brief beta, 12 measurements for the 12 combinations, beta[13] is modified weighted mean |
207 |
* |
* |
208 |
* The 12 measurements are S11-S31, S11-S32, S12-S31, S12-S32, and then analogue for |
* The 12 measurements are S11-S31, S11-S32, S12-S31, S12-S32, and then analogue for |
209 |
* S2-S3 and S1-S2. |
* S2-S3 and S1-S2. |
210 |
* In the moment all measurements are taken and the weighted mean is calculated. |
* The calculation of beta[13] is now modified: |
211 |
* Note that the weights are just simple overall results for S1-S3, S2-S3, and S1-S2. |
* We check the individual weights for artificial TDC values, then calculate |
212 |
* Artificial measurments are not treated correct, (since there is only one real |
* am mean beta for the first time. In a second step we loop again through |
213 |
* measurment the weight should be different then for two meassurments). |
* the single measurements, checking for the residual from the mean |
214 |
* The beta calculation will be improved in the next release. |
* The cut on the residual reject measurements > "x"-sigma. A chi2 value is |
215 |
|
* calculated, furthermore a "quality" value by adding the weights which |
216 |
|
* are finally used. If all measurements are taken, "quality" will be = 505. |
217 |
|
* A chi2 cut around 3-4 and a quality-cut > 400 is needed for clean beta |
218 |
|
* The Level2 beta[12] which is derived in the fortran routines uses: 10.,200.,20. |
219 |
|
* This is not a very high quality measurement. One can re-calculate a new beta[13] |
220 |
|
* using the L2-method "CalcBeta" |
221 |
*/ |
*/ |
222 |
Float_t beta[13]; |
Float_t beta[13]; |
223 |
// |
// |
236 |
ToFTrkVar(const ToFTrkVar&); |
ToFTrkVar(const ToFTrkVar&); |
237 |
|
|
238 |
ToFTrkVar* GetToFTrkVar(){return this;}; |
ToFTrkVar* GetToFTrkVar(){return this;}; |
239 |
void Clear(); |
void Clear(Option_t *t=""); |
240 |
|
|
241 |
ClassDef(ToFTrkVar,1); |
ClassDef(ToFTrkVar,1); |
242 |
// |
// |
260 |
Int_t default_calib; ///< one if the default calibration has been used to process the data, zero otherwise |
Int_t default_calib; ///< one if the default calibration has been used to process the data, zero otherwise |
261 |
// |
// |
262 |
Float_t GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl); // gf Apr 07 |
Float_t GetdEdx(Int_t notrack, Int_t plane, Int_t adcfl); // gf Apr 07 |
263 |
|
|
264 |
|
Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut); // wm feb 08 |
265 |
|
|
266 |
|
// |
267 |
|
// Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t chi2cut, Float_t qualitycut); // wm feb 08 |
268 |
// |
// |
269 |
// methods to make life simplier during the analysis, returns a pointer to the ToFTrkVar class containing track related variables |
// methods to make life simplier during the analysis, returns a pointer to the ToFTrkVar class containing track related variables |
270 |
// |
// |
287 |
void GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning); // gf Apr 07 |
void GetdEdxPaddle(Int_t notrack, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning); // gf Apr 07 |
288 |
TString GetPMTName(Int_t ind, Int_t &iplane, Int_t &ipaddle,Int_t &ipmt); |
TString GetPMTName(Int_t ind, Int_t &iplane, Int_t &ipaddle,Int_t &ipmt); |
289 |
Int_t GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane); // gf Apr 07 |
Int_t GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane); // gf Apr 07 |
290 |
|
Int_t GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane, Float_t margin); // wm jun 2008 |
291 |
void GetPMTPaddle(Int_t pmt_id, Int_t &plane, Int_t &paddle); // gf Apr 07 |
void GetPMTPaddle(Int_t pmt_id, Int_t &plane, Int_t &paddle); // gf Apr 07 |
292 |
void GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright); // gf Apr 07 |
void GetPaddlePMT(Int_t paddle, Int_t &pmtleft, Int_t &pmtright); // gf Apr 07 |
293 |
void GetPaddleGeometry(Int_t plane, Int_t paddle, Float_t &xleft, Float_t &xright, Float_t &yleft, Float_t &yright); // gf Apr 07 |
void GetPaddleGeometry(Int_t plane, Int_t paddle, Float_t &xleft, Float_t &xright, Float_t &yleft, Float_t &yright); // gf Apr 07 |
295 |
void GetPaddlePlane(Int_t padid, Int_t &plane, Int_t &paddle); |
void GetPaddlePlane(Int_t padid, Int_t &plane, Int_t &paddle); |
296 |
Int_t GetNPaddle(Int_t plane); |
Int_t GetNPaddle(Int_t plane); |
297 |
// |
// |
298 |
|
// |
299 |
|
// |
300 |
|
Int_t Process(TrkLevel2 *trk, TrigLevel2 *trg, GL_RUN *run, OrbitalInfo *orb, Bool_t force); // Emiliano |
301 |
|
|
302 |
// |
// |
303 |
// constructor |
// constructor |
304 |
// |
// |
305 |
ToFLevel2(); |
ToFLevel2(); |
306 |
~ToFLevel2(){Delete();}; //ELENA |
~ToFLevel2(){Delete();}; //ELENA |
307 |
void Delete(); //ELENA |
void Delete(Option_t *t=""); //ELENA |
308 |
void Set();//ELENA |
void Set();//ELENA |
309 |
// |
// |
310 |
// |
// |
342 |
Int_t GetToFPlaneIndex(Int_t plane_id); |
Int_t GetToFPlaneIndex(Int_t plane_id); |
343 |
Bool_t HitPaddle(Int_t ,Int_t); |
Bool_t HitPaddle(Int_t ,Int_t); |
344 |
Int_t GetNHitPaddles(Int_t plane); |
Int_t GetNHitPaddles(Int_t plane); |
345 |
void Clear(); |
void Clear(Option_t *t=""); |
346 |
// |
// |
347 |
ClassDef(ToFLevel2,3); |
ClassDef(ToFLevel2,4); |
348 |
}; |
}; |
349 |
|
|
350 |
#endif |
#endif |