Fork me on GitHub

source: git/classes/DelphesClasses.cc@ edf10ba

ImprovedOutputFile Timing dual_readout llp
Last change on this file since edf10ba was edf10ba, checked in by Pavel Demin <pavel.demin@…>, 9 years ago

add JetFlavourAssociation

  • Property mode set to 100644
File size: 10.6 KB
Line 
1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
4 *
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.
9 *
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.
14 *
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
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();
42CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
43CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
44
45//------------------------------------------------------------------------------
46
47TLorentzVector GenParticle::P4() const
48{
49 TLorentzVector vec;
50 vec.SetPxPyPzE(Px, Py, Pz, E);
51 return vec;
52}
53
54//------------------------------------------------------------------------------
55
56TLorentzVector MissingET::P4() const
57{
58 TLorentzVector vec;
59 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
60 return vec;
61}
62
63//------------------------------------------------------------------------------
64
65TLorentzVector Photon::P4() const
66{
67 TLorentzVector vec;
68 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
69 return vec;
70}
71
72//------------------------------------------------------------------------------
73
74TLorentzVector Electron::P4() const
75{
76 TLorentzVector vec;
77 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
78 return vec;
79}
80
81//------------------------------------------------------------------------------
82
83TLorentzVector Muon::P4() const
84{
85 TLorentzVector vec;
86 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
87 return vec;
88}
89
90//------------------------------------------------------------------------------
91
92TLorentzVector Jet::P4() const
93{
94 TLorentzVector vec;
95 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
96 return vec;
97}
98
99//------------------------------------------------------------------------------
100
101TLorentzVector Track::P4() const
102{
103 TLorentzVector vec;
104 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
105 return vec;
106}
107
108//------------------------------------------------------------------------------
109
110TLorentzVector Tower::P4() const
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), IsRecoPU(0), IsConstituent(0),
123 BTag(0), BTagAlgo(0), BTagDefault(0), BTagPhysics(0), BTagNearest2(0), BTagNearest3(0), BTagHeaviest(0), BTagHighestPt(0),
124 FlavorAlgo(0), FlavorDefault(0), FlavorPhysics(0), FlavorNearest2(0), FlavorNearest3(0), FlavorHeaviest(0), FlavorHighestPt(0),
125 TauTag(0), Eem(0.0), Ehad(0.0),
126 DeltaEta(0.0), DeltaPhi(0.0),
127 Momentum(0.0, 0.0, 0.0, 0.0),
128 Position(0.0, 0.0, 0.0, 0.0),
129 Area(0.0, 0.0, 0.0, 0.0),
130 Dxy(0), SDxy(0), Xd(0), Yd(0), Zd(0),
131 NCharged(0),
132 NNeutrals(0),
133 NSubJetsTrimmed(0),
134 NSubJetsPruned(0),
135 NSubJetsSoftDropped(0),
136 Beta(0),
137 BetaStar(0),
138 MeanSqDeltaR(0),
139 PTD(0),
140 Ntimes(-1),
141 IsolationVar(-999),
142 IsolationVarRhoCorr(-999),
143 SumPtCharged(-999),
144 SumPtNeutral(-999),
145 SumPtChargedPU(-999),
146 SumPt(-999),
147 fFactory(0),
148 fArray(0)
149{
150 int i;
151 Edges[0] = 0.0;
152 Edges[1] = 0.0;
153 Edges[2] = 0.0;
154 Edges[3] = 0.0;
155 FracPt[0] = 0.0;
156 FracPt[1] = 0.0;
157 FracPt[2] = 0.0;
158 FracPt[3] = 0.0;
159 FracPt[4] = 0.0;
160 Tau[0] = 0.0;
161 Tau[1] = 0.0;
162 Tau[2] = 0.0;
163 Tau[3] = 0.0;
164 Tau[4] = 0.0;
165 for(i = 0; i < 5; ++i)
166 {
167 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
168 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
169 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
170 }
171}
172
173//------------------------------------------------------------------------------
174
175void Candidate::AddCandidate(Candidate *object)
176{
177 if(!fArray) fArray = fFactory->NewArray();
178 fArray->Add(object);
179}
180
181//------------------------------------------------------------------------------
182
183TObjArray *Candidate::GetCandidates()
184{
185 if(!fArray) fArray = fFactory->NewArray();
186 return fArray;
187}
188
189//------------------------------------------------------------------------------
190
191Bool_t Candidate::Overlaps(const Candidate *object) const
192{
193 const Candidate *candidate;
194
195 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
196
197 if(fArray)
198 {
199 TIter it(fArray);
200 while((candidate = static_cast<Candidate *>(it.Next())))
201 {
202 if(candidate->Overlaps(object)) return kTRUE;
203 }
204 }
205
206 if(object->fArray)
207 {
208 TIter it(object->fArray);
209 while((candidate = static_cast<Candidate *>(it.Next())))
210 {
211 if(candidate->Overlaps(this)) return kTRUE;
212 }
213 }
214
215 return kFALSE;
216}
217
218
219//------------------------------------------------------------------------------
220
221TObject *Candidate::Clone(const char *newname) const
222{
223 Candidate *object = fFactory->NewCandidate();
224 Copy(*object);
225 return object;
226}
227
228//------------------------------------------------------------------------------
229
230void Candidate::Copy(TObject &obj) const
231{
232 Candidate &object = static_cast<Candidate &>(obj);
233 Candidate *candidate;
234
235 object.PID = PID;
236 object.Status = Status;
237 object.M1 = M1;
238 object.M2 = M2;
239 object.D1 = D1;
240 object.D2 = D2;
241 object.Charge = Charge;
242 object.Mass = Mass;
243 object.IsPU = IsPU;
244 object.IsConstituent = IsConstituent;
245 object.BTag = BTag;
246 object.BTagAlgo = BTagAlgo;
247 object.BTagDefault = BTagDefault;
248 object.BTagPhysics = BTagPhysics;
249 object.BTagNearest2 = BTagNearest2;
250 object.BTagNearest3 = BTagNearest3;
251 object.BTagHeaviest = BTagHeaviest;
252 object.BTagHighestPt = BTagHighestPt;
253 object.FlavorAlgo = FlavorAlgo;
254 object.FlavorDefault = FlavorDefault;
255 object.FlavorPhysics = FlavorPhysics;
256 object.FlavorNearest2 = FlavorNearest2;
257 object.FlavorNearest3 = FlavorNearest3;
258 object.FlavorHeaviest = FlavorHeaviest;
259 object.FlavorHighestPt = FlavorHighestPt;
260 object.TauTag = TauTag;
261 object.Eem = Eem;
262 object.Ehad = Ehad;
263 object.Edges[0] = Edges[0];
264 object.Edges[1] = Edges[1];
265 object.Edges[2] = Edges[2];
266 object.Edges[3] = Edges[3];
267 object.DeltaEta = DeltaEta;
268 object.DeltaPhi = DeltaPhi;
269 object.Momentum = Momentum;
270 object.Position = Position;
271 object.Area = Area;
272 object.Dxy = Dxy;
273 object.SDxy = SDxy;
274 object.Xd = Xd;
275 object.Yd = Yd;
276 object.Zd = Zd;
277
278 object.NCharged = NCharged;
279 object.NNeutrals = NNeutrals;
280 object.Beta = Beta;
281 object.BetaStar = BetaStar;
282 object.MeanSqDeltaR = MeanSqDeltaR;
283 object.PTD = PTD;
284 object.Ntimes = Ntimes;
285 object.IsolationVar = IsolationVar;
286 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
287 object.SumPtCharged = SumPtCharged;
288 object.SumPtNeutral = SumPtNeutral;
289 object.SumPtChargedPU = SumPtChargedPU;
290 object.SumPt = SumPt;
291
292 object.FracPt[0] = FracPt[0];
293 object.FracPt[1] = FracPt[1];
294 object.FracPt[2] = FracPt[2];
295 object.FracPt[3] = FracPt[3];
296 object.FracPt[4] = FracPt[4];
297 object.Tau[0] = Tau[0];
298 object.Tau[1] = Tau[1];
299 object.Tau[2] = Tau[2];
300 object.Tau[3] = Tau[3];
301 object.Tau[4] = Tau[4];
302
303 object.TrimmedP4[0] = TrimmedP4[0];
304 object.TrimmedP4[1] = TrimmedP4[1];
305 object.TrimmedP4[2] = TrimmedP4[2];
306 object.TrimmedP4[3] = TrimmedP4[3];
307 object.TrimmedP4[4] = TrimmedP4[4];
308 object.PrunedP4[0] = PrunedP4[0];
309 object.PrunedP4[1] = PrunedP4[1];
310 object.PrunedP4[2] = PrunedP4[2];
311 object.PrunedP4[3] = PrunedP4[3];
312 object.PrunedP4[4] = PrunedP4[4];
313 object.SoftDroppedP4[0] = SoftDroppedP4[0];
314 object.SoftDroppedP4[1] = SoftDroppedP4[1];
315 object.SoftDroppedP4[2] = SoftDroppedP4[2];
316 object.SoftDroppedP4[3] = SoftDroppedP4[3];
317 object.SoftDroppedP4[4] = SoftDroppedP4[4];
318
319 object.NSubJetsTrimmed = NSubJetsTrimmed;
320 object.NSubJetsPruned = NSubJetsPruned;
321 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
322
323 object.fFactory = fFactory;
324 object.fArray = 0;
325
326 // Copy cluster timing info
327 copy(Ecal_E_t.begin(),Ecal_E_t.end(),back_inserter(object.Ecal_E_t));
328
329 if(fArray && fArray->GetEntriesFast() > 0)
330 {
331 TIter itArray(fArray);
332 TObjArray *array = object.GetCandidates();
333 while((candidate = static_cast<Candidate *>(itArray.Next())))
334 {
335 array->Add(candidate);
336 }
337 }
338}
339
340//------------------------------------------------------------------------------
341
342void Candidate::Clear(Option_t* option)
343{
344 int i;
345 SetUniqueID(0);
346 ResetBit(kIsReferenced);
347 PID = 0;
348 Status = 0;
349 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
350 Charge = 0;
351 Mass = 0.0;
352 IsPU = 0;
353 IsConstituent = 0;
354 BTag = 0;
355 BTagAlgo = 0;
356 BTagDefault = 0;
357 BTagPhysics = 0;
358 BTagNearest2 = 0;
359 BTagNearest3 = 0;
360 BTagHeaviest = 0;
361 BTagHighestPt = 0;
362 FlavorAlgo = 0;
363 FlavorDefault = 0;
364 FlavorPhysics = 0;
365 FlavorNearest2 = 0;
366 FlavorNearest3 = 0;
367 FlavorHeaviest = 0;
368 FlavorHighestPt = 0;
369 TauTag = 0;
370 Eem = 0.0;
371 Ehad = 0.0;
372 Edges[0] = 0.0;
373 Edges[1] = 0.0;
374 Edges[2] = 0.0;
375 Edges[3] = 0.0;
376 DeltaEta = 0.0;
377 DeltaPhi = 0.0;
378 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
379 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
380 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
381 Dxy = 0.0;
382 SDxy = 0.0;
383 Xd = 0.0;
384 Yd = 0.0;
385 Zd = 0.0;
386 NCharged = 0;
387 NNeutrals = 0;
388 Beta = 0.0;
389 BetaStar = 0.0;
390 MeanSqDeltaR = 0.0;
391 PTD = 0.0;
392
393 Ntimes = 0;
394 Ecal_E_t.clear();
395
396 IsolationVar = -999;
397 IsolationVarRhoCorr = -999;
398 SumPtCharged = -999;
399 SumPtNeutral = -999;
400 SumPtChargedPU = -999;
401 SumPt = -999;
402
403 FracPt[0] = 0.0;
404 FracPt[1] = 0.0;
405 FracPt[2] = 0.0;
406 FracPt[3] = 0.0;
407 FracPt[4] = 0.0;
408 Tau[0] = 0.0;
409 Tau[1] = 0.0;
410 Tau[2] = 0.0;
411 Tau[3] = 0.0;
412 Tau[4] = 0.0;
413
414 for(i = 0; i < 5; ++i)
415 {
416 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
417 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
418 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
419 }
420
421 NSubJetsTrimmed = 0;
422 NSubJetsPruned = 0;
423 NSubJetsSoftDropped = 0;
424
425 fArray = 0;
426}
Note: See TracBrowser for help on using the repository browser.