76 {
77 MsgStream log(
msgSvc(), name() );
78 log << MSG::INFO << "MdcCalibAlg initialze() ..." << endreq;
79 log << MSG::INFO << "MdcCalFlg = " << m_mdcCalFlg << endreq;
80
81 if("NULL"==m_histname){
82 log << MSG::ERROR << "not defined histogram file." << endreq;
83 return StatusCode::FAILURE;
84 }
85 if("NULL"==m_configFile){
86 log << MSG::ERROR << "not defined MdcCalibConfig file." << endreq;
87 return StatusCode::FAILURE;
88 }
89
90 StatusCode sc = service("MdcGeomSvc", m_mdcGeomSvc);
91 if(sc != StatusCode::SUCCESS){
92 log << MSG::ERROR << "can not use MdcGeomSvc" << endreq;
93 }
94
95 sc = service("MdcCalibFunSvc", m_mdcFunSvc);
96 if( sc != StatusCode::SUCCESS ){
97 log << MSG::FATAL << "can not use MdcCalibFunSvc" << endreq;
98 }
99
100 sc = service ("MdcUtilitySvc", m_mdcUtilitySvc);
101 if ( sc.isFailure() ){
102 log << MSG::FATAL << "Could not load MdcUtilitySvc!" << endreq;
103 }
104
105 string estver = getenv("ESTIMEALGROOT");
106 cout << "EsTimeAlg_ver: "<< estver << endl;
107
108
109 initParam();
110
111
112 int i;
113 int lay;
114 std::string strconfig;
115 std::string strcomment;
116 std::string strtmp;
117 std::string strTes;
118 int fgTes[50];
119 for(i=0; i<50; i++) fgTes[i] = -999;
120 ifstream fconfig( m_configFile.c_str() );
121 if( ! fconfig.is_open() ){
122 log << MSG::ERROR << "can not open config file " << m_configFile
123 << ". Use defalt config parameters" << endreq;
124 return StatusCode::FAILURE;
125 } else {
126 log << MSG::INFO << "Open config file " << m_configFile << endreq;
127 while( fconfig >> strconfig ){
128 if('#' == strconfig[0]){
129 getline(fconfig, strcomment);
130 } else if("FillNtuple" == strconfig){
132 } else if("nEvtNtuple" == strconfig){
134 }else if("FlagCalDetEffi" == strconfig){
136 }else if("BoostPar" == strconfig){
138 } else if("EsTimeCut" == strconfig){
139 fconfig >> m_param.
esCut;
140 } else if("EsTimeFlag" == strconfig){
141 getline(fconfig, strTes);
142 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",
143 fgTes+0, fgTes+1, fgTes+2, fgTes+3, fgTes+4,
144 fgTes+5, fgTes+6, fgTes+7, fgTes+8, fgTes+9,
145 fgTes+10, fgTes+11, fgTes+12, fgTes+13, fgTes+14,
146 fgTes+15, fgTes+16, fgTes+17, fgTes+18, fgTes+19);
147 for(i=0; i<
n; i++) m_param.
esFlag[i] = fgTes[i];
149 } else if("TimeShift" == strconfig){
151 } else if("TesMin" == strconfig){
152 fconfig >> m_param.
tesMin;
153 } else if("TesMax" == strconfig){
154 fconfig >> m_param.
tesMax;
155 } else if("FlagIniCalConst" == strconfig){
157 } else if("FlagUpdateTmInPreT0" == strconfig){
159 } else if("InitT0" == strconfig){
160 fconfig >> m_param.
initT0;
161 } else if("T0Shift" == strconfig){
163 } else if("TminFitChindf" == strconfig){
165 } else if("TmaxFitChindf" == strconfig){
167 } else if("InitSigma" == strconfig){
169 } else if("UpdateSigma" == strconfig){
171 } else if("ResidualType" == strconfig){
173 } else if("FixXtC0" == strconfig){
175 } else if("FixXtEdge" == strconfig){
177 } else if("FlagAdjacLayerCut" == strconfig){
179 } else if("FlagBoundLayerCut" == strconfig){
181 } else if("hitStatCut" == strconfig){
183 } else if("nTrkCut" == strconfig){
185 } else if("nHitLayCut" == strconfig){
187 } else if("nHitCut" == strconfig){
189 } else if("noiseCut" == strconfig){
191 } else if("cosmicDwTrk" == strconfig){
193 } else if("cosThetaCut" == strconfig){
195 } else if("pCut" == strconfig){
196 fconfig >> m_param.
pCut[0] >> m_param.
pCut[1];
197 } else if("DrCut" == strconfig){
198 fconfig >> m_param.
drCut;
199 } else if("DzCut" == strconfig){
200 fconfig >> m_param.
dzCut;
201 }else if("MaximalDocaInner" == strconfig){
203 }else if("MaximalDocaOuter" == strconfig){
205 } else if("charge" == strconfig){
206 fconfig >> m_param.
charge;
207 } else if("RawTimeFitRange" == strconfig){
209 fconfig >> strtmp
218 >> m_param.
qmax[lay];
219 }
220 }
221 }
222 fconfig.close();
223 }
224
226
227
229
230
232
234
235 cout << "EsFlag for Mdc Calibration: ";
236 for(
int iEs=0; iEs<m_param.
nEsFlag; iEs++) cout << setw(6) << m_param.
esFlag[iEs];
237 cout << endl;
238
239 ifstream fwirecal(m_fileWireNoCal.c_str());
240 if(fwirecal.is_open()){
241 cout << "open single wire calibration file: " << m_fileWireNoCal << endl;
242 int wid;
243 getline(fwirecal, strtmp);
244 cout << strtmp << endl;
245 while(fwirecal >> wid){
247 cout << "Wire " << wid << endl;
248 }
249 fwirecal.close();
250 }
251
252 m_hlist = new TObjArray(0);
255
257 m_mdcevt -> setParam(m_param);
258 m_mdcevt -> setGeomSvc(m_mdcGeomSvc);
259 m_mdcevt -> setUtilSvc(m_mdcUtilitySvc);
260
261 if( 0 == m_mdcCalFlg ){
263 }else if( 1 == m_mdcCalFlg ){
265 }else if( 2 == m_mdcCalFlg ){
267 }else if( 3 == m_mdcCalFlg ){
269 }else if( 4 == m_mdcCalFlg ){
271 }else if( 9 == m_mdcCalFlg ){
273 }else if( 5 == m_mdcCalFlg ){
275 }else if( 6 == m_mdcCalFlg ){
277 }else if( 7 == m_mdcCalFlg ){
279 }else if( 8 == m_mdcCalFlg ){
281 }
282
283 m_constmgr ->
init(m_mdcGeomSvc, m_mdcFunSvc);
284
285 m_mdccalib -> setParam(m_param);
286 m_mdccalib ->
initialize(m_hlist, m_mdcGeomSvc, m_mdcFunSvc, m_mdcUtilitySvc);
287
288
289
290 return StatusCode::SUCCESS;
291}
double initTm[MdcCalNLayer]
int fgCalib[MdcCalNLayer]
double tminFitRange[MdcCalNLayer][2]
double qmax[MdcCalNLayer]
double qmin[MdcCalNLayer]
double resiCut[MdcCalNLayer]
int fgWireCal[MdcCalTotCell]
double tmaxFitRange[MdcCalNLayer][2]