RealizationSvc Class Reference

#include <RealizationSvc.h>

Inheritance diagram for RealizationSvc:

IRealizationSvc List of all members.

Public Member Functions

 RealizationSvc (const std::string &name, ISvcLocator *svcloc)
 ~RealizationSvc ()
virtual StatusCode initialize ()
virtual StatusCode finalize ()
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvInterface)
void handle (const Incident &)
void readDB (int runNo)
void updateRealData ()
int getInitEvtID ()
void setInitEvtID (int i)
void setLuminosity (float i)
float getLuminosity ()
float getLuminosity (int runNo)
void setBunchPosX (double i)
void setBunchPosY (double i)
void setBunchPosZ (double i)
void setBunchSizeX (double i)
void setBunchSizeY (double i)
void setBunchSizeZ (double i)
double getBunchPosX ()
double getBunchPosY ()
double getBunchPosZ ()
double getBunchSizeX ()
double getBunchSizeY ()
double getBunchSizeZ ()
double getTrgGain (int cry_id)
void setRunEvtNum (int i)
int getRunEvtNum ()
void setTrgTable (std::vector< uint32_t > i)
std::vector< uint32_t > getTrgTable ()
int getEtotDataSteps ()
int getVthBEtotH ()
int getVthEEtotH ()
int getVthEtotL ()
int getVthEtotM ()
int getVthBLZ ()
int getVthDiffB ()
int getVthDiffE ()
int getVthBalBLK ()
int getVthBalEEMC ()
int getVthDiffMin ()
void setBgFileName (std::vector< std::string > i)
std::vector< std::stringgetBgFileName ()
std::vector< std::stringgetBgFileName (std::string query)
float getRunTotalTime ()
float getTauValue ()
std::vector< double > getRunInfo ()
std::vector< std::stringgetTofThreshold ()
std::vector< int > getRunList ()
int getRunId ()
void setRunId (int i)
bool UseDBFlag ()
bool ifReadBunch ()
bool ifReadTrg ()
bool ifReadRandTrg ()
bool ifReadTFEE ()

Static Public Member Functions

static const InterfaceID & interfaceID ()

Private Attributes

int m_CaliConst
std::string m_bossRelease
std::string m_SftVer
std::string m_ParVer
float m_lumi
double m_bunch_x
double m_bunch_y
double m_bunch_z
double m_sigma_x
double m_sigma_y
double m_sigma_z
int m_initEvtID
int m_RunEvtNum
std::vector< int > m_runNoList
std::vector< int > m_runIdList
int m_runID
bool m_useDB
float m_runTotalTime
float m_tauValue
bool m_ifReadBunch
bool m_ifReadTrg
bool m_ifReadRandTrg
bool m_ifReadTFEE
bool m_ifReadRunInfo
std::vector< uint32_t > m_trgTable
IDataProviderSvc * m_eventSvc
std::vector< std::stringm_bgfilename
std::vector< std::stringm_tfee
std::vector< double > m_runInfo
double m_trgGain [6240]
int m_EtotDataSteps
int m_VthBEtotH
int m_VthEEtotH
int m_VthEtotL
int m_VthEtotM
int m_VthBLZ
int m_VthDiffB
int m_VthDiffE
int m_VthBalBLK
int m_VthBalEEMC
int m_VthDiffMin
RealDBUtil::ConnectionProviderm_connect

Detailed Description

Definition at line 16 of file RealizationSvc.h.


Constructor & Destructor Documentation

RealizationSvc::RealizationSvc ( const std::string name,
ISvcLocator *  svcloc 
)

RealizationSvc::~RealizationSvc (  )  [inline]

Definition at line 21 of file RealizationSvc.h.

00021 {};


Member Function Documentation

StatusCode RealizationSvc::finalize (  )  [virtual]

Definition at line 93 of file RealizationSvc.cxx.

References Bes_Common::INFO.

00093                                    {
00094      MsgStream log(messageService(), name());
00095      log << MSG::INFO << "RealizationSvc::finalize()" << endreq;
00096 
00097      return StatusCode::SUCCESS;
00098 }

std::vector< std::string > RealizationSvc::getBgFileName ( std::string  query  ) 

Definition at line 146 of file RealizationSvc.cxx.

References calibUtil::ERROR, RealDBUtil::ConnectionProvider::getReadBackgroundInfo(), genRecEmupikp::i, Bes_Common::INFO, and m_connect.

00146                                                                   {
00147   MsgStream log( messageService(), name() );
00148   using RealDBUtil::ConnectionProvider;
00149 
00150   std::vector<std::string> Bgfilename;
00151   Bgfilename.clear();
00152 
00153   std::vector<std::string> fileInfor;
00154   ConnectionProvider::eRet e = m_connect->getReadBackgroundInfo(fileInfor,query);
00155   if(e != 0 ) {
00156     log << MSG::ERROR << "Could not find background infor., exit." << endreq;
00157     exit(1);
00158   }
00159 
00160   for(unsigned int i = 0; i < fileInfor.size(); i+=2)
00161   {
00162     Bgfilename.push_back(fileInfor[i]+"/"+fileInfor[i+1]);
00163   }
00164   fileInfor.clear();
00165   
00166   for(unsigned int i = 0; i < Bgfilename.size(); i++) {
00167      log << MSG::INFO << "Background file name: " << Bgfilename[i] << endreq;
00168   }
00169 
00170   return Bgfilename;
00171 }

