BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcCalibFunSvc.h
Go to the documentation of this file.
1#ifndef MDCCALIBFUNSVC_H_
2#define MDCCALIBFUNSVC_H_
3
4#include "GaudiKernel/DataSvc.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/IIncidentListener.h"
7#include "GaudiKernel/IInterface.h"
8#include "GaudiKernel/Kernel.h"
9#include "GaudiKernel/Service.h"
10#include "GaudiKernel/SmartDataPtr.h"
11
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 extends<Service, IMdcCalibFunSvc>,
22 virtual public IIncidentListener {
23public:
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, double entrance = 0.0, double tanlam = 0.0,
57 double z = 0.0, double Q = 1000.0 ) const;
58 double getSigmaLR( int layid, int lr, double dist, double entrance = 0.0,
59 double tanlam = 0.0, double z = 0.0, double Q = 1000.0 ) const;
60 double getSigma1( int layid, int lr, double dist, double entrance = 0.0, double tanlam = 0.0,
61 double z = 0.0, double Q = 1000.0 ) const;
62 double getSigma2( int layid, int lr, double dist, double entrance = 0.0, double tanlam = 0.0,
63 double z = 0.0, double Q = 1000.0 ) const;
64 double getF( int layid, int lr, double dist, double entrance = 0.0, double tanlam = 0.0,
65 double z = 0.0, double Q = 1000.0 ) const;
66
67 double getSigmaToT( int layid, int lr, double tdr, double entrance = 0.0,
68 double tanlam = 0.0, double z = 0.0, double Q = 1000.0 ) const;
69 double getSigmaToTLR( int layid, int lr, double tdr, double entrance = 0.0,
70 double tanlam = 0.0, double z = 0.0, double Q = 1000.0 ) const;
71
72 void setXtBegin() { m_xtiter = m_xtmap.begin(); }
73 int getNextXtpar( int& key, double& par );
74 void getXtpar( int layid, int entr, int lr, double par[] ) const;
75 bool getNewXtpar();
76 TTree* getNewXtparTree( int layid, int entr, int lr ) const;
77
78 double getT0( int layid, int cellid ) const;
79 double getT0( int wireid ) const { return m_t0[wireid]; }
80 double getDelT0( int wireid ) const { return m_delt0[wireid]; }
81
82 double getTimeWalk( int layid, double Q ) const;
83 double getQtpar( int layid, int ord ) const;
84
85 double getWireEff( int layid, int cellid ) const;
86 double getWireEff( int wireid ) const { return m_wireEff[wireid]; }
87
88 void setSdBegin() { m_sditer = m_sdmap.begin(); }
89 int getNextSdpar( int& key, double& par );
90 void getSdpar( int layid, int entr, int lr, double par[] ) const;
91 bool getR2tpar();
92 TTree* getR2tTree( int layid ) const;
93
94 int getXtEntrIndex( double entrance ) const;
95 int getSdEntrIndex( double entrance ) const;
96
97 /* std::string getCalibDataFile() { return m_pRootSvc->getrootfile(); } */
98
99private:
100 static const int NWIRE = 6796;
101 static const int NLAYER = 43;
102 static const int NXTENTR = 18;
103 static const int NXTPAR = 8;
104 static const int NXTORD = 6;
105 static const int NSDBIN = 24;
106
107 /* initial calib const */
108 bool initCalibConst();
109
110 double t2dPoly( double drifttime, int layid, int cellid, int lr,
111 double entrance = 0.0 ) const;
112 double t2dInter( double drifttime, int layid, int cellid, int lr,
113 double entrance = 0.0 ) const;
114
115 /* bool getNewXtpar() ; */
116 /* TTree* getNewXtparTree(int layid, int entr, int lr) const; */
117
118 /* bool getR2tpar() ; */
119 /* TTree* getR2tTree(int layid) const; */
120
121 int getXtKey( int layid, int entr, int lr, int ord ) const;
122 int getSdKey( int layid, int entr, int lr, int bin ) const;
123 int getXtparId( int layid, int entr, int lr, int ord ) const;
124 int getSdparId( int layid, int entr, int lr, int bin ) const;
125
126 void checkConst();
127 int m_updateNum;
128 bool m_checkConst;
129
130 int m_layInfSig; /* the layer with infinite sigma for reconstruction */
131 int m_xtMode; /* 0: polynomial, 1: interpretation */
132 std::string m_xtfile;
133 bool m_fgR2t;
134 bool m_linearXT; /* 1: v=0.03um/ns, 0: read xt from database */
135 bool m_readWireEffDb; /* 1: read from DB, 0: read from file */
136 std::string m_wireEffFile;
137 bool m_outputXtMode;
138 bool m_fixSigma;
139 double m_fixSigmaValue;
140
141 IMdcGeomSvc* m_pMdcGeomSvc;
142 IDataProviderSvc* m_pCalDataSvc;
143 ICalibRootSvc* m_pRootSvc;
144
145 /* for calculation Tprop */
146 double m_zst[43];
147
148 /* calibration constants */
149 std::map<int, double> m_xtmap;
150 std::vector<double> m_xtpar;
151
152 std::vector<double> m_t0;
153 std::vector<double> m_delt0;
154
155 std::vector<double> m_qtpar0;
156 std::vector<double> m_qtpar1;
157
158 std::map<int, double> m_sdmap;
159 std::vector<double> m_sdpar;
160
161 std::map<int, double>::iterator m_xtiter;
162 std::map<int, double>::iterator m_sditer;
163
164 double m_wireEff[6796];
165
166 int m_nNewXt[NLAYER][NXTENTR][2];
167 double m_vt[NLAYER][NXTENTR][2][200];
168 double m_vd[NLAYER][NXTENTR][2][200];
169
170 int m_nR2t[NLAYER][NXTENTR][2];
171 double m_tR2t[NLAYER][NXTENTR][2][200];
172 double m_sR2t[NLAYER][NXTENTR][2][200];
173
174 static const int XTLAYER_INDEX = 11;
175 static const int XTLAYER_MASK = 0x1F800;
176 static const int XTLAYER_DECO = 0x3F;
177
178 static const int XTENTRA_INDEX = 6;
179 static const int XTENTRA_MASK = 0x7C0;
180 static const int XTENTRA_DECO = 0x1F;
181
182 static const int XTLR_INDEX = 4;
183 static const int XTLR_MASK = 0x30;
184 static const int XTLR_DECO = 0x3;
185
186 static const int XTORDER_INDEX = 0;
187 static const int XTORDER_MASK = 0xF;
188 static const int XTORDER_DECO = 0xF;
189
190 static const int SDLAYER_INDEX = 10;
191 static const int SDLAYER_MASK = 0xFC00;
192 static const int SDLAYER_DECO = 0x3F;
193
194 static const int SDENTRA_INDEX = 7;
195 static const int SDENTRA_MASK = 0x380;
196 static const int SDENTRA_DECO = 0x7;
197
198 static const int SDLR_INDEX = 5;
199 static const int SDLR_MASK = 0x60;
200 static const int SDLR_DECO = 0x3;
201
202 static const int SDBIN_INDEX = 0;
203 static const int SDBIN_MASK = 0x1F;
204 static const int SDBIN_DECO = 0x1F;
205};
206
207inline double MdcCalibFunSvc::getVprop( int lay ) const {
208 if ( lay < 8 ) return 220.0;
209 else return 240.0;
210}
211
212inline int MdcCalibFunSvc::getXtparId( int layid, int entr, int lr, int ord ) const {
213 int parId = ( layid * 432 ) + ( entr * 24 ) + ( lr * 8 ) + ord;
214 return parId;
215}
216
217inline int MdcCalibFunSvc::getSdparId( int layid, int entr, int lr, int bin ) const {
218 int parId = ( layid * 288 ) + ( entr * 48 ) + ( lr * 24 ) + bin;
219 return parId;
220}
221
222#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
NTuple::Item< double > m_t0
*************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 finalize()
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 getWireEff(int wireid) 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
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 getDelT0(int wireid) const
double getVprop(int lay) const
virtual StatusCode initialize()
void handle(const Incident &)
double getT0(int wireid) const
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
double getTimeWalk(int layid, double Q) const