36 base_class (name, svcloc) {
37 declareProperty(
"ReadSatuDeadEnDb", m_readSatuDeadEnDb =
true);
39 for(
int i=0;i<6240;i++){
40 m_CrystalEmaxData[i]=0;
41 m_CrystalDeadEcut[i]=-1;
43 if (m_readSatuDeadEnDb==
true){
49 if (m_readSatuDeadEnDb==
false){
52 m_EmaxVersion4740=
false;
53 m_EmaxVersion4750=
false;
54 m_EmaxVersion4780=
false;
55 m_EmaxVersion4840=
false;
56 m_EmaxVersion4914=
false;
57 m_EmaxVersion4946=
false;
59 m_DeadEcutVersion2020=
false;
61 for(
int i=0;i<6240;i++){
62 m_CrystalEmaxData_1[i]=0;
63 m_CrystalEmaxData_2[i]=0;
64 m_CrystalEmaxData_4740[i]=0;
65 m_CrystalEmaxData_4750[i]=0;
66 m_CrystalEmaxData_4780[i]=0;
67 m_CrystalEmaxData_4840[i]=0;
68 m_CrystalEmaxData_4914[i]=0;
69 m_CrystalEmaxData_4946[i]=0;
71 m_CrystalDeadEcut_2020[i]=-1;
80 string paraPath = getenv(
"EMCCALIBCONSTSVCROOT");
81 paraPath +=
"/share/emax_data.dat";
83 in.open(paraPath.c_str());
86 while (in.peek() != EOF)
89 in >> ixtal>>emaxData;
91 m_CrystalEmaxData_1[ixtal]=emaxData;
100 string paraPath2 = getenv(
"EMCCALIBCONSTSVCROOT");
101 paraPath2 +=
"/share/emax_data_2.dat";
104 in2.open(paraPath2.c_str());
108 while (in2.peek() != EOF)
111 in2 >> ixtal>>emaxData;
113 m_CrystalEmaxData_2[ixtal]=emaxData;
123 string paraPath4740 = getenv(
"EMCCALIBCONSTSVCROOT");
124 paraPath4740 +=
"/share/emax_data_4740.dat";
127 in4740.open(paraPath4740.c_str());
131 while (in4740.peek() != EOF)
134 in4740 >> ixtal>>emaxData;
136 m_CrystalEmaxData_4740[ixtal]=emaxData;
146 string paraPath4750 = getenv(
"EMCCALIBCONSTSVCROOT");
147 paraPath4750 +=
"/share/emax_data_4750.dat";
150 in4750.open(paraPath4750.c_str());
154 while (in4750.peek() != EOF)
157 in4750 >> ixtal>>emaxData;
159 m_CrystalEmaxData_4750[ixtal]=emaxData;
169 string paraPath4780 = getenv(
"EMCCALIBCONSTSVCROOT");
170 paraPath4780 +=
"/share/emax_data_4780.dat";
173 in4780.open(paraPath4780.c_str());
177 while (in4780.peek() != EOF)
180 in4780 >> ixtal>>emaxData;
182 m_CrystalEmaxData_4780[ixtal]=emaxData;
192 string paraPath4840 = getenv(
"EMCCALIBCONSTSVCROOT");
193 paraPath4840 +=
"/share/emax_data_4840.dat";
196 in4840.open(paraPath4840.c_str());
200 while (in4840.peek() != EOF)
203 in4840 >> ixtal>>emaxData;
205 m_CrystalEmaxData_4840[ixtal]=emaxData;
216 string paraPath4914 = getenv(
"EMCCALIBCONSTSVCROOT");
217 paraPath4914 +=
"/share/emax_data_4914.dat";
220 in4914.open(paraPath4914.c_str());
224 while (in4914.peek() != EOF)
227 in4914 >> ixtal>>emaxData;
229 m_CrystalEmaxData_4914[ixtal]=emaxData;
239 string paraPath4946 = getenv(
"EMCCALIBCONSTSVCROOT");
240 paraPath4946 +=
"/share/emax_data_4946.dat";
243 in4946.open(paraPath4946.c_str());
247 while (in4946.peek() != EOF)
250 in4946 >> ixtal>>emaxData;
252 m_CrystalEmaxData_4946[ixtal]=emaxData;
263 string paraPath3 = getenv(
"EMCCALIBCONSTSVCROOT");
264 paraPath3 +=
"/share/DeadThresholdEcut_2020.conf";
267 in3.open(paraPath3.c_str());
272 double DeltaEcut=0.0;
274 while (in3.peek() != EOF)
277 in3 >> ixtal>>satuEn>>Ecut;
278 if ((Ecut-satuEn)>DeltaEcut) {
279 m_CrystalDeadEcut_2020[ixtal]=Ecut-DeltaEcut;
281 m_CrystalDeadEcut_2020[ixtal]=Ecut;
307 MsgStream log(messageService(), name());
308 log << MSG::INFO <<
"EmcCalibConstSvc::initialize()" << endreq;
310 StatusCode sc = Service::initialize();
311 if( sc.isFailure() )
return sc;
314 IIncidentSvc* incsvc;
315 sc = service(
"IncidentSvc", incsvc);
317 if( sc.isSuccess() ){
318 incsvc -> addListener(
this,
"NewRun", priority);
321 sc = serviceLocator()->service(
"EventDataSvc", m_eventSvc,
true);
322 if (sc .isFailure() ) {
323 log << MSG::ERROR <<
"Unable to find EventDataSvc " << endreq;
328 if( sc == StatusCode::SUCCESS ){
329 log << MSG::INFO <<
"Retrieve IDataProviderSvc" << endreq;
331 log << MSG::FATAL <<
"can not get IDataProviderSvc" << endreq;
343 ISvcLocator* svcLocator = Gaudi::svcLocator();
344 sc = svcLocator->service(
"EmcSatuDeadEnSvc", m_EmcSatuDeadEnSvc);
347 if( sc == StatusCode::SUCCESS){
349 std::cout<<
"Retrieve EmcSatuDeadEnSvc" << endl;
354 log << MSG::FATAL <<
"can not get EmcSatuDeadEnSvc" << endreq;
362 return StatusCode::SUCCESS;
376 MsgStream log( messageService(), name() );
377 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
379 if ( inc.type() ==
"NewRun" ){
380 log << MSG::DEBUG <<
"NewRun" << endreq;
382 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,
"/Event/EventHeader");
383 int run = eventHeader->runNumber();
385 log << MSG::DEBUG <<
"handle: " <<
"Run in handle is: "<<run<< endreq;
387 if (m_readSatuDeadEnDb==
true&&run<0){
388 if (run<0) run = -run;
390 if (run>=m_runFrom&&run<=m_runTo) {
395 if (m_inFlag==
false){
399 log << MSG::ERROR <<
"can not get EmcSatuDeadEnSvc" << endreq;
401 m_runFrom=m_EmcSatuDeadEnSvc -> getRunFrom();
402 m_runTo=m_EmcSatuDeadEnSvc -> getRunTo();
404 cout <<
"current run=" << run<<endl;
405 cout <<
"RunFrom="<< m_runFrom<<
",RunTo="<< m_runTo<<endl;
406 cout <<
"in EmcCalibConstSvc open getSatuEnFile()= " << m_EmcSatuDeadEnSvc -> getSatuEnFile()<<endl;
407 cout <<
"open getDeadEnFile()= " << m_EmcSatuDeadEnSvc -> getDeadEnFile()<<endl;
408 string aEmcSatuEnFile;
409 string aEmcDeadEnFile;
410 aEmcSatuEnFile= m_EmcSatuDeadEnSvc -> getSatuEnFile();
411 aEmcDeadEnFile= m_EmcSatuDeadEnSvc -> getDeadEnFile();
414 inSatuEn.open(aEmcSatuEnFile.c_str());
417 if (inSatuEn.is_open()){
421 while (inSatuEn.peek() != EOF)
423 inSatuEn >> ixtal>>emaxData;
429 std::cout <<
"EmcCalibConstSvc ERROR::Could not open the file of " <<aEmcSatuEnFile<< endl;
435 inDeadEn.open(aEmcDeadEnFile.c_str());
437 if (inDeadEn.is_open()){
440 double satuEn,deadEn;
441 while (inDeadEn.peek() != EOF)
443 inDeadEn >> ixtal>>satuEn>>deadEn;
449 std::cout <<
"EmcCalibConstSvc ERROR::Could not open the file of " <<aEmcDeadEnFile<< endl;
462 if (m_readSatuDeadEnDb==
false&&run<0){
465 if (run<0) run = -run;
468 log << MSG::DEBUG <<
"handle: " <<
"Run in handle is: "<<run<< endreq;
470 cout<<
"handle: " <<
"Run in handle is: "<<run<<endl;
485 cout<<
"handle: " <<
"EmaxVersion="<<
"111111111111111"<<endl;
500 cout<<
"handle: " <<
"EmaxVersion="<<
"emax data from topup data 4680@2020"<<endl;
516 cout<<
"handle: " <<
"EmaxVersion="<<
"emax data from 4740data@2021"<<endl;
531 cout<<
"handle: " <<
"EmaxVersion="<<
"emax data from 4750data@2021"<<endl;
546 cout<<
"handle: " <<
"EmaxVersion="<<
"emax data from 4780data@2021"<<endl;
562 cout<<
"handle: " <<
"EmaxVersion="<<
"emax data from 4840data@2021"<<endl;
577 cout<<
"handle: " <<
"EmaxVersion="<<
"emax data from 4914data@2021"<<endl;
592 cout<<
"handle: " <<
"EmaxVersion="<<
"emax data from 4946data@2021"<<endl;
598 cout<<
"handle: " <<
"DeadEcutVersion="<<
"2020"<<endl;