BOSS 7.1.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcDummy.cxx
Go to the documentation of this file.
2#include "GaudiKernel/MsgStream.h"
3#include "GaudiKernel/AlgFactory.h"
4#include "GaudiKernel/ISvcLocator.h"
5#include "GaudiKernel/SmartDataPtr.h"
6#include "GaudiKernel/IDataProviderSvc.h"
7#include "GaudiKernel/PropertyMgr.h"
10#include "TofRawEvent/TofDigi.h"
11#include "EmcRawEvent/EmcDigi.h"
12#include "McTruth/DecayMode.h"
13
14/*#include "McTruth/McParticle.h"
15
16#include "MdcGeomSvc/IMdcGeomSvc.h"
17#include "MdcGeomSvc/MdcGeoWire.h"
18#include "MdcGeomSvc/MdcGeoLayer.h"
19*/
20#include <vector>
21#include <iostream>
22
23using namespace std;
24using namespace Event;
25
26/////////////////////////////////////////////////////////////////////////////
27DECLARE_COMPONENT(MdcDummy)
28MdcDummy::MdcDummy(const std::string& name, ISvcLocator* pSvcLocator) :
29 Algorithm(name, pSvcLocator)
30{
31 // Declare the properties
32 declareProperty("FittingMethod", m_fittingMethod = 2);
33 declareProperty("ConfigFile", m_configFile = "MDCConfig.xml");
34}
35
36// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
38
39 MsgStream log(msgSvc(), name());
40 log << MSG::INFO << "in initialize()" << endreq;
41
42
43 return StatusCode::SUCCESS;
44}
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
47StatusCode MdcDummy::execute() {
48
49 MsgStream log(msgSvc(), name());
50 log << MSG::INFO << "in execute()" << endreq;
51
52 // Part 1: Get the event header, print out event and run number
53 int event, run;
54
55 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
56 if (!eventHeader) {
57 log << MSG::FATAL << "Could not find Event Header" << endreq;
58 return( StatusCode::FAILURE);
59 }
60 log << MSG::INFO << "MdcDummy: retrieved event: " << eventHeader->eventNumber() << " run: " << eventHeader->runNumber() << endreq;
61
62 int digiId;
63
64 //Part 2: Retrieve MC truth
65 SmartDataPtr<DecayMode> decayMode(eventSvc(),"/Event/MC/DecayMode");
66 if (!decayMode) {
67 log << MSG::FATAL << "Could not find DecayMode" << endreq;
68 return( StatusCode::FAILURE);
69 }
70 unsigned int size = 10;
71 int decayId[10];
72 decayMode->getData(decayId, size);
73
74 for (unsigned int index =0; index<10; index++) {
75 log << MSG::INFO
76 << " Decay Mode = " << decayId[index]
77 << endreq;
78 }
79
80 //Part 3: Retrieve MDC digi
81 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc(),"/Event/Digi/MdcDigiCol");
82 if (!mdcDigiCol) {
83 log << MSG::FATAL << "Could not find MDC digi" << endreq;
84 return( StatusCode::FAILURE);
85 }
86
87 MdcDigiCol::iterator iter1 = mdcDigiCol->begin();
88 digiId = 0;
89 for (;iter1 != mdcDigiCol->end(); iter1++, digiId++) {
90 log << MSG::INFO << "MDC digit No: " << digiId << endreq;
91
92 log << MSG::INFO
93 << " time_channel = " << (*iter1)->getTimeChannel()
94 << " charge_channel = " << (*iter1)->getChargeChannel()
95 << endreq;
96 }
97
98
99 //Part 4: Retrieve TOF digi
100 SmartDataPtr<TofDigiCol> tofDigiCol(eventSvc(),"/Event/Digi/TofDigiCol");
101 if (!tofDigiCol) {
102 log << MSG::FATAL << "Could not find TOF digi" << endreq;
103 return( StatusCode::FAILURE);
104 }
105
106 TofDigiCol::iterator iter2 = tofDigiCol->begin();
107 digiId = 0;
108 for (;iter2 != tofDigiCol->end(); iter2++, digiId++) {
109 log << MSG::INFO << "TOF digit No: " << digiId << endreq;
110
111 }
112
113 //Part 5: Retrieve EMC digi
114 SmartDataPtr<EmcDigiCol> emcDigiCol(eventSvc(),"/Event/Digi/EmcDigiCol");
115 if (!emcDigiCol) {
116 log << MSG::FATAL << "Could not find EMC digi" << endreq;
117 return( StatusCode::FAILURE);
118 }
119
120 EmcDigiCol::iterator iter3 = emcDigiCol->begin();
121 digiId = 0;
122 for (;iter3 != emcDigiCol->end(); iter3++, digiId++) {
123 log << MSG::INFO << "Emc digit No: " << digiId << endreq;
124
125 log << MSG::INFO
126 << " time_channel = " << (*iter3)->getTimeChannel()
127 << " charge_channel = " << (*iter3)->getChargeChannel()
128 << endreq;
129 }
130
131
132 return StatusCode::SUCCESS;
133}
134
135// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
136StatusCode MdcDummy::finalize() {
137
138 MsgStream log(msgSvc(), name());
139 log << MSG::INFO << "in finalize()" << endreq;
140
141 return StatusCode::SUCCESS;
142}
IMessageSvc * msgSvc()
StatusCode finalize()
Definition: MdcDummy.cxx:136
StatusCode initialize()
Definition: MdcDummy.cxx:37
StatusCode execute()
Definition: MdcDummy.cxx:47
Definition: Event.h:21