65 #include "StPeCPair.h"
66 #include "StEventTypes.h"
67 #include "StEmcUtil/geometry/StEmcGeom.h"
68 #include "StEmcUtil/projection/StEmcPosition.h"
69 #include "StEmcUtil/filters/StEmcFilter.h"
70 #include "StEmcUtil/geometry/StEmcGeom.h"
71 #include "StEmcUtil/others/emcDetectorName.h"
72 #include "St_geant_Maker/St_geant_Maker.h"
81 StPeCPair::~StPeCPair() {
84 void StPeCPair::Clear(
const char *) {
116 Bool_t primaryFlag,
StEvent* event ) {
119 if(trk1->geometry()->charge() < 0 && trk2->geometry()->charge()>0 ) {
128 fill ( primaryFlag, event ) ;
139 pairTOFgeoLocal = pairTOFgeo;
141 bFld=
event->eventSummary().magneticField()/10.;
154 fill ( primaryFlag, event ) ;
165 bFld=
event->eventSummary().magneticField()/10.;
166 pairTOFgeoLocal = pairTOFgeo;
167 cout<<
" StPeCPair StEvent StMuEvent ************ Mag field from summary: "<<bFld<<
" TOF geometry pointer: "<<pairTOFgeo<<endl;
190 fill ( primaryFlag, event, eventP ) ;
195 void StPeCPair::setTrack1(
StTrack* trk) {
198 void StPeCPair::setTrack2(
StTrack* trk) {
202 void StPeCPair::setTrack1(
StMuTrack* trk) {
205 void StPeCPair::setTrack2(
StMuTrack* trk) {
209 StTrack* StPeCPair::getTrack1() {
return track1; }
210 StTrack* StPeCPair::getTrack2() {
return track2; }
212 StMuTrack* StPeCPair::getMuTrack1() {
return muTrack1; }
213 StMuTrack* StPeCPair::getMuTrack2() {
return muTrack2; }
217 if ( pid == 0 )
return pionH.Mom4 ;
218 else if ( pid == 1 )
return kaonH.Mom4 ;
219 else if ( pid == 2 )
return protonH.Mom4 ;
220 else if ( pid == 3 )
return electronH.Mom4 ;
221 else if ( pid == 4 )
return muonH.Mom4 ;
223 printf (
"StPeCPair::getPair4Momentum: wrong pid %d \n", pid ) ;
231 Int_t StPeCPair::fill ( Bool_t primaryFlag,
StEventSummary* summary,
251 if ( summary != 0 ) bField = summary->magneticField();
255 if ( !primaryFlag ) {
256 p1 = h1.momentumAt(dcaLengths.first, tesla*bField*0.1 ) ;
257 p2 = h2.momentumAt(dcaLengths.second, tesla*bField*0.1 ) ;
275 pV0Dca = v0Helix.distance ( primaryVertexPosition ) ;
283 Float_t ScalarProduct = p1*p2;
284 Float_t Denominator = p1.mag()*p2.mag();
286 pAngle = acos(ScalarProduct/Denominator);
290 if (p1.perp() * p2.perp()) {
291 pXyAngle = acos((p1.x()*p2.x()+p1.y()*p2.y())/p1.perp()/p2.perp());
298 Float_t p1AlongPtot = p*p1/p.mag() ;
299 Float_t p2AlongPtot = p*p2/p.mag() ;
301 Float_t pt1Ptot = ::sqrt(p1.mag()*p1.mag()-p1AlongPtot*p1AlongPtot);
304 pAlpha = (p1AlongPtot-p2AlongPtot)/(p1AlongPtot+p2AlongPtot);
311 Float_t mInv, cosThetaStar ;
314 for (
int i = 0 ; i < nSpecies ; i++ )
317 mptcle = pion_plus_mass_c2;
320 else if ( i == kaon ) {
321 mptcle = 493.677*MeV;
324 else if ( i == proton ) {
325 mptcle = proton_mass_c2;
328 else if ( i == electron ) {
329 mptcle = electron_mass_c2;
330 species = &electronH ;
332 else if ( i == muon ) {
333 mptcle = 105.6584*MeV;
337 printf (
"StPecPair:calculatePair4Momentum; wrong pid %d \n", i ) ;
342 Float_t e1 = p1.massHypothesis(mptcle);
343 Float_t e2 = p2.massHypothesis(mptcle);
347 FourMomentum = p4pair ;
365 pf1 = pf1.boost(p4pair);
366 pf2 = pf2.boost(p4pair);
367 Float_t d1th = pf1.cosTheta();
368 Float_t d2th = pf2.cosTheta();
370 if( d1th > 0 ) cosThetaStar = d1th;
371 else cosThetaStar = d2th;
374 species->mInv = mInv ;
375 species->yRap = FourMomentum.rapidity() ;
376 species->Mom4 = FourMomentum ;
377 species->cosThetaStar = cosThetaStar ;
404 Int_t StPeCPair::fill ( Bool_t primaryFlag,
StMuEvent* event ) {
413 short charge1, charge2 ;
418 tr1_bemcModule = -999;
419 tr1_bemcEtabin = -999;
420 tr1_bemcEtaValue = -999;
421 tr1_bemcPhiValue = -999;
423 tr1_bemcEnergy = -999;
424 tr2_bemcModule = -999;
425 tr2_bemcEtabin = -999;
426 tr2_bemcEtaValue = -999;
427 tr2_bemcPhiValue = -999;
429 tr2_bemcEnergy = -999;
431 tr1_bsmdeModule = -999;
432 tr1_bsmdeEtabin = -999;
433 tr1_bsmdeEtaValue = -999;
434 tr1_bsmdePhiValue = -999;
436 tr1_bsmdeEnergy = -999;
437 tr2_bsmdeModule = -999;
438 tr2_bsmdeEtabin = -999;
439 tr2_bsmdeEtaValue = -999;
440 tr2_bsmdePhiValue = -999;
442 tr2_bsmdeEnergy = -999;
444 tr1_timeOfFlight = -999;
445 tr1_pathLength = -999;
447 tr2_timeOfFlight = -999;
448 tr2_pathLength = -999;
451 tr1_extrapolatedTOF_mX = -999;
452 tr1_extrapolatedTOF_mY = -999;
453 tr1_extrapolatedTOF_mZ = -999;
455 tr2_extrapolatedTOF_mX = -999;
456 tr2_extrapolatedTOF_mY = -999;
457 tr2_extrapolatedTOF_mZ = -999;
462 charge1 = muTrack1->
charge();
463 charge2 = muTrack2->
charge();
464 h1 = muTrack1->
helix() ;
465 h2 = muTrack2->
helix() ;
479 fill ( primaryFlag, &(event->eventSummary()),
480 p1, h1, charge1, p2, h2, charge2, vtx ) ;
483 tr1.set(1,muTrack1, event);
484 tr2.set(1,muTrack2, event);
487 tr1_pathLength = mBTofPidTraits_1.pathLength();
488 tr1_Beta = mBTofPidTraits_1.beta();
489 const float a = mBTofPidTraits_1.position().x();
490 const float b = mBTofPidTraits_1.position().y();
491 const float c = mBTofPidTraits_1.position().z();
492 tr1_extrapolatedTOF_mX = a;
493 tr1_extrapolatedTOF_mY = b;
494 tr1_extrapolatedTOF_mZ = c;
497 tr2_pathLength = mBTofPidTraits_2.pathLength();
498 tr2_Beta = mBTofPidTraits_2.beta();
499 const float a2 = mBTofPidTraits_2.position().x();
500 const float b2 = mBTofPidTraits_2.position().y();
501 const float c2 = mBTofPidTraits_2.position().z();
502 tr2_extrapolatedTOF_mX = a2;
503 tr2_extrapolatedTOF_mY = b2;
504 tr2_extrapolatedTOF_mZ = c2;
509 vector<Double_t> pathVec;
545 Int_t StPeCPair::fill ( Bool_t primaryFlag,
StMuEvent* event,
StEvent* eventP ) {
554 short charge1, charge2 ;
560 tr1_bemcModule = -999;
561 tr1_bemcEtabin = -999;
562 tr1_bemcEtaValue = -999;
563 tr1_bemcPhiValue = -999;
565 tr1_bemcEnergy = -999;
566 tr2_bemcModule = -999;
567 tr2_bemcEtabin = -999;
568 tr2_bemcEtaValue = -999;
569 tr2_bemcPhiValue = -999;
571 tr2_bemcEnergy = -999;
573 tr1_bsmdeModule = -999;
574 tr1_bsmdeEtabin = -999;
575 tr1_bsmdeEtaValue = -999;
576 tr1_bsmdePhiValue = -999;
578 tr1_bsmdeEnergy = -999;
579 tr2_bsmdeModule = -999;
580 tr2_bsmdeEtabin = -999;
581 tr2_bsmdeEtaValue = -999;
582 tr2_bsmdePhiValue = -999;
584 tr2_bsmdeEnergy = -999;
586 tr1_timeOfFlight = -999;
587 tr1_pathLength = -999;
589 tr2_timeOfFlight = -999;
590 tr2_pathLength = -999;
593 tr1_extrapolatedTOF_mX = -999;
594 tr1_extrapolatedTOF_mY = -999;
595 tr1_extrapolatedTOF_mZ = -999;
597 tr2_extrapolatedTOF_mX = -999;
598 tr2_extrapolatedTOF_mY = -999;
599 tr2_extrapolatedTOF_mZ = -999;
604 charge1 = muTrack1->
charge();
605 charge2 = muTrack2->
charge();
606 h1 = muTrack1->
helix() ;
607 h2 = muTrack2->
helix() ;
625 cout<<
" in StPeCPair fill "<<
" TOF geo pointer inside fill: "<<pairTOFgeoLocal<<endl;
626 StEmcDetector* EMCdetector = emcStEvent->detector(kBarrelEmcTowerId);
628 {cout<<
"There is no kBarrelSmdEtaStripId Detector ---------"<<endl;}
632 StEmcGeom * mGeom2=StEmcGeom::instance(
"bemc");
633 Bool_t ok=project->
trackOnEmc(&position,&momentum,muTrack1,bFld);
637 mGeom2->
getBin(position.phi(),position.pseudoRapidity(),mod,eta,sub);
641 for(
unsigned int i=1;i<=120;i++)
643 if(fabs(mod)!=i)
continue;
645 StSPtrVecEmcRawHit& hits=module->hits();
646 for(
unsigned int k=0;k<hits.size();k++)
if(hits[k]){
647 unsigned int module=hits[k]->module();
648 unsigned int Eta=hits[k]->eta();
650 int s=fabs(hits[k]->sub());
652 if (module==fabs(mod) && Eta == fabs(eta)){
653 float energyT1=hits[k]->energy();
654 mGeom2->getId(module,Eta,s,did);
656 tr1_bemcModule = module;
657 tr1_bemcEtabin = Eta;
658 tr1_bemcEtaValue = position.pseudoRapidity();
659 tr1_bemcPhiValue = position.phi();
661 tr1_bemcEnergy = energyT1;
668 Bool_t ok2=project->
trackOnEmc(&position,&momentum,muTrack2,bFld);
671 mGeom2->
getBin(position.phi(),position.pseudoRapidity(),mod,eta,sub);
675 for(
unsigned int i=1;i<=120;i++)
677 if(fabs(mod)!=i)
continue;
679 StSPtrVecEmcRawHit& hits=module->hits();
680 for(
unsigned int k=0;k<hits.size();k++)
if(hits[k]){
681 unsigned int module=hits[k]->module();
682 unsigned int Eta=hits[k]->eta();
684 int s=fabs(hits[k]->sub());
686 if (module==fabs(mod) && Eta == fabs(eta)){
687 float energyT1=hits[k]->energy();
688 mGeom2->getId(module,Eta,s,did);
689 tr2_bemcModule = module;
690 tr2_bemcEtabin = Eta;
691 tr2_bemcEtaValue = position.pseudoRapidity();
692 tr2_bemcPhiValue = position.phi();
694 tr2_bemcEnergy = energyT1;
703 StEmcDetector* SMDdetector = emcStEvent->detector(kBarrelSmdEtaStripId);
705 {cout<<
"There is no kBarrelSmdEtaStripId Detector ---------"<<endl;}
707 StEmcGeom * mGeomSmde=StEmcGeom::instance(
"bsmde");
708 Bool_t okSmd=projectSmde->
trackOnEmc(&position,&momentum,muTrack1,bFld);
710 mGeomSmde->
getBin(position.phi(),position.pseudoRapidity(),mod,eta,sub);
714 for(
unsigned int i=1;i<=120;i++)
716 if(fabs(mod)!=i)
continue;
718 StSPtrVecEmcRawHit& hits=module->hits();
719 for(
unsigned int k=0;k<hits.size();k++)
if(hits[k]){
720 unsigned int module=hits[k]->module();
721 unsigned int Eta=hits[k]->eta();
723 int s=fabs(hits[k]->sub());
725 if (module==fabs(mod) && Eta == fabs(eta)){
726 float energyT1=hits[k]->energy();
727 mGeomSmde->getId(module,Eta,s,did);
729 tr1_bsmdeModule = module;
730 tr1_bsmdeEtabin = Eta;
731 tr1_bsmdeEtaValue = position.pseudoRapidity();
732 tr1_bsmdePhiValue = position.phi();
734 tr1_bsmdeEnergy = energyT1;
740 fill ( primaryFlag, &(event->eventSummary()),
741 p1, h1, charge1, p2, h2, charge2, vtx ) ;
744 tr1.set(1,muTrack1, event);
745 tr2.set(1,muTrack2, event);
748 tr1_pathLength = mBTofPidTraits_1.pathLength();
749 tr1_Beta = mBTofPidTraits_1.beta();
751 tr2_pathLength = mBTofPidTraits_2.pathLength();
752 tr2_Beta = mBTofPidTraits_2.beta();
758 vector<Double_t> pathVec;
769 Int_t moduleId = -999;
771 pairTOFgeoLocal->DecodeCellId(idVec[0],cellId,moduleId,trayId);
772 tr1_extrapolatedTOF_mX = crossVec[0].x();
773 tr1_extrapolatedTOF_mY = crossVec[0].y();
774 tr1_extrapolatedTOF_mZ = crossVec[0].z();
775 cout<<
" extrapolated first track"<<endl;
780 Int_t moduleId = -999;
782 pairTOFgeoLocal->DecodeCellId(idVec[0],cellId,moduleId,trayId);
783 tr2_extrapolatedTOF_mX = crossVec[0].x();
784 tr2_extrapolatedTOF_mY = crossVec[0].y();
785 tr2_extrapolatedTOF_mZ = crossVec[0].z();
791 Int_t StPeCPair::fill ( Bool_t primaryFlag,
StEvent* event ) {
793 pCharge = track1->geometry()->charge()+track2->geometry()->charge();
799 short charge1, charge2 ;
801 p1 = track1->geometry()->momentum();
802 p2 = track2->geometry()->momentum();
803 charge1 = track1->geometry()->charge();
804 charge2 = track2->geometry()->charge();
807 h1 = track1->geometry()->helix() ;
808 h2 = track2->geometry()->helix() ;
814 vtx =
event->primaryVertex();
815 summary =
event->summary();
822 vtxP = vtx->position() ;
829 fill ( primaryFlag, summary, p1, h1, charge1, p2, h2, charge2, vtxP ) ;
842 Int_t StPeCPair::getSumCharge()
const{
846 Float_t StPeCPair::getSumPt()
const{
850 Float_t StPeCPair::getSumPz()
const{
854 Float_t StPeCPair::getMInv(StPeCSpecies pid)
const{
855 if ( pid == 0 )
return pionH.mInv ;
856 else if ( pid == 1 )
return kaonH.mInv ;
857 else if ( pid == 2 )
return protonH.mInv ;
858 else if ( pid == 3 )
return electronH.mInv ;
859 else if ( pid == 4 )
return muonH.mInv ;
861 printf (
"StPeCPair::getMInv: wrong pid %d \n", pid ) ;
866 Float_t StPeCPair::getOpeningAngle()
const{
869 Float_t StPeCPair::getCosThetaStar(StPeCSpecies pid)
const{
870 if ( pid == 0 )
return pionH.cosThetaStar ;
871 else if ( pid == 1 )
return kaonH.cosThetaStar ;
872 else if ( pid == 2 )
return protonH.cosThetaStar ;
873 else if ( pid == 3 )
return electronH.cosThetaStar ;
874 else if ( pid == 4 )
return muonH.cosThetaStar ;
876 printf (
"StPeCPair::getCosThetaStar: wrong pid %d \n", pid ) ;
Bool_t trackOnEmc(StThreeVectorD *position, StThreeVectorD *momentum, const StTrack *const track, Double_t magField, Double_t emcRadius=225.405) const
Track projection utility.
Bool_t HelixCrossCellIds(const StHelixD &helix, IntVec &idVec, DoubleVec &pathVec, PointVec &crossVec) const
pair< double, double > pathLengths(const StHelix &, double minStepSize=10 *micrometer, double minRange=10 *centimeter) const
path lengths at dca between two helices
StPhysicalHelixD helix() const
Returns inner helix (first measured point)
Short_t charge() const
Returns charge.
const StThreeVectorF & momentum() const
Returns 3-momentum at dca to primary vertex.
float timeOfFlight() const
timing for PID
Int_t getBin(const Float_t phi, const Float_t eta, Int_t &m, Int_t &e, Int_t &s) const
StPhysicalHelixD outerHelix() const
Returns outer helix (last measured point)