Fork me on GitHub

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

ImprovedOutputFile Timing
Last change on this file since 4d7014e was 4d7014e, checked in by Michele Selvaggi <michele.selvaggi@…>, 5 years ago

added PFcandidate class

  • Property mode set to 100644
File size: 12.5 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();
[4d7014e]41CompBase *ParticleFlowCandidate::fgCompare = CompE<ParticleFlowCandidate>::Instance();
[8f7db23]42CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
[3c46e17]43CompBase *Vertex::fgCompare = CompSumPT2<Vertex>::Instance();
[d7d2da3]44CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
45
46//------------------------------------------------------------------------------
47
[2b3ef28]48TLorentzVector GenParticle::P4() const
[d7d2da3]49{
50 TLorentzVector vec;
51 vec.SetPxPyPzE(Px, Py, Pz, E);
52 return vec;
53}
54
55//------------------------------------------------------------------------------
56
[2b3ef28]57TLorentzVector MissingET::P4() const
[4ad7b96]58{
59 TLorentzVector vec;
60 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
61 return vec;
62}
63
64//------------------------------------------------------------------------------
65
[2b3ef28]66TLorentzVector Photon::P4() const
[d7d2da3]67{
68 TLorentzVector vec;
69 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
70 return vec;
71}
72
73//------------------------------------------------------------------------------
74
[2b3ef28]75TLorentzVector Electron::P4() const
[d7d2da3]76{
77 TLorentzVector vec;
78 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
79 return vec;
80}
81
82//------------------------------------------------------------------------------
83
[2b3ef28]84TLorentzVector Muon::P4() const
[d7d2da3]85{
86 TLorentzVector vec;
87 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
88 return vec;
89}
90
91//------------------------------------------------------------------------------
92
[2b3ef28]93TLorentzVector Jet::P4() const
[d7d2da3]94{
95 TLorentzVector vec;
96 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
97 return vec;
98}
99
100//------------------------------------------------------------------------------
101
[2b3ef28]102TLorentzVector Track::P4() const
[d7d2da3]103{
104 TLorentzVector vec;
105 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
106 return vec;
107}
108
109//------------------------------------------------------------------------------
110
[2b3ef28]111TLorentzVector Tower::P4() const
[d7d2da3]112{
113 TLorentzVector vec;
114 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
115 return vec;
116}
117
118//------------------------------------------------------------------------------
119
[4d7014e]120TLorentzVector ParticleFlowCandidate::P4() const
121{
122 TLorentzVector vec;
123 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
124 return vec;
125}
126
127//------------------------------------------------------------------------------
128
[d7d2da3]129Candidate::Candidate() :
130 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
131 Charge(0), Mass(0.0),
[5d2481f]132 IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0),
[fe0273c]133 Flavor(0), FlavorAlgo(0), FlavorPhys(0),
134 BTag(0), BTagAlgo(0), BTagPhys(0),
[7429c6a]135 TauTag(0), TauWeight(0.0), Eem(0.0), Ehad(0.0),
[d7d2da3]136 DeltaEta(0.0), DeltaPhi(0.0),
137 Momentum(0.0, 0.0, 0.0, 0.0),
138 Position(0.0, 0.0, 0.0, 0.0),
[2118a6a]139 InitialPosition(0.0, 0.0, 0.0, 0.0),
[1a4956e]140 PositionError(0.0, 0.0, 0.0, 0.0),
[d7d2da3]141 Area(0.0, 0.0, 0.0, 0.0),
[80306e6]142 L(0),
[341014c]143 D0(0), ErrorD0(0),
144 DZ(0), ErrorDZ(0),
145 P(0), ErrorP(0),
146 PT(0), ErrorPT(0),
147 CtgTheta(0), ErrorCtgTheta(0),
148 Phi(0), ErrorPhi(0),
149 Xd(0), Yd(0), Zd(0),
[a98c7ef]150 TrackResolution(0),
[24d005f]151 NCharged(0),
152 NNeutrals(0),
153 Beta(0),
154 BetaStar(0),
155 MeanSqDeltaR(0),
[da00c35]156 PTD(0),
[839deb7]157 NTimeHits(-1),
[b62c2da]158 IsolationVar(-999),
159 IsolationVarRhoCorr(-999),
160 SumPtCharged(-999),
161 SumPtNeutral(-999),
162 SumPtChargedPU(-999),
163 SumPt(-999),
[1a4956e]164 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
[839deb7]165 NSubJetsTrimmed(0),
166 NSubJetsPruned(0),
167 NSubJetsSoftDropped(0),
[e9c0d73]168 ExclYmerge23(0),
169 ExclYmerge34(0),
170 ExclYmerge45(0),
171 ExclYmerge56(0),
[da00c35]172 fFactory(0),
173 fArray(0)
[d7d2da3]174{
[8d200a6]175 int i;
[d7d2da3]176 Edges[0] = 0.0;
177 Edges[1] = 0.0;
178 Edges[2] = 0.0;
179 Edges[3] = 0.0;
[24d005f]180 FracPt[0] = 0.0;
181 FracPt[1] = 0.0;
182 FracPt[2] = 0.0;
183 FracPt[3] = 0.0;
184 FracPt[4] = 0.0;
[63178fb]185 Tau[0] = 0.0;
186 Tau[1] = 0.0;
187 Tau[2] = 0.0;
188 Tau[3] = 0.0;
189 Tau[4] = 0.0;
[ba75867]190
191 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
192 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
193 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
194
[8d200a6]195 for(i = 0; i < 5; ++i)
196 {
197 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
198 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
199 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
200 }
[d7d2da3]201}
202
203//------------------------------------------------------------------------------
204
205void Candidate::AddCandidate(Candidate *object)
206{
207 if(!fArray) fArray = fFactory->NewArray();
208 fArray->Add(object);
209}
210
211//------------------------------------------------------------------------------
212
213TObjArray *Candidate::GetCandidates()
214{
215 if(!fArray) fArray = fFactory->NewArray();
216 return fArray;
217}
218
219//------------------------------------------------------------------------------
220
221Bool_t Candidate::Overlaps(const Candidate *object) const
222{
223 const Candidate *candidate;
224
225 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
226
227 if(fArray)
228 {
229 TIter it(fArray);
230 while((candidate = static_cast<Candidate *>(it.Next())))
231 {
232 if(candidate->Overlaps(object)) return kTRUE;
233 }
234 }
235
236 if(object->fArray)
237 {
238 TIter it(object->fArray);
239 while((candidate = static_cast<Candidate *>(it.Next())))
240 {
241 if(candidate->Overlaps(this)) return kTRUE;
242 }
243 }
244
245 return kFALSE;
246}
247
248//------------------------------------------------------------------------------
249
250TObject *Candidate::Clone(const char *newname) const
251{
252 Candidate *object = fFactory->NewCandidate();
253 Copy(*object);
254 return object;
255}
256
257//------------------------------------------------------------------------------
258
259void Candidate::Copy(TObject &obj) const
260{
261 Candidate &object = static_cast<Candidate &>(obj);
262 Candidate *candidate;
263
264 object.PID = PID;
265 object.Status = Status;
266 object.M1 = M1;
267 object.M2 = M2;
268 object.D1 = D1;
269 object.D2 = D2;
270 object.Charge = Charge;
271 object.Mass = Mass;
272 object.IsPU = IsPU;
[84733ae]273 object.IsRecoPU = IsRecoPU;
[d7d2da3]274 object.IsConstituent = IsConstituent;
[5d2481f]275 object.IsFromConversion = IsFromConversion;
[2118a6a]276 object.ClusterIndex = ClusterIndex;
277 object.ClusterNDF = ClusterNDF;
278 object.ClusterSigma = ClusterSigma;
279 object.SumPT2 = SumPT2;
280 object.BTVSumPT2 = BTVSumPT2;
281 object.GenDeltaZ = GenDeltaZ;
282 object.GenSumPT2 = GenSumPT2;
[fe0273c]283 object.Flavor = Flavor;
284 object.FlavorAlgo = FlavorAlgo;
285 object.FlavorPhys = FlavorPhys;
[d7d2da3]286 object.BTag = BTag;
[edf10ba]287 object.BTagAlgo = BTagAlgo;
[fe0273c]288 object.BTagPhys = BTagPhys;
[d7d2da3]289 object.TauTag = TauTag;
[7429c6a]290 object.TauWeight = TauWeight;
[d7d2da3]291 object.Eem = Eem;
292 object.Ehad = Ehad;
293 object.Edges[0] = Edges[0];
294 object.Edges[1] = Edges[1];
295 object.Edges[2] = Edges[2];
296 object.Edges[3] = Edges[3];
297 object.DeltaEta = DeltaEta;
298 object.DeltaPhi = DeltaPhi;
299 object.Momentum = Momentum;
300 object.Position = Position;
[2118a6a]301 object.InitialPosition = InitialPosition;
302 object.PositionError = PositionError;
[43c646a]303 object.Area = Area;
[80306e6]304 object.L = L;
[28c722a]305 object.ErrorT = ErrorT;
[80306e6]306 object.D0 = D0;
307 object.ErrorD0 = ErrorD0;
308 object.DZ = DZ;
309 object.ErrorDZ = ErrorDZ;
310 object.P = P;
311 object.ErrorP = ErrorP;
312 object.PT = PT;
313 object.ErrorPT = ErrorPT;
[341014c]314 object.CtgTheta = CtgTheta;
[80306e6]315 object.ErrorCtgTheta = ErrorCtgTheta;
316 object.Phi = Phi;
[341014c]317 object.ErrorPhi = ErrorPhi;
[a0431dc]318 object.Xd = Xd;
319 object.Yd = Yd;
320 object.Zd = Zd;
[a98c7ef]321 object.TrackResolution = TrackResolution;
[24d005f]322 object.NCharged = NCharged;
323 object.NNeutrals = NNeutrals;
324 object.Beta = Beta;
325 object.BetaStar = BetaStar;
326 object.MeanSqDeltaR = MeanSqDeltaR;
327 object.PTD = PTD;
[839deb7]328 object.NTimeHits = NTimeHits;
[b62c2da]329 object.IsolationVar = IsolationVar;
330 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
331 object.SumPtCharged = SumPtCharged;
332 object.SumPtNeutral = SumPtNeutral;
333 object.SumPtChargedPU = SumPtChargedPU;
334 object.SumPt = SumPt;
[ab3bdd9]335 object.ClusterIndex = ClusterIndex;
336 object.ClusterNDF = ClusterNDF;
[341014c]337 object.ClusterSigma = ClusterSigma;
[ab3bdd9]338 object.SumPT2 = SumPT2;
[341014c]339
[24d005f]340 object.FracPt[0] = FracPt[0];
341 object.FracPt[1] = FracPt[1];
342 object.FracPt[2] = FracPt[2];
343 object.FracPt[3] = FracPt[3];
344 object.FracPt[4] = FracPt[4];
[63178fb]345 object.Tau[0] = Tau[0];
346 object.Tau[1] = Tau[1];
347 object.Tau[2] = Tau[2];
348 object.Tau[3] = Tau[3];
349 object.Tau[4] = Tau[4];
[839deb7]350
[de6d698]351 object.TrimmedP4[0] = TrimmedP4[0];
352 object.TrimmedP4[1] = TrimmedP4[1];
353 object.TrimmedP4[2] = TrimmedP4[2];
354 object.TrimmedP4[3] = TrimmedP4[3];
355 object.TrimmedP4[4] = TrimmedP4[4];
356 object.PrunedP4[0] = PrunedP4[0];
357 object.PrunedP4[1] = PrunedP4[1];
358 object.PrunedP4[2] = PrunedP4[2];
359 object.PrunedP4[3] = PrunedP4[3];
360 object.PrunedP4[4] = PrunedP4[4];
361 object.SoftDroppedP4[0] = SoftDroppedP4[0];
362 object.SoftDroppedP4[1] = SoftDroppedP4[1];
363 object.SoftDroppedP4[2] = SoftDroppedP4[2];
364 object.SoftDroppedP4[3] = SoftDroppedP4[3];
365 object.SoftDroppedP4[4] = SoftDroppedP4[4];
366
[edf10ba]367 object.NSubJetsTrimmed = NSubJetsTrimmed;
368 object.NSubJetsPruned = NSubJetsPruned;
[de6d698]369 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
[e4c3fef]370
[341014c]371 object.SoftDroppedJet = SoftDroppedJet;
[ba75867]372 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
373 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
374
[d7d2da3]375 object.fFactory = fFactory;
376 object.fArray = 0;
377
[839deb7]378 // copy cluster timing info
379 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
[3db5282]380
[d7d2da3]381 if(fArray && fArray->GetEntriesFast() > 0)
382 {
383 TIter itArray(fArray);
384 TObjArray *array = object.GetCandidates();
385 while((candidate = static_cast<Candidate *>(itArray.Next())))
386 {
387 array->Add(candidate);
388 }
389 }
390}
391
392//------------------------------------------------------------------------------
393
[341014c]394void Candidate::Clear(Option_t *option)
[d7d2da3]395{
[8d200a6]396 int i;
[d7d2da3]397 SetUniqueID(0);
398 ResetBit(kIsReferenced);
399 PID = 0;
400 Status = 0;
[341014c]401 M1 = -1;
402 M2 = -1;
403 D1 = -1;
404 D2 = -1;
[d7d2da3]405 Charge = 0;
406 Mass = 0.0;
407 IsPU = 0;
[d759c46]408 IsRecoPU = 0;
[d7d2da3]409 IsConstituent = 0;
[5d2481f]410 IsFromConversion = 0;
[fe0273c]411 Flavor = 0;
412 FlavorAlgo = 0;
413 FlavorPhys = 0;
[d7d2da3]414 BTag = 0;
[edf10ba]415 BTagAlgo = 0;
[fe0273c]416 BTagPhys = 0;
[d7d2da3]417 TauTag = 0;
[7429c6a]418 TauWeight = 0.0;
[d7d2da3]419 Eem = 0.0;
420 Ehad = 0.0;
421 Edges[0] = 0.0;
422 Edges[1] = 0.0;
423 Edges[2] = 0.0;
424 Edges[3] = 0.0;
425 DeltaEta = 0.0;
426 DeltaPhi = 0.0;
427 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
428 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
[80306e6]429 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
[d7d2da3]430 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[80306e6]431 L = 0.0;
[28c722a]432 ErrorT = 0.0;
[341014c]433 D0 = 0.0;
[80306e6]434 ErrorD0 = 0.0;
435 DZ = 0.0;
436 ErrorDZ = 0.0;
[341014c]437 P = 0.0;
438 ErrorP = 0.0;
[80306e6]439 PT = 0.0;
440 ErrorPT = 0.0;
441 CtgTheta = 0.0;
442 ErrorCtgTheta = 0.0;
443 Phi = 0.0;
444 ErrorPhi = 0.0;
[a0431dc]445 Xd = 0.0;
446 Yd = 0.0;
447 Zd = 0.0;
[a98c7ef]448 TrackResolution = 0.0;
[24d005f]449 NCharged = 0;
450 NNeutrals = 0;
451 Beta = 0.0;
452 BetaStar = 0.0;
453 MeanSqDeltaR = 0.0;
454 PTD = 0.0;
[839deb7]455
456 NTimeHits = 0;
457 ECalEnergyTimePairs.clear();
458
[b62c2da]459 IsolationVar = -999;
460 IsolationVarRhoCorr = -999;
461 SumPtCharged = -999;
462 SumPtNeutral = -999;
463 SumPtChargedPU = -999;
464 SumPt = -999;
[839deb7]465
[ab3bdd9]466 ClusterIndex = -1;
467 ClusterNDF = -99;
[341014c]468 ClusterSigma = 0.0;
[ab3bdd9]469 SumPT2 = 0.0;
470 BTVSumPT2 = 0.0;
471 GenDeltaZ = 0.0;
[341014c]472 GenSumPT2 = 0.0;
473
[24d005f]474 FracPt[0] = 0.0;
475 FracPt[1] = 0.0;
476 FracPt[2] = 0.0;
477 FracPt[3] = 0.0;
478 FracPt[4] = 0.0;
[63178fb]479 Tau[0] = 0.0;
480 Tau[1] = 0.0;
481 Tau[2] = 0.0;
482 Tau[3] = 0.0;
483 Tau[4] = 0.0;
[839deb7]484
[ba75867]485 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
486 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
487 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
488
[8d200a6]489 for(i = 0; i < 5; ++i)
490 {
491 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[839deb7]492 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[8d200a6]493 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
494 }
495
[edf10ba]496 NSubJetsTrimmed = 0;
497 NSubJetsPruned = 0;
[de6d698]498 NSubJetsSoftDropped = 0;
[839deb7]499
[d7d2da3]500 fArray = 0;
501}
Note: See TracBrowser for help on using the repository browser.