std::vector<std::string> RealizationSvc::getBgFileName (  )  [inline]

Definition at line 86 of file RealizationSvc.h.

References m_bgfilename.

Referenced by MixerAlg::execute(), and MixerAlg::initialize().

00086 { return m_bgfilename; }

double RealizationSvc::getBunchPosX (  )  [inline]

Definition at line 47 of file RealizationSvc.h.

References m_bunch_x.

Referenced by G4HepMCInterface::HepMC2G4().

00047 { return m_bunch_x; }

double RealizationSvc::getBunchPosY (  )  [inline]

Definition at line 48 of file RealizationSvc.h.

References m_bunch_y.

Referenced by G4HepMCInterface::HepMC2G4().

00048 { return m_bunch_y; }

double RealizationSvc::getBunchPosZ (  )  [inline]

Definition at line 49 of file RealizationSvc.h.

References m_bunch_z.

Referenced by G4HepMCInterface::HepMC2G4().

00049 { return m_bunch_z; }

double RealizationSvc::getBunchSizeX (  )  [inline]

Definition at line 50 of file RealizationSvc.h.

References m_sigma_x.

Referenced by G4HepMCInterface::HepMC2G4().

00050 { return m_sigma_x; }

double RealizationSvc::getBunchSizeY (  )  [inline]

Definition at line 51 of file RealizationSvc.h.

References m_sigma_y.

Referenced by G4HepMCInterface::HepMC2G4().

00051 { return m_sigma_y; }

double RealizationSvc::getBunchSizeZ (  )  [inline]

Definition at line 52 of file RealizationSvc.h.

References m_sigma_z.

Referenced by G4HepMCInterface::HepMC2G4().

00052 { return m_sigma_z; }

int RealizationSvc::getEtotDataSteps (  )  [inline]

Definition at line 73 of file RealizationSvc.h.

References m_EtotDataSteps.

00073 { return m_EtotDataSteps; }

int RealizationSvc::getInitEvtID (  )  [inline]

Definition at line 34 of file RealizationSvc.h.

References m_initEvtID.

Referenced by McContext::McContext().

00034 { return m_initEvtID; }

float RealizationSvc::getLuminosity ( int  runNo  ) 

Definition at line 131 of file RealizationSvc.cxx.

References calibUtil::ERROR, RealDBUtil::ConnectionProvider::getReadLumInfo(), Bes_Common::INFO, m_bossRelease, m_connect, m_lumi, m_ParVer, m_SftVer, and deljobs::string.

00131                                              {
00132   using RealDBUtil::ConnectionProvider;
00133 
00134   MsgStream log( messageService(), name() );
00135   std::string sLum;
00136   ConnectionProvider::eRet e = m_connect->getReadLumInfo(sLum,runNo, m_SftVer, m_ParVer, m_bossRelease);
00137   if(e != 0 ) {
00138     log << MSG::ERROR << "Could not find Luminosity infor., exit." << endreq;
00139     exit(1);
00140   }
00141   m_lumi  = std::atof(sLum.c_str());
00142   log << MSG::INFO << "Luminosity is " << m_lumi << " in Run " << runNo << endreq;
00143   return m_lumi;
00144 }

float RealizationSvc::getLuminosity (  )  [inline]

Definition at line 38 of file RealizationSvc.h.

References m_lumi.

Referenced by McContext::McContext().

00038 { return m_lumi; }

int RealizationSvc::getRunEvtNum (  )  [inline]

Definition at line 62 of file RealizationSvc.h.

References m_RunEvtNum.

00062 { return m_RunEvtNum; }

int RealizationSvc::getRunId (  )  [inline]

Definition at line 101 of file RealizationSvc.h.

References m_runID.

Referenced by BesEventAction::EndOfEventAction(), BesTofDigitizer::GroupHits(), G4Svc::initialize(), BesTofDigitizerEcV3::ReadEffTree(), BesTofDigitizerBrV2::TofPmtAccum(), and BesTofDigitizerBrV2::TofPmtRspns().

00101 { return m_runID; }

std::vector<double> RealizationSvc::getRunInfo (  )  [inline]

Definition at line 94 of file RealizationSvc.h.

References m_runInfo.

00094 {return m_runInfo; }

std::vector<int> RealizationSvc::getRunList (  )  [inline]

Definition at line 100 of file RealizationSvc.h.

References m_runIdList.

Referenced by McContext::McContext().

00100 { return m_runIdList; }

float RealizationSvc::getRunTotalTime (  )  [inline]

Definition at line 90 of file RealizationSvc.h.

References m_runTotalTime.

Referenced by MixerAlg::execute().

00090 { return m_runTotalTime; }

float RealizationSvc::getTauValue (  )  [inline]

Definition at line 91 of file RealizationSvc.h.

References m_tauValue.

Referenced by MixerAlg::execute().

