BOSS 7.0.3
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
112 TofDigiCol* tofDigiCol = new TofDigiCol;
113 m_tofCnv->convert(tofBuf, tofDigiCol);
114 /*TofDigiCol::const_iterator tofDigi = tofDigiCol->begin();
115 for(; tofDigi!=tofDigiCol->end(); tofDigi++ )
116 {
117 (*tofDigi)->getTrackIndex();
118 const Identifier ident = (*tofDigi)->identify();
119 std::cout<<"print tof digi in RawEventReader"<<std::endl;
120 std::cout<<"partId: "<<TofID::barrel_ec(ident);
121 std::cout<<" layer: "<<TofID::layer(ident);
122 std::cout<<" scinNb: "<<TofID::phi_module(ident);
123 std::cout<<" end: "<<TofID::end(ident);
124 std::cout<<" charge: "<<(*tofDigi)->getChargeChannel();
125 std::cout<<" time: "<<(*tofDigi)->getTimeChannel()<<std::endl;
126 }*/
127
128 //register TofDigiCol to TDS...
129 StatusCode scTof = m_evtSvc->registerObject("/Event/Digi/TofDigiCol", tofDigiCol);
130 if( scTof!=StatusCode::SUCCESS ) {
131 std::cout<< "Could not register TOF digi collection" <<std::endl;
132 }
133 }
134
135 if(m_emcdigi)
136 {
137 const BufferHolder& emcBuf = m_raw_event->getEmcBuf();
138
139 EmcDigiCol* emcDigiCol = new EmcDigiCol;
140 m_emcCnv->convert(emcBuf, emcDigiCol);
141 //register EmcDigiCol to TDS...
142 StatusCode scEmc = m_evtSvc->registerObject("/Event/Digi/EmcDigiCol", emcDigiCol);
143 if( scEmc!=StatusCode::SUCCESS ) {
144 std::cout<< "Could not register EMC digi collection" <<std::endl;
145 }
146 }
147
148 if(m_mucdigi)
149 {
150 const BufferHolder& mucBuf = m_raw_event->getMucBuf();
151
152 MucDigiCol* mucDigiCol = new MucDigiCol;
153 m_mucCnv->convert(mucBuf, mucDigiCol);
154 //register MucDigiCol to TDS...
155 StatusCode scMuc = m_evtSvc->registerObject("/Event/Digi/MucDigiCol", mucDigiCol);
156 if( scMuc!=StatusCode::SUCCESS ) {
157 std::cout<< "Could not register MUC digi collection" <<std::endl;
158 }
159 }
160 // clear the Memory Buffer, so that m_raw_event can be used directly during next event loop
161 m_raw_event->reset();
162
163 return StatusCode::SUCCESS;
164}
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 210 of file RawEventReader.cxx.

210 {
211
212 MsgStream log(msgSvc(), name());
213 log << MSG::INFO << "in finalize()" << endreq;
214
215 //TODO: release ...
216 delete m_raw_event;
217 //delete fileReader;
218
219 return StatusCode::SUCCESS;
220}

◆ 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 166 of file RawEventReader.cxx.

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

Referenced by execute().

◆ readEvent() [2/2]

StatusCode RawEventReader::readEvent ( )

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