Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 20dc57b

Last change on this file since 20dc57b was cab38f6, checked in by Pavel Demin <pavel.demin@…>, 10 years ago

remove svn tags and fix formatting

  • Property mode set to 100644
File size: 7.6 KB
RevLine 
[b443089]1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
[1fa50c2]4 *
[b443089]5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
[1fa50c2]9 *
[b443089]10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
[1fa50c2]14 *
[b443089]15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
[d7d2da3]19
20/**
21 *
22 * Definition of classes to be stored in the root tree.
23 * Function CompareXYZ sorts objects by the variable XYZ that MUST be
24 * present in the data members of the root tree class of the branch.
25 *
26 * \author P. Demin - UCL, Louvain-la-Neuve
27 *
28 */
29
30#include "classes/DelphesClasses.h"
31
32#include "classes/DelphesFactory.h"
33#include "classes/SortableObject.h"
34
35CompBase *GenParticle::fgCompare = 0;
36CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
37CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
38CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
39CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
40CompBase *Track::fgCompare = CompPT<Track>::Instance();
41CompBase *Tower::fgCompare = CompE<Tower>::Instance();
[8f7db23]42CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
[d7d2da3]43CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
44
45//------------------------------------------------------------------------------
46
47TLorentzVector GenParticle::P4()
48{
49 TLorentzVector vec;
50 vec.SetPxPyPzE(Px, Py, Pz, E);
51 return vec;
52}
53
54//------------------------------------------------------------------------------
55
[4ad7b96]56TLorentzVector MissingET::P4()
57{
58 TLorentzVector vec;
59 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
60 return vec;
61}
62
63//------------------------------------------------------------------------------
64
[d7d2da3]65TLorentzVector Photon::P4()
66{
67 TLorentzVector vec;
68 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
69 return vec;
70}
71
72//------------------------------------------------------------------------------
73
74TLorentzVector Electron::P4()
75{
76 TLorentzVector vec;
77 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
78 return vec;
79}
80
81//------------------------------------------------------------------------------
82
83TLorentzVector Muon::P4()
84{
85 TLorentzVector vec;
86 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
87 return vec;
88}
89
90//------------------------------------------------------------------------------
91
92TLorentzVector Jet::P4()
93{
94 TLorentzVector vec;
95 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
96 return vec;
97}
98
99//------------------------------------------------------------------------------
100
101TLorentzVector Track::P4()
102{
103 TLorentzVector vec;
104 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
105 return vec;
106}
107
108//------------------------------------------------------------------------------
109
110TLorentzVector Tower::P4()
111{
112 TLorentzVector vec;
113 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
114 return vec;
115}
116
117//------------------------------------------------------------------------------
118
119Candidate::Candidate() :
120 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
121 Charge(0), Mass(0.0),
122 IsPU(0), IsConstituent(0),
123 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
124 DeltaEta(0.0), DeltaPhi(0.0),
125 Momentum(0.0, 0.0, 0.0, 0.0),
126 Position(0.0, 0.0, 0.0, 0.0),
127 Area(0.0, 0.0, 0.0, 0.0),
[43c646a]128 Dxy(0), SDxy(0), Xd(0), Yd(0), Zd(0),
[24d005f]129 NCharged(0),
130 NNeutrals(0),
131 Beta(0),
132 BetaStar(0),
133 MeanSqDeltaR(0),
[da00c35]134 PTD(0),
135 fFactory(0),
136 fArray(0)
[d7d2da3]137{
138 Edges[0] = 0.0;
139 Edges[1] = 0.0;
140 Edges[2] = 0.0;
141 Edges[3] = 0.0;
[24d005f]142 FracPt[0] = 0.0;
143 FracPt[1] = 0.0;
144 FracPt[2] = 0.0;
145 FracPt[3] = 0.0;
146 FracPt[4] = 0.0;
[63178fb]147 Tau[0] = 0.0;
148 Tau[1] = 0.0;
149 Tau[2] = 0.0;
150 Tau[3] = 0.0;
151 Tau[4] = 0.0;
[d7d2da3]152}
153
154//------------------------------------------------------------------------------
155
156void Candidate::AddCandidate(Candidate *object)
157{
158 if(!fArray) fArray = fFactory->NewArray();
159 fArray->Add(object);
160}
161
162//------------------------------------------------------------------------------
163
164TObjArray *Candidate::GetCandidates()
165{
166 if(!fArray) fArray = fFactory->NewArray();
167 return fArray;
168}
169
170//------------------------------------------------------------------------------
171
172Bool_t Candidate::Overlaps(const Candidate *object) const
173{
174 const Candidate *candidate;
175
176 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
177
178 if(fArray)
179 {
180 TIter it(fArray);
181 while((candidate = static_cast<Candidate *>(it.Next())))
182 {
183 if(candidate->Overlaps(object)) return kTRUE;
184 }
185 }
186
187 if(object->fArray)
188 {
189 TIter it(object->fArray);
190 while((candidate = static_cast<Candidate *>(it.Next())))
191 {
192 if(candidate->Overlaps(this)) return kTRUE;
193 }
194 }
195
196 return kFALSE;
197}
198
199
200//------------------------------------------------------------------------------
201
202TObject *Candidate::Clone(const char *newname) const
203{
204 Candidate *object = fFactory->NewCandidate();
205 Copy(*object);
206 return object;
207}
208
209//------------------------------------------------------------------------------
210
211void Candidate::Copy(TObject &obj) const
212{
213 Candidate &object = static_cast<Candidate &>(obj);
214 Candidate *candidate;
215
216 object.PID = PID;
217 object.Status = Status;
218 object.M1 = M1;
219 object.M2 = M2;
220 object.D1 = D1;
221 object.D2 = D2;
222 object.Charge = Charge;
223 object.Mass = Mass;
224 object.IsPU = IsPU;
225 object.IsConstituent = IsConstituent;
226 object.BTag = BTag;
227 object.TauTag = TauTag;
228 object.Eem = Eem;
229 object.Ehad = Ehad;
230 object.Edges[0] = Edges[0];
231 object.Edges[1] = Edges[1];
232 object.Edges[2] = Edges[2];
233 object.Edges[3] = Edges[3];
234 object.DeltaEta = DeltaEta;
235 object.DeltaPhi = DeltaPhi;
236 object.Momentum = Momentum;
237 object.Position = Position;
[43c646a]238 object.Area = Area;
[a0431dc]239 object.Dxy = Dxy;
240 object.SDxy = SDxy;
241 object.Xd = Xd;
242 object.Yd = Yd;
243 object.Zd = Zd;
[d7d2da3]244
[24d005f]245 object.NCharged = NCharged;
246 object.NNeutrals = NNeutrals;
247 object.Beta = Beta;
248 object.BetaStar = BetaStar;
249 object.MeanSqDeltaR = MeanSqDeltaR;
250 object.PTD = PTD;
251 object.FracPt[0] = FracPt[0];
252 object.FracPt[1] = FracPt[1];
253 object.FracPt[2] = FracPt[2];
254 object.FracPt[3] = FracPt[3];
255 object.FracPt[4] = FracPt[4];
[63178fb]256 object.Tau[0] = Tau[0];
257 object.Tau[1] = Tau[1];
258 object.Tau[2] = Tau[2];
259 object.Tau[3] = Tau[3];
260 object.Tau[4] = Tau[4];
[e4c3fef]261
[d7d2da3]262 object.fFactory = fFactory;
263 object.fArray = 0;
264
265 if(fArray && fArray->GetEntriesFast() > 0)
266 {
267 TIter itArray(fArray);
268 TObjArray *array = object.GetCandidates();
269 while((candidate = static_cast<Candidate *>(itArray.Next())))
270 {
271 array->Add(candidate);
272 }
273 }
274}
275
276//------------------------------------------------------------------------------
277
278void Candidate::Clear(Option_t* option)
279{
280 SetUniqueID(0);
281 ResetBit(kIsReferenced);
282 PID = 0;
283 Status = 0;
284 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
285 Charge = 0;
286 Mass = 0.0;
287 IsPU = 0;
288 IsConstituent = 0;
289 BTag = 0;
290 TauTag = 0;
291 Eem = 0.0;
292 Ehad = 0.0;
293 Edges[0] = 0.0;
294 Edges[1] = 0.0;
295 Edges[2] = 0.0;
296 Edges[3] = 0.0;
297 DeltaEta = 0.0;
298 DeltaPhi = 0.0;
299 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
300 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
301 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[a0431dc]302 Dxy = 0.0;
303 SDxy = 0.0;
304 Xd = 0.0;
305 Yd = 0.0;
306 Zd = 0.0;
[24d005f]307 NCharged = 0;
308 NNeutrals = 0;
309 Beta = 0.0;
310 BetaStar = 0.0;
311 MeanSqDeltaR = 0.0;
312 PTD = 0.0;
313 FracPt[0] = 0.0;
314 FracPt[1] = 0.0;
315 FracPt[2] = 0.0;
316 FracPt[3] = 0.0;
317 FracPt[4] = 0.0;
[63178fb]318 Tau[0] = 0.0;
319 Tau[1] = 0.0;
320 Tau[2] = 0.0;
321 Tau[3] = 0.0;
322 Tau[4] = 0.0;
[e4c3fef]323
[d7d2da3]324 fArray = 0;
325}
Note: See TracBrowser for help on using the repository browser.