00091 { return m_tauValue; }

std::vector<std::string> RealizationSvc::getTofThreshold (  )  [inline]

Definition at line 97 of file RealizationSvc.h.

References m_tfee.

00097 { return m_tfee; }

double RealizationSvc::getTrgGain ( int  cry_id  )  [inline]

Definition at line 54 of file RealizationSvc.h.

References m_trgGain.

Referenced by BesTrigL1::getEmcAnalogSig(), and EmcTCFinder::setEmcDigi().

00054 { return m_trgGain[cry_id]; }

std::vector<uint32_t> RealizationSvc::getTrgTable (  )  [inline]

Definition at line 70 of file RealizationSvc.h.

References m_trgTable.

Referenced by BesGlobalTrigSvc::handle().

00070 { return m_trgTable; }

int RealizationSvc::getVthBalBLK (  )  [inline]

Definition at line 81 of file RealizationSvc.h.

References m_VthBalBLK.

Referenced by BesGlobalTrigSvc::getL1BLK_GATE(), and BesGlobalTrigSvc::getL1EBL_BR().

00081 { return m_VthBalBLK; }

int RealizationSvc::getVthBalEEMC (  )  [inline]

Definition at line 82 of file RealizationSvc.h.

References m_VthBalEEMC.

Referenced by BesGlobalTrigSvc::getL1EBL_EC().

00082 { return m_VthBalEEMC; }

int RealizationSvc::getVthBEtotH (  )  [inline]

Definition at line 74 of file RealizationSvc.h.

References m_VthBEtotH.

Referenced by BesGlobalTrigSvc::getL1ETOT_BR().

00074 { return m_VthBEtotH; }

int RealizationSvc::getVthBLZ (  )  [inline]

Definition at line 78 of file RealizationSvc.h.

References m_VthBLZ.

Referenced by BesGlobalTrigSvc::getL1EBL_Z().

00078 { return m_VthBLZ; }

int RealizationSvc::getVthDiffB (  )  [inline]

Definition at line 79 of file RealizationSvc.h.

References m_VthDiffB.

Referenced by BesGlobalTrigSvc::getL1EDIFF_BR().

00079 { return m_VthDiffB; }

int RealizationSvc::getVthDiffE (  )  [inline]

Definition at line 80 of file RealizationSvc.h.

References m_VthDiffE.

Referenced by BesGlobalTrigSvc::getL1EDIFF_EC().

00080 { return m_VthDiffE; }

int RealizationSvc::getVthDiffMin (  )  [inline]

Definition at line 83 of file RealizationSvc.h.

References m_VthDiffMin.

00083 { return m_VthDiffMin; }

int RealizationSvc::getVthEEtotH (  )  [inline]

Definition at line 75 of file RealizationSvc.h.

References m_VthEEtotH.

Referenced by BesGlobalTrigSvc::getL1ETOT_EC().

00075 { return m_VthEEtotH; }

int RealizationSvc::getVthEtotL (  )  [inline]

Definition at line 76 of file RealizationSvc.h.

References m_VthEtotL.

Referenced by BesGlobalTrigSvc::getL1ETOT_L().

00076 { return m_VthEtotL; }

int RealizationSvc::getVthEtotM (  )  [inline]

Definition at line 77 of file RealizationSvc.h.

References m_VthEtotM.

Referenced by BesGlobalTrigSvc::getL1ETOT_M().

00077 { return m_VthEtotM; }

void RealizationSvc::handle ( const Incident &   ) 

Definition at line 111 of file RealizationSvc.cxx.

References abs, Bes_Common::DEBUG, calibUtil::ERROR, Bes_Common::INFO, m_eventSvc, m_useDB, readDB(), and runNo.

00111                                               {
00112   MsgStream log( messageService(), name() );
00113   log << MSG::DEBUG << "handle: " << inc.type() << endreq;
00114   if ( inc.type() == "NewRun" ){
00115     log << MSG::DEBUG << "Begin New Run" << endreq;
00116     if(m_useDB == true) {
00117       int runNo;
00118         SmartDataPtr<Event::EventHeader> evt(m_eventSvc,"/Event/EventHeader");
00119         if( evt ){
00120           runNo = evt -> runNumber();
00121           log << MSG::INFO <<"The runNumber of current event is  "<<runNo<<endreq;
00122         }
00123         else {
00124           log << MSG::ERROR <<"Can not get EventHeader!"<<endreq;
00125         }
00126       readDB(std::abs(runNo)); 
00127     }
00128   } 
00129 }

bool RealizationSvc::ifReadBunch (  )  [inline]

Definition at line 106 of file RealizationSvc.h.

References m_ifReadBunch.

Referenced by G4HepMCInterface::HepMC2G4().

00106 { return m_ifReadBunch; }

bool RealizationSvc::ifReadRandTrg (  )  [inline]

Definition at line 108 of file RealizationSvc.h.

References m_ifReadRandTrg.

Referenced by MixerAlg::execute(), and MixerAlg::initialize().

00108 { return m_ifReadRandTrg; }

bool RealizationSvc::ifReadTFEE (  )  [inline]

Definition at line 109 of file RealizationSvc.h.

