Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 8284b74

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

store time smearing error

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