BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcMakeHits Class Reference

#include <MdcMakeHits.h>

+ Inheritance diagram for MdcMakeHits:

Public Member Functions

 MdcMakeHits (const std::string &name, ISvcLocator *pSvcLocator)
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
StatusCode beginRun ()
 

Detailed Description

Definition at line 11 of file MdcMakeHits.h.

Constructor & Destructor Documentation

◆ MdcMakeHits()

MdcMakeHits::MdcMakeHits ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 36 of file MdcMakeHits.cxx.

36 :
37 Algorithm(name, pSvcLocator)
38{
39 // Declare the properties
40 declareProperty("cosmicFit", m_cosmicFit= false);
41 declareProperty("doSag", m_doSag= false);
42 declareProperty("countPropTime",m_countPropTime = true);
43
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);//yzhang 2010-05-28
51
52#ifdef MDCPATREC_RESLAYER
53 declareProperty("resLayer", m_resLayer= -1);
54#endif
55}

Member Function Documentation

◆ beginRun()

StatusCode MdcMakeHits::beginRun ( )

Definition at line 58 of file MdcMakeHits.cxx.

58 {
59 _gm = MdcDetector::instance(m_doSag);
60 if(NULL == _gm) return StatusCode::FAILURE;
61 return StatusCode::SUCCESS;
62}
#define NULL
static MdcDetector * instance()
Definition: MdcDetector.cxx:21

◆ execute()

StatusCode MdcMakeHits::execute ( )

Definition at line 90 of file MdcMakeHits.cxx.

90 {
91 MsgStream log(msgSvc(), name());
92 log << MSG::INFO << "in execute()" << endreq;
93 StatusCode sc;
94
95 DataObject *pnode = 0;
96 sc = eventSvc()->retrieveObject("/Event/Hit",pnode);
97 if(!sc.isSuccess()) {
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;
103 }
104 }
105
106 SmartIF<IDataManagerSvc> dataManSvc(eventSvc());
107 DataObject *hitCol;
108 eventSvc()->findObject("/Event/Hit/MdcHitCol",hitCol);
109 if(hitCol!= NULL) {
110 dataManSvc->clearSubTree("/Event/Hit/MdcHitCol");
111 eventSvc()->unregisterObject("/Event/Hit/MdcHitCol");
112 }
113 MdcHitCol *mdcHitCol = new 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;
118 }
119
120 DataObject *hitMap;
121 eventSvc()->findObject("/Event/Hit/MdcHitMap",hitMap);
122 if(hitMap!= NULL) {
123 dataManSvc->clearSubTree("/Event/Hit/MdcHitMap");
124 eventSvc()->unregisterObject("/Event/Hit/MdcHitMap");
125 }
126 MdcHitMap *mdcHitMap = new MdcHitMap(*_gm);
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;
131 }
132
133 // retrieve Mdc digi vector form RawDataProviderSvc
134 uint32_t getDigiFlag = 0;
135 getDigiFlag += m_maxMdcDigi;
136 if(m_dropHot || m_combineTracking)getDigiFlag |= MdcRawDataProvider::b_dropHot;
137 if(m_keepBadTdc) getDigiFlag |= MdcRawDataProvider::b_keepBadTdc;
138 if(m_keepUnmatch) getDigiFlag |= MdcRawDataProvider::b_keepUnmatch;
139 MdcDigiVec mdcDigiVec = m_rawDataProviderSvc->getMdcDigiVec(getDigiFlag);
140
141 //std::cout<<__FILE__<<" nDigi = "<<mdcDigiVec.size()<< std::endl;
142 if ((int)mdcDigiVec.size()<m_minMdcDigi){
143 log << MSG::WARNING << " Skip this event for MdcDigiVec.size() < "<<m_minMdcDigi << endreq;
144 return StatusCode::SUCCESS;
145 }
146
147 MdcDigiVec::iterator iter = mdcDigiVec.begin();
148 for (;iter != mdcDigiVec.end(); iter++ ) {
149 const MdcDigi* aDigi = *iter;
150 MdcHit *hit = new MdcHit(aDigi, _gm);
151 hit->setCalibSvc(m_mdcCalibFunSvc);
152 hit->setCosmicFit(m_cosmicFit);
153 hit->setCountPropTime(m_countPropTime);
154#ifdef MDCPATREC_RESLAYER
155 hit->setResLayer(m_resLayer);
156#endif
157 mdcHitCol->push_back(hit);
158 mdcHitMap->addHit(*hit);
159 }
160 return StatusCode::SUCCESS;
161}
ObjectVector< MdcHit > MdcHitCol
Definition: MdcHit.h:129
std::vector< MdcDigi * > MdcDigiVec
IMessageSvc * msgSvc()
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
void addHit(MdcHit &theHit)
Definition: MdcHitMap.h:35
Definition: MdcHit.h:44
void setCalibSvc(const MdcCalibFunSvc *calibSvc)
Definition: MdcHit.cxx:136
void setCosmicFit(const bool cosmicfit)
Definition: MdcHit.h:87
void setCountPropTime(const bool count)
Definition: MdcHit.h:86
MdcDigiVec & getMdcDigiVec(uint32_t control=0)

◆ finalize()

StatusCode MdcMakeHits::finalize ( )

Definition at line 164 of file MdcMakeHits.cxx.

164 {
165
166 MsgStream log(msgSvc(), name());
167 log << MSG::INFO << "in finalize()" << endreq;
168
169 return StatusCode::SUCCESS;
170}

◆ initialize()

StatusCode MdcMakeHits::initialize ( )

Definition at line 64 of file MdcMakeHits.cxx.

64 {
65
66 MsgStream log(msgSvc(), name());
67 log << MSG::INFO << "in initialize()" << endreq;
68
69 StatusCode sc;
70
71 IMdcCalibFunSvc* imdcCalibSvc;
72 sc = service ("MdcCalibFunSvc",imdcCalibSvc);
73 m_mdcCalibFunSvc = dynamic_cast<MdcCalibFunSvc*> (imdcCalibSvc);
74 if ( sc.isFailure() ){
75 log << MSG::FATAL << "Could not load MdcCalibFunSvc!" << endreq;
76 }
77
78 IRawDataProviderSvc* irawDataProviderSvc;
79 sc = service ("RawDataProviderSvc", irawDataProviderSvc);
80 m_rawDataProviderSvc = dynamic_cast<RawDataProviderSvc*> (irawDataProviderSvc);
81 if ( sc.isFailure() ){
82 log << MSG::FATAL << "Could not load RawDataProviderSvc!" << endreq;
83 return StatusCode::FAILURE;
84 }
85
86 return StatusCode::SUCCESS;
87}

The documentation for this class was generated from the following files: