BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
RawDataInputSvc Class Reference

#include <RawDataInputSvc.h>

+ Inheritance diagram for RawDataInputSvc:

Public Member Functions

 RawDataInputSvc (const std::string &name, ISvcLocator *svcloc)
 
virtual ~RawDataInputSvc ()
 
virtual StatusCode initialize ()
 
virtual StatusCode finalize ()
 
virtual RAWEVENTnextEvent ()
 
virtual RAWEVENTcurrentEvent ()
 
virtual bool setCurrentEvent (RAWEVENT *m_onlinere)
 
std::string currentFile () const
 
int runMode ()
 
uint32_t runNo ()
 
const SniperJSONconfig (const std::string &key)
 
OfflineReviseofflineRevisor ()
 

Detailed Description

Definition at line 24 of file RawDataInputSvc.h.

Constructor & Destructor Documentation

◆ RawDataInputSvc()

RawDataInputSvc::RawDataInputSvc ( const std::string & name,
ISvcLocator * svcloc )

Definition at line 26 of file RawDataInputSvc.cxx.

27 :base_class(name,svcloc),
28 m_re(0),
29 m_reader(0),
30 m_sds(0),
31 m_robs(0)
32{
33 // Get a pointer to the Job Options Service
34 IJobOptionsSvc* jobSvc;
35 Gaudi::svcLocator()->service("JobOptionsSvc", jobSvc);
36
37 PropertyMgr m_propMgr;
38 // 0-NormalNetMode, 1-OnlineMode, 2-OfflineMode, 3-DistBossMode
39 m_propMgr.declareProperty("RunMode", m_mode = 2);
40 m_propMgr.declareProperty("KeepRandomTrigEvt", m_keepRdm = true);
41 m_propMgr.declareProperty("InputFiles", m_inputFiles);
42 m_propMgr.declareProperty("Config4Revise", m_conf4Revise);
43
44 jobSvc->setMyProperties("RawDataInputSvc", &m_propMgr);
45}

◆ ~RawDataInputSvc()

RawDataInputSvc::~RawDataInputSvc ( )
virtual

Definition at line 48 of file RawDataInputSvc.cxx.

49{
50 //MsgStream log(messageService(), name() );
51 //log << MSG::DEBUG << "RawDataInputSvc Destructor called " << endreq;
52}

Member Function Documentation

◆ config()

const SniperJSON & RawDataInputSvc::config ( const std::string & key)
inline

Definition at line 50 of file RawDataInputSvc.h.

50{ return m_json[key]; }
*************DOUBLE PRECISION m_pi *DOUBLE PRECISION m_HvecTau2 DOUBLE PRECISION m_HvClone2 DOUBLE PRECISION m_gamma1 DOUBLE PRECISION m_gamma2 DOUBLE PRECISION m_thet1 DOUBLE PRECISION m_thet2 INTEGER m_IFPHOT *COMMON c_Taupair $ !Spin Polarimeter vector first Tau $ !Spin Polarimeter vector second Tau $ !Clone Spin Polarimeter vector first Tau $ !Clone Spin Polarimeter vector second Tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning st tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !Random Euler angle for cloning nd tau $ !phi of HvecTau1 $ !theta of HvecTau1 $ !phi of HvecTau2 $ !theta of HvecTau2 $ !super key
Definition Taupair.h:42

Referenced by RawDataMdcDigiCnv::initialize().

◆ currentEvent()

RAWEVENT * RawDataInputSvc::currentEvent ( )
virtual

Get a pointer to the current event.

Definition at line 287 of file RawDataInputSvc.cxx.

288{
289 // Return a pointer to the raw event.
290 //std::cout << "RawDataCnv -> Return a pointer to the raw event." << std::endl;
291 //std::cout << "It is the first time to call the currentEvent()" << std::endl;
292 return m_re;
293}

Referenced by RawDataMdcDigiCnv::createObj().

◆ currentFile()

std::string RawDataInputSvc::currentFile ( ) const
inline

Definition at line 43 of file RawDataInputSvc.h.

43{ return m_reader->currentFile(); }
virtual std::string currentFile()=0

◆ finalize()

StatusCode RawDataInputSvc::finalize ( )
virtual

Definition at line 101 of file RawDataInputSvc.cxx.

101 {
102 // clean up
103 if ( m_re ) {
104 delete m_re;
105 m_re = 0;
106 }
107
108 if ( m_reader ) {
109 delete m_reader;
110 m_reader = 0;
111 }
112
113 delete m_revisor;
114
115 if ( m_sds ) delete m_sds;
116 if ( m_robs ) delete m_robs;
117
118 return StatusCode::SUCCESS;
119}

◆ initialize()

StatusCode RawDataInputSvc::initialize ( )
virtual

Definition at line 55 of file RawDataInputSvc.cxx.

