Fork me on GitHub

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

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

void TRootGenParticle::print

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