Fork me on GitHub

source: git/classes/DelphesClasses.cc@ b8a6aa3

Last change on this file since b8a6aa3 was 363e269, checked in by Michele Selvaggi <michele@…>, 4 years ago

define TrackCovariance in mm

  • Property mode set to 100644
File size: 14.7 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, 0.0);
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, 0.0);
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 TrackResolution(0),
233 NCharged(0),
234 NNeutrals(0),
235 NeutralEnergyFraction(0), // charged energy fraction
236 ChargedEnergyFraction(0), // neutral energy fraction
237 Beta(0),
238 BetaStar(0),
239 MeanSqDeltaR(0),
240 PTD(0),
241 NTimeHits(-1),
242 IsolationVar(-999),
243 IsolationVarRhoCorr(-999),
244 SumPtCharged(-999),
245 SumPtNeutral(-999),
246 SumPtChargedPU(-999),
247 SumPt(-999),
248 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
249 NSubJetsTrimmed(0),
250 NSubJetsPruned(0),
251 NSubJetsSoftDropped(0),
252 ExclYmerge23(0),
253 ExclYmerge34(0),
254 ExclYmerge45(0),
255 ExclYmerge56(0),
256 ParticleDensity(0),
257 fFactory(0),
258 fArray(0)
259{
260 int i;
261 Edges[0] = 0.0;
262 Edges[1] = 0.0;
263 Edges[2] = 0.0;
264 Edges[3] = 0.0;
265 FracPt[0] = 0.0;
266 FracPt[1] = 0.0;
267 FracPt[2] = 0.0;
268 FracPt[3] = 0.0;
269 FracPt[4] = 0.0;
270 Tau[0] = 0.0;
271 Tau[1] = 0.0;
272 Tau[2] = 0.0;
273 Tau[3] = 0.0;
274 Tau[4] = 0.0;
275
276 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
277 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
278 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
279
280 for(i = 0; i < 5; ++i)
281 {
282 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
283 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
284 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
285 }
286}
287
288//------------------------------------------------------------------------------
289
290void Candidate::AddCandidate(Candidate *object)
291{
292 if(!fArray) fArray = fFactory->NewArray();
293 fArray->Add(object);
294}
295
296//------------------------------------------------------------------------------
297
298TObjArray *Candidate::GetCandidates()
299{
300 if(!fArray) fArray = fFactory->NewArray();
301 return fArray;
302}
303
304//------------------------------------------------------------------------------
305
306Bool_t Candidate::Overlaps(const Candidate *object) const
307{
308 const Candidate *candidate;
309
310 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
311
312 if(fArray)
313 {
314 TIter it(fArray);
315 while((candidate = static_cast<Candidate *>(it.Next())))
316 {
317 if(candidate->Overlaps(object)) return kTRUE;
318 }
319 }
320
321 if(object->fArray)
322 {
323 TIter it(object->fArray);
324 while((candidate = static_cast<Candidate *>(it.Next())))
325 {
326 if(candidate->Overlaps(this)) return kTRUE;
327 }
328 }
329
330 return kFALSE;
331}
332
333//------------------------------------------------------------------------------
334
335TObject *Candidate::Clone(const char *newname) const
336{
337 Candidate *object = fFactory->NewCandidate();
338 Copy(*object);
339 return object;
340}
341
342//------------------------------------------------------------------------------
343
344void Candidate::Copy(TObject &obj) const
345{
346 Candidate &object = static_cast<Candidate &>(obj);
347 Candidate *candidate;
348
349 object.PID = PID;
350 object.Status = Status;
351 object.M1 = M1;
352 object.M2 = M2;
353 object.D1 = D1;
354 object.D2 = D2;
355 object.Charge = Charge;
356 object.Mass = Mass;
357 object.IsPU = IsPU;
358 object.IsRecoPU = IsRecoPU;
359 object.IsConstituent = IsConstituent;
360 object.IsFromConversion = IsFromConversion;
361 object.ClusterIndex = ClusterIndex;
362 object.ClusterNDF = ClusterNDF;
363 object.ClusterSigma = ClusterSigma;
364 object.SumPT2 = SumPT2;
365 object.BTVSumPT2 = BTVSumPT2;
366 object.GenDeltaZ = GenDeltaZ;
367 object.GenSumPT2 = GenSumPT2;
368 object.Flavor = Flavor;
369 object.FlavorAlgo = FlavorAlgo;
370 object.FlavorPhys = FlavorPhys;
371 object.BTag = BTag;
372 object.BTagAlgo = BTagAlgo;
373 object.BTagPhys = BTagPhys;
374 object.TauTag = TauTag;
375 object.TauWeight = TauWeight;
376 object.Eem = Eem;
377 object.Ehad = Ehad;
378 object.Edges[0] = Edges[0];
379 object.Edges[1] = Edges[1];
380 object.Edges[2] = Edges[2];
381 object.Edges[3] = Edges[3];
382 object.DeltaEta = DeltaEta;
383 object.DeltaPhi = DeltaPhi;
384 object.Momentum = Momentum;
385 object.Position = Position;
386 object.InitialPosition = InitialPosition;
387 object.PositionError = PositionError;
388 object.Area = Area;
389 object.L = L;
390 object.ErrorT = ErrorT;
391 object.D0 = D0;
392 object.ErrorD0 = ErrorD0;
393 object.DZ = DZ;
394 object.ErrorDZ = ErrorDZ;
395 object.P = P;
396 object.ErrorP = ErrorP;
397 object.C = C;
398 object.ErrorC = ErrorC;
399 object.PT = PT;
400 object.ErrorPT = ErrorPT;
401 object.CtgTheta = CtgTheta;
402 object.ErrorCtgTheta = ErrorCtgTheta;
403 object.Phi = Phi;
404 object.ErrorPhi = ErrorPhi;
405 object.Xd = Xd;
406 object.Yd = Yd;
407 object.Zd = Zd;
408 object.TrackResolution = TrackResolution;
409 object.NCharged = NCharged;
410 object.NNeutrals = NNeutrals;
411 object.NeutralEnergyFraction = NeutralEnergyFraction;
412 object.ChargedEnergyFraction = ChargedEnergyFraction;
413 object.Beta = Beta;
414 object.BetaStar = BetaStar;
415 object.MeanSqDeltaR = MeanSqDeltaR;
416 object.PTD = PTD;
417 object.NTimeHits = NTimeHits;
418 object.IsolationVar = IsolationVar;
419 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
420 object.SumPtCharged = SumPtCharged;
421 object.SumPtNeutral = SumPtNeutral;
422 object.SumPtChargedPU = SumPtChargedPU;
423 object.SumPt = SumPt;
424 object.ClusterIndex = ClusterIndex;
425 object.ClusterNDF = ClusterNDF;
426 object.ClusterSigma = ClusterSigma;
427 object.SumPT2 = SumPT2;
428
429 object.FracPt[0] = FracPt[0];
430 object.FracPt[1] = FracPt[1];
431 object.FracPt[2] = FracPt[2];
432 object.FracPt[3] = FracPt[3];
433 object.FracPt[4] = FracPt[4];
434 object.Tau[0] = Tau[0];
435 object.Tau[1] = Tau[1];
436 object.Tau[2] = Tau[2];
437 object.Tau[3] = Tau[3];
438 object.Tau[4] = Tau[4];
439
440 object.TrimmedP4[0] = TrimmedP4[0];
441 object.TrimmedP4[1] = TrimmedP4[1];
442 object.TrimmedP4[2] = TrimmedP4[2];
443 object.TrimmedP4[3] = TrimmedP4[3];
444 object.TrimmedP4[4] = TrimmedP4[4];
445 object.PrunedP4[0] = PrunedP4[0];
446 object.PrunedP4[1] = PrunedP4[1];
447 object.PrunedP4[2] = PrunedP4[2];
448 object.PrunedP4[3] = PrunedP4[3];
449 object.PrunedP4[4] = PrunedP4[4];
450 object.SoftDroppedP4[0] = SoftDroppedP4[0];
451 object.SoftDroppedP4[1] = SoftDroppedP4[1];
452 object.SoftDroppedP4[2] = SoftDroppedP4[2];
453 object.SoftDroppedP4[3] = SoftDroppedP4[3];
454 object.SoftDroppedP4[4] = SoftDroppedP4[4];
455
456 object.NSubJetsTrimmed = NSubJetsTrimmed;
457 object.NSubJetsPruned = NSubJetsPruned;
458 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
459
460 object.SoftDroppedJet = SoftDroppedJet;
461 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
462 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
463 object.TrackCovariance = TrackCovariance;
464 object.fFactory = fFactory;
465 object.fArray = 0;
466
467 // copy cluster timing info
468 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
469
470 if(fArray && fArray->GetEntriesFast() > 0)
471 {
472 TIter itArray(fArray);
473 TObjArray *array = object.GetCandidates();
474 while((candidate = static_cast<Candidate *>(itArray.Next())))
475 {
476 array->Add(candidate);
477 }
478 }
479}
480
481//------------------------------------------------------------------------------
482
483void Candidate::Clear(Option_t *option)
484{
485 int i;
486 SetUniqueID(0);
487 ResetBit(kIsReferenced);
488 PID = 0;
489 Status = 0;
490 M1 = -1;
491 M2 = -1;
492 D1 = -1;
493 D2 = -1;
494 Charge = 0;
495 Mass = 0.0;
496 IsPU = 0;
497 IsRecoPU = 0;
498 IsConstituent = 0;
499 IsFromConversion = 0;
500 Flavor = 0;
501 FlavorAlgo = 0;
502 FlavorPhys = 0;
503 BTag = 0;
504 BTagAlgo = 0;
505 BTagPhys = 0;
506 TauTag = 0;
507 TauWeight = 0.0;
508 Eem = 0.0;
509 Ehad = 0.0;
510 Edges[0] = 0.0;
511 Edges[1] = 0.0;
512 Edges[2] = 0.0;
513 Edges[3] = 0.0;
514 DeltaEta = 0.0;
515 DeltaPhi = 0.0;
516 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
517 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
518 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
519 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
520 TrackCovariance.Zero();
521 L = 0.0;
522 ErrorT = 0.0;
523 D0 = 0.0;
524 ErrorD0 = 0.0;
525 DZ = 0.0;
526 ErrorDZ = 0.0;
527 P = 0.0;
528 ErrorP = 0.0;
529 C = 0.0;
530 ErrorC = 0.0;
531 PT = 0.0;
532 ErrorPT = 0.0;
533 CtgTheta = 0.0;
534 ErrorCtgTheta = 0.0;
535 Phi = 0.0;
536 ErrorPhi = 0.0;
537 Xd = 0.0;
538 Yd = 0.0;
539 Zd = 0.0;
540 TrackResolution = 0.0;
541 NCharged = 0;
542 NNeutrals = 0;
543 Beta = 0.0;
544 BetaStar = 0.0;
545 MeanSqDeltaR = 0.0;
546 PTD = 0.0;
547
548 NTimeHits = 0;
549 ECalEnergyTimePairs.clear();
550
551 IsolationVar = -999;
552 IsolationVarRhoCorr = -999;
553 SumPtCharged = -999;
554 SumPtNeutral = -999;
555 SumPtChargedPU = -999;
556 SumPt = -999;
557
558 ClusterIndex = -1;
559 ClusterNDF = -99;
560 ClusterSigma = 0.0;
561 SumPT2 = 0.0;
562 BTVSumPT2 = 0.0;
563 GenDeltaZ = 0.0;
564 GenSumPT2 = 0.0;
565
566 FracPt[0] = 0.0;
567 FracPt[1] = 0.0;
568 FracPt[2] = 0.0;
569 FracPt[3] = 0.0;
570 FracPt[4] = 0.0;
571 Tau[0] = 0.0;
572 Tau[1] = 0.0;
573 Tau[2] = 0.0;
574 Tau[3] = 0.0;
575 Tau[4] = 0.0;
576
577 SoftDroppedJet.SetXYZT(0.0, 0.0, 0.0, 0.0);
578 SoftDroppedSubJet1.SetXYZT(0.0, 0.0, 0.0, 0.0);
579 SoftDroppedSubJet2.SetXYZT(0.0, 0.0, 0.0, 0.0);
580
581 for(i = 0; i < 5; ++i)
582 {
583 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
584 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
585 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
586 }
587
588 NSubJetsTrimmed = 0;
589 NSubJetsPruned = 0;
590 NSubJetsSoftDropped = 0;
591
592 fArray = 0;
593}
Note: See TracBrowser for help on using the repository browser.