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

#include <RawEventReader.h>

+ Inheritance diagram for RawEventReader:

Public Member Functions

 RawEventReader (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~RawEventReader ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
StatusCode readEvent ()
 

Detailed Description

Definition at line 15 of file RawEventReader.h.

Constructor & Destructor Documentation

◆ RawEventReader()

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

Definition at line 32 of file RawEventReader.cxx.

32 :
33 Algorithm(name, pSvcLocator)
34{
35 m_mdcCnv = MdcConverter::instance();
36 m_tofCnv = TofConverter::instance();
37 m_emcCnv = EmcConverter::instance();
38 m_mucCnv = MucConverter::instance();
39
40 declareProperty("MdcDigi",m_mdcdigi=1);
41 declareProperty("TofDigi",m_tofdigi=1);
42 declareProperty("EmcDigi",m_emcdigi=1);
43 declareProperty("MucDigi",m_mucdigi=1);
44 declareProperty("InputFiles",m_inputFiles);
45 declareProperty("RawDataReviseConfFile", m_rawReviseConfig);
46}
static EmcConverter * instance(int runMode=2)
static MdcConverter * instance(int runMode=2)
static MucConverter * instance()
static TofConverter * instance()

◆ ~RawEventReader()

RawEventReader::~RawEventReader ( )
virtual

Definition at line 48 of file RawEventReader.cxx.

49{
54}
static void destroy()
static void destroy()
static void destroy()
static void destroy()

Member Function Documentation

◆ execute()

StatusCode RawEventReader::execute ( )

Definition at line 76 of file RawEventReader.cxx.

76 {
77
78 MsgStream log(msgSvc(), name());
79 log << MSG::INFO << "in execute()" << endreq;
80
81 DigiEvent* aDigiEvent = new DigiEvent;
82 StatusCode sc = m_evtSvc->registerObject("/Event/Digi",aDigiEvent);
83 if(sc!=StatusCode::SUCCESS) {
84 std::cout<< "Could not register DigiEvent" <<std::endl;
85 }
86
87 readEvent();
88
89
90 if(m_mdcdigi)
91 {
92 const BufferHolder& mdcBuf = m_raw_event->getMdcBuf();
93
94 MdcDigiCol* mdcDigiCol = new MdcDigiCol;
95 m_mdcCnv->convert(mdcBuf, mdcDigiCol);
96 /*MdcDigiCol::const_iterator mdcDigi = mdcDigiCol->begin();
97 for(; mdcDigi!=mdcDigiCol->end(); mdcDigi++ )
98 {
99 (*mdcDigi)->getTrackIndex();
100 std::cout<<"mdc digi: "<< " trackIndex: "<<(*mdcDigi)->getTrackIndex()<<std::endl;
101 }*/
102 //register MdcDigiCol to TDS...
103 StatusCode scMdc = m_evtSvc->registerObject("/Event/Digi/MdcDigiCol", mdcDigiCol);
104 if( scMdc!=StatusCode::SUCCESS ) {
105 std::cout<< "Could not register MDC digi collection" <<std::endl;
106 }
107 }
108
109
110 if(m_tofdigi)
111 {
112 const BufferHolder& tofBuf = m_raw_event->getTofBuf();
113 const BufferHolder& etfBuf = m_raw_event->getEtfBuf();
114
115 TofDigiCol* tofDigiCol = new TofDigiCol;
116 // m_tofCnv->convert(tofBuf, tofDigiCol);
117 m_tofCnv->convert(tofBuf, etfBuf, tofDigiCol);
118
119 /*TofDigiCol::const_iterator tofDigi = tofDigiCol->begin();
120 for(; tofDigi!=tofDigiCol->end(); tofDigi++ )
121 {
122 (*tofDigi)->getTrackIndex();
123 const Identifier ident = (*tofDigi)->identify();
124 std::cout<<"print tof digi in RawEventReader"<<std::endl;
125 std::cout<<"partId: "<<TofID::barrel_ec(ident);
126 std::cout<<" layer: "<<TofID::layer(ident);
127 std::cout<<" scinNb: "<<TofID::phi_module(ident);
128 std::cout<<" end: "<<TofID::end(ident);
129 std::cout<<" charge: "<<(*tofDigi)->getChargeChannel();
130 std::cout<<" time: "<<(*tofDigi)->getTimeChannel()<<std::endl;
131 }*/
132
133 //register TofDigiCol to TDS...
134 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", tofDigiCol);
135 if( scTof!=StatusCode::SUCCESS ) {
136 std::cout<< "Could not register TOF digi collection" <<std::endl;
137 }
138 }
139
140 if(m_emcdigi)
141 {
142 const BufferHolder& emcBuf = m_raw_event->getEmcBuf();
143
144 EmcDigiCol* emcDigiCol = new EmcDigiCol;
145 m_emcCnv->convert(emcBuf, emcDigiCol);
146 //register EmcDigiCol to TDS...
147 StatusCode scEmc = m_evtSvc->registerObject("/Event/Digi/EmcDigiCol", emcDigiCol);
148 if( scEmc!=StatusCode::SUCCESS ) {
149 std::cout<< "Could not register EMC digi collection" <<std::endl;
150 }
151 }
152
153 if(m_mucdigi)
154 {
155 const BufferHolder& mucBuf = m_raw_event->getMucBuf();
156
157 MucDigiCol* mucDigiCol = new MucDigiCol;
158 m_mucCnv->convert(mucBuf, mucDigiCol);
159 //register MucDigiCol to TDS...
160 StatusCode scMuc = m_evtSvc->registerObject("/Event/Digi/MucDigiCol", mucDigiCol);
161 if( scMuc!=StatusCode::SUCCESS ) {
162 std::cout<< "Could not register MUC digi collection" <<std::endl;
163 }
164 }
165 // clear the Memory Buffer, so that m_raw_event can be used directly during next event loop
166 m_raw_event->reset();
167
168 return StatusCode::SUCCESS;
169}
ObjectVector< EmcDigi > EmcDigiCol
Definition EmcDigi.h:43
ObjectVector< MdcDigi > MdcDigiCol
Definition MdcDigi.h:39
ObjectVector< MucDigi > MucDigiCol
Definition MucDigi.h:29
IMessageSvc * msgSvc()
ObjectVector< TofDigi > TofDigiCol
Definition TofDigi.h:41
StatusCode convert(const BufferHolder &src, EmcDigiCol *des)
StatusCode convert(const BufferHolder &src, MdcDigiCol *des)
StatusCode convert(const BufferHolder &src, MucDigiCol *des)
const BufferHolder & getEtfBuf() const
Definition RAWEVENT.h:102
const BufferHolder & getEmcBuf() const
Definition RAWEVENT.h:97
const BufferHolder & getMdcBuf() const
Definition RAWEVENT.h:95
const BufferHolder & getMucBuf() const
Definition RAWEVENT.h:98
const BufferHolder & getTofBuf() const
Definition RAWEVENT.h:96
void reset()
Definition RAWEVENT.cxx:6
StatusCode readEvent()
StatusCode convert(const BufferHolder &src, TofDigiCol *des, LumiDigiCol *des2=0)

◆ finalize()

StatusCode RawEventReader::finalize ( )

Definition at line 218 of file RawEventReader.cxx.

218 {
219
220 MsgStream log(msgSvc(), name());
221 log << MSG::INFO << "in finalize()" << endreq;
222
223 //TODO: release ...
224 delete m_raw_event;
225 //delete fileReader;
226
227 return StatusCode::SUCCESS;
228}

◆ initialize()

StatusCode RawEventReader::initialize ( )

Definition at line 57 of file RawEventReader.cxx.

57 {
58
59 MsgStream log(msgSvc(), name());
60 log << MSG::INFO << "in initialize()" << endreq;
61
62 m_raw_event = new RAWEVENT;
63
64 std::ifstream conff(m_rawReviseConfig.c_str());
65 m_mdcCnv->init(SniperJSON::load(conff)["MDCID_FIX"]);
66
67 ISvcLocator* svcLocator = Gaudi::svcLocator();
68 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
69 if (sc.isFailure())
70 std::cout<<"Could not accesss EventDataSvc!"<<std::endl;
71
72 return StatusCode::SUCCESS;
73}
void init(const SniperJSON &config)
static SniperJSON load(std::istream &is)

◆ readEvent()

StatusCode RawEventReader::readEvent ( )

Definition at line 171 of file RawEventReader.cxx.

172{
173 static RawFileReader* fileReader = new RawFileReader(m_inputFiles);
174 const uint32_t* fragment;
175
176 try {
177 fragment = fileReader->nextEvent();
178 }
179 catch (RawFileException& ex) {
180 ex.print();
181 }
182 catch (...) {
183 std::cerr << std::endl << "Uncaught unknown exception" << std::endl;
184 }
185
186 RawEvent f(fragment);
187 uint32_t *robs[64];
188 int nrobs = eformat::get_robs(fragment, (const uint32_t **)robs, 64);
189 for (int robi = 0; robi < nrobs; robi++) {
190 eformat::ROBFragment<uint32_t*> rob(robs[robi]);
191 if ((rob.rod_detev_type() & 0x2) != 0) continue; //bad data caogf add
192 uint32_t* dataptr = NULL;
193 rob.rod_data(dataptr);
194 uint32_t source_id_number = rob.rod_source_id();
195 source_id_number <<= 8;
196 source_id_number >>= 24;
197 switch(source_id_number) {
198 case 161:
199 m_raw_event->addReMdcDigi(dataptr, rob.rod_ndata());
200 break;
201 case 163:
202 m_raw_event->addReEmcDigi(dataptr, rob.rod_ndata());
203 break;
204 case 162:
205 m_raw_event->addReTofDigi(dataptr, rob.rod_ndata());
206 break;
207 case 164:
208 m_raw_event->addReMucDigi(dataptr, rob.rod_ndata());
209 break;
210 case 167:
211 m_raw_event->addReEtfDigi(dataptr, rob.rod_ndata());
212 break;
213 }
214 }
215 return StatusCode::SUCCESS;
216}
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
#define NULL
void addReTofDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:59
void addReMdcDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:53
void addReMucDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:62
void addReEtfDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:74
void addReEmcDigi(uint32_t *digi, uint32_t size)
Definition RAWEVENT.h:56
virtual void print() const
const uint32_t * nextEvent()
size_t get_robs(const uint32_t *fragment, const uint32_t **rob, size_t max_count)
Definition util.cxx:107

Referenced by execute().


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