BOSS 7.0.4
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 queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
int phase ()
 
int fromRun (unsigned int run)
 
 DetVerSvc (const std::string &name, ISvcLocator *svcloc)
 
virtual ~DetVerSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
int phase ()
 
int fromRun (unsigned int run)
 
virtual int phase ()=0
 
virtual int phase ()=0
 

Additional Inherited Members

- Static Public Member Functions inherited from IDetVerSvc
static const InterfaceID & interfaceID ()
 
static const InterfaceID & interfaceID ()
 

Detailed Description

Constructor & Destructor Documentation

◆ DetVerSvc() [1/2]

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

Definition at line 12 of file DetVerSvc.cxx.

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

◆ ~DetVerSvc() [1/2]

DetVerSvc::~DetVerSvc ( )
virtual

Definition at line 19 of file DetVerSvc.cxx.

20{
21}

◆ DetVerSvc() [2/2]

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

◆ ~DetVerSvc() [2/2]

virtual DetVerSvc::~DetVerSvc ( )
virtual

Member Function Documentation

◆ finalize() [1/2]

StatusCode DetVerSvc::finalize ( )
virtual

Definition at line 49 of file DetVerSvc.cxx.

49 {
50 MsgStream log(messageService(), name());
51 log << MSG::INFO << name() << ": End of Run finalize" << endreq;
52
53 return StatusCode::SUCCESS;
54}

◆ finalize() [2/2]

virtual StatusCode DetVerSvc::finalize ( )
virtual

◆ fromRun() [1/2]

int DetVerSvc::fromRun ( unsigned int  run)

Definition at line 84 of file DetVerSvc.cxx.

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

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

◆ fromRun() [2/2]

int DetVerSvc::fromRun ( unsigned int  run)

◆ initialize() [1/2]

StatusCode DetVerSvc::initialize ( )
virtual

Definition at line 33 of file DetVerSvc.cxx.

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

Referenced by BesGeoSelector::getGeomFileNameFromRunNo().

◆ initialize() [2/2]

virtual StatusCode DetVerSvc::initialize ( )
virtual

◆ phase() [1/2]

int DetVerSvc::phase ( )
virtual

Implements IDetVerSvc.

Definition at line 56 of file DetVerSvc.cxx.

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

◆ phase() [2/2]

int DetVerSvc::phase ( )
virtual

Implements IDetVerSvc.

◆ queryInterface() [1/2]

StatusCode DetVerSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

Definition at line 23 of file DetVerSvc.cxx.

24{
25 if ( IID_IDetVerSvc.versionMatch(riid) ) {
26 *ppvInterface = static_cast<IDetVerSvc*> (this);
27 } else {
28 return Service::queryInterface(riid, ppvInterface) ;
29 }
30 return StatusCode::SUCCESS;
31}

◆ queryInterface() [2/2]

virtual StatusCode DetVerSvc::queryInterface ( const InterfaceID &  riid,
void **  ppvUnknown 
)
virtual

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