Fork me on GitHub

source: svn/trunk/Utilities/ExRootAnalysis/src/BlockClasses.cc@ 553

Last change on this file since 553 was 550, checked in by severine ovyn, 15 years ago

changements pour EtRatio muons et electrons. Bugge

File size: 9.6 KB
Line 
1/***********************************************************************
2** **
3** /----------------------------------------------\ **
4** | Delphes, a framework for the fast simulation | **
5** | of a generic collider experiment | **
6** \----------------------------------------------/ **
7** **
8** **
9** This package uses: **
10** ------------------ **
11** FastJet algorithm: Phys. Lett. B641 (2006) [hep-ph/0512210] **
12** Hector: JINST 2:P09005 (2007) [physics.acc-ph:0707.1198v2] **
13** FROG: [hep-ex/0901.2718v1] **
14** **
15** ------------------------------------------------------------------ **
16** **
17** Main authors: **
18** ------------- **
19** **
20** Severine Ovyn Xavier Rouby **
21** severine.ovyn@uclouvain.be xavier.rouby@cern **
22** **
23** Center for Particle Physics and Phenomenology (CP3) **
24** Universite catholique de Louvain (UCL) **
25** Louvain-la-Neuve, Belgium **
26** **
27** Copyright (C) 2008-2009, **
28** All rights reserved. **
29** **
30***********************************************************************/
31
32
33#include "BlockClasses.h"
34#include "BlockCompare.h"
35#include "TLorentzVector.h"
36#include <cstdlib> // abs(int)
37
38TCompare *TRootGenParticle::fgCompare = 0;
39TCompare *TRootGenFwdParticle::fgCompare = 0;
40TCompare *TRootC::GenParticle::fgCompare = 0;
41TCompare *TRootElectron::fgCompare = TComparePT<TRootElectron>::Instance();
42TCompare *TRootMuon::fgCompare = TComparePT<TRootMuon>::Instance();
43TCompare *TRootPhoton::fgCompare = TComparePT<TRootPhoton>::Instance();
44TCompare *TRootTauJet::fgCompare = TComparePT<TRootTauJet>::Instance();
45TCompare *TRootJet::fgCompare = TComparePT<TRootJet>::Instance();
46TCompare *TRootTracks::fgCompare = 0;
47TCompare *TRootETmis::fgCompare = 0;
48TCompare *TRootCalo::fgCompare = 0;
49TCompare *TRootZdcHits::fgCompare = 0;
50TCompare *TRootGenEvent:: fgCompare = 0;
51TCompare *TRootParticle::fgCompare=0;
52TCompare *TRootLHEFParticle::fgCompare = 0;
53TCompare *TRootRomanPotHits::fgCompare =0;
54TCompare *TRootForwardTaggerHits::fgCompare =0;
55TCompare *TRootTrigger::fgCompare =0;
56
57void TRootParticle::Set(const TLorentzVector& momentum) {
58 E = momentum.E();
59 Px = momentum.Px();
60 Py = momentum.Py();
61 Pz = momentum.Pz();
62 PT = momentum.Pt();
63 Eta = momentum.Eta();
64 Phi = momentum.Phi();
65}
66
67void TRootGenFwdParticle::Set(const TLorentzVector& momentum) {
68 genE = momentum.E();
69 genPx = momentum.Px();
70 genPy = momentum.Py();
71 genPz = momentum.Pz();
72 genPT = momentum.Pt();
73 genEta = momentum.Eta();
74 genPhi = momentum.Phi();
75}
76
77
78void TRootTauJet::Set(const TLorentzVector& momentum) {
79
80 E = momentum.E();
81 Px = momentum.Px();
82 Py = momentum.Py();
83 Pz = momentum.Pz();
84 PT = momentum.Pt();
85 Eta = momentum.Eta();
86 Phi = momentum.Phi();
87
88}
89
90void TRootParticle::Set(const float px, const float py, const float pz, const float e) {
91 TLorentzVector toFill;
92 toFill.SetPxPyPzE(px,py,pz,e);
93 E = e;
94 Px = px;
95 Py = py;
96 Pz = pz;
97 PT = toFill.Pt();
98 Eta = toFill.Eta();
99 Phi = toFill.Phi();
100}
101
102void TRootGenFwdParticle::Set(const float px, const float py, const float pz, const float e) {
103 TLorentzVector toFill;
104 toFill.SetPxPyPzE(px,py,pz,e);
105 genE = e;
106 genPx = px;
107 genPy = py;
108 genPz = pz;
109 genPT = toFill.Pt();
110 genEta = toFill.Eta();
111 genPhi = toFill.Phi();
112}
113
114
115void TRootParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
116 Eta = eta; Phi = phi; E = e; PT = et;
117 //float theta = 2* atan(exp(-Eta);
118 Px = PT*cos(Phi); Py = PT*sin(Phi);
119}
120
121void TRootGenFwdParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
122 genEta = eta; genPhi = phi; genE = e; genPT = et;
123 genPx = genPT*cos(genPhi); genPy = genPT*sin(genPhi);
124}
125
126
127TRootGenFwdParticle::TRootGenFwdParticle(const TRootGenFwdParticle& p): TSortableObject(),
128 genE(p.genE), genPx(p.genPx), genPy(p.genPy), genPz(p.genPz), genPT(p.genPT), genEta(p.genEta), genPhi(p.genPhi) {}
129
130TRootGenFwdParticle& TRootGenFwdParticle::operator=(const TRootGenFwdParticle& p){
131 if(this == &p) return *this;
132 genE=p.genE; genPx=p.genPx; genPy=p.genPy; genPz=p.genPz;
133 genPT=p.genPT; genEta=p.genEta; genPhi=p.genPhi;
134 return *this;
135}
136
137namespace TRootC {
138GenParticle::GenParticle(const TRootGenParticle& p) :
139 PID(p.PID), Status(p.Status), M1(p.M1), M2(p.M2), D1(p.D1), D2(p.D2), Charge(p.Charge),
140 T(p.T), X(p.X), Y(p.Y), Z(p.Z), M(p.M) {
141}
142}
143
144TRootGenParticle::TRootGenParticle(TRootC::GenParticle* part) :
145PID(part->PID),Status(part->Status),M1(part->M1),M2(part->M2),D1(part->D1),D2(part->D2),
146T(part->T),X(part->X),Y(part->Y),Z(part->Z),M(part->M){
147 E=part->E;
148 Px=part->Px;
149 Py=part->Py;
150 Pz=part->Pz;
151 Eta=part->Eta;
152 Phi=part->Phi;
153 PT=part->PT;
154 _initialised=false;
155}
156
157
158void TRootGenParticle::setFractions() {
159 switch(abs(PID)) {
160 default: _Fem = 0; _Fhad=1; break;
161 case(pE):
162 case(pGAMMA):
163 case(pPI0):
164 _Fem = 1; _Fhad=0; break;
165 case(pNU1):
166 case(pNU2):
167 case(pNU3):
168 case(pMU):
169 _Fem =0; _Fhad=0; break;
170 case(pK0S):
171 case(pLAMBDA):
172 _Fem=0.3; _Fhad=0.7; break;
173 }
174 _initialised=true;
175}
176
177/* float Eta, Phi; // (eta,phi) at the beginning of the track
178 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
179 float PT, E, Px, Py, Pz; */
180
181TRootTracks::TRootTracks() :
182 Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
183 PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED),
184 Charge(UNDEFINED) {}
185
186TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
187 Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
188 PT(pt) {
189 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
190 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
191 Charge = UNDEFINED;
192}
193TRootTracks::TRootTracks(const TRootTracks& track) : TSortableObject(),
194 Eta(track.Eta), Phi(track.Phi),
195 EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
196 PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz), Charge(track.Charge) {}
197
198TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
199 if(this == &track) return *this;
200 Eta = track.Eta; Phi = track.Phi;
201 EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
202 PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
203 Charge = track.Charge;
204 return *this;
205}
206
207void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt, const float charge) {
208 Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
209 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
210 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
211 Charge = charge;
212}
213
214const TLorentzVector TRootTracks::GetFourVector() const {
215 TLorentzVector v;
216 v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
217 return TLorentzVector(v);
218}
219
220TRootCalo::TRootCalo() :
221 E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
222 //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
223
224TRootCalo::TRootCalo(const TRootCalo& cal) : TSortableObject() {
225 E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
226 //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
227}
228
229TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
230 if(this==&cal) return *this;
231 Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
232 return *this;
233}
234
235void TRootCalo::set(const D_CaloTower& cal) {
236 Eta =cal.getEta(); Phi=cal.getPhi();
237 E_em=cal.getEem(); E_had=cal.getEhad();
238 E =cal.getE(); ET =cal.getET();
239}
240
241TRootZdcHits::TRootZdcHits(const float e, const float t, const int side, const bool had) : E(e), T(t), side(side), hadronic_hit(had) {}
242
243TRootZdcHits::TRootZdcHits(const TRootZdcHits& zdc) : TRootGenFwdParticle(zdc), E(zdc.E), T(zdc.T), side(zdc.side), hadronic_hit(zdc.hadronic_hit) {}
244
245TRootZdcHits& TRootZdcHits::operator=(const TRootZdcHits& zdc) {
246 if(this==&zdc) return *this;
247 E = zdc.E; T = zdc.T; side = zdc.side; hadronic_hit = zdc.hadronic_hit;
248 return *this;
249}
250
251
252void TRootGenParticle:: print(){
253 cout << "pid = " << PID << "\tM=" << M << "\tQ= " << Charge << "\tStatus = " << Status << "\t E= " << E << endl;
254// cout << "T = " << T << "\t X = " << X << "\t Y = " << Y << "\t Z = " << Z << endl;
255}
256
Note: See TracBrowser for help on using the repository browser.