103 std::cout << std::defaultfloat;
105 MsgStream log(
msgSvc(), name() );
106 log << MSG::INFO <<
"execute()" << endmsg;
107 int eventNumber, runNumber;
109 if ( m_setSeed ==
true ) CLHEP::HepRandom::setTheSeed( 9000 );
112 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
115 log << MSG::FATAL <<
"Could not find Event Header" << endmsg;
116 return ( StatusCode::FAILURE );
118 runNumber = eventHeader->runNumber();
119 eventNumber = eventHeader->eventNumber();
124 cout <<
"TrackExt: ******************* Start a event *******************" << endl;
125 cout <<
"run= " << runNumber <<
"; event= " << eventNumber << endl;
129 SmartDataPtr<MucDigiCol> mucDigiCol( eventSvc(),
"/Event/Digi/MucDigiCol" );
132 log << MSG::FATAL <<
"Could not find MUC digi" << endmsg;
133 return ( StatusCode::SUCCESS );
143 if ( myParticleName ==
"e" ) parID = 0;
144 else if ( myParticleName ==
"mu" ) parID = 1;
145 else if ( myParticleName ==
"pi" ) parID = 2;
146 else if ( myParticleName ==
"kaon" ) parID = 3;
147 else if ( myParticleName ==
"proton" || myParticleName ==
"anti_proton" ) parID = 4;
150 std::cerr <<
"TrkExtAlg::execute() - Error: Invalid particle name: " << myParticleName
155 if ( myInputTrk ==
"Mdc" )
157 SmartDataPtr<RecMdcTrackCol> aMdcTrackCol( eventSvc(),
"/Event/Recon/RecMdcTrackCol" );
160 log << MSG::WARNING <<
"Can't find RecMdcTrackCol in TDS!" << endmsg;
161 return ( StatusCode::SUCCESS );
165 else if ( myInputTrk ==
"Kal" )
167 SmartDataPtr<RecMdcKalTrackCol> aMdcKalTrackCol( eventSvc(),
168 "/Event/Recon/RecMdcKalTrackCol" );
169 if ( !aMdcKalTrackCol )
171 log << MSG::WARNING <<
"Can't find RecMdcKalTrackCol in TDS!" << endmsg;
172 return ( StatusCode::SUCCESS );
178 log << MSG::WARNING <<
"Wrong type of inputTrk:" << myInputTrk << endmsg;
179 return ( StatusCode::SUCCESS );
190 for (
int i = 0; i < 5; i++ )
192 if ( aExtMdcTrack.
ReadTrk( i ) )
202 double tofInMdc = aExtMdcTrack.
GetTrkTof();
206 cout <<
"Start From:" << position.x() <<
' ' << position.y() <<
' ' << position.z()
210 cout <<
"Start Error matrix:" << error << endl;
211 cout <<
"Path before start:" << pathInMDC << endl;
214 G4String aParticleName(
parName[i] );
216 if ( !aParticleName.contains(
"proton" ) )
218 if ( charge > 0 ) aParticleName +=
"+";
219 else aParticleName +=
"-";
223 if ( charge > 0 ) aParticleName =
"proton";
224 else aParticleName =
"anti_proton";
229 cout <<
"Charge: " << charge << endl;
230 cout <<
"Particle: " << aParticleName << endl;
234 extSteppingAction = myExtTrack->GetStepAction();
238 extSteppingAction->
Reset();
241 bool m_trackstatus =
false;
242 int trk_startpart = 0;
243 while ( !m_trackstatus )
247 if ( trk_startpart > 20 )
249 cout <<
"-------has modified more than 20 times---------" << endl;
252 if ( myExtTrack->Set( position,
momentum, error, aParticleName, pathInMDC,
255 myExtTrack->TrackExtrapotation();
257 m_trackstatus = extSteppingAction->
TrackStop();
259 else m_trackstatus =
true;
266 if ( msgFlag ) cout <<
"will add aExtTrack!" << endl;
269 if ( aExtTrack ) aExtTrackCol->add( aExtTrack );
270 else if ( msgFlag ) cout <<
"No aExtTrack!" << endl;
274 if ( msgFlag ) cout <<
"No aExtTrackCol!" << endl;
276 if ( msgFlag ) cout <<
"add a aExtTrack!" << endl;
308 SmartIF<IDataManagerSvc> dataManSvc( eventSvc() );
311 DataObject* extTrackCol;
312 eventSvc()->findObject(
"/Event/Recon/RecExtTrackCol", extTrackCol );
313 if ( extTrackCol != NULL )
315 dataManSvc->clearSubTree(
"/Event/Recon/RecExtTrackCol" );
316 eventSvc()->unregisterObject(
"/Event/Recon/RecExtTrackCol" );
321 StatusCode sc = eventSvc()->registerObject(
"/Event/Recon/RecExtTrackCol", aExtTrackCol );
322 if ( sc != StatusCode::SUCCESS )
324 log << MSG::FATAL <<
"Could not register RecExtTrackCol in TDS!" << endmsg;
325 return ( StatusCode::FAILURE );
330 SmartDataPtr<RecExtTrackCol> aExtTrkCol( eventSvc(),
"/Event/Recon/RecExtTrackCol" );
333 log << MSG::FATAL <<
"Can't find RecExtTrackCol in TDS!" << endmsg;
334 return ( StatusCode::FAILURE );
337 RecExtTrackCol::iterator iterOfExtTrk;
340 for ( iterOfExtTrk = aExtTrkCol->begin(); iterOfExtTrk != aExtTrkCol->end(); iterOfExtTrk++ )
344 for (
int i = 0; i < 5; i++ )
347 cout <<
"##########track" << j <<
": "
348 <<
"(" << i <<
")" << endl;
349 cout <<
"******TOF1:******" << endl;
350 cout <<
"VolumeName: " << ( *iterOfExtTrk )->tof1VolumeName( i ) <<
"\t"
351 <<
"VolumeNumber: " << ( *iterOfExtTrk )->tof1VolumeNumber( i ) <<
"\t" << endl
352 <<
"Position: " << ( *iterOfExtTrk )->tof1Position( i ) <<
"\t"
353 <<
"Momentum: " << ( *iterOfExtTrk )->tof1Momentum( i ) <<
"\t" << endl
354 <<
"Error matrix: " << ( *iterOfExtTrk )->tof1ErrorMatrix( i )
355 <<
"Error z: " << ( *iterOfExtTrk )->tof1PosSigmaAlongZ( i ) <<
"\t"
356 <<
"Error Tz: " << ( *iterOfExtTrk )->tof1PosSigmaAlongT( i ) <<
"\t"
357 <<
"Error x: " << ( *iterOfExtTrk )->tof1PosSigmaAlongX( i ) <<
"\t"
358 <<
"Error y: " << ( *iterOfExtTrk )->tof1PosSigmaAlongY( i ) << endl
359 <<
"Tof: " << ( *iterOfExtTrk )->tof1( i ) <<
"\t"
360 <<
"PathOF: " << ( *iterOfExtTrk )->tof1Path( i ) << endl;
361 cout <<
"******TOF2:******" << endl;
362 cout <<
"VolumeName: " << ( *iterOfExtTrk )->tof2VolumeName( i ) <<
"\t"
363 <<
"VolumeNumber: " << ( *iterOfExtTrk )->tof2VolumeNumber( i ) <<
"\t" << endl
364 <<
"Position: " << ( *iterOfExtTrk )->tof2Position( i ) <<
"\t"
365 <<
"Momentum: " << ( *iterOfExtTrk )->tof2Momentum( i ) <<
"\t" << endl
366 <<
"Error matrix: " << ( *iterOfExtTrk )->tof2ErrorMatrix( i )
367 <<
"Error z: " << ( *iterOfExtTrk )->tof2PosSigmaAlongZ( i ) <<
"\t"
368 <<
"Error Tz: " << ( *iterOfExtTrk )->tof2PosSigmaAlongT( i ) <<
"\t"
369 <<
"Error x: " << ( *iterOfExtTrk )->tof2PosSigmaAlongX( i ) <<
"\t"
370 <<
"Error y: " << ( *iterOfExtTrk )->tof2PosSigmaAlongY( i ) << endl
371 <<
"Tof: " << ( *iterOfExtTrk )->tof2( i ) <<
"\t"
372 <<
"PathOF: " << ( *iterOfExtTrk )->tof2Path( i ) << endl;
375 cout <<
"******EMC:******" << endl
376 <<
"VolumeName: " << ( *iterOfExtTrk )->emcVolumeName( i ) <<
"\t"
377 <<
"VolumeNumber: " << ( *iterOfExtTrk )->emcVolumeNumber( i ) <<
"\t" << endl
378 <<
"Position: " << ( *iterOfExtTrk )->emcPosition( i ) <<
"\t"
379 <<
"Momentum: " << ( *iterOfExtTrk )->emcMomentum( i ) <<
"\t" << endl
380 <<
"Error matrix: " << ( *iterOfExtTrk )->emcErrorMatrix( i )
381 <<
"Error theta: " << ( *iterOfExtTrk )->emcPosSigmaAlongTheta( i ) <<
"\t"
382 <<
"Error phi: " << ( *iterOfExtTrk )->emcPosSigmaAlongPhi( i ) <<
"\t"
383 <<
"EMC path: " << ( *iterOfExtTrk )->emcPath( i ) << endl;
386 cout <<
"******MUC:******" << endl
387 <<
"VolumeName: " << ( *iterOfExtTrk )->mucVolumeName( i ) <<
"\t"
388 <<
"VolumeNumber: " << ( *iterOfExtTrk )->mucVolumeNumber( i ) << endl
389 <<
"Position: " << ( *iterOfExtTrk )->mucPosition( i ) <<
"\t"
390 <<
"Momentum: " << ( *iterOfExtTrk )->mucMomentum( i ) <<
"\t" << endl
391 <<
"Error matrix: " << ( *iterOfExtTrk )->mucErrorMatrix( i )
392 <<
"Error z: " << ( *iterOfExtTrk )->mucPosSigmaAlongZ( i ) <<
"\t"
393 <<
"Error Tz: " << ( *iterOfExtTrk )->mucPosSigmaAlongT( i ) <<
"\t"
394 <<
"Error x: " << ( *iterOfExtTrk )->mucPosSigmaAlongX( i ) <<
"\t"
395 <<
"Error y: " << ( *iterOfExtTrk )->mucPosSigmaAlongY( i ) << endl;
397 cout <<
"*******MUC KALMANFILTER***********" << endl;
398 cout <<
"Chisq is " << ( *iterOfExtTrk )->MucKalchi2( i ) << endl;
399 cout <<
"Nfit is " << ( *iterOfExtTrk )->MucKaldof( i ) << endl;
400 cout <<
"chiL " << ( *iterOfExtTrk )->MucKalchi2() << endl;
428 if ( msgFlag ) cout <<
"****************** End a event! ****************" << endl << endl;
556 return StatusCode::SUCCESS;