BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataProviderSvc.cxx
Go to the documentation of this file.
1#include "RawDataProviderSvc/RawDataProviderSvc.h"
2#include "GaudiKernel/Kernel.h"
3#include "GaudiKernel/IInterface.h"
4#include "GaudiKernel/IIncidentSvc.h"
5#include "GaudiKernel/Incident.h"
6#include "GaudiKernel/IIncidentListener.h"
7#include "GaudiKernel/StatusCode.h"
8#include "GaudiKernel/SvcFactory.h"
9#include "GaudiKernel/MsgStream.h"
10#include "GaudiKernel/IDataProviderSvc.h"
11#include "GaudiKernel/SmartDataPtr.h"
12#include "GaudiKernel/DataSvc.h"
13#include "RawEvent/RawDataUtil.h"
14
15// tianhl for mt
16#include "GaudiKernel/ThreadGaudi.h"
17// tianhl for mt
18#include <stdint.h>
19#include <vector>
20
21using namespace std;
22
23RawDataProviderSvc::RawDataProviderSvc( const string& name, ISvcLocator* svcloc) :
24 Service (name, svcloc) {
25 declareProperty("OutputLevel", m_outputLevel=MSG::WARNING);
26 declareProperty("skipLayers", m_skipLayers);
27 declareProperty("MdcWireEffThreshold", m_effThreshold=0.9);
28 declareProperty("EmcELow", m_elow=0);
29 declareProperty("EmcTLow", m_tlow=0);
30 declareProperty("EmcTHigh", m_thigh=60);
31 declareProperty("EmcHotCrystals", m_hotVec);
32 declareProperty("EmcDeadCrystals", m_deadVec);
33 declareProperty("EmcDeadCrystals", m_deadVec);
34 declareProperty("OnlineMode", m_onlineMode=0);
35 // tianhl for mt
36 m_mdcProvider = new MdcRawDataProvider(name.c_str());
37 m_tofProvider = new TofRawDataProvider(name.c_str());
38 m_emcProvider = new EmcRawDataProvider(name.c_str());
39 // tianhl for mt
40}
41
42
44 if(m_mdcProvider) delete m_mdcProvider;
45 if(m_tofProvider) delete m_tofProvider;
46 if(m_emcProvider) delete m_emcProvider;
47}
48
49
51 MsgStream log(messageService(), name());
52 log << MSG::INFO << "RawDataProviderSvc::initialize()" << endreq;
53
54 StatusCode sc = Service::initialize();
55 if( sc.isFailure() ) return sc;
56
57 // tianhl for mt
58 std::string incidentSvc_name("IncidentSvc");
59 //if(isGaudiThreaded(name())){
60 // incidentSvc_name += getGaudiThreadIDfromName(name());
61 //}
62 // tianhl for mt
63 IIncidentSvc* incsvc;
64 sc = service(incidentSvc_name.c_str(), incsvc);
65 int priority = 100;
66 if( sc.isSuccess() ){
67 incsvc -> addListener(this, "BeginEvent", priority);
68 }
69
70 sc = m_mdcProvider->initialize();
71 if( sc.isFailure() ) return sc;
72
73
74 sc = m_tofProvider->initialize(m_onlineMode);
75 if( sc.isFailure() ) return sc;
76
77 if( m_skipLayers.size()>0 ) m_mdcProvider->setSkipLayers( m_skipLayers );
78 m_mdcProvider->setEffThreshold( m_effThreshold );
79
80 if(m_elow>0) m_emcProvider->setELowThreshold(RawDataUtil::EmcChargeChannel(m_elow));
81 if(m_tlow>0) m_emcProvider->setTLowThreshold(m_tlow);
82 if(m_thigh>0&&m_thigh<60) m_emcProvider->setTHighThreshold(m_thigh);
83 if(m_hotVec.size()>0) m_emcProvider->setHotCrystals(m_hotVec);
84 if(m_deadVec.size()>0) m_emcProvider->setHotCrystals(m_deadVec);
85 sc = m_emcProvider->initialize(m_onlineMode,serviceLocator());
86 if( sc.isFailure() ) return sc;
87
88 //log << MSG::INFO << "finish initializing..." << endreq;
89 return StatusCode::SUCCESS;
90}
91
93 MsgStream log(messageService(), name());
94 log << MSG::INFO << "RawDataProviderSvc::finalize()" << endreq;
95
96 return StatusCode::SUCCESS;
97}
98
99StatusCode RawDataProviderSvc::queryInterface(const InterfaceID& riid, void** ppvInterface)
100{
101 if ( IRawDataProviderSvc::interfaceID().versionMatch(riid) ) {
102 *ppvInterface = (IRawDataProviderSvc*)this;
103 }else{
104 return Service::queryInterface(riid, ppvInterface);
105 }
106 addRef();
107 return StatusCode::SUCCESS;
108}
109
110void RawDataProviderSvc::handle(const Incident& inc){
111 MsgStream log( messageService(), name() );
112 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
113 if ( inc.type() == "BeginEvent" ){
114 log << MSG::DEBUG << "Begin Event" << endreq;
115 m_tofProvider->handle( inc );
116 m_emcProvider->handle( inc );
117 m_mdcProvider->handle( inc );
118 }
119}
void handle(const Incident &)
virtual StatusCode initialize(bool mode=0, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
void handle(const Incident &)
StatusCode initialize(ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
virtual StatusCode finalize()
virtual StatusCode queryInterface(const InterfaceID &riid, void **ppvInterface)
void handle(const Incident &)
RawDataProviderSvc(const std::string &name, ISvcLocator *svcloc)
virtual StatusCode initialize()
void handle(const Incident &)
StatusCode initialize(bool mode=false, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)