199 double eBeam = m_ecm / 2;
201 MsgStream log(
msgSvc(), name() );
202 log << MSG::INFO <<
"in execute()" << endmsg;
204 SmartDataPtr<Event::EventHeader> eventHeader( eventSvc(),
"/Event/EventHeader" );
205 int run = eventHeader->runNumber();
206 int event = eventHeader->eventNumber();
207 if ( event % m_RunEventFreq == 0 )
208 std::cout <<
"Run " << run <<
", event " <<
event << std::endl;
211 log << MSG::DEBUG <<
"ncharg, nneu, tottks = " << evtRecEvent->totalCharged() <<
" , "
212 << evtRecEvent->totalNeutral() <<
" , " << evtRecEvent->totalTracks() << endmsg;
218 int nChargedTracks = 0, nChargedTracksIP = 0;
219 int nCharge = 0, nChargeIP = 0;
220 double totalVisibleEnergy = 0, totalChargedEnergy = 0, totalEMCEnergy = 0;
221 double totalChargedPX = 0, totalChargedPY = 0, totalChargedPZ = 0;
223 double highestIPTrackP = -1, secondHighestIPTrackP = -2;
224 int highestPIPTrackId = -1, secondHighestPIPTrackId = -1;
227 for (
int i = 0; i < evtRecEvent->totalCharged(); i++ )
230 if ( !( *itTrk )->isMdcTrackValid() )
continue;
233 int trackId = mdcTrk->
trackId();
234 int charge = mdcTrk->
charge();
235 double r0 = mdcTrk->
r();
236 double z0 = mdcTrk->
z();
237 h_trackR0->fill( r0 );
238 h_trackZ0->fill( z0 );
243 double pX = mdcTrk->
px();
244 double pY = mdcTrk->
py();
245 double pZ = mdcTrk->
pz();
246 double pMag = mdcTrk->
p();
247 double cosTheta =
cos( mdcTrk->
theta() );
248 double phi = mdcTrk->
phi();
250 double chargedEnergy = sqrt( pMag * pMag +
mPi *
mPi );
251 totalVisibleEnergy += chargedEnergy;
252 totalChargedEnergy += chargedEnergy;
254 totalChargedPX += pX;
255 totalChargedPY += pY;
256 totalChargedPZ += pZ;
259 if ( ( *itTrk )->isEmcShowerValid() )
262 totalEMCEnergy += emcChargedTrk->
energy();
266 if ( ( *itTrk )->isMucTrackValid() )
269 double mucDepth = mucTrk->
depth();
272 h_mucDepth->fill( mucDepth );
273 h_mucDepthVsCosTheta->fill( cosTheta, mucDepth );
274 h_mucDepthVsPhi->fill( phi, mucDepth );
280 if ( fabs( z0 ) >= m_vz0cut )
continue;
281 if ( r0 >= m_vr0cut )
continue;
287 double dedxProbPH = -10;
288 int dedxNumTotalHits = -10;
289 int dedxNumGoodHits = -10;
291 if ( ( *itTrk )->isMdcDedxValid() )
297 h_dedxTotalHitsIP->fill( dedxNumTotalHits );
298 h_dedxGoodHitsIP->fill( dedxNumGoodHits );
300 h_dedxElecChiIP->fill( dedxTrk->
chiE() );
301 h_dedxMuonChiIP->fill( dedxTrk->
chiMu() );
302 h_dedxPionChiIP->fill( dedxTrk->
chiPi() );
303 h_dedxKaonChiIP->fill( dedxTrk->
chiK() );
304 h_dedxProtonChiIP->fill( dedxTrk->
chiP() );
306 dedxProbPH = dedxTrk->
probPH();
307 h_dedxProbPHIP->fill( dedxProbPH );
308 h_dedxProbPHVsMomentumIP->fill( pMag, dedxProbPH );
313 if ( ( *itTrk )->isTofTrackValid() )
315 SmartRefVector<RecTofTrack> tofTrkCol = ( *itTrk )->tofTrack();
316 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
318 for ( ; iter_tof != tofTrkCol.end(); iter_tof++ )
321 status->
setStatus( ( *iter_tof )->status() );
327 double tofPH = ( *iter_tof )->ph();
328 double tof = ( *iter_tof )->tof();
330 h_tofElecIP_Barrel->fill( tof - ( *iter_tof )->texpElectron() );
331 h_tofMuonIP_Barrel->fill( tof - ( *iter_tof )->texpMuon() );
332 h_tofPionIP_Barrel->fill( tof - ( *iter_tof )->texpPion() );
333 h_tofKaonIP_Barrel->fill( tof - ( *iter_tof )->texpKaon() );
334 h_tofProtonIP_Barrel->fill( tof - ( *iter_tof )->texpProton() );
335 h_tofVsMomentumIP->fill( pMag, tof );
337 if ( status->
layer() == 1 )
339 h_tofPHIP_BarrelLayer1->fill( tofPH );
340 h_tofIP_BarrelLayer1->fill( tof );
342 if ( status->
layer() == 2 )
344 h_tofPHIP_BarrelLayer2->fill( tofPH );
345 h_tofIP_BarrelLayer2->fill( tof );
353 double tofPH = ( *iter_tof )->ph();
354 double tof = ( *iter_tof )->tof();
356 h_tofElecIP_Endcap->fill( tof - ( *iter_tof )->texpElectron() );
357 h_tofMuonIP_Endcap->fill( tof - ( *iter_tof )->texpMuon() );
358 h_tofPionIP_Endcap->fill( tof - ( *iter_tof )->texpPion() );
359 h_tofKaonIP_Endcap->fill( tof - ( *iter_tof )->texpKaon() );
360 h_tofProtonIP_Endcap->fill( tof - ( *iter_tof )->texpProton() );
361 h_tofVsMomentumIP->fill( pMag, tof );
365 h_tofPHIP_EastEndcap->fill( tofPH );
366 h_tofIP_EastEndcap->fill( tof );
370 h_tofPHIP_WestEndcap->fill( tofPH );
371 h_tofIP_WestEndcap->fill( tof );
379 if ( pMag > highestIPTrackP )
381 secondHighestPIPTrackId = highestPIPTrackId;
382 secondHighestIPTrackP = highestIPTrackP;
383 highestPIPTrackId = trackId;
384 highestIPTrackP = pMag;
386 if ( ( pMag > secondHighestIPTrackP ) && ( pMag < highestIPTrackP ) )
388 secondHighestPIPTrackId = trackId;
389 secondHighestIPTrackP = pMag;
396 if ( nChargedTracksIP > 0 )
400 double highestPPhi0 = mdcTrk->
phi();
401 h_pIPTrack1DivEb->fill( mdcTrk->
p() / eBeam );
403 if ( ( *itTrk )->isEmcShowerValid() )
406 h_eEMCIPTrack1DivEb->fill( emcChargedTrk->
energy() / eBeam );
410 if ( nChargedTracksIP > 1 )
412 itTrk = evtRecTrkCol->begin() + secondHighestPIPTrackId;
414 double secondHighestPPhi0 = mdcTrk->
phi();
415 h_pIPTrack2DivEb->fill( mdcTrk->
p() / eBeam );
417 if ( ( *itTrk )->isEmcShowerValid() )
420 h_eEMCIPTrack2DivEb->fill( emcChargedTrk->
energy() / eBeam );
423 h_acoplanarity_2HighestPIPTracks->fill(
424 fabs( CLHEP::pi - fabs( highestPPhi0 - secondHighestPPhi0 ) ) );
430 int nNeutralTracks = 0, nNeutralTracksGT30MeV = 0;
431 double totalNeutralEnergy = 0;
432 double totalNeutralPX = 0, totalNeutralPY = 0, totalNeutralPZ = 0;
434 for (
int i = evtRecEvent->totalCharged(); i < evtRecEvent->totalTracks(); i++ )
437 if ( !( *itTrk )->isEmcShowerValid() )
continue;
441 double eraw = emcTrk->
energy();
442 if ( eraw > 0.030 ) nNeutralTracksGT30MeV++;
444 totalVisibleEnergy += eraw;
445 totalEMCEnergy += eraw;
446 totalNeutralEnergy += eraw;
448 double theta = emcTrk->
theta();
449 double phi = emcTrk->
phi();
451 double pX = eraw *
cos( phi ) *
sin( theta );
452 double pY = eraw *
sin( phi ) *
sin( theta );
453 double pZ = eraw *
cos( theta );
455 totalNeutralPX += pX;
456 totalNeutralPY += pY;
457 totalNeutralPZ += pZ;
460 if ( nNeutralTracks == 1 ) h_eEMCShower1DivEb->fill( eraw / eBeam );
461 if ( nNeutralTracks == 2 ) h_eEMCShower2DivEb->fill( eraw / eBeam );
462 if ( nNeutralTracks == 3 ) h_eEMCShower3DivEb->fill( eraw / eBeam );
469 h_nChargedTracks->fill( nChargedTracks );
470 h_nChargedTracksIP->fill( nChargedTracksIP );
472 h_netCharge->fill( nCharge );
473 h_netChargeIP->fill( nChargeIP );
475 h_nNeutralTracks->fill( nNeutralTracks );
476 h_nNeutralTracksGT30MeV->fill( nNeutralTracksGT30MeV );
479 h_eVisibleDivEcm->fill( totalVisibleEnergy / m_ecm );
480 h_eEMCDivEcm->fill( totalEMCEnergy / m_ecm );
481 h_eNeutralDivEcm->fill( totalNeutralEnergy / m_ecm );
482 h_eChargedDivEcm->fill( totalChargedEnergy / m_ecm );
485 double totalChargedPXY =
486 sqrt( totalChargedPX * totalChargedPX + totalChargedPY * totalChargedPY );
487 double totalChargedP =
488 sqrt( totalChargedPXY * totalChargedPXY + totalChargedPZ * totalChargedPZ );
490 h_netMomentumDivEcm_AllChargedTracks->fill( totalChargedP / m_ecm );
491 h_netTransMomentumDivEcm_AllChargedTracks->fill( totalChargedPXY / m_ecm );
492 if ( totalChargedP > 0 )
493 { h_cosTheta_AllChargedTracks->fill( totalChargedPZ / totalChargedP ); }
496 if ( nChargedTracks > 0 )
498 log << MSG::INFO <<
"Run " << run <<
", event " <<
event <<
": totalChargedP <= 0! "
504 double totalNeutralPXY =
505 sqrt( totalNeutralPX * totalNeutralPX + totalNeutralPY * totalNeutralPY );
506 double totalNeutralP =
507 sqrt( totalNeutralPXY * totalNeutralPXY + totalNeutralPZ * totalNeutralPZ );
509 h_netMomentumDivEcm_AllNeutralTracks->fill( totalNeutralP / m_ecm );
510 h_netTransMomentumDivEcm_AllNeutralTracks->fill( totalNeutralPXY / m_ecm );
511 if ( totalNeutralP > 0 )
512 { h_cosTheta_AllNeutralTracks->fill( totalNeutralPZ / totalNeutralP ); }
515 if ( nNeutralTracks > 0 )
517 log << MSG::INFO <<
"Run " << run <<
", event " <<
event <<
": totalNeutralP <= 0! "
523 double totalEventPX = totalChargedPX + totalNeutralPX;
524 double totalEventPY = totalChargedPY + totalNeutralPY;
525 double totalEventPZ = totalChargedPZ + totalNeutralPZ;
527 double totalEventPXY = sqrt( totalEventPX * totalEventPX + totalEventPY * totalEventPY );
528 double totalEventP = sqrt( totalEventPXY * totalEventPXY + totalEventPZ * totalEventPZ );
530 h_netMomentumDivEcm_AllTracks->fill( totalEventP / m_ecm );
531 h_netTransMomentumDivEcm_AllTracks->fill( totalEventPXY / m_ecm );
532 if ( totalEventP > 0 ) { h_cosTheta_AllTracks->fill( totalEventPZ / totalEventP ); }
535 log << MSG::INFO <<
"Run " << run <<
", event " <<
event <<
": totalEventP <= 0! "
540 SmartDataPtr<EvtRecVeeVertexCol> evtRecVeeVertexCol( eventSvc(),
541 "/Event/EvtRec/EvtRecVeeVertexCol" );
542 if ( !evtRecVeeVertexCol )
544 log << MSG::FATAL <<
"Could not find EvtRecVeeVertexCol" << endmsg;
545 return StatusCode::FAILURE;
549 int numKs = 0, numLambda = 0;
550 for ( EvtRecVeeVertexCol::iterator veeItr = evtRecVeeVertexCol->begin();
551 veeItr < evtRecVeeVertexCol->end(); veeItr++ )
554 h_ksMass->fill( ( *veeItr )->mass() );
555 if ( fabs( ( *veeItr )->mass() -
mKs ) < 0.010 ) ++numKs;
557 h_lambdaMass->fill( ( *veeItr )->mass() );
558 if ( fabs( ( *veeItr )->mass() -
mLambda ) < 0.010 ) ++numLambda;
562 h_nKs->fill( numKs );
563 h_nLambda->fill( numLambda );
565 return StatusCode::SUCCESS;