Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 3fdfd04

Last change on this file since 3fdfd04 was 781af69, checked in by michele <michele.selvaggi@…>, 4 years ago

added dNdx member

  • Property mode set to 100644
File size: 14.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 * 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#include "classes/DelphesFactory.h"
31#include "classes/SortableObject.h"
32
33CompBase *GenParticle::fgCompare = 0;
34CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
35CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
36CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
37CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
38CompBase *Track::fgCompare = CompPT<Track>::Instance();
39CompBase *Tower::fgCompare = CompE<Tower>::Instance();
40CompBase *ParticleFlowCandidate::fgCompare = CompE<ParticleFlowCandidate>::Instance();
41CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
42CompBase *Vertex::fgCompare = CompSumPT2<Vertex>::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, Mass);
105 return vec;
106}
107
108//------------------------------------------------------------------------------
109
110TMatrixDSym Track::CovarianceMatrix() const
111{
112 TMatrixDSym Cv;
113 Cv.ResizeTo(5, 5);
114
115 // convert diagonal term to original units
116 Cv(0, 0)=TMath::Power(ErrorD0, 2.);
117 Cv(1, 1)=TMath::Power(ErrorPhi, 2.);
118 Cv(2, 2)=TMath::Power(ErrorC, 2.);
119 Cv(3, 3)=TMath::Power(ErrorDZ, 2.);
120 Cv(4, 4)=TMath::Power(ErrorCtgTheta, 2.);
121
122 // off diagonal terms
123 Cv(0, 1)=ErrorD0Phi;
124 Cv(0, 2)=ErrorD0C;
125 Cv(0, 3)=ErrorD0DZ;
126 Cv(0, 4)=ErrorD0CtgTheta;
127 Cv(1, 2)=ErrorPhiC;
128 Cv(1, 3)=ErrorPhiDZ;
129 Cv(1, 4)=ErrorPhiCtgTheta;
130 Cv(2, 3)=ErrorCDZ;
131 Cv(2, 4)=ErrorCCtgTheta;
132 Cv(3, 4)=ErrorDZCtgTheta;
133
134 Cv(1, 0)=Cv(0, 1);
135 Cv(2, 0)=Cv(0, 2);
136 Cv(3, 0)=Cv(0, 3);
137 Cv(4, 0)=Cv(0, 4);
138 Cv(2, 1)=Cv(1, 2);
139 Cv(3, 1)=Cv(1, 3);
140 Cv(4, 1)=Cv(1, 4);
141 Cv(3, 2)=Cv(2, 3);
142 Cv(4, 2)=Cv(2, 4);
143 Cv(4, 3)=Cv(3, 4);
144
145 return Cv;
146}
147
148
149//------------------------------------------------------------------------------
150
151TLorentzVector Tower::P4() const
152{
153 TLorentzVector vec;
154 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
155 return vec;
156}
157
158//------------------------------------------------------------------------------
159
160TLorentzVector ParticleFlowCandidate::P4() const
161{
162 TLorentzVector vec;
163 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
164 return vec;
165}
166
167//------------------------------------------------------------------------------
168
169TMatrixDSym ParticleFlowCandidate::CovarianceMatrix() const
170{
171 TMatrixDSym Cv;
172 Cv.ResizeTo(5, 5);
173
174 // convert diagonal term to original units
175 Cv(0, 0)=TMath::Power(ErrorD0, 2.);
176 Cv(1, 1)=TMath::Power(ErrorPhi, 2.);
177 Cv(2, 2)=TMath::Power(ErrorC, 2.);
178 Cv(3, 3)=TMath::Power(ErrorDZ, 2.);
179 Cv(4, 4)=TMath::Power(ErrorCtgTheta, 2.);
180
181 // off diagonal terms
182 Cv(0, 1)=ErrorD0Phi;
183 Cv(0, 2)=ErrorD0C;
184 Cv(0, 3)=ErrorD0DZ;
185 Cv(0, 4)=ErrorD0CtgTheta;
186 Cv(1, 2)=ErrorPhiC;
187 Cv(1, 3)=ErrorPhiDZ;
188 Cv(1, 4)=ErrorPhiCtgTheta;
189 Cv(2, 3)=ErrorCDZ;
190 Cv(2, 4)=ErrorCCtgTheta;
191 Cv(3, 4)=ErrorDZCtgTheta;
192
193 Cv(1, 0)=Cv(0, 1);
194 Cv(2, 0)=Cv(0, 2);
195 Cv(3, 0)=Cv(0, 3);
196 Cv(4, 0)=Cv(0, 4);
197 Cv(2, 1)=Cv(1, 2);
198 Cv(3, 1)=Cv(1, 3);
199 Cv(4, 1)=Cv(1, 4);
200 Cv(3, 2)=Cv(2, 3);
201 Cv(4, 2)=Cv(2, 4);
202 Cv(4, 3)=Cv(3, 4);
203
204 return Cv;
205}
206
207//------------------------------------------------------------------------------
208
209Candidate::Candidate() :
210 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
211 Charge(0), Mass(0.0),
212 IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0),
213 Flavor(0), FlavorAlgo(0), FlavorPhys(0),
214 BTag(0), BTagAlgo(0), BTagPhys(0),
215 TauTag(0), TauWeight(0.0), Eem(0.0), Ehad(0.0),
216 DeltaEta(0.0), DeltaPhi(0.0),
217 Momentum(0.0, 0.0, 0.0, 0.0),
218 Position(0.0, 0.0, 0.0, 0.0),
219 InitialPosition(0.0, 0.0, 0.0, 0.0),
220 PositionError(0.0, 0.0, 0.0, 0.0),
221 Area(0.0, 0.0, 0.0, 0.0),
222 TrackCovariance(5),
223 L(0),
224 D0(0), ErrorD0(0),
225 DZ(0), ErrorDZ(0),
226 P(0), ErrorP(0),
227 C(0), ErrorC(0),
228 PT(0), ErrorPT(0),
229 CtgTheta(0), ErrorCtgTheta(0),
230 Phi(0), ErrorPhi(0),
231 Xd(0), Yd(0), Zd(0),
232 Nclusters(0.0),
233 dNdx(0.0),
234 TrackResolution(0),
235 NCharged(0),
236 NNeutrals(0),
237 NeutralEnergyFraction(0), // charged energy fraction
238 ChargedEnergyFraction(0), // neutral energy fraction
239 Beta(0),
240 BetaStar(0),
241 MeanSqDeltaR(0),
242 PTD(0),
243 NTimeHits(-1),
244 IsolationVar(-999),
245 IsolationVarRhoCorr(-999),
246 SumPtCharged(-999),
247 SumPtNeutral(-999),
248 SumPtChargedPU(-999),
249 SumPt(-999),
250 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
251 NSubJetsTrimmed(0),
252 NSubJetsPruned(0),
253 NSubJetsSoftDropped(0),
254 ExclYmerge23(0),
255 ExclYmerge34(0),
256 ExclYmerge45(0),
257 ExclYmerge56(0),
258 ParticleDensity(0),
259 fFactory(0),
260 fArray(0)
261{
262 int i;
263 Edges[0] = 0.0;
264 Edges[1] = 0.0;
265 Edges[2] = 0.0;
266 Edges[3] = 0.0;
267 FracPt[0] = 0.0;
268 FracPt[1] = 0.0;
269 FracPt[2] = 0.0;
270 FracPt[3] = 0.0;
271 FracPt[4] = 0.0;
272 Tau[0] = 0.0;
273 Tau[1] = 0.0;
274 Tau[2] = 0.0;
275 Tau[3] = 0.0;
276 Tau[4] = 0.0;
277
278 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
279 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
280 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
281
282 for(i = 0; i < 5; ++i)
283 {
284 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
285 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
286 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
287 }
288}
289
290//------------------------------------------------------------------------------
291
292void Candidate::AddCandidate(Candidate *object)
293{
294 if(!fArray) fArray = fFactory->NewArray();
295 fArray->Add(object);
296}
297
298//------------------------------------------------------------------------------
299
300TObjArray *Candidate::GetCandidates()
301{
302 if(!fArray) fArray = fFactory->NewArray();
303 return fArray;
304}
305
306//------------------------------------------------------------------------------
307
308Bool_t Candidate::Overlaps(const Candidate *object) const
309{
310 const Candidate *candidate;
311
312 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
313
314 if(fArray)
315 {
316 TIter it(fArray);
317 while((candidate = static_cast<Candidate *>(it.Next())))
318 {
319 if(candidate->Overlaps(object)) return kTRUE;
320 }
321 }
322
323 if(object->fArray)
324 {
325 TIter it(object->fArray);
326 while((candidate = static_cast<Candidate *>(it.Next())))
327 {
328 if(candidate->Overlaps(this)) return kTRUE;
329 }
330 }
331
332 return kFALSE;
333}
334
335//------------------------------------------------------------------------------
336
337TObject *Candidate::Clone(const char *newname) const
338{
339 Candidate *object = fFactory->NewCandidate();
340 Copy(*object);
341 return object;
342}
343
344//------------------------------------------------------------------------------
345
346void Candidate::Copy(TObject &obj) const
347{
348 Candidate &object = static_cast<Candidate &>(obj);
349 Candidate *candidate;
350
351 object.PID = PID;
352 object.Status = Status;
353 object.M1 = M1;
354 object.M2 = M2;
355 object.D1 = D1;
356 object.D2 = D2;
357 object.Charge = Charge;
358 object.Mass = Mass;
359 object.IsPU = IsPU;
360 object.IsRecoPU = IsRecoPU;
361 object.IsConstituent = IsConstituent;
362 object.IsFromConversion = IsFromConversion;
363 object.ClusterIndex = ClusterIndex;
364 object.ClusterNDF = ClusterNDF;
365 object.ClusterSigma = ClusterSigma;
366 object.SumPT2 = SumPT2;
367 object.BTVSumPT2 = BTVSumPT2;
368 object.GenDeltaZ = GenDeltaZ;
369 object.GenSumPT2 = GenSumPT2;
370 object.Flavor = Flavor;
371 object.FlavorAlgo = FlavorAlgo;
372 object.FlavorPhys = FlavorPhys;
373 object.BTag = BTag;
374 object.BTagAlgo = BTagAlgo;
375 object.BTagPhys = BTagPhys;
376 object.TauTag = TauTag;
377 object.TauWeight = TauWeight;
378 object.Eem = Eem;
379 object.Ehad = Ehad;
380 object.Edges[0] = Edges[0];
381 object.Edges[1] = Edges[1];
382 object.Edges[2] = Edges[2];
383 object.Edges[3] = Edges[3];
384 object.DeltaEta = DeltaEta;
385 object.DeltaPhi = DeltaPhi;
386 object.Momentum = Momentum;
387 object.Position = Position;
388 object.InitialPosition = InitialPosition;
389 object.PositionError = PositionError;
390 object.Area = Area;
391 object.L = L;
392 object.ErrorT = ErrorT;
393 object.D0 = D0;
394 object.ErrorD0 = ErrorD0;
395 object.DZ = DZ;
396 object.ErrorDZ = ErrorDZ;
397 object.P = P;
398 object.ErrorP = ErrorP;
399 object.C = C;
400 object.ErrorC = ErrorC;
401 object.PT = PT;
402 object.ErrorPT = ErrorPT;
403 object.CtgTheta = CtgTheta;
404 object.ErrorCtgTheta = ErrorCtgTheta;
405 object.Phi = Phi;
406 object.ErrorPhi = ErrorPhi;
407 object.Xd = Xd;
408 object.Yd = Yd;
409 object.Zd = Zd;
410 object.Nclusters = Nclusters;
411 object.dNdx = dNdx;
412 object.TrackResolution = TrackResolution;
413 object.NCharged = NCharged;
414 object.NNeutrals = NNeutrals;
415 object.NeutralEnergyFraction = NeutralEnergyFraction;
416 object.ChargedEnergyFraction = ChargedEnergyFraction;
417 object.Beta = Beta;
418 object.BetaStar = BetaStar;
419 object.MeanSqDeltaR = MeanSqDeltaR;
420 object.PTD = PTD;
421 object.NTimeHits = NTimeHits;
422 object.IsolationVar = IsolationVar;
423 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
424 object.SumPtCharged = SumPtCharged;
425 object.SumPtNeutral = SumPtNeutral;
426 object.SumPtChargedPU = SumPtChargedPU;
427 object.SumPt = SumPt;
428 object.ClusterIndex = ClusterIndex;
429 object.ClusterNDF = ClusterNDF;
430 object.ClusterSigma = ClusterSigma;
431 object.SumPT2 = SumPT2;
432
433 object.FracPt[0] = FracPt[0];
434 object.FracPt[1] = FracPt[1];
435 object.FracPt[2] = FracPt[2];
436 object.FracPt[3] = FracPt[3];
437 object.FracPt[4] = FracPt[4];
438 object.Tau[0] = Tau[0];
439 object.Tau[1] = Tau[1];
440 object.Tau[2] = Tau[2];
441 object.Tau[3] = Tau[3];
442 object.Tau[4] = Tau[4];
443
444 object.TrimmedP4[0] = TrimmedP4[0];
445 object.TrimmedP4[1] = TrimmedP4[1];
446 object.TrimmedP4[2] = TrimmedP4[2];
447 object.TrimmedP4[3] = TrimmedP4[3];
448 object.TrimmedP4[4] = TrimmedP4[4];
449 object.PrunedP4[0] = PrunedP4[0];
450 object.PrunedP4[1] = PrunedP4[1];
451 object.PrunedP4[2] = PrunedP4[2];
452 object.PrunedP4[3] = PrunedP4[3];
453 object.PrunedP4[4] = PrunedP4[4];
454 object.SoftDroppedP4[0] = SoftDroppedP4[0];
455 object.SoftDroppedP4[1] = SoftDroppedP4[1];
456 object.SoftDroppedP4[2] = SoftDroppedP4[2];
457 object.SoftDroppedP4[3] = SoftDroppedP4[3];
458 object.SoftDroppedP4[4] = SoftDroppedP4[4];
459
460 object.NSubJetsTrimmed = NSubJetsTrimmed;
461 object.NSubJetsPruned = NSubJetsPruned;
462 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
463
464 object.SoftDroppedJet = SoftDroppedJet;
465 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
466 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
467 object.TrackCovariance = TrackCovariance;
468 object.fFactory = fFactory;
469 object.fArray = 0;
470
471 // copy cluster timing info
472 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
473
474 if(fArray && fArray->GetEntriesFast() > 0)
475 {
476 TIter itArray(fArray);
477 TObjArray *array = object.GetCandidates();
478 while((candidate = static_cast<Candidate *>(itArray.Next())))
479 {
480 array->Add(candidate);
481 }
482 }
483}
484
485//------------------------------------------------------------------------------
486
487void Candidate::Clear(Option_t *option)
488{
489 int i;
490 SetUniqueID(0);
491 ResetBit(kIsReferenced);
492 PID = 0;
493 Status = 0;
494 M1 = -1;
495 M2 = -1;
496 D1 = -1;
497 D2 = -1;
498 Charge = 0;
499 Mass = 0.0;
500 IsPU = 0;
501 IsRecoPU = 0;
502 IsConstituent = 0;
503 IsFromConversion = 0;
504 Flavor = 0;
505 FlavorAlgo = 0;
506 FlavorPhys = 0;
507 BTag = 0;
508 BTagAlgo = 0;
509 BTagPhys = 0;
510 TauTag = 0;
511 TauWeight = 0.0;
512 Eem = 0.0;
513 Ehad = 0.0;
514 Edges[0] = 0.0;
515 Edges[1] = 0.0;
516 Edges[2] = 0.0;
517 Edges[3] = 0.0;
518 DeltaEta = 0.0;
519 DeltaPhi = 0.0;
520 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
521 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
522 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
523 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
524 TrackCovariance.Zero();
525 L = 0.0;
526 ErrorT = 0.0;
527 D0 = 0.0;
528 ErrorD0 = 0.0;
529 DZ = 0.0;
530 ErrorDZ = 0.0;
531 P = 0.0;
532 ErrorP = 0.0;
533 C = 0.0;
534 ErrorC = 0.0;
535 PT = 0.0;
536 ErrorPT = 0.0;
537 CtgTheta = 0.0;
538 ErrorCtgTheta = 0.0;
539 Phi = 0.0;
540 ErrorPhi = 0.0;
541 Xd = 0.0;
542 Yd = 0.0;
543 Zd = 0.0;
544 Nclusters = 0.0;
545 dNdx = 0.0;
546 TrackResolution = 0.0;
547 NCharged = 0;
548 NNeutrals = 0;
549 Beta = 0.0;
550 BetaStar = 0.0;
551 MeanSqDeltaR = 0.0;
552 PTD = 0.0;
553
554 NTimeHits = 0;
555 ECalEnergyTimePairs.clear();
556
557 IsolationVar = -999;
558 IsolationVarRhoCorr = -999;
559 SumPtCharged = -999;
560 SumPtNeutral = -999;
561 SumPtChargedPU = -999;
562 SumPt = -999;
563
564 ClusterIndex = -1;
565 ClusterNDF = -99;
566 ClusterSigma = 0.0;
567 SumPT2 = 0.0;
568 BTVSumPT2 = 0.0;
569 GenDeltaZ = 0.0;
570 GenSumPT2 = 0.0;
571
572 FracPt[0] = 0.0;
573 FracPt[1] = 0.0;
574 FracPt[2] = 0.0;
575 FracPt[3] = 0.0;
576 FracPt[4] = 0.0;
577 Tau[0] = 0.0;
578 Tau[1] = 0.0;
579 Tau[2] = 0.0;
580 Tau[3] = 0.0;
581 Tau[4] = 0.0;
582
583 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
584 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
585 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
586
587 for(i = 0; i < 5; ++i)
588 {
589 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
590 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
591 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
592 }
593
594 NSubJetsTrimmed = 0;
595 NSubJetsPruned = 0;
596 NSubJetsSoftDropped = 0;
597
598 fArray = 0;
599}
Note: See TracBrowser for help on using the repository browser.