References m_ifReadTFEE.

00109 { return m_ifReadTFEE; }

bool RealizationSvc::ifReadTrg (  )  [inline]

Definition at line 107 of file RealizationSvc.h.

References m_ifReadTrg.

Referenced by BesGlobalTrigSvc::handle().

00107 { return m_ifReadTrg; }

StatusCode RealizationSvc::initialize (  )  [virtual]

Definition at line 39 of file RealizationSvc.cxx.

References calibUtil::ERROR, genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, m_connect, m_eventSvc, m_runID, m_runIdList, m_runNoList, and m_SftVer.

00039                                      {
00040      MsgStream log(messageService(), name());
00041      log << MSG::INFO << "RealizationSvc::initialize()" << endreq;
00042 
00043      StatusCode sc = Service::initialize();
00044      if( sc.isFailure() ) return sc;
00045  
00046      if(m_SftVer == "NONE") m_SftVer = getenv("BES_RELEASE");
00047 
00048      for(unsigned int i = 0; i < m_runNoList.size(); i++) {
00049        if(m_runNoList[i] != 0) {
00050          std::cout <<"run id : " << m_runNoList[i] << std::endl;
00051          if(find(m_runIdList.begin(),m_runIdList.end(),m_runNoList[i]) == m_runIdList.end()) m_runIdList.push_back(m_runNoList[i]);
00052          else log << MSG::ALWAYS <<"RunNo "<<m_runNoList[i]<<" repeated in run list"<<endreq;
00053        }
00054        else {
00055          if(i == 0 || (i+1) >= m_runNoList.size()) log << MSG::ERROR << "Please check your run id list, it is wrong" << endreq;
00056          if(m_runNoList[i+1] < m_runNoList[i-1]) {
00057            for(int j = m_runNoList[i+1]+1; j < m_runNoList[i-1]; j++) {
00058              if(find(m_runIdList.begin(),m_runIdList.end(),j) == m_runIdList.end()) m_runIdList.push_back(j);
00059              else log << MSG::ALWAYS <<"RunNo "<<j<<" repeated in run list"<<endreq;
00060            }
00061          }
00062          else {
00063            for(int j = m_runNoList[i-1]+1; j < m_runNoList[i+1]; j++) {
00064              if(find(m_runIdList.begin(),m_runIdList.end(),j) == m_runIdList.end()) m_runIdList.push_back(j);
00065              else log << MSG::ALWAYS <<"RunNo "<<j<<" repeated in run list"<<endreq;
00066            }
00067          }
00068        }
00069      }
00070      m_runID = m_runIdList[0];
00071 
00072      m_connect = new RealDBUtil::ConnectionProvider();
00073      if (!m_connect) {
00074        log << MSG::ERROR << "Could not open connection to database" << endreq;
00075      }
00076 
00077      IIncidentSvc* incsvc;
00078      sc = service("IncidentSvc", incsvc);
00079      int priority = 100;
00080      if( sc.isSuccess() ){
00081        incsvc -> addListener(this, "NewRun", priority);
00082      }
00083 
00084      sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
00085      if (sc.isFailure() ) {
00086        log << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
00087        return sc;
00088      }
00089 
00090      return StatusCode::SUCCESS;
00091 }

static const InterfaceID& IRealizationSvc::interfaceID (  )  [inline, static, inherited]

Definition at line 14 of file IRealizationSvc.h.

References IID_IRealizationSvc().

Referenced by queryInterface().

00014 { return IID_IRealizationSvc; }

StatusCode RealizationSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvInterface 
) [virtual]

Definition at line 100 of file RealizationSvc.cxx.

References IRealizationSvc::interfaceID().

00101 {
00102   if ( IRealizationSvc::interfaceID().versionMatch(riid) )    {
00103     *ppvInterface = (IRealizationSvc*)this;
00104   }else{
00105     return Service::queryInterface(riid, ppvInterface);
00106   }
00107   addRef();
00108   return StatusCode::SUCCESS;
00109 }

void RealizationSvc::readDB ( int  runNo  ) 

Definition at line 242 of file RealizationSvc.cxx.

References EvtCyclic3::c_str(), Bes_Common::DEBUG, calibUtil::ERROR, RealDBUtil::ConnectionProvider::getEmcGain(), RealDBUtil::ConnectionProvider::getEtotDataSteps(), RealDBUtil::ConnectionProvider::getLumCurvePar(), RealDBUtil::ConnectionProvider::getReadBackgroundInfo(), RealDBUtil::ConnectionProvider::getReadBunchInfo(), RealDBUtil::ConnectionProvider::getReadTofThreshInfo(), RealDBUtil::ConnectionProvider::getReadTrgTableInfo(), RealDBUtil::ConnectionProvider::getRunInfo(), RealDBUtil::ConnectionProvider::getTrgConfigInfo(), RealDBUtil::ConnectionProvider::getVthBalBLK(), RealDBUtil::ConnectionProvider::getVthBalEEMC(), RealDBUtil::ConnectionProvider::getVthBEtotH(), RealDBUtil::ConnectionProvider::getVthBLZ(), RealDBUtil::ConnectionProvider::getVthDiffB(), RealDBUtil::ConnectionProvider::getVthDiffE(), RealDBUtil::ConnectionProvider::getVthDiffMin(), RealDBUtil::ConnectionProvider::getVthEEtotH(), RealDBUtil::ConnectionProvider::getVthEtotL(), RealDBUtil::ConnectionProvider::getVthEtotM(), genRecEmupikp::i, Bes_Common::INFO, ganga-rec::j, m_bgfilename, m_bossRelease, m_bunch_x, m_bunch_y, m_bunch_z, m_connect, m_EtotDataSteps, m_ifReadBunch, m_ifReadRandTrg, m_ifReadRunInfo, m_ifReadTFEE, m_ifReadTrg, m_ParVer, m_runInfo, m_runTotalTime, m_SftVer, m_sigma_x, m_sigma_y, m_sigma_z, m_tauValue, m_tfee, m_trgGain, m_trgTable, m_VthBalBLK, m_VthBalEEMC, m_VthBEtotH, m_VthBLZ, m_VthDiffB, m_VthDiffE, m_VthDiffMin, m_VthEEtotH, m_VthEtotL, m_VthEtotM, and deljobs::string.

Referenced by handle().

