#include <MdcTunningSvc.h>
Inheritance diagram for MdcTunningSvc:
Public Member Functions | |
MdcTunningSvc (const std::string &name, ISvcLocator *svcloc) | |
~MdcTunningSvc () | |
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvUnknown) |
virtual StatusCode | initialize () |
virtual StatusCode | finalize () |
void | handle (const Incident &) |
bool | initTuningConst () |
bool | setMcEff (std::string eff_con) |
bool | setMcRes () |
bool | setMcRes2 (std::string res_con) |
bool | setMcRes3 (std::string res_con) |
StatusCode | getMdcTuningTableInfo () |
BesMdcRes * | getMdcRes () |
void | setMdcRes (std::string path) |
double | NewSig (int layerId, double driftD) |
double | DeldriftD (int layerId, double driftD) |
double | Delcostta (int layerId, double costta) |
double | GetEff (int layerId, int cellId, double driftD, double cosTheta, int posFlag) |
double | GetRes (int layerId, int cellId, double driftD, double cosTheta, int posFlag, double entranceAngle, double &mean, double &sigma) |
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) |
double | ResvEntr (int layerId, double enterA, int ilr, double driftD) |
double | DelEtr_Sig (int lay, double enterA, int ilr, double driftD) |
double | get_docaEff (int i, int j) |
double | get_thetaEff (int i, int j) |
double | get_cellEff (int i, int j) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
Private Attributes | |
int | cellNo [43] |
double | docaEff [43][docaNo] |
double | thetaEff [43][thetaNo] |
double | cellEff [43][288] |
double | docaRes [43][docaNo][2][2] |
double | docaF [43][docaNo][2] |
double | docaMean1 [43][docaNo][2] |
double | docaSigma1 [43][docaNo][2] |
double | docaMean2 [43][docaNo][2] |
double | docaSigma2 [43][docaNo][2] |
double | resLargest [43][docaNo][2] |
double | resSmallest [43][docaNo][2] |
double | resRatio [43][docaNo][2] |
double | resLargest_2 [43][docaNo][2] |
double | resSmallest_2 [43][docaNo][2] |
double | resRatio_2 [43][docaNo][2] |
double | docaEff_2 [43][docaNo] |
double | thetaEff_2 [43][thetaNo] |
double | cellEff_2 [43][288] |
double | docaRes_2 [43][docaNo][2][2] |
double | docaF_2 [43][docaNo][2] |
double | docaMean1_2 [43][docaNo][2] |
double | docaSigma1_2 [43][docaNo][2] |
double | docaMean2_2 [43][docaNo][2] |
double | docaSigma2_2 [43][docaNo][2] |
std::string | m_ParBossVer |
double | dD [18] |
int | m_EndcapTuning |
bool | m_dbFlag |
std::string | m_effFile |
std::string | m_resFile |
std::string | m_effFile_endcap |
std::string | m_resFile_endcap |
std::string | m_path |
BesMdcRes * | m_BesMdcRes |
bool | m_fromDB |
IDataProviderSvc * | m_eventSvc |
std::string | host |
std::string | dbName |
std::string | table |
std::string | userName |
std::string | password |
unsigned int | serialNo |
IDatabaseSvc * | m_dbsvc |
Static Private Attributes | |
static const int | docaNo = 60 |
static const int | thetaNo = 40 |
Definition at line 16 of file MdcTunningSvc.h.
MdcTunningSvc::MdcTunningSvc | ( | const std::string & | name, | |
ISvcLocator * | svcloc | |||
) |
MdcTunningSvc::~MdcTunningSvc | ( | ) |
Definition at line 58 of file MdcTunningSvc.cc.
References m_BesMdcRes.
00058 { 00059 if(m_BesMdcRes) delete m_BesMdcRes; 00060 }
double MdcTunningSvc::Delcostta | ( | int | layerId, | |
double | costta | |||
) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 495 of file MdcTunningSvc.cc.
References m_BesMdcRes.
00495 { 00496 int binTa = 0; 00497 int maxTa = 15; 00498 double minCos = -0.8 ; 00499 double minCos2 = -0.7 ; 00500 double maxCos = 0.8 ; 00501 00502 for(int ii = 0; ii <16; ii++){ 00503 if((costta<minCos)||(costta>maxCos)){ 00504 binTa = maxTa; 00505 }else if((costta>=(minCos + ii*0.1))&&(costta<(minCos2 + ii*0.1))){ 00506 binTa = ii; 00507 } 00508 } 00509 00510 double y0D = (m_BesMdcRes -> getD_theta(layerId ,binTa)); 00511 double y1D = (m_BesMdcRes -> getD_theta(layerId ,binTa+1)); 00512 double y0M = (m_BesMdcRes -> getM_theta(layerId,binTa)); 00513 double y1M = (m_BesMdcRes -> getM_theta(layerId,binTa+1)); 00514 00515 double yD[16],yM[16],Del[16]; 00516 for(int ll =0;ll<16;ll++){ 00517 yD[ll] = y0D + (y1D - y0D)/0.1*(costta - (minCos + ll*0.1)); 00518 yM[ll] = y0M + (y1M - y0D)/0.1*(costta - (minCos + ll*0.1)); 00519 Del[ll] = yD[ll] - yM[ll] ; 00520 } 00521 00522 double delTha = 0; 00523 00524 if((binTa>=0)&&(binTa<=5)){ 00525 delTha = Del[binTa] * 0.118 ; 00526 }else if((binTa>5)&&(binTa<=10)){ 00527 delTha = Del[binTa] * 0.518 ; 00528 }else if((binTa>10)&&(binTa<=15)){ 00529 delTha = Del[binTa] * 0.218 ; 00530 } 00531 00532 return delTha ; 00533 00534 }
double MdcTunningSvc::DeldriftD | ( | int | layerId, | |
double | driftD | |||
) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 459 of file MdcTunningSvc.cc.
References m_BesMdcRes.
00459 { 00460 int bindD = 0; 00461 int maxbin =8 ; 00462 double mindD = 0.0 ; 00463 double maxdD = 9.0 ; 00464 00465 for(int jj =0;jj<9;jj++){ 00466 if((driftD<mindD)||(driftD>maxdD)){ 00467 bindD = maxbin; 00468 }else if((driftD>=jj)&&(driftD<(jj+1))){ 00469 bindD = jj ; 00470 } 00471 } 00472 double y0D = (m_BesMdcRes -> getD_dD(layerId ,bindD)) ; 00473 double y1D = (m_BesMdcRes -> getD_dD(layerId, bindD+1)) ; 00474 double yD = y0D + (y1D-y0D)*(driftD - bindD); // calculate the data 00475 double y0M = (m_BesMdcRes -> getM_dD(layerId ,bindD)) ; 00476 double y1M = (m_BesMdcRes -> getM_dD(layerId ,bindD+1)); 00477 double yM = y0M + (y1M-y0M)*(driftD - bindD); // calculate the mc data 00478 double dely = yD - yM ; 00479 00480 00481 /*if((bindD>=1)&&(bindD<=4)){ 00482 // cout<<"layerId :"<<layerId<<" dritfD :"<<driftD<<" dely*0.618:"<<dely*0.618<<endl; 00483 return dely*0.618 ; 00484 }else if((bindD>=5)&&(bindD<7)||(bindD ==8)){ 00485 // cout<<"layerId :"<<layerId<<" dritfD :"<<driftD<<" dely*0.418:"<<dely*0.418<<endl; 00486 return dely*0.418 ; 00487 }else { 00488 // cout<<"layerId :"<<layerId<<" dritfD :"<<driftD<<" dely:"<<dely<<endl; 00489 return dely; 00490 }*/ 00491 return dely; 00492 00493 }
double MdcTunningSvc::DelEtr_Sig | ( | int | lay, | |
double | enterA, | |||
int | ilr, | |||
double | driftD | |||
) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 812 of file MdcTunningSvc.cc.
References dD, and m_BesMdcRes.
00812 { 00813 int bindD = 0; 00814 int maxbin =17; 00815 int iEntr =0; 00816 int ll = -1; 00817 double mindD = -9.; 00818 double maxdD =9.0; 00820 00821 if(enterA < 0){ 00822 iEntr = 0; 00823 }else {iEntr = 1;} 00824 00825 if(ilr == 0 ){ 00826 driftD = -1.*driftD; 00827 }else{ driftD = driftD ;} 00828 00829 if( (driftD < mindD) || (driftD > maxdD) ){ 00830 bindD = maxbin; 00831 }else { 00832 for(double dd =-9.; dd<9.;dd++){ 00833 ll++; 00834 if( (driftD>=dd ) && (driftD < (dd+1.)) ){ 00835 bindD = ll; 00836 dD[bindD] = dd; 00837 } 00838 } 00839 } 00840 00841 double y0D = (m_BesMdcRes -> getD_iEntr(lay,iEntr,bindD) ); 00842 double y1D = (m_BesMdcRes -> getD_iEntr(lay,iEntr,bindD+1) ); 00843 double yD = y0D + (y1D-y0D)*(driftD - dD[bindD]); // calculate the data 00844 double y0M = (m_BesMdcRes -> getM_iEntr(lay,iEntr,bindD) ); 00845 double y1M = (m_BesMdcRes -> getM_iEntr(lay,iEntr,bindD+1)); 00846 double yM = y0M + (y1M-y0M)*(driftD - dD[bindD]); // calculate the mc data 00847 double dely = yD - yM ; 00848 00849 //cout<<"Svc lay:"<<lay<<" iEntr :"<<iEntr<<" bindD :"<<bindD 00850 // <<" dD["<<bindD<<"] : "<<dD[bindD] 00851 // <<" y0D : "<<y0D<<" y1D : "<<y1D<<" yD :"<<yD 00852 // <<" y0M : "<<y0M<<" y1M : "<<y1M<<" yM :"<<yM<<" dely : "<<dely<<endl; 00853 00854 return dely; 00855 00856 }
StatusCode MdcTunningSvc::finalize | ( | ) | [virtual] |
Definition at line 134 of file MdcTunningSvc.cc.
References Bes_Common::INFO.
00134 { 00135 MsgStream log(messageService(), name()); 00136 log << MSG::INFO << "========== MdcTunningSvc::finalize() ==========" << endreq; 00138 00139 return StatusCode::SUCCESS; 00140 }
double MdcTunningSvc::get_cellEff | ( | int | i, | |
int | j | |||
) | [inline, virtual] |
double MdcTunningSvc::get_docaEff | ( | int | i, | |
int | j | |||
) | [inline, virtual] |
double MdcTunningSvc::get_thetaEff | ( | int | i, | |
int | j | |||
) | [inline, virtual] |
double MdcTunningSvc::GetEff | ( | int | layerId, | |
int | cellId, | |||
double | driftD, | |||
double | cosTheta, | |||
int | posFlag | |||
) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 537 of file MdcTunningSvc.cc.
References cellEff, cellEff_2, cellNo, docaEff, docaEff_2, docaNo, m_EndcapTuning, thetaEff, thetaEff_2, and thetaNo.
Referenced by BesMdcDigitizer::Digitize().
00537 { 00538 driftD=fabs(driftD); 00539 if(driftD>12){ 00540 //std::cout<<"MdcTuningSvc: driftD overflow "<<driftD<<std::endl; 00541 driftD=12; 00542 } 00543 if(posFlag==0)driftD *= -1; 00544 00545 if(layerId<0 || layerId>42)std::cout<<" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl; 00546 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<"MdcTuningSvc:wrong cellId "<<cellId<<std::endl; 00547 00548 if(fabs(cosTheta)>1){ 00549 std::cout<<"MdcTuningSvc:wrong coseTheta "<<cosTheta<<std::endl; 00550 cosTheta=1; 00551 } 00552 double eff; 00553 int thetaBin=(int)floor((cosTheta+1)*thetaNo/2.); 00554 //debug 00555 // std::cout<<"cosTheta "<<cosTheta<<" caled "<<(cosTheta+1)*thetaNo/2.<<" floor "<<thetaBin<<std::endl; 00556 int docaBin=(int)floor((driftD+12)*docaNo/24.); 00557 if(m_EndcapTuning==0) 00558 eff = docaEff[layerId][docaBin] * thetaEff[layerId][thetaBin] * cellEff[layerId][cellId]; 00559 else { 00560 if(fabs(cosTheta)<=0.83) 00561 eff = docaEff[layerId][docaBin] * thetaEff[layerId][thetaBin] * cellEff[layerId][cellId]; 00562 else 00563 eff = docaEff_2[layerId][docaBin] * thetaEff_2[layerId][thetaBin] * cellEff_2[layerId][cellId]; 00564 00565 } 00566 //debug 00567 //std::cout<<"tuning svc layer "<<layerId<<"doca"<<docaBin<<" theta "<<thetaBin<<"cell"<<cellId<<" eff "<<eff<<std::endl; 00568 00569 return eff; 00570 }
BesMdcRes * MdcTunningSvc::getMdcRes | ( | ) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 427 of file MdcTunningSvc.cc.
References m_BesMdcRes.
00427 { 00428 return m_BesMdcRes; 00429 }
StatusCode MdcTunningSvc::getMdcTuningTableInfo | ( | ) |
Definition at line 858 of file MdcTunningSvc.cc.
References DatabaseRecordVector::clear(), Bes_Common::DEBUG, calibUtil::ERROR, genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, m_dbsvc, m_eventSvc, m_ParBossVer, IDatabaseSvc::query(), setMcEff(), setMcRes3(), and deljobs::string.
Referenced by handle().
00858 { 00859 MsgStream log(messageService(), name()); 00860 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader"); 00861 int run=eventHeader->runNumber(); 00862 00863 log << MSG::INFO << "MdcTuningSvc::getMdcTuningTableInfo() run =" << run << endreq; 00864 if(m_ParBossVer==std::string("unknown")) 00865 cout << "MdcTuningSvc::getMdcTuningTableInfo() : ERROR: there is no ParBossVer " << endl; 00866 else log << MSG::INFO << "MdcTuningSvc::getMdcTuningTableInfo() : ParBossVer = " << m_ParBossVer << endl; 00867 00868 run = fabs(run); 00872 int j=0; 00873 int cnt=0; 00874 DatabaseRecordVector result; 00875 for(int i=0;i<1000;i++){ 00876 char stmt1[200]; 00877 cnt = i; 00878 int run1 = run+i; 00879 cout << " ==================== " << endl; 00880 //sprintf(stmt1,"select MdcRes,MdcEff,dEdxTuning from MdcTuning where RunFrom <= %d and RunTo >= %d ",run1,run1); 00881 sprintf(stmt1,"select MdcRes,MdcEff from MdcTuning where RunFrom <= %d and RunTo >= %d and SftVer = \"%s\"",run1,run1,m_ParBossVer.c_str()); 00882 cout << " stmt1: " << stmt1 << endl; 00883 00884 result.clear(); 00885 int status = m_dbsvc->query("offlinedb",stmt1,result); 00886 if(status<0){ 00887 cout << " ERROR: can not read MdcRes, MdcEff from the MdcTuning table " << endl; 00888 log << MSG::ERROR << " ERROR Read MdcRes, MdcEff from the MdcTuning table " << endreq; 00889 return StatusCode::FAILURE; 00890 } 00891 00892 if(result.size()>=1){ 00893 00896 00899 // if(mysql_real_query(conn, stmt1, strlen(stmt1))) 00908 j=1; 00909 break; 00910 } 00911 00912 int run2 = run-i; 00913 char stmt2[200]; 00914 //sprintf(stmt2,"select MdcRes,MdcEff.dEdxTuning from MdcTuning where RunFrom <= %d and RunTo >= %d ",run2,run2); 00915 sprintf(stmt2,"select MdcRes,MdcEff from MdcTuning where RunFrom <= %d and RunTo >= %d and SftVer = \"%s\"",run2,run2,m_ParBossVer.c_str()); 00916 00917 result.clear(); 00918 status = m_dbsvc->query("offlinedb",stmt2,result); 00919 if(status<0){ 00920 log << MSG::ERROR << " ERROR Read MdcRes, MdcEff.dEdxTuning from the MdcTuning table " << endreq; 00921 return StatusCode::FAILURE; 00922 } 00923 00924 00925 if(result.size()>=1){ 00932 j=-1; 00933 break; 00934 } 00935 } 00936 00937 if(cnt!=0&&cnt!=1000) { 00938 log << MSG::INFO << " get MDC tuning data from run " << run + cnt*j << " instead of run " << run<< endreq; 00940 } 00941 cout << " cnt = " << cnt << endl; 00942 if(cnt==1000){ 00943 log << MSG::ERROR << " can not read Data from DB" << endreq; 00945 return StatusCode::FAILURE; 00946 } 00947 00949 00951 // string fff = std::string(row[0]); 00952 // m_BesMdcRes->setMdcRes(fff); 00955 00956 //get last row 00957 int row = result.size()-1; 00958 cout << " row = " << row << endl; 00959 00960 if(row<0){ 00961 cout << " ERROR: can not read Data from DB, please check MdcTunningSvc Version. " << endl; 00962 return StatusCode::FAILURE; 00963 } 00964 00965 string ggg = result[row]->GetString("MdcEff"); 00966 string fff = result[row]->GetString("MdcRes"); 00967 00968 log << MSG::DEBUG << " MdcTunning Data: MdcEff: " << ggg << " MdcRes: " << fff << endreq; 00969 //cout << " MdcTunning Data: MdcEff: " << ggg << " MdcRes: " << fff << endl; 00970 00971 bool stRes = setMcRes3(fff); 00972 //bool stRes = setMcRes2(fff); 00973 bool stEff = setMcEff(ggg); 00974 00975 if(!stEff) return StatusCode::FAILURE; 00976 if(!stRes) return StatusCode::FAILURE; 00977 return StatusCode::SUCCESS; 00978 }
double MdcTunningSvc::GetRes | ( | int | layerId, | |
int | cellId, | |||
double | driftD, | |||
double | cosTheta, | |||
int | posFlag, | |||
double | entranceAngle, | |||
double & | mean, | |||
double & | sigma | |||
) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 574 of file MdcTunningSvc.cc.
References cellNo, docaNo, and docaRes.
00574 { 00575 00576 driftD=fabs(driftD); 00577 if(driftD>12){ 00578 //std::cout<<"MdcTuningSvc: driftD overflow "<<driftD<<std::endl; 00579 driftD=12; 00580 } 00581 if(posFlag==0)driftD *= -1; 00582 00583 if(layerId<0 || layerId>42)std::cout<<" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl; 00584 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<"MdcTuningSvc:wrong cellId "<<cellId<<std::endl; 00585 00586 if(fabs(cosTheta)>1){ 00587 std::cout<<"MdcTuningSvc:wrong cosTheta "<<cosTheta<<std::endl; 00588 cosTheta=1; 00589 } 00590 00592 //debug 00593 // std::cout<<"cosTheta "<<cosTheta<<" caled "<<(cosTheta+1)*thetaNo/2.<<" floor "<<thetaBin<<std::endl; 00594 int docaBin=(int)floor((driftD+12)*docaNo/24.); 00595 if(entranceAngle<0){ 00596 mean=docaRes[layerId][docaBin][0][0]; 00597 sigma=docaRes[layerId][docaBin][0][1]; 00598 }else{ 00599 mean=docaRes[layerId][docaBin][1][0]; 00600 sigma=docaRes[layerId][docaBin][1][1]; 00601 } 00602 00603 //debug 00604 //std::cout<<"tuning svc layer "<<layerId<<" driftD "<<driftD<<" posFlag "<<posFlag<<" doca "<<docaBin<<" theta "<<thetaBin<<" angle "<<entranceAngle<<" mean "<<mean<<" sigma "<<sigma<<std::endl; 00605 00606 return 1; 00607 }
double MdcTunningSvc::GetRes2 | ( | int | layerId, | |
int | cellId, | |||
double | driftD, | |||
double | cosTheta, | |||
int | posFlag, | |||
double | entranceAngle, | |||
double & | f, | |||
double & | mean1, | |||
double & | sigma1, | |||
double & | mean2, | |||
double & | sigma2 | |||
) |
Definition at line 609 of file MdcTunningSvc.cc.
References cellNo, docaF, docaF_2, docaMean1, docaMean1_2, docaMean2, docaMean2_2, docaNo, docaSigma1, docaSigma1_2, docaSigma2, docaSigma2_2, and m_EndcapTuning.
00609 { 00610 00611 driftD=fabs(driftD); 00612 if(driftD>12){ 00613 //std::cout<<"MdcTuningSvc: driftD overflow "<<driftD<<std::endl; 00614 driftD=12; 00615 } 00616 if(posFlag==0)driftD *= -1; 00617 00618 if(layerId<0 || layerId>42)std::cout<<" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl; 00619 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<"MdcTuningSvc:wrong cellId "<<cellId<<std::endl; 00620 00621 if(fabs(cosTheta)>1){ 00622 std::cout<<"MdcTuningSvc:wrong cosTheta "<<cosTheta<<std::endl; 00623 cosTheta=1; 00624 } 00625 00627 //debug 00628 // std::cout<<"cosTheta "<<cosTheta<<" caled "<<(cosTheta+1)*thetaNo/2.<<" floor "<<thetaBin<<std::endl; 00629 int docaBin=(int)floor((driftD+12)*docaNo/24.); 00630 if(m_EndcapTuning==0) { 00631 if(entranceAngle<0){ 00632 f=docaF[layerId][docaBin][0]; 00633 mean1=docaMean1[layerId][docaBin][0]; 00634 sigma1=docaSigma1[layerId][docaBin][0]; 00635 mean2=docaMean2[layerId][docaBin][0]; 00636 sigma2=docaSigma2[layerId][docaBin][0]; 00637 }else{ 00638 f=docaF[layerId][docaBin][1]; 00639 mean1=docaMean1[layerId][docaBin][1]; 00640 sigma1=docaSigma1[layerId][docaBin][1]; 00641 mean2=docaMean2[layerId][docaBin][1]; 00642 sigma2=docaSigma2[layerId][docaBin][1]; 00643 } 00644 }else { 00645 if(fabs(cosTheta)<=0.83) { 00646 if(entranceAngle<0){ 00647 f=docaF[layerId][docaBin][0]; 00648 mean1=docaMean1[layerId][docaBin][0]; 00649 sigma1=docaSigma1[layerId][docaBin][0]; 00650 mean2=docaMean2[layerId][docaBin][0]; 00651 sigma2=docaSigma2[layerId][docaBin][0]; 00652 }else{ 00653 f=docaF[layerId][docaBin][1]; 00654 mean1=docaMean1[layerId][docaBin][1]; 00655 sigma1=docaSigma1[layerId][docaBin][1]; 00656 mean2=docaMean2[layerId][docaBin][1]; 00657 sigma2=docaSigma2[layerId][docaBin][1]; 00658 } 00659 } else { 00660 if(entranceAngle<0){ 00661 f=docaF_2[layerId][docaBin][0]; 00662 mean1=docaMean1_2[layerId][docaBin][0]; 00663 sigma1=docaSigma1_2[layerId][docaBin][0]; 00664 mean2=docaMean2_2[layerId][docaBin][0]; 00665 sigma2=docaSigma2_2[layerId][docaBin][0]; 00666 }else{ 00667 f=docaF_2[layerId][docaBin][1]; 00668 mean1=docaMean1_2[layerId][docaBin][1]; 00669 sigma1=docaSigma1_2[layerId][docaBin][1]; 00670 mean2=docaMean2_2[layerId][docaBin][1]; 00671 sigma2=docaSigma2_2[layerId][docaBin][1]; 00672 } 00673 } 00674 } 00675 00676 //debug 00677 //std::cout<<"tuning svc layer "<<layerId<<" driftD "<<driftD<<" posFlag "<<posFlag<<" doca "<<docaBin<<" theta "<<thetaBin<<" angle "<<entranceAngle<<" f "<<f<<" mean1 "<<mean1<<" sigma1 "<<sigma1<<" mean2 "<<mean2<<" sigma2 "<<sigma2<<std::endl; 00678 00679 return 1; 00680 }
double 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 | |||
) |
Definition at line 682 of file MdcTunningSvc.cc.
References cellNo, docaF, docaF_2, docaMean1, docaMean1_2, docaMean2, docaMean2_2, docaNo, docaSigma1, docaSigma1_2, docaSigma2, docaSigma2_2, m_EndcapTuning, resLargest, resLargest_2, resRatio, resRatio_2, resSmallest, and resSmallest_2.
Referenced by BesMdcDigitizer::Digitize().
00682 { 00683 00684 driftD=fabs(driftD); 00685 if(driftD>12){ 00686 //std::cout<<"MdcTuningSvc: driftD overflow "<<driftD<<std::endl; 00687 driftD=12; 00688 } 00689 if(posFlag==0)driftD *= -1; 00690 00691 if(layerId<0 || layerId>42)std::cout<<" MdcTuningSvc:wrong LayerId "<<layerId<<std::endl; 00692 if(cellId<0 || cellId>=cellNo[layerId])std::cout<<"MdcTuningSvc:wrong cellId "<<cellId<<std::endl; 00693 00694 if(fabs(cosTheta)>1){ 00695 std::cout<<"MdcTuningSvc:wrong cosTheta "<<cosTheta<<std::endl; 00696 cosTheta=1; 00697 } 00698 00700 //debug 00701 // std::cout<<"cosTheta "<<cosTheta<<" caled "<<(cosTheta+1)*thetaNo/2.<<" floor "<<thetaBin<<std::endl; 00702 int docaBin=(int)floor((driftD+12)*docaNo/24.); 00703 if(m_EndcapTuning==0) { 00704 if(entranceAngle<0){ 00705 f=docaF[layerId][docaBin][0]; 00706 mean1=docaMean1[layerId][docaBin][0]; 00707 sigma1=docaSigma1[layerId][docaBin][0]; 00708 mean2=docaMean2[layerId][docaBin][0]; 00709 sigma2=docaSigma2[layerId][docaBin][0]; 00710 ResLargest=resLargest[layerId][docaBin][0]; 00711 ResSmallest=resSmallest[layerId][docaBin][0]; 00712 ResRatio=resRatio[layerId][docaBin][0]; 00713 00714 }else{ 00715 f=docaF[layerId][docaBin][1]; 00716 mean1=docaMean1[layerId][docaBin][1]; 00717 sigma1=docaSigma1[layerId][docaBin][1]; 00718 mean2=docaMean2[layerId][docaBin][1]; 00719 sigma2=docaSigma2[layerId][docaBin][1]; 00720 ResLargest=resLargest[layerId][docaBin][1]; 00721 ResSmallest=resSmallest[layerId][docaBin][1]; 00722 ResRatio=resRatio[layerId][docaBin][1]; 00723 } 00724 }else { 00725 if(fabs(cosTheta)<=0.83) { 00726 if(entranceAngle<0){ 00727 f=docaF[layerId][docaBin][0]; 00728 mean1=docaMean1[layerId][docaBin][0]; 00729 sigma1=docaSigma1[layerId][docaBin][0]; 00730 mean2=docaMean2[layerId][docaBin][0]; 00731 sigma2=docaSigma2[layerId][docaBin][0]; 00732 ResLargest=resLargest[layerId][docaBin][0]; 00733 ResSmallest=resSmallest[layerId][docaBin][0]; 00734 ResRatio=resRatio[layerId][docaBin][0]; 00735 }else{ 00736 f=docaF[layerId][docaBin][1]; 00737 mean1=docaMean1[layerId][docaBin][1]; 00738 sigma1=docaSigma1[layerId][docaBin][1]; 00739 mean2=docaMean2[layerId][docaBin][1]; 00740 sigma2=docaSigma2[layerId][docaBin][1]; 00741 ResLargest=resLargest[layerId][docaBin][1]; 00742 ResSmallest=resSmallest[layerId][docaBin][1]; 00743 ResRatio=resRatio[layerId][docaBin][1]; 00744 } 00745 } else { 00746 if(entranceAngle<0){ 00747 f=docaF_2[layerId][docaBin][0]; 00748 mean1=docaMean1_2[layerId][docaBin][0]; 00749 sigma1=docaSigma1_2[layerId][docaBin][0]; 00750 mean2=docaMean2_2[layerId][docaBin][0]; 00751 sigma2=docaSigma2_2[layerId][docaBin][0]; 00752 ResLargest=resLargest_2[layerId][docaBin][0]; 00753 ResSmallest=resSmallest_2[layerId][docaBin][0]; 00754 ResRatio=resRatio_2[layerId][docaBin][0]; 00755 }else{ 00756 f=docaF_2[layerId][docaBin][1]; 00757 mean1=docaMean1_2[layerId][docaBin][1]; 00758 sigma1=docaSigma1_2[layerId][docaBin][1]; 00759 mean2=docaMean2_2[layerId][docaBin][1]; 00760 sigma2=docaSigma2_2[layerId][docaBin][1]; 00761 ResLargest=resLargest_2[layerId][docaBin][1]; 00762 ResSmallest=resSmallest_2[layerId][docaBin][1]; 00763 ResRatio=resRatio_2[layerId][docaBin][1]; 00764 00765 } 00766 } 00767 } 00768 00769 //debug 00770 //std::cout<<"tuning svc layer "<<layerId<<" driftD "<<driftD<<" posFlag "<<posFlag<<" doca "<<docaBin<<" theta "<<thetaBin<<" angle "<<entranceAngle<<" f "<<f<<" mean1 "<<mean1<<" sigma1 "<<sigma1<<" mean2 "<<mean2<<" sigma2 "<<sigma2<<std::endl; 00771 //debug information 00772 //std::cout<<"MdcTunningSvc::GetRes3() debug Info."<<endl 00773 // <<"layer docaBin thetaBin entranceAngle f mean1 sigma1 mean2 sigma2 largest smallest ratio"<<endl 00774 // <<setw(5)<<layerId<<setw(5)<<docaBin<<setw(5)<<thetaBin<<setw(18)<<entranceAngle<<setw(15)<<f<<setw(15)<<mean1<<setw(15)<<sigma1<<setw(15)<<mean2<<setw(15)<<sigma2<<setw(15)<<ResLargest<<setw(15)<<ResSmallest<<ResRatio<<endl; 00775 00776 return 1; 00777 }
void MdcTunningSvc::handle | ( | const Incident & | ) |
Definition at line 142 of file MdcTunningSvc.cc.
References Bes_Common::DEBUG, calibUtil::ERROR, getMdcTuningTableInfo(), and m_fromDB.
00142 { 00143 cout << "========== MdcTunningSvc::handle() ==========" << endl; 00144 00145 MsgStream log( messageService(), name() ); 00146 log << MSG::DEBUG << "handle: " << inc.type() << endreq; 00147 00148 if ( inc.type() == "NewRun" ){ 00149 log << MSG::DEBUG << "NewRun" << endreq; 00150 if(m_fromDB==true) { 00151 cout << " Start getMdcTuningTableInfo. " << endl; 00152 StatusCode sc = getMdcTuningTableInfo(); 00153 if(sc.isFailure()) { 00154 cout << " ERROR: can not get MdcTuning data from the database. " << endl; 00155 log << MSG::ERROR << " ERROR: can not get MdcTuning data from the database. " << endreq; 00156 exit(1); 00157 } 00158 } 00159 } 00160 }
StatusCode MdcTunningSvc::initialize | ( | ) | [virtual] |
Definition at line 72 of file MdcTunningSvc.cc.
References calibUtil::ERROR, Bes_Common::INFO, initTuningConst(), m_dbsvc, m_eventSvc, m_fromDB, and m_ParBossVer.
00072 { 00073 MsgStream log(messageService(), name()); 00074 log << MSG::INFO << "========== MdcTunningSvc::initialize() ==========" << endreq; 00075 00076 m_ParBossVer=getenv("BES_RELEASE"); 00077 00078 StatusCode sc = Service::initialize(); 00079 if( sc.isFailure() ) return sc; 00080 00081 if(m_fromDB) 00082 cout << " MdcTunningSvc read from database. " << endl; 00083 else if(!m_fromDB) 00084 cout << " MdcTunningSvc read from localfile. " << endl; 00085 00086 if(m_fromDB==true){ 00087 00088 sc = serviceLocator()->service("DatabaseSvc", m_dbsvc, true); 00089 if (sc .isFailure() ) { 00090 log << MSG::ERROR << " ERROR: unable to find DatabaseSvc " << endreq; 00091 return sc; 00092 } 00093 00094 // MYSQL *conn; 00095 // char *opt_host_name = "202.122.33.53"; 00096 // char *opt_user_name = "maqm"; 00097 // char *opt_password = "maqm_offline"; 00100 // char *opt_db_name = "offlinedb"; 00105 // mysql_real_connect(conn, opt_host_name, opt_user_name, opt_password, 00106 // opt_db_name, opt_port_num, opt_socket_name, opt_flags); 00107 00108 00109 IIncidentSvc* incsvc; 00110 sc = service("IncidentSvc", incsvc); 00111 int priority = 100; 00112 if( sc.isSuccess() ){ 00113 incsvc -> addListener(this, "NewRun", priority); 00114 } 00115 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true); 00116 if (sc .isFailure() ) { 00117 log << MSG::ERROR << " ERROR: unable to find EventDataSvc " << endreq; 00118 return sc; 00119 } 00120 } 00121 00122 if(m_fromDB!=true){ 00123 bool initStat = initTuningConst(); 00124 // if(m_path!=std::string("no path")) setMdcRes(m_path); 00125 if(!initStat){ 00126 cout << "========== MdcTunningSvc::initialize() failure ! ==========" << endl; 00127 return StatusCode::FAILURE; 00128 } 00129 } 00130 00131 return StatusCode::SUCCESS; 00132 }
bool MdcTunningSvc::initTuningConst | ( | ) |
Definition at line 162 of file MdcTunningSvc.cc.
References m_effFile, m_fromDB, m_resFile, setMcEff(), setMcRes3(), and deljobs::string.
Referenced by initialize().
00162 { 00163 std::string FilePath = getenv("MDCTUNNINGSVCROOT"); 00164 00165 if(m_effFile==std::string("no path")){ 00166 if(!m_fromDB) cout << " ERROR: no mdc tuning eff file, please check the input! " << endl; 00167 //m_effFile=FilePath+"/dat/mc_eff.dat"; 00168 //m_effFile = FilePath+"/dat/mc_eff_psipp.dat"; 00169 return false; 00170 } 00171 bool setMcEffStat = setMcEff(m_effFile); 00172 00173 if(m_resFile==std::string("no path")){ 00174 if(!m_fromDB) cout << " ERROR: no mdc tuning res file, please check the input! " << endl; 00175 //m_resFile=FilePath+"/dat/mc_res.dat"; 00176 //m_resFile = FilePath+"/dat/mc_res_psipp.dat"; 00177 return false; 00178 } 00179 //setMcRes2(m_resFile); 00180 bool setMcRes3Stat = setMcRes3(m_resFile); 00181 00182 if(!(setMcRes3Stat&&setMcEffStat)) 00183 return false; 00184 00185 return true; 00186 }
static const InterfaceID& IMdcTunningSvc::interfaceID | ( | ) | [inline, static, inherited] |
Definition at line 13 of file IMdcTunningSvc.h.
References IID_IMdcTunningSvc().
00013 { return IID_IMdcTunningSvc; }
double MdcTunningSvc::NewSig | ( | int | layerId, | |
double | driftD | |||
) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 436 of file MdcTunningSvc.cc.
References m_BesMdcRes.
00436 { 00437 int bindD = 0; 00438 double mindD = 0.0 ; 00439 double maxdD = 9.0 ; 00440 int maxbin =8.0 ; 00441 00442 if((driftD<mindD)||(driftD>maxdD)){ 00443 bindD = maxbin ; 00444 }else { 00445 for(int kk = 0; kk < 9; kk++){ 00446 if((driftD>=(double)kk)&&(driftD<(double)(kk+1))){ 00447 bindD = kk ; } 00448 } 00449 } 00450 00451 double sigma1 = 0 ; 00452 00453 sigma1 = (m_BesMdcRes -> getD_dD(layerId ,bindD)) ; 00454 00455 return sigma1; 00456 }
StatusCode MdcTunningSvc::queryInterface | ( | const InterfaceID & | riid, | |
void ** | ppvUnknown | |||
) | [virtual] |
Definition at line 62 of file MdcTunningSvc.cc.
References IID_IMdcTunningSvc().
00062 { 00063 if( IID_IMdcTunningSvc.versionMatch(riid) ){ 00064 *ppvInterface = static_cast<IMdcTunningSvc*> (this); 00065 } else{ 00066 return Service::queryInterface(riid, ppvInterface); 00067 } 00068 return StatusCode::SUCCESS; 00069 }
double MdcTunningSvc::ResvEntr | ( | int | layerId, | |
double | enterA, | |||
int | ilr, | |||
double | driftD | |||
) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 779 of file MdcTunningSvc.cc.
References m_BesMdcRes.
00779 { 00780 int bindD =0; 00781 int maxbin = 17; 00782 int iEntr = 0; 00783 int ll = -1; 00784 double mindD = -9.; 00785 double maxdD = 9.; 00786 double sigmaE = 0.0; 00787 00788 if(enterA < 0){ 00789 iEntr = 0 ; 00790 }else{ iEntr = 1 ;} 00791 00792 if(ilr == 0 ){ 00793 driftD = -1.*driftD; 00794 }else{ driftD = driftD ;} 00795 00796 if( (driftD < mindD) || (driftD > maxdD) ){ 00797 bindD = maxbin ; 00798 }else{ 00799 for(double dd=-9.;dd<9.;dd++){ 00800 ll++; 00801 if( (driftD>= dd ) && (driftD < (dd+1.)) ){ 00802 bindD = ll ; 00803 } 00804 } 00805 } 00806 00807 sigmaE = (m_BesMdcRes -> getD_iEntr(layerId,iEntr,bindD) ); 00808 //cout<<"Svc lay : "<<layerId<<" iEntr : "<<iEntr<<" bindD : "<<bindD<<" sigmaE :"<<sigmaE<<endl; 00809 return sigmaE; 00810 }
bool MdcTunningSvc::setMcEff | ( | std::string | eff_con | ) |
Definition at line 188 of file MdcTunningSvc.cc.
References bin, cellEff, cellEff_2, cellNo, docaEff, docaEff_2, docaNo, genRecEmupikp::i, iter(), ganga-rec::j, genRecEmupikp::line, m_effFile, m_fromDB, deljobs::string, thetaEff, thetaEff_2, and thetaNo.
Referenced by getMdcTuningTableInfo(), and initTuningConst().
00188 { 00189 int i,j; 00190 string line; 00191 double lay,bin,expect,hit; 00192 //ifstream readMCEff(eff_con.c_str()); 00193 std::istringstream readMCEff; 00194 // (eff_con); 00195 if(m_fromDB){ 00196 readMCEff.str(eff_con); 00197 } 00198 if(!m_fromDB){ 00199 ifstream in(eff_con.c_str()); 00200 //char ch; 00201 //string hhh; 00202 //while(ift.get(ch)) hhh.putback(ch); 00203 //std::cout<<"hhh:"<<hhh<<std::endl; 00204 // stringstream strBuf ; 00205 istreambuf_iterator<char> iter(in) ; 00206 string strCache = string( iter, (istreambuf_iterator<char>()) ); 00207 readMCEff.str(strCache); 00208 //std::cout<<"strCache:"<<strCache<<std::endl; 00209 } 00210 00211 00212 ifstream fin(eff_con.c_str()); 00213 if(!m_fromDB) 00214 if(!fin){ 00215 cout << " ERROR: the mdc tunning eff file " << m_effFile << " not exist, please check the input! " << endl; 00216 return false; 00217 } 00218 // ifstream readMCEff(eff_con); 00219 if(!readMCEff.good()){ 00220 cout << " ERROR: mdc tuning eff file " << m_effFile << " not exist. " << endl; 00221 return false; 00222 }else{ 00223 if(!m_fromDB) 00224 if(fin) 00225 cout << " Open mdc tuning eff file: " << m_effFile << endl; 00226 for(i=0;i<43;i++){ 00227 readMCEff>>lay; 00228 getline(readMCEff,line); 00229 for(j=0;j<docaNo;j++){ 00230 readMCEff>>bin>>docaEff[i][j]>>expect>>hit; 00231 } 00232 readMCEff>>lay; 00233 getline(readMCEff,line); 00234 for(j=0;j<thetaNo;j++){ 00235 readMCEff>>bin>>thetaEff[i][j]>>expect>>hit; 00236 } 00237 readMCEff>>lay; 00238 getline(readMCEff,line); 00239 for(j=0;j<cellNo[i];j++){ 00240 readMCEff>>bin>>cellEff[i][j]>>expect>>hit; 00241 00242 } 00243 } 00244 for(i=0;i<43;i++){ 00245 readMCEff>>lay; 00246 getline(readMCEff,line); 00247 for(j=0;j<docaNo;j++){ 00248 readMCEff>>bin>>docaEff_2[i][j]>>expect>>hit; 00249 } 00250 readMCEff>>lay; 00251 getline(readMCEff,line); 00252 for(j=0;j<thetaNo;j++){ 00253 readMCEff>>bin>>thetaEff_2[i][j]>>expect>>hit; 00254 00255 } 00256 readMCEff>>lay; 00257 getline(readMCEff,line); 00258 for(j=0;j<cellNo[i];j++){ 00259 readMCEff>>bin>>cellEff_2[i][j]>>expect>>hit; 00260 00261 } 00262 } 00263 } 00264 return true; 00265 }
bool MdcTunningSvc::setMcRes | ( | ) |
Definition at line 267 of file MdcTunningSvc.cc.
References bin, docaNo, docaRes, genRecEmupikp::i, ganga-rec::j, genRecEmupikp::line, m_resFile, and deljobs::string.
00267 { 00268 00269 00270 int i,j; 00271 string line; 00272 double lay,bin; 00273 ifstream readMCRes(m_resFile.c_str()); 00274 if(!readMCRes.good()){ 00275 cout << " ERROR: mdc tuning file: " << m_resFile << " not exist. " << endl; 00276 return false; 00277 }else{ 00278 cout << " Open mdc tuning file: " << m_resFile << endl; 00279 for(i=0;i<43;i++){ 00280 readMCRes>>lay; 00281 getline(readMCRes,line); 00282 getline(readMCRes,line); 00283 for(j=0;j<docaNo;j++){ 00284 readMCRes>>bin>>docaRes[i][j][0][0]>>docaRes[i][j][0][1]; //entranceAngle<0 00285 } 00286 readMCRes>>lay; 00287 getline(readMCRes,line); 00288 getline(readMCRes,line); 00289 for(j=0;j<docaNo;j++){ 00290 readMCRes>>bin>>docaRes[i][j][1][0]>>docaRes[i][j][1][1]; //entranceAngle>0 00291 /* 00292 if(i==0||i==42){ 00293 cout<<"lay "<<i<<" docaNo "<<j<<" <0 mean "<<docaRes[i][j][0][0]<<" sigma "<<docaRes[i][j][0][1]<<" >0 mean "<<docaRes[i][j][1][0]<<" sigma "<<docaRes[i][j][1][1]<<endl; 00294 } 00295 */ 00296 } 00297 } 00298 } 00299 return true; 00300 }
bool MdcTunningSvc::setMcRes2 | ( | std::string | res_con | ) |
Definition at line 302 of file MdcTunningSvc.cc.
References bin, docaF, docaF_2, docaMean1, docaMean1_2, docaMean2, docaMean2_2, docaNo, docaSigma1, docaSigma1_2, docaSigma2, docaSigma2_2, genRecEmupikp::i, iter(), ganga-rec::j, genRecEmupikp::line, m_fromDB, m_resFile, and deljobs::string.
00302 { 00303 00304 int i,j; 00305 string line; 00306 double lay,bin; 00307 //ifstream readMCRes(m_resFile.c_str()); 00308 std::istringstream readMCRes; 00309 if(m_fromDB) 00310 { 00311 readMCRes.str(res_con); 00312 } 00313 if(!m_fromDB) 00314 { 00315 ifstream in(res_con.c_str()); 00316 istreambuf_iterator<char> iter(in) ; 00317 string strCache = string( iter, (istreambuf_iterator<char>()) ); 00318 readMCRes.str(strCache); 00319 } 00320 if(!readMCRes.good()){ 00321 cout << " ERROR: mdc tuning file: " << m_resFile << " not exist. " << endl; 00322 return false; 00323 }else{ 00324 cout << " MdcTunningSvc::setMcRes2() Open mdc tuning resfile " << m_resFile << endl; 00325 for(i=0;i<43;i++){ 00326 readMCRes>>lay; 00327 getline(readMCRes,line); 00328 getline(readMCRes,line); 00329 for(j=0;j<docaNo;j++){ 00330 readMCRes>>bin>>docaF[i][j][0]>>docaMean1[i][j][0]>>docaSigma1[i][j][0]>>docaMean2[i][j][0]>>docaSigma2[i][j][0]; //entranceAngle<0 00331 } 00332 readMCRes>>lay; 00333 getline(readMCRes,line); 00334 getline(readMCRes,line); 00335 for(j=0;j<docaNo;j++){ 00336 readMCRes>>bin>>docaF[i][j][1]>>docaMean1[i][j][1]>>docaSigma1[i][j][1]>>docaMean2[i][j][1]>>docaSigma2[i][j][1]; //entranceAngle>0 00337 } 00338 } 00339 for(i=0;i<43;i++){ 00340 readMCRes>>lay; 00341 getline(readMCRes,line); 00342 getline(readMCRes,line); 00343 for(j=0;j<docaNo;j++){ 00344 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]; //entranceAngle<0 00345 } 00346 readMCRes>>lay; 00347 getline(readMCRes,line); 00348 getline(readMCRes,line); 00349 for(j=0;j<docaNo;j++){ 00350 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]; //entranceAngle>0 00351 } 00352 } 00353 } 00354 return true; 00355 }
bool MdcTunningSvc::setMcRes3 | ( | std::string | res_con | ) |
Definition at line 357 of file MdcTunningSvc.cc.
References bin, docaF, docaF_2, docaMean1, docaMean1_2, docaMean2, docaMean2_2, docaNo, docaSigma1, docaSigma1_2, docaSigma2, docaSigma2_2, genRecEmupikp::i, iter(), ganga-rec::j, genRecEmupikp::line, m_fromDB, m_resFile, resLargest, resLargest_2, resRatio, resRatio_2, resSmallest, resSmallest_2, and deljobs::string.
Referenced by getMdcTuningTableInfo(), and initTuningConst().
00357 { 00358 00359 int i,j; 00360 string line; 00361 double lay,bin; 00362 //ifstream readMCRes(m_resFile.c_str()); 00363 std::istringstream readMCRes; 00364 if(m_fromDB){ 00365 readMCRes.str(res_con); 00366 } 00367 if(!m_fromDB){ 00368 ifstream in(res_con.c_str()); 00369 istreambuf_iterator<char> iter(in) ; 00370 string strCache = string( iter, (istreambuf_iterator<char>()) ); 00371 readMCRes.str(strCache); 00372 } 00373 00374 ifstream fin(res_con.c_str()); 00375 00376 if(!m_fromDB) 00377 if(!fin){ 00378 cout << " ERROR: the mdc tunning res file " << m_resFile << " not exist, please check the input!" << endl; 00379 return false; 00380 } 00381 if(!readMCRes.good()){ 00382 cout << " ERROR: the mdc tuning res file: " << m_resFile << " not exist, please check the input! " << endl; 00383 return false; 00384 }else{ 00385 if(!m_fromDB) 00386 if(fin) 00387 cout << " MdcTunningSvc::setMcRes3() Open mdc tuning resfile: " << m_resFile << endl; 00388 for(i=0;i<43;i++){ 00389 readMCRes>>lay; 00390 getline(readMCRes,line); 00391 getline(readMCRes,line); 00392 for(j=0;j<docaNo;j++){ 00393 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]; //entranceAngle<0 00394 } 00395 readMCRes>>lay; 00396 getline(readMCRes,line); 00397 getline(readMCRes,line); 00398 for(j=0;j<docaNo;j++){ 00399 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]; //entranceAngle>0 00400 00401 } 00402 } 00403 for(i=0;i<43;i++){ 00404 readMCRes>>lay; 00405 getline(readMCRes,line); 00406 getline(readMCRes,line); 00407 for(j=0;j<docaNo;j++){ 00408 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]; //entranceAngle<0 00409 } 00410 readMCRes>>lay; 00411 getline(readMCRes,line); 00412 getline(readMCRes,line); 00413 for(j=0;j<docaNo;j++){ 00414 00415 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]; //entranceAngle>0 00416 00417 00418 } 00419 } 00420 } 00421 00422 return true; 00423 }
void MdcTunningSvc::setMdcRes | ( | std::string | path | ) | [virtual] |
Implements IMdcTunningSvc.
Definition at line 431 of file MdcTunningSvc.cc.
References m_BesMdcRes.
00431 { 00432 if(m_BesMdcRes) delete m_BesMdcRes; 00433 m_BesMdcRes = new BesMdcRes(path); 00434 }
double MdcTunningSvc::cellEff[43][288] [private] |
Definition at line 60 of file MdcTunningSvc.h.
Referenced by get_cellEff(), GetEff(), and setMcEff().
double MdcTunningSvc::cellEff_2[43][288] [private] |
int MdcTunningSvc::cellNo[43] [private] |
Definition at line 57 of file MdcTunningSvc.h.
Referenced by GetEff(), GetRes(), GetRes2(), GetRes3(), and setMcEff().
std::string MdcTunningSvc::dbName [private] |
Definition at line 101 of file MdcTunningSvc.h.
double MdcTunningSvc::dD[18] [private] |
double MdcTunningSvc::docaEff[43][docaNo] [private] |
Definition at line 58 of file MdcTunningSvc.h.
Referenced by get_docaEff(), GetEff(), and setMcEff().
double MdcTunningSvc::docaEff_2[43][docaNo] [private] |
double MdcTunningSvc::docaF[43][docaNo][2] [private] |
Definition at line 62 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaF_2[43][docaNo][2] [private] |
Definition at line 80 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaMean1[43][docaNo][2] [private] |
Definition at line 63 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaMean1_2[43][docaNo][2] [private] |
Definition at line 81 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaMean2[43][docaNo][2] [private] |
Definition at line 65 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaMean2_2[43][docaNo][2] [private] |
Definition at line 83 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
const int MdcTunningSvc::docaNo = 60 [static, private] |
Definition at line 55 of file MdcTunningSvc.h.
Referenced by GetEff(), GetRes(), GetRes2(), GetRes3(), setMcEff(), setMcRes(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaRes[43][docaNo][2][2] [private] |
double MdcTunningSvc::docaRes_2[43][docaNo][2][2] [private] |
Definition at line 79 of file MdcTunningSvc.h.
double MdcTunningSvc::docaSigma1[43][docaNo][2] [private] |
Definition at line 64 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaSigma1_2[43][docaNo][2] [private] |
Definition at line 82 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaSigma2[43][docaNo][2] [private] |
Definition at line 66 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
double MdcTunningSvc::docaSigma2_2[43][docaNo][2] [private] |
Definition at line 84 of file MdcTunningSvc.h.
Referenced by GetRes2(), GetRes3(), setMcRes2(), and setMcRes3().
std::string MdcTunningSvc::host [private] |
Definition at line 100 of file MdcTunningSvc.h.
BesMdcRes* MdcTunningSvc::m_BesMdcRes [private] |
Definition at line 95 of file MdcTunningSvc.h.
Referenced by Delcostta(), DeldriftD(), DelEtr_Sig(), getMdcRes(), NewSig(), ResvEntr(), setMdcRes(), and ~MdcTunningSvc().
bool MdcTunningSvc::m_dbFlag [private] |
Definition at line 89 of file MdcTunningSvc.h.
IDatabaseSvc* MdcTunningSvc::m_dbsvc [private] |
Definition at line 107 of file MdcTunningSvc.h.
Referenced by getMdcTuningTableInfo(), and initialize().
std::string MdcTunningSvc::m_effFile [private] |
std::string MdcTunningSvc::m_effFile_endcap [private] |
Definition at line 92 of file MdcTunningSvc.h.
int MdcTunningSvc::m_EndcapTuning [private] |
IDataProviderSvc* MdcTunningSvc::m_eventSvc [private] |
Definition at line 98 of file MdcTunningSvc.h.
Referenced by getMdcTuningTableInfo(), and initialize().
bool MdcTunningSvc::m_fromDB [private] |
Definition at line 97 of file MdcTunningSvc.h.
Referenced by handle(), initialize(), initTuningConst(), setMcEff(), setMcRes2(), and setMcRes3().
std::string MdcTunningSvc::m_ParBossVer [private] |
Definition at line 86 of file MdcTunningSvc.h.
Referenced by getMdcTuningTableInfo(), and initialize().
std::string MdcTunningSvc::m_path [private] |
Definition at line 94 of file MdcTunningSvc.h.
std::string MdcTunningSvc::m_resFile [private] |
Definition at line 91 of file MdcTunningSvc.h.
Referenced by initTuningConst(), setMcRes(), setMcRes2(), and setMcRes3().
std::string MdcTunningSvc::m_resFile_endcap [private] |
Definition at line 93 of file MdcTunningSvc.h.
std::string MdcTunningSvc::password [private] |
Definition at line 104 of file MdcTunningSvc.h.
double MdcTunningSvc::resLargest[43][docaNo][2] [private] |
double MdcTunningSvc::resLargest_2[43][docaNo][2] [private] |
double MdcTunningSvc::resRatio[43][docaNo][2] [private] |
double MdcTunningSvc::resRatio_2[43][docaNo][2] [private] |
double MdcTunningSvc::resSmallest[43][docaNo][2] [private] |
double MdcTunningSvc::resSmallest_2[43][docaNo][2] [private] |
unsigned int MdcTunningSvc::serialNo [private] |
Definition at line 105 of file MdcTunningSvc.h.
std::string MdcTunningSvc::table [private] |
Definition at line 102 of file MdcTunningSvc.h.
double MdcTunningSvc::thetaEff[43][thetaNo] [private] |
Definition at line 59 of file MdcTunningSvc.h.
Referenced by get_thetaEff(), GetEff(), and setMcEff().
double MdcTunningSvc::thetaEff_2[43][thetaNo] [private] |
const int MdcTunningSvc::thetaNo = 40 [static, private] |
std::string MdcTunningSvc::userName [private] |
Definition at line 103 of file MdcTunningSvc.h.