Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 25291dd

Last change on this file since 25291dd was 3051ea17, checked in by Michele Selvaggi <michele.selvaggi@…>, 4 years ago

added track curvature to candidate class and switched back to regular covariance matrix

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