Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 3051358a

ImprovedOutputFile
Last change on this file since 3051358a 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
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),
[c614dd7]153 NeutralEnergyFraction(0), // charged energy fraction
154 ChargedEnergyFraction(0), // neutral energy fraction
[24d005f]155 Beta(0),
156 BetaStar(0),
157 MeanSqDeltaR(0),
[da00c35]158 PTD(0),
[839deb7]159 NTimeHits(-1),
[b62c2da]160 IsolationVar(-999),
161 IsolationVarRhoCorr(-999),
162 SumPtCharged(-999),
163 SumPtNeutral(-999),
164 SumPtChargedPU(-999),
165 SumPt(-999),
[1a4956e]166 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
[839deb7]167 NSubJetsTrimmed(0),
168 NSubJetsPruned(0),
169 NSubJetsSoftDropped(0),
[e9c0d73]170 ExclYmerge23(0),
171 ExclYmerge34(0),
172 ExclYmerge45(0),
173 ExclYmerge56(0),
[da00c35]174 fFactory(0),
175 fArray(0)
[d7d2da3]176{
[8d200a6]177 int i;
[d7d2da3]178 Edges[0] = 0.0;
179 Edges[1] = 0.0;
180 Edges[2] = 0.0;
181 Edges[3] = 0.0;
[24d005f]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;
[63178fb]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;
[ba75867]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
[8d200a6]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 }
[d7d2da3]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;
[84733ae]275 object.IsRecoPU = IsRecoPU;
[d7d2da3]276 object.IsConstituent = IsConstituent;
[5d2481f]277 object.IsFromConversion = IsFromConversion;
[2118a6a]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;
[fe0273c]285 object.Flavor = Flavor;
286 object.FlavorAlgo = FlavorAlgo;
287 object.FlavorPhys = FlavorPhys;
[d7d2da3]288 object.BTag = BTag;
[edf10ba]289 object.BTagAlgo = BTagAlgo;
[fe0273c]290 object.BTagPhys = BTagPhys;
[d7d2da3]291 object.TauTag = TauTag;
[7429c6a]292 object.TauWeight = TauWeight;
[d7d2da3]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;
[2118a6a]303 object.InitialPosition = InitialPosition;
304 object.PositionError = PositionError;
[43c646a]305 object.Area = Area;
[80306e6]306 object.L = L;
[28c722a]307 object.ErrorT = ErrorT;
[80306e6]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;
[341014c]316 object.CtgTheta = CtgTheta;
[80306e6]317 object.ErrorCtgTheta = ErrorCtgTheta;
318 object.Phi = Phi;
[341014c]319 object.ErrorPhi = ErrorPhi;
[a0431dc]320 object.Xd = Xd;
321 object.Yd = Yd;
322 object.Zd = Zd;
[a98c7ef]323 object.TrackResolution = TrackResolution;
[24d005f]324 object.NCharged = NCharged;
325 object.NNeutrals = NNeutrals;
[c614dd7]326 object.NeutralEnergyFraction = NeutralEnergyFraction;
327 object.ChargedEnergyFraction = ChargedEnergyFraction;
[24d005f]328 object.Beta = Beta;
329 object.BetaStar = BetaStar;
330 object.MeanSqDeltaR = MeanSqDeltaR;
331 object.PTD = PTD;
[839deb7]332 object.NTimeHits = NTimeHits;
[b62c2da]333 object.IsolationVar = IsolationVar;
334 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
335 object.SumPtCharged = SumPtCharged;
336 object.SumPtNeutral = SumPtNeutral;
337 object.SumPtChargedPU = SumPtChargedPU;
338 object.SumPt = SumPt;
[ab3bdd9]339 object.ClusterIndex = ClusterIndex;
340 object.ClusterNDF = ClusterNDF;
[341014c]341 object.ClusterSigma = ClusterSigma;
[ab3bdd9]342 object.SumPT2 = SumPT2;
[341014c]343
[24d005f]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];
[63178fb]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];
[839deb7]354
[de6d698]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
[edf10ba]371 object.NSubJetsTrimmed = NSubJetsTrimmed;
372 object.NSubJetsPruned = NSubJetsPruned;
[de6d698]373 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
[e4c3fef]374
[341014c]375 object.SoftDroppedJet = SoftDroppedJet;
[ba75867]376 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
377 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
378
[d7d2da3]379 object.fFactory = fFactory;
380 object.fArray = 0;
381
[839deb7]382 // copy cluster timing info
383 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
[3db5282]384
[d7d2da3]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
[341014c]398void Candidate::Clear(Option_t *option)
[d7d2da3]399{
[8d200a6]400 int i;
[d7d2da3]401 SetUniqueID(0);
402 ResetBit(kIsReferenced);
403 PID = 0;
404 Status = 0;
[341014c]405 M1 = -1;
406 M2 = -1;
407 D1 = -1;
408 D2 = -1;
[d7d2da3]409 Charge = 0;
410 Mass = 0.0;
411 IsPU = 0;
[d759c46]412 IsRecoPU = 0;
[d7d2da3]413 IsConstituent = 0;
[5d2481f]414 IsFromConversion = 0;
[fe0273c]415 Flavor = 0;
416 FlavorAlgo = 0;
417 FlavorPhys = 0;
[d7d2da3]418 BTag = 0;
[edf10ba]419 BTagAlgo = 0;
[fe0273c]420 BTagPhys = 0;
[d7d2da3]421 TauTag = 0;
[7429c6a]422 TauWeight = 0.0;
[d7d2da3]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);
[80306e6]433 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
[d7d2da3]434 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[80306e6]435 L = 0.0;
[28c722a]436 ErrorT = 0.0;
[341014c]437 D0 = 0.0;
[80306e6]438 ErrorD0 = 0.0;
439 DZ = 0.0;
440 ErrorDZ = 0.0;
[341014c]441 P = 0.0;
442 ErrorP = 0.0;
[80306e6]443 PT = 0.0;
444 ErrorPT = 0.0;
445 CtgTheta = 0.0;
446 ErrorCtgTheta = 0.0;
447 Phi = 0.0;
448 ErrorPhi = 0.0;
[a0431dc]449 Xd = 0.0;
450 Yd = 0.0;
451 Zd = 0.0;
[a98c7ef]452 TrackResolution = 0.0;
[24d005f]453 NCharged = 0;
454 NNeutrals = 0;
455 Beta = 0.0;
456 BetaStar = 0.0;
457 MeanSqDeltaR = 0.0;
458 PTD = 0.0;
[839deb7]459
460 NTimeHits = 0;
461 ECalEnergyTimePairs.clear();
462
[b62c2da]463 IsolationVar = -999;
464 IsolationVarRhoCorr = -999;
465 SumPtCharged = -999;
466 SumPtNeutral = -999;
467 SumPtChargedPU = -999;
468 SumPt = -999;
[839deb7]469
[ab3bdd9]470 ClusterIndex = -1;
471 ClusterNDF = -99;
[341014c]472 ClusterSigma = 0.0;
[ab3bdd9]473 SumPT2 = 0.0;
474 BTVSumPT2 = 0.0;
475 GenDeltaZ = 0.0;
[341014c]476 GenSumPT2 = 0.0;
477
[24d005f]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;
[63178fb]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;
[839deb7]488
[ba75867]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
[8d200a6]493 for(i = 0; i < 5; ++i)
494 {
495 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[839deb7]496 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[8d200a6]497 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
498 }
499
[edf10ba]500 NSubJetsTrimmed = 0;
501 NSubJetsPruned = 0;
[de6d698]502 NSubJetsSoftDropped = 0;
[839deb7]503
[d7d2da3]504 fArray = 0;
505}
Note: See TracBrowser for help on using the repository browser.