106 {
107
108 MsgStream log(
msgSvc(), name());
109 log << MSG::INFO << "MrpcRec in execute()!" << endreq;
110
111 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),"/Event/EventHeader");
112 if( !eventHeader ) {
113 log << MSG::FATAL << "MrpcRec could not find Event Header!" << endreq;
114 return StatusCode::FAILURE;
115 }
116 int run = eventHeader->runNumber();
117 int event = eventHeader->eventNumber();
118 if( ( event % 1000 == 0 ) && m_printOutInfo ) {
119 std::cout << "run:" << run << " event: " << event << std::endl;
120 }
121 log << MSG::INFO << "run= " << run << " event= " << event << endreq;
122
125
126
127 if( m_acceleratorStatus == "Colliding" ) {
128
129 SmartDataPtr<RecEsTimeCol> estimeCol(eventSvc(),"/Event/Recon/RecEsTimeCol");
130 if( !estimeCol || ( estimeCol->size() == 0 ) ) {
131 log << MSG::WARNING << "MrpcRec Could not find RecEsTimeCol! Run = " << run << " Event = " << event << endreq;
132 return StatusCode::SUCCESS;
133 }
134 RecEsTimeCol::iterator iter_ESTime=estimeCol->begin();
135 double t0 = (*iter_ESTime)->getTest();
136 int t0Stat = (*iter_ESTime)->getStat();
137 log << MSG::INFO << "t0= " << t0 << " t0Stat= " << t0Stat << endreq;
138
139
140
141
142 SmartDataPtr<RecMdcKalTrackCol> mdcKalTrackCol(eventSvc(),"/Event/Recon/RecMdcKalTrackCol");
143 if( !mdcKalTrackCol ) {
144 log << MSG::WARNING << "No MdcKalTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
145 return StatusCode::SUCCESS;
146 }
147
148
149
150
151 SmartDataPtr<RecExtTrackCol> extTrackCol(eventSvc(),"/Event/Recon/RecExtTrackCol");
152 if( !extTrackCol ) {
153 log << MSG::WARNING << "No ExtTrackCol in TDS! Run = " << run << " Event = " << event << endreq;
154 return StatusCode::SUCCESS;
155 }
156 else {
157 if( m_printOutInfo ) { m_printOut->
setExtTrackNum( extTrackCol->size() ); }
158 }
159
160
161
163 RecExtTrackCol::iterator iter_track = extTrackCol->begin();
164 for( ; iter_track < extTrackCol->end(); iter_track++ ) {
165 RecMdcKalTrackCol::iterator iter_kal = mdcKalTrackCol->begin();
166 for( ; iter_kal != mdcKalTrackCol->end(); iter_kal++ ) {
167 if( (*iter_kal)->trackId() == (*iter_track)->trackId() ) break;
168 }
169 int kal[5] = {-1};
170 if( iter_kal != mdcKalTrackCol->end() ) {
171 for( unsigned int i=0; i<5; i++ ) {
172 kal[i] = (*iter_kal)->getStat( 1, i );
173 }
174 }
176 tof->
setExtTrack( (*iter_track), kal, t0, t0Stat );
177
178 if( tofTrackVec->size()>0 ) {
179 std::vector<MrpcTrack*>::iterator iterExt = tofTrackVec->begin();
180 for( ; iterExt < tofTrackVec->end(); iterExt++ ) {
181 if( (*iterExt)->isNoHit() ) continue;
183 }
184 }
185
186 tofTrackVec->push_back( tof );
187 }
188
189 if( m_printOutInfo ) {
191 }
192
193
195 if( tofDataMap.empty() ) {
196 log << MSG::WARNING << "No Tof Data Map in RawDataProviderSvc! Run=" << run << " Event=" << event << endreq;
197 }
198
199
200 std::vector<MrpcTrack*>::iterator
iter = tofTrackVec->begin();
201 for( ;
iter < tofTrackVec->end();
iter++ ) {
202 if( (*iter)->isNoHit() ) continue;
203 (*iter)->setTofData( tofDataMap,m_neighborhood );
205 if( (*iter)->isNoHit() ) continue;
206 (*iter)->match(tofTrackVec );
208 }
209
210 iter = tofTrackVec->begin();
211 for( ;
iter < tofTrackVec->end();
iter++ )
212 {
213 (*iter)->setCalibration();
214 }
215
216 tds.
RegisterTDS( eventHeader->runNumber(), eventHeader->eventNumber(), tofTrackVec );
217
219
220
221 SmartDataPtr<RecTofTrackCol> tofTrackCol(eventSvc(),"/Event/Recon/RecTofTrackCol");
222 if (!tofTrackCol) {
223 log << MSG::FATAL << "MrpcRec could not find RecTofTrackCol!" << endreq;
224 return StatusCode::FAILURE;
225 }
226
227 }
228 else {
229 log << MSG::FATAL << "In MrpcRec: AcceleratorStatus is NOT correct! m_acceleratorStatus = " << m_acceleratorStatus << endreq;
230 return StatusCode::FAILURE;
231 }
232
233 return StatusCode::SUCCESS;
234
235}
IRawDataProviderSvc * tofDigiSvc
std::vector< MrpcTrack * > TofTrackVec
std::multimap< unsigned int, TofData * > TofDataMap
virtual TofDataMap & tofDataMapTof(double estime=0)=0
void setExtTrackNum(unsigned int ntrk)
void setTrack3(MrpcTrack *&tof)
void setTrack2(MrpcTrack *&tof)
void setTrack1Col(std::vector< MrpcTrack * > *&tofTrackVec)
StatusCode RegisterNullRecTofTrackCol()
StatusCode RegisterTDS(int runNumber, int eventNumber, std::vector< MrpcTrack * > *&tofTrackVec)
void clearTofTrackVec(std::vector< MrpcTrack * > *&tofTrackVec)
void getMultiHit(MrpcTrack *&)
void setExtTrack(RecExtTrack *extTrack, int kal[5], double t0, int t0Stat)