BOSS 7.0.4
BESIII Offline Software System
Loading...
Searching...
No Matches
EFDetectorHits.cxx
Go to the documentation of this file.
1#include "GaudiKernel/MsgStream.h"
2//#include "GaudiKernel/AlgFactory.h"
3#include "GaudiKernel/SmartDataPtr.h"
4//#include "GaudiKernel/PropertyMgr.h"
5//#include "GaudiKernel/Bootstrap.h"
6//#include "GaudiKernel/IJobOptionsSvc.h"
7//#include "GaudiKernel/ISvcLocator.h"
8#include "EventModel/Event.h"
9#include "EventModel/EventHeader.h"
10#include "Identifier/Identifier.h"
11#include "EmcRawEvent/EmcDigi.h"
12#include "Identifier/EmcID.h"
13#include "TofRawEvent/TofDigi.h"
14#include "Identifier/TofID.h"
15#include "MdcRawEvent/MdcDigi.h"
16#include "Identifier/MdcID.h"
17#include "MucRawEvent/MucDigi.h"
18#include "Identifier/MucID.h"
19#include "HltAlgorithms/EFDetectorHits.h"
20#include "CLHEP/Random/RandFlat.h"
21
22using namespace Event;
23
24EFDetectorHits::EFDetectorHits(const std::string& name, ISvcLocator* pSvcLocator) :
25 IEFAlgorithm(name, pSvcLocator) {
26
27 int output=m_output/100000;
28#if 1
29 //m_propMgr.declareProperty("OutputLevel", output);
30 //cout << "OutputLevel="<<output<<"; name="<<name<<endl;
31 // Get a pointer to the Job Options Service
32 //IJobOptionsSvc* jobSvc;
33 //Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
34 //jobSvc->setMyProperties("EFDetector", &m_propMgr);
35 //cout << "OutputLevel="<<output<<"; name="<<name<<endl;
36#endif
37 MsgStream log(msgSvc(), name);
38 msgSvc()->setOutputLevel(name,output);
39
40 m_nmdc = new CriteriaItemValue;
41 m_nmuc = new CriteriaItemValue;
42 m_ntof = new CriteriaItemValue;
43 m_nemc = new CriteriaItemValue;
44 m_derr = new CriteriaItemValue;
45 m_rndm = new CriteriaItemValue;
46}
47
49 delete m_nmdc;
50 delete m_nmuc;
51 delete m_ntof;
52 delete m_nemc;
53 delete m_derr;
54 delete m_rndm;
55}
56
58
59 MsgStream log(msgSvc(), name());
60 log << MSG::INFO << "in initialize()" << endreq;
61
63
64 StatusCode sc;
65 sc = m_HltStoreSvc->put("nmdc", m_nmdc);
66 if ( sc.isFailure() ) {
67 log << MSG::ERROR << "m_HltStoreSvc->put(nmdc) wrong" << endreq;
68 return sc;
69 }
70 sc = m_HltStoreSvc->put("nmuc", m_nmuc);
71 if ( sc.isFailure() ) {
72 log << MSG::ERROR << "m_HltStoreSvc->put(nmuc) wrong" << endreq;
73 return sc;
74 }
75 sc = m_HltStoreSvc->put("ntof", m_ntof);
76 if ( sc.isFailure() ) {
77 log << MSG::ERROR << "m_HltStoreSvc->put(ntof) wrong" << endreq;
78 return sc;
79 }
80 sc = m_HltStoreSvc->put("nemc", m_nemc);
81 if ( sc.isFailure() ) {
82 log << MSG::ERROR << "m_HltStoreSvc->put(nemc) wrong" << endreq;
83 return sc;
84 }
85 sc = m_HltStoreSvc->put("derr", m_derr);
86 if(sc.isFailure()) {
87 log << MSG::ERROR << "m_HltStoreSvc->put(derr) wrong" << endreq;
88 return sc;
89 }
90 sc = m_HltStoreSvc->put("rndm", m_rndm);
91 if(sc.isFailure()) {
92 log << MSG::ERROR << "m_HltStoreSvc->put(rndm) wrong" << endreq;
93 return sc;
94 }
95
96 return StatusCode::SUCCESS;
97}
98
100
101 //reset();
102
103 MsgStream log(msgSvc(), name());
104
105 // Part 1: Get the event header, print out event number
106 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
107 if (!eventHeader) {
108 log << MSG::FATAL << "Could not find Event Header" << endreq;
109 return( StatusCode::FAILURE);
110 }
111 log << MSG::INFO << "eventNo-->" << eventHeader->eventNumber()<<endreq;
112
113 //Part 2: Retrieve Hits Collection
114 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),"/Event/Digi/MdcDigiCol");
115 if (!mdcDigiCol) {
116 log << MSG::FATAL << "Could not find Mdc digi!!" << endreq;
117 return( StatusCode::FAILURE);
118 }
119
120 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),"/Event/Digi/TofDigiCol");
121 if (!tofDigiCol) {
122 log << MSG::FATAL << "Could not find Tof digi!!" << endreq;
123 return( StatusCode::FAILURE);
124 }
125 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),"/Event/Digi/EmcDigiCol");
126 if (!emcDigiCol) {
127 log << MSG::FATAL << "Could not find Emc digi!!" << endreq;
128 return( StatusCode::FAILURE);
129 }
130 if(m_rawDigiSvc){
133 }
134 }
135
136 SmartDataPtr<MucDigiCol> mucDigiCol(eventSvc(),"/Event/Digi/MucDigiCol");
137 if (!mucDigiCol) {
138 log << MSG::FATAL << "Could not find Muc digi!!" << endreq;
139 return( StatusCode::FAILURE);
140 }
141
142 //Part 3: Get information of hits
143 unsigned int nhitsMdc=mdcDigiCol->size();
144 if(m_rawDigiSvc){
146 nhitsMdc=m_rawDigiSvc->getMdcDigiVec(0x38000).size();
147 }
148 }
149 unsigned int nhitsEmc=emcDigiCol->size();
150 unsigned int nhitsMuc=mucDigiCol->size();
151 unsigned int nhitsTof=tofDigiCol->size();
152
153 double rndm=CLHEP::RandFlat::shoot();
154
155 log << MSG::INFO << " Number of hits in MDC:EMC:MUC:TOF is " << nhitsMdc
156 << ":" << nhitsEmc << ":" << nhitsMuc << ":" <<nhitsTof <<"; "
157 << "random number:" << rndm <<endreq;
158
159 //Part 4: Put the criteria item(s) to HltStoreSvc here
160 m_nmdc->setValue(nhitsMdc);
161 m_nmuc->setValue(nhitsMuc);
162 m_ntof->setValue(nhitsTof);
163 m_nemc->setValue(nhitsEmc);
164
165 m_rndm->setValue(rndm);
166
167 m_ef->addToEFVec(nhitsMdc, 5);
168 m_ef->addToEFVec(nhitsTof, 25);
169 m_ef->addToEFVec(nhitsEmc, 30);
170 m_ef->addToEFVec(nhitsMuc, 52);
171
172 m_ef->addToEFVec(0xFFFFFFF7,37); //nsec init
173
174 m_ef->setVecBit(true, 0, 0);
175 m_ef->addToEFVec(1, 1);
176 m_ef->addToEFVec(1<<8, 1);
177 m_ef->addToEFVec(1<<16, 1);
178 m_ef->addToEFVec(1<<24, 1);
179
180 m_run=1;
181
182 return StatusCode::SUCCESS;
183}
184
186 MsgStream log(msgSvc(), name());
187 log << MSG::INFO << "in finalize()" << endmsg;
188 return StatusCode::SUCCESS;
189}
190
192
193 if(m_run){
194 m_nmdc->reset();
195 m_nmuc->reset();
196 m_ntof->reset();
197 m_nemc->reset();
198 m_derr->reset();
199 m_rndm->reset();
200 m_run=0;
201 }
202 return;
203}
*******INTEGER m_nBinMax INTEGER m_NdiMax !No of bins in histogram for cell exploration division $ !Last vertex $ !Last active cell $ !Last cell in buffer $ !No of sampling when dividing cell $ !No of function total $ !Flag for random ceel for $ !Flag for type of for WtMax $ !Flag which decides whether vertices are included in the sampling $ entire domain is hyp !Maximum effective eevents per saves r n generator level $ !Flag for chat level in output
Definition: FoamA.h:89
virtual ~EFDetectorHits()
virtual StatusCode execute()
virtual StatusCode initialize()
virtual void reset()
virtual StatusCode finalize()
EFDetectorHits(const std::string &name, ISvcLocator *pSvcLocator)
bool addToEFVec(uint32_t val, uint32_t pos)
Definition: EFResult.cxx:81
bool setVecBit(uint32_t val, uint32_t vecpos, uint32_t bbegin, uint32_t bend)
Definition: EFResult.cxx:94
virtual StatusCode initialize()
virtual EmcDigiCol & getEmcDigiVec(uint32_t control=0)=0
virtual bool isOnlineMode()=0
virtual MdcDigiVec & getMdcDigiVec(uint32_t control=0)=0