00242                                      {
00243   MsgStream log( messageService(), name() );
00244   log << MSG::DEBUG << "In getCaliConst" << endreq;
00245 
00246   using RealDBUtil::ConnectionProvider;
00247 
00248   StatusCode sc;
00249 
00250   //Get bunch infor
00251   if(m_ifReadBunch == true) {
00252     std::vector<std::string> sbunch;
00253     std::vector<double> bunchInfo;
00254     ConnectionProvider::eRet e = m_connect->getReadBunchInfo(sbunch,runNo,m_SftVer,m_ParVer,m_bossRelease);
00255     if(e == 7 ) {
00256       bool last = true;
00257       for(int id = 1; true; id++) {
00258         e = m_connect->getReadBunchInfo(sbunch,runNo+id,m_SftVer,m_ParVer,m_bossRelease);
00259         last = true;
00260         if(e == 7) {
00261           if((runNo-id) > 0) {
00262             e = m_connect->getReadBunchInfo(sbunch,runNo-id,m_SftVer,m_ParVer,m_bossRelease);
00263             last = false;
00264           }
00265         }
00266         if(e == 0) {
00267           if(last == true) log << MSG::INFO << "Use Bunch infor. of run " << runNo+id << " instead of run " << runNo << endreq;
00268           if(last == false) log << MSG::INFO << "Use Bunch infor. of run " << runNo-id << " instead of run " << runNo << endreq;
00269           break;
00270         }
00271       }
00272     }
00273     if(e != 0 && e != 7) {
00274       log << MSG::ERROR << "Could not find Bunch infor., exit." << endreq;
00275       exit(1);
00276     }
00277     for(unsigned int i = 0; i < sbunch.size(); i++)
00278     {
00279       bunchInfo.push_back(atof(sbunch[i].c_str()));
00280     }
00281     sbunch.clear();
00282 
00283     if(bunchInfo.size() == 6)
00284     {
00285       //convert from cm to mm
00286       m_bunch_x = 10*bunchInfo[0];
00287       m_bunch_y = 10*bunchInfo[1];
00288       m_bunch_z = 10*bunchInfo[2];
00289       m_sigma_x = 10*bunchInfo[3];
00290       m_sigma_y = 10*bunchInfo[4];
00291       m_sigma_z = 10*bunchInfo[5];
00292       log << MSG::INFO << "BunchPosX: " << m_bunch_x << " BunchPosY: " << m_bunch_y << " BunchPosZ: " << m_bunch_z << " in Run " << runNo << endreq;
00293       log << MSG::INFO << "BunchSigmaX: " << m_sigma_x << " BunchSigmaY: " << m_sigma_y << " BunchSigmaZ: " << m_sigma_z << " in Run " << runNo << endreq;
00294     }
00295     else {
00296       log << MSG::ERROR << "Please check the bunch information, the size is " << bunchInfo.size() << endreq;
00297     }
00298     bunchInfo.clear();
00299   }
00300   
00301   //get trigger table
00302   if(m_ifReadTrg == true) {
00303     m_trgTable.clear();
00304     std::vector<std::string> strgTable;
00305     ConnectionProvider::eRet e = m_connect->getReadTrgTableInfo(strgTable,runNo);
00306     if(e != 0 ) {
00307       log << MSG::ERROR << "Could not find TrgTable infor., exit." << endreq;
00308       exit(1);
00309     }
00310     for(unsigned int i = 0; i < strgTable.size(); i++)
00311     {
00312       long long value = 0;
00313       for (unsigned int j = 0; j < (strgTable[i]).length(); j++)
00314       {
00315         value = value*10 + (strgTable[i][j] - '0');
00316       }
00317       m_trgTable.push_back(uint32_t(value));
00318     }
00319     strgTable.clear();
00320     if(m_trgTable.size() != 65) log << MSG::ERROR << "Please check the TrgTable information, the size is " << m_trgTable.size() << endreq;
00321 
00322     std::vector<double> vtrgGain;
00323     e = m_connect->getEmcGain(vtrgGain,runNo);
00324     if(e != 0 ) {
00325       log << MSG::ERROR << "Could not find emc gain infor., exit." << endreq;
00326       exit(1);
00327     }
00328     for(unsigned int i = 0; i < vtrgGain.size(); i++) {
00329       m_trgGain[i] = vtrgGain[i];
00330     }
00331 
00332     //get trigger config information
00333     e = m_connect->getTrgConfigInfo(runNo);
00334     if(e != 0 ) {
00335       log << MSG::ERROR << "Could not find Trigger config infor., exit." << endreq;
00336       exit(1);
00337     }
00338     m_EtotDataSteps = m_connect->getEtotDataSteps();
00339     m_VthBEtotH = m_connect->getVthBEtotH();
00340     m_VthEEtotH = m_connect->getVthEEtotH();
00341     m_VthEtotL = m_connect->getVthEtotL();
00342     m_VthEtotM = m_connect->getVthEtotM();
00343     m_VthBLZ = m_connect->getVthBLZ();
00344     m_VthDiffB = m_connect->getVthDiffB();
00345     m_VthDiffE = m_connect->getVthDiffE();
00346     m_VthBalBLK = m_connect->getVthBalBLK();
00347     m_VthBalEEMC = m_connect->getVthBalEEMC();
00348     m_VthDiffMin = m_connect->getVthDiffMin();
00349   }
00350 
00351   //get background file
00352   if(m_ifReadRandTrg == true) {
00353     std::vector<std::string> fileInfor;
00354     ConnectionProvider::eRet e = m_connect->getReadBackgroundInfo(fileInfor,runNo);
00355     if(e == 7 ) {
00356       bool last = true;
00357       for(int id = 1; true; id++) {
00358         e = m_connect->getReadBackgroundInfo(fileInfor,runNo+id);
00359         last = true;
00360         if(e == 7) {
00361           if((runNo-id) > 0) {
00362             e = m_connect->getReadBackgroundInfo(fileInfor,runNo-id);
00363             last = false;
00364           }
00365         }
00366         if(e == 0) {
00367           if(last == true) log << MSG::INFO << "Use Bg files of run " << runNo+id << " instead of run " << runNo << endreq;
00368           if(last == false) log << MSG::INFO << "Use Bg files of run " << runNo-id << " instead of run " << runNo << endreq;
00369           break;
00370         }
00371       }
00372     }
00373     if(e != 0 && e != 7) {
00374       log << MSG::ERROR << "Could not find background infor., exit." << endreq;
00375       exit(1);
00376     }
00377     m_bgfilename.clear();
00378     for(unsigned int i = 0; i < fileInfor.size(); i+=2)
00379     {
00380       m_bgfilename.push_back(fileInfor[i]+"/"+fileInfor[i+1]);
00381     }
00382     fileInfor.clear();
00383     for(unsigned int i = 0; i < m_bgfilename.size(); i++) {
00384        log << MSG::INFO << "Background file name: " << m_bgfilename[i] << " in run " << runNo << endreq;
00385     }
00386 
00387     //get luminosity curve parameters
00388     std::string srunTime;
00389     std::string stau_value;
00390     e = m_connect->getLumCurvePar(srunTime, stau_value, runNo, m_SftVer, m_ParVer, m_bossRelease);
00391     if(e != 0 ) {
00392       log << MSG::ERROR << "Could not find Luminosity curve parameters, exit." << endreq;
00393       exit(1);
00394     }
00395     m_runTotalTime  = std::atof(srunTime.c_str());
00396     m_tauValue  = std::atof(stau_value.c_str());
00397     log << MSG::INFO << "Total time is " << m_runTotalTime << ", tau is " << m_tauValue << " in run " << runNo << ". " << endreq;
00398   }
00399 
00400   //get tof threshold in table TFEE
00401   if(m_ifReadTFEE == true) {
00402     m_tfee.clear();
00403     ConnectionProvider::eRet e = m_connect->getReadTofThreshInfo(m_tfee,runNo);
00404     if(e != 0 ) {
00405       log << MSG::ERROR << "Could not find TFEE infor., exit." << endreq;
00406       exit(1);
00407     }
00408     
00409     for(unsigned int i = 0; i < m_tfee.size(); i++) {
00410       log << MSG::INFO << "TFEE ----> " << m_tfee[i] << endreq; 
00411     }
00412   }
00413 
00414   //get run infor.
00415   if(m_ifReadRunInfo == true) {
00416     m_runInfo.clear();
00417     std::vector<std::string> srunInfo;
00418     ConnectionProvider::eRet e = m_connect->getRunInfo(srunInfo,runNo);
00419     if(e != 0 ) {
00420       log << MSG::ERROR << "Could not find run infor., exit." << endreq;
00421       exit(1);
00422     }
00423     for(unsigned int i = 0; i < srunInfo.size(); i++)
00424     {
00425       m_runInfo.push_back(atof(srunInfo[i].c_str()));
00426     }
00427     srunInfo.clear();
00428     
00429     for(unsigned int i = 0; i < m_runInfo.size(); i++) {
00430       log << MSG::INFO << "runInfo ----> " << m_runInfo[i] << endreq; 
00431     }
00432   }
00433   
00434 }

