Fork me on GitHub

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

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

GenParticle(TRootGenparticle) constructor

File size: 7.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 *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
95GenParticle::GenParticle(const TRootGenParticle& p) :
96 PID(p.PID), Status(p.Status), M1(p.M1), M2(p.M2), D1(p.D1), D2(p.D2), Charge(p.Charge),
97 T(p.T), X(p.X), Y(p.Y), Z(p.Z), M(p.M) {
98}
99
100TRootGenParticle::TRootGenParticle(GenParticle* part) :
101PID(part->PID),Status(part->Status),M1(part->M1),M2(part->M2),D1(part->D1),D2(part->D2),
102T(part->T),X(part->X),Y(part->Y),Z(part->Z),M(part->M){
103 E=part->E;
104 Px=part->Px;
105 Py=part->Py;
106 Pz=part->Pz;
107 Eta=part->Eta;
108 Phi=part->Phi;
109 PT=part->PT;
110 _initialised=false;
111}
112
113
114void TRootGenParticle::setFractions() {
115 switch(abs(PID)) {
116 default: _Fem = 0; _Fhad=1; break;
117 case(pE):
118 case(pGAMMA):
119 case(pPI0):
120 _Fem = 1; _Fhad=0; break;
121 case(pNU1):
122 case(pNU2):
123 case(pNU3):
124 case(pMU):
125 _Fem =0; _Fhad=0; break;
126 case(pK0S):
127 case(pLAMBDA):
128 _Fem=0.3; _Fhad=0.7; break;
129 }
130 _initialised=true;
131}
132
133/* float Eta, Phi; // (eta,phi) at the beginning of the track
134 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
135 float PT, E, Px, Py, Pz; */
136
137TRootTracks::TRootTracks() :
138 Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
139 PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED),
140 Charge(UNDEFINED) {}
141
142TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
143 Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
144 PT(pt) {
145 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
146 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
147 Charge = UNDEFINED;
148}
149TRootTracks::TRootTracks(const TRootTracks& track) :
150 Eta(track.Eta), Phi(track.Phi),
151 EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
152 PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz), Charge(track.Charge) {}
153
154TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
155 if(this == &track) return *this;
156 Eta = track.Eta; Phi = track.Phi;
157 EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
158 PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
159 Charge = track.Charge;
160 return *this;
161}
162
163void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt, const float charge) {
164 Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
165 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
166 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
167 Charge = charge;
168}
169
170const TLorentzVector TRootTracks::GetFourVector() const {
171 TLorentzVector v;
172 v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
173 return TLorentzVector(v);
174}
175
176TRootCalo::TRootCalo() :
177 E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
178 //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
179
180TRootCalo::TRootCalo(const TRootCalo& cal) {
181 E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
182 //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
183}
184
185TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
186 if(this==&cal) return *this;
187 Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
188 return *this;
189}
190
191void TRootCalo::set(const D_CaloTower& cal) {
192 Eta =cal.getEta(); Phi=cal.getPhi();
193 E_em=cal.getEem(); E_had=cal.getEhad();
194 E =cal.getE(); ET =cal.getET();
195}
Note: See TracBrowser for help on using the repository browser.