BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
Mdc/MdcCalibFunSvc/MdcCalibFunSvc-00-03-16/MdcCalibFunSvc/MdcCalibFunSvc.h
Go to the documentation of this file.
1#ifndef MDCCALIBFUNSVC_H_
2#define MDCCALIBFUNSVC_H_
3
4#include "GaudiKernel/IInterface.h"
5#include "GaudiKernel/Kernel.h"
6#include "GaudiKernel/Service.h"
7#include "GaudiKernel/IIncidentListener.h"
8
9#include "GaudiKernel/IDataProviderSvc.h"
10#include "GaudiKernel/SmartDataPtr.h"
11#include "GaudiKernel/DataSvc.h"
12#include "CalibData/CalibModel.h"
13#include "CalibData/Mdc/MdcCalibData.h"
14#include "CalibDataSvc/ICalibRootSvc.h"
15
16#include "MdcCalibFunSvc/IMdcCalibFunSvc.h"
17
18#include <map>
19#include <vector>
20
21class MdcCalibFunSvc: public Service, virtual public IMdcCalibFunSvc,
22 virtual public IIncidentListener{
23 public:
24 MdcCalibFunSvc( const std::string& name, ISvcLocator* svcloc );
26
27 virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvUnknown);
28 virtual StatusCode initialize();
29 virtual StatusCode finalize();
30
31 // Incident handler
32 void handle(const Incident&);
33
34 int m_run;
35
36 /* Access by users */
37
38 /* propagation velocity of the signal in the wire. unit: mm/ns */
39 double getVprop(int lay) const;
40
41 /* get propagation time. the unit of z is mm */
42 double getTprop(int lay, double z) const;
43
44 /* DriftTime is real drift time, that is
45 DriftTime = Tdc - TOF - T0 - TimeWalk */
46 /* the unit of distance is mm */
47 double driftTimeToDist(double drifttime, int layid, int cellid, int lr,
48 double entrance = 0.0) const ;
49 double distToDriftTime(double dist, int layid, int cellid, int lr,
50 double entrance = 0.0) const ;
51
52 /* Sigma1 and Sigma2 are the smaller and the bigger sigma of
53 the two gaussian distribution, respectively.
54 Sigma = sqrt( F*Sigma1^2 + (1-F)*Sigma2^2 ) */
55 /* the unit of distance is mm */
56 double getSigma(int layid, int lr, double dist,
57 double entrance = 0.0, double tanlam = 0.0,
58 double z = 0.0, double Q = 1000.0) const ;
59 double getSigmaLR(int layid, int lr, double dist,
60 double entrance = 0.0, double tanlam = 0.0,
61 double z = 0.0, double Q = 1000.0) const ;
62 double getSigma1(int layid, int lr, double dist,
63 double entrance = 0.0, double tanlam = 0.0,
64 double z = 0.0, double Q = 1000.0) const ;
65 double getSigma2(int layid, int lr, double dist,
66 double entrance = 0.0, double tanlam = 0.0,
67 double z = 0.0, double Q = 1000.0) const ;
68 double getF(int layid, int lr, double dist,
69 double entrance = 0.0, double tanlam = 0.0,
70 double z = 0.0, double Q = 1000.0) const ;
71
72 double getSigmaToT(int layid, int lr, double tdr,
73 double entrance = 0.0, double tanlam = 0.0,
74 double z = 0.0, double Q = 1000.0) const ;
75 double getSigmaToTLR(int layid, int lr, double tdr,
76 double entrance = 0.0, double tanlam = 0.0,
77 double z = 0.0, double Q = 1000.0) const ;
78
79 void setXtBegin() { m_xtiter = m_xtmap.begin(); }
80 int getNextXtpar(int& key, double& par);
81 void getXtpar(int layid, int entr, int lr, double par[]) const;
82 bool getNewXtpar() ;
83 TTree* getNewXtparTree(int layid, int entr, int lr) const;
84
85 double getT0(int layid, int cellid) const ;
86 double getT0(int wireid) const { return m_t0[wireid]; }
87 double getDelT0(int wireid) const { return m_delt0[wireid]; }
88
89 double getTimeWalk(int layid, double Q) const ;
90 double getQtpar(int layid, int ord) const;
91
92 double getWireEff(int layid, int cellid) const ;
93 double getWireEff(int wireid) const { return m_wireEff[wireid]; }
94
95 void setSdBegin() { m_sditer = m_sdmap.begin(); }
96 int getNextSdpar(int& key, double& par);
97 void getSdpar(int layid, int entr, int lr, double par[]) const;
98 bool getR2tpar() ;
99 TTree* getR2tTree(int layid) const;
100
101 int getXtEntrIndex(double entrance) const;
102 int getSdEntrIndex(double entrance) const;
103
104/* std::string getCalibDataFile() { return m_pRootSvc->getrootfile(); } */
105
106private:
107 static const int NWIRE = 6796;
108 static const int NLAYER = 43;
109 static const int NXTENTR = 18;
110 static const int NXTPAR = 8;
111 static const int NXTORD = 6;
112 static const int NSDBIN = 24;
113
114 /* initial calib const */
115 bool initCalibConst();
116
117 double t2dPoly(double drifttime, int layid, int cellid, int lr,
118 double entrance = 0.0) const ;
119 double t2dInter(double drifttime, int layid, int cellid, int lr,
120 double entrance = 0.0) const ;
121
122/* bool getNewXtpar() ; */
123/* TTree* getNewXtparTree(int layid, int entr, int lr) const; */
124
125/* bool getR2tpar() ; */
126/* TTree* getR2tTree(int layid) const; */
127
128 int getXtKey(int layid, int entr, int lr, int ord) const;
129 int getSdKey(int layid, int entr, int lr, int bin) const;
130 int getXtparId(int layid, int entr, int lr, int ord) const;
131 int getSdparId(int layid, int entr, int lr, int bin) const;
132
133 void checkConst();
134 int m_updateNum;
135 bool m_checkConst;
136
137 int m_layInfSig; /* the layer with infinite sigma for reconstruction */
138 int m_xtMode; /* 0: polynomial, 1: interpretation */
139 std::string m_xtfile;
140 bool m_fgR2t;
141 bool m_linearXT; /* 1: v=0.03um/ns, 0: read xt from database */
142 bool m_readWireEffDb; /* 1: read from DB, 0: read from file */
143 std::string m_wireEffFile;
144 bool m_outputXtMode;
145 bool m_fixSigma;
146 double m_fixSigmaValue;
147
148 IMdcGeomSvc* m_pMdcGeomSvc;
149 IDataProviderSvc* m_pCalDataSvc;
150 ICalibRootSvc* m_pRootSvc;
151
152 /* for calculation Tprop */
153 double m_zst[43];
154
155 /* calibration constants */
156 std::map<int, double> m_xtmap;
157 std::vector<double> m_xtpar;
158
159 std::vector<double> m_t0;
160 std::vector<double> m_delt0;
161
162 std::vector<double> m_qtpar0;
163 std::vector<double> m_qtpar1;
164
165 std::map<int, double> m_sdmap;
166 std::vector<double> m_sdpar;
167
168 std::map<int, double>::iterator m_xtiter;
169 std::map<int, double>::iterator m_sditer;
170
171 double m_wireEff[6796];
172
173 int m_nNewXt[NLAYER][NXTENTR][2];
174 double m_vt[NLAYER][NXTENTR][2][200];
175 double m_vd[NLAYER][NXTENTR][2][200];
176
177 int m_nR2t[NLAYER][NXTENTR][2];
178 double m_tR2t[NLAYER][NXTENTR][2][200];
179 double m_sR2t[NLAYER][NXTENTR][2][200];
180
181 static const int XTLAYER_INDEX = 11;
182 static const int XTLAYER_MASK = 0x1F800;
183 static const int XTLAYER_DECO = 0x3F;
184
185 static const int XTENTRA_INDEX = 6;
186 static const int XTENTRA_MASK = 0x7C0;
187 static const int XTENTRA_DECO = 0x1F;
188
189 static const int XTLR_INDEX = 4;
190 static const int XTLR_MASK = 0x30;
191 static const int XTLR_DECO = 0x3;
192
193 static const int XTORDER_INDEX = 0;
194 static const int XTORDER_MASK = 0xF;
195 static const int XTORDER_DECO = 0xF;
196
197
198 static const int SDLAYER_INDEX = 10;
199 static const int SDLAYER_MASK = 0xFC00;
200 static const int SDLAYER_DECO = 0x3F;
201
202 static const int SDENTRA_INDEX = 7;
203 static const int SDENTRA_MASK = 0x380;
204 static const int SDENTRA_DECO = 0x7;
205
206 static const int SDLR_INDEX = 5;
207 static const int SDLR_MASK = 0x60;
208 static const int SDLR_DECO = 0x3;
209
210 static const int SDBIN_INDEX = 0;
211 static const int SDBIN_MASK = 0x1F;
212 static const int SDBIN_DECO = 0x1F;
213};
214
215inline double MdcCalibFunSvc::getVprop(int lay) const{
216 if(lay<8) return 220.0;
217 else return 240.0;
218}
219
220inline int MdcCalibFunSvc::getXtparId(int layid, int entr, int lr,
221 int ord) const{
222 int parId = (layid * 432) + (entr * 24) + (lr * 8) + ord;
223 return parId;
224}
225
226inline int MdcCalibFunSvc::getSdparId(int layid, int entr, int lr,
227 int bin) const{
228 int parId = (layid * 288) + (entr * 48) + (lr * 24) + bin;
229 return parId;
230}
231
232#endif /* MDCCALIBFUNSVC_H_ */
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per bin
Definition: FoamA.h:85
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition: Taupair.h:42
int getNextXtpar(int &key, double &par)
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
double getSigmaToT(int layid, int lr, double tdr, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
int getSdEntrIndex(double entrance) const
TTree * getR2tTree(int layid) const
double getSigmaToTLR(int layid, int lr, double tdr, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
void getSdpar(int layid, int entr, int lr, double par[]) const
double distToDriftTime(double dist, int layid, int cellid, int lr, double entrance=0.0) const
double getSigma2(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getWireEff(int layid, int cellid) const
double getSigma(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getT0(int layid, int cellid) const
double driftTimeToDist(double drifttime, int layid, int cellid, int lr, double entrance=0.0) const
double getSigmaLR(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
double getQtpar(int layid, int ord) const
TTree * getNewXtparTree(int layid, int entr, int lr) const
void getXtpar(int layid, int entr, int lr, double par[]) const
virtual StatusCode finalize()
MdcCalibFunSvc(const std::string &name, ISvcLocator *svcloc)
double getSigma1(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
int getXtEntrIndex(double entrance) const
double getVprop(int lay) const
virtual StatusCode initialize()
void handle(const Incident &)
int getNextSdpar(int &key, double &par)
double getTprop(int lay, double z) const
double getF(int layid, int lr, double dist, double entrance=0.0, double tanlam=0.0, double z=0.0, double Q=1000.0) const
bool getNewXtpar()
double getTimeWalk(int layid, double Q) const