Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 8d200a6

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 8d200a6 was 8d200a6, checked in by Pavel Demin <pavel.demin@…>, 9 years ago

fix four-vectors in Candidate

  • Property mode set to 100644
File size: 9.5 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()
48{
49 TLorentzVector vec;
50 vec.SetPxPyPzE(Px, Py, Pz, E);
51 return vec;
52}
53
54//------------------------------------------------------------------------------
55
56TLorentzVector MissingET::P4()
57{
58 TLorentzVector vec;
59 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
60 return vec;
61}
62
63//------------------------------------------------------------------------------
64
65TLorentzVector Photon::P4()
66{
67 TLorentzVector vec;
68 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
69 return vec;
70}
71
72//------------------------------------------------------------------------------
73
74TLorentzVector Electron::P4()
75{
76 TLorentzVector vec;
77 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
78 return vec;
79}
80
81//------------------------------------------------------------------------------
82
83TLorentzVector Muon::P4()
84{
85 TLorentzVector vec;
86 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
87 return vec;
88}
89
90//------------------------------------------------------------------------------
91
92TLorentzVector Jet::P4()
93{
94 TLorentzVector vec;
95 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
96 return vec;
97}
98
99//------------------------------------------------------------------------------
100
101TLorentzVector Track::P4()
102{
103 TLorentzVector vec;
104 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
105 return vec;
106}
107
108//------------------------------------------------------------------------------
109
110TLorentzVector Tower::P4()
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),
123 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
124 DeltaEta(0.0), DeltaPhi(0.0),
125 Momentum(0.0, 0.0, 0.0, 0.0),
126 Position(0.0, 0.0, 0.0, 0.0),
127 Area(0.0, 0.0, 0.0, 0.0),
128 Dxy(0), SDxy(0), Xd(0), Yd(0), Zd(0),
129 NCharged(0),
130 NNeutrals(0),
131 NSubJetsTrimmed(0),
132 NSubJetsPruned(0),
133 NSubJetsSoftDropped(0),
134 Beta(0),
135 BetaStar(0),
136 MeanSqDeltaR(0),
137 PTD(0),
138 Ntimes(-1),
139 IsolationVar(-999),
140 IsolationVarRhoCorr(-999),
141 SumPtCharged(-999),
142 SumPtNeutral(-999),
143 SumPtChargedPU(-999),
144 SumPt(-999),
145 fFactory(0),
146 fArray(0)
147{
148 int i;
149 Edges[0] = 0.0;
150 Edges[1] = 0.0;
151 Edges[2] = 0.0;
152 Edges[3] = 0.0;
153 FracPt[0] = 0.0;
154 FracPt[1] = 0.0;
155 FracPt[2] = 0.0;
156 FracPt[3] = 0.0;
157 FracPt[4] = 0.0;
158 Tau[0] = 0.0;
159 Tau[1] = 0.0;
160 Tau[2] = 0.0;
161 Tau[3] = 0.0;
162 Tau[4] = 0.0;
163 for(i = 0; i < 5; ++i)
164 {
165 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
166 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
167 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
168 }
169}
170
171//------------------------------------------------------------------------------
172
173void Candidate::AddCandidate(Candidate *object)
174{
175 if(!fArray) fArray = fFactory->NewArray();
176 fArray->Add(object);
177}
178
179//------------------------------------------------------------------------------
180
181TObjArray *Candidate::GetCandidates()
182{
183 if(!fArray) fArray = fFactory->NewArray();
184 return fArray;
185}
186
187//------------------------------------------------------------------------------
188
189Bool_t Candidate::Overlaps(const Candidate *object) const
190{
191 const Candidate *candidate;
192
193 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
194
195 if(fArray)
196 {
197 TIter it(fArray);
198 while((candidate = static_cast<Candidate *>(it.Next())))
199 {
200 if(candidate->Overlaps(object)) return kTRUE;
201 }
202 }
203
204 if(object->fArray)
205 {
206 TIter it(object->fArray);
207 while((candidate = static_cast<Candidate *>(it.Next())))
208 {
209 if(candidate->Overlaps(this)) return kTRUE;
210 }
211 }
212
213 return kFALSE;
214}
215
216
217//------------------------------------------------------------------------------
218
219TObject *Candidate::Clone(const char *newname) const
220{
221 Candidate *object = fFactory->NewCandidate();
222 Copy(*object);
223 return object;
224}
225
226//------------------------------------------------------------------------------
227
228void Candidate::Copy(TObject &obj) const
229{
230 Candidate &object = static_cast<Candidate &>(obj);
231 Candidate *candidate;
232
233 object.PID = PID;
234 object.Status = Status;
235 object.M1 = M1;
236 object.M2 = M2;
237 object.D1 = D1;
238 object.D2 = D2;
239 object.Charge = Charge;
240 object.Mass = Mass;
241 object.IsPU = IsPU;
242 object.IsConstituent = IsConstituent;
243 object.BTag = BTag;
244 object.TauTag = TauTag;
245 object.Eem = Eem;
246 object.Ehad = Ehad;
247 object.Edges[0] = Edges[0];
248 object.Edges[1] = Edges[1];
249 object.Edges[2] = Edges[2];
250 object.Edges[3] = Edges[3];
251 object.DeltaEta = DeltaEta;
252 object.DeltaPhi = DeltaPhi;
253 object.Momentum = Momentum;
254 object.Position = Position;
255 object.Area = Area;
256 object.Dxy = Dxy;
257 object.SDxy = SDxy;
258 object.Xd = Xd;
259 object.Yd = Yd;
260 object.Zd = Zd;
261
262 object.NCharged = NCharged;
263 object.NNeutrals = NNeutrals;
264 object.Beta = Beta;
265 object.BetaStar = BetaStar;
266 object.MeanSqDeltaR = MeanSqDeltaR;
267 object.PTD = PTD;
268 object.Ntimes = Ntimes;
269 object.IsolationVar = IsolationVar;
270 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
271 object.SumPtCharged = SumPtCharged;
272 object.SumPtNeutral = SumPtNeutral;
273 object.SumPtChargedPU = SumPtChargedPU;
274 object.SumPt = SumPt;
275
276 object.FracPt[0] = FracPt[0];
277 object.FracPt[1] = FracPt[1];
278 object.FracPt[2] = FracPt[2];
279 object.FracPt[3] = FracPt[3];
280 object.FracPt[4] = FracPt[4];
281 object.Tau[0] = Tau[0];
282 object.Tau[1] = Tau[1];
283 object.Tau[2] = Tau[2];
284 object.Tau[3] = Tau[3];
285 object.Tau[4] = Tau[4];
286
287 object.TrimmedP4[0] = TrimmedP4[0];
288 object.TrimmedP4[1] = TrimmedP4[1];
289 object.TrimmedP4[2] = TrimmedP4[2];
290 object.TrimmedP4[3] = TrimmedP4[3];
291 object.TrimmedP4[4] = TrimmedP4[4];
292 object.PrunedP4[0] = PrunedP4[0];
293 object.PrunedP4[1] = PrunedP4[1];
294 object.PrunedP4[2] = PrunedP4[2];
295 object.PrunedP4[3] = PrunedP4[3];
296 object.PrunedP4[4] = PrunedP4[4];
297 object.SoftDroppedP4[0] = SoftDroppedP4[0];
298 object.SoftDroppedP4[1] = SoftDroppedP4[1];
299 object.SoftDroppedP4[2] = SoftDroppedP4[2];
300 object.SoftDroppedP4[3] = SoftDroppedP4[3];
301 object.SoftDroppedP4[4] = SoftDroppedP4[4];
302
303 object.NSubJetsTrimmed = NSubJetsTrimmed;
304 object.NSubJetsPruned = NSubJetsPruned;
305 object.NSubJetsSoftDropped = NSubJetsSoftDropped;
306
307 object.fFactory = fFactory;
308 object.fArray = 0;
309
310 // Copy cluster timing info
311 copy(Ecal_E_t.begin(),Ecal_E_t.end(),back_inserter(object.Ecal_E_t));
312
313 if(fArray && fArray->GetEntriesFast() > 0)
314 {
315 TIter itArray(fArray);
316 TObjArray *array = object.GetCandidates();
317 while((candidate = static_cast<Candidate *>(itArray.Next())))
318 {
319 array->Add(candidate);
320 }
321 }
322}
323
324//------------------------------------------------------------------------------
325
326void Candidate::Clear(Option_t* option)
327{
328 int i;
329 SetUniqueID(0);
330 ResetBit(kIsReferenced);
331 PID = 0;
332 Status = 0;
333 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
334 Charge = 0;
335 Mass = 0.0;
336 IsPU = 0;
337 IsConstituent = 0;
338 BTag = 0;
339 TauTag = 0;
340 Eem = 0.0;
341 Ehad = 0.0;
342 Edges[0] = 0.0;
343 Edges[1] = 0.0;
344 Edges[2] = 0.0;
345 Edges[3] = 0.0;
346 DeltaEta = 0.0;
347 DeltaPhi = 0.0;
348 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
349 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
350 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
351 Dxy = 0.0;
352 SDxy = 0.0;
353 Xd = 0.0;
354 Yd = 0.0;
355 Zd = 0.0;
356 NCharged = 0;
357 NNeutrals = 0;
358 Beta = 0.0;
359 BetaStar = 0.0;
360 MeanSqDeltaR = 0.0;
361 PTD = 0.0;
362
363 Ntimes = 0;
364 Ecal_E_t.clear();
365
366 IsolationVar = -999;
367 IsolationVarRhoCorr = -999;
368 SumPtCharged = -999;
369 SumPtNeutral = -999;
370 SumPtChargedPU = -999;
371 SumPt = -999;
372
373 FracPt[0] = 0.0;
374 FracPt[1] = 0.0;
375 FracPt[2] = 0.0;
376 FracPt[3] = 0.0;
377 FracPt[4] = 0.0;
378 Tau[0] = 0.0;
379 Tau[1] = 0.0;
380 Tau[2] = 0.0;
381 Tau[3] = 0.0;
382 Tau[4] = 0.0;
383
384 for(i = 0; i < 5; ++i)
385 {
386 TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
387 PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
388 SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
389 }
390
391 NSubJetsTrimmed = 0;
392 NSubJetsPruned = 0;
393 NSubJetsSoftDropped = 0;
394
395 fArray = 0;
396}
Note: See TracBrowser for help on using the repository browser.