Fork me on GitHub

source: git/classes/DelphesClasses.cc@ ab3bdd9

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

added Vertex variables

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