Fork me on GitHub

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

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

add Eta to MissingET

File size: 5.6 KB
Line 
1
2/**
3 *
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.
7 *
8 * $Date: 2008-06-04 13:57:24 $
9 * $Revision: 1.1 $
10 *
11 *
12 * \author P. Demin - UCL, Louvain-la-Neuve
13 *
14 */
15
16#include "classes/DelphesClasses.h"
17
18#include "classes/DelphesFactory.h"
19#include "classes/SortableObject.h"
20
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();
28CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
29
30//------------------------------------------------------------------------------
31
32TLorentzVector GenParticle::P4()
33{
34 TLorentzVector vec;
35 vec.SetPxPyPzE(Px, Py, Pz, E);
36 return vec;
37}
38
39//------------------------------------------------------------------------------
40
41TLorentzVector MissingET::P4()
42{
43 TLorentzVector vec;
44 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
45 return vec;
46}
47
48//------------------------------------------------------------------------------
49
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
104Candidate::Candidate() :
105 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
106 Charge(0), Mass(0.0),
107 IsPU(0), IsConstituent(0),
108 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
109 DeltaEta(0.0), DeltaPhi(0.0),
110 Momentum(0.0, 0.0, 0.0, 0.0),
111 Position(0.0, 0.0, 0.0, 0.0),
112 Area(0.0, 0.0, 0.0, 0.0),
113 fFactory(0),
114 fArray(0)
115{
116 Edges[0] = 0.0;
117 Edges[1] = 0.0;
118 Edges[2] = 0.0;
119 Edges[3] = 0.0;
120}
121
122//------------------------------------------------------------------------------
123
124void Candidate::AddCandidate(Candidate *object)
125{
126 if(!fArray) fArray = fFactory->NewArray();
127 fArray->Add(object);
128}
129
130//------------------------------------------------------------------------------
131
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
144 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
145
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
170TObject *Candidate::Clone(const char *newname) const
171{
172 Candidate *object = fFactory->NewCandidate();
173 Copy(*object);
174 return object;
175}
176
177//------------------------------------------------------------------------------
178
179void Candidate::Copy(TObject &obj) const
180{
181 Candidate &object = static_cast<Candidate &>(obj);
182 Candidate *candidate;
183
184 object.PID = PID;
185 object.Status = Status;
186 object.M1 = M1;
187 object.M2 = M2;
188 object.D1 = D1;
189 object.D2 = D2;
190 object.Charge = Charge;
191 object.Mass = Mass;
192 object.IsPU = IsPU;
193 object.IsConstituent = IsConstituent;
194 object.BTag = BTag;
195 object.TauTag = TauTag;
196 object.Eem = Eem;
197 object.Ehad = Ehad;
198 object.Edges[0] = Edges[0];
199 object.Edges[1] = Edges[1];
200 object.Edges[2] = Edges[2];
201 object.Edges[3] = Edges[3];
202 object.DeltaEta = DeltaEta;
203 object.DeltaPhi = DeltaPhi;
204 object.Momentum = Momentum;
205 object.Position = Position;
206 object.Area = Area;
207
208 object.fFactory = fFactory;
209 object.fArray = 0;
210
211 if(fArray && fArray->GetEntriesFast() > 0)
212 {
213 TIter itArray(fArray);
214 TObjArray *array = object.GetCandidates();
215 while((candidate = static_cast<Candidate *>(itArray.Next())))
216 {
217 array->Add(candidate);
218 }
219 }
220}
221
222//------------------------------------------------------------------------------
223
224void Candidate::Clear(Option_t* option)
225{
226 SetUniqueID(0);
227 ResetBit(kIsReferenced);
228 PID = 0;
229 Status = 0;
230 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
231 Charge = 0;
232 Mass = 0.0;
233 IsPU = 0;
234 IsConstituent = 0;
235 BTag = 0;
236 TauTag = 0;
237 Eem = 0.0;
238 Ehad = 0.0;
239 Edges[0] = 0.0;
240 Edges[1] = 0.0;
241 Edges[2] = 0.0;
242 Edges[3] = 0.0;
243 DeltaEta = 0.0;
244 DeltaPhi = 0.0;
245 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
246 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
247 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
248 fArray = 0;
249}
Note: See TracBrowser for help on using the repository browser.