BOSS 6.6.4.p03
BESIII Offline Software System
Loading...
Searching...
No Matches
ReadRawData.cxx
Go to the documentation of this file.
1// Include files.
2#include <vector>
3#include "ReadRawData.h"
4#include "GaudiKernel/MsgStream.h"
5#include "GaudiKernel/ISvcLocator.h"
6#include "GaudiKernel/PropertyMgr.h"
7#include "GaudiKernel/SmartDataPtr.h"
9#include "GaudiKernel/IDataProviderSvc.h"
10#include "GaudiKernel/IDataManagerSvc.h"
11
12// Event Model related classes
13#include "EventModel/Event.h"
14#include "RawEvent/DigiEvent.h"
15#include "MdcRawEvent/MdcDigi.h"
16#include "EmcRawEvent/EmcDigi.h"
17#include "TofRawEvent/TofDigi.h"
18#include "MucRawEvent/MucDigi.h"
19
21
22using namespace std;
23
24// Constructor.
25ReadRawData::ReadRawData(const string& name, ISvcLocator* pSvcLocator)
26 : Algorithm(name, pSvcLocator)
27{}
28
29// ReadRawData::initialize().
31{
32
33 MsgStream log(msgSvc(), name());
34 m_count = 0;
35
36 log << MSG::INFO << "in initialize()" << endreq;
37
38 return StatusCode::SUCCESS;
39}
40
41// ReadRawData::execute().
43{
44 StatusCode sc;
45 MsgStream log( msgSvc(), name() );
46
47 log << MSG::INFO << "================================================" << endreq;
48 log << MSG::INFO << "In execute()" << endreq;
49 log << MSG::INFO << "++++++++++++++++++++++++++++++++++++++++++++++++" << endreq;
50
51 SmartDataPtr<Event::EventHeader> evt(eventSvc(), EventModel::EventHeader);
52 if (!evt) {
53 log << MSG::ERROR << "Did not retrieve event" << endreq;
54 return StatusCode::FAILURE;
55 }
56 //Check event header
57
58 int eventNo = evt->eventNumber();
59 int runNo = evt->runNumber();
60
61 log << MSG::INFO << "ReadRawData: retrieved event: " << eventNo << " run: " << runNo << endreq;
62
63 log << MSG::INFO << "ReadRawData: start to read MdcDigiData" << endreq;
64 sc = readMdcDigiData();
65
66 log << MSG::INFO << "ReadRawData: start to read EmcDigiData" << endreq;
67 sc = readEmcDigiData();
68
69 log << MSG::INFO << "ReadRawData: start to read TofDigiData" << endreq;
70 sc = readTofDigiData();
71
72 log << MSG::INFO << "ReadRawData: start to read MucDigiData" << endreq;
73 sc = readMucDigiData();
74 if (sc.isFailure()) {
75 return sc;
76 }
77
78 m_count++;
79
80
81 return StatusCode::SUCCESS;
82}
83
84StatusCode ReadRawData::readMdcDigiData() {
85 MsgStream log(msgSvc(), name());
86 StatusCode sc = StatusCode::SUCCESS;
87
88 SmartDataPtr<DigiEvent> digiEvt(eventSvc(), EventModel::Digi::Event);
89 if (!digiEvt) {
90 log << MSG::ERROR << "Did not retrieve DigiEvent" << endreq;
91 return StatusCode::FAILURE;
92 }
93
94 SmartDataPtr<MdcDigiCol> digiCol(eventSvc(), EventModel::Digi::MdcDigiCol);
95
96 if (digiCol == 0) {
97 log << "no MdcDigiCol found" << endreq;
98 return sc;
99 } else {
100 log << "Event No. " << m_count << " ---> " << digiCol->size() << " Mdc digis found " << endreq;
101
102 log << MSG::INFO << "Detailed dump of this event: " << endreq;
103 int ndigi = 0;
104 MdcDigiCol::const_iterator pMdcDigi = digiCol->begin();
105 for ( ; pMdcDigi!= digiCol->end(); pMdcDigi++) {
106 log << MSG::INFO << "Digi " << ndigi++ << " ";
107 // output the digi proper: " << digi " no longer works because
108 // "digi" now returns an integer sort order
109 (**pMdcDigi).fillStream(log.stream());
110 log << endreq;
111 }
112 }
113
114
115 return StatusCode::SUCCESS;
116}
117
118StatusCode ReadRawData::readEmcDigiData() {
119 MsgStream log(msgSvc(), name());
120 StatusCode sc = StatusCode::SUCCESS;
121
122
123 SmartDataPtr<EmcDigiCol> digiCol(eventSvc(), EventModel::Digi::EmcDigiCol);
124
125
126 if (digiCol == 0) {
127 log << "no EmcDigiCol found" << endreq;
128 return sc;
129 } else {
130 log << "Event No. " << m_count << " ---> " << digiCol->size() << " Emc digis found " << endreq;
131 log << MSG::INFO << "Detailed dump of this event: " << endreq;
132 int ndigi = 0;
133 EmcDigiCol::const_iterator pEmcDigi = digiCol->begin();
134 for ( ; pEmcDigi != digiCol->end(); pEmcDigi++) {
135 log <<MSG::INFO << "Digi " << ndigi++ << " ";
136 (**pEmcDigi).fillStream(log.stream());
137 log << endreq;
138 }
139 }
140
141
142 return StatusCode::SUCCESS;
143}
144
145StatusCode ReadRawData::readTofDigiData() {
146 MsgStream log(msgSvc(), name());
147 StatusCode sc = StatusCode::SUCCESS;
148
149 SmartDataPtr<TofDigiCol> digiCol(eventSvc(), EventModel::Digi::TofDigiCol);
150
151 if (digiCol == 0) {
152 log << "no TofDigiCol found" << endreq;
153 return sc;
154 } else {
155 log << "Event No. " << m_count << " ---> " << digiCol->size() << " Tof digis found " << endreq;
156 log << MSG::INFO << "Detailed dump of this event: " << endreq;
157 int ndigi = 0;
158 TofDigiCol::const_iterator pTofDigi = digiCol->begin();
159 for ( ; pTofDigi!= digiCol->end(); pTofDigi++) {
160 log <<MSG::INFO << "Digi " << ndigi++ << " ";
161 (**pTofDigi).fillStream(log.stream());
162 log << endreq;
163 }
164 }
165
166
167 return StatusCode::SUCCESS;
168}
169
170StatusCode ReadRawData::readMucDigiData() {
171 MsgStream log(msgSvc(), name());
172 StatusCode sc = StatusCode::SUCCESS;
173
174 SmartDataPtr<MucDigiCol> digiCol(eventSvc(), EventModel::Digi::MucDigiCol);
175
176 if (digiCol == 0) {
177 log << "no MucDigiCol found" << endreq;
178 return sc;
179 } else {
180 log << "Event No. " << m_count << " ---> " << digiCol->size() << " Muc digis found " << endreq;
181 log << MSG::INFO << "Detailed dump of this event: " << endreq;
182 int ndigi = 0;
183 MucDigiCol::const_iterator pMucDigi = digiCol->begin();
184 for ( ; pMucDigi!= digiCol->end(); pMucDigi++) {
185 log <<MSG::INFO << "Digi " << ndigi++ << " ";
186 (**pMucDigi).fillStream(log.stream());
187 log << endreq;
188 }
189 }
190
191
192 return StatusCode::SUCCESS;
193}
194
195
196// ReadRawData::finalize().
198{
199
200 MsgStream log(msgSvc(), name());
201
202 log << MSG::INFO << "In finalize()" << endreq;
203
204 return StatusCode::SUCCESS;
205}
int runNo
int eventNo
IMessageSvc * msgSvc()
StatusCode finalize()
ReadRawData(const std::string &name, ISvcLocator *pSvcLocator)
Definition: ReadRawData.cxx:25
StatusCode execute()
Definition: ReadRawData.cxx:42
StatusCode initialize()
Definition: ReadRawData.cxx:30
_EXTERN_ std::string Event
Definition: EventModel.h:56
_EXTERN_ std::string MdcDigiCol
Definition: EventModel.h:57
_EXTERN_ std::string MucDigiCol
Definition: EventModel.h:60
_EXTERN_ std::string EmcDigiCol
Definition: EventModel.h:58
_EXTERN_ std::string TofDigiCol
Definition: EventModel.h:59