/[PAMELA software]/tof/flight/ToFdEdx_patch/inc/ToFdEdx_patch.h
ViewVC logotype

Annotation of /tof/flight/ToFdEdx_patch/inc/ToFdEdx_patch.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Dec 10 18:47:01 2018 UTC (6 years, 1 month ago) by mayorov
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/plain
ToFdEdx_patch from Wolfgang. Follows Rita Carbone's advanced method to
derive the ToF dEdx (including PMT saturation, Bethe-Bloch effect, etc.)

1 mayorov 1.1
2    
3     /**
4     * \file ToFdEdx_patch.h
5     * \authors Rita Carbone & Lucia Consiglio & Wolfgang Menn
6     */
7     #ifndef tofdEdx_patch_h
8     #define tofdEdx_patch_h
9    
10     #include <PamLevel2.h>
11    
12     #include <TTree.h>
13     #include <TFriendElement.h>
14     #include <TChain.h>
15     #include <TFile.h>
16     #include <TList.h>
17     #include <TF1.h>
18     #include <TKey.h>
19     #include <TSystemFile.h>
20     #include <TSystemDirectory.h>
21     #include <TSQLServer.h>
22    
23     #include <iostream>
24    
25     using namespace std;
26    
27    
28     class ToF_geometry : public TObject {
29    
30     private:
31     TArrayI ePlane, eXY;
32    
33     public:
34     ToF_geometry() {
35     int plane[24] = {
36     0, 0, 0, 0, 0, 0, 0, 0,
37     1, 1, 1, 1, 1, 1,
38     2, 2,
39     3, 3,
40     4, 4, 4,
41     5, 5, 5
42     };
43     int plXY[6]= { 2, 1, 1, 2, 2, 1 }; // X==1, Y==2 */
44     ePlane.Set(24,plane);
45     eXY.Set(6,plXY);
46     }
47    
48     int GetPad( int idpmt) { return (int)((idpmt+0.5)/2.); }
49     int GetPlane( int idpmt) { return ePlane[ GetPad(idpmt) ]; }
50     int GetXY( int idpmt) { return eXY[ GetPlane(idpmt) ]; }
51    
52     ClassDef(ToF_geometry,1);
53    
54     };
55    
56     /**
57     *
58     * Class to store and calculate variables useful for nuclei analysis
59     */
60     class ToFdEdx_patch : public TObject { //class definition
61    
62     private:
63     //
64     PamLevel2 *L2;
65     Int_t eNtr; // number of tracker tracks
66     const char* trkAlg;
67    
68     ToF_geometry eGeom; // ToF geometry
69     //
70    
71     UInt_t OBT;
72     UInt_t PKT;
73     UInt_t atime;
74     Int_t tr;
75    
76     Float_t adc_he;
77    
78     // ToF track dependent
79     TArrayF eDEDXpmt; // 0-47 pmt dEdx
80     TArrayF eZpmt; // 0-47 pmt charge
81     TArrayF eDEDXpad; // 0-23 paddle dEdx
82     TArrayF eZpad; // 0-23 paddle charge
83     TArrayF eDEDXlayer; // 0-5 layer dEdx
84     TArrayF eZlayer; // 0-5 layer charge
85     TArrayF eDEDXplane; // 0-2 plane dEdx
86     TArrayF eZplane; // 0-2 plane charge
87    
88     TArrayF INFOpmt; // 0-47 pmt status
89     TArrayF INFOlayer; //0-5 layer status
90    
91    
92    
93     // ToF standalone
94     TArrayF eDEDXpmtstd; // 0-47 pmt dEdx
95     TArrayF eZpmtstd; // 0-47 pmt charge
96     TArrayF eDEDXpadstd; // 0-23 paddle dEdx
97     TArrayF eZpadstd; // 0-23 paddle charge
98     TArrayF eDEDXlayerstd; // 0-5 layer dEdx
99     TArrayF eZlayerstd; // 0-5 layer charge
100     TArrayF INFOpmtstd; // 0-47 pmt status
101     TArrayF INFOlayerstd; //0-5 layer status
102    
103     // parameters:
104     TArrayF PMTsat; // 0-47 saturation parameters
105    
106    
107     TArrayF A0_array[100]; // 48 x 100 define an array of 48 elements per each time interval
108     TArrayF A1_array[100];
109     TArrayF A2_array[100];
110     TArrayF A3_array[100];
111     TArrayF A4_array[100];
112     TArrayF A5_array[100];
113    
114     Float_t A0[48];
115     Float_t A1[48];
116     Float_t A2[48];
117     Float_t A3[48];
118     Float_t A4[48];
119     Float_t A5[48];
120    
121     UInt_t T_int_min[100];
122     UInt_t T_int_max[100];
123     UInt_t tmin_atten,tmax_atten;
124     Int_t ical_atten;
125    
126     TArrayF dedx_corr_mp[3500]; // 48 x 3500 define an array of 48 elements per each time interval
127     TArrayF dedx_corr_mhe[3500]; // 48 x 3500 define an array of 48 elements per each time interval
128     TArrayF dedx_corr_mc[3500]; // 48 x 3500 define an array of 48 elements per each time interval
129    
130     UInt_t mtime[3500];
131     Int_t ical_2nd;
132     UInt_t tmin_2nd,tmax_2nd;
133    
134    
135     // TArrayF TDx[48]; // 200 x 48 define an array of 200 elements per each pmt
136     // TArrayF TDy[48];
137     // TArrayF parAtt[48]; // 48 x 6
138    
139     TArrayF parPos[48]; // 48 x 4
140     TArrayF parDesatBB[48]; // 48 x 3
141     TArrayF parBBneg[48]; // 48 x 3
142     TArrayF parBBpos; // 48 x 1
143     TArrayF parBBpol4[48]; // 48 x 5 for pol4 parameters
144    
145    
146     public:
147     ToFdEdx_patch() {Clear();} // class constructor
148     ~ToFdEdx_patch(){ Delete(); }; // class distructor
149     //
150     void Clear(Option_t *option="");
151     void Delete(Option_t *option="") { Clear(); }
152    
153     // void InitPar(const char *pardir); // init parameters
154     void InitPar(const char *pardir, const char *param); // init parameters
155    
156     void Define_PMTsat();
157     // void ReadParTD( Int_t ipmt, const char *fname );
158    
159     void ReadParAtt(const char *pardir, const char *param);
160     // void ReadParAtt( const char *fname, const char *param );
161     void ReadParPos( const char *fname );
162     void ReadParBBneg( const char *fname );
163     void ReadParBBpos( const char *fname );
164     void ReadParDesatBB( const char *fname );
165     void ReadParBBpol4( const char *fname );
166    
167    
168    
169     // void Process( PamLevel2 *l2p, Int_t itr=0 ); ///< Process data for track number itr
170     void Process( PamLevel2 *l2p, const char* alg, const char *tri_or_bi ); ///< Process data 10th red
171     void Print(Option_t *option="");
172     void PrintTD();
173    
174     // track dependent results
175    
176     Float_t GetdEdx_pmt(Int_t ipmt) { return eDEDXpmt[ipmt]; } // 0-47 dEdx for each PMT for tracked events
177     Float_t GetCharge_pmt(Int_t ipmt) {return eZpmt[ipmt];} // 0-47 Z for each PMT for tracked events
178     Float_t GetdEdx_pad(Int_t ipad) {return eDEDXpad[ipad];} // 0-23 dEdx for each paddle for tracked events (no request of consistency between PMT's response when both on!)
179     Float_t GetCharge_pad(Int_t ipad) {return eZpad[ipad];} // 0-23 Z for each paddle for tracked events (no request of consistency)
180     Float_t GetdEdx_layer(Int_t ilay) {return eDEDXlayer[ilay];} // 0-5 dEdx for each layer for tracked events
181     Float_t GetCharge_layer(Int_t ilay) {return eZlayer[ilay];} // 0-5 Z for each layer for tracked events
182    
183    
184    
185     // ToF standalone results
186     Float_t GetdEdx_pmtstd(Int_t ipmt) { return eDEDXpmtstd[ipmt]; } // 0-47 dEdx for each PMT for tracked events
187     Float_t GetCharge_pmtstd(Int_t ipmt) {return eZpmtstd[ipmt];} // 0-47 Z for each PMT for tracked events
188     Float_t GetdEdx_padstd(Int_t ipad) {return eDEDXpadstd[ipad];} // 0-23 dEdx for each paddle for tracked events (no request of consistency between PMT's response when both on!)
189     Float_t GetCharge_padstd(Int_t ipad) {return eZpadstd[ipad];} // 0-23 Z for each paddle for tracked events (no request of consistency)
190     Float_t GetdEdx_layerstd(Int_t ilay) {return eDEDXlayerstd[ilay];} // 0-5 dEdx for each layer for tracked events
191     Float_t GetCharge_layerstd(Int_t ilay) {return eZlayerstd[ilay];} // 0-5 Z for each layer for tracked events
192    
193    
194    
195     Float_t GetInfo_pmt(Int_t ipmt) {return INFOpmt[ipmt];} // 0-47 pmt status
196    
197     /* INFOpmt table:
198    
199     INFOpmt[ii]=0 ---> everithing is ok!
200     INFOpmt[ii]=1 ---> beta not good (<0.05 || >2)
201     INFOpmt[ii]=2 ---> PMT OFF
202     INFOpmt[ii]=3 ---> PMT saturated
203     INFOpmt[ii]=4 ---> error during the correction for the incidence angle
204     INFOpmt[ii]=5 ---> error during the correction for the dependence on the position
205     INFOpmt[ii]=6 ---> error in dEdx reconstruction
206     INFOpmt[ii]=7 ---> error in Z reconstruction
207     */
208    
209     Float_t GetInfo_layer(Int_t ilay) {return INFOlayer[ilay];} // 0-5 layer status
210    
211     /* INFOlayer table:
212    
213     INFOlayer[ii]=0 ---> everithing is ok!
214     INFOlayer[ii]=1 ---> beta not good (<0.05 || >2)
215     INFOlayer[ii]=2 ---> only one PMT is OFF (but you get the other one to have the measurement)
216     INFOlayer[ii]=3 ---> only one PMT is saturated (but you get the other one to have the measurement)
217     INFOlayer[ii]=4 ---> only one PMT with a wrong reconstruction (but you get the other one to have the measurement)
218     INFOlayer[ii]=5 ---> the 2 PMTs involved give different measurement (actually they differ for more then 1.5, to be tuned...)
219     INFOlayer[ii]=6 ---> saturated layer (both PMTs)
220     INFOlayer[ii]=7 ---> all PMTs show some error during reconstruction
221     INFOlayer[ii]=8 ---> 1 PMT is OFF and 1 is saturated (it happens quiet only on S115...)
222     INFOlayer[ii]=9 ---> OFF layer
223     */
224    
225     private:
226     double f_adcPC( float x );
227    
228     double f_BB( TArrayF &p, float x );
229     double f_BBpol4( TArrayF &p, float x );
230    
231     double f_BB5B( float x );
232     double f_BB5Bpol4( float x );
233    
234    
235     // double f_att( TArrayF &p, float x ) ;
236     double f_att(float C0, float C1, float C2, float C3, float C4, float C5, float x ) ;
237     double f_att5B( float x );
238     double f_desatBB( TArrayF &p, float x );
239     double f_desatBB5B( float x );
240     double f_pos( TArrayF &p, float x );
241     double f_pos5B( float x );
242     // float Get_adc_he( int id, float pl_x[6], float pl_y[6]);
243     float Get_adc_he( int id, float x);
244    
245    
246    
247    
248     ClassDef(ToFdEdx_patch,1);
249     };
250    
251     #endif
252    

  ViewVC Help
Powered by ViewVC 1.1.23