Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 0f5bf9d

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 0f5bf9d was 3c46e17, checked in by Michele Selvaggi <michele.selvaggi@…>, 8 years ago

added SumPT2 sorting

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