Fork me on GitHub

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

Last change on this file since 428 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
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
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
[351]134namespace TRootC {
[318]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}
[351]139}
[318]140
[351]141TRootGenParticle::TRootGenParticle(TRootC::GenParticle* part) :
[270]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}
[264]153
[270]154
[264]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
[290]174/* float Eta, Phi; // (eta,phi) at the beginning of the track
[264]175 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
[290]176 float PT, E, Px, Py, Pz; */
[264]177
[268]178TRootTracks::TRootTracks() :
[290]179 Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
180 PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED),
181 Charge(UNDEFINED) {}
[264]182
[268]183TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
[290]184 Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
185 PT(pt) {
[264]186 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
187 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
[290]188 Charge = UNDEFINED;
[264]189}
[268]190TRootTracks::TRootTracks(const TRootTracks& track) :
[290]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) {}
[264]194
[268]195TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
[264]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;
[290]200 Charge = track.Charge;
[264]201 return *this;
202}
203
[290]204void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt, const float charge) {
[264]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();
[290]208 Charge = charge;
[264]209}
210
[268]211const TLorentzVector TRootTracks::GetFourVector() const {
[264]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}
[387]237
[409]238TRootZdcHits::TRootZdcHits(const float e, const float t, const int side, const bool had) : E(e), T(t), side(side), hadronic_hit(had) {}
[387]239TRootZdcHits::TRootZdcHits(const TRootZdcHits& zdc) : E(zdc.E), T(zdc.T), side(zdc.side), hadronic_hit(zdc.hadronic_hit) {}
[370]240TRootZdcHits& TRootZdcHits::operator=(const TRootZdcHits& zdc) {
[387]241 if(this==&zdc) return *this;
[409]242 E = zdc.E; T = zdc.T; side = zdc.side; hadronic_hit = zdc.hadronic_hit;
[370]243 return *this;
244}
[387]245
[409]246
[375]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.