/** \class BlockClasses * * Initialization of static fgCompare functions. At the moment a number of * functions TCompare*** are implemented (see BlockCompare.h). * Function TCompareXX sorts objects * by the variable "XX" that MUST be present in the data members of the * Block TRoot class. * By default most objects are sorted by PT or ET. * Only calorimeter cells and basic cluster are sorted by E * TRootGenParticle particle is not sorted by default * to preserve mother-dautherlinks between particles. * * $Date: 2009-02-11 09:19:14 $ * $Revision: 1.8 $ * * * \author S. Ovyn - UCL, Louvain-la-Neuve * */ #include "BlockClasses.h" #include "BlockCompare.h" #include "TLorentzVector.h" #include TCompare *TRootGenParticle::fgCompare = 0; TCompare *TRootJet::fgCompare = TComparePT::Instance(); TCompare *TRootElectron::fgCompare = TComparePT::Instance(); TCompare *TRootMuon::fgCompare = TComparePT::Instance(); TCompare *TRootPhoton::fgCompare = TComparePT::Instance(); TCompare *TRootTauJet::fgCompare = TComparePT::Instance(); TCompare *TRootTracks::fgCompare = TComparePT::Instance(); TCompare *TRootETmis::fgCompare = 0; TCompare *TRootCalo::fgCompare = 0; TCompare *TRootZdcHits::fgCompare = 0; TCompare *TRootGenEvent:: fgCompare = 0; TCompare *TRootParticle::fgCompare=0; TCompare *TRootLHEFParticle::fgCompare = 0; TCompare *TRootRomanPotHits::fgCompare =0; TCompare *TRootTrigger::fgCompare =0; //TCompare *D_CaloTower::fgCompare=0; TCompare *D_Track::fgCompare=0; void TRootParticle::Set(const TLorentzVector& momentum) { E = momentum.E(); Px = momentum.Px(); Py = momentum.Py(); Pz = momentum.Pz(); PT = momentum.Pt(); Eta = momentum.Eta(); Phi = momentum.Phi(); } void TRootParticle::Set(const float px, const float py, const float pz, const float e) { TLorentzVector toFill; toFill.SetPxPyPzE(px,py,pz,e); E = e; Px = px; Py = py; Pz = pz; PT = toFill.Pt(); Eta = toFill.Eta(); Phi = toFill.Phi(); } void TRootParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) { Eta = eta; Phi = phi; E = e; PT = et; //float theta = 2* atan(exp(-Eta); Px = PT*cos(Phi); Py = PT*sin(Phi); } void TRootGenParticle::setFractions() { switch(abs(PID)) { default: _Fem = 0; _Fhad=1; break; case(pE): case(pGAMMA): case(pPI0): _Fem = 1; _Fhad=0; break; case(pNU1): case(pNU2): case(pNU3): case(pMU): _Fem =0; _Fhad=0; break; case(pK0S): case(pLAMBDA): _Fem=0.3; _Fhad=0.7; break; } _initialised=true; } float Eta, Phi; // (eta,phi) at the beginning of the track float EtaOuter, PhiOuter; // (eta,phi) at the end of the track float PT, E, Px, Py, Pz; D_Track::D_Track() : Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED), PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED) {} D_Track::D_Track(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) : Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi), PT(pt) { TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta)); Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E(); } D_Track::D_Track(const D_Track& track) : Eta(track.Eta), Phi(track.Phi), EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter), PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz) {} D_Track& D_Track::operator=(const D_Track& track) { if(this == &track) return *this; Eta = track.Eta; Phi = track.Phi; EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter; PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz; return *this; } void D_Track::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) { Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt; TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta)); Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E(); } const TLorentzVector D_Track::GetFourVector() const { TLorentzVector v; v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta)); return TLorentzVector(v); } TRootCalo::TRootCalo() : E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {} //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {} TRootCalo::TRootCalo(const TRootCalo& cal) { E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET; //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET; } TRootCalo& TRootCalo::operator=(const TRootCalo& cal) { if(this==&cal) return *this; Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET; return *this; } void TRootCalo::set(const D_CaloTower& cal) { Eta =cal.getEta(); Phi=cal.getPhi(); E_em=cal.getEem(); E_had=cal.getEhad(); E =cal.getE(); ET =cal.getET(); EtaCalo = cal.getEta(); PhiCalo = cal.getPhi(); } TRootTracks::TRootTracks(const D_Track& track) : E(track.getE()), Px(track.getPx()), Py(track.getPy()), Pz(track.getPz()), Eta(track.getEta()), Phi(track.getPhi()), /*Etaout(track.getEtaOuter()),*/ EtaCalo(track.getEtaOuter()), /*Phiout(track.getPhiOuter()),*/ PhiCalo(track.getPhiOuter()) {}