56{
57 //MsgStream log(messageService(), name() );
58 //log << MSG::DEBUG << " in RawDataInputSvc::initialize()" << endreq;
59
60 //StatusCode sc= IRawDataInputSvc::initialize();
61 //if(!sc.isSuccess()) {
62 // log << MSG::ERROR << "failed to initialize IRawDataInputSvc" << endreq;
63 // return sc;
64 //}
65
66#ifndef OnlineMode
67 if ( m_mode > 1 ) {
68 try {
69 if ( m_mode == 2 ) { //OfflineMode
70 if ( m_inputFiles.empty() ) return StatusCode::SUCCESS;
71 m_reader = new RawFileReader(m_inputFiles);
72 }
73 else if ( m_mode == 3 ) { //DistBossMode
74 DistBoss::GetPropertyValue<std::string>("DistBoss", "ServerName", m_evtServer);
75 m_reader = new NetDataReader(m_evtServer+"/RawEvtSvc");
76 }
77 else {
78 throw RawExMessage("RawDataInputSvc: Invalid RunMode!");
79 }
80 }
81 catch (RawFileException& ex) {
82 ex.print();
83 return StatusCode::FAILURE;
84 }
85
86 m_re = new RAWEVENT;
87
88 m_sds = new const uint32_t*[64];
89 m_robs = new const uint32_t*[256];
90 }
91#endif
92
93 std::ifstream cf(m_conf4Revise.c_str());
94 m_json = SniperJSON::load(cf);
95
96 m_revisor = new OfflineRevise(m_json["ETS_FIX"]);
97
98 return StatusCode::SUCCESS;
99}
PthrReaderBufPool< DimRpcReader, 4 > NetDataReader
virtual void print() const
static SniperJSON load(std::istream &is)
StatusCode GetPropertyValue(const std::string &client, const std::string &name, T &value)

◆ nextEvent()

RAWEVENT * RawDataInputSvc::nextEvent ( )
virtual

Definition at line 122 of file RawDataInputSvc.cxx.

