175 double eBeam = m_ecm/2;
177 MsgStream log(
msgSvc(), name());
178 log << MSG::INFO <<
"in execute()" << endreq;
180 SmartDataPtr<Event::EventHeader> eventHeader(eventSvc(),
"/Event/EventHeader");
181 int run=eventHeader->runNumber();
182 int event=eventHeader->eventNumber();
183 if( event%m_RunEventFreq == 0) std::cout <<
"Run " << run <<
", event " <<
event << std::endl;
186 log << MSG::DEBUG <<
"ncharg, nneu, tottks = "
187 << evtRecEvent->totalCharged() <<
" , "
188 << evtRecEvent->totalNeutral() <<
" , "
189 << evtRecEvent->totalTracks() <<endreq;
196 int nChargedTracks = 0, nChargedTracksIP = 0;
197 int nCharge = 0, nChargeIP = 0;
198 double totalVisibleEnergy = 0, totalChargedEnergy = 0, totalEMCEnergy = 0;
199 double totalChargedPX = 0, totalChargedPY = 0, totalChargedPZ = 0;
201 double highestIPTrackP = -1, secondHighestIPTrackP = -2;
202 int highestPIPTrackId = -1, secondHighestPIPTrackId = -1;
205 for(
int i = 0; i < evtRecEvent->totalCharged(); i++){
207 if(!(*itTrk)->isMdcTrackValid())
continue;
210 int trackId = mdcTrk->
trackId();
212 double r0 = mdcTrk->
r();
213 double z0 = mdcTrk->
z();
220 double pX = mdcTrk->
px();
221 double pY = mdcTrk->
py();
222 double pZ = mdcTrk->
pz();
223 double pMag = mdcTrk->
p();
224 double cosTheta =
cos(mdcTrk->
theta());
225 double phi = mdcTrk->
phi();
227 double chargedEnergy = sqrt(pMag*pMag +
mPi*
mPi);
228 totalVisibleEnergy += chargedEnergy;
229 totalChargedEnergy += chargedEnergy;
231 totalChargedPX += pX;
232 totalChargedPY += pY;
233 totalChargedPZ += pZ;
236 if( (*itTrk)->isEmcShowerValid() ) {
238 totalEMCEnergy += emcChargedTrk->
energy();
242 if( (*itTrk)->isMucTrackValid() ) {
244 double mucDepth = mucTrk->
depth();
246 h_mucDepth->fill(mucDepth);
247 h_mucDepthVsCosTheta->fill(cosTheta,mucDepth);
248 h_mucDepthVsPhi->fill(phi,mucDepth);
255 if(fabs(z0) >= m_vz0cut)
continue;
256 if(r0 >= m_vr0cut)
continue;
262 double dedxProbPH = -10;
263 int dedxNumTotalHits = -10;
264 int dedxNumGoodHits = -10;
266 if( (*itTrk)->isMdcDedxValid() ) {
271 h_dedxTotalHitsIP->fill(dedxNumTotalHits);
272 h_dedxGoodHitsIP->fill(dedxNumGoodHits);
274 h_dedxElecChiIP->fill(dedxTrk->
chiE());
275 h_dedxMuonChiIP->fill(dedxTrk->
chiMu());
276 h_dedxPionChiIP->fill(dedxTrk->
chiPi());
277 h_dedxKaonChiIP->fill(dedxTrk->
chiK());
278 h_dedxProtonChiIP->fill(dedxTrk->
chiP());
280 dedxProbPH = dedxTrk->
probPH();
281 h_dedxProbPHIP->fill(dedxProbPH);
282 h_dedxProbPHVsMomentumIP->fill(pMag,dedxProbPH);
287 if( (*itTrk)->isTofTrackValid() ) {
288 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
289 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
291 for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
293 status->
setStatus((*iter_tof)->status());
298 double tofPH = (*iter_tof)->ph();
299 double tof = (*iter_tof)->tof();
301 h_tofElecIP_Barrel->fill(tof - (*iter_tof)->texpElectron());
302 h_tofMuonIP_Barrel->fill(tof - (*iter_tof)->texpMuon());
303 h_tofPionIP_Barrel->fill(tof - (*iter_tof)->texpPion());
304 h_tofKaonIP_Barrel->fill(tof - (*iter_tof)->texpKaon());
305 h_tofProtonIP_Barrel->fill(tof - (*iter_tof)->texpProton());
306 h_tofVsMomentumIP->fill(pMag,tof);
308 if( status->
layer() == 1 ) {
309 h_tofPHIP_BarrelLayer1->fill(tofPH);
310 h_tofIP_BarrelLayer1->fill(tof);
312 if( status->
layer() == 2 ) {
313 h_tofPHIP_BarrelLayer2->fill(tofPH);
314 h_tofIP_BarrelLayer2->fill(tof);
321 double tofPH = (*iter_tof)->ph();
322 double tof = (*iter_tof)->tof();
324 h_tofElecIP_Endcap->fill(tof - (*iter_tof)->texpElectron());
325 h_tofMuonIP_Endcap->fill(tof - (*iter_tof)->texpMuon());
326 h_tofPionIP_Endcap->fill(tof - (*iter_tof)->texpPion());
327 h_tofKaonIP_Endcap->fill(tof - (*iter_tof)->texpKaon());
328 h_tofProtonIP_Endcap->fill(tof - (*iter_tof)->texpProton());
329 h_tofVsMomentumIP->fill(pMag,tof);
332 h_tofPHIP_EastEndcap->fill(tofPH);
333 h_tofIP_EastEndcap->fill(tof);
336 h_tofPHIP_WestEndcap->fill(tofPH);
337 h_tofIP_WestEndcap->fill(tof);
346 if(pMag > highestIPTrackP) {
347 secondHighestPIPTrackId = highestPIPTrackId;
348 secondHighestIPTrackP = highestIPTrackP;
349 highestPIPTrackId = trackId;
350 highestIPTrackP = pMag;
352 if((pMag > secondHighestIPTrackP)&&(pMag < highestIPTrackP)) {
353 secondHighestPIPTrackId = trackId;
354 secondHighestIPTrackP = pMag;
362 if(nChargedTracksIP > 0) {
365 double highestPPhi0 = mdcTrk->
phi();
366 h_pIPTrack1DivEb->fill(mdcTrk->
p()/eBeam);
368 if( (*itTrk)->isEmcShowerValid() ) {
370 h_eEMCIPTrack1DivEb->fill(emcChargedTrk->
energy()/eBeam);
374 if(nChargedTracksIP > 1) {
375 itTrk = evtRecTrkCol->begin() + secondHighestPIPTrackId;
377 double secondHighestPPhi0 = mdcTrk->
phi();
378 h_pIPTrack2DivEb->fill(mdcTrk->
p()/eBeam);
380 if( (*itTrk)->isEmcShowerValid() ) {
382 h_eEMCIPTrack2DivEb->fill(emcChargedTrk->
energy()/eBeam);
385 h_acoplanarity_2HighestPIPTracks->fill(fabs(CLHEP::pi - fabs(highestPPhi0 - secondHighestPPhi0)));
392 int nNeutralTracks = 0, nNeutralTracksGT30MeV = 0;
393 double totalNeutralEnergy = 0;
394 double totalNeutralPX = 0, totalNeutralPY = 0, totalNeutralPZ = 0;
396 for(
int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
398 if(!(*itTrk)->isEmcShowerValid())
continue;
402 double eraw = emcTrk->
energy();
403 if(eraw > 0.030) nNeutralTracksGT30MeV++;
405 totalVisibleEnergy += eraw;
406 totalEMCEnergy += eraw;
407 totalNeutralEnergy += eraw;
409 double theta = emcTrk->
theta();
410 double phi = emcTrk->
phi();
412 double pX = eraw*
cos(phi)*
sin(theta);
413 double pY = eraw*
sin(phi)*
sin(theta);
414 double pZ = eraw*
cos(theta);
416 totalNeutralPX += pX;
417 totalNeutralPY += pY;
418 totalNeutralPZ += pZ;
421 if(nNeutralTracks == 1) h_eEMCShower1DivEb->fill(eraw/eBeam);
422 if(nNeutralTracks == 2) h_eEMCShower2DivEb->fill(eraw/eBeam);
423 if(nNeutralTracks == 3) h_eEMCShower3DivEb->fill(eraw/eBeam);
431 h_nChargedTracks->fill(nChargedTracks);
432 h_nChargedTracksIP->fill(nChargedTracksIP);
434 h_netCharge->fill(nCharge);
435 h_netChargeIP->fill(nChargeIP);
437 h_nNeutralTracks->fill(nNeutralTracks);
438 h_nNeutralTracksGT30MeV->fill(nNeutralTracksGT30MeV);
442 h_eVisibleDivEcm->fill(totalVisibleEnergy/m_ecm);
443 h_eEMCDivEcm->fill(totalEMCEnergy/m_ecm);
444 h_eNeutralDivEcm ->fill(totalNeutralEnergy/m_ecm);
445 h_eChargedDivEcm->fill(totalChargedEnergy/m_ecm);
449 double totalChargedPXY = sqrt(totalChargedPX*totalChargedPX + totalChargedPY*totalChargedPY);
450 double totalChargedP = sqrt(totalChargedPXY*totalChargedPXY + totalChargedPZ*totalChargedPZ);
452 h_netMomentumDivEcm_AllChargedTracks->fill(totalChargedP/m_ecm);
453 h_netTransMomentumDivEcm_AllChargedTracks->fill(totalChargedPXY/m_ecm);
454 if(totalChargedP > 0) {
455 h_cosTheta_AllChargedTracks->fill(totalChargedPZ/totalChargedP);
457 if(nChargedTracks > 0) {
458 log << MSG::INFO <<
"Run " << run <<
", event " <<
event
459 <<
": totalChargedP <= 0! " << endmsg;
465 double totalNeutralPXY = sqrt(totalNeutralPX*totalNeutralPX + totalNeutralPY*totalNeutralPY);
466 double totalNeutralP = sqrt(totalNeutralPXY*totalNeutralPXY + totalNeutralPZ*totalNeutralPZ);
468 h_netMomentumDivEcm_AllNeutralTracks->fill(totalNeutralP/m_ecm);
469 h_netTransMomentumDivEcm_AllNeutralTracks->fill(totalNeutralPXY/m_ecm);
470 if(totalNeutralP > 0) {
471 h_cosTheta_AllNeutralTracks->fill(totalNeutralPZ/totalNeutralP);
473 if(nNeutralTracks > 0) {
474 log << MSG::INFO <<
"Run " << run <<
", event " <<
event
475 <<
": totalNeutralP <= 0! " << endmsg;
480 double totalEventPX = totalChargedPX + totalNeutralPX;
481 double totalEventPY = totalChargedPY + totalNeutralPY;
482 double totalEventPZ = totalChargedPZ + totalNeutralPZ;
484 double totalEventPXY = sqrt(totalEventPX*totalEventPX + totalEventPY*totalEventPY);
485 double totalEventP = sqrt(totalEventPXY*totalEventPXY + totalEventPZ*totalEventPZ);
487 h_netMomentumDivEcm_AllTracks->fill(totalEventP/m_ecm);
488 h_netTransMomentumDivEcm_AllTracks->fill(totalEventPXY/m_ecm);
489 if(totalEventP > 0) {
490 h_cosTheta_AllTracks->fill(totalEventPZ/totalEventP);
492 log << MSG::INFO <<
"Run " << run <<
", event " <<
event
493 <<
": totalEventP <= 0! " << endmsg;
498 SmartDataPtr<EvtRecVeeVertexCol> evtRecVeeVertexCol(eventSvc(),
"/Event/EvtRec/EvtRecVeeVertexCol");
499 if ( ! evtRecVeeVertexCol ) {
500 log << MSG::FATAL <<
"Could not find EvtRecVeeVertexCol" << endreq;
501 return StatusCode::FAILURE;
505 int numKs = 0, numLambda = 0;
506 for(EvtRecVeeVertexCol::iterator veeItr = evtRecVeeVertexCol->begin();
507 veeItr < evtRecVeeVertexCol->end(); veeItr++){
509 h_ksMass->fill((*veeItr)->mass());
510 if(fabs((*veeItr)->mass() -
mKs) < 0.010) ++numKs;
512 h_lambdaMass->fill((*veeItr)->mass());
513 if(fabs((*veeItr)->mass() -
mLambda) < 0.010) ++numLambda;
518 h_nLambda->fill(numLambda);
521 return StatusCode::SUCCESS;