Fork me on GitHub

source: git/classes/DelphesClasses.cc@ acd0621

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

added new variables for TrackSmearing

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