122 {
123
124 //MsgStream log(messageService(), name() );
125#ifndef OnlineMode
126 //OfflineMode and DistBossMode
127 m_re->reset();
128
129 try {
130 RawEvent f;
131 const uint32_t* ef = 0;
132 do {
133 f.assign( m_reader->nextEvent());
134 if (!f.check()) {
135 std::cerr << "Found invalid event (traceback):" << std::endl;
136 std::exit(1);
137 }
138 //1.print basic event information
139 // log << MSG::DEBUG<< "run" << f.run_no() << " [Event No. #" << f.global_id()
140 // << "] " << f.fragment_size_word() << " words in "
141 // << f.nchildren() << " subdetectors "
142 // << endreq;
143
144 //fucd: get event filter information
145 f.event_filter_info(ef);
146 if ( !ef ) {
147 //log << MSG::ERROR << "Event Filter Data Failed!!!" << endreq;
148 exit(1);
149 }
150 else {
151 //log << MSG::DEBUG<< "Event Filter Information*********" <<std::hex<<endreq
152 // <<*ef<< " "<<*(ef+1)<<" "<<*(ef+2)<<" "<<*(ef+3)<<std::dec<<endreq;
153 if ( ! m_keepRdm && ((*ef)>>31) != 0 ) {
154 continue;
155 }
156 }
157 break;
158 } while (true);
159
160 m_re->setRunNo(f.run_no());
161 m_re->setEventNo(f.global_id());
162 m_re->setTime(f.time());
163 m_re->addReHltRaw((uint32_t*)ef, 4);
164
165 //set HV status and get all robs
166 uint32_t hv_status = 0;
167 int nrobs = 0;
168 int nsds = f.children(m_sds, 64);
169 for ( int sdi = 0; sdi < nsds; ++sdi ) {
171
172 if ( sd.nspecific() != 0 ) {
173 const uint32_t* specific_header;
174 sd.specific_header(specific_header);
175 uint32_t source_id_number = sd.source_id();
176 source_id_number <<= 8;
177 source_id_number >>= 24;
178 switch( source_id_number ) {
179 case 161:
180 hv_status |= ((8 | ((*specific_header)&0x7)) << 8);
181 break;
182 case 162:
183 hv_status |= ((8 | ((*specific_header)&0x7)) << 4);
184 break;
185 case 164:
186 hv_status |= (8 | ((*specific_header)&0x7));
187 break;
188 default:
189 break;
190 }
191 }
192
193 nrobs += eformat::get_robs(m_sds[sdi], m_robs+nrobs, 256-nrobs);
194 }
195
196 m_re->setFlag1( hv_status );
197
198 //log << MSG::INFO << " nrobs: " << nrobs << endreq;
199 for (int robi = 0; robi < nrobs; robi++) {
200 eformat::ROBFragment<uint32_t*> rob((uint32_t*)m_robs[robi]);
201 //uint32_t detev_type = rob.rod_detev_type();
202 uint32_t* dataptr = NULL;
203 rob.rod_data(dataptr);
204
205 //log << MSG::DEBUG<< "addReHltRaw" << endreq;
206 uint32_t source_id_number = rob.rod_source_id();
207 //std::cout<<"#####source_id_number#####"<<source_id_number<<std::endl;
208 source_id_number <<= 8;
209 source_id_number >>= 24;
210 //std::cout<<"#####(source_id_number<<24)>>29#####"<<source_id_number<<std::endl;
211
212 if ((rob.rod_detev_type() & 0x2) != 0) {
213 if ( source_id_number == 165 ) {
214 m_re->addReEtsDigi(dataptr, rob.rod_ndata()); // ETS
215 }
216 continue; //bad data or ETS
217 }
218
219 //be careful here!!!
220 switch(source_id_number) {
221 case 161:
222 m_re->addReMdcDigi(dataptr, rob.rod_ndata());
223 break;
224 case 163:
225 m_re->addReEmcDigi(dataptr, rob.rod_ndata());
226 break;
227 case 162:
228 m_re->addReTofDigi(dataptr, rob.rod_ndata());
229 break;
230 case 167: //ETF(MRPC)
231 m_re->addReEtfDigi(dataptr, rob.rod_ndata());
232 break;
233 case 164:
234 m_re->addReMucDigi(dataptr, rob.rod_ndata());
235 break;
236 case 165: // trigger !!!
237 //std::cout << "Get Trigger Data -" << std::endl;
238 //for (int i = 0; i < rob.rod_ndata(); i++) {
239 // std::cout << "\t0x" << std::hex << dataptr[i] << std::dec << std::endl;
240 //}
241 m_re->addReTrigGTD(dataptr, rob.rod_ndata());
242 break;
243 case 166:
244 m_re->addReZddDigi(dataptr, rob.rod_ndata());
245 break;
246 case 124: // EventFilter
247 m_re->addReHltRaw(dataptr, rob.rod_ndata());
248 break;
249 case 241: // McParticle
250 m_re->addMcParticle(dataptr, rob.rod_ndata());
251 break;
252 default:
253 //log << MSG::ERROR << "no such subdetector type: " << source_id_number << endreq;
254 break;
255 }
256 }
257 }
258 catch (RawFileException& ex) {
259 ex.print();
260 if ( m_reader->stat()&4 ) { // fstream badbit is set
261 std::cerr << std::endl << "reading ifstream error !!!" << std::endl;
262 exit(1);
263 }
264 delete m_re;
265 m_re = NULL;
266 }
267 catch (eformat::Issue& ex) {
268 std::cerr << std::endl << "Uncaught eformat issue: " << ex.what() << std::endl;
269 }
270 catch (ers::Issue& ex) {
271 std::cerr << std::endl << "Uncaught ERS issue: " << ex.what() << std::endl;
272 }
273 catch (std::exception& ex) {
274 std::cerr << std::endl << "Uncaught std exception: " << ex.what() << std::endl;
275 }
276 catch (...) {
277 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
278 }
279#endif
280
281 return m_re;
282}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
#define NULL
virtual const uint32_t * nextEvent()=0
virtual uint32_t stat()=0
void addReTofDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:59
void setFlag1(uint32_t flag1)
Definition RAWEVENT.h:49
void setRunNo(uint32_t run_no)
Definition RAWEVENT.h:46
void addReEtsDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:77
void addReMdcDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:53
void addReTrigGTD(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:65
void addReMucDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:62
void addReZddDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:68
void addMcParticle(uint32_t *buf, uint32_t size)
Definition RAWEVENT.h:82
void setTime(uint32_t time)
Definition RAWEVENT.h:48
void setEventNo(uint32_t event_no)
Definition RAWEVENT.h:47
void addReEtfDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:74
void addReEmcDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:56
void addReHltRaw(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:71
void reset()
Definition RAWEVENT.cxx:6
Root Issue class.
const char * what() const
Human description message.
size_t get_robs(const uint32_t *fragment, const uint32_t **rob, size_t max_count)
Definition util.cxx:107

◆ offlineRevisor()

OfflineRevise * RawDataInputSvc::offlineRevisor ( )
inline

Definition at line 52 of file RawDataInputSvc.h.

52{ return m_revisor; }

◆ runMode()

int RawDataInputSvc::runMode ( )
inline

Definition at line 46 of file RawDataInputSvc.h.

46{ return m_mode; }

Referenced by RawDataMdcDigiCnv::initialize().

◆ runNo()

uint32_t RawDataInputSvc::runNo ( )
inline

Definition at line 48 of file RawDataInputSvc.h.

48{ return m_reader->runNo(); }
virtual uint32_t runNo()=0

Referenced by DetVerSvcPack::funcInputRaw().

◆ setCurrentEvent()

bool RawDataInputSvc::setCurrentEvent ( RAWEVENT * m_onlinere)
virtual

Definition at line 295 of file RawDataInputSvc.cxx.

296{
297 //std::cout << "setCurrentEvent(RAWEVENT* m_onlinere)" << std::endl;
298 return (m_re = m_onlinere);
299}

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