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 |
25 |
#include <GLTables.h> // Emiliano |
#include <GLTables.h> // Emiliano |
26 |
#include <OrbitalInfo.h> // Emiliano |
#include <OrbitalInfo.h> // Emiliano |
27 |
#include <ToFCore.h> // Emiliano |
#include <ToFCore.h> // Emiliano |
28 |
|
#include <physics/tof/TofEvent.h> |
29 |
|
|
30 |
// |
// |
31 |
// Declaration of the core fortran routines |
// Declaration of the core fortran routines |
32 |
// |
// |
35 |
#define toftrk toftrk_ |
#define toftrk toftrk_ |
36 |
extern "C" int toftrk(); |
extern "C" int toftrk(); |
37 |
#define rdtofcal rdtofcal_ |
#define rdtofcal rdtofcal_ |
38 |
extern "C" int rdtofcal(char [], int *); |
//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 |
|
Float_t l0flag_adc; ///< warning flags from unpacking |
98 |
|
Float_t l0flag_tdc; ///< warning flags from unpacking |
99 |
// |
// |
100 |
ToFPMT(); |
ToFPMT(); |
101 |
ToFPMT(const ToFPMT&); |
ToFPMT(const ToFPMT&); |
103 |
ToFPMT* GetToFPMT(){return this;}; |
ToFPMT* GetToFPMT(){return this;}; |
104 |
void Clear(Option_t *t=""); |
void Clear(Option_t *t=""); |
105 |
|
|
106 |
|
ClassDef(ToFPMT,3); |
107 |
|
}; |
108 |
|
|
109 |
|
/** |
110 |
|
* \brief Class used to calibrate adc to dEdx for each PMT |
111 |
|
* |
112 |
|
* Class used to calibrate adc to dEdx for each PMT |
113 |
|
*/ |
114 |
|
class ToFdEdx : public TObject { |
115 |
|
|
116 |
|
private: |
117 |
|
// |
118 |
|
ToFGeom eGeom; // ToF geometry |
119 |
|
// |
120 |
|
Float_t adc_he; |
121 |
|
TArrayF *eDEDXpmt; // 0-47 pmt dEdx |
122 |
|
// parameters: |
123 |
|
TArrayF PMTsat; // 0-47 saturation parameters |
124 |
|
Float_t adc[48]; |
125 |
|
// |
126 |
|
|
127 |
ClassDef(ToFPMT,2); |
TArrayF parAtt[48]; // 48 x 6 |
128 |
|
TArrayF parPos[48]; // 48 x 4 |
129 |
|
TArrayF parDesatBB[48]; // 48 x 3 |
130 |
|
TArrayF parBBneg[48]; // 48 x 3 |
131 |
|
TArrayF parBBpos; // 48 x 1 |
132 |
|
|
133 |
|
double f_adcPC( float x ); |
134 |
|
double f_BB( TArrayF &p, float x ); |
135 |
|
double f_BB5B( float x ); |
136 |
|
double f_att( TArrayF &p, float x ) ; |
137 |
|
double f_att5B( float x ); |
138 |
|
double f_desatBB( TArrayF &p, float x ); |
139 |
|
double f_desatBB5B( float x ); |
140 |
|
double f_pos( TArrayF &p, float x ); |
141 |
|
double f_pos5B( float x ); |
142 |
|
float Get_adc_he( int id, float pl_x[6], float pl_y[6]); |
143 |
|
|
144 |
|
Bool_t conn[12]; |
145 |
|
|
146 |
|
UInt_t ts[12]; |
147 |
|
UInt_t te[12]; |
148 |
|
|
149 |
|
|
150 |
|
public: |
151 |
|
ToFdEdx(); // class constructor |
152 |
|
~ToFdEdx(); // class distructor |
153 |
|
// |
154 |
|
void Clear(Option_t *option=""); |
155 |
|
void Delete(Option_t *option=""); |
156 |
|
|
157 |
|
void Init(pamela::tof::TofEvent *tofl0 ); // init parameters |
158 |
|
void Init(Int_t i, Int_t j, Float_t adce); |
159 |
|
void Define_PMTsat(); |
160 |
|
|
161 |
|
void ReadParAtt( const char *fname ); |
162 |
|
void ReadParPos( const char *fname ); |
163 |
|
void ReadParBBneg( const char *fname ); |
164 |
|
void ReadParBBpos( const char *fname ); |
165 |
|
void ReadParDesatBB( const char *fname ); |
166 |
|
|
167 |
|
void CheckConnectors(UInt_t atime, GL_PARAM *glparam, TSQLServer *dbc); |
168 |
|
|
169 |
|
void Process( UInt_t atime, Float_t betamean, Float_t *xtr_tof, Float_t *ytr_tof, Int_t exitat=-1); // |
170 |
|
void Print(Option_t *option=""); |
171 |
|
|
172 |
|
// Float_t GetdEdx_pmt(Int_t ipmt) { return (Float_t)eDEDXpmt[ipmt]; } // 0-47 dEdx for each PMT for tracked events |
173 |
|
Float_t GetdEdx_pmt(Int_t ipmt) { return eDEDXpmt->At(ipmt); } // 0-47 dEdx for each PMT for tracked events |
174 |
|
// |
175 |
|
ToFdEdx* GetToFdEdx(){return this;}; |
176 |
|
ClassDef(ToFdEdx,3); |
177 |
}; |
}; |
178 |
|
|
179 |
|
|
258 |
TClonesArray *ToFTrk; ///<track related variable class |
TClonesArray *ToFTrk; ///<track related variable class |
259 |
Int_t tof_j_flag[6]; ///<number of hitted paddle(s) for each ToF layer: flag = flag + 2**(paddlenumber-1) |
Int_t tof_j_flag[6]; ///<number of hitted paddle(s) for each ToF layer: flag = flag + 2**(paddlenumber-1) |
260 |
// |
// |
261 |
Int_t unpackError;///< zero if no error presente |
Int_t unpackError;///< zero if no errors |
262 |
|
Int_t unpackWarning;///< zero if no warnings | bitwise: ... 3 2 1 0 --> bit 0 = discharging flag on at least one PMT (adc OR tdc), bit 1 = there is at least one PMT off (no tdc nor adc) which is included in the patterntrig, bit 2 = PMTs hit are not enough to match trigger configuration, bit 3 = pattern trig does not match trigger configuration |
263 |
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 |
264 |
// |
// |
265 |
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 |
266 |
|
Float_t GetdEdx(ToFTrkVar *trk, Int_t plane, Int_t adcfl); // gf Apr 07 |
267 |
|
|
268 |
Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut); // wm feb 08 |
Float_t CalcBeta(Int_t notrack, Float_t resmax, Float_t qualitycut, Float_t chi2cut); // wm feb 08 |
269 |
|
|
289 |
|
|
290 |
// gf Apr 07 |
// gf Apr 07 |
291 |
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 |
292 |
|
void GetdEdxPaddle(ToFTrkVar *trk, Int_t paddleid, Int_t adcfl, Float_t &PadEdx, Int_t &SatWarning); // gf Apr 07 |
293 |
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); |
294 |
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 //EMXX |
295 |
Int_t GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane, Float_t margin); // wm jun 2008 |
Int_t GetPaddleIdOfTrack(Float_t xtr, Float_t ytr, Int_t plane, Float_t margin); // wm jun 2008 |
296 |
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 |
297 |
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 |
303 |
// |
// |
304 |
// |
// |
305 |
Int_t Process(TrkLevel2 *trk, TrigLevel2 *trg, GL_RUN *run, OrbitalInfo *orb, Bool_t force); // Emiliano |
Int_t Process(TrkLevel2 *trk, TrigLevel2 *trg, GL_RUN *run, OrbitalInfo *orb, Bool_t force); // Emiliano |
306 |
|
|
307 |
|
// |
308 |
|
// |
309 |
|
bool bit(int decimal, char pos); |
310 |
|
bool checkPMT(TString givenpmt); |
311 |
|
bool checkPMTpatternPMThit(TrigLevel2 *trg, int &pmtpattern, int &pmtnosignal); |
312 |
|
bool checkPMTpmttrig(TrigLevel2 *trg); |
313 |
|
void printPMT(); |
314 |
|
|
315 |
// |
// |
316 |
// constructor |
// constructor |
317 |
// |
// |
353 |
|
|
354 |
Int_t GetToFPlaneID(Int_t ip); |
Int_t GetToFPlaneID(Int_t ip); |
355 |
Int_t GetToFPlaneIndex(Int_t plane_id); |
Int_t GetToFPlaneIndex(Int_t plane_id); |
356 |
Bool_t HitPaddle(Int_t ,Int_t); |
Bool_t HitPaddle(Int_t ,Int_t); // EMXX |
357 |
Int_t GetNHitPaddles(Int_t plane); |
Int_t GetNHitPaddles(Int_t plane); |
358 |
|
Int_t GetTrueNHitPaddles(Int_t plane); |
359 |
void Clear(Option_t *t=""); |
void Clear(Option_t *t=""); |
360 |
|
|
361 |
|
// |
362 |
|
TClonesArray *GetTrackArray(){return ToFTrk;} ///< returns a pointer to the track related variables array |
363 |
|
TClonesArray** GetPointerToTrackArray(){return &ToFTrk;}///< returns pointer to pointer to the track array |
364 |
|
|
365 |
|
|
366 |
// |
// |
367 |
ClassDef(ToFLevel2,4); |
ClassDef(ToFLevel2,6); |
368 |
}; |
}; |
369 |
|
|
370 |
#endif |
#endif |