Fork me on GitHub

source: git/classes/DelphesClasses.cc@ fec809d

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

added energy loss module

  • Property mode set to 100644
File size: 12.8 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),
[84a097e]149 Xd(0), Yd(0), Zd(0), Td(0),
[b4a3c55]150 DeDx(0),
[84a097e]151 VertexingWeight(0),
[a98c7ef]152 TrackResolution(0),
[24d005f]153 NCharged(0),
154 NNeutrals(0),
[c614dd7]155 NeutralEnergyFraction(0), // charged energy fraction
156 ChargedEnergyFraction(0), // neutral energy fraction
[24d005f]157 Beta(0),
158 BetaStar(0),
159 MeanSqDeltaR(0),
[da00c35]160 PTD(0),
[839deb7]161 NTimeHits(-1),
[b62c2da]162 IsolationVar(-999),
163 IsolationVarRhoCorr(-999),
164 SumPtCharged(-999),
165 SumPtNeutral(-999),
166 SumPtChargedPU(-999),
167 SumPt(-999),
[1a4956e]168 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
[839deb7]169 NSubJetsTrimmed(0),
170 NSubJetsPruned(0),
171 NSubJetsSoftDropped(0),
[e9c0d73]172 ExclYmerge23(0),
173 ExclYmerge34(0),
174 ExclYmerge45(0),
175 ExclYmerge56(0),
[da00c35]176 fFactory(0),
177 fArray(0)
[d7d2da3]178{
[8d200a6]179 int i;
[d7d2da3]180 Edges[0] = 0.0;
181 Edges[1] = 0.0;
182 Edges[2] = 0.0;
183 Edges[3] = 0.0;
[24d005f]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;
[63178fb]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;
[ba75867]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
[8d200a6]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 }
[d7d2da3]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;
[84733ae]277 object.IsRecoPU = IsRecoPU;
[d7d2da3]278 object.IsConstituent = IsConstituent;
[5d2481f]279 object.IsFromConversion = IsFromConversion;
[2118a6a]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;
[fe0273c]287 object.Flavor = Flavor;
288 object.FlavorAlgo = FlavorAlgo;
289 object.FlavorPhys = FlavorPhys;
[d7d2da3]290 object.BTag = BTag;
[edf10ba]291 object.BTagAlgo = BTagAlgo;
[fe0273c]292 object.BTagPhys = BTagPhys;
[d7d2da3]293 object.TauTag = TauTag;
[7429c6a]294 object.TauWeight = TauWeight;
[d7d2da3]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;
[2118a6a]305 object.InitialPosition = InitialPosition;
306 object.PositionError = PositionError;
[43c646a]307 object.Area = Area;
[80306e6]308 object.L = L;
[b4a3c55]309 object.DeDx = DeDx;
[28c722a]310 object.ErrorT = ErrorT;
[80306e6]311 object.D0 = D0;
312 object.ErrorD0 = ErrorD0;
313 object.DZ = DZ;
314 object.ErrorDZ = ErrorDZ;
315 object.P = P;
316 object.ErrorP = ErrorP;
317 object.PT = PT;
318 object.ErrorPT = ErrorPT;
[341014c]319 object.CtgTheta = CtgTheta;
[80306e6]320 object.ErrorCtgTheta = ErrorCtgTheta;
321 object.Phi = Phi;
[341014c]322 object.ErrorPhi = ErrorPhi;
[84a097e]323 object.Td = Td;
[a0431dc]324 object.Xd = Xd;
325 object.Yd = Yd;
326 object.Zd = Zd;
[84a097e]327 object.VertexingWeight = Zd;
[a98c7ef]328 object.TrackResolution = TrackResolution;
[24d005f]329 object.NCharged = NCharged;
330 object.NNeutrals = NNeutrals;
[c614dd7]331 object.NeutralEnergyFraction = NeutralEnergyFraction;
332 object.ChargedEnergyFraction = ChargedEnergyFraction;
[24d005f]333 object.Beta = Beta;
334 object.BetaStar = BetaStar;
335 object.MeanSqDeltaR = MeanSqDeltaR;
336 object.PTD = PTD;
[839deb7]337 object.NTimeHits = NTimeHits;
[b62c2da]338 object.IsolationVar = IsolationVar;
339 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
340 object.SumPtCharged = SumPtCharged;
341 object.SumPtNeutral = SumPtNeutral;
342 object.SumPtChargedPU = SumPtChargedPU;
343 object.SumPt = SumPt;
[ab3bdd9]344 object.ClusterIndex = ClusterIndex;
345 object.ClusterNDF = ClusterNDF;
[341014c]346 object.ClusterSigma = ClusterSigma;
[ab3bdd9]347 object.SumPT2 = SumPT2;
[341014c]348
[24d005f]349 object.FracPt[0] = FracPt[0];
350 object.FracPt[1] = FracPt[1];
351 object.FracPt[2] = FracPt[2];
352 object.FracPt[3] = FracPt[3];
353 object.FracPt[4] = FracPt[4];
[63178fb]354 object.Tau[0] = Tau[0];
355 object.Tau[1] = Tau[1];
356 object.Tau[2] = Tau[2];
357 object.Tau[3] = Tau[3];
358 object.Tau[4] = Tau[4];
[839deb7]359
[de6d698]360 object.TrimmedP4[0] = TrimmedP4[0];
361 object.TrimmedP4[1] = TrimmedP4[1];
362 object.TrimmedP4[2] = TrimmedP4[2];
363 object.TrimmedP4[3] = TrimmedP4[3];
364 object.TrimmedP4[4] = TrimmedP4[4];
365 object.PrunedP4[0] = PrunedP4[0];
366 object.PrunedP4[1] = PrunedP4[1];
367 object.PrunedP4[2] = PrunedP4[2];
368 object.PrunedP4[3] = PrunedP4[3];
369 object.PrunedP4[4] = PrunedP4[4];
370 object.SoftDroppedP4[0] = SoftDroppedP4[0];
371 object.SoftDroppedP4[1] = SoftDroppedP4[1];
372 object.SoftDroppedP4[2] = SoftDroppedP4[2];
373 object.SoftDroppedP4[3] = SoftDroppedP4[3];
374 object.SoftDroppedP4[4] = SoftDroppedP4[4];
375
[edf10ba]376 object.NSubJetsTrimmed = NSubJetsTrimmed;
377 object.NSubJetsPruned = NSubJetsPruned;
[de6d698]378 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
[e4c3fef]379
[341014c]380 object.SoftDroppedJet = SoftDroppedJet;
[ba75867]381 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
382 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
383
[d7d2da3]384 object.fFactory = fFactory;
385 object.fArray = 0;
386
[839deb7]387 // copy cluster timing info
388 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
[3db5282]389
[d7d2da3]390 if(fArray && fArray->GetEntriesFast() > 0)
391 {
392 TIter itArray(fArray);
393 TObjArray *array = object.GetCandidates();
394 while((candidate = static_cast<Candidate *>(itArray.Next())))
395 {
396 array->Add(candidate);
397 }
398 }
399}
400
401//------------------------------------------------------------------------------
402
[341014c]403void Candidate::Clear(Option_t *option)
[d7d2da3]404{
[8d200a6]405 int i;
[d7d2da3]406 SetUniqueID(0);
407 ResetBit(kIsReferenced);
408 PID = 0;
409 Status = 0;
[341014c]410 M1 = -1;
411 M2 = -1;
412 D1 = -1;
413 D2 = -1;
[d7d2da3]414 Charge = 0;
415 Mass = 0.0;
416 IsPU = 0;
[d759c46]417 IsRecoPU = 0;
[d7d2da3]418 IsConstituent = 0;
[5d2481f]419 IsFromConversion = 0;
[fe0273c]420 Flavor = 0;
421 FlavorAlgo = 0;
422 FlavorPhys = 0;
[d7d2da3]423 BTag = 0;
[edf10ba]424 BTagAlgo = 0;
[fe0273c]425 BTagPhys = 0;
[d7d2da3]426 TauTag = 0;
[7429c6a]427 TauWeight = 0.0;
[d7d2da3]428 Eem = 0.0;
429 Ehad = 0.0;
430 Edges[0] = 0.0;
431 Edges[1] = 0.0;
432 Edges[2] = 0.0;
433 Edges[3] = 0.0;
434 DeltaEta = 0.0;
435 DeltaPhi = 0.0;
436 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
437 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
[80306e6]438 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
[d7d2da3]439 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[80306e6]440 L = 0.0;
[b4a3c55]441 DeDx = 0.0;
[28c722a]442 ErrorT = 0.0;
[341014c]443 D0 = 0.0;
[80306e6]444 ErrorD0 = 0.0;
445 DZ = 0.0;
446 ErrorDZ = 0.0;
[341014c]447 P = 0.0;
448 ErrorP = 0.0;
[80306e6]449 PT = 0.0;
450 ErrorPT = 0.0;
451 CtgTheta = 0.0;
452 ErrorCtgTheta = 0.0;
453 Phi = 0.0;
454 ErrorPhi = 0.0;
[84a097e]455 Td = 0.0;
[a0431dc]456 Xd = 0.0;
457 Yd = 0.0;
458 Zd = 0.0;
[84a097e]459 VertexingWeight = 0.0;
[a98c7ef]460 TrackResolution = 0.0;
[24d005f]461 NCharged = 0;
462 NNeutrals = 0;
463 Beta = 0.0;
464 BetaStar = 0.0;
465 MeanSqDeltaR = 0.0;
466 PTD = 0.0;
[839deb7]467
468 NTimeHits = 0;
469 ECalEnergyTimePairs.clear();
470
[b62c2da]471 IsolationVar = -999;
472 IsolationVarRhoCorr = -999;
473 SumPtCharged = -999;
474 SumPtNeutral = -999;
475 SumPtChargedPU = -999;
476 SumPt = -999;
[839deb7]477
[ab3bdd9]478 ClusterIndex = -1;
479 ClusterNDF = -99;
[341014c]480 ClusterSigma = 0.0;
[ab3bdd9]481 SumPT2 = 0.0;
482 BTVSumPT2 = 0.0;
483 GenDeltaZ = 0.0;
[341014c]484 GenSumPT2 = 0.0;
485
[24d005f]486 FracPt[0] = 0.0;
487 FracPt[1] = 0.0;
488 FracPt[2] = 0.0;
489 FracPt[3] = 0.0;
490 FracPt[4] = 0.0;
[63178fb]491 Tau[0] = 0.0;
492 Tau[1] = 0.0;
493 Tau[2] = 0.0;
494 Tau[3] = 0.0;
495 Tau[4] = 0.0;
[839deb7]496
[ba75867]497 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
498 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
499 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
500
[8d200a6]501 for(i = 0; i < 5; ++i)
502 {
503 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[839deb7]504 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[8d200a6]505 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
506 }
507
[edf10ba]508 NSubJetsTrimmed = 0;
509 NSubJetsPruned = 0;
[de6d698]510 NSubJetsSoftDropped = 0;
[839deb7]511
[d7d2da3]512 fArray = 0;
513}
Note: See TracBrowser for help on using the repository browser.