Fork me on GitHub

source: git/classes/DelphesClasses.cc@ adeddd8

ImprovedOutputFile Timing
Last change on this file since adeddd8 was 341014c, checked in by Pavel Demin <pavel-demin@…>, 6 years ago

apply .clang-format to all .h, .cc and .cpp files

  • Property mode set to 100644
File size: 12.2 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 * 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();
[8f7db23]41CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
[3c46e17]42CompBase *Vertex::fgCompare = CompSumPT2<Vertex>::Instance();
[d7d2da3]43CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
44
45//------------------------------------------------------------------------------
46
[2b3ef28]47TLorentzVector GenParticle::P4() const
[d7d2da3]48{
49 TLorentzVector vec;
50 vec.SetPxPyPzE(Px, Py, Pz, E);
51 return vec;
52}
53
54//------------------------------------------------------------------------------
55
[2b3ef28]56TLorentzVector MissingET::P4() const
[4ad7b96]57{
58 TLorentzVector vec;
59 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
60 return vec;
61}
62
63//------------------------------------------------------------------------------
64
[2b3ef28]65TLorentzVector Photon::P4() const
[d7d2da3]66{
67 TLorentzVector vec;
68 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
69 return vec;
70}
71
72//------------------------------------------------------------------------------
73
[2b3ef28]74TLorentzVector Electron::P4() const
[d7d2da3]75{
76 TLorentzVector vec;
77 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
78 return vec;
79}
80
81//------------------------------------------------------------------------------
82
[2b3ef28]83TLorentzVector Muon::P4() const
[d7d2da3]84{
85 TLorentzVector vec;
86 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
87 return vec;
88}
89
90//------------------------------------------------------------------------------
91
[2b3ef28]92TLorentzVector Jet::P4() const
[d7d2da3]93{
94 TLorentzVector vec;
95 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
96 return vec;
97}
98
99//------------------------------------------------------------------------------
100
[2b3ef28]101TLorentzVector Track::P4() const
[d7d2da3]102{
103 TLorentzVector vec;
104 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
105 return vec;
106}
107
108//------------------------------------------------------------------------------
109
[2b3ef28]110TLorentzVector Tower::P4() const
[d7d2da3]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),
[5d2481f]122 IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0),
[2118a6a]123 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
[fe0273c]124 Flavor(0), FlavorAlgo(0), FlavorPhys(0),
125 BTag(0), BTagAlgo(0), BTagPhys(0),
[7429c6a]126 TauTag(0), TauWeight(0.0), Eem(0.0), Ehad(0.0),
[d7d2da3]127 DeltaEta(0.0), DeltaPhi(0.0),
128 Momentum(0.0, 0.0, 0.0, 0.0),
129 Position(0.0, 0.0, 0.0, 0.0),
[2118a6a]130 PositionError(0.0, 0.0, 0.0, 0.0),
131 InitialPosition(0.0, 0.0, 0.0, 0.0),
[d7d2da3]132 Area(0.0, 0.0, 0.0, 0.0),
[80306e6]133 L(0),
[341014c]134 D0(0), ErrorD0(0),
135 DZ(0), ErrorDZ(0),
136 P(0), ErrorP(0),
137 PT(0), ErrorPT(0),
138 CtgTheta(0), ErrorCtgTheta(0),
139 Phi(0), ErrorPhi(0),
140 Xd(0), Yd(0), Zd(0),
[a98c7ef]141 TrackResolution(0),
[24d005f]142 NCharged(0),
143 NNeutrals(0),
144 Beta(0),
145 BetaStar(0),
146 MeanSqDeltaR(0),
[da00c35]147 PTD(0),
[839deb7]148 NTimeHits(-1),
[b62c2da]149 IsolationVar(-999),
150 IsolationVarRhoCorr(-999),
151 SumPtCharged(-999),
152 SumPtNeutral(-999),
153 SumPtChargedPU(-999),
154 SumPt(-999),
[839deb7]155 NSubJetsTrimmed(0),
156 NSubJetsPruned(0),
157 NSubJetsSoftDropped(0),
[e9c0d73]158 ExclYmerge23(0),
159 ExclYmerge34(0),
160 ExclYmerge45(0),
161 ExclYmerge56(0),
[da00c35]162 fFactory(0),
163 fArray(0)
[d7d2da3]164{
[8d200a6]165 int i;
[d7d2da3]166 Edges[0] = 0.0;
167 Edges[1] = 0.0;
168 Edges[2] = 0.0;
169 Edges[3] = 0.0;
[24d005f]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;
[63178fb]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;
[ba75867]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
[8d200a6]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 }
[d7d2da3]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;
[84733ae]263 object.IsRecoPU = IsRecoPU;
[d7d2da3]264 object.IsConstituent = IsConstituent;
[5d2481f]265 object.IsFromConversion = IsFromConversion;
[2118a6a]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;
[fe0273c]273 object.Flavor = Flavor;
274 object.FlavorAlgo = FlavorAlgo;
275 object.FlavorPhys = FlavorPhys;
[d7d2da3]276 object.BTag = BTag;
[edf10ba]277 object.BTagAlgo = BTagAlgo;
[fe0273c]278 object.BTagPhys = BTagPhys;
[d7d2da3]279 object.TauTag = TauTag;
[7429c6a]280 object.TauWeight = TauWeight;
[d7d2da3]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;
[2118a6a]291 object.InitialPosition = InitialPosition;
292 object.PositionError = PositionError;
[43c646a]293 object.Area = Area;
[80306e6]294 object.L = L;
[28c722a]295 object.ErrorT = ErrorT;
[80306e6]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;
[341014c]304 object.CtgTheta = CtgTheta;
[80306e6]305 object.ErrorCtgTheta = ErrorCtgTheta;
306 object.Phi = Phi;
[341014c]307 object.ErrorPhi = ErrorPhi;
[a0431dc]308 object.Xd = Xd;
309 object.Yd = Yd;
310 object.Zd = Zd;
[a98c7ef]311 object.TrackResolution = TrackResolution;
[24d005f]312 object.NCharged = NCharged;
313 object.NNeutrals = NNeutrals;
314 object.Beta = Beta;
315 object.BetaStar = BetaStar;
316 object.MeanSqDeltaR = MeanSqDeltaR;
317 object.PTD = PTD;
[839deb7]318 object.NTimeHits = NTimeHits;
[b62c2da]319 object.IsolationVar = IsolationVar;
320 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
321 object.SumPtCharged = SumPtCharged;
322 object.SumPtNeutral = SumPtNeutral;
323 object.SumPtChargedPU = SumPtChargedPU;
324 object.SumPt = SumPt;
[ab3bdd9]325 object.ClusterIndex = ClusterIndex;
326 object.ClusterNDF = ClusterNDF;
[341014c]327 object.ClusterSigma = ClusterSigma;
[ab3bdd9]328 object.SumPT2 = SumPT2;
[341014c]329
[24d005f]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];
[63178fb]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];
[839deb7]340
[de6d698]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
[edf10ba]357 object.NSubJetsTrimmed = NSubJetsTrimmed;
358 object.NSubJetsPruned = NSubJetsPruned;
[de6d698]359 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
[e4c3fef]360
[341014c]361 object.SoftDroppedJet = SoftDroppedJet;
[ba75867]362 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
363 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
364
[d7d2da3]365 object.fFactory = fFactory;
366 object.fArray = 0;
367
[839deb7]368 // copy cluster timing info
369 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
[3db5282]370
[d7d2da3]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
[341014c]384void Candidate::Clear(Option_t *option)
[d7d2da3]385{
[8d200a6]386 int i;
[d7d2da3]387 SetUniqueID(0);
388 ResetBit(kIsReferenced);
389 PID = 0;
390 Status = 0;
[341014c]391 M1 = -1;
392 M2 = -1;
393 D1 = -1;
394 D2 = -1;
[d7d2da3]395 Charge = 0;
396 Mass = 0.0;
397 IsPU = 0;
[d759c46]398 IsRecoPU = 0;
[d7d2da3]399 IsConstituent = 0;
[5d2481f]400 IsFromConversion = 0;
[fe0273c]401 Flavor = 0;
402 FlavorAlgo = 0;
403 FlavorPhys = 0;
[d7d2da3]404 BTag = 0;
[edf10ba]405 BTagAlgo = 0;
[fe0273c]406 BTagPhys = 0;
[d7d2da3]407 TauTag = 0;
[7429c6a]408 TauWeight = 0.0;
[d7d2da3]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);
[80306e6]419 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
[d7d2da3]420 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[80306e6]421 L = 0.0;
[28c722a]422 ErrorT = 0.0;
[341014c]423 D0 = 0.0;
[80306e6]424 ErrorD0 = 0.0;
425 DZ = 0.0;
426 ErrorDZ = 0.0;
[341014c]427 P = 0.0;
428 ErrorP = 0.0;
[80306e6]429 PT = 0.0;
430 ErrorPT = 0.0;
431 CtgTheta = 0.0;
432 ErrorCtgTheta = 0.0;
433 Phi = 0.0;
434 ErrorPhi = 0.0;
[a0431dc]435 Xd = 0.0;
436 Yd = 0.0;
437 Zd = 0.0;
[a98c7ef]438 TrackResolution = 0.0;
[24d005f]439 NCharged = 0;
440 NNeutrals = 0;
441 Beta = 0.0;
442 BetaStar = 0.0;
443 MeanSqDeltaR = 0.0;
444 PTD = 0.0;
[839deb7]445
446 NTimeHits = 0;
447 ECalEnergyTimePairs.clear();
448
[b62c2da]449 IsolationVar = -999;
450 IsolationVarRhoCorr = -999;
451 SumPtCharged = -999;
452 SumPtNeutral = -999;
453 SumPtChargedPU = -999;
454 SumPt = -999;
[839deb7]455
[ab3bdd9]456 ClusterIndex = -1;
457 ClusterNDF = -99;
[341014c]458 ClusterSigma = 0.0;
[ab3bdd9]459 SumPT2 = 0.0;
460 BTVSumPT2 = 0.0;
461 GenDeltaZ = 0.0;
[341014c]462 GenSumPT2 = 0.0;
463
[24d005f]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;
[63178fb]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;
[839deb7]474
[ba75867]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
[8d200a6]479 for(i = 0; i < 5; ++i)
480 {
481 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[839deb7]482 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[8d200a6]483 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
484 }
485
[edf10ba]486 NSubJetsTrimmed = 0;
487 NSubJetsPruned = 0;
[de6d698]488 NSubJetsSoftDropped = 0;
[839deb7]489
[d7d2da3]490 fArray = 0;
491}
Note: See TracBrowser for help on using the repository browser.