Fork me on GitHub

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

Last change on this file since 483 was 439, checked in by Xavier Rouby, 15 years ago

TRootGenFwdParticle better written

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#include "BlockClasses.h"
33#include "BlockCompare.h"
34#include "TLorentzVector.h"
35#include <cmath>
36
37TCompare *TRootGenParticle::fgCompare = 0;
38TCompare *TRootGenFwdParticle::fgCompare = 0;
39TCompare *TRootC::GenParticle::fgCompare = 0;
40TCompare *TRootElectron::fgCompare = TComparePT<TRootElectron>::Instance();
41TCompare *TRootMuon::fgCompare = TComparePT<TRootMuon>::Instance();
42TCompare *TRootPhoton::fgCompare = TComparePT<TRootPhoton>::Instance();
43TCompare *TRootTauJet::fgCompare = TComparePT<TRootTauJet>::Instance();
44TCompare *TRootJet::fgCompare = TComparePT<TRootJet>::Instance();
45TCompare *TRootTracks::fgCompare = 0;
46TCompare *TRootETmis::fgCompare = 0;
47TCompare *TRootCalo::fgCompare = 0;
48TCompare *TRootZdcHits::fgCompare = 0;
49TCompare *TRootGenEvent:: fgCompare = 0;
50TCompare *TRootParticle::fgCompare=0;
51TCompare *TRootLHEFParticle::fgCompare = 0;
52TCompare *TRootRomanPotHits::fgCompare =0;
53TCompare *TRootForwardTaggerHits::fgCompare =0;
54TCompare *TRootTrigger::fgCompare =0;
55
56void TRootParticle::Set(const TLorentzVector& momentum) {
57 E = momentum.E();
58 Px = momentum.Px();
59 Py = momentum.Py();
60 Pz = momentum.Pz();
61 PT = momentum.Pt();
62 Eta = momentum.Eta();
63 Phi = momentum.Phi();
64}
65
66void TRootGenFwdParticle::Set(const TLorentzVector& momentum) {
67 genE = momentum.E();
68 genPx = momentum.Px();
69 genPy = momentum.Py();
70 genPz = momentum.Pz();
71 genPT = momentum.Pt();
72 genEta = momentum.Eta();
73 genPhi = momentum.Phi();
74}
75
76
77void TRootTauJet::Set(const TLorentzVector& momentum) {
78
79 E = momentum.E();
80 Px = momentum.Px();
81 Py = momentum.Py();
82 Pz = momentum.Pz();
83 PT = momentum.Pt();
84 Eta = momentum.Eta();
85 Phi = momentum.Phi();
86
87}
88
89void TRootParticle::Set(const float px, const float py, const float pz, const float e) {
90 TLorentzVector toFill;
91 toFill.SetPxPyPzE(px,py,pz,e);
92 E = e;
93 Px = px;
94 Py = py;
95 Pz = pz;
96 PT = toFill.Pt();
97 Eta = toFill.Eta();
98 Phi = toFill.Phi();
99}
100
101void TRootGenFwdParticle::Set(const float px, const float py, const float pz, const float e) {
102 TLorentzVector toFill;
103 toFill.SetPxPyPzE(px,py,pz,e);
104 genE = e;
105 genPx = px;
106 genPy = py;
107 genPz = pz;
108 genPT = toFill.Pt();
109 genEta = toFill.Eta();
110 genPhi = toFill.Phi();
111}
112
113
114void TRootParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
115 Eta = eta; Phi = phi; E = e; PT = et;
116 //float theta = 2* atan(exp(-Eta);
117 Px = PT*cos(Phi); Py = PT*sin(Phi);
118}
119
120void TRootGenFwdParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
121 genEta = eta; genPhi = phi; genE = e; genPT = et;
122 genPx = genPT*cos(genPhi); genPy = genPT*sin(genPhi);
123}
124
125
126TRootGenFwdParticle::TRootGenFwdParticle(const TRootGenFwdParticle& p): TSortableObject(),
127 genE(p.genE), genPx(p.genPx), genPy(p.genPy), genPz(p.genPz), genPT(p.genPT), genEta(p.genEta), genPhi(p.genPhi) {}
128
129TRootGenFwdParticle& TRootGenFwdParticle::operator=(const TRootGenFwdParticle& p){
130 if(this == &p) return *this;
131 genE=p.genE; genPx=p.genPx; genPy=p.genPy; genPz=p.genPz;
132 genPT=p.genPT; genEta=p.genEta; genPhi=p.genPhi;
133 return *this;
134}
135
136namespace TRootC {
137GenParticle::GenParticle(const TRootGenParticle& p) :
138 PID(p.PID), Status(p.Status), M1(p.M1), M2(p.M2), D1(p.D1), D2(p.D2), Charge(p.Charge),
139 T(p.T), X(p.X), Y(p.Y), Z(p.Z), M(p.M) {
140}
141}
142
143TRootGenParticle::TRootGenParticle(TRootC::GenParticle* part) :
144PID(part->PID),Status(part->Status),M1(part->M1),M2(part->M2),D1(part->D1),D2(part->D2),
145T(part->T),X(part->X),Y(part->Y),Z(part->Z),M(part->M){
146 E=part->E;
147 Px=part->Px;
148 Py=part->Py;
149 Pz=part->Pz;
150 Eta=part->Eta;
151 Phi=part->Phi;
152 PT=part->PT;
153 _initialised=false;
154}
155
156
157void TRootGenParticle::setFractions() {
158 switch(abs(PID)) {
159 default: _Fem = 0; _Fhad=1; break;
160 case(pE):
161 case(pGAMMA):
162 case(pPI0):
163 _Fem = 1; _Fhad=0; break;
164 case(pNU1):
165 case(pNU2):
166 case(pNU3):
167 case(pMU):
168 _Fem =0; _Fhad=0; break;
169 case(pK0S):
170 case(pLAMBDA):
171 _Fem=0.3; _Fhad=0.7; break;
172 }
173 _initialised=true;
174}
175
176/* float Eta, Phi; // (eta,phi) at the beginning of the track
177 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
178 float PT, E, Px, Py, Pz; */
179
180TRootTracks::TRootTracks() :
181 Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
182 PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED),
183 Charge(UNDEFINED) {}
184
185TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
186 Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
187 PT(pt) {
188 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
189 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
190 Charge = UNDEFINED;
191}
192TRootTracks::TRootTracks(const TRootTracks& track) : TSortableObject(),
193 Eta(track.Eta), Phi(track.Phi),
194 EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
195 PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz), Charge(track.Charge) {}
196
197TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
198 if(this == &track) return *this;
199 Eta = track.Eta; Phi = track.Phi;
200 EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
201 PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
202 Charge = track.Charge;
203 return *this;
204}
205
206void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt, const float charge) {
207 Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
208 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
209 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
210 Charge = charge;
211}
212
213const TLorentzVector TRootTracks::GetFourVector() const {
214 TLorentzVector v;
215 v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
216 return TLorentzVector(v);
217}
218
219TRootCalo::TRootCalo() :
220 E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
221 //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
222
223TRootCalo::TRootCalo(const TRootCalo& cal) : TSortableObject() {
224 E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
225 //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
226}
227
228TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
229 if(this==&cal) return *this;
230 Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
231 return *this;
232}
233
234void TRootCalo::set(const D_CaloTower& cal) {
235 Eta =cal.getEta(); Phi=cal.getPhi();
236 E_em=cal.getEem(); E_had=cal.getEhad();
237 E =cal.getE(); ET =cal.getET();
238}
239
240TRootZdcHits::TRootZdcHits(const float e, const float t, const int side, const bool had) : E(e), T(t), side(side), hadronic_hit(had) {}
241
242TRootZdcHits::TRootZdcHits(const TRootZdcHits& zdc) : TRootGenFwdParticle(zdc), E(zdc.E), T(zdc.T), side(zdc.side), hadronic_hit(zdc.hadronic_hit) {}
243
244TRootZdcHits& TRootZdcHits::operator=(const TRootZdcHits& zdc) {
245 if(this==&zdc) return *this;
246 E = zdc.E; T = zdc.T; side = zdc.side; hadronic_hit = zdc.hadronic_hit;
247 return *this;
248}
249
250
251void TRootGenParticle:: print(){
252 cout << "pid = " << PID << "\tM=" << M << "\tQ= " << Charge << "\tStatus = " << Status << "\t E= " << E << endl;
253// cout << "T = " << T << "\t X = " << X << "\t Y = " << Y << "\t Z = " << Z << endl;
254}
255
Note: See TracBrowser for help on using the repository browser.