BOSS 7.1.1
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataProviderSvc.cxx
Go to the documentation of this file.
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"
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
23DECLARE_COMPONENT(RawDataProviderSvc)
24
25RawDataProviderSvc::RawDataProviderSvc( const string& name, ISvcLocator* svcloc) :
26 base_class (name, svcloc) {
27// Service (name, svcloc) {
28 declareProperty("OutputLevel", m_outputLevel=MSG::WARNING);
29 declareProperty("skipLayers", m_skipLayers);
30 declareProperty("MdcWireEffThreshold", m_effThreshold=0.9);
31 declareProperty("MdcAdcThreshold", m_adcThresholds);
32 declareProperty("EmcELow", m_elow=0);
33 declareProperty("EmcTLow", m_tlow=0);
34 declareProperty("EmcTHigh", m_thigh=60);
35 declareProperty("EmcHotCrystals", m_hotVec);
36 declareProperty("EmcDeadCrystals", m_deadVec);
37 declareProperty("EmcDeadCrystals", m_deadVec);
38 declareProperty("OnlineMode", m_onlineMode=0);
39 // tianhl for mt
40 m_mdcProvider = new MdcRawDataProvider(name.c_str());
41 m_tofProvider = new TofRawDataProvider(name.c_str());
42 m_emcProvider = new EmcRawDataProvider(name.c_str());
43 // tianhl for mt
44}
45
46
48 if(m_mdcProvider) delete m_mdcProvider;
49 if(m_tofProvider) delete m_tofProvider;
50 if(m_emcProvider) delete m_emcProvider;
51}
52
53
55 MsgStream log(messageService(), name());
56 log << MSG::INFO << "RawDataProviderSvc::initialize()" << endreq;
57
58 StatusCode sc = Service::initialize();
59 if( sc.isFailure() ) return sc;
60
61 // tianhl for mt
62 std::string incidentSvc_name("IncidentSvc");
63 //if(isGaudiThreaded(name())){
64 // incidentSvc_name += getGaudiThreadIDfromName(name());
65 //}
66 // tianhl for mt
67 IIncidentSvc* incsvc;
68 sc = service(incidentSvc_name.c_str(), incsvc);
69 int priority = 100;
70 if( sc.isSuccess() ){
71 incsvc -> addListener(this, "BeginEvent", priority);
72 }
73
74 sc = m_mdcProvider->initialize();
75 if( sc.isFailure() ) return sc;
76
77
78 sc = m_tofProvider->initialize(m_onlineMode);
79 if( sc.isFailure() ) return sc;
80
81 if( m_skipLayers.size()>0 ) m_mdcProvider->setSkipLayers( m_skipLayers );
82 m_mdcProvider->setEffThreshold( m_effThreshold );
83 if(m_adcThresholds.size()>0) m_mdcProvider->setAdcThresholds( m_adcThresholds );
84
85 if(m_elow>0) m_emcProvider->setELowThreshold(RawDataUtil::EmcChargeChannel(m_elow));
86 if(m_tlow>0) m_emcProvider->setTLowThreshold(m_tlow);
87 if(m_thigh>0&&m_thigh<60) m_emcProvider->setTHighThreshold(m_thigh);
88 if(m_hotVec.size()>0) m_emcProvider->setHotCrystals(m_hotVec);
89 if(m_deadVec.size()>0) m_emcProvider->setHotCrystals(m_deadVec);
90 sc = m_emcProvider->initialize(m_onlineMode,serviceLocator());
91 if( sc.isFailure() ) return sc;
92
93 //log << MSG::INFO << "finish initializing..." << endreq;
94 return StatusCode::SUCCESS;
95}
96
98 MsgStream log(messageService(), name());
99 log << MSG::INFO << "RawDataProviderSvc::finalize()" << endreq;
100
101 return StatusCode::SUCCESS;
102}
103
104/*StatusCode RawDataProviderSvc::queryInterface(const InterfaceID& riid, void** ppvInterface)
105{
106 if ( IRawDataProviderSvc::interfaceID().versionMatch(riid) ) {
107 *ppvInterface = (IRawDataProviderSvc*)this;
108 }else{
109 return Service::queryInterface(riid, ppvInterface);
110 }
111 addRef();
112 return StatusCode::SUCCESS;
113}*/
114
115void RawDataProviderSvc::handle(const Incident& inc){
116 MsgStream log( messageService(), name() );
117 log << MSG::DEBUG << "handle: " << inc.type() << endreq;
118 if ( inc.type() == "BeginEvent" ){
119 log << MSG::DEBUG << "Begin Event" << endreq;
120 m_tofProvider->handle( inc );
121 m_emcProvider->handle( inc );
122 m_mdcProvider->handle( inc );
123 }
124}
void setTLowThreshold(const uint32_t low)
void setHotCrystals(const std::vector< uint32_t > &idVec)
void setELowThreshold(const uint32_t low)
void handle(const Incident &)
virtual StatusCode initialize(bool mode=0, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
void setTHighThreshold(const uint32_t high)
void handle(const Incident &)
void setAdcThresholds(const std::vector< float > &adcThresholds)
StatusCode initialize(ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
void setSkipLayers(const std::vector< int > &skipLayers)
void setEffThreshold(float effThreshold)
virtual StatusCode finalize()
void handle(const Incident &)
virtual StatusCode initialize()
static int EmcChargeChannel(double charge)
Definition RawDataUtil.h:37
void handle(const Incident &)
StatusCode initialize(bool mode=false, ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)