1#include "RawDataProviderSvc/RawDataProviderSvc.h"
2#include "RawDataProviderSvc/MdcRawDataProvider.h"
3#include "GaudiKernel/Kernel.h"
4#include "GaudiKernel/IInterface.h"
5#include "GaudiKernel/IIncidentSvc.h"
6#include "GaudiKernel/Incident.h"
7#include "GaudiKernel/IIncidentListener.h"
8#include "GaudiKernel/StatusCode.h"
9#include "GaudiKernel/SvcFactory.h"
10#include "GaudiKernel/MsgStream.h"
11#include "GaudiKernel/IDataProviderSvc.h"
12#include "GaudiKernel/SmartDataPtr.h"
13#include "GaudiKernel/DataSvc.h"
14#include "MdcRecEvent/RecMdcHit.h"
15#include "Identifier/MdcID.h"
16#include "MdcCalibFunSvc/MdcCalibFunSvc.h"
17#include "RawEvent/RawDataUtil.h"
18#include "EvTimeEvent/RecEsTime.h"
21#include "GaudiKernel/ThreadGaudi.h"
46 return StatusCode::SUCCESS;
51 log << MSG::DEBUG <<
"handle: " << inc.type() << endreq;
52 if ( inc.type() ==
"BeginEvent" ){
62 if(!unRedo) digiRef.clear();
63 else if(digiRef.size()>0)
return digiRef;
65 IDataProviderSvc* evtSvc;
67 std::string evtDataSvc_name(
"EventDataSvc");
68 if(isGaudiThreaded(
m_name)){
69 evtDataSvc_name += getGaudiThreadIDfromName(
m_name);
72 sc =
m_svcLocator->service(evtDataSvc_name.c_str(),evtSvc,
true);
74 log << MSG::FATAL <<
"Could not load EventDataSvc" << endreq;
86 sc =
m_svcLocator->service(
"MdcCalibFunSvc", m_mdcCalibFunSvc);
87 if ( sc.isFailure() ){
88 log << MSG::FATAL <<
"Could not load MdcCalibFunSvc!" << endreq;
93 SmartDataPtr<RecEsTimeCol> esTimeCol(evtSvc,
"/Event/Recon/RecEsTimeCol");
95 log << MSG::INFO<<
" Could not retrieve RecEsTimeCol"<< endreq;
97 }
else if( (esTimeCol->size()==0)) {
98 log << MSG::INFO<<
" Could not retrieve RecEsTimeCol"<< endreq;
101 RecEsTimeCol::iterator
iter= esTimeCol->begin();
102 for(;
iter!=esTimeCol->end();
iter++){
103 t0 = (*iter)->getTest();
109 bool m_hitInUse[43][288];
110 for (
int i=0; i<43; i++){
111 for (
int j=0; j<288; j++) m_hitInUse[i][j]=
false;
113 bool dropHot = ((control&
b_dropHot)==0x4000);
115 SmartDataPtr<RecMdcHitCol>
recHitCol(evtSvc,
"/Event/Recon/RecMdcHitCol");
117 log << MSG::INFO <<
"Could not retrieve RecMdcHitCol" << endreq;
129 bool isSkipLayers = ((control&
b_keepSkipped)!=0x8000) && (m_skipLayers.size()>0);
132 for (
int i=0; i<43; i++){skipLayer[i]=
false;}
133 for(
unsigned iSkip =0; iSkip < m_skipLayers.size(); iSkip++){
134 skipLayer[m_skipLayers[iSkip]]=
true;
141 SmartDataPtr<MdcDigiCol> mdcDigiCol(evtSvc,
"/Event/Digi/MdcDigiCol");
142 if (sc!=StatusCode::SUCCESS) {
143 log << MSG::FATAL <<
"Could not find MdcDigiCol!" << endreq;
146 MdcDigiCol::iterator
iter = mdcDigiCol->begin();
147 for (;
iter != mdcDigiCol->end();
iter++,iDigi++ ) {
158 && m_mdcCalibFunSvc->
getWireEff(layer,wire) < m_effThreshold)
continue;
161 if ( isSkipLayers && skipLayer[layer] )
continue;
164 if ( dropHot && m_hitInUse[layer][wire])
continue;
173 (((overflow & 1)>0) ||
174 (((overflow&12)!=12)&&((overflow&12)!=0)) ||
175 (tdc==0x7FFFFFFF) || (adc== 0x7FFFFFFF) ) ) {
continue; }
183 if (m_mdcCalibFunSvc) { T0Walk = m_mdcCalibFunSvc->
getT0(layer,wire)
190 if ((maxMdcDigi>0) && (nMatchedDigi > maxMdcDigi)){
195 digiRef.push_back(aDigi);
std::vector< HoughRecHit > recHitCol
std::vector< MdcDigi * > MdcDigiVec
virtual double getWireEff(int layid, int cellid) const =0
virtual double getT0(int layid, int cellid) const =0
virtual double getTimeWalk(int layid, double Q) const =0
unsigned int getOverflow() const
static int layer(const Identifier &id)
Values of different levels (failure returns 0)
static int wire(const Identifier &id)
void handle(const Incident &)
MdcDigiVec & getMdcDigiVec(uint32_t control=0)
StatusCode initialize(ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
ISvcLocator * m_svcLocator
StatusCode initialize(ISvcLocator *svcLoc=0, IMessageSvc *pMsg=0)
static double MdcTime(int timeChannel)
virtual Identifier identify() const
unsigned int getChargeChannel() const
unsigned int getTimeChannel() const