void RealizationSvc::setBgFileName ( std::vector< std::string i  )  [inline]

Definition at line 85 of file RealizationSvc.h.

References m_bgfilename.

00085 { m_bgfilename = i; }

void RealizationSvc::setBunchPosX ( double  i  )  [inline]

Definition at line 41 of file RealizationSvc.h.

References m_bunch_x.

00041 { m_bunch_x = i; }

void RealizationSvc::setBunchPosY ( double  i  )  [inline]

Definition at line 42 of file RealizationSvc.h.

References m_bunch_y.

00042 { m_bunch_y = i; }

void RealizationSvc::setBunchPosZ ( double  i  )  [inline]

Definition at line 43 of file RealizationSvc.h.

References m_bunch_z.

00043 { m_bunch_z = i; }

void RealizationSvc::setBunchSizeX ( double  i  )  [inline]

Definition at line 44 of file RealizationSvc.h.

References m_sigma_x.

00044 { m_sigma_x = i; }

void RealizationSvc::setBunchSizeY ( double  i  )  [inline]

Definition at line 45 of file RealizationSvc.h.

References m_sigma_y.

00045 { m_sigma_y = i; }

void RealizationSvc::setBunchSizeZ ( double  i  )  [inline]

Definition at line 46 of file RealizationSvc.h.

References m_sigma_z.

00046 { m_sigma_z = i; }

void RealizationSvc::setInitEvtID ( int  i  )  [inline]

Definition at line 35 of file RealizationSvc.h.

References m_initEvtID.

00035 { m_initEvtID = i; }

void RealizationSvc::setLuminosity ( float  i  )  [inline]

Definition at line 37 of file RealizationSvc.h.

References m_lumi.

00037 { m_lumi = i; }

void RealizationSvc::setRunEvtNum ( int  i  )  [inline]

Definition at line 57 of file RealizationSvc.h.

References m_RunEvtNum.

Referenced by McContext::McContext(), and McContext::next().

00057 { m_RunEvtNum = i; }

void RealizationSvc::setRunId ( int  i  )  [inline]

Definition at line 102 of file RealizationSvc.h.

References m_runID.

Referenced by McContext::McContext(), and McContext::next().

00102 { m_runID = i; }

void RealizationSvc::setTrgTable ( std::vector< uint32_t >  i  )  [inline]

Definition at line 69 of file RealizationSvc.h.

References m_trgTable.

00069 { m_trgTable = i; }

void RealizationSvc::updateRealData (  ) 

Definition at line 436 of file RealizationSvc.cxx.

00436                                     {
00437 }

bool RealizationSvc::UseDBFlag (  )  [inline]

Definition at line 104 of file RealizationSvc.h.

References m_useDB.

Referenced by BesEventAction::EndOfEventAction(), MixerAlg::execute(), BesGlobalTrigSvc::handle(), G4HepMCInterface::HepMC2G4(), BesGlobalTrigSvc::initialize(), MixerAlg::initialize(), McContext::McContext(), McContext::next(), and MixerAlg::nextEvent().

00104 { return m_useDB; }


Member Data Documentation

std::vector<std::string> RealizationSvc::m_bgfilename [private]

Definition at line 153 of file RealizationSvc.h.

Referenced by getBgFileName(), readDB(), and setBgFileName().

std::string RealizationSvc::m_bossRelease [private]

Definition at line 114 of file RealizationSvc.h.

Referenced by getLuminosity(), and readDB().

double RealizationSvc::m_bunch_x [private]

Definition at line 119 of file RealizationSvc.h.

Referenced by getBunchPosX(), readDB(), and setBunchPosX().

double RealizationSvc::m_bunch_y [private]

Definition at line 120 of file RealizationSvc.h.

Referenced by getBunchPosY(), readDB(), and setBunchPosY().

double RealizationSvc::m_bunch_z [private]

Definition at line 121 of file RealizationSvc.h.

Referenced by getBunchPosZ(), readDB(), and setBunchPosZ().

int RealizationSvc::m_CaliConst [private]

Definition at line 112 of file RealizationSvc.h.

RealDBUtil::ConnectionProvider* RealizationSvc::m_connect [private]

Definition at line 175 of file RealizationSvc.h.

Referenced by getBgFileName(), getLuminosity(), initialize(), and readDB().

int RealizationSvc::m_EtotDataSteps [private]

Definition at line 163 of file RealizationSvc.h.

Referenced by getEtotDataSteps(), and readDB().

IDataProviderSvc* RealizationSvc::m_eventSvc [private]

Definition at line 150 of file RealizationSvc.h.

Referenced by handle(), and initialize().

bool RealizationSvc::m_ifReadBunch [private]

Definition at line 143 of file RealizationSvc.h.

Referenced by ifReadBunch(), and readDB().

bool RealizationSvc::m_ifReadRandTrg [private]

Definition at line 145 of file RealizationSvc.h.

Referenced by ifReadRandTrg(), and readDB().

