Fork me on GitHub

source: git/classes/DelphesClasses.cc@ b291b0b

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

fixed missing vertexing variables

  • Property mode set to 100644
File size: 11.2 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.D0 = D0;
286 object.ErrorD0 = ErrorD0;
287 object.DZ = DZ;
288 object.ErrorDZ = ErrorDZ;
289 object.P = P;
290 object.ErrorP = ErrorP;
291 object.PT = PT;
292 object.ErrorPT = ErrorPT;
293 object.CtgTheta = CtgTheta ;
294 object.ErrorCtgTheta = ErrorCtgTheta;
295 object.Phi = Phi;
296 object.ErrorPhi = ErrorPhi;
297 object.Xd = Xd;
298 object.Yd = Yd;
299 object.Zd = Zd;
300 object.TrackResolution = TrackResolution;
301 object.NCharged = NCharged;
302 object.NNeutrals = NNeutrals;
303 object.Beta = Beta;
304 object.BetaStar = BetaStar;
305 object.MeanSqDeltaR = MeanSqDeltaR;
306 object.PTD = PTD;
307 object.NTimeHits = NTimeHits;
308 object.IsolationVar = IsolationVar;
309 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
310 object.SumPtCharged = SumPtCharged;
311 object.SumPtNeutral = SumPtNeutral;
312 object.SumPtChargedPU = SumPtChargedPU;
313 object.SumPt = SumPt;
314
315 object.FracPt[0] = FracPt[0];
316 object.FracPt[1] = FracPt[1];
317 object.FracPt[2] = FracPt[2];
318 object.FracPt[3] = FracPt[3];
319 object.FracPt[4] = FracPt[4];
320 object.Tau[0] = Tau[0];
321 object.Tau[1] = Tau[1];
322 object.Tau[2] = Tau[2];
323 object.Tau[3] = Tau[3];
324 object.Tau[4] = Tau[4];
325
326 object.TrimmedP4[0] = TrimmedP4[0];
327 object.TrimmedP4[1] = TrimmedP4[1];
328 object.TrimmedP4[2] = TrimmedP4[2];
329 object.TrimmedP4[3] = TrimmedP4[3];
330 object.TrimmedP4[4] = TrimmedP4[4];
331 object.PrunedP4[0] = PrunedP4[0];
332 object.PrunedP4[1] = PrunedP4[1];
333 object.PrunedP4[2] = PrunedP4[2];
334 object.PrunedP4[3] = PrunedP4[3];
335 object.PrunedP4[4] = PrunedP4[4];
336 object.SoftDroppedP4[0] = SoftDroppedP4[0];
337 object.SoftDroppedP4[1] = SoftDroppedP4[1];
338 object.SoftDroppedP4[2] = SoftDroppedP4[2];
339 object.SoftDroppedP4[3] = SoftDroppedP4[3];
340 object.SoftDroppedP4[4] = SoftDroppedP4[4];
341
342 object.NSubJetsTrimmed = NSubJetsTrimmed;
343 object.NSubJetsPruned = NSubJetsPruned;
344 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
345
346 object.fFactory = fFactory;
347 object.fArray = 0;
348
349 // copy cluster timing info
350 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
351
352 if(fArray && fArray->GetEntriesFast() > 0)
353 {
354 TIter itArray(fArray);
355 TObjArray *array = object.GetCandidates();
356 while((candidate = static_cast<Candidate *>(itArray.Next())))
357 {
358 array->Add(candidate);
359 }
360 }
361}
362
363//------------------------------------------------------------------------------
364
365void Candidate::Clear(Option_t* option)
366{
367 int i;
368 SetUniqueID(0);
369 ResetBit(kIsReferenced);
370 PID = 0;
371 Status = 0;
372 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
373 Charge = 0;
374 Mass = 0.0;
375 IsPU = 0;
376 IsConstituent = 0;
377 IsFromConversion = 0;
378 Flavor = 0;
379 FlavorAlgo = 0;
380 FlavorPhys = 0;
381 BTag = 0;
382 BTagAlgo = 0;
383 BTagPhys = 0;
384 TauTag = 0;
385 Eem = 0.0;
386 Ehad = 0.0;
387 Edges[0] = 0.0;
388 Edges[1] = 0.0;
389 Edges[2] = 0.0;
390 Edges[3] = 0.0;
391 DeltaEta = 0.0;
392 DeltaPhi = 0.0;
393 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
394 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
395 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
396 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
397 L = 0.0;
398 D0 = 0.0;
399 ErrorD0 = 0.0;
400 DZ = 0.0;
401 ErrorDZ = 0.0;
402 P =0.0;
403 ErrorP =0.0;
404 PT = 0.0;
405 ErrorPT = 0.0;
406 CtgTheta = 0.0;
407 ErrorCtgTheta = 0.0;
408 Phi = 0.0;
409 ErrorPhi = 0.0;
410 Xd = 0.0;
411 Yd = 0.0;
412 Zd = 0.0;
413 TrackResolution = 0.0;
414 NCharged = 0;
415 NNeutrals = 0;
416 Beta = 0.0;
417 BetaStar = 0.0;
418 MeanSqDeltaR = 0.0;
419 PTD = 0.0;
420
421 NTimeHits = 0;
422 ECalEnergyTimePairs.clear();
423
424 IsolationVar = -999;
425 IsolationVarRhoCorr = -999;
426 SumPtCharged = -999;
427 SumPtNeutral = -999;
428 SumPtChargedPU = -999;
429 SumPt = -999;
430
431 FracPt[0] = 0.0;
432 FracPt[1] = 0.0;
433 FracPt[2] = 0.0;
434 FracPt[3] = 0.0;
435 FracPt[4] = 0.0;
436 Tau[0] = 0.0;
437 Tau[1] = 0.0;
438 Tau[2] = 0.0;
439 Tau[3] = 0.0;
440 Tau[4] = 0.0;
441
442 for(i = 0; i < 5; ++i)
443 {
444 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
445 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
446 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
447 }
448
449 NSubJetsTrimmed = 0;
450 NSubJetsPruned = 0;
451 NSubJetsSoftDropped = 0;
452
453 fArray = 0;
454}
Note: See TracBrowser for help on using the repository browser.