FairRoot/PandaRoot
PndEmcDigiCalibrator.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // Description:
3 // Class PndEmcDigiCalibrator
4 // Do an energy and position corrections for EMC cluster
5 // PndEmcDigiCalibrator is a factory which call specific method depending on the input parameter "method"
6 // method=1 - PndEmcClusterHistCalibrator is called, which perform correction from the interpolation on 2-dimensional histogram on (Energy, theta)
7 // method=2 - PndEmcClusterSimpleCalibrator is called, where energy correction is parametrised as a function of (Energy, theta)
8 // PndEmcAbsClusterCalibrator - abstract interface class
9 //
10 // Versions of the correction:
11 // 1 - "emc_module12.dat","emc_module3_2011_new.root","emc_module4_StraightGeo24.4.root","emc_module5_fsc.root" (+ full PANDA geometry) TGeant3
12 //
13 // Author List:
14 // D.Melnychuk
15 // PndEmcClusterHistCalibrator class is based on code PndEmcMakeCorr.cxx
16 // (A. Biegun, M. Babai)
17 // PndEmcClusterSimpleCalibrator class is based on EmcPhotonSimpleCalib class in Babar framework (Jan Zhong)
18 //------------------------------------------------------------------------
19 
20 
21 //-----------------------
22 // This Class's Header --
23 //-----------------------
24 //-------------------------------
25 // Collaborating Class Headers --
26 //-------------------------------
27 #include "PndEmcDigiCalibrator.h"
28 #include "PndEmcDigi.h"
29 #include "PndEmcBump.h"
30 
31 #include <algorithm>
32 #include <iostream>
33 
34 using std::cout;
35 using std::endl;
36 
37 //----------------
38 // Constructors --
39 //----------------
41  //(x-2)<0.5,.6-.8,.8-1,1-2, 2-3, 3-4, 4-5, 5-6, 6-7, 7-8, 8-9, 9-10, 10-20,20-30,30-40,40-50,50+
42  14., 14., 9.4, 4.7, 3.0, 2.1, 1.6, 1.3, 1.1, 0.9, 0.8, 0.7, 0.5, 0.3, 0.2, 0.16, 0.14,/*mod=1*/
43  14., 14., 9.4, 4.7, 3.0, 2.1, 1.6, 1.3, 1.1, 0.9, 0.8, 0.7, 0.5, 0.3, 0.2, 0.16, 0.14,/*mod=2*/
44  7.0, 5.0, 3.6, 2.2, 1.2, 0.8, 0.7, 0.6, 0.5, 0.45,0.38,0.36, 0.27, 0.2, 0.20,0.20, 0.20,/*mod=3*/
45  14., 14., 9.4, 4.7, 3.0, 2.1, 1.6, 1.3, 1.0, 0.9, 0.8, 0.7, 0.5, 0.3, 0.2, 0.16, 0.14,/*mod=4*/
46  2.3, 1.8, 1.3, 0.9, 0.6, 0.4, 0.3, 0.3, 0.3, 0.3, 0.25,0.25, 0.25, 0.25, 0.25, 0.25, 0.25/*mod=5*/
47 };
49 //(x-2)<0.5,.6-.8,.8-1, 1-2, 2-3, 3-4, 4-5, 5-6, 6-7, 7-8, 8-9, 9-10, 10-20,20-30,30-40,40-50,50+
50  24., 18., 12.5, 9.5, 4.7, 3.2, 2.3, 2.0, 1.7, 1.4, 1.2, 1.1, 0.7, 0.4, 0.3, 0.23, 0.19, 0.16, 0.14, 0.12,/*mod=1*/
51  24., 18., 12.5, 9.5, 4.7, 3.2, 2.3, 2.0, 1.7, 1.4, 1.2, 1.1, 0.7, 0.4, 0.3, 0.23, 0.19, 0.16, 0.14, 0.12,/*mod=1*/
52  7, 5.5, 3.7, 2.9, 2.0, 1.7, 1.7, 1.6, 1.5, 1.3, 1.3, 1.1, 0.86, 0.28, 0.18, 0.14, 0.15, 0.14, 0.14, 0.13,/*mod=3*/
53  24., 18., 12.5, 9.5, 4.7, 3.2, 2.3, 2.0, 1.7, 1.4, 1.2, 1.1, 0.7, 0.4, 0.3, 0.23, 0.19, 0.16, 0.14, 0.12,/*mod=1*/
54  7, 5.5, 1.4, 1.1, 0.67, 0.44, 0.29, 0.23, 0.24, 0.19, 0.14, 0.18, 0.14, 0.12, 0.13, 0.14, 0.12, 0.13, 0.13, 0.12/*mod=5*/
55 };
56 
57 
59 {
60  //digi coefficients
61  //shashylik
62  CoeffMod5.ResizeTo(6);
63  CoeffMod5[0] = 41.636;
64  CoeffMod5[1] = 0.0532;
65  CoeffMod5[2] = 0.0277;
66  CoeffMod5[3] = 0.0097;
67  CoeffMod5[4] = -7.576e-5;
68  CoeffMod5[5] = 1.6053e-7;
69  //forward
70  CoeffMod3.ResizeTo(6);
71  CoeffMod3[0] = 130.996;
72  CoeffMod3[1] = 0.00135;
73  CoeffMod3[2] = 0.32456;
74  CoeffMod3[3] = -0.0295;
75  CoeffMod3[4] = -3.0491e-6;
76  CoeffMod3[5] = 1.93008e-7;
77  //other parts
78  //barrel mod == 1, 2, backward mod = 4
79  CoeffModo.ResizeTo(6);
80  CoeffModo[0] = 246.223;
81  CoeffModo[1] = 0.03520;
82  CoeffModo[2] = -0.1207;
83  CoeffModo[3] = 0.04283;
84  CoeffModo[4] = -0.0002;
85  CoeffModo[5]= 1.25472e-6;
86  //bump coefficients, for numofdigi>3
87  CoeffMod5A.ResizeTo(6);
88  CoeffMod5A[0] = 52.221;
89  CoeffMod5A[1] = 0.0408;
90  CoeffMod5A[2] = -0.5354;
91  CoeffMod5A[3] = 0.1821;
92  CoeffMod5A[4] = -9.337e-3;
93  CoeffMod5A[5] = 2.8338e-4;
94  //forward
95  CoeffMod3A.ResizeTo(6);
96  CoeffMod3A[0] = 131.428;
97  CoeffMod3A[1] = 0.01073;
98  CoeffMod3A[2] = -3.2207;
99  CoeffMod3A[3] = 1.2828;
100  CoeffMod3A[4] = -3.3757e-2;
101  CoeffMod3A[5] = 3.33785e-4;
102  //other parts
103  //barrel mod == 1, 2, backward mod = 4
104  CoeffModoA.ResizeTo(6);
105  CoeffModoA[0] = 246.536;
106  CoeffModoA[1] = 0.03316;
107  CoeffModoA[2] = -0.6604;
108  CoeffModoA[3] = 0.29184;
109  CoeffModoA[4] = -0.0076;
110  CoeffModoA[5]= 1.52179e-4;
111 //for bumps numofdigi<=3
112  CoeffMod5B.ResizeTo(6);
113  CoeffMod5B[0] = 44.206;
114  CoeffMod5B[1] = 0.0504;
115  CoeffMod5B[2] = -0.140;
116  CoeffMod5B[3] = 0.0225;
117  CoeffMod5B[4] = -9.603e-7;
118  CoeffMod5B[5] = -3.906e-7;
119  //forward
120  CoeffMod3B.ResizeTo(6);
121  CoeffMod3B[0] = 136.73;
122  CoeffMod3B[1] = -0.0359;
123  CoeffMod3B[2] = 1.9219;
124  CoeffMod3B[3] = -0.2218;
125  CoeffMod3B[4] = 7.4442e-4;
126  CoeffMod3B[5] = -1.16553e-6;
127  //other parts
128  //barrel mod == 1, 2, backward mod = 4
129  CoeffModoB.ResizeTo(6);
130  CoeffModoB[0] = 244.578;
131  CoeffModoB[1] = 0.04145;
132  CoeffModoB[2] = 0.34314;
133  CoeffModoB[3] = 0.02705;
134  CoeffModoB[4] = -2.6097e-4;
135  CoeffModoB[5] = 1.42555e-6;
136 
137 }
138 
139 //--------------
140 // Destructor --
141 //--------------
143 {
144 }
145 
147 {
148  Double_t digiT = theDigi->GetTimeStamp();
149  Double_t digiE = theDigi->GetEnergy();
150  Int_t mod = theDigi->GetModule();
151  //Int_t detID = theDigi->GetDetectorId();
152  //PndEmcTwoCoordIndex* _tci = PndEmcMapper::Instance()->GetTCI(detID);
153  //PndEmcTciXtalMap& map = const_cast<PndEmcTciXtalMap&> ( PndEmcStructure::Instance()->GetTciXtalMap());
154  //TVector3 Where = PndEmcDigi::algPointer()(map.find(_tci)->second);
155  Double_t path = theDigi->where().Mag();
156  //Double_t path = map[_tci]->frontCentre().Mag();
157 
158 
159  TVectorD vFunc(6);
160  vFunc[0]=1.;
161  vFunc[1]=path;
162  vFunc[2]=1./TMath::Sqrt(digiE);
163  vFunc[3]=1./digiE;
164  vFunc[4]=vFunc[3]*vFunc[3];
165  vFunc[5]=vFunc[4]*vFunc[3];
166 
167  Double_t corrT(0.);
168  //Int_t mod = detID/100000000;
169 
170  if(mod == 3){
171  corrT = CoeffMod3*vFunc;
172  }else if( mod == 5){
173  corrT = CoeffMod5*vFunc;
174  }else{
175  corrT = CoeffModo*vFunc;
176  }
177  if(PrintOut){
178  cout<<"path = "<<path<<", mod = "<<mod<<", corrT = "<<corrT<<endl;
179  }
180  return digiT - corrT;
181 }
182 
184 {
185  Double_t bumpT = theBump->GetTimeStamp();
186  Double_t bumpE = theBump->energy();
187  Int_t mod = theBump->GetModule();
188  Int_t nDigi = theBump->NumberOfDigis();
189  //Int_t detID = theDigi->GetDetectorId();
190  //PndEmcTwoCoordIndex* _tci = PndEmcMapper::Instance()->GetTCI(detID);
191  //PndEmcTciXtalMap& map = const_cast<PndEmcTciXtalMap&> ( PndEmcStructure::Instance()->GetTciXtalMap());
192  //TVector3 Where = PndEmcDigi::algPointer()(map.find(_tci)->second);
193  Double_t path = theBump->where().Mag();
194  //Double_t path = map[_tci]->frontCentre().Mag();
195 
196 
197  TVectorD vFunc(6);
198  vFunc[0]=1.;
199  vFunc[1]=path;
200  vFunc[2]=1./TMath::Sqrt(bumpE);
201  vFunc[3]=1./bumpE;
202  vFunc[4]=vFunc[3]*vFunc[3];
203  vFunc[5]=vFunc[4]*vFunc[3];
204 
205  Double_t corrT(0.);
206  //Int_t mod = detID/100000000;
207 
208  if(mod == 3){
209  if(nDigi > 3)
210  corrT = CoeffMod3A*vFunc;
211  else
212  corrT = CoeffMod3B*vFunc;
213  }else if( mod == 5){
214  if(nDigi > 3)
215  corrT = CoeffMod5A*vFunc;
216  else
217  corrT = CoeffMod5B*vFunc;
218  }else{
219  if(nDigi > 3)
220  corrT = CoeffModoA*vFunc;
221  else
222  corrT = CoeffModoB*vFunc;
223  }
224  if(PrintOut){
225  cout<<"path = "<<path<<", mod = "<<mod<<", corrT = "<<corrT<<endl;
226  }
227  return bumpT - corrT;
228 }
229 
231 {
232  Int_t TheIndexOfEnergy = GetIdxByEnergy(theDigi->GetEnergy());
233  Int_t TheIndexOfModule = theDigi->GetModule();
234  return PndEmcDigiCalibrator::fTimeWindowOfDigi[TheIndexOfModule-1][TheIndexOfEnergy];
235 }
236 
238 {
239  Int_t TheIndexOfEnergy = GetIdxByEnergyForBump(theBump->energy());
240  Int_t TheIndexOfModule = theBump->GetModule();
241  return PndEmcDigiCalibrator::fTimeWindowOfShower[TheIndexOfModule-1][TheIndexOfEnergy];
242 }
244 {
245  if(energy < 0.006) return 0;
246  if(energy < 0.008) return 1;
247  if(energy < 0.010) return 2;
248  if(energy < 0.1)
249  return 2 + Int_t(energy/0.01);//energy step 0.01GeV
250  if(energy >= 0.1){
251  Int_t idx = 11 + Int_t(energy/0.1);
252  if(idx > 16) idx = 16;
253  return idx;
254  }
255  return -1;
256 }
258 {
259  if(energy < 0.006) return 0;
260  if(energy < 0.008) return 1;
261  if(energy < 0.010) return 2;
262  if(energy < 0.1)
263  return 2 + Int_t(energy/0.01);//energy step 0.01GeV
264  if(energy >= 0.1){
265  Int_t idx = 11 + Int_t(energy/0.1);
266  if(idx > 19) idx = 19;
267  return idx;
268  }
269  return -1;
270 }
TVector3 where() const
virtual Double_t GetEnergy() const
Definition: PndEmcDigi.cxx:296
represents the reconstructed hit of one emc crystal
Definition: PndEmcDigi.h:40
Short_t GetModule() const
Double_t CalibrationEvtTimeByDigi(PndEmcDigi *theDigi, bool PrintOut=kFALSE) const
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
Short_t GetModule() const
Definition: PndEmcDigi.h:103
static Double_t fTimeWindowOfShower[5][20]
int idx[MAX]
Definition: autocutx.C:38
Double_t GetTimeResolutionOfShower(PndEmcBump *theBump) const
static Double_t fTimeWindowOfDigi[5][17]
Double_t
Int_t GetIdxByEnergy(Double_t energy) const
Double_t CalibrationEvtTimeByBump(PndEmcBump *theBump, bool PrintOut=kFALSE) const
Int_t NumberOfDigis() const
virtual Double_t energy() const
const TVector3 & where() const
Definition: PndEmcDigi.h:111
Double_t GetTimeResolutionOfDigi(PndEmcDigi *theDigi) const
represents a reconstructed (splitted) emc cluster
Definition: PndEmcBump.h:34
Int_t GetIdxByEnergyForBump(Double_t energy) const
Double_t energy
Definition: plot_dirc.C:15