BOSS 7.0.4
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 ()
 
 RawEventReader (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual ~RawEventReader ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
StatusCode readEvent ()
 

Detailed Description

Constructor & Destructor Documentation

◆ RawEventReader() [1/2]

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

Definition at line 31 of file RawEventReader.cxx.

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

◆ ~RawEventReader() [1/2]

RawEventReader::~RawEventReader ( )
virtual

Definition at line 47 of file RawEventReader.cxx.

48{
53}
static void destroy()
static void destroy()
static void destroy()
static void destroy()

◆ RawEventReader() [2/2]

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

◆ ~RawEventReader() [2/2]

virtual RawEventReader::~RawEventReader ( )
virtual

Member Function Documentation

◆ execute() [1/2]

StatusCode RawEventReader::execute ( )

Definition at line 74 of file RawEventReader.cxx.

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

◆ execute() [2/2]

StatusCode RawEventReader::execute ( )

◆ finalize() [1/2]

StatusCode RawEventReader::finalize ( )

Definition at line 216 of file RawEventReader.cxx.

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

◆ finalize() [2/2]

StatusCode RawEventReader::finalize ( )

◆ initialize() [1/2]

StatusCode RawEventReader::initialize ( )

Definition at line 56 of file RawEventReader.cxx.

56 {
57
58 MsgStream log(msgSvc(), name());
59 log << MSG::INFO << "in initialize()" << endreq;
60
61 m_raw_event = new RAWEVENT;
62
63 m_mdcCnv->init(0, 999999);
64
65 ISvcLocator* svcLocator = Gaudi::svcLocator();
66 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
67 if (sc.isFailure())
68 std::cout<<"Could not accesss EventDataSvc!"<<std::endl;
69
70 return StatusCode::SUCCESS;
71}
void init(int runFrom, int runTo)

◆ initialize() [2/2]

StatusCode RawEventReader::initialize ( )

◆ readEvent() [1/2]

StatusCode RawEventReader::readEvent ( )

Definition at line 169 of file RawEventReader.cxx.

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

Referenced by execute().

◆ readEvent() [2/2]

StatusCode RawEventReader::readEvent ( )

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