BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
VertexDbSvc Class Reference

#include <VertexDbSvc.h>

+ Inheritance diagram for VertexDbSvc:

Public Member Functions

 VertexDbSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~VertexDbSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &)
 
double * PrimaryVertex ()
 
double * SigmaPrimaryVertex ()
 
bool isVertexValid ()
 
virtual double * PrimaryVertex ()=0
 
virtual double * SigmaPrimaryVertex ()=0
 
virtual bool isVertexValid ()=0
 

Additional Inherited Members

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

Detailed Description

Definition at line 27 of file VertexDbSvc.h.

Constructor & Destructor Documentation

◆ VertexDbSvc()

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

Definition at line 48 of file VertexDbSvc.cxx.

48 :
49 Service (name, svcloc){
50 // declare properties
51 declareProperty("Host" , host = std::string("bes3db2.ihep.ac.cn"));
52 declareProperty("DbName" , dbName = std::string("offlinedb"));
53 declareProperty("UserName" , userName = std::string("guest"));
54 declareProperty("Password" , password = std::string("guestpass"));
55 declareProperty("BossVer" , m_bossver = std::string("default"));
56 declareProperty("VerPar" , m_verpar = std::string("default"));
57 declareProperty("BossRelease",m_bossRelease = std::string("default"));
58 declareProperty("ReadOneTime",m_readOneTime=false);
59 declareProperty("RunFrom", m_runFrom=8093);
60 declareProperty("RunTo",m_runTo=9025);
61}

◆ ~VertexDbSvc()

VertexDbSvc::~VertexDbSvc ( )

Definition at line 63 of file VertexDbSvc.cxx.

63 {
64}

Member Function Documentation

◆ finalize()

StatusCode VertexDbSvc::finalize ( )
virtual

Definition at line 111 of file VertexDbSvc.cxx.

111 {
112 MsgStream log(messageService(), name());
113 log << MSG::INFO << "VertexDbSvc::finalize()" << endreq;
114 // if(m_connect_offline) delete m_connect_offline;
115 return StatusCode::SUCCESS;
116}

◆ handle()

void VertexDbSvc::handle ( const Incident &  inc)

Definition at line 118 of file VertexDbSvc.cxx.

118 {
119 MsgStream log( messageService(), name() );
120 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
121
122 if ( inc.type() == "NewRun" ){
123 log << MSG::DEBUG << "NewRun" << endreq;
124 if(!m_readOneTime) {
125 getVertexTableInfo();
126 } else {
127 SmartDataPtr<Event::EventHeader> eventHeader(m_eventSvc,"/Event/EventHeader");
128 int run = eventHeader->runNumber();
129 //cout << endl << "New Run: " << run << " VertexDB vertex= ";
130 if(run<0) run=-run;
131 if((m_mapPrimaryVertex[run]).size()>0) {
132 m_isRunNumberValid = true;
133 m_primaryVertex[0] = (m_mapPrimaryVertex[run])[0];
134 m_primaryVertex[1] = (m_mapPrimaryVertex[run])[1];
135 m_primaryVertex[2] = (m_mapPrimaryVertex[run])[2];
136 m_sigmaPrimaryVertex[0] = (m_mapPrimaryVertex[run])[3];
137 m_sigmaPrimaryVertex[1] = (m_mapPrimaryVertex[run])[4];
138 m_sigmaPrimaryVertex[2] = (m_mapPrimaryVertex[run])[5];
139 //cout << m_primaryVertex[0] << "," << m_primaryVertex[1] << "," << m_primaryVertex[2] << " sigma= " << m_sigmaPrimaryVertex[0] << "," << m_sigmaPrimaryVertex[1] << "," << m_sigmaPrimaryVertex[2] << endl;
140 } else {
141 std::cout<<"VertexDbSvc, could not get vertex infor in handle new run"<<std::endl;
142 }
143 }
144 }
145}

◆ initialize()

StatusCode VertexDbSvc::initialize ( )
virtual

Definition at line 75 of file VertexDbSvc.cxx.

75 {
76 MsgStream log(messageService(), name());
77 log << MSG::INFO << "VertexDbSvc::initialize()" << endreq;
78
79 StatusCode sc = Service::initialize();
80 if( sc.isFailure() ) return sc;
81
82
83 IIncidentSvc* incsvc;
84 sc = service("IncidentSvc", incsvc);
85 int priority = 100;
86 if( sc.isSuccess() ){
87 incsvc -> addListener(this, "NewRun", priority);
88 }
89
90 sc = serviceLocator()->service("DatabaseSvc",m_dbsvc,true);
91 if (sc .isFailure() ) {
92 log << MSG::ERROR << "Unable to find DatabaseSvc " << endreq;
93 return sc;
94 }
95
96 sc = serviceLocator()->service("EventDataSvc", m_eventSvc, true);
97 if (sc .isFailure() ) {
98 log << MSG::ERROR << "Unable to find EventDataSvc " << endreq;
99 return sc;
100 }
101 if(m_readOneTime){
102 if(m_runFrom>=8093){
103 getReadBunchInfo(m_runFrom, m_runTo);
104 }
105 else
106 std::cout<<"VertexDbSvc, invalid RunFrom, RunFrom should be >=8093"<<std::endl;
107 }
108 return StatusCode::SUCCESS;
109}

◆ isVertexValid()

bool VertexDbSvc::isVertexValid ( )
inlinevirtual

Implements IVertexDbSvc.

Definition at line 73 of file VertexDbSvc.h.

73{return m_isRunNumberValid;}

◆ PrimaryVertex()

double * VertexDbSvc::PrimaryVertex ( )
virtual

Implements IVertexDbSvc.

Definition at line 181 of file VertexDbSvc.cxx.

182{
183 if( !m_isRunNumberValid ) {
184 cerr << "WARNING in VertexDbSvc: runNo is invalid!\n";
185 memset(m_primaryVertex,0,sizeof(m_primaryVertex));
186 }
187 return m_primaryVertex;
188}

◆ queryInterface()

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

Definition at line 66 of file VertexDbSvc.cxx.

66 {
67 if( IID_IVertexDbSvc.versionMatch(riid) ){
68 *ppvInterface = static_cast<IVertexDbSvc*> (this);
69 } else{
70 return Service::queryInterface(riid, ppvInterface);
71 }
72 return StatusCode::SUCCESS;
73}

◆ SigmaPrimaryVertex()

double * VertexDbSvc::SigmaPrimaryVertex ( )
virtual

Implements IVertexDbSvc.

Definition at line 190 of file VertexDbSvc.cxx.

191{
192 if( !m_isRunNumberValid ) {
193 cerr << "WARNING in VertexDbSvc: runNo is invalid!\n";
194 memset(m_sigmaPrimaryVertex,0,sizeof(m_sigmaPrimaryVertex));
195 }
196 return m_sigmaPrimaryVertex;
197}

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