[3] | 1 | /** \class BlockClasses
|
---|
| 2 | *
|
---|
| 3 | * Initialization of static fgCompare functions. At the moment a number of
|
---|
| 4 | * functions TCompare*** are implemented (see BlockCompare.h).
|
---|
| 5 | * Function TCompareXX sorts objects
|
---|
| 6 | * by the variable "XX" that MUST be present in the data members of the
|
---|
| 7 | * Block TRoot class.
|
---|
| 8 | * By default most objects are sorted by PT or ET.
|
---|
| 9 | * Only calorimeter cells and basic cluster are sorted by E
|
---|
| 10 | * TRootGenParticle particle is not sorted by default
|
---|
| 11 | * to preserve mother-dautherlinks between particles.
|
---|
| 12 | *
|
---|
[264] | 13 | * $Date: 2009-02-11 09:19:14 $
|
---|
| 14 | * $Revision: 1.8 $
|
---|
[3] | 15 | *
|
---|
| 16 | *
|
---|
| 17 | * \author S. Ovyn - UCL, Louvain-la-Neuve
|
---|
| 18 | *
|
---|
| 19 | */
|
---|
| 20 |
|
---|
[220] | 21 | #include "BlockClasses.h"
|
---|
| 22 | #include "BlockCompare.h"
|
---|
[73] | 23 | #include "TLorentzVector.h"
|
---|
[264] | 24 | #include <cmath>
|
---|
[73] | 25 |
|
---|
[3] | 26 | TCompare *TRootGenParticle::fgCompare = 0;
|
---|
| 27 | TCompare *TRootJet::fgCompare = TComparePT<TRootJet>::Instance();
|
---|
| 28 | TCompare *TRootElectron::fgCompare = TComparePT<TRootElectron>::Instance();
|
---|
| 29 | TCompare *TRootMuon::fgCompare = TComparePT<TRootMuon>::Instance();
|
---|
| 30 | TCompare *TRootPhoton::fgCompare = TComparePT<TRootPhoton>::Instance();
|
---|
| 31 | TCompare *TRootTauJet::fgCompare = TComparePT<TRootTauJet>::Instance();
|
---|
| 32 | TCompare *TRootTracks::fgCompare = TComparePT<TRootTracks>::Instance();
|
---|
| 33 | TCompare *TRootETmis::fgCompare = 0;
|
---|
| 34 | TCompare *TRootCalo::fgCompare = 0;
|
---|
| 35 | TCompare *TRootZdcHits::fgCompare = 0;
|
---|
| 36 | TCompare *TRootGenEvent:: fgCompare = 0;
|
---|
| 37 | TCompare *TRootParticle::fgCompare=0;
|
---|
| 38 | TCompare *TRootLHEFParticle::fgCompare = 0;
|
---|
| 39 | TCompare *TRootRomanPotHits::fgCompare =0;
|
---|
[67] | 40 | TCompare *TRootTrigger::fgCompare =0;
|
---|
[264] | 41 | //TCompare *D_CaloTower::fgCompare=0;
|
---|
| 42 | TCompare *D_Track::fgCompare=0;
|
---|
[3] | 43 |
|
---|
| 44 | void TRootParticle::Set(const TLorentzVector& momentum) {
|
---|
| 45 | E = momentum.E();
|
---|
| 46 | Px = momentum.Px();
|
---|
| 47 | Py = momentum.Py();
|
---|
| 48 | Pz = momentum.Pz();
|
---|
| 49 | PT = momentum.Pt();
|
---|
| 50 | Eta = momentum.Eta();
|
---|
| 51 | Phi = momentum.Phi();
|
---|
| 52 | }
|
---|
[85] | 53 |
|
---|
[176] | 54 | void TRootParticle::Set(const float px, const float py, const float pz, const float e) {
|
---|
[73] | 55 | TLorentzVector toFill;
|
---|
| 56 | toFill.SetPxPyPzE(px,py,pz,e);
|
---|
| 57 | E = e;
|
---|
| 58 | Px = px;
|
---|
| 59 | Py = py;
|
---|
| 60 | Pz = pz;
|
---|
| 61 | PT = toFill.Pt();
|
---|
| 62 | Eta = toFill.Eta();
|
---|
| 63 | Phi = toFill.Phi();
|
---|
| 64 | }
|
---|
[3] | 65 |
|
---|
[264] | 66 | void TRootParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
|
---|
| 67 | Eta = eta; Phi = phi; E = e; PT = et;
|
---|
| 68 | //float theta = 2* atan(exp(-Eta);
|
---|
| 69 | Px = PT*cos(Phi);
|
---|
| 70 | Py = PT*sin(Phi);
|
---|
| 71 | }
|
---|
[73] | 72 |
|
---|
[264] | 73 |
|
---|
| 74 | void TRootGenParticle::setFractions() {
|
---|
| 75 | switch(abs(PID)) {
|
---|
| 76 | default: _Fem = 0; _Fhad=1; break;
|
---|
| 77 | case(pE):
|
---|
| 78 | case(pGAMMA):
|
---|
| 79 | case(pPI0):
|
---|
| 80 | _Fem = 1; _Fhad=0; break;
|
---|
| 81 | case(pNU1):
|
---|
| 82 | case(pNU2):
|
---|
| 83 | case(pNU3):
|
---|
| 84 | case(pMU):
|
---|
| 85 | _Fem =0; _Fhad=0; break;
|
---|
| 86 | case(pK0S):
|
---|
| 87 | case(pLAMBDA):
|
---|
| 88 | _Fem=0.3; _Fhad=0.7; break;
|
---|
| 89 | }
|
---|
| 90 | _initialised=true;
|
---|
| 91 | }
|
---|
| 92 |
|
---|
| 93 | float Eta, Phi; // (eta,phi) at the beginning of the track
|
---|
| 94 | float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
|
---|
| 95 | float PT, E, Px, Py, Pz;
|
---|
| 96 |
|
---|
| 97 | D_Track::D_Track() :
|
---|
| 98 | Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
|
---|
| 99 | PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED) {}
|
---|
| 100 |
|
---|
| 101 | D_Track::D_Track(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
|
---|
| 102 | Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
|
---|
| 103 | PT(pt) {
|
---|
| 104 | TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
|
---|
| 105 | Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | D_Track::D_Track(const D_Track& track) :
|
---|
| 109 | Eta(track.Eta), Phi(track.Phi),
|
---|
| 110 | EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
|
---|
| 111 | PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz) {}
|
---|
| 112 |
|
---|
| 113 | D_Track& D_Track::operator=(const D_Track& track) {
|
---|
| 114 | if(this == &track) return *this;
|
---|
| 115 | Eta = track.Eta; Phi = track.Phi;
|
---|
| 116 | EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
|
---|
| 117 | PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
|
---|
| 118 | return *this;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | void D_Track::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) {
|
---|
| 122 | Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
|
---|
| 123 | TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
|
---|
| 124 | Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | const TLorentzVector D_Track::GetFourVector() const {
|
---|
| 128 | TLorentzVector v;
|
---|
| 129 | v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
|
---|
| 130 | return TLorentzVector(v);
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | TRootCalo::TRootCalo() :
|
---|
| 134 | E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
|
---|
| 135 | //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
|
---|
| 136 |
|
---|
| 137 | TRootCalo::TRootCalo(const TRootCalo& cal) {
|
---|
| 138 | E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
|
---|
| 139 | //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
|
---|
| 143 | if(this==&cal) return *this;
|
---|
| 144 | Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
|
---|
| 145 | return *this;
|
---|
| 146 | }
|
---|
| 147 |
|
---|
| 148 | void TRootCalo::set(const D_CaloTower& cal) {
|
---|
| 149 | Eta =cal.getEta(); Phi=cal.getPhi();
|
---|
| 150 | E_em=cal.getEem(); E_had=cal.getEhad();
|
---|
| 151 | E =cal.getE(); ET =cal.getET();
|
---|
| 152 | EtaCalo = cal.getEta();
|
---|
| 153 | PhiCalo = cal.getPhi();
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 |
|
---|
| 157 | TRootTracks::TRootTracks(const D_Track& track) :
|
---|
| 158 | E(track.getE()), Px(track.getPx()), Py(track.getPy()), Pz(track.getPz()),
|
---|
| 159 | Eta(track.getEta()), Phi(track.getPhi()),
|
---|
| 160 | /*Etaout(track.getEtaOuter()),*/ EtaCalo(track.getEtaOuter()), /*Phiout(track.getPhiOuter()),*/ PhiCalo(track.getPhiOuter()) {}
|
---|
| 161 |
|
---|