173 {
174
175 double eBeam = m_ecm/2;
176
177 MsgStream log(
msgSvc(), name());
178 log << MSG::INFO << "in execute()" << endreq;
179
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;
184
186 log << MSG::DEBUG <<"ncharg, nneu, tottks = "
187 << evtRecEvent->totalCharged() << " , "
188 << evtRecEvent->totalNeutral() << " , "
189 << evtRecEvent->totalTracks() <<endreq;
190
192
193
194
195
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;
200
201 double highestIPTrackP = -1, secondHighestIPTrackP = -2;
202 int highestPIPTrackId = -1, secondHighestPIPTrackId = -1;
203
204
205 for(int i = 0; i < evtRecEvent->totalCharged(); i++){
207 if(!(*itTrk)->isMdcTrackValid()) continue;
209
210 int trackId = mdcTrk->
trackId();
212 double r0 = mdcTrk->
r();
213 double z0 = mdcTrk->
z();
214 h_trackR0->fill(r0);
215 h_trackZ0->fill(z0);
216
217 nChargedTracks++;
219
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();
226
227 double chargedEnergy = sqrt(pMag*pMag +
mPi*
mPi);
228 totalVisibleEnergy += chargedEnergy;
229 totalChargedEnergy += chargedEnergy;
230
231 totalChargedPX += pX;
232 totalChargedPY += pY;
233 totalChargedPZ += pZ;
234
235
236 if( (*itTrk)->isEmcShowerValid() ) {
238 totalEMCEnergy += emcChargedTrk->
energy();
239 }
240
241
242 if( (*itTrk)->isMucTrackValid() ) {
244 double mucDepth = mucTrk->
depth();
245 if(mucDepth > 0) {
246 h_mucDepth->fill(mucDepth);
247 h_mucDepthVsCosTheta->fill(cosTheta,mucDepth);
248 h_mucDepthVsPhi->fill(phi,mucDepth);
249 }
250 }
251
252
253
254
255 if(fabs(z0) >= m_vz0cut) continue;
256 if(r0 >= m_vr0cut) continue;
257
258 nChargedTracksIP++;
260
261
262 double dedxProbPH = -10;
263 int dedxNumTotalHits = -10;
264 int dedxNumGoodHits = -10;
265
266 if( (*itTrk)->isMdcDedxValid() ) {
268
271 h_dedxTotalHitsIP->fill(dedxNumTotalHits);
272 h_dedxGoodHitsIP->fill(dedxNumGoodHits);
273
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());
279
280 dedxProbPH = dedxTrk->
probPH();
281 h_dedxProbPHIP->fill(dedxProbPH);
282 h_dedxProbPHVsMomentumIP->fill(pMag,dedxProbPH);
283
284 }
285
286
287 if( (*itTrk)->isTofTrackValid() ) {
288 SmartRefVector<RecTofTrack> tofTrkCol = (*itTrk)->tofTrack();
289 SmartRefVector<RecTofTrack>::iterator iter_tof = tofTrkCol.begin();
290
291 for(;iter_tof != tofTrkCol.end(); iter_tof++ ) {
293 status->
setStatus((*iter_tof)->status());
294
297
298 double tofPH = (*iter_tof)->ph();
299 double tof = (*iter_tof)->tof();
300
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);
307
308 if( status->
layer() == 1 ) {
309 h_tofPHIP_BarrelLayer1->fill(tofPH);
310 h_tofIP_BarrelLayer1->fill(tof);
311 }
312 if( status->
layer() == 2 ) {
313 h_tofPHIP_BarrelLayer2->fill(tofPH);
314 h_tofIP_BarrelLayer2->fill(tof);
315 }
316 }
317
318 else {
320
321 double tofPH = (*iter_tof)->ph();
322 double tof = (*iter_tof)->tof();
323
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);
330
332 h_tofPHIP_EastEndcap->fill(tofPH);
333 h_tofIP_EastEndcap->fill(tof);
334 }
335 else {
336 h_tofPHIP_WestEndcap->fill(tofPH);
337 h_tofIP_WestEndcap->fill(tof);
338 }
339 }
340
341 }
342 }
343
344
345
346 if(pMag > highestIPTrackP) {
347 secondHighestPIPTrackId = highestPIPTrackId;
348 secondHighestIPTrackP = highestIPTrackP;
349 highestPIPTrackId = trackId;
350 highestIPTrackP = pMag;
351 }
352 if((pMag > secondHighestIPTrackP)&&(pMag < highestIPTrackP)) {
353 secondHighestPIPTrackId = trackId;
354 secondHighestIPTrackP = pMag;
355 }
356
357 }
358
359
360
361
362 if(nChargedTracksIP > 0) {
365 double highestPPhi0 = mdcTrk->
phi();
366 h_pIPTrack1DivEb->fill(mdcTrk->
p()/eBeam);
367
368 if( (*itTrk)->isEmcShowerValid() ) {
370 h_eEMCIPTrack1DivEb->fill(emcChargedTrk->
energy()/eBeam);
371 }
372
373
374 if(nChargedTracksIP > 1) {
375 itTrk = evtRecTrkCol->begin() + secondHighestPIPTrackId;
377 double secondHighestPPhi0 = mdcTrk->
phi();
378 h_pIPTrack2DivEb->fill(mdcTrk->
p()/eBeam);
379
380 if( (*itTrk)->isEmcShowerValid() ) {
382 h_eEMCIPTrack2DivEb->fill(emcChargedTrk->
energy()/eBeam);
383 }
384
385 h_acoplanarity_2HighestPIPTracks->fill(fabs(CLHEP::pi - fabs(highestPPhi0 - secondHighestPPhi0)));
386 }
387 }
388
389
390
391
392 int nNeutralTracks = 0, nNeutralTracksGT30MeV = 0;
393 double totalNeutralEnergy = 0;
394 double totalNeutralPX = 0, totalNeutralPY = 0, totalNeutralPZ = 0;
395
396 for(int i = evtRecEvent->totalCharged(); i< evtRecEvent->totalTracks(); i++) {
398 if(!(*itTrk)->isEmcShowerValid()) continue;
400
401 nNeutralTracks++;
402 double eraw = emcTrk->
energy();
403 if(eraw > 0.030) nNeutralTracksGT30MeV++;
404
405 totalVisibleEnergy += eraw;
406 totalEMCEnergy += eraw;
407 totalNeutralEnergy += eraw;
408
409 double theta = emcTrk->
theta();
410 double phi = emcTrk->
phi();
411
412 double pX = eraw*
cos(phi)*
sin(theta);
413 double pY = eraw*
sin(phi)*
sin(theta);
414 double pZ = eraw*
cos(theta);
415
416 totalNeutralPX += pX;
417 totalNeutralPY += pY;
418 totalNeutralPZ += pZ;
419
420
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);
424
425 }
426
427
428
429
430
431 h_nChargedTracks->fill(nChargedTracks);
432 h_nChargedTracksIP->fill(nChargedTracksIP);
433
434 h_netCharge->fill(nCharge);
435 h_netChargeIP->fill(nChargeIP);
436
437 h_nNeutralTracks->fill(nNeutralTracks);
438 h_nNeutralTracksGT30MeV->fill(nNeutralTracksGT30MeV);
439
440
441
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);
446
447
448
449 double totalChargedPXY = sqrt(totalChargedPX*totalChargedPX + totalChargedPY*totalChargedPY);
450 double totalChargedP = sqrt(totalChargedPXY*totalChargedPXY + totalChargedPZ*totalChargedPZ);
451
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);
456 } else {
457 if(nChargedTracks > 0) {
458 log << MSG::INFO << "Run " << run << ", event " << event
459 << ": totalChargedP <= 0! " << endmsg;
460 }
461 }
462
463
464
465 double totalNeutralPXY = sqrt(totalNeutralPX*totalNeutralPX + totalNeutralPY*totalNeutralPY);
466 double totalNeutralP = sqrt(totalNeutralPXY*totalNeutralPXY + totalNeutralPZ*totalNeutralPZ);
467
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);
472 } else {
473 if(nNeutralTracks > 0) {
474 log << MSG::INFO << "Run " << run << ", event " << event
475 << ": totalNeutralP <= 0! " << endmsg;
476 }
477 }
478
479
480 double totalEventPX = totalChargedPX + totalNeutralPX;
481 double totalEventPY = totalChargedPY + totalNeutralPY;
482 double totalEventPZ = totalChargedPZ + totalNeutralPZ;
483
484 double totalEventPXY = sqrt(totalEventPX*totalEventPX + totalEventPY*totalEventPY);
485 double totalEventP = sqrt(totalEventPXY*totalEventPXY + totalEventPZ*totalEventPZ);
486
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);
491 } else {
492 log << MSG::INFO << "Run " << run << ", event " << event
493 << ": totalEventP <= 0! " << endmsg;
494 }
495
496
497
498 SmartDataPtr<EvtRecVeeVertexCol> evtRecVeeVertexCol(eventSvc(), "/Event/EvtRec/EvtRecVeeVertexCol");
499 if ( ! evtRecVeeVertexCol ) {
500 log << MSG::FATAL << "Could not find EvtRecVeeVertexCol" << endreq;
501 return StatusCode::FAILURE;
502 }
503
504
505 int numKs = 0, numLambda = 0;
506 for(EvtRecVeeVertexCol::iterator veeItr = evtRecVeeVertexCol->begin();
507 veeItr < evtRecVeeVertexCol->end(); veeItr++){
508
509 h_ksMass->fill((*veeItr)->mass());
510 if(fabs((*veeItr)->mass() -
mKs) < 0.010) ++numKs;
511
512 h_lambdaMass->fill((*veeItr)->mass());
513 if(fabs((*veeItr)->mass() -
mLambda) < 0.010) ++numLambda;
514
515 }
516
517 h_nKs->fill(numKs);
518 h_nLambda->fill(numLambda);
519
520
521 return StatusCode::SUCCESS;
522}
double sin(const BesAngle a)
double cos(const BesAngle a)
EvtRecTrackCol::iterator EvtRecTrackIterator
const double theta() const
const int trackId() const
unsigned int layer() const
void setStatus(unsigned int status)
_EXTERN_ std::string EvtRecEvent
_EXTERN_ std::string EvtRecTrackCol