Fork me on GitHub

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

Last change on this file since 416 was 409, checked in by Xavier Rouby, 16 years ago

new class TRootGenFwdParticle; modifs in ZDC and RomanPot classes. New leaves in the branches

File size: 9.4 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):
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 genE=p.genE; genPx=p.genPx; genPy=p.genPy; genPz=p.genPz;
131 genPT=p.genPT; genEta=p.genEta; genPhi=p.genPhi;
132}
133
134namespace TRootC {
135GenParticle::GenParticle(const TRootGenParticle& p) :
136 PID(p.PID), Status(p.Status), M1(p.M1), M2(p.M2), D1(p.D1), D2(p.D2), Charge(p.Charge),
137 T(p.T), X(p.X), Y(p.Y), Z(p.Z), M(p.M) {
138}
139}
140
141TRootGenParticle::TRootGenParticle(TRootC::GenParticle* part) :
142PID(part->PID),Status(part->Status),M1(part->M1),M2(part->M2),D1(part->D1),D2(part->D2),
143T(part->T),X(part->X),Y(part->Y),Z(part->Z),M(part->M){
144 E=part->E;
145 Px=part->Px;
146 Py=part->Py;
147 Pz=part->Pz;
148 Eta=part->Eta;
149 Phi=part->Phi;
150 PT=part->PT;
151 _initialised=false;
152}
153
154
155void TRootGenParticle::setFractions() {
156 switch(abs(PID)) {
157 default: _Fem = 0; _Fhad=1; break;
158 case(pE):
159 case(pGAMMA):
160 case(pPI0):
161 _Fem = 1; _Fhad=0; break;
162 case(pNU1):
163 case(pNU2):
164 case(pNU3):
165 case(pMU):
166 _Fem =0; _Fhad=0; break;
167 case(pK0S):
168 case(pLAMBDA):
169 _Fem=0.3; _Fhad=0.7; break;
170 }
171 _initialised=true;
172}
173
174/* float Eta, Phi; // (eta,phi) at the beginning of the track
175 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
176 float PT, E, Px, Py, Pz; */
177
178TRootTracks::TRootTracks() :
179 Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
180 PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED),
181 Charge(UNDEFINED) {}
182
183TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
184 Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
185 PT(pt) {
186 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
187 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
188 Charge = UNDEFINED;
189}
190TRootTracks::TRootTracks(const TRootTracks& track) :
191 Eta(track.Eta), Phi(track.Phi),
192 EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
193 PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz), Charge(track.Charge) {}
194
195TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
196 if(this == &track) return *this;
197 Eta = track.Eta; Phi = track.Phi;
198 EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
199 PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
200 Charge = track.Charge;
201 return *this;
202}
203
204void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt, const float charge) {
205 Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
206 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
207 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
208 Charge = charge;
209}
210
211const TLorentzVector TRootTracks::GetFourVector() const {
212 TLorentzVector v;
213 v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
214 return TLorentzVector(v);
215}
216
217TRootCalo::TRootCalo() :
218 E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
219 //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
220
221TRootCalo::TRootCalo(const TRootCalo& cal) {
222 E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
223 //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
224}
225
226TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
227 if(this==&cal) return *this;
228 Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
229 return *this;
230}
231
232void TRootCalo::set(const D_CaloTower& cal) {
233 Eta =cal.getEta(); Phi=cal.getPhi();
234 E_em=cal.getEem(); E_had=cal.getEhad();
235 E =cal.getE(); ET =cal.getET();
236}
237
238TRootZdcHits::TRootZdcHits(const float e, const float t, const int side, const bool had) : E(e), T(t), side(side), hadronic_hit(had) {}
239TRootZdcHits::TRootZdcHits(const TRootZdcHits& zdc) : E(zdc.E), T(zdc.T), side(zdc.side), hadronic_hit(zdc.hadronic_hit) {}
240TRootZdcHits& TRootZdcHits::operator=(const TRootZdcHits& zdc) {
241 if(this==&zdc) return *this;
242 E = zdc.E; T = zdc.T; side = zdc.side; hadronic_hit = zdc.hadronic_hit;
243 return *this;
244}
245
246
247void TRootGenParticle:: print(){
248 cout << "pid = " << PID << "\tM=" << M << "\tQ= " << Charge << "\tStatus = " << Status << "\t E= " << E << endl;
249// cout << "T = " << T << "\t X = " << X << "\t Y = " << Y << "\t Z = " << Z << endl;
250}
251
Note: See TracBrowser for help on using the repository browser.