69 {
70 MsgStream log(
msgSvc(), name() );
71 log << MSG::INFO << "MdcCalibAlg initialze() ..." << endreq;
72 log << MSG::INFO << "MdcCalFlg = " << m_mdcCalFlg << endreq;
73
74 if("NULL"==m_histname){
75 log << MSG::ERROR << "not defined histogram file." << endreq;
76 return StatusCode::FAILURE;
77 }
78 if("NULL"==m_configFile){
79 log << MSG::ERROR << "not defined MdcCalibConfig file." << endreq;
80 return StatusCode::FAILURE;
81 }
82
83 StatusCode sc = service("MdcGeomSvc", m_mdcGeomSvc);
84 if(sc != StatusCode::SUCCESS){
85 log << MSG::ERROR << "can not use MdcGeomSvc" << endreq;
86 }
87
88 sc = service("MdcCalibFunSvc", m_mdcFunSvc);
89 if( sc != StatusCode::SUCCESS ){
90 log << MSG::FATAL << "can not use MdcCalibFunSvc" << endreq;
91 }
92
93 sc = service ("MdcUtilitySvc", m_mdcUtilitySvc);
94 if ( sc.isFailure() ){
95 log << MSG::FATAL << "Could not load MdcUtilitySvc!" << endreq;
96 }
97
98 string estver = getenv("ESTIMEALGROOT");
99 cout << "EsTimeAlg_ver: "<< estver << endl;
100
101
102 initParam();
103
104
105 int i;
106 int lay;
107 std::string strconfig;
108 std::string strcomment;
109 std::string strtmp;
110 std::string strTes;
111 int fgTes[50];
112 for(i=0; i<50; i++) fgTes[i] = -999;
113 ifstream fconfig( m_configFile.c_str() );
114 if( ! fconfig.is_open() ){
115 log << MSG::ERROR << "can not open config file " << m_configFile
116 << ". Use defalt config parameters" << endreq;
117 return StatusCode::FAILURE;
118 } else {
119 log << MSG::INFO << "Open config file " << m_configFile << endreq;
120 while( fconfig >> strconfig ){
121 if('#' == strconfig[0]){
122 getline(fconfig, strcomment);
123 } else if("FillNtuple" == strconfig){
125 } else if("nEvtNtuple" == strconfig){
127 }else if("FlagCalDetEffi" == strconfig){
129 }else if("BoostPar" == strconfig){
131 } else if("EsTimeFlag" == strconfig){
132 getline(fconfig, strTes);
133 int n = sscanf(strTes.c_str(),
"%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d%d",
134 fgTes+0, fgTes+1, fgTes+2, fgTes+3, fgTes+4,
135 fgTes+5, fgTes+6, fgTes+7, fgTes+8, fgTes+9,
136 fgTes+10, fgTes+11, fgTes+12, fgTes+13, fgTes+14,
137 fgTes+15, fgTes+16, fgTes+17, fgTes+18, fgTes+19);
138 for(i=0; i<
n; i++) m_param.
esFlag[i] = fgTes[i];
140 } else if("TimeShift" == strconfig){
142 } else if("TesMin" == strconfig){
143 fconfig >> m_param.
tesMin;
144 } else if("TesMax" == strconfig){
145 fconfig >> m_param.
tesMax;
146 } else if("FlagIniCalConst" == strconfig){
148 } else if("FlagUpdateTmInPreT0" == strconfig){
150 } else if("InitT0" == strconfig){
151 fconfig >> m_param.
initT0;
152 } else if("T0Shift" == strconfig){
154 } else if("TminFitChindf" == strconfig){
156 } else if("TmaxFitChindf" == strconfig){
158 } else if("InitSigma" == strconfig){
160 } else if("UpdateSigma" == strconfig){
162 } else if("ResidualType" == strconfig){
164 } else if("FixXtC0" == strconfig){
166 } else if("FixXtEdge" == strconfig){
168 } else if("FlagAdjacLayerCut" == strconfig){
170 } else if("FlagBoundLayerCut" == strconfig){
172 } else if("hitStatCut" == strconfig){
174 } else if("nTrkCut" == strconfig){
176 } else if("nHitLayCut" == strconfig){
178 } else if("nHitCut" == strconfig){
180 } else if("noiseCut" == strconfig){
182 } else if("cosThetaCut" == strconfig){
184 } else if("DrCut" == strconfig){
185 fconfig >> m_param.
drCut;
186 } else if("DzCut" == strconfig){
187 fconfig >> m_param.
dzCut;
188 }else if("MaximalDocaInner" == strconfig){
190 }else if("MaximalDocaOuter" == strconfig){
192 } else if("RawTimeFitRange" == strconfig){
194 fconfig >> strtmp
203 >> m_param.
qmax[lay];
204 }
205 }
206 }
207 fconfig.close();
208 }
209
211
212
214
215
217
218 cout << "EsFlag for Mdc Calibration: ";
219 for(
int iEs=0; iEs<m_param.
nEsFlag; iEs++) cout << setw(6) << m_param.
esFlag[iEs];
220 cout << endl;
221
222 m_hlist = new TObjArray(0);
225
227 m_mdcevt -> setParam(m_param);
228 m_mdcevt -> setGeomSvc(m_mdcGeomSvc);
229 m_mdcevt -> setUtilSvc(m_mdcUtilitySvc);
230
231 if( 0 == m_mdcCalFlg ){
233 }else if( 1 == m_mdcCalFlg ){
235 }else if( 2 == m_mdcCalFlg ){
237 }else if( 3 == m_mdcCalFlg ){
239 }else if( 4 == m_mdcCalFlg ){
241 }else if( 9 == m_mdcCalFlg ){
243 }else if( 5 == m_mdcCalFlg ){
245 }else if( 6 == m_mdcCalFlg ){
247 }else if( 7 == m_mdcCalFlg ){
249 }else if( 8 == m_mdcCalFlg ){
251 }
252
253 m_constmgr -> init(m_mdcGeomSvc, m_mdcFunSvc);
254
255 m_mdccalib -> setParam(m_param);
256 m_mdccalib ->
initialize(m_hlist, m_mdcGeomSvc, m_mdcFunSvc, m_mdcUtilitySvc);
257
258
259
260 return StatusCode::SUCCESS;
261}
double resiCut[MdcCalNLayer]
double tmaxFitRange[MdcCalNLayer][2]
double qmax[MdcCalNLayer]
int fgCalib[MdcCalNLayer]
double tminFitRange[MdcCalNLayer][2]
double initTm[MdcCalNLayer]
double qmin[MdcCalNLayer]