BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
DetVerSvc Class Reference

#include <DetVerSvc.h>

+ Inheritance diagram for DetVerSvc:

Public Member Functions

 DetVerSvc (const std::string &name, ISvcLocator *svcloc)
 
virtual ~DetVerSvc ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
int phase ()
 
int fromRun (unsigned int run)
 

Detailed Description

Definition at line 7 of file DetVerSvc.h.

Constructor & Destructor Documentation

◆ DetVerSvc()

DetVerSvc::DetVerSvc ( const std::string & name,
ISvcLocator * svcloc )

Definition at line 14 of file DetVerSvc.cxx.

15 : base_class(name, svcloc)
16{
17 declareProperty("Config", m_conf = std::string(getenv("DETVERSVCROOT")) + "/share/config.txt");
18 m_phase = -1;
19}

◆ ~DetVerSvc()

DetVerSvc::~DetVerSvc ( )
virtual

Definition at line 21 of file DetVerSvc.cxx.

22{
23}

Member Function Documentation

◆ finalize()

StatusCode DetVerSvc::finalize ( )
virtual

Definition at line 53 of file DetVerSvc.cxx.

53 {
54 MsgStream log(messageService(), name());
55 log << MSG::INFO << name() << ": End of Run finalize" << endreq;
56
57 return StatusCode::SUCCESS;
58}

◆ fromRun()

int DetVerSvc::fromRun ( unsigned int run)

Definition at line 88 of file DetVerSvc.cxx.

89{
90 std::vector<int> runList;
91 //parse m_conf
92 int iTmp;
93 std::ifstream fs(m_conf.c_str());
94 fs >> iTmp;
95 while ( ! fs.eof() ) {
96 runList.push_back(iTmp);
97 fs >> iTmp;
98 }
99
100 //return phase from run
101 int iPhase = 1;
102 for ( std::vector<int>::iterator it = runList.begin(); it != runList.end(); ++it ) {
103 if ( run < (*it) ) {
104 break;
105 }
106 ++iPhase;
107 }
108 return iPhase;
109}
#define fs

Referenced by BesGeoSelector::getGeomFileNameFromRunNo(), RealizationSvc::initialize(), and phase().

◆ initialize()

StatusCode DetVerSvc::initialize ( )
virtual

Definition at line 37 of file DetVerSvc.cxx.

38{
39 Service::initialize();
40
41 MsgStream log(messageService(), name());
42 log << MSG::INFO << name() << ": Start of run initialisation" << endreq;
43
44 //assert m_conf is a valid file
45 if ( access( m_conf.c_str(), F_OK ) < 0 ) {
46 log << MSG::FATAL << "Cann't find config file: " << m_conf << endreq;
47 return StatusCode::FAILURE;
48 }
49
50 return StatusCode::SUCCESS;
51}

Referenced by BesGeoSelector::getGeomFileNameFromRunNo().

◆ phase()

int DetVerSvc::phase ( )

Definition at line 60 of file DetVerSvc.cxx.

61{
62 if ( m_phase < 0) { //phase has not been retrieved
63 SmartIF<IJobOptionsSvc> iSvc(serviceLocator()->service("JobOptionsSvc"));
64 if ( iSvc.isValid() ) {
65 std::string dll; //sub so name
66 const std::vector<const Property*>* ps = 0;
67 if ( (ps = iSvc->getProperties("RawDataInputSvc")) != 0 ) {
68 dll = "libDetVerSvc_IRaw.so"; //case 0: Input RAW
69 }
70 else if ( (ps = iSvc->getProperties("EventCnvSvc")) != 0 ) {
71 dll = "libDetVerSvc_IRoot.so"; //case 1: Input root
72 }
73 else if ( (ps = iSvc->getProperties("RealizationSvc")) != 0 ) {
74 dll = "libDetVerSvc_Sim.so"; //case 2: simulation
75 }
76 //else // //Unknown job type !!!!!
77
78 void *dl_handler = dlopen(dll.c_str(), RTLD_LAZY|RTLD_GLOBAL);
79 if ( dl_handler != 0 ) {
80 m_phase = fromRun( (*DetVerSvcPack::pf_helper)(serviceLocator()) );
81 }
82 dlclose(dl_handler);
83 }
84 }
85 return m_phase;
86}
int fromRun(unsigned int run)
Definition DetVerSvc.cxx:88
int(* pf_helper)(ISvcLocator *)
Definition DetVerSvc.cxx:11

The documentation for this class was generated from the following files: