Fork me on GitHub

source: git/classes/DelphesClasses.cc@ a5af1df

Last change on this file since a5af1df was a5af1df, checked in by christinaw97 <christina.wang@…>, 3 years ago

added CscCluster modules and classes

  • Property mode set to 100644
File size: 12.3 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 * Definition of classes to be stored in the root tree.
22 * Function CompareXYZ sorts objects by the variable XYZ that MUST be
23 * present in the data members of the root tree class of the branch.
24 *
25 * \author P. Demin - UCL, Louvain-la-Neuve
26 *
27 */
28
29#include "classes/DelphesClasses.h"
30
31#include "classes/DelphesFactory.h"
32#include "classes/SortableObject.h"
33
34CompBase *GenParticle::fgCompare = 0;
35CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
36CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
37CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
38
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 *Vertex::fgCompare = CompSumPT2<Vertex>::Instance();
44CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
45CompBase *CscCluster::fgCompare = CompE<CscCluster>::Instance();
46
47//------------------------------------------------------------------------------
48
49TLorentzVector GenParticle::P4() const
50{
51 TLorentzVector vec;
52 vec.SetPxPyPzE(Px, Py, Pz, E);
53 return vec;
54}
55
56//------------------------------------------------------------------------------
57
58TLorentzVector MissingET::P4() const
59{
60 TLorentzVector vec;
61 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
62 return vec;
63}
64
65//------------------------------------------------------------------------------
66
67TLorentzVector Photon::P4() const
68{
69 TLorentzVector vec;
70 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
71 return vec;
72}
73
74//------------------------------------------------------------------------------
75
76TLorentzVector Electron::P4() const
77{
78 TLorentzVector vec;
79 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
80 return vec;
81}
82
83//------------------------------------------------------------------------------
84
85TLorentzVector Muon::P4() const
86{
87 TLorentzVector vec;
88 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
89 return vec;
90}
91
92//------------------------------------------------------------------------------
93
94TLorentzVector Jet::P4() const
95{
96 TLorentzVector vec;
97 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
98 return vec;
99}
100
101//------------------------------------------------------------------------------
102
103TLorentzVector Track::P4() const
104{
105 TLorentzVector vec;
106 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
107 return vec;
108}
109
110//------------------------------------------------------------------------------
111
112TLorentzVector Tower::P4() const
113{
114 TLorentzVector vec;
115 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
116 return vec;
117}
118
119//------------------------------------------------------------------------------
120
121Candidate::Candidate() :
122 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
123 Charge(0), Mass(0.0),
124 IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0),
125 Flavor(0), FlavorAlgo(0), FlavorPhys(0),
126 BTag(0), BTagAlgo(0), BTagPhys(0),
127 TauTag(0), TauWeight(0.0), Eem(0.0), Ehad(0.0),
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),
131 InitialPosition(0.0, 0.0, 0.0, 0.0),
132 DecayPosition(0.0, 0.0, 0.0, 0.0),
133 PositionError(0.0, 0.0, 0.0, 0.0),
134 Area(0.0, 0.0, 0.0, 0.0),
135 L(0),
136 D0(0), ErrorD0(0),
137 DZ(0), ErrorDZ(0),
138 P(0), ErrorP(0),
139 PT(0), ErrorPT(0),
140 CtgTheta(0), ErrorCtgTheta(0),
141 Phi(0), ErrorPhi(0),
142 Xd(0), Yd(0), Zd(0),
143 TrackResolution(0),
144 NCharged(0),
145 NNeutrals(0),
146 Beta(0),
147 BetaStar(0),
148 MeanSqDeltaR(0),
149 PTD(0),
150 NTimeHits(-1),
151 IsolationVar(-999),
152 IsolationVarRhoCorr(-999),
153 SumPtCharged(-999),
154 SumPtNeutral(-999),
155 SumPtChargedPU(-999),
156 SumPt(-999),
157 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
158 NSubJetsTrimmed(0),
159 NSubJetsPruned(0),
160 NSubJetsSoftDropped(0),
161 ExclYmerge23(0),
162 ExclYmerge34(0),
163 ExclYmerge45(0),
164 ExclYmerge56(0),
165 fFactory(0),
166 fArray(0)
167{
168 int i;
169 Edges[0] = 0.0;
170 Edges[1] = 0.0;
171 Edges[2] = 0.0;
172 Edges[3] = 0.0;
173 FracPt[0] = 0.0;
174 FracPt[1] = 0.0;
175 FracPt[2] = 0.0;
176 FracPt[3] = 0.0;
177 FracPt[4] = 0.0;
178 Tau[0] = 0.0;
179 Tau[1] = 0.0;
180 Tau[2] = 0.0;
181 Tau[3] = 0.0;
182 Tau[4] = 0.0;
183
184 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
185 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
186 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
187
188 for(i = 0; i < 5; ++i)
189 {
190 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
191 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
192 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
193 }
194}
195
196//------------------------------------------------------------------------------
197
198void Candidate::AddCandidate(Candidate *object)
199{
200 if(!fArray) fArray = fFactory->NewArray();
201 fArray->Add(object);
202}
203
204//------------------------------------------------------------------------------
205
206TObjArray *Candidate::GetCandidates()
207{
208 if(!fArray) fArray = fFactory->NewArray();
209 return fArray;
210}
211
212//------------------------------------------------------------------------------
213
214Bool_t Candidate::Overlaps(const Candidate *object) const
215{
216 const Candidate *candidate;
217
218 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
219
220 if(fArray)
221 {
222 TIter it(fArray);
223 while((candidate = static_cast<Candidate *>(it.Next())))
224 {
225 if(candidate->Overlaps(object)) return kTRUE;
226 }
227 }
228
229 if(object->fArray)
230 {
231 TIter it(object->fArray);
232 while((candidate = static_cast<Candidate *>(it.Next())))
233 {
234 if(candidate->Overlaps(this)) return kTRUE;
235 }
236 }
237
238 return kFALSE;
239}
240
241//------------------------------------------------------------------------------
242
243TObject *Candidate::Clone(const char *newname) const
244{
245 Candidate *object = fFactory->NewCandidate();
246 Copy(*object);
247 return object;
248}
249
250//------------------------------------------------------------------------------
251
252void Candidate::Copy(TObject &obj) const
253{
254 Candidate &object = static_cast<Candidate &>(obj);
255 Candidate *candidate;
256
257 object.PID = PID;
258 object.Status = Status;
259 object.M1 = M1;
260 object.M2 = M2;
261 object.D1 = D1;
262 object.D2 = D2;
263 object.Charge = Charge;
264 object.Mass = Mass;
265 object.IsPU = IsPU;
266 object.IsRecoPU = IsRecoPU;
267 object.IsConstituent = IsConstituent;
268 object.IsFromConversion = IsFromConversion;
269 object.ClusterIndex = ClusterIndex;
270 object.ClusterNDF = ClusterNDF;
271 object.ClusterSigma = ClusterSigma;
272 object.SumPT2 = SumPT2;
273 object.BTVSumPT2 = BTVSumPT2;
274 object.GenDeltaZ = GenDeltaZ;
275 object.GenSumPT2 = GenSumPT2;
276 object.Flavor = Flavor;
277 object.FlavorAlgo = FlavorAlgo;
278 object.FlavorPhys = FlavorPhys;
279 object.BTag = BTag;
280 object.BTagAlgo = BTagAlgo;
281 object.BTagPhys = BTagPhys;
282 object.TauTag = TauTag;
283 object.TauWeight = TauWeight;
284 object.Eem = Eem;
285 object.Ehad = Ehad;
286 object.Edges[0] = Edges[0];
287 object.Edges[1] = Edges[1];
288 object.Edges[2] = Edges[2];
289 object.Edges[3] = Edges[3];
290 object.DeltaEta = DeltaEta;
291 object.DeltaPhi = DeltaPhi;
292 object.Momentum = Momentum;
293 object.Position = Position;
294 object.InitialPosition = InitialPosition;
295 object.DecayPosition = DecayPosition;
296 object.PositionError = PositionError;
297 object.Area = Area;
298 object.L = L;
299 object.ErrorT = ErrorT;
300 object.D0 = D0;
301 object.ErrorD0 = ErrorD0;
302 object.DZ = DZ;
303 object.ErrorDZ = ErrorDZ;
304 object.P = P;
305 object.ErrorP = ErrorP;
306 object.PT = PT;
307 object.ErrorPT = ErrorPT;
308 object.CtgTheta = CtgTheta;
309 object.ErrorCtgTheta = ErrorCtgTheta;
310 object.Phi = Phi;
311 object.ErrorPhi = ErrorPhi;
312 object.Xd = Xd;
313 object.Yd = Yd;
314 object.Zd = Zd;
315 object.TrackResolution = TrackResolution;
316 object.NCharged = NCharged;
317 object.NNeutrals = NNeutrals;
318 object.Beta = Beta;
319 object.BetaStar = BetaStar;
320 object.MeanSqDeltaR = MeanSqDeltaR;
321 object.PTD = PTD;
322 object.NTimeHits = NTimeHits;
323 object.IsolationVar = IsolationVar;
324 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
325 object.SumPtCharged = SumPtCharged;
326 object.SumPtNeutral = SumPtNeutral;
327 object.SumPtChargedPU = SumPtChargedPU;
328 object.SumPt = SumPt;
329 object.ClusterIndex = ClusterIndex;
330 object.ClusterNDF = ClusterNDF;
331 object.ClusterSigma = ClusterSigma;
332 object.SumPT2 = SumPT2;
333
334 object.FracPt[0] = FracPt[0];
335 object.FracPt[1] = FracPt[1];
336 object.FracPt[2] = FracPt[2];
337 object.FracPt[3] = FracPt[3];
338 object.FracPt[4] = FracPt[4];
339 object.Tau[0] = Tau[0];
340 object.Tau[1] = Tau[1];
341 object.Tau[2] = Tau[2];
342 object.Tau[3] = Tau[3];
343 object.Tau[4] = Tau[4];
344
345 object.TrimmedP4[0] = TrimmedP4[0];
346 object.TrimmedP4[1] = TrimmedP4[1];
347 object.TrimmedP4[2] = TrimmedP4[2];
348 object.TrimmedP4[3] = TrimmedP4[3];
349 object.TrimmedP4[4] = TrimmedP4[4];
350 object.PrunedP4[0] = PrunedP4[0];
351 object.PrunedP4[1] = PrunedP4[1];
352 object.PrunedP4[2] = PrunedP4[2];
353 object.PrunedP4[3] = PrunedP4[3];
354 object.PrunedP4[4] = PrunedP4[4];
355 object.SoftDroppedP4[0] = SoftDroppedP4[0];
356 object.SoftDroppedP4[1] = SoftDroppedP4[1];
357 object.SoftDroppedP4[2] = SoftDroppedP4[2];
358 object.SoftDroppedP4[3] = SoftDroppedP4[3];
359 object.SoftDroppedP4[4] = SoftDroppedP4[4];
360
361 object.NSubJetsTrimmed = NSubJetsTrimmed;
362 object.NSubJetsPruned = NSubJetsPruned;
363 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
364
365 object.SoftDroppedJet = SoftDroppedJet;
366 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
367 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
368
369 object.fFactory = fFactory;
370 object.fArray = 0;
371
372 // copy cluster timing info
373 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
374
375 if(fArray && fArray->GetEntriesFast() > 0)
376 {
377 TIter itArray(fArray);
378 TObjArray *array = object.GetCandidates();
379 while((candidate = static_cast<Candidate *>(itArray.Next())))
380 {
381 array->Add(candidate);
382 }
383 }
384}
385
386//------------------------------------------------------------------------------
387
388void Candidate::Clear(Option_t *option)
389{
390 int i;
391 SetUniqueID(0);
392 ResetBit(kIsReferenced);
393 PID = 0;
394 Status = 0;
395 M1 = -1;
396 M2 = -1;
397 D1 = -1;
398 D2 = -1;
399 Charge = 0;
400 Mass = 0.0;
401 IsPU = 0;
402 IsRecoPU = 0;
403 IsConstituent = 0;
404 IsFromConversion = 0;
405 Flavor = 0;
406 FlavorAlgo = 0;
407 FlavorPhys = 0;
408 BTag = 0;
409 BTagAlgo = 0;
410 BTagPhys = 0;
411 TauTag = 0;
412 TauWeight = 0.0;
413 Eem = 0.0;
414 Ehad = 0.0;
415 Edges[0] = 0.0;
416 Edges[1] = 0.0;
417 Edges[2] = 0.0;
418 Edges[3] = 0.0;
419 DeltaEta = 0.0;
420 DeltaPhi = 0.0;
421 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
422 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
423 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
424 DecayPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
425 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
426 L = 0.0;
427 ErrorT = 0.0;
428 D0 = 0.0;
429 ErrorD0 = 0.0;
430 DZ = 0.0;
431 ErrorDZ = 0.0;
432 P = 0.0;
433 ErrorP = 0.0;
434 PT = 0.0;
435 ErrorPT = 0.0;
436 CtgTheta = 0.0;
437 ErrorCtgTheta = 0.0;
438 Phi = 0.0;
439 ErrorPhi = 0.0;
440 Xd = 0.0;
441 Yd = 0.0;
442 Zd = 0.0;
443 TrackResolution = 0.0;
444 NCharged = 0;
445 NNeutrals = 0;
446 Beta = 0.0;
447 BetaStar = 0.0;
448 MeanSqDeltaR = 0.0;
449 PTD = 0.0;
450
451 NTimeHits = 0;
452 ECalEnergyTimePairs.clear();
453
454 IsolationVar = -999;
455 IsolationVarRhoCorr = -999;
456 SumPtCharged = -999;
457 SumPtNeutral = -999;
458 SumPtChargedPU = -999;
459 SumPt = -999;
460
461 ClusterIndex = -1;
462 ClusterNDF = -99;
463 ClusterSigma = 0.0;
464 SumPT2 = 0.0;
465 BTVSumPT2 = 0.0;
466 GenDeltaZ = 0.0;
467 GenSumPT2 = 0.0;
468
469 FracPt[0] = 0.0;
470 FracPt[1] = 0.0;
471 FracPt[2] = 0.0;
472 FracPt[3] = 0.0;
473 FracPt[4] = 0.0;
474 Tau[0] = 0.0;
475 Tau[1] = 0.0;
476 Tau[2] = 0.0;
477 Tau[3] = 0.0;
478 Tau[4] = 0.0;
479
480 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
481 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
482 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
483
484 for(i = 0; i < 5; ++i)
485 {
486 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
487 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
488 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
489 }
490
491 NSubJetsTrimmed = 0;
492 NSubJetsPruned = 0;
493 NSubJetsSoftDropped = 0;
494
495 fArray = 0;
496}
Note: See TracBrowser for help on using the repository browser.