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 | *
|
---|
13 | * $Date: 2009-02-13 19:38:03 $
|
---|
14 | * $Revision: 1.9 $
|
---|
15 | *
|
---|
16 | *
|
---|
17 | * \author S. Ovyn - UCL, Louvain-la-Neuve
|
---|
18 | *
|
---|
19 | */
|
---|
20 |
|
---|
21 | #include "BlockClasses.h"
|
---|
22 | #include "BlockCompare.h"
|
---|
23 | #include "TLorentzVector.h"
|
---|
24 | #include <cmath>
|
---|
25 |
|
---|
26 | TCompare *TRootGenParticle::fgCompare = 0;
|
---|
27 | TCompare *TRootElectron::fgCompare = TComparePT<TRootElectron>::Instance();
|
---|
28 | TCompare *TRootMuon::fgCompare = TComparePT<TRootMuon>::Instance();
|
---|
29 | TCompare *TRootPhoton::fgCompare = TComparePT<TRootPhoton>::Instance();
|
---|
30 | TCompare *TRootTauJet::fgCompare = TComparePT<TRootTauJet>::Instance();
|
---|
31 | TCompare *TRootJet::fgCompare = TComparePT<TRootJet>::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;
|
---|
40 | TCompare *TRootTrigger::fgCompare =0;
|
---|
41 | //TCompare *D_CaloTower::fgCompare=0;
|
---|
42 | TCompare *D_Track::fgCompare=0;
|
---|
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 | }
|
---|
53 |
|
---|
54 | void TRootTauJet::Set(const TLorentzVector& momentum) {
|
---|
55 |
|
---|
56 | E = momentum.E();
|
---|
57 | Px = momentum.Px();
|
---|
58 | Py = momentum.Py();
|
---|
59 | Pz = momentum.Pz();
|
---|
60 | PT = momentum.Pt();
|
---|
61 | Eta = momentum.Eta();
|
---|
62 | Phi = momentum.Phi();
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 | void TRootParticle::Set(const float px, const float py, const float pz, const float e) {
|
---|
67 | TLorentzVector toFill;
|
---|
68 | toFill.SetPxPyPzE(px,py,pz,e);
|
---|
69 | E = e;
|
---|
70 | Px = px;
|
---|
71 | Py = py;
|
---|
72 | Pz = pz;
|
---|
73 | PT = toFill.Pt();
|
---|
74 | Eta = toFill.Eta();
|
---|
75 | Phi = toFill.Phi();
|
---|
76 | }
|
---|
77 |
|
---|
78 | void TRootParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
|
---|
79 | Eta = eta; Phi = phi; E = e; PT = et;
|
---|
80 | //float theta = 2* atan(exp(-Eta);
|
---|
81 | Px = PT*cos(Phi);
|
---|
82 | Py = PT*sin(Phi);
|
---|
83 | }
|
---|
84 |
|
---|
85 |
|
---|
86 | void TRootGenParticle::setFractions() {
|
---|
87 | switch(abs(PID)) {
|
---|
88 | default: _Fem = 0; _Fhad=1; break;
|
---|
89 | case(pE):
|
---|
90 | case(pGAMMA):
|
---|
91 | case(pPI0):
|
---|
92 | _Fem = 1; _Fhad=0; break;
|
---|
93 | case(pNU1):
|
---|
94 | case(pNU2):
|
---|
95 | case(pNU3):
|
---|
96 | case(pMU):
|
---|
97 | _Fem =0; _Fhad=0; break;
|
---|
98 | case(pK0S):
|
---|
99 | case(pLAMBDA):
|
---|
100 | _Fem=0.3; _Fhad=0.7; break;
|
---|
101 | }
|
---|
102 | _initialised=true;
|
---|
103 | }
|
---|
104 |
|
---|
105 | float Eta, Phi; // (eta,phi) at the beginning of the track
|
---|
106 | float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
|
---|
107 | float PT, E, Px, Py, Pz;
|
---|
108 |
|
---|
109 | D_Track::D_Track() :
|
---|
110 | Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
|
---|
111 | PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED) {}
|
---|
112 |
|
---|
113 | D_Track::D_Track(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
|
---|
114 | Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
|
---|
115 | PT(pt) {
|
---|
116 | TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
|
---|
117 | Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
|
---|
118 | }
|
---|
119 |
|
---|
120 | D_Track::D_Track(const D_Track& track) :
|
---|
121 | Eta(track.Eta), Phi(track.Phi),
|
---|
122 | EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
|
---|
123 | PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz) {}
|
---|
124 |
|
---|
125 | D_Track& D_Track::operator=(const D_Track& track) {
|
---|
126 | if(this == &track) return *this;
|
---|
127 | Eta = track.Eta; Phi = track.Phi;
|
---|
128 | EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
|
---|
129 | PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
|
---|
130 | return *this;
|
---|
131 | }
|
---|
132 |
|
---|
133 | void D_Track::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) {
|
---|
134 | Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
|
---|
135 | TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
|
---|
136 | Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
|
---|
137 | }
|
---|
138 |
|
---|
139 | const TLorentzVector D_Track::GetFourVector() const {
|
---|
140 | TLorentzVector v;
|
---|
141 | v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
|
---|
142 | return TLorentzVector(v);
|
---|
143 | }
|
---|
144 |
|
---|
145 | TRootCalo::TRootCalo() :
|
---|
146 | E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
|
---|
147 | //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
|
---|
148 |
|
---|
149 | TRootCalo::TRootCalo(const TRootCalo& cal) {
|
---|
150 | E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
|
---|
151 | //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
|
---|
152 | }
|
---|
153 |
|
---|
154 | TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
|
---|
155 | if(this==&cal) return *this;
|
---|
156 | Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
|
---|
157 | return *this;
|
---|
158 | }
|
---|
159 |
|
---|
160 | void TRootCalo::set(const D_CaloTower& cal) {
|
---|
161 | Eta =cal.getEta(); Phi=cal.getPhi();
|
---|
162 | E_em=cal.getEem(); E_had=cal.getEhad();
|
---|
163 | E =cal.getE(); ET =cal.getET();
|
---|
164 | //EtaCalo = cal.getEta();
|
---|
165 | //PhiCalo = cal.getPhi();
|
---|
166 | }
|
---|
167 |
|
---|
168 |
|
---|
169 | TRootTracks::TRootTracks(const D_Track& track) :
|
---|
170 | E(track.getE()), Px(track.getPx()), Py(track.getPy()), Pz(track.getPz()),
|
---|
171 | Eta(track.getEta()), Phi(track.getPhi()),
|
---|
172 | /*Etaout(track.getEtaOuter()),*/ EtaCalo(track.getEtaOuter()), /*Phiout(track.getPhiOuter()),*/ PhiCalo(track.getPhiOuter()) {}
|
---|
173 |
|
---|