Fork me on GitHub

source: git/classes/DelphesClasses.cc @ c18dca6

Last change on this file since c18dca6 was c18dca6, checked in by Michele Selvaggi <michele.selvaggi@…>, 2 months ago

added ACTS track covariance to internat Delphes candidates

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