Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 4d3fb73

ImprovedOutputFile Timing
Last change on this file since 4d3fb73 was 1a4956e, checked in by Pavel Demin <pavel-demin@…>, 6 years ago

reorder member initializer lists

  • Property mode set to 100644
File size: 12.2 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 * Definition of classes to be stored in the root tree.
22 * Function CompareXYZ sorts objects by the variable XYZ that MUST be
23 * present in the data members of the root tree class of the branch.
24 *
25 * \author P. Demin - UCL, Louvain-la-Neuve
26 *
27 */
28
29#include "classes/DelphesClasses.h"
30
31#include "classes/DelphesFactory.h"
32#include "classes/SortableObject.h"
33
34CompBase *GenParticle::fgCompare = 0;
35CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
36CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
37CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
38CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
39CompBase *Track::fgCompare = CompPT<Track>::Instance();
40CompBase *Tower::fgCompare = CompE<Tower>::Instance();
41CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
42CompBase *Vertex::fgCompare = CompSumPT2<Vertex>::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), IsFromConversion(0),
123 Flavor(0), FlavorAlgo(0), FlavorPhys(0),
124 BTag(0), BTagAlgo(0), BTagPhys(0),
125 TauTag(0), TauWeight(0.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 InitialPosition(0.0, 0.0, 0.0, 0.0),
130 PositionError(0.0, 0.0, 0.0, 0.0),
131 Area(0.0, 0.0, 0.0, 0.0),
132 L(0),
133 D0(0), ErrorD0(0),
134 DZ(0), ErrorDZ(0),
135 P(0), ErrorP(0),
136 PT(0), ErrorPT(0),
137 CtgTheta(0), ErrorCtgTheta(0),
138 Phi(0), ErrorPhi(0),
139 Xd(0), Yd(0), Zd(0),
140 TrackResolution(0),
141 NCharged(0),
142 NNeutrals(0),
143 Beta(0),
144 BetaStar(0),
145 MeanSqDeltaR(0),
146 PTD(0),
147 NTimeHits(-1),
148 IsolationVar(-999),
149 IsolationVarRhoCorr(-999),
150 SumPtCharged(-999),
151 SumPtNeutral(-999),
152 SumPtChargedPU(-999),
153 SumPt(-999),
154 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
155 NSubJetsTrimmed(0),
156 NSubJetsPruned(0),
157 NSubJetsSoftDropped(0),
158 ExclYmerge23(0),
159 ExclYmerge34(0),
160 ExclYmerge45(0),
161 ExclYmerge56(0),
162 fFactory(0),
163 fArray(0)
164{
165 int i;
166 Edges[0] = 0.0;
167 Edges[1] = 0.0;
168 Edges[2] = 0.0;
169 Edges[3] = 0.0;
170 FracPt[0] = 0.0;
171 FracPt[1] = 0.0;
172 FracPt[2] = 0.0;
173 FracPt[3] = 0.0;
174 FracPt[4] = 0.0;
175 Tau[0] = 0.0;
176 Tau[1] = 0.0;
177 Tau[2] = 0.0;
178 Tau[3] = 0.0;
179 Tau[4] = 0.0;
180
181 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
182 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
183 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
184
185 for(i = 0; i < 5; ++i)
186 {
187 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
188 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
189 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
190 }
191}
192
193//------------------------------------------------------------------------------
194
195void Candidate::AddCandidate(Candidate *object)
196{
197 if(!fArray) fArray = fFactory->NewArray();
198 fArray->Add(object);
199}
200
201//------------------------------------------------------------------------------
202
203TObjArray *Candidate::GetCandidates()
204{
205 if(!fArray) fArray = fFactory->NewArray();
206 return fArray;
207}
208
209//------------------------------------------------------------------------------
210
211Bool_t Candidate::Overlaps(const Candidate *object) const
212{
213 const Candidate *candidate;
214
215 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
216
217 if(fArray)
218 {
219 TIter it(fArray);
220 while((candidate = static_cast<Candidate *>(it.Next())))
221 {
222 if(candidate->Overlaps(object)) return kTRUE;
223 }
224 }
225
226 if(object->fArray)
227 {
228 TIter it(object->fArray);
229 while((candidate = static_cast<Candidate *>(it.Next())))
230 {
231 if(candidate->Overlaps(this)) return kTRUE;
232 }
233 }
234
235 return kFALSE;
236}
237
238//------------------------------------------------------------------------------
239
240TObject *Candidate::Clone(const char *newname) const
241{
242 Candidate *object = fFactory->NewCandidate();
243 Copy(*object);
244 return object;
245}
246
247//------------------------------------------------------------------------------
248
249void Candidate::Copy(TObject &obj) const
250{
251 Candidate &object = static_cast<Candidate &>(obj);
252 Candidate *candidate;
253
254 object.PID = PID;
255 object.Status = Status;
256 object.M1 = M1;
257 object.M2 = M2;
258 object.D1 = D1;
259 object.D2 = D2;
260 object.Charge = Charge;
261 object.Mass = Mass;
262 object.IsPU = IsPU;
263 object.IsRecoPU = IsRecoPU;
264 object.IsConstituent = IsConstituent;
265 object.IsFromConversion = IsFromConversion;
266 object.ClusterIndex = ClusterIndex;
267 object.ClusterNDF = ClusterNDF;
268 object.ClusterSigma = ClusterSigma;
269 object.SumPT2 = SumPT2;
270 object.BTVSumPT2 = BTVSumPT2;
271 object.GenDeltaZ = GenDeltaZ;
272 object.GenSumPT2 = GenSumPT2;
273 object.Flavor = Flavor;
274 object.FlavorAlgo = FlavorAlgo;
275 object.FlavorPhys = FlavorPhys;
276 object.BTag = BTag;
277 object.BTagAlgo = BTagAlgo;
278 object.BTagPhys = BTagPhys;
279 object.TauTag = TauTag;
280 object.TauWeight = TauWeight;
281 object.Eem = Eem;
282 object.Ehad = Ehad;
283 object.Edges[0] = Edges[0];
284 object.Edges[1] = Edges[1];
285 object.Edges[2] = Edges[2];
286 object.Edges[3] = Edges[3];
287 object.DeltaEta = DeltaEta;
288 object.DeltaPhi = DeltaPhi;
289 object.Momentum = Momentum;
290 object.Position = Position;
291 object.InitialPosition = InitialPosition;
292 object.PositionError = PositionError;
293 object.Area = Area;
294 object.L = L;
295 object.ErrorT = ErrorT;
296 object.D0 = D0;
297 object.ErrorD0 = ErrorD0;
298 object.DZ = DZ;
299 object.ErrorDZ = ErrorDZ;
300 object.P = P;
301 object.ErrorP = ErrorP;
302 object.PT = PT;
303 object.ErrorPT = ErrorPT;
304 object.CtgTheta = CtgTheta;
305 object.ErrorCtgTheta = ErrorCtgTheta;
306 object.Phi = Phi;
307 object.ErrorPhi = ErrorPhi;
308 object.Xd = Xd;
309 object.Yd = Yd;
310 object.Zd = Zd;
311 object.TrackResolution = TrackResolution;
312 object.NCharged = NCharged;
313 object.NNeutrals = NNeutrals;
314 object.Beta = Beta;
315 object.BetaStar = BetaStar;
316 object.MeanSqDeltaR = MeanSqDeltaR;
317 object.PTD = PTD;
318 object.NTimeHits = NTimeHits;
319 object.IsolationVar = IsolationVar;
320 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
321 object.SumPtCharged = SumPtCharged;
322 object.SumPtNeutral = SumPtNeutral;
323 object.SumPtChargedPU = SumPtChargedPU;
324 object.SumPt = SumPt;
325 object.ClusterIndex = ClusterIndex;
326 object.ClusterNDF = ClusterNDF;
327 object.ClusterSigma = ClusterSigma;
328 object.SumPT2 = SumPT2;
329
330 object.FracPt[0] = FracPt[0];
331 object.FracPt[1] = FracPt[1];
332 object.FracPt[2] = FracPt[2];
333 object.FracPt[3] = FracPt[3];
334 object.FracPt[4] = FracPt[4];
335 object.Tau[0] = Tau[0];
336 object.Tau[1] = Tau[1];
337 object.Tau[2] = Tau[2];
338 object.Tau[3] = Tau[3];
339 object.Tau[4] = Tau[4];
340
341 object.TrimmedP4[0] = TrimmedP4[0];
342 object.TrimmedP4[1] = TrimmedP4[1];
343 object.TrimmedP4[2] = TrimmedP4[2];
344 object.TrimmedP4[3] = TrimmedP4[3];
345 object.TrimmedP4[4] = TrimmedP4[4];
346 object.PrunedP4[0] = PrunedP4[0];
347 object.PrunedP4[1] = PrunedP4[1];
348 object.PrunedP4[2] = PrunedP4[2];
349 object.PrunedP4[3] = PrunedP4[3];
350 object.PrunedP4[4] = PrunedP4[4];
351 object.SoftDroppedP4[0] = SoftDroppedP4[0];
352 object.SoftDroppedP4[1] = SoftDroppedP4[1];
353 object.SoftDroppedP4[2] = SoftDroppedP4[2];
354 object.SoftDroppedP4[3] = SoftDroppedP4[3];
355 object.SoftDroppedP4[4] = SoftDroppedP4[4];
356
357 object.NSubJetsTrimmed = NSubJetsTrimmed;
358 object.NSubJetsPruned = NSubJetsPruned;
359 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
360
361 object.SoftDroppedJet = SoftDroppedJet;
362 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
363 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
364
365 object.fFactory = fFactory;
366 object.fArray = 0;
367
368 // copy cluster timing info
369 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
370
371 if(fArray && fArray->GetEntriesFast() > 0)
372 {
373 TIter itArray(fArray);
374 TObjArray *array = object.GetCandidates();
375 while((candidate = static_cast<Candidate *>(itArray.Next())))
376 {
377 array->Add(candidate);
378 }
379 }
380}
381
382//------------------------------------------------------------------------------
383
384void Candidate::Clear(Option_t *option)
385{
386 int i;
387 SetUniqueID(0);
388 ResetBit(kIsReferenced);
389 PID = 0;
390 Status = 0;
391 M1 = -1;
392 M2 = -1;
393 D1 = -1;
394 D2 = -1;
395 Charge = 0;
396 Mass = 0.0;
397 IsPU = 0;
398 IsRecoPU = 0;
399 IsConstituent = 0;
400 IsFromConversion = 0;
401 Flavor = 0;
402 FlavorAlgo = 0;
403 FlavorPhys = 0;
404 BTag = 0;
405 BTagAlgo = 0;
406 BTagPhys = 0;
407 TauTag = 0;
408 TauWeight = 0.0;
409 Eem = 0.0;
410 Ehad = 0.0;
411 Edges[0] = 0.0;
412 Edges[1] = 0.0;
413 Edges[2] = 0.0;
414 Edges[3] = 0.0;
415 DeltaEta = 0.0;
416 DeltaPhi = 0.0;
417 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
418 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
419 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
420 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
421 L = 0.0;
422 ErrorT = 0.0;
423 D0 = 0.0;
424 ErrorD0 = 0.0;
425 DZ = 0.0;
426 ErrorDZ = 0.0;
427 P = 0.0;
428 ErrorP = 0.0;
429 PT = 0.0;
430 ErrorPT = 0.0;
431 CtgTheta = 0.0;
432 ErrorCtgTheta = 0.0;
433 Phi = 0.0;
434 ErrorPhi = 0.0;
435 Xd = 0.0;
436 Yd = 0.0;
437 Zd = 0.0;
438 TrackResolution = 0.0;
439 NCharged = 0;
440 NNeutrals = 0;
441 Beta = 0.0;
442 BetaStar = 0.0;
443 MeanSqDeltaR = 0.0;
444 PTD = 0.0;
445
446 NTimeHits = 0;
447 ECalEnergyTimePairs.clear();
448
449 IsolationVar = -999;
450 IsolationVarRhoCorr = -999;
451 SumPtCharged = -999;
452 SumPtNeutral = -999;
453 SumPtChargedPU = -999;
454 SumPt = -999;
455
456 ClusterIndex = -1;
457 ClusterNDF = -99;
458 ClusterSigma = 0.0;
459 SumPT2 = 0.0;
460 BTVSumPT2 = 0.0;
461 GenDeltaZ = 0.0;
462 GenSumPT2 = 0.0;
463
464 FracPt[0] = 0.0;
465 FracPt[1] = 0.0;
466 FracPt[2] = 0.0;
467 FracPt[3] = 0.0;
468 FracPt[4] = 0.0;
469 Tau[0] = 0.0;
470 Tau[1] = 0.0;
471 Tau[2] = 0.0;
472 Tau[3] = 0.0;
473 Tau[4] = 0.0;
474
475 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
476 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
477 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
478
479 for(i = 0; i < 5; ++i)
480 {
481 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
482 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
483 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
484 }
485
486 NSubJetsTrimmed = 0;
487 NSubJetsPruned = 0;
488 NSubJetsSoftDropped = 0;
489
490 fArray = 0;
491}
Note: See TracBrowser for help on using the repository browser.