1#include <CLHEP/Units/PhysicalConstants.h>
2#include <CLHEP/Geometry/Point3D.h>
6#include "GaudiKernel/MsgStream.h"
7#include "GaudiKernel/AlgFactory.h"
8#include "GaudiKernel/ISvcLocator.h"
9#include "GaudiKernel/SmartDataPtr.h"
10#include "GaudiKernel/IDataProviderSvc.h"
11#include "GaudiKernel/IDataManagerSvc.h"
12#include "GaudiKernel/PropertyMgr.h"
21#include "GaudiKernel/INTupleSvc.h"
37 Algorithm(name, pSvcLocator)
40 declareProperty(
"cosmicFit", m_cosmicFit=
false);
41 declareProperty(
"doSag", m_doSag=
false);
42 declareProperty(
"countPropTime",m_countPropTime =
true);
44 declareProperty(
"getDigiFlag", m_getDigiFlag = 0);
45 declareProperty(
"maxMdcDigi", m_maxMdcDigi= 0);
46 declareProperty(
"keepBadTdc", m_keepBadTdc= 0);
47 declareProperty(
"dropHot", m_dropHot= 0);
48 declareProperty(
"keepUnmatch", m_keepUnmatch= 0);
49 declareProperty(
"minMdcDigi", m_minMdcDigi = 0);
50 declareProperty(
"combineTracking",m_combineTracking =
false);
52#ifdef MDCPATREC_RESLAYER
53 declareProperty(
"resLayer", m_resLayer= -1);
60 if(NULL == _gm)
return StatusCode::FAILURE;
61 return StatusCode::SUCCESS;
66 MsgStream log(
msgSvc(), name());
67 log << MSG::INFO <<
"in initialize()" << endreq;
72 sc = service (
"MdcCalibFunSvc",imdcCalibSvc);
74 if ( sc.isFailure() ){
75 log << MSG::FATAL <<
"Could not load MdcCalibFunSvc!" << endreq;
79 sc = service (
"RawDataProviderSvc", irawDataProviderSvc);
81 if ( sc.isFailure() ){
82 log << MSG::FATAL <<
"Could not load RawDataProviderSvc!" << endreq;
83 return StatusCode::FAILURE;
86 return StatusCode::SUCCESS;
91 MsgStream log(
msgSvc(), name());
92 log << MSG::INFO <<
"in execute()" << endreq;
95 DataObject *pnode = 0;
96 sc = eventSvc()->retrieveObject(
"/Event/Hit",pnode);
98 pnode =
new DataObject;
99 sc = eventSvc()->registerObject(
"/Event/Hit",pnode);
100 if(!sc.isSuccess()) {
101 log << MSG::FATAL <<
" Could not register hit branch" <<endreq;
102 return StatusCode::FAILURE;
106 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
108 eventSvc()->findObject(
"/Event/Hit/MdcHitCol",hitCol);
110 dataManSvc->clearSubTree(
"/Event/Hit/MdcHitCol");
111 eventSvc()->unregisterObject(
"/Event/Hit/MdcHitCol");
114 sc = eventSvc()->registerObject(
"/Event/Hit/MdcHitCol",mdcHitCol);
115 if(!sc.isSuccess()) {
116 log << MSG::FATAL <<
" Could not register hit collection" <<endreq;
117 return StatusCode::FAILURE;
121 eventSvc()->findObject(
"/Event/Hit/MdcHitMap",hitMap);
123 dataManSvc->clearSubTree(
"/Event/Hit/MdcHitMap");
124 eventSvc()->unregisterObject(
"/Event/Hit/MdcHitMap");
127 sc = eventSvc()->registerObject(
"/Event/Hit/MdcHitMap",mdcHitMap);
128 if(!sc.isSuccess()) {
129 log << MSG::FATAL <<
" Could not register hit map" <<endreq;
130 return StatusCode::FAILURE;
134 uint32_t getDigiFlag = 0;
135 getDigiFlag += m_maxMdcDigi;
142 if ((
int)mdcDigiVec.size()<m_minMdcDigi){
143 log << MSG::WARNING <<
" Skip this event for MdcDigiVec.size() < "<<m_minMdcDigi << endreq;
144 return StatusCode::SUCCESS;
147 MdcDigiVec::iterator
iter = mdcDigiVec.begin();
148 for (;
iter != mdcDigiVec.end();
iter++ ) {
154#ifdef MDCPATREC_RESLAYER
155 hit->setResLayer(m_resLayer);
157 mdcHitCol->push_back(hit);
160 return StatusCode::SUCCESS;
166 MsgStream log(
msgSvc(), name());
167 log << MSG::INFO <<
"in finalize()" << endreq;
169 return StatusCode::SUCCESS;
ObjectVector< MdcHit > MdcHitCol
const CLID & CLID_MdcHitCol
std::vector< MdcDigi * > MdcDigiVec
static MdcDetector * instance()
void addHit(MdcHit &theHit)
void setCalibSvc(const MdcCalibFunSvc *calibSvc)
void setCosmicFit(const bool cosmicfit)
void setCountPropTime(const bool count)
MdcMakeHits(const std::string &name, ISvcLocator *pSvcLocator)
MdcDigiVec & getMdcDigiVec(uint32_t control=0)