/[PAMELA software]/DarthVader/ToFLevel2/inc/ToFLevel2.h
ViewVC logotype

Annotation of /DarthVader/ToFLevel2/inc/ToFLevel2.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.22 - (hide annotations) (download)
Fri Jun 20 12:22:11 2008 UTC (16 years, 5 months ago) by pamela
Branch: MAIN
CVS Tags: v6r01, v6r00
Changes since 1.21: +1 -0 lines
File MIME type: text/plain
GetPaddleIdOfTrack modified

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

  ViewVC Help
Powered by ViewVC 1.1.23