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