BOSS 8.0.0
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 "CLHEP/Random/RandFlat.h"
9#include "EmcRawEvent/EmcDigi.h"
10#include "EventModel/Event.h"
11#include "EventModel/EventHeader.h"
13#include "Identifier/EmcID.h"
14#include "Identifier/Identifier.h"
15#include "Identifier/MdcID.h"
16#include "Identifier/MucID.h"
17#include "Identifier/TofID.h"
18#include "MdcRawEvent/MdcDigi.h"
19#include "MucRawEvent/MucDigi.h"
20#include "TofRawEvent/TofDigi.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()" << endmsg;
61
63
64 StatusCode sc;
65 sc = m_HltStoreSvc->put( "nmdc", m_nmdc );
66 if ( sc.isFailure() )
67 {
68 log << MSG::ERROR << "m_HltStoreSvc->put(nmdc) wrong" << endmsg;
69 return sc;
70 }
71 sc = m_HltStoreSvc->put( "nmuc", m_nmuc );
72 if ( sc.isFailure() )
73 {
74 log << MSG::ERROR << "m_HltStoreSvc->put(nmuc) wrong" << endmsg;
75 return sc;
76 }
77 sc = m_HltStoreSvc->put( "ntof", m_ntof );
78 if ( sc.isFailure() )
79 {
80 log << MSG::ERROR << "m_HltStoreSvc->put(ntof) wrong" << endmsg;
81 return sc;
82 }
83 sc = m_HltStoreSvc->put( "nemc", m_nemc );
84 if ( sc.isFailure() )
85 {
86 log << MSG::ERROR << "m_HltStoreSvc->put(nemc) wrong" << endmsg;
87 return sc;
88 }
89 sc = m_HltStoreSvc->put( "derr", m_derr );
90 if ( sc.isFailure() )
91 {
92 log << MSG::ERROR << "m_HltStoreSvc->put(derr) wrong" << endmsg;
93 return sc;
94 }
95 sc = m_HltStoreSvc->put( "rndm", m_rndm );
96 if ( sc.isFailure() )
97 {
98 log << MSG::ERROR << "m_HltStoreSvc->put(rndm) wrong" << endmsg;
99 return sc;
100 }
101
102 return StatusCode::SUCCESS;
103}
104
106
107 // reset();
108
109 MsgStream log( msgSvc(), name() );
110
111 // Part 1: Get the event header, print out event number
112 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(), "/Event/EventHeader" );
113 if ( !eventHeader )
114 {
115 log << MSG::FATAL << "Could not find Event Header" << endmsg;
116 return ( StatusCode::FAILURE );
117 }
118 log << MSG::INFO << "eventNo-->" << eventHeader->eventNumber() << endmsg;
119
120 // Part 2: Retrieve Hits Collection
121 SmartDataPtr<MdcDigiCol> mdcDigiCol( eventSvc(), "/Event/Digi/MdcDigiCol" );
122 if ( !mdcDigiCol )
123 {
124 log << MSG::FATAL << "Could not find Mdc digi!!" << endmsg;
125 return ( StatusCode::FAILURE );
126 }
127
128 SmartDataPtr<TofDigiCol> tofDigiCol( eventSvc(), "/Event/Digi/TofDigiCol" );
129 if ( !tofDigiCol )
130 {
131 log << MSG::FATAL << "Could not find Tof digi!!" << endmsg;
132 return ( StatusCode::FAILURE );
133 }
134 SmartDataPtr<EmcDigiCol> emcDigiCol( eventSvc(), "/Event/Digi/EmcDigiCol" );
135 if ( !emcDigiCol )
136 {
137 log << MSG::FATAL << "Could not find Emc digi!!" << endmsg;
138 return ( StatusCode::FAILURE );
139 }
140 if ( m_rawDigiSvc )
141 {
142 if ( m_rawDigiSvc->isOnlineMode() )
143 {
144 emcDigiCol = &( m_rawDigiSvc->getEmcDigiVec(
147 }
148 }
149
150 SmartDataPtr<MucDigiCol> mucDigiCol( eventSvc(), "/Event/Digi/MucDigiCol" );
151 if ( !mucDigiCol )
152 {
153 log << MSG::FATAL << "Could not find Muc digi!!" << endmsg;
154 return ( StatusCode::FAILURE );
155 }
156
157 // Part 3: Get information of hits
158 unsigned int nhitsMdc = mdcDigiCol->size();
159 if ( m_rawDigiSvc )
160 {
161 if ( m_rawDigiSvc->isOnlineMode() )
162 { nhitsMdc = m_rawDigiSvc->getMdcDigiVec( 0x38000 ).size(); }
163 }
164 unsigned int nhitsEmc = emcDigiCol->size();
165 unsigned int nhitsMuc = mucDigiCol->size();
166 unsigned int nhitsTof = tofDigiCol->size();
167
168 double rndm = CLHEP::RandFlat::shoot();
169
170 log << MSG::INFO << " Number of hits in MDC:EMC:MUC:TOF is " << nhitsMdc << ":" << nhitsEmc
171 << ":" << nhitsMuc << ":" << nhitsTof << "; "
172 << "random number:" << rndm << endmsg;
173
174 // Part 4: Put the criteria item(s) to HltStoreSvc here
175 m_nmdc->setValue( nhitsMdc );
176 m_nmuc->setValue( nhitsMuc );
177 m_ntof->setValue( nhitsTof );
178 m_nemc->setValue( nhitsEmc );
179
180 m_rndm->setValue( rndm );
181
182 m_ef->addToEFVec( nhitsMdc, 5 );
183 m_ef->addToEFVec( nhitsTof, 25 );
184 m_ef->addToEFVec( nhitsEmc, 30 );
185 m_ef->addToEFVec( nhitsMuc, 52 );
186
187 m_ef->addToEFVec( 0xFFFFFFF7, 37 ); // nsec init
188
189 m_ef->setVecBit( true, 0, 0 );
190 m_ef->addToEFVec( 1, 1 );
191 m_ef->addToEFVec( 1 << 8, 1 );
192 m_ef->addToEFVec( 1 << 16, 1 );
193 m_ef->addToEFVec( 1 << 24, 1 );
194
195 m_run = 1;
196
197 return StatusCode::SUCCESS;
198}
199
201 MsgStream log( msgSvc(), name() );
202 log << MSG::INFO << "in finalize()" << endmsg;
203 return StatusCode::SUCCESS;
204}
205
207
208 if ( m_run )
209 {
210 m_nmdc->reset();
211 m_nmuc->reset();
212 m_ntof->reset();
213 m_nemc->reset();
214 m_derr->reset();
215 m_rndm->reset();
216 m_run = 0;
217 }
218 return;
219}
*******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
IMessageSvc * msgSvc()
virtual ~EFDetectorHits()
virtual StatusCode execute()
virtual StatusCode initialize()
virtual void reset()
virtual StatusCode finalize()
EFDetectorHits(const std::string &name, ISvcLocator *pSvcLocator)
EFResult * m_ef
IEFAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
virtual StatusCode initialize()
IRawDataProviderSvc * m_rawDigiSvc
HltStoreSvc * m_HltStoreSvc