BOSS 7.0.8
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcCalEvent.cxx
Go to the documentation of this file.
2
3#include "GaudiKernel/MsgStream.h"
4#include "GaudiKernel/IMessageSvc.h"
5#include "GaudiKernel/StatusCode.h"
6#include "GaudiKernel/ISvcLocator.h"
7#include "GaudiKernel/Bootstrap.h"
8#include "GaudiKernel/SmartDataPtr.h"
9#include "GaudiKernel/IDataProviderSvc.h"
10#include "GaudiKernel/PropertyMgr.h"
11
14
15#include "EventModel/Event.h"
17#include "EventModel/Event.h"
18
21
28#include "Identifier/MdcID.h"
29#include "MdcRawEvent/MdcDigi.h"
30
31#include <iostream>
32#include <math.h>
33
34using namespace Event;
35
37}
38
40}
41
43 IMessageSvc *msgSvc;
44 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
45 MsgStream log(msgSvc, "MdcCalEvent");
46 log << MSG::INFO << "MdcCalEvent::setRecEvent" << endreq;
47
48 IDataProviderSvc* eventSvc = NULL;
49 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
50
51 // retrieve Mdc digi
52 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc,"/Event/Digi/MdcDigiCol");
53 if (!mdcDigiCol) {
54 log << MSG::FATAL << "Could not find event" << endreq;
55 }
56
57 MdcDigiCol::iterator iter = mdcDigiCol->begin();
58 m_nhitTQ = 0;
59 for(; iter != mdcDigiCol->end(); iter++) {
60 MdcDigi *aDigi = (*iter);
61 unsigned fgOverFlow = (aDigi) -> getOverflow();
62 if ( ((fgOverFlow & 3) !=0 ) || ((fgOverFlow & 12) != 0) ||
63 (aDigi->getTimeChannel() == 0x7FFFFFFF) ||
64 (aDigi->getChargeChannel() == 0x7FFFFFFF) ) continue;
65 m_nhitTQ++;
66 }
67
68 // get EsTimeCol
69 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,"/Event/Recon/RecEsTimeCol");
70 if( (!aevtimeCol) || (aevtimeCol->size()==0) ){
71 m_tes = -9999.0;
72 m_esFlag = -1;
73 }else{
74 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
75 for(; iter_evt!=aevtimeCol->end(); iter_evt++){
76 m_tes = (*iter_evt)->getTest();
77 m_esFlag = (*iter_evt)->getStat();
78 }
79 }
80 m_esCutFg = false;
81 m_nEsCutFg = -1;
82 bool flagTes = false;
83 for(int iEs=0; iEs<m_param.nEsFlag; iEs++){
84 if(m_esFlag == m_param.esFlag[iEs]){
85 flagTes = true;
86 m_nEsCutFg = iEs;
87 break;
88 }
89 }
90 if( flagTes && (m_tes > m_param.tesMin) && (m_tes < m_param.tesMax) ) m_esCutFg = true;
91
92 SmartDataPtr<RecMdcTrackCol> newtrkCol(eventSvc, "/Event/Recon/RecMdcTrackCol");
93 if(!newtrkCol){
94 log << MSG::ERROR << "Could not find RecMdcTrackCol" << endreq;
95 return ( StatusCode::FAILURE );
96 }
97
98 int i = 0;
99 MdcCalRecTrk* rectrk;
100 RecMdcTrackCol::iterator it_trk = newtrkCol->begin();
101 for(; it_trk != newtrkCol->end(); it_trk++){
102 rectrk = new MdcCalRecTrk(m_param.particle);
103 rectrk -> setGeomSvc(m_mdcGeomSvc);
104 rectrk -> setUtilSvc(m_mdcUtilitySvc);
105 rectrk -> setRecTrk(it_trk);
106 m_rectrk.push_back(rectrk);
107
108 i++;
109 }
110// log << MSG::WARNING << "RecTrack ntrk = " << i << endreq;
111
112 return StatusCode::SUCCESS;
113}
114
116 IMessageSvc *msgSvc;
117 Gaudi::svcLocator()->service("MessageSvc", msgSvc);
118 MsgStream log(msgSvc, "MdcCalEvent");
119 log << MSG::INFO << "MdcCalEvent::setKalEvent" << endreq;
120
121 IDataProviderSvc* eventSvc = NULL;
122 Gaudi::svcLocator()->service("EventDataSvc", eventSvc);
123
124 // retrieve Mdc digi
125 SmartDataPtr<MdcDigiCol> mdcDigiCol(eventSvc,"/Event/Digi/MdcDigiCol");
126 if (!mdcDigiCol) {
127 log << MSG::FATAL << "Could not find event" << endreq;
128 }
129
130 MdcDigiCol::iterator iter = mdcDigiCol->begin();
131 m_nhitTQ = 0;
132 for(; iter != mdcDigiCol->end(); iter++) {
133 MdcDigi *aDigi = (*iter);
134 unsigned fgOverFlow = (aDigi) -> getOverflow();
135 if ( ((fgOverFlow & 3) !=0 ) || ((fgOverFlow & 12) != 0) ||
136 (aDigi->getTimeChannel() == 0x7FFFFFFF) ||
137 (aDigi->getChargeChannel() == 0x7FFFFFFF) ) continue;
138 m_nhitTQ++;
139 }
140
141 // get EsTimeCol
142 SmartDataPtr<RecEsTimeCol> aevtimeCol(eventSvc,"/Event/Recon/RecEsTimeCol");
143 if( (!aevtimeCol) || (aevtimeCol->size()==0) ){
144 m_tes = -9999.0;
145 m_esFlag = -1;
146 }else{
147 RecEsTimeCol::iterator iter_evt = aevtimeCol->begin();
148 for(; iter_evt!=aevtimeCol->end(); iter_evt++){
149 m_tes = (*iter_evt)->getTest();
150 m_esFlag = (*iter_evt)->getStat();
151 }
152 }
153 m_esCutFg = false;
154 m_nEsCutFg = -1;
155 bool flagTes = false;
156 for(int iEs=0; iEs<m_param.nEsFlag; iEs++){
157 if(m_esFlag == m_param.esFlag[iEs]){
158 flagTes = true;
159 m_nEsCutFg = iEs;
160 break;
161 }
162 }
163 if( flagTes && (m_tes > m_param.tesMin) && (m_tes < m_param.tesMax) ) m_esCutFg = true;
164
165 SmartDataPtr<RecMdcKalTrackCol> kaltrkCol(eventSvc,"/Event/Recon/RecMdcKalTrackCol");
166 if (!kaltrkCol) {
167 log << MSG::FATAL << "Could not find RecMdcKalTrackCol" << endreq;
168 return StatusCode::FAILURE;
169 }
170
171 int i = 0;
172 MdcCalRecTrk* rectrk;
173 RecMdcKalTrackCol::iterator iter_trk = kaltrkCol->begin();
174 for(; iter_trk != kaltrkCol->end(); iter_trk++) {
175 rectrk = new MdcCalRecTrk(m_param.particle);
176 rectrk -> setGeomSvc(m_mdcGeomSvc);
177 rectrk -> setUtilSvc(m_mdcUtilitySvc);
178 rectrk -> setKalTrk(iter_trk);
179 m_rectrk.push_back(rectrk);
180
181 i++;
182 }
183 log << MSG::INFO << "KalTrack ntrk = " << i << endreq;
184
185 return StatusCode::SUCCESS;
186}
187
189 unsigned int i;
190 for(i=0; i<m_rectrk.size(); i++){
191 delete m_rectrk[i];
192 }
193 m_rectrk.clear();
194}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
IMessageSvc * msgSvc()
#define NULL
StatusCode setKalEvent()
StatusCode setRecEvent()
Definition: MdcCalEvent.cxx:42
void setGeomSvc(IMdcGeomSvc *mdcGeomSvc)
Definition: MdcCalEvent.h:21
void setUtilSvc(IMdcUtilitySvc *mdcUtilitySvc)
Definition: MdcCalEvent.h:22
double tesMax
Definition: MdcCalParams.h:44
int esFlag[50]
Definition: MdcCalParams.h:41
double tesMin
Definition: MdcCalParams.h:43
unsigned int getChargeChannel() const
Definition: RawData.cxx:45
unsigned int getTimeChannel() const
Definition: RawData.cxx:40
Definition: Event.h:21