Fork me on GitHub

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

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 3db5282 was 3db5282, checked in by Michele Selvaggi <michele.selvaggi@…>, 10 years ago

included timing information in Calorimeter

  • Property mode set to 100644
File size: 8.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 *
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 Beta(0),
132 BetaStar(0),
133 MeanSqDeltaR(0),
134 PTD(0),
135 Ntimes(-1),
136 IsolationVar(-999),
137 IsolationVarRhoCorr(-999),
138 SumPtCharged(-999),
139 SumPtNeutral(-999),
140 SumPtChargedPU(-999),
141 SumPt(-999),
142 fFactory(0),
143 fArray(0)
144{
145 Edges[0] = 0.0;
146 Edges[1] = 0.0;
147 Edges[2] = 0.0;
148 Edges[3] = 0.0;
149 FracPt[0] = 0.0;
150 FracPt[1] = 0.0;
151 FracPt[2] = 0.0;
152 FracPt[3] = 0.0;
153 FracPt[4] = 0.0;
154 Tau[0] = 0.0;
155 Tau[1] = 0.0;
156 Tau[2] = 0.0;
157 Tau[3] = 0.0;
158 Tau[4] = 0.0;
159}
160
161//------------------------------------------------------------------------------
162
163void Candidate::AddCandidate(Candidate *object)
164{
165 if(!fArray) fArray = fFactory->NewArray();
166 fArray->Add(object);
167}
168
169//------------------------------------------------------------------------------
170
171TObjArray *Candidate::GetCandidates()
172{
173 if(!fArray) fArray = fFactory->NewArray();
174 return fArray;
175}
176
177//------------------------------------------------------------------------------
178
179Bool_t Candidate::Overlaps(const Candidate *object) const
180{
181 const Candidate *candidate;
182
183 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
184
185 if(fArray)
186 {
187 TIter it(fArray);
188 while((candidate = static_cast<Candidate *>(it.Next())))
189 {
190 if(candidate->Overlaps(object)) return kTRUE;
191 }
192 }
193
194 if(object->fArray)
195 {
196 TIter it(object->fArray);
197 while((candidate = static_cast<Candidate *>(it.Next())))
198 {
199 if(candidate->Overlaps(this)) return kTRUE;
200 }
201 }
202
203 return kFALSE;
204}
205
206
207//------------------------------------------------------------------------------
208
209TObject *Candidate::Clone(const char *newname) const
210{
211 Candidate *object = fFactory->NewCandidate();
212 Copy(*object);
213 return object;
214}
215
216//------------------------------------------------------------------------------
217
218void Candidate::Copy(TObject &obj) const
219{
220 Candidate &object = static_cast<Candidate &>(obj);
221 Candidate *candidate;
222
223 object.PID = PID;
224 object.Status = Status;
225 object.M1 = M1;
226 object.M2 = M2;
227 object.D1 = D1;
228 object.D2 = D2;
229 object.Charge = Charge;
230 object.Mass = Mass;
231 object.IsPU = IsPU;
232 object.IsConstituent = IsConstituent;
233 object.BTag = BTag;
234 object.TauTag = TauTag;
235 object.Eem = Eem;
236 object.Ehad = Ehad;
237 object.Edges[0] = Edges[0];
238 object.Edges[1] = Edges[1];
239 object.Edges[2] = Edges[2];
240 object.Edges[3] = Edges[3];
241 object.DeltaEta = DeltaEta;
242 object.DeltaPhi = DeltaPhi;
243 object.Momentum = Momentum;
244 object.Position = Position;
245 object.Area = Area;
246 object.Dxy = Dxy;
247 object.SDxy = SDxy;
248 object.Xd = Xd;
249 object.Yd = Yd;
250 object.Zd = Zd;
251
252 object.NCharged = NCharged;
253 object.NNeutrals = NNeutrals;
254 object.Beta = Beta;
255 object.BetaStar = BetaStar;
256 object.MeanSqDeltaR = MeanSqDeltaR;
257 object.PTD = PTD;
258 object.Ntimes = Ntimes;
259 object.IsolationVar = IsolationVar;
260 object.IsolationVarRhoCorr = IsolationVarRhoCorr;
261 object.SumPtCharged = SumPtCharged;
262 object.SumPtNeutral = SumPtNeutral;
263 object.SumPtChargedPU = SumPtChargedPU;
264 object.SumPt = SumPt;
265
266 object.FracPt[0] = FracPt[0];
267 object.FracPt[1] = FracPt[1];
268 object.FracPt[2] = FracPt[2];
269 object.FracPt[3] = FracPt[3];
270 object.FracPt[4] = FracPt[4];
271 object.Tau[0] = Tau[0];
272 object.Tau[1] = Tau[1];
273 object.Tau[2] = Tau[2];
274 object.Tau[3] = Tau[3];
275 object.Tau[4] = Tau[4];
276
277 object.fFactory = fFactory;
278 object.fArray = 0;
279
280
281 // Copy cluster timing info
282 copy(Ecal_E_t.begin(),Ecal_E_t.end(),back_inserter(object.Ecal_E_t));
283
284 if(fArray && fArray->GetEntriesFast() > 0)
285 {
286 TIter itArray(fArray);
287 TObjArray *array = object.GetCandidates();
288 while((candidate = static_cast<Candidate *>(itArray.Next())))
289 {
290 array->Add(candidate);
291 }
292 }
293}
294
295//------------------------------------------------------------------------------
296
297void Candidate::Clear(Option_t* option)
298{
299 SetUniqueID(0);
300 ResetBit(kIsReferenced);
301 PID = 0;
302 Status = 0;
303 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
304 Charge = 0;
305 Mass = 0.0;
306 IsPU = 0;
307 IsConstituent = 0;
308 BTag = 0;
309 TauTag = 0;
310 Eem = 0.0;
311 Ehad = 0.0;
312 Edges[0] = 0.0;
313 Edges[1] = 0.0;
314 Edges[2] = 0.0;
315 Edges[3] = 0.0;
316 DeltaEta = 0.0;
317 DeltaPhi = 0.0;
318 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
319 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
320 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
321 Dxy = 0.0;
322 SDxy = 0.0;
323 Xd = 0.0;
324 Yd = 0.0;
325 Zd = 0.0;
326 NCharged = 0;
327 NNeutrals = 0;
328 Beta = 0.0;
329 BetaStar = 0.0;
330 MeanSqDeltaR = 0.0;
331 PTD = 0.0;
332
333 Ntimes = 0;
334 Ecal_E_t.clear();
335
336 IsolationVar = -999;
337 IsolationVarRhoCorr = -999;
338 SumPtCharged = -999;
339 SumPtNeutral = -999;
340 SumPtChargedPU = -999;
341 SumPt = -999;
342
343 FracPt[0] = 0.0;
344 FracPt[1] = 0.0;
345 FracPt[2] = 0.0;
346 FracPt[3] = 0.0;
347 FracPt[4] = 0.0;
348 Tau[0] = 0.0;
349 Tau[1] = 0.0;
350 Tau[2] = 0.0;
351 Tau[3] = 0.0;
352 Tau[4] = 0.0;
353
354 fArray = 0;
355}
Note: See TracBrowser for help on using the repository browser.