/[PAMELA software]/calo/flight/CaloElectron/inc/CaloElectron.h
ViewVC logotype

Contents of /calo/flight/CaloElectron/inc/CaloElectron.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Fri Mar 13 15:23:20 2009 UTC (15 years, 8 months ago) by pam-fi
Branch: MAIN, pamela
CVS Tags: beta, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
Error occurred while calculating annotation data.
CaloElectron beta version

1 #ifndef caloelectron_h
2 #define caloelectron_h
3
4
5 #if !defined(__CINT__) || defined(__MAKECINT__)
6
7 #include <PamLevel2.h>
8
9 //#include <TMinuit.h>
10 #include <TPaveStats.h>
11 #include <TStyle.h>
12 #include <TSystem.h>
13 #include <TCanvas.h>
14 #include <TGraphErrors.h>
15 #include <TH1F.h>
16 #include <TF2.h>
17 #include <TH2F.h>
18 #include <TProfile.h>
19 #include <TBenchmark.h>
20
21 #include <iostream>
22 #include <iomanip>
23 using namespace std;
24
25 #endif
26
27 //CaloLevel1* cl1;
28
29 #define NTAUBINMAX 100
30
31 #define WX0 0.350 //cm
32 #define WTICK 0.26 //cm
33 #define PITCH 0.244 //cm
34 #define DEAD 0.096 //cm
35 #define GLUE 0.05 //cm
36
37 #define CALIBNBIN 600
38 #define CALIBRANGE 15.//cm
39
40 double fradpro(Double_t *xi, Double_t *parmin);
41
42 ///////////////////////////////////////////////////
43 ///
44 ///
45 /// CLASS FOR INITIALIZATIONS & PARAMETERS
46 ///
47 ///
48 ///////////////////////////////////////////////////
49
50 class CaloElectron_parameters : public TObject{
51
52 private:
53
54 CaloElectron_parameters(){ SetDefault(); };
55
56 static CaloElectron_parameters * _parameters;
57
58 public:
59
60 static CaloElectron_parameters *Get(){
61 if(_parameters==0) {
62 // cout << "**NEW**"<<endl;
63 _parameters = new CaloElectron_parameters();
64 }
65 return _parameters;
66 }
67
68 // ------
69 //general
70 // ------
71
72 bool debug;
73
74 int isimu; //simulation flag
75 int dolongfit; //longitudinal-fit flag
76 int dolatcorr; //lateral-correction flag
77 int calibmode; //calibration flag
78
79 float TAUMAX; // max longitudinal depth to evaluate qtot (TAU=t/T)
80 float RMAX; // max radius around the track to evaluate qtot
81
82 float RMAXsp; // radius around the track to integrate the profile
83
84 int ipmin; // first plane (0-21)
85 int ipmax; // last plane (0-21)
86
87 bool maskpl[22][2]; // plane masks
88
89 CaloLevel1* cl1;
90
91 // -----------------------
92 // plots of energy deposit
93 // -----------------------
94 TH2F *h_qtot[2]; //matrix of energy deposits (measured) 192x22
95 TH2F *h_qfit[2]; //matrix of energy deposits (fit) 192x22
96
97 // --------------------------------------
98 // parameters for lateral profile (fixed)
99 // --------------------------------------
100
101 float file_rt[12][3];
102 float file_rc[12][3];
103 float file_p[12][3];
104 float file_tau[12];
105
106 void Dump();
107
108 void SetCalo(int icalo,int notused);
109 void SetPar();
110 void SetPar(TString pathx,TString pathyd,TString pathyp);
111 void SetRMAX(float setRMAX) {RMAX = setRMAX;};
112 void SetRMAXsp(float setRMAX) {RMAXsp = setRMAX;};
113 void SetTAUMAX(float setTAUMAX){TAUMAX = setTAUMAX;};
114 void Setsimu(int isetsimu) {isimu=isetsimu; SetPar();};
115 void SetLongitudinalFit(int isetdolongfit) {dolongfit = isetdolongfit;};
116 void SetLateralCorrection(int isetdolatcorr) {dolatcorr = isetdolatcorr;};
117 void SetCalibrationMode(int icalibmode){calibmode=icalibmode;};
118 void SetDebug(bool isetdebug) {debug = isetdebug;};
119 //
120 void SetCaloLevel1(CaloLevel1 *cl1in) {cl1 = cl1in; };
121
122 void SetDefault();
123
124
125 // --------------------------------------
126 // tools for calibration (NTAUBINMAX)
127 // --------------------------------------
128 //
129 TH2F *h_qtot_tau[100][3];///< profile histos for x,yodd,yeven
130 TH1F *h_qtot_tau_wav[100][3];///< profile histos for x,yodd,yeven (weighted average)
131 double summW[100][3][1000];
132 double summWF[100][3][1000];
133 //
134 float par_rt[100][3];
135 float par_rc[100][3];
136 float par_p[100][3];
137 int par_ntau;
138 float par_taubin[101];
139 //
140 void Calibration_SetTools();
141 void Calibration_SetTools(int ntau, float* taubin);
142 void Calibration_Fit();
143 void Calibration_Save(TFile* file);
144 void Calibration_Load(TFile* file);
145
146 ClassDef(CaloElectron_parameters,2);
147
148 };
149
150 ///////////////////////////////////////////////////
151 ///
152 ///
153 /// CLASS INPLEMENTATION
154 ///
155 ///
156 ///////////////////////////////////////////////////
157 class CaloElectron : public TObject{
158
159 private:
160
161 public:
162
163
164 // -----------
165 // shower axis
166 // -----------
167 float trkcoordx[22][2]; ///< track coordinates (PAMELA r.s.)
168 float trkcoordy[22][2]; ///< track coordinates (PAMELA r.s.)
169 float trkstrip[22][2]; ///< strip traversed by the track
170 float tgx,tgy,tg;
171 // --------------
172 // energy deposit
173 // --------------
174 float qtot; ///< total collected charge
175 float qplane0[22][2]; ///< collected charge (within RMAX & TAUMAX)
176 float qplane1[22][2]; ///< corrected charge (lateral leakage & gaps)
177 float qplanefit[22][2]; ///< fitted values
178 float tplane[22][2]; ///< shower depth (in units of radiation lenth)
179 // --------------------------------
180 // parameters from longitudinal fit
181 // --------------------------------
182 float chi2__l; // output longitudinal fit (chi2)
183 float par__l[4]; // parameters (E,alpha,T,t0)
184 int err__l; // minuit flag (0=ok ecc...)
185 float corr__l; // longitudinal correction factor
186
187 float chi2; ///< global chi2 (lateral+longitudinal)
188
189 // --------------
190 // new variables
191 // --------------
192 float RMS[22][2];
193 float SKEW[22][2];
194 float KURT[22][2];
195 float TAU[22][2];
196
197
198 CaloElectron(){ Reset(); };
199 CaloElectron(PamLevel2 *l2, int ntr){ Reset(); Set(l2,ntr); };
200
201 /* CaloElectron(){ Reset(); SetDefault(); SetPar(); }; */
202 /* CaloElectron(PamLevel2 *l2, int ntr){ Reset(); SetPar(); Set(l2,ntr); SetDefault();}; */
203 /* CaloElectron(PamLevel2 *l2){ Reset(); SetPar(); Set(l2); SetDefault();}; */
204
205 ~CaloElectron(){ Reset(); };
206
207 void Reset();
208 void Clear(){ Reset(); };
209 void Delete(){ Reset(); };
210
211 bool Set(CaloLevel1*,float tracoo[][2]);//main set
212 bool Set(CaloLevel1*,CaloTrkVar*);
213 bool Set(PamLevel2*,int);
214
215 // bool Set(PamLevel2* l2){ return Set(l2,0); };
216 // bool Set(CaloLevel1*,float tracoo[][2]);
217 // bool Set(CaloLevel1*,CaloLevel2*);
218
219 // -------------------------------------
220 // methods to perform lateral correction
221 // -------------------------------------
222 double GetLateralCorrection(double,double,int,int);
223 double GetLateralCorrection(double,double,TF2*,int);
224 float ApplyLateralCorrection(float);
225 void GetProfile(int,int,float xx[],float qq[],float errxx[],float errqq[]);
226 // float GetLateralFactor(){return corr;};
227 TGraphErrors* GetGraph_Lateral(int, int);
228 TGraphErrors* GetFunc_Lateral(int,int);
229 // ------------------------------------------
230 // methods to perform longitudinal correction
231 // ------------------------------------------
232 int ApplyLongitudinalFit(int longto);//return the ierflg value of gminuit minimization
233 float GetLongitudinalCorrection();
234 // float GetLongitudinalFactor(){return corr__l;};
235 // float GetLongitudinalFcnout(){return chi2__l;};
236 float GetIerflg(){return err__l;};
237 TGraphErrors* GetGraph_Longitudinal();
238 TGraphErrors* GetGraph_Longitudinal_Fit();
239 TGraphErrors* GetGraph_Longitudinal_Integral();
240 TGraphErrors* GetGraph_Longitudinal_Integral_Fit();
241 TF1* GetFunc_Longitudinal();
242 float GetMaxResidual();
243 int GetNRun();
244 float GetMaxRun();
245 // ------------------------------------
246 // other methods
247 // ------------------------------------
248 float ProfileTest();
249 void GetCornerCoord(int,int,float&,float&);
250 void Print();
251 int GetNWLayers(int ip,int iv){ return ip+(1-iv);}; ///< n.W-layers above an active layer
252 // ------------------------------------
253 // methods to get some shower variables
254 // ------------------------------------
255 float GetQ(int icorr); ///< shower charge (within RMAX and TAUMAX)
256 float GetQ(){ return GetQ(1); }; ///< shower charge (within RMAX and TAUMAX)
257 float GetQView(int icorr,int iv);///< shower charge on x or y view
258 /* float GetQW(int icorr,int iw); */
259 /* float GetQW(int icorr,int iw,int iv); */
260 /* float GetQipiv(int icorr,int ip,int iv); */
261 float GetEnergy(int icorr); ///< shower energy
262 float GetEnergy(){ return GetEnergy(1); };///< shower energy
263 float GetShowerMaximum(float qplane[][2]);
264 float GetShowerMaximum(int icorr);///< shower maximum (in units of W-layers)
265 float GetShowerMaximumX0(int icorr);///< shower maximum (in units of X0)
266 float GetShowerMaximumView(int view,float qplane[][2]);
267 float GetShowerMaximumView(int view,int icorr);///< shower maximum (in units of W-layers)
268 float GetShowerMaximumViewX0(int view,int icorr);///< shower maximum (in units of X0)
269 /* float GetStripMaximum(int iv,int icorr);///< strip traversed by track on maximum plane */
270 /* float GetCoordMaximum(int iv,int icorr);///< coordinate traversed by track on maximum plane */
271 /* float GetStripW(int iw,int iv);///< coordinate traversed by track after iw tungsten planes */
272 /* float GetCoordW(int iw,int iv,int ixy);///< coordinate traversed by track after iw tungsten planes */
273 /* float GetmaxStrip(int ip,int iv); */
274
275
276 bool IsInsideFiducial(int level);
277
278 // ------------------------------------
279 // methods to perform calibration
280 // ------------------------------------
281 void Calibration_Fill();
282
283
284 ClassDef(CaloElectron,4);
285
286 };
287
288
289
290 #endif

  ViewVC Help
Powered by ViewVC 1.1.23