5#include "MdcTunningSvc.h"
6#include "GaudiKernel/Kernel.h"
7#include "GaudiKernel/IInterface.h"
8#include "GaudiKernel/StatusCode.h"
9#include "GaudiKernel/SvcFactory.h"
10#include "GaudiKernel/MsgStream.h"
12#include "GaudiKernel/IIncidentSvc.h"
13#include "GaudiKernel/Incident.h"
14#include "GaudiKernel/IIncidentListener.h"
16#include "GaudiKernel/ISvcLocator.h"
17#include "GaudiKernel/Bootstrap.h"
20#include "EventModel/EventModel.h"
21#include "EventModel/Event.h"
22#include "EventModel/EventHeader.h"
23#include "GaudiKernel/SmartDataPtr.h"
25#include "DatabaseSvc/DatabaseSvc.h"
30 Service (name, svcloc){
33 declareProperty(
"UseDatabase",m_dbFlag=
false);
34 declareProperty(
"UseEndcapTuning",m_EndcapTuning=1);
35 declareProperty(
"EffFile", m_effFile= std::string(
"no path"));
36 declareProperty(
"ResFile", m_resFile= std::string(
"no path"));
37 declareProperty(
"EffFile_endcap", m_effFile_endcap= std::string(
"no path"));
38 declareProperty(
"ResFile_endcap", m_resFile_endcap= std::string(
"no path"));
39 declareProperty(
"path_mdc", m_path= std::string(
"no path"));
40 declareProperty(
"Host" , host = std::string(
"bes3db2.ihep.ac.cn"));
41 declareProperty(
"DbName" , dbName = std::string(
"offlinedb"));
42 declareProperty(
"UserName" , userName = std::string(
"guest"));
43 declareProperty(
"Password" , password = std::string(
"guestpass"));
44 declareProperty(
"SerialNo" , serialNo = 0);
45 declareProperty(
"fromDB", m_fromDB=
true);
46 declareProperty(
"ParBossVer", m_ParBossVer= std::string(
"unknown"));
48 int no[43]={40,44,48,56,64,72,80,80,76,76,88,88,100,100,112,112,128,128,140,140,160,160,160,160,176,176,176,176,208,208,208,208,240,240,240,240,256,256,256,256,288,288,288};
50 for(
int i=0;i<43;i++){
57 if(m_BesMdcRes)
delete m_BesMdcRes;
61 if( IID_IMdcTunningSvc.versionMatch(riid) ){
64 return Service::queryInterface(riid, ppvInterface);
66 return StatusCode::SUCCESS;
71 MsgStream log(messageService(), name());
72 log << MSG::INFO <<
"MdcTunningSvc::initialize()" << endreq;
74 m_ParBossVer=getenv(
"BES_RELEASE");
76 StatusCode sc = Service::initialize();
77 if( sc.isFailure() )
return sc;
81 sc = serviceLocator()->service(
"DatabaseSvc", m_dbsvc,
true);
82 if (sc .isFailure() ) {
83 log << MSG::ERROR <<
"Unable to find DatabaseSvc " << endreq;
102 IIncidentSvc* incsvc;
103 sc = service(
"IncidentSvc", incsvc);
105 if( sc.isSuccess() ){
106 incsvc -> addListener(
this,
"NewRun", priority);
108 sc = serviceLocator()->service(
"EventDataSvc", m_eventSvc,
true);
109 if (sc .isFailure() ) {
110 log << MSG::ERROR <<
"Unable to find EventDataSvc " << endreq;
119 return StatusCode::SUCCESS;
123 MsgStream log(messageService(), name());
124 log << MSG::INFO <<
"MdcTunningSvc::finalize()" << endreq;
127 return StatusCode::SUCCESS;
131 MsgStream log( messageService(), name() );
132 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
134 if ( inc.type() ==
"NewRun" ){
135 log << MSG::DEBUG <<
"NewRun" << endreq;
139 log << MSG::ERROR <<
"can not get MdcTuning data from the database" << endreq;
147 std::string FilePath = getenv(
"MDCTUNNINGSVCROOT");
148 if(m_effFile==std::string(
"no path")){
150 m_effFile=FilePath+
"/dat/mc_eff_psipp.dat";
153 if(m_resFile==std::string(
"no path")){
155 m_resFile=FilePath+
"/dat/mc_res_psipp.dat";
159 cout<<
"!!!!!!!!!!!!!!!!! MdcTunningSvc::initTunningConst setMcRes"<<endl;
166 double lay,
bin,expect,hit;
168 std::istringstream readMCEff;
171 readMCEff.str(eff_con);
174 ifstream in(eff_con.c_str());
180 istreambuf_iterator<char>
iter(in) ;
181 string strCache = string(
iter, (istreambuf_iterator<char>()) );
182 readMCEff.str(strCache);
187 if(!readMCEff.good()){
188 std::cout<<
" Error , mdc tuning effFile: "<<m_effFile<<
" not exist "<<std::endl;
191 std::cout<<
" Open mdc tuning effFile: "<<m_effFile<<std::endl;
194 getline(readMCEff,line);
195 for(j=0;j<docaNo;j++){
196 readMCEff>>
bin>>docaEff[i][j]>>expect>>hit;
199 getline(readMCEff,line);
200 for(j=0;j<thetaNo;j++){
201 readMCEff>>
bin>>thetaEff[i][j]>>expect>>hit;
204 getline(readMCEff,line);
205 for(j=0;j<cellNo[i];j++){
206 readMCEff>>
bin>>cellEff[i][j]>>expect>>hit;
212 getline(readMCEff,line);
213 for(j=0;j<docaNo;j++){
214 readMCEff>>
bin>>docaEff_2[i][j]>>expect>>hit;
217 getline(readMCEff,line);
218 for(j=0;j<thetaNo;j++){
219 readMCEff>>
bin>>thetaEff_2[i][j]>>expect>>hit;
223 getline(readMCEff,line);
224 for(j=0;j<cellNo[i];j++){
225 readMCEff>>
bin>>cellEff_2[i][j]>>expect>>hit;
239 ifstream readMCRes(m_resFile.c_str());
240 if(!readMCRes.good()){
241 std::cout<<
" Error , mdc tuning file: "<<m_resFile<<
" not exist "<<std::endl;
244 std::cout<<
" Open mdc tuning file: "<<m_resFile<<std::endl;
247 getline(readMCRes,line);
248 getline(readMCRes,line);
249 for(j=0;j<docaNo;j++){
250 readMCRes>>
bin>>docaRes[i][j][0][0]>>docaRes[i][j][0][1];
253 getline(readMCRes,line);
254 getline(readMCRes,line);
255 for(j=0;j<docaNo;j++){
256 readMCRes>>
bin>>docaRes[i][j][1][0]>>docaRes[i][j][1][1];
274 std::istringstream readMCRes;
277 readMCRes.str(res_con);
281 ifstream in(res_con.c_str());
282 istreambuf_iterator<char>
iter(in) ;
283 string strCache = string(
iter, (istreambuf_iterator<char>()) );
284 readMCRes.str(strCache);
286 if(!readMCRes.good()){
287 std::cout<<
" Error , mdc tuning file: "<<m_resFile<<
" not exist "<<std::endl;
290 std::cout<<
" MdcTunningSvc::setMcRes2() Open mdc tuning resfile "<<m_resFile<<std::endl;
293 getline(readMCRes,line);
294 getline(readMCRes,line);
295 for(j=0;j<docaNo;j++){
296 readMCRes>>
bin>>docaF[i][j][0]>>docaMean1[i][j][0]>>docaSigma1[i][j][0]>>docaMean2[i][j][0]>>docaSigma2[i][j][0];
299 getline(readMCRes,line);
300 getline(readMCRes,line);
301 for(j=0;j<docaNo;j++){
302 readMCRes>>
bin>>docaF[i][j][1]>>docaMean1[i][j][1]>>docaSigma1[i][j][1]>>docaMean2[i][j][1]>>docaSigma2[i][j][1];
307 getline(readMCRes,line);
308 getline(readMCRes,line);
309 for(j=0;j<docaNo;j++){
310 readMCRes>>
bin>>docaF_2[i][j][0]>>docaMean1_2[i][j][0]>>docaSigma1_2[i][j][0]>>docaMean2_2[i][j][0]>>docaSigma2_2[i][j][0];
313 getline(readMCRes,line);
314 getline(readMCRes,line);
315 for(j=0;j<docaNo;j++){
316 readMCRes>>
bin>>docaF_2[i][j][1]>>docaMean1_2[i][j][1]>>docaSigma1_2[i][j][1]>>docaMean2_2[i][j][1]>>docaSigma2_2[i][j][1];
328 std::istringstream readMCRes;
331 readMCRes.str(res_con);
335 ifstream in(res_con.c_str());
336 istreambuf_iterator<char>
iter(in) ;
337 string strCache = string(
iter, (istreambuf_iterator<char>()) );
338 readMCRes.str(strCache);
340 if(!readMCRes.good()){
341 std::cout<<
" Error , mdc tuning resfile: "<<m_resFile<<
" not exist "<<std::endl;
344 std::cout<<
" MdcTunningSvc::setMcRes3() Open mdc tuning resfile: "<<m_resFile<<std::endl;
347 getline(readMCRes,line);
348 getline(readMCRes,line);
349 for(j=0;j<docaNo;j++){
350 readMCRes>>
bin>>docaF[i][j][0]>>docaMean1[i][j][0]>>docaSigma1[i][j][0]>>docaMean2[i][j][0]>>docaSigma2[i][j][0]>>resLargest[i][j][0]>>resSmallest[i][j][0]>>resRatio[i][j][0];
353 getline(readMCRes,line);
354 getline(readMCRes,line);
355 for(j=0;j<docaNo;j++){
356 readMCRes>>
bin>>docaF[i][j][1]>>docaMean1[i][j][1]>>docaSigma1[i][j][1]>>docaMean2[i][j][1]>>docaSigma2[i][j][1]>>resLargest[i][j][1]>>resSmallest[i][j][1]>>resRatio[i][j][1];
362 getline(readMCRes,line);
363 getline(readMCRes,line);
364 for(j=0;j<docaNo;j++){
365 readMCRes>>
bin>>docaF_2[i][j][0]>>docaMean1_2[i][j][0]>>docaSigma1_2[i][j][0]>>docaMean2_2[i][j][0]>>docaSigma2_2[i][j][0]>>resLargest_2[i][j][0]>>resSmallest_2[i][j][0]>>resRatio_2[i][j][0];
368 getline(readMCRes,line);
369 getline(readMCRes,line);
370 for(j=0;j<docaNo;j++){
372 readMCRes>>
bin>>docaF_2[i][j][1]>>docaMean1_2[i][j][1]>>docaSigma1_2[i][j][1]>>docaMean2_2[i][j][1]>>docaSigma2_2[i][j][1]>>resLargest_2[i][j][1]>>resSmallest_2[i][j][1]>>resRatio_2[i][j][1];
390 if(m_BesMdcRes)
delete m_BesMdcRes;
400 if((driftD<mindD)||(driftD>maxdD)){
403 for(
int kk = 0; kk < 9; kk++){
404 if((driftD>=(
double)kk)&&(driftD<(
double)(kk+1))){
411 sigma1 = (m_BesMdcRes -> getD_dD(layerId ,bindD)) ;
423 for(
int jj =0;jj<9;jj++){
424 if((driftD<mindD)||(driftD>maxdD)){
426 }
else if((driftD>=jj)&&(driftD<(jj+1))){
430 double y0D = (m_BesMdcRes -> getD_dD(layerId ,bindD)) ;
431 double y1D = (m_BesMdcRes -> getD_dD(layerId, bindD+1)) ;
432 double yD = y0D + (y1D-y0D)*(driftD - bindD);
433 double y0M = (m_BesMdcRes -> getM_dD(layerId ,bindD)) ;
434 double y1M = (m_BesMdcRes -> getM_dD(layerId ,bindD+1));
435 double yM = y0M + (y1M-y0M)*(driftD - bindD);
436 double dely = yD - yM ;
456 double minCos = -0.8 ;
457 double minCos2 = -0.7 ;
458 double maxCos = 0.8 ;
460 for(
int ii = 0; ii <16; ii++){
461 if((costta<minCos)||(costta>maxCos)){
463 }
else if((costta>=(minCos + ii*0.1))&&(costta<(minCos2 + ii*0.1))){
468 double y0D = (m_BesMdcRes -> getD_theta(layerId ,binTa));
469 double y1D = (m_BesMdcRes -> getD_theta(layerId ,binTa+1));
470 double y0M = (m_BesMdcRes -> getM_theta(layerId,binTa));
471 double y1M = (m_BesMdcRes -> getM_theta(layerId,binTa+1));
473 double yD[16],yM[16],Del[16];
474 for(
int ll =0;ll<16;ll++){
475 yD[ll] = y0D + (y1D - y0D)/0.1*(costta - (minCos + ll*0.1));
476 yM[ll] = y0M + (y1M - y0D)/0.1*(costta - (minCos + ll*0.1));
477 Del[ll] = yD[ll] - yM[ll] ;
482 if((binTa>=0)&&(binTa<=5)){
483 delTha = Del[binTa] * 0.118 ;
484 }
else if((binTa>5)&&(binTa<=10)){
485 delTha = Del[binTa] * 0.518 ;
486 }
else if((binTa>10)&&(binTa<=15)){
487 delTha = Del[binTa] * 0.218 ;
501 if(posFlag==0)driftD *= -1;
503 if(layerId<0 || layerId>42)std::cout<<
" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl;
504 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<
"MdcTuningSvc:wrong cellId "<<cellId<<std::endl;
506 if(fabs(cosTheta)>1){
507 std::cout<<
"MdcTuningSvc:wrong coseTheta "<<cosTheta<<std::endl;
511 int thetaBin=(int)floor((cosTheta+1)*thetaNo/2.);
514 int docaBin=(int)floor((driftD+12)*docaNo/24.);
515 if(m_EndcapTuning==0)
516 eff = docaEff[layerId][docaBin] * thetaEff[layerId][thetaBin] * cellEff[layerId][cellId];
518 if(fabs(cosTheta)<=0.83)
519 eff = docaEff[layerId][docaBin] * thetaEff[layerId][thetaBin] * cellEff[layerId][cellId];
521 eff = docaEff_2[layerId][docaBin] * thetaEff_2[layerId][thetaBin] * cellEff_2[layerId][cellId];
532double MdcTunningSvc::GetRes(
int layerId,
int cellId,
double driftD,
double cosTheta,
int posFlag,
double entranceAngle,
double& mean,
double& sigma){
539 if(posFlag==0)driftD *= -1;
541 if(layerId<0 || layerId>42)std::cout<<
" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl;
542 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<
"MdcTuningSvc:wrong cellId "<<cellId<<std::endl;
544 if(fabs(cosTheta)>1){
545 std::cout<<
"MdcTuningSvc:wrong cosTheta "<<cosTheta<<std::endl;
552 int docaBin=(int)floor((driftD+12)*docaNo/24.);
554 mean=docaRes[layerId][docaBin][0][0];
555 sigma=docaRes[layerId][docaBin][0][1];
557 mean=docaRes[layerId][docaBin][1][0];
558 sigma=docaRes[layerId][docaBin][1][1];
567double MdcTunningSvc::GetRes2(
int layerId,
int cellId,
double driftD,
double cosTheta,
int posFlag,
double entranceAngle,
double& f,
double& mean1,
double& sigma1,
double& mean2,
double& sigma2){
574 if(posFlag==0)driftD *= -1;
576 if(layerId<0 || layerId>42)std::cout<<
" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl;
577 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<
"MdcTuningSvc:wrong cellId "<<cellId<<std::endl;
579 if(fabs(cosTheta)>1){
580 std::cout<<
"MdcTuningSvc:wrong cosTheta "<<cosTheta<<std::endl;
587 int docaBin=(int)floor((driftD+12)*docaNo/24.);
588 if(m_EndcapTuning==0) {
590 f=docaF[layerId][docaBin][0];
591 mean1=docaMean1[layerId][docaBin][0];
592 sigma1=docaSigma1[layerId][docaBin][0];
593 mean2=docaMean2[layerId][docaBin][0];
594 sigma2=docaSigma2[layerId][docaBin][0];
596 f=docaF[layerId][docaBin][1];
597 mean1=docaMean1[layerId][docaBin][1];
598 sigma1=docaSigma1[layerId][docaBin][1];
599 mean2=docaMean2[layerId][docaBin][1];
600 sigma2=docaSigma2[layerId][docaBin][1];
603 if(fabs(cosTheta)<=0.83) {
605 f=docaF[layerId][docaBin][0];
606 mean1=docaMean1[layerId][docaBin][0];
607 sigma1=docaSigma1[layerId][docaBin][0];
608 mean2=docaMean2[layerId][docaBin][0];
609 sigma2=docaSigma2[layerId][docaBin][0];
611 f=docaF[layerId][docaBin][1];
612 mean1=docaMean1[layerId][docaBin][1];
613 sigma1=docaSigma1[layerId][docaBin][1];
614 mean2=docaMean2[layerId][docaBin][1];
615 sigma2=docaSigma2[layerId][docaBin][1];
619 f=docaF_2[layerId][docaBin][0];
620 mean1=docaMean1_2[layerId][docaBin][0];
621 sigma1=docaSigma1_2[layerId][docaBin][0];
622 mean2=docaMean2_2[layerId][docaBin][0];
623 sigma2=docaSigma2_2[layerId][docaBin][0];
625 f=docaF_2[layerId][docaBin][1];
626 mean1=docaMean1_2[layerId][docaBin][1];
627 sigma1=docaSigma1_2[layerId][docaBin][1];
628 mean2=docaMean2_2[layerId][docaBin][1];
629 sigma2=docaSigma2_2[layerId][docaBin][1];
640double MdcTunningSvc::GetRes3(
int layerId,
int cellId,
double driftD,
double cosTheta,
int posFlag,
double entranceAngle,
double& f,
double& mean1,
double& sigma1,
double& mean2,
double& sigma2,
double& ResLargest,
double& ResSmallest,
double& ResRatio){
647 if(posFlag==0)driftD *= -1;
649 if(layerId<0 || layerId>42)std::cout<<
" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl;
650 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<
"MdcTuningSvc:wrong cellId "<<cellId<<std::endl;
652 if(fabs(cosTheta)>1){
653 std::cout<<
"MdcTuningSvc:wrong cosTheta "<<cosTheta<<std::endl;
660 int docaBin=(int)floor((driftD+12)*docaNo/24.);
661 if(m_EndcapTuning==0) {
663 f=docaF[layerId][docaBin][0];
664 mean1=docaMean1[layerId][docaBin][0];
665 sigma1=docaSigma1[layerId][docaBin][0];
666 mean2=docaMean2[layerId][docaBin][0];
667 sigma2=docaSigma2[layerId][docaBin][0];
668 ResLargest=resLargest[layerId][docaBin][0];
669 ResSmallest=resSmallest[layerId][docaBin][0];
670 ResRatio=resRatio[layerId][docaBin][0];
673 f=docaF[layerId][docaBin][1];
674 mean1=docaMean1[layerId][docaBin][1];
675 sigma1=docaSigma1[layerId][docaBin][1];
676 mean2=docaMean2[layerId][docaBin][1];
677 sigma2=docaSigma2[layerId][docaBin][1];
678 ResLargest=resLargest[layerId][docaBin][1];
679 ResSmallest=resSmallest[layerId][docaBin][1];
680 ResRatio=resRatio[layerId][docaBin][1];
683 if(fabs(cosTheta)<=0.83) {
685 f=docaF[layerId][docaBin][0];
686 mean1=docaMean1[layerId][docaBin][0];
687 sigma1=docaSigma1[layerId][docaBin][0];
688 mean2=docaMean2[layerId][docaBin][0];
689 sigma2=docaSigma2[layerId][docaBin][0];
690 ResLargest=resLargest[layerId][docaBin][0];
691 ResSmallest=resSmallest[layerId][docaBin][0];
692 ResRatio=resRatio[layerId][docaBin][0];
694 f=docaF[layerId][docaBin][1];
695 mean1=docaMean1[layerId][docaBin][1];
696 sigma1=docaSigma1[layerId][docaBin][1];
697 mean2=docaMean2[layerId][docaBin][1];
698 sigma2=docaSigma2[layerId][docaBin][1];
699 ResLargest=resLargest[layerId][docaBin][1];
700 ResSmallest=resSmallest[layerId][docaBin][1];
701 ResRatio=resRatio[layerId][docaBin][1];
705 f=docaF_2[layerId][docaBin][0];
706 mean1=docaMean1_2[layerId][docaBin][0];
707 sigma1=docaSigma1_2[layerId][docaBin][0];
708 mean2=docaMean2_2[layerId][docaBin][0];
709 sigma2=docaSigma2_2[layerId][docaBin][0];
710 ResLargest=resLargest_2[layerId][docaBin][0];
711 ResSmallest=resSmallest_2[layerId][docaBin][0];
712 ResRatio=resRatio_2[layerId][docaBin][0];
714 f=docaF_2[layerId][docaBin][1];
715 mean1=docaMean1_2[layerId][docaBin][1];
716 sigma1=docaSigma1_2[layerId][docaBin][1];
717 mean2=docaMean2_2[layerId][docaBin][1];
718 sigma2=docaSigma2_2[layerId][docaBin][1];
719 ResLargest=resLargest_2[layerId][docaBin][1];
720 ResSmallest=resSmallest_2[layerId][docaBin][1];
721 ResRatio=resRatio_2[layerId][docaBin][1];
752 }
else{ driftD = driftD ;}
754 if( (driftD < mindD) || (driftD > maxdD) ){
757 for(
double dd=-9.;dd<9.;dd++){
759 if( (driftD>= dd ) && (driftD < (dd+1.)) ){
765 sigmaE = (m_BesMdcRes -> getD_iEntr(layerId,iEntr,bindD) );
785 }
else{ driftD = driftD ;}
787 if( (driftD < mindD) || (driftD > maxdD) ){
790 for(
double dd =-9.; dd<9.;dd++){
792 if( (driftD>=dd ) && (driftD < (dd+1.)) ){
799 double y0D = (m_BesMdcRes -> getD_iEntr(lay,iEntr,bindD) );
800 double y1D = (m_BesMdcRes -> getD_iEntr(lay,iEntr,bindD+1) );
801 double yD = y0D + (y1D-y0D)*(driftD - dD[bindD]);
802 double y0M = (m_BesMdcRes -> getM_iEntr(lay,iEntr,bindD) );
803 double y1M = (m_BesMdcRes -> getM_iEntr(lay,iEntr,bindD+1));
804 double yM = y0M + (y1M-y0M)*(driftD - dD[bindD]);
805 double dely = yD - yM ;
816 MsgStream log(messageService(), name());
817 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,
"/Event/EventHeader");
818 int run=eventHeader->runNumber();
820 log << MSG::INFO <<
"MdcTuningSvc::getMdcTuningTableInfo() run =" << run << endreq;
821 if(m_ParBossVer==std::string(
"unknown"))std::cout<<
"MdcTuningSvc::getMdcTuningTableInfo() : ERROR = there is no ParBossVer "<<endl;
822 else log << MSG::INFO <<
"MdcTuningSvc::getMdcTuningTableInfo() : ParBossVer = " << m_ParBossVer << endl;
831 for(
int i=0;i<1000;i++){
835 std::cout<<
" ========== 1 =============="<<endl;
837 sprintf(stmt1,
"select MdcRes,MdcEff from MdcTuning where RunFrom <= %d and RunTo >= %d and SftVer = \"%s\"",run1,run1,m_ParBossVer.c_str());
838 std::cout<<
"stmt1:"<<stmt1<<std::endl;
841 int status = m_dbsvc->
query(
"offlinedb",stmt1,result);
843 log << MSG::ERROR <<
"ERROR Read MdcRes,MdcEff from the MdcTuning table" << endreq;
844 return StatusCode::FAILURE;
847 if(result.size()>=1){
870 sprintf(stmt2,
"select MdcRes,MdcEff from MdcTuning where RunFrom <= %d and RunTo >= %d and SftVer = \"%s\"",run2,run2,m_ParBossVer.c_str());
873 status = m_dbsvc->
query(
"offlinedb",stmt2,result);
875 log << MSG::ERROR <<
"ERROR Read MdcRes,MdcEff.dEdxTuning from the MdcTuning table" << endreq;
876 return StatusCode::FAILURE;
879 if(result.size()>=1){
890 if(cnt!=0&&cnt!=1000) {
891 log << MSG::INFO <<
"get MDC tuning data from run " <<run+cnt*j<<
" instead of run"<< run<< endreq;
894 std::cout<<
"cnt ="<<cnt<<std::endl;
896 log << MSG::ERROR <<
"can not read Data from DB"<< endreq;
898 return StatusCode::FAILURE;
909 int row = result.size()-1;
910 string ggg = result[row]->GetString(
"MdcEff");
911 string fff = result[row]->GetString(
"MdcRes");
913 log << MSG::DEBUG <<
"MdcTunning Data: MdcEff: " << ggg <<
" MdcRes: " << fff << endreq;
918 if(!stEff)
return StatusCode::FAILURE;
919 if(!stRes)
return StatusCode::FAILURE;
920 return StatusCode::SUCCESS;
*******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
virtual int query(const std::string &dbName, const std::string &sql, DatabaseRecordVector &res)=0
double DelEtr_Sig(int lay, double enterA, int ilr, double driftD)
void setMdcRes(std::string path)
bool setMcRes2(std::string res_con)
bool setMcRes3(std::string res_con)
StatusCode getMdcTuningTableInfo()
double Delcostta(int layerId, double costta)
void handle(const Incident &)
double ResvEntr(int layerId, double enterA, int ilr, double driftD)
bool setMcEff(std::string eff_con)
double NewSig(int layerId, double driftD)
double DeldriftD(int layerId, double driftD)
double GetRes(int layerId, int cellId, double driftD, double cosTheta, int posFlag, double entranceAngle, double &mean, double &sigma)
double GetEff(int layerId, int cellId, double driftD, double cosTheta, int posFlag)
MdcTunningSvc(const std::string &name, ISvcLocator *svcloc)
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvUnknown)
virtual StatusCode finalize()
double GetRes2(int layerId, int cellId, double driftD, double cosTheta, int posFlag, double entranceAngle, double &f, double &mean1, double &sigma1, double &mean2, double &sigma2)
double GetRes3(int layerId, int cellId, double driftD, double cosTheta, int posFlag, double entranceAngle, double &f, double &mean1, double &sigma1, double &mean2, double &sigma2, double &ResLargest, double &ResSmallest, double &ResRatio)
virtual StatusCode initialize()