Fork me on GitHub

source: svn/trunk/classes/DelphesClasses.cc@ 1337

Last change on this file since 1337 was 1318, checked in by Pavel Demin, 11 years ago

add Eta to MissingET

File size: 5.6 KB
RevLine 
[593]1
[814]2/**
[593]3 *
[814]4 * Definition of classes to be stored in the root tree.
5 * Function CompareXYZ sorts objects by the variable XYZ that MUST be
6 * present in the data members of the root tree class of the branch.
[593]7 *
[814]8 * $Date: 2008-06-04 13:57:24 $
[593]9 * $Revision: 1.1 $
10 *
[814]11 *
[593]12 * \author P. Demin - UCL, Louvain-la-Neuve
13 *
14 */
15
[687]16#include "classes/DelphesClasses.h"
[593]17
[687]18#include "classes/DelphesFactory.h"
19#include "classes/SortableObject.h"
[593]20
[687]21CompBase *GenParticle::fgCompare = 0;
22CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
23CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
24CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
25CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
26CompBase *Track::fgCompare = CompPT<Track>::Instance();
27CompBase *Tower::fgCompare = CompE<Tower>::Instance();
[895]28CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
[687]29
[685]30//------------------------------------------------------------------------------
31
[884]32TLorentzVector GenParticle::P4()
33{
34 TLorentzVector vec;
35 vec.SetPxPyPzE(Px, Py, Pz, E);
36 return vec;
37}
38
39//------------------------------------------------------------------------------
40
[1318]41TLorentzVector MissingET::P4()
42{
43 TLorentzVector vec;
44 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
45 return vec;
46}
47
48//------------------------------------------------------------------------------
49
[884]50TLorentzVector Photon::P4()
51{
52 TLorentzVector vec;
53 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
54 return vec;
55}
56
57//------------------------------------------------------------------------------
58
59TLorentzVector Electron::P4()
60{
61 TLorentzVector vec;
62 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
63 return vec;
64}
65
66//------------------------------------------------------------------------------
67
68TLorentzVector Muon::P4()
69{
70 TLorentzVector vec;
71 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
72 return vec;
73}
74
75//------------------------------------------------------------------------------
76
77TLorentzVector Jet::P4()
78{
79 TLorentzVector vec;
80 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
81 return vec;
82}
83
84//------------------------------------------------------------------------------
85
86TLorentzVector Track::P4()
87{
88 TLorentzVector vec;
89 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
90 return vec;
91}
92
93//------------------------------------------------------------------------------
94
95TLorentzVector Tower::P4()
96{
97 TLorentzVector vec;
98 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
99 return vec;
100}
101
102//------------------------------------------------------------------------------
103
[687]104Candidate::Candidate() :
[1014]105 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
[1088]106 Charge(0), Mass(0.0),
[1074]107 IsPU(0), IsConstituent(0),
108 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
[900]109 DeltaEta(0.0), DeltaPhi(0.0),
[685]110 Momentum(0.0, 0.0, 0.0, 0.0),
111 Position(0.0, 0.0, 0.0, 0.0),
[1088]112 Area(0.0, 0.0, 0.0, 0.0),
[685]113 fFactory(0),
114 fArray(0)
115{
[898]116 Edges[0] = 0.0;
117 Edges[1] = 0.0;
118 Edges[2] = 0.0;
119 Edges[3] = 0.0;
[685]120}
121
122//------------------------------------------------------------------------------
123
[687]124void Candidate::AddCandidate(Candidate *object)
[680]125{
126 if(!fArray) fArray = fFactory->NewArray();
127 fArray->Add(object);
128}
[685]129
130//------------------------------------------------------------------------------
131
[887]132TObjArray *Candidate::GetCandidates()
133{
134 if(!fArray) fArray = fFactory->NewArray();
135 return fArray;
136}
137
138//------------------------------------------------------------------------------
139
140Bool_t Candidate::Overlaps(const Candidate *object) const
141{
142 const Candidate *candidate;
143
[919]144 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
[891]145
[887]146 if(fArray)
147 {
148 TIter it(fArray);
149 while((candidate = static_cast<Candidate *>(it.Next())))
150 {
151 if(candidate->Overlaps(object)) return kTRUE;
152 }
153 }
154
155 if(object->fArray)
156 {
157 TIter it(object->fArray);
158 while((candidate = static_cast<Candidate *>(it.Next())))
159 {
160 if(candidate->Overlaps(this)) return kTRUE;
161 }
162 }
163
164 return kFALSE;
165}
166
167
168//------------------------------------------------------------------------------
169
[687]170TObject *Candidate::Clone(const char *newname) const
[685]171{
[687]172 Candidate *object = fFactory->NewCandidate();
[685]173 Copy(*object);
174 return object;
175}
176
177//------------------------------------------------------------------------------
178
[687]179void Candidate::Copy(TObject &obj) const
[685]180{
[687]181 Candidate &object = static_cast<Candidate &>(obj);
[891]182 Candidate *candidate;
[686]183
[685]184 object.PID = PID;
[845]185 object.Status = Status;
186 object.M1 = M1;
187 object.M2 = M2;
188 object.D1 = D1;
189 object.D2 = D2;
[685]190 object.Charge = Charge;
191 object.Mass = Mass;
[1014]192 object.IsPU = IsPU;
[1077]193 object.IsConstituent = IsConstituent;
[845]194 object.BTag = BTag;
[926]195 object.TauTag = TauTag;
[845]196 object.Eem = Eem;
197 object.Ehad = Ehad;
[898]198 object.Edges[0] = Edges[0];
199 object.Edges[1] = Edges[1];
200 object.Edges[2] = Edges[2];
201 object.Edges[3] = Edges[3];
[900]202 object.DeltaEta = DeltaEta;
203 object.DeltaPhi = DeltaPhi;
[685]204 object.Momentum = Momentum;
205 object.Position = Position;
[1088]206 object.Area = Area;
[685]207
208 object.fFactory = fFactory;
209 object.fArray = 0;
210
211 if(fArray && fArray->GetEntriesFast() > 0)
212 {
213 TIter itArray(fArray);
[891]214 TObjArray *array = object.GetCandidates();
215 while((candidate = static_cast<Candidate *>(itArray.Next())))
[685]216 {
[891]217 array->Add(candidate);
[685]218 }
219 }
220}
221
222//------------------------------------------------------------------------------
223
[687]224void Candidate::Clear(Option_t* option)
[685]225{
226 SetUniqueID(0);
[919]227 ResetBit(kIsReferenced);
[685]228 PID = 0;
[845]229 Status = 0;
[1014]230 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
[685]231 Charge = 0;
[1014]232 Mass = 0.0;
233 IsPU = 0;
[1074]234 IsConstituent = 0;
[845]235 BTag = 0;
[926]236 TauTag = 0;
[845]237 Eem = 0.0;
238 Ehad = 0.0;
[898]239 Edges[0] = 0.0;
240 Edges[1] = 0.0;
241 Edges[2] = 0.0;
242 Edges[3] = 0.0;
[900]243 DeltaEta = 0.0;
244 DeltaPhi = 0.0;
[685]245 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
246 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
[1088]247 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[685]248 fArray = 0;
249}
Note: See TracBrowser for help on using the repository browser.