BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcTripSvc Class Reference

#include <MdcTripSvc.h>

+ Inheritance diagram for MdcTripSvc:

Public Member Functions

 MdcTripSvc (const std::string &name, ISvcLocator *svcloc)
 
 ~MdcTripSvc ()
 
virtual StatusCode queryInterface (const InterfaceID &riid, void **ppvUnknown)
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
void handle (const Incident &inc)
 
bool getTripFlag (int iRun, time_t etime)
 
virtual bool getTripFlag (int iRun, time_t etime)=0
 

Additional Inherited Members

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

Detailed Description

Definition at line 15 of file MdcTripSvc.h.

Constructor & Destructor Documentation

◆ MdcTripSvc()

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

Definition at line 15 of file MdcTripSvc.cxx.

15 :
16 Service(name, pSvcLocator)
17{
18 m_nEvt=0;
19 m_Run=-1;
20 m_isTrip = false;
21}

◆ ~MdcTripSvc()

MdcTripSvc::~MdcTripSvc ( )

Definition at line 23 of file MdcTripSvc.cxx.

24{
25 vec.clear();
26 vec1.clear();
27}

Member Function Documentation

◆ finalize()

StatusCode MdcTripSvc::finalize ( )
virtual

Definition at line 42 of file MdcTripSvc.cxx.

43{
44 MsgStream log(msgSvc(), name());
45 log << MSG::INFO << "in finalize()" << endreq;
46 cout << "the number of tripped events are: " << m_nEvt << endl;
47
48 return StatusCode::SUCCESS;
49}
IMessageSvc * msgSvc()

◆ getTripFlag()

bool MdcTripSvc::getTripFlag ( int  iRun,
time_t  etime 
)
virtual

Implements IMdcTripSvc.

Definition at line 64 of file MdcTripSvc.cxx.

65{
66 //cout<<"m_Run= "<<m_Run<<" iRun: "<<iRun<<endl;
67 if(m_Run!=iRun)
68 {
69 m_Run=iRun;
70 vec.clear();
71 vec1.clear();
72
73 m_readt.ReadDb(iRun);
74 m_isTrip = m_readt.isRunTripped();
75 //cout<<"m_isTrip= "<<m_isTrip<<endl;
76 if(m_isTrip)
77 {
78 int m = m_readt.getstSize();
79 int n = m_readt.getndSize();
80 char trip_st[255];
81 char trip_nd[255];
82 string m_tStat;
83 string m_tStop;
84 time_t runtripst;
85 time_t runtripnd;
86
87 for(int c = 0;c < m;c++)
88 {
89 m_tStat=m_readt.gettimest(c);
90 strcpy(trip_st, m_tStat.c_str());
91 struct tm tm1;
92 int i = sscanf(trip_st,"%04d-%02d-%02d %02d:%02d:%02d",&(tm1.tm_year),&(tm1.tm_mon),&(tm1.tm_mday),&(tm1.tm_hour),&(tm1.tm_min),&(tm1.tm_sec));
93 tm1.tm_year -= 1900;
94 tm1.tm_mon -= 1;
95 tm1.tm_isdst = 0;
96 tm1.tm_yday = 0;
97 tm1.tm_wday = 0;
98 runtripst = mktime(&tm1);
99 vec.push_back(runtripst);
100
101 m_tStop=m_readt.gettimend(c);
102 strcpy(trip_nd, m_tStop.c_str());
103 struct tm tm2;
104 int j = sscanf(trip_nd,"%04d-%02d-%02d %02d:%02d:%02d",&(tm2.tm_year),&(tm2.tm_mon),&(tm2.tm_mday),&(tm2.tm_hour),&(tm2.tm_min),&(tm2.tm_sec));
105 tm2.tm_year -= 1900;
106 tm2.tm_mon -= 1;
107 tm2.tm_isdst = 0;
108 tm2.tm_yday = 0;
109 tm2.tm_wday = 0;
110 runtripnd = mktime(&tm2);
111 vec1.push_back(runtripnd);
112 //cout<<"m_tStat="<<m_tStat<<"m_tStop="<<m_tStop<<endl;
113 }
114 }
115 }
116
117 bool flag = false;
118 if(m_isTrip)
119 {
120 for(int f = 0;f < vec.size();f++)
121 {
122 if((etime > vec[f])&&(etime < vec1[f])) flag = true;
123 }
124 }
125 if(flag) m_nEvt++;
126 return flag;
127}
const Int_t n
string gettimest(int i)
dble_vec_t vec[12]
Definition: ranlxd.c:372

◆ handle()

void MdcTripSvc::handle ( const Incident &  inc)

Definition at line 129 of file MdcTripSvc.cxx.

130{
131 MsgStream log( messageService(), name() );
132 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
133}

◆ initialize()

StatusCode MdcTripSvc::initialize ( )
virtual

Definition at line 30 of file MdcTripSvc.cxx.

30 {
31 StatusCode status = Service::initialize();
32 MsgStream log( msgSvc(), name() );
33 log << MSG::INFO << "in initialize()" << endreq;
34
35 IService* pSvc = 0;
36 status = serviceLocator()->getService("EventDataSvc", pSvc);
37
38 return status;
39}

◆ queryInterface()

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

Definition at line 51 of file MdcTripSvc.cxx.

52{
53 if ( IID_IMdcTripSvc.versionMatch(riid) ) {
54 *ppvInterface = static_cast<IMdcTripSvc*> (this);
55 } else {
56 return Service::queryInterface(riid, ppvInterface) ;
57 }
58
59 return StatusCode::SUCCESS;
60}

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