bool RealizationSvc::m_ifReadRunInfo [private]

Definition at line 147 of file RealizationSvc.h.

Referenced by readDB().

bool RealizationSvc::m_ifReadTFEE [private]

Definition at line 146 of file RealizationSvc.h.

Referenced by ifReadTFEE(), and readDB().

bool RealizationSvc::m_ifReadTrg [private]

Definition at line 144 of file RealizationSvc.h.

Referenced by ifReadTrg(), and readDB().

int RealizationSvc::m_initEvtID [private]

Definition at line 127 of file RealizationSvc.h.

Referenced by getInitEvtID(), and setInitEvtID().

float RealizationSvc::m_lumi [private]

Definition at line 118 of file RealizationSvc.h.

Referenced by getLuminosity(), and setLuminosity().

std::string RealizationSvc::m_ParVer [private]

Definition at line 116 of file RealizationSvc.h.

Referenced by getLuminosity(), and readDB().

int RealizationSvc::m_RunEvtNum [private]

Definition at line 129 of file RealizationSvc.h.

Referenced by getRunEvtNum(), and setRunEvtNum().

int RealizationSvc::m_runID [private]

Definition at line 135 of file RealizationSvc.h.

Referenced by getRunId(), initialize(), and setRunId().

std::vector<int> RealizationSvc::m_runIdList [private]

Definition at line 134 of file RealizationSvc.h.

Referenced by getRunList(), and initialize().

std::vector<double> RealizationSvc::m_runInfo [private]

Definition at line 158 of file RealizationSvc.h.

Referenced by getRunInfo(), and readDB().

std::vector<int> RealizationSvc::m_runNoList [private]

Definition at line 133 of file RealizationSvc.h.

Referenced by initialize().

float RealizationSvc::m_runTotalTime [private]

Definition at line 140 of file RealizationSvc.h.

Referenced by getRunTotalTime(), and readDB().

std::string RealizationSvc::m_SftVer [private]

Definition at line 115 of file RealizationSvc.h.

Referenced by getLuminosity(), initialize(), and readDB().

double RealizationSvc::m_sigma_x [private]

Definition at line 123 of file RealizationSvc.h.

Referenced by getBunchSizeX(), readDB(), and setBunchSizeX().

double RealizationSvc::m_sigma_y [private]

Definition at line 124 of file RealizationSvc.h.

Referenced by getBunchSizeY(), readDB(), and setBunchSizeY().

double RealizationSvc::m_sigma_z [private]

Definition at line 125 of file RealizationSvc.h.

Referenced by getBunchSizeZ(), readDB(), and setBunchSizeZ().

float RealizationSvc::m_tauValue [private]

Definition at line 141 of file RealizationSvc.h.

Referenced by getTauValue(), and readDB().

std::vector<std::string> RealizationSvc::m_tfee [private]

Definition at line 155 of file RealizationSvc.h.

Referenced by getTofThreshold(), and readDB().

double RealizationSvc::m_trgGain[6240] [private]

Definition at line 160 of file RealizationSvc.h.

Referenced by getTrgGain(), and readDB().

std::vector<uint32_t> RealizationSvc::m_trgTable [private]

Definition at line 149 of file RealizationSvc.h.

Referenced by getTrgTable(), readDB(), and setTrgTable().

bool RealizationSvc::m_useDB [private]

Definition at line 137 of file RealizationSvc.h.

Referenced by handle(), and UseDBFlag().

int RealizationSvc::m_VthBalBLK [private]

Definition at line 171 of file RealizationSvc.h.

Referenced by getVthBalBLK(), and readDB().

int RealizationSvc::m_VthBalEEMC [private]

Definition at line 172 of file RealizationSvc.h.

Referenced by getVthBalEEMC(), and readDB().

int RealizationSvc::m_VthBEtotH [private]

Definition at line 164 of file RealizationSvc.h.

Referenced by getVthBEtotH(), and readDB().

int RealizationSvc::m_VthBLZ [private]

Definition at line 168 of file RealizationSvc.h.

Referenced by getVthBLZ(), and readDB().

int RealizationSvc::m_VthDiffB [private]

Definition at line 169 of file RealizationSvc.h.

Referenced by getVthDiffB(), and readDB().

int RealizationSvc::m_VthDiffE [private]

Definition at line 170 of file RealizationSvc.h.

Referenced by getVthDiffE(), and readDB().

int RealizationSvc::m_VthDiffMin [private]

Definition at line 173 of file RealizationSvc.h.

Referenced by getVthDiffMin(), and readDB().

int RealizationSvc::m_VthEEtotH [private]

Definition at line 165 of file RealizationSvc.h.

Referenced by getVthEEtotH(), and readDB().

int RealizationSvc::m_VthEtotL [private]

Definition at line 166 of file RealizationSvc.h.

Referenced by getVthEtotL(), and readDB().

int RealizationSvc::m_VthEtotM [private]

Definition at line 167 of file RealizationSvc.h.

Referenced by getVthEtotM(), and readDB().


Generated on Tue Nov 29 23:20:47 2016 for BOSS_7.0.2 by  doxygen 1.4.7