Fork me on GitHub

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

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

tracks and Taujets have charge

File size: 7.2 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;
[270]38TCompare *GenParticle::fgCompare = 0;
[3]39TCompare *TRootElectron::fgCompare = TComparePT<TRootElectron>::Instance();
40TCompare *TRootMuon::fgCompare = TComparePT<TRootMuon>::Instance();
41TCompare *TRootPhoton::fgCompare = TComparePT<TRootPhoton>::Instance();
42TCompare *TRootTauJet::fgCompare = TComparePT<TRootTauJet>::Instance();
[267]43TCompare *TRootJet::fgCompare = TComparePT<TRootJet>::Instance();
[268]44TCompare *TRootTracks::fgCompare = 0;
[3]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;
[67]52TCompare *TRootTrigger::fgCompare =0;
[3]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}
[85]63
[267]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
[176]76void TRootParticle::Set(const float px, const float py, const float pz, const float e) {
[73]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}
[3]87
[264]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}
[73]94
[270]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}
[264]107
[270]108
[264]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
[290]128/* float Eta, Phi; // (eta,phi) at the beginning of the track
[264]129 float EtaOuter, PhiOuter; // (eta,phi) at the end of the track
[290]130 float PT, E, Px, Py, Pz; */
[264]131
[268]132TRootTracks::TRootTracks() :
[290]133 Eta(UNDEFINED), Phi(UNDEFINED), EtaOuter(UNDEFINED), PhiOuter(UNDEFINED),
134 PT(UNDEFINED), E(UNDEFINED), Px(UNDEFINED), Py(UNDEFINED), Pz(UNDEFINED),
135 Charge(UNDEFINED) {}
[264]136
[268]137TRootTracks::TRootTracks(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt) :
[290]138 Eta(inEta), Phi(inPhi), EtaOuter(outEta), PhiOuter(outPhi),
139 PT(pt) {
[264]140 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
141 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
[290]142 Charge = UNDEFINED;
[264]143}
[268]144TRootTracks::TRootTracks(const TRootTracks& track) :
[290]145 Eta(track.Eta), Phi(track.Phi),
146 EtaOuter(track.EtaOuter), PhiOuter(track.PhiOuter),
147 PT(track.PT), E(track.E), Px(track.Px), Py(track.Py), Pz(track.Pz), Charge(track.Charge) {}
[264]148
[268]149TRootTracks& TRootTracks::operator=(const TRootTracks& track) {
[264]150 if(this == &track) return *this;
151 Eta = track.Eta; Phi = track.Phi;
152 EtaOuter = track.EtaOuter; PhiOuter = track.PhiOuter;
153 PT = track.PT; E = track.E; Px = track.Px; Py= track.Py; Pz =track.Pz;
[290]154 Charge = track.Charge;
[264]155 return *this;
156}
157
[290]158void TRootTracks::Set(const float inEta, const float inPhi, const float outEta, const float outPhi, const float pt, const float charge) {
[264]159 Eta= inEta; Phi=inPhi; EtaOuter=outEta; PhiOuter=outPhi; PT=pt;
160 TLorentzVector p; p.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
161 Px = p.Px(); Py = p.Py(); Pz = p.Pz(); E=p.E();
[290]162 Charge = charge;
[264]163}
164
[268]165const TLorentzVector TRootTracks::GetFourVector() const {
[264]166 TLorentzVector v;
167 v.SetPtEtaPhiE(PT,Eta,Phi,PT*cosh(Eta));
168 return TLorentzVector(v);
169}
170
171TRootCalo::TRootCalo() :
172 E_em(UNDEFINED), E_had(UNDEFINED), ET(UNDEFINED) {}
173 //Eta(UNDEFINED), Phi(UNDEFINED), E_em(UNDEFINED), E_had(UNDEFINED), E(UNDEFINED), ET(UNDEFINED) {}
174
175TRootCalo::TRootCalo(const TRootCalo& cal) {
176 E_em=cal.E_em; E_had=cal.E_had; ET=cal.ET;
177 //Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
178}
179
180TRootCalo& TRootCalo::operator=(const TRootCalo& cal) {
181 if(this==&cal) return *this;
182 Eta =cal.Eta; Phi=cal.Phi; E_em=cal.E_em; E_had=cal.E_had; E=cal.E; ET=cal.ET;
183 return *this;
184}
185
186void TRootCalo::set(const D_CaloTower& cal) {
187 Eta =cal.getEta(); Phi=cal.getPhi();
188 E_em=cal.getEem(); E_had=cal.getEhad();
189 E =cal.getE(); ET =cal.getET();
190}
Note: See TracBrowser for help on using the repository browser.