Fork me on GitHub

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

Last change on this file since 279 was 278, checked in by severine ovyn, 16 years ago

TRootParticle TrootTracks

File size: 7.3 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 *GenParticle::fgCompare = 0;
39TCompare *TRootElectron::fgCompare = TComparePT<TRootElectron>::Instance();
40TCompare *TRootMuon::fgCompare = TComparePT<TRootMuon>::Instance();
41TCompare *TRootPhoton::fgCompare = TComparePT<TRootPhoton>::Instance();
42TCompare *TRootTauJet::fgCompare = TComparePT<TRootTauJet>::Instance();
43TCompare *TRootJet::fgCompare = TComparePT<TRootJet>::Instance();
44TCompare *TRootTracks::fgCompare = 0;
45TCompare *TRootETmis::fgCompare = 0;
46TCompare *TRootCalo::fgCompare = 0;
47TCompare *TRootZdcHits::fgCompare = 0;
48TCompare *TRootGenEvent:: fgCompare = 0;
49TCompare *TRootParticle::fgCompare=0;
50TCompare *TRootLHEFParticle::fgCompare = 0;
51TCompare *TRootRomanPotHits::fgCompare =0;
52TCompare *TRootTrigger::fgCompare =0;
53
54void TRootParticle::Set(const TLorentzVector& momentum) {
55 E = momentum.E();
56 Px = momentum.Px();
57 Py = momentum.Py();
58 Pz = momentum.Pz();
59 PT = momentum.Pt();
60 Eta = momentum.Eta();
61 Phi = momentum.Phi();
62}
63
64void TRootTauJet::Set(const TLorentzVector& momentum) {
65
66 E = momentum.E();
67 Px = momentum.Px();
68 Py = momentum.Py();
69 Pz = momentum.Pz();
70 PT = momentum.Pt();
71 Eta = momentum.Eta();
72 Phi = momentum.Phi();
73
74}
75
76void TRootParticle::Set(const float px, const float py, const float pz, const float e) {
77 TLorentzVector toFill;
78 toFill.SetPxPyPzE(px,py,pz,e);
79 E = e;
80 Px = px;
81 Py = py;
82 Pz = pz;
83 PT = toFill.Pt();
84 Eta = toFill.Eta();
85 Phi = toFill.Phi();
86}
87
88void TRootParticle::SetEtaPhiEET(const float eta, const float phi, const float e, const float et) {
89 Eta = eta; Phi = phi; E = e; PT = et;
90 //float theta = 2* atan(exp(-Eta);
91 Px = PT*cos(Phi);
92 Py = PT*sin(Phi);
93}
94
95TRootGenParticle::TRootGenParticle(GenParticle* part) :
96PID(part->PID),Status(part->Status),M1(part->M1),M2(part->M2),D1(part->D1),D2(part->D2),
97T(part->T),X(part->X),Y(part->Y),Z(part->Z),M(part->M){
98 E=part->E;
99 Px=part->Px;
100 Py=part->Py;
101 Pz=part->Pz;
102 Eta=part->Eta;
103 Phi=part->Phi;
104 PT=part->PT;
105 _initialised=false;
106}
107
108
109void TRootGenParticle::setFractions() {
110 switch(abs(PID)) {
111 default: _Fem = 0; _Fhad=1; break;
112 case(pE):
113 case(pGAMMA):
114 case(pPI0):
115 _Fem = 1; _Fhad=0; break;
116 case(pNU1):
117 case(pNU2):
118 case(pNU3):
119 case(pMU):
120 _Fem =0; _Fhad=0; break;
121 case(pK0S):
122 case(pLAMBDA):
123 _Fem=0.3; _Fhad=0.7; break;
124 }
125 _initialised=true;
126}
127
128 float Eta, Phi; // (eta,phi) at the beginning of the track
129 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
130 float PT, E, Px, Py, Pz;
131
132TRootTracks::TRootTracks() :
133 TRootParticle(),
134 EtaOuter(UNDEFINED), PhiOuter(UNDEFINED) {}
135/* Eta = UNDEFINED;
136 Phi = UNDEFINED;
137 PT = UNDEFINED;
138 E = UNDEFINED;
139 Px = UNDEFINED;
140 Py = UNDEFINED;
141 Pz = UNDEFINED;
142
143}*/
144
145TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
146 EtaOuter(outEta), PhiOuter(outPhi) {
147 Eta = inEta;
148 Phi = inPhi;
149 PT = pt;
150 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
151 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
152}
153TRootTracks::TRootTracks(const TRootTracks& track) :
154 EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter)
155 {
156 Eta = track.Eta;
157 Phi = track.Phi;
158 PT = track.PT;
159 E = track.E;
160 Px = track.Px;
161 Py = track.Py;
162 Pz = track.Pz;
163 }
164
165TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
166 if(this == &track) return *this;
167 Eta = track.Eta; Phi = track.Phi;
168 EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
169 PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
170 return *this;
171}
172
173void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) {
174 Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
175 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
176 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
177}
178
179const TLorentzVector TRootTracks::GetFourVector() const {
180 TLorentzVector v;
181 v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
182 return TLorentzVector(v);
183}
184
185TRootCalo::TRootCalo() :
186 E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
187 //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
188
189TRootCalo::TRootCalo(const TRootCalo& cal) {
190 E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
191 //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
192}
193
194TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
195 if(this==&cal) return *this;
196 Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
197 return *this;
198}
199
200void TRootCalo::set(const D_CaloTower& cal) {
201 Eta =cal.getEta(); Phi=cal.getPhi();
202 E_em=cal.getEem(); E_had=cal.getEhad();
203 E =cal.getE(); ET =cal.getET();
204}
Note: See TracBrowser for help on using the repository browser.