Fork me on GitHub

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

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

TRootGenFwdParticle better written

File size: 9.6 KB
RevLine 
[268]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***********************************************************************/
[3]31
[220]32#include "BlockClasses.h"
33#include "BlockCompare.h"
[73]34#include "TLorentzVector.h"
[264]35#include <cmath>
[73]36
[3]37TCompare *TRootGenParticle::fgCompare = 0;
[409]38TCompare *TRootGenFwdParticle::fgCompare = 0;
[351]39TCompare *TRootC::GenParticle::fgCompare = 0;
[3]40TCompare *TRootElectron::fgCompare = TComparePT<TRootElectron>::Instance();
41TCompare *TRootMuon::fgCompare = TComparePT<TRootMuon>::Instance();
42TCompare *TRootPhoton::fgCompare = TComparePT<TRootPhoton>::Instance();
43TCompare *TRootTauJet::fgCompare = TComparePT<TRootTauJet>::Instance();
[267]44TCompare *TRootJet::fgCompare = TComparePT<TRootJet>::Instance();
[268]45TCompare *TRootTracks::fgCompare = 0;
[3]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;
[370]53TCompare *TRootForwardTaggerHits::fgCompare =0;
[67]54TCompare *TRootTrigger::fgCompare =0;
[3]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}
[85]65
[409]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
[267]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
[176]89void TRootParticle::Set(const float px, const float py, const float pz, const float e) {
[73]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}
[3]100
[409]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
[264]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);
[409]117 Px = PT*cos(Phi); Py = PT*sin(Phi);
[264]118}
[73]119
[409]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
[439]126TRootGenFwdParticle::TRootGenFwdParticle(const TRootGenFwdParticle& p): TSortableObject(),
[409]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){
[439]130 if(this == &p) return *this;
[409]131 genE=p.genE; genPx=p.genPx; genPy=p.genPy; genPz=p.genPz;
132 genPT=p.genPT; genEta=p.genEta; genPhi=p.genPhi;
[439]133 return *this;
[409]134}
135
[351]136namespace TRootC {
[318]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}
[351]141}
[318]142
[351]143TRootGenParticle::TRootGenParticle(TRootC::GenParticle* part) :
[270]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}
[264]155
[270]156
[264]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
[290]176/* float Eta, Phi; // (eta,phi) at the beginning of the track
[264]177 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
[290]178 float PT, E, Px, Py, Pz; */
[264]179
[268]180TRootTracks::TRootTracks() :
[290]181 Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
182 PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED),
183 Charge(UNDEFINED) {}
[264]184
[268]185TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
[290]186 Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
187 PT(pt) {
[264]188 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
189 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
[290]190 Charge = UNDEFINED;
[264]191}
[439]192TRootTracks::TRootTracks(const TRootTracks& track) : TSortableObject(),
[290]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) {}
[264]196
[268]197TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
[264]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;
[290]202 Charge = track.Charge;
[264]203 return *this;
204}
205
[290]206void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt, const float charge) {
[264]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();
[290]210 Charge = charge;
[264]211}
212
[268]213const TLorentzVector TRootTracks::GetFourVector() const {
[264]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
[439]223TRootCalo::TRootCalo(const TRootCalo& cal) : TSortableObject() {
[264]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}
[387]239
[409]240TRootZdcHits::TRootZdcHits(const float e, const float t, const int side, const bool had) : E(e), T(t), side(side), hadronic_hit(had) {}
[439]241
242TRootZdcHits::TRootZdcHits(const TRootZdcHits& zdc) : TRootGenFwdParticle(zdc), E(zdc.E), T(zdc.T), side(zdc.side), hadronic_hit(zdc.hadronic_hit) {}
243
[370]244TRootZdcHits& TRootZdcHits::operator=(const TRootZdcHits& zdc) {
[439]245 if(this==&zdc) return *this;
[409]246 E = zdc.E; T = zdc.T; side = zdc.side; hadronic_hit = zdc.hadronic_hit;
[370]247 return *this;
248}
[387]249
[409]250
[375]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.