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
RevLine 
[b443089]1/*
2 * Delphes: a framework for fast simulation of a generic collider experiment
3 * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
[1fa50c2]4 *
[b443089]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.
[1fa50c2]9 *
[b443089]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.
[1fa50c2]14 *
[b443089]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
[d7d2da3]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();
[a5af1df]38
[d7d2da3]39CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
40CompBase *Track::fgCompare = CompPT<Track>::Instance();
41CompBase *Tower::fgCompare = CompE<Tower>::Instance();
[8f7db23]42CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
[3c46e17]43CompBase *Vertex::fgCompare = CompSumPT2<Vertex>::Instance();
[d7d2da3]44CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
[a5af1df]45CompBase *CscCluster::fgCompare = CompE<CscCluster>::Instance();
[d7d2da3]46
47//------------------------------------------------------------------------------
48
[2b3ef28]49TLorentzVector GenParticle::P4() const
[d7d2da3]50{
51 TLorentzVector vec;
52 vec.SetPxPyPzE(Px, Py, Pz, E);
53 return vec;
54}
55
56//------------------------------------------------------------------------------
57
[2b3ef28]58TLorentzVector MissingET::P4() const
[4ad7b96]59{
60 TLorentzVector vec;
61 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
62 return vec;
63}
64
65//------------------------------------------------------------------------------
66
[2b3ef28]67TLorentzVector Photon::P4() const
[d7d2da3]68{
69 TLorentzVector vec;
70 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
71 return vec;
72}
73
74//------------------------------------------------------------------------------
75
[2b3ef28]76TLorentzVector Electron::P4() const
[d7d2da3]77{
78 TLorentzVector vec;
79 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
80 return vec;
81}
82
83//------------------------------------------------------------------------------
84
[2b3ef28]85TLorentzVector Muon::P4() const
[d7d2da3]86{
87 TLorentzVector vec;
88 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
89 return vec;
90}
91
92//------------------------------------------------------------------------------
93
[2b3ef28]94TLorentzVector Jet::P4() const
[d7d2da3]95{
96 TLorentzVector vec;
97 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
98 return vec;
99}
100
101//------------------------------------------------------------------------------
102
[2b3ef28]103TLorentzVector Track::P4() const
[d7d2da3]104{
105 TLorentzVector vec;
106 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
107 return vec;
108}
109
110//------------------------------------------------------------------------------
111
[2b3ef28]112TLorentzVector Tower::P4() const
[d7d2da3]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),
[5d2481f]124 IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0),
[fe0273c]125 Flavor(0), FlavorAlgo(0), FlavorPhys(0),
126 BTag(0), BTagAlgo(0), BTagPhys(0),
[7429c6a]127 TauTag(0), TauWeight(0.0), Eem(0.0), Ehad(0.0),
[d7d2da3]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),
[2118a6a]131 InitialPosition(0.0, 0.0, 0.0, 0.0),
[a5af1df]132 DecayPosition(0.0, 0.0, 0.0, 0.0),
[1a4956e]133 PositionError(0.0, 0.0, 0.0, 0.0),
[d7d2da3]134 Area(0.0, 0.0, 0.0, 0.0),
[80306e6]135 L(0),
[341014c]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),
[a98c7ef]143 TrackResolution(0),
[24d005f]144 NCharged(0),
145 NNeutrals(0),
146 Beta(0),
147 BetaStar(0),
148 MeanSqDeltaR(0),
[da00c35]149 PTD(0),
[839deb7]150 NTimeHits(-1),
[b62c2da]151 IsolationVar(-999),
152 IsolationVarRhoCorr(-999),
153 SumPtCharged(-999),
154 SumPtNeutral(-999),
155 SumPtChargedPU(-999),
156 SumPt(-999),
[1a4956e]157 ClusterIndex(-1), ClusterNDF(0), ClusterSigma(0), SumPT2(0), BTVSumPT2(0), GenDeltaZ(0), GenSumPT2(0),
[839deb7]158 NSubJetsTrimmed(0),
159 NSubJetsPruned(0),
160 NSubJetsSoftDropped(0),
[e9c0d73]161 ExclYmerge23(0),
162 ExclYmerge34(0),
163 ExclYmerge45(0),
164 ExclYmerge56(0),
[da00c35]165 fFactory(0),
166 fArray(0)
[d7d2da3]167{
[8d200a6]168 int i;
[d7d2da3]169 Edges[0] = 0.0;
170 Edges[1] = 0.0;
171 Edges[2] = 0.0;
172 Edges[3] = 0.0;
[24d005f]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;
[63178fb]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;
[ba75867]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
[8d200a6]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 }
[d7d2da3]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;
[84733ae]266 object.IsRecoPU = IsRecoPU;
[d7d2da3]267 object.IsConstituent = IsConstituent;
[5d2481f]268 object.IsFromConversion = IsFromConversion;
[2118a6a]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;
[fe0273c]276 object.Flavor = Flavor;
277 object.FlavorAlgo = FlavorAlgo;
278 object.FlavorPhys = FlavorPhys;
[d7d2da3]279 object.BTag = BTag;
[edf10ba]280 object.BTagAlgo = BTagAlgo;
[fe0273c]281 object.BTagPhys = BTagPhys;
[d7d2da3]282 object.TauTag = TauTag;
[7429c6a]283 object.TauWeight = TauWeight;
[d7d2da3]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;
[2118a6a]294 object.InitialPosition = InitialPosition;
[a5af1df]295 object.DecayPosition = DecayPosition;
[2118a6a]296 object.PositionError = PositionError;
[43c646a]297 object.Area = Area;
[80306e6]298 object.L = L;
[28c722a]299 object.ErrorT = ErrorT;
[80306e6]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;
[341014c]308 object.CtgTheta = CtgTheta;
[80306e6]309 object.ErrorCtgTheta = ErrorCtgTheta;
310 object.Phi = Phi;
[341014c]311 object.ErrorPhi = ErrorPhi;
[a0431dc]312 object.Xd = Xd;
313 object.Yd = Yd;
314 object.Zd = Zd;
[a98c7ef]315 object.TrackResolution = TrackResolution;
[24d005f]316 object.NCharged = NCharged;
317 object.NNeutrals = NNeutrals;
318 object.Beta = Beta;
319 object.BetaStar = BetaStar;
320 object.MeanSqDeltaR = MeanSqDeltaR;
321 object.PTD = PTD;
[839deb7]322 object.NTimeHits = NTimeHits;
[b62c2da]323 object.IsolationVar = IsolationVar;
324 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
325 object.SumPtCharged = SumPtCharged;
326 object.SumPtNeutral = SumPtNeutral;
327 object.SumPtChargedPU = SumPtChargedPU;
328 object.SumPt = SumPt;
[ab3bdd9]329 object.ClusterIndex = ClusterIndex;
330 object.ClusterNDF = ClusterNDF;
[341014c]331 object.ClusterSigma = ClusterSigma;
[ab3bdd9]332 object.SumPT2 = SumPT2;
[341014c]333
[24d005f]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];
[63178fb]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];
[839deb7]344
[de6d698]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
[edf10ba]361 object.NSubJetsTrimmed = NSubJetsTrimmed;
362 object.NSubJetsPruned = NSubJetsPruned;
[de6d698]363 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
[e4c3fef]364
[341014c]365 object.SoftDroppedJet = SoftDroppedJet;
[ba75867]366 object.SoftDroppedSubJet1 = SoftDroppedSubJet1;
367 object.SoftDroppedSubJet2 = SoftDroppedSubJet2;
368
[d7d2da3]369 object.fFactory = fFactory;
370 object.fArray = 0;
371
[839deb7]372 // copy cluster timing info
373 copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
[3db5282]374
[d7d2da3]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
[341014c]388void Candidate::Clear(Option_t *option)
[d7d2da3]389{
[8d200a6]390 int i;
[d7d2da3]391 SetUniqueID(0);
392 ResetBit(kIsReferenced);
393 PID = 0;
394 Status = 0;
[341014c]395 M1 = -1;
396 M2 = -1;
397 D1 = -1;
398 D2 = -1;
[d7d2da3]399 Charge = 0;
400 Mass = 0.0;
401 IsPU = 0;
[d759c46]402 IsRecoPU = 0;
[d7d2da3]403 IsConstituent = 0;
[5d2481f]404 IsFromConversion = 0;
[fe0273c]405 Flavor = 0;
406 FlavorAlgo = 0;
407 FlavorPhys = 0;
[d7d2da3]408 BTag = 0;
[edf10ba]409 BTagAlgo = 0;
[fe0273c]410 BTagPhys = 0;
[d7d2da3]411 TauTag = 0;
[7429c6a]412 TauWeight = 0.0;
[d7d2da3]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);
[80306e6]423 InitialPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
[a5af1df]424 DecayPosition.SetXYZT(0.0, 0.0, 0.0, 0.0);
[d7d2da3]425 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[80306e6]426 L = 0.0;
[28c722a]427 ErrorT = 0.0;
[341014c]428 D0 = 0.0;
[80306e6]429 ErrorD0 = 0.0;
430 DZ = 0.0;
431 ErrorDZ = 0.0;
[341014c]432 P = 0.0;
433 ErrorP = 0.0;
[80306e6]434 PT = 0.0;
435 ErrorPT = 0.0;
436 CtgTheta = 0.0;
437 ErrorCtgTheta = 0.0;
438 Phi = 0.0;
439 ErrorPhi = 0.0;
[a0431dc]440 Xd = 0.0;
441 Yd = 0.0;
442 Zd = 0.0;
[a98c7ef]443 TrackResolution = 0.0;
[24d005f]444 NCharged = 0;
445 NNeutrals = 0;
446 Beta = 0.0;
447 BetaStar = 0.0;
448 MeanSqDeltaR = 0.0;
449 PTD = 0.0;
[839deb7]450
451 NTimeHits = 0;
452 ECalEnergyTimePairs.clear();
453
[b62c2da]454 IsolationVar = -999;
455 IsolationVarRhoCorr = -999;
456 SumPtCharged = -999;
457 SumPtNeutral = -999;
458 SumPtChargedPU = -999;
459 SumPt = -999;
[839deb7]460
[ab3bdd9]461 ClusterIndex = -1;
462 ClusterNDF = -99;
[341014c]463 ClusterSigma = 0.0;
[ab3bdd9]464 SumPT2 = 0.0;
465 BTVSumPT2 = 0.0;
466 GenDeltaZ = 0.0;
[341014c]467 GenSumPT2 = 0.0;
468
[24d005f]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;
[63178fb]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;
[839deb7]479
[ba75867]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
[8d200a6]484 for(i = 0; i < 5; ++i)
485 {
486 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[839deb7]487 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
[8d200a6]488 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
489 }
490
[edf10ba]491 NSubJetsTrimmed = 0;
492 NSubJetsPruned = 0;
[de6d698]493 NSubJetsSoftDropped = 0;
[839deb7]494
[d7d2da3]495 fArray = 0;
496}
Note: See TracBrowser for help on using the repository browser.