Fork me on GitHub

source: git/classes/DelphesClasses.cc@ f298e48

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

added neutral and charged energy fraction to jets

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