Fork me on GitHub

source: git/classes/DelphesClasses.cc@ 944c250

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 944c250 was 7c0fcd5, checked in by Pavel Demin <demin@…>, 10 years ago

delete duplicate license file and prepend GPLv3 header to all source code files

  • Property mode set to 100644
File size: 7.7 KB
RevLine 
[7c0fcd5]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
[d7d2da3]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 * $Date: 2008-06-04 13:57:24 $
27 * $Revision: 1.1 $
28 *
29 *
30 * \author P. Demin - UCL, Louvain-la-Neuve
31 *
32 */
33
34#include "classes/DelphesClasses.h"
35
36#include "classes/DelphesFactory.h"
37#include "classes/SortableObject.h"
38
39CompBase *GenParticle::fgCompare = 0;
40CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
41CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
42CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
43CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
44CompBase *Track::fgCompare = CompPT<Track>::Instance();
45CompBase *Tower::fgCompare = CompE<Tower>::Instance();
[8f7db23]46CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
[d7d2da3]47CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
48
49//------------------------------------------------------------------------------
50
51TLorentzVector GenParticle::P4()
52{
53 TLorentzVector vec;
54 vec.SetPxPyPzE(Px, Py, Pz, E);
55 return vec;
56}
57
58//------------------------------------------------------------------------------
59
[4ad7b96]60TLorentzVector MissingET::P4()
61{
62 TLorentzVector vec;
63 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
64 return vec;
65}
66
67//------------------------------------------------------------------------------
68
[d7d2da3]69TLorentzVector Photon::P4()
70{
71 TLorentzVector vec;
72 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
73 return vec;
74}
75
76//------------------------------------------------------------------------------
77
78TLorentzVector Electron::P4()
79{
80 TLorentzVector vec;
81 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
82 return vec;
83}
84
85//------------------------------------------------------------------------------
86
87TLorentzVector Muon::P4()
88{
89 TLorentzVector vec;
90 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
91 return vec;
92}
93
94//------------------------------------------------------------------------------
95
96TLorentzVector Jet::P4()
97{
98 TLorentzVector vec;
99 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
100 return vec;
101}
102
103//------------------------------------------------------------------------------
104
105TLorentzVector Track::P4()
106{
107 TLorentzVector vec;
108 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
109 return vec;
110}
111
112//------------------------------------------------------------------------------
113
114TLorentzVector Tower::P4()
115{
116 TLorentzVector vec;
117 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
118 return vec;
119}
120
121//------------------------------------------------------------------------------
122
123Candidate::Candidate() :
124 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
125 Charge(0), Mass(0.0),
126 IsPU(0), IsConstituent(0),
127 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
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),
131 Area(0.0, 0.0, 0.0, 0.0),
[43c646a]132 Dxy(0), SDxy(0), Xd(0), Yd(0), Zd(0),
[24d005f]133 NCharged(0),
134 NNeutrals(0),
135 Beta(0),
136 BetaStar(0),
137 MeanSqDeltaR(0),
[da00c35]138 PTD(0),
139 fFactory(0),
140 fArray(0)
[d7d2da3]141{
142 Edges[0] = 0.0;
143 Edges[1] = 0.0;
144 Edges[2] = 0.0;
145 Edges[3] = 0.0;
[24d005f]146 FracPt[0] = 0.0;
147 FracPt[1] = 0.0;
148 FracPt[2] = 0.0;
149 FracPt[3] = 0.0;
150 FracPt[4] = 0.0;
[63178fb]151 Tau[0] = 0.0;
152 Tau[1] = 0.0;
153 Tau[2] = 0.0;
154 Tau[3] = 0.0;
155 Tau[4] = 0.0;
[d7d2da3]156}
157
158//------------------------------------------------------------------------------
159
160void Candidate::AddCandidate(Candidate *object)
161{
162 if(!fArray) fArray = fFactory->NewArray();
163 fArray->Add(object);
164}
165
166//------------------------------------------------------------------------------
167
168TObjArray *Candidate::GetCandidates()
169{
170 if(!fArray) fArray = fFactory->NewArray();
171 return fArray;
172}
173
174//------------------------------------------------------------------------------
175
176Bool_t Candidate::Overlaps(const Candidate *object) const
177{
178 const Candidate *candidate;
179
180 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
181
182 if(fArray)
183 {
184 TIter it(fArray);
185 while((candidate = static_cast<Candidate *>(it.Next())))
186 {
187 if(candidate->Overlaps(object)) return kTRUE;
188 }
189 }
190
191 if(object->fArray)
192 {
193 TIter it(object->fArray);
194 while((candidate = static_cast<Candidate *>(it.Next())))
195 {
196 if(candidate->Overlaps(this)) return kTRUE;
197 }
198 }
199
200 return kFALSE;
201}
202
203
204//------------------------------------------------------------------------------
205
206TObject *Candidate::Clone(const char *newname) const
207{
208 Candidate *object = fFactory->NewCandidate();
209 Copy(*object);
210 return object;
211}
212
213//------------------------------------------------------------------------------
214
215void Candidate::Copy(TObject &obj) const
216{
217 Candidate &object = static_cast<Candidate &>(obj);
218 Candidate *candidate;
219
220 object.PID = PID;
221 object.Status = Status;
222 object.M1 = M1;
223 object.M2 = M2;
224 object.D1 = D1;
225 object.D2 = D2;
226 object.Charge = Charge;
227 object.Mass = Mass;
228 object.IsPU = IsPU;
229 object.IsConstituent = IsConstituent;
230 object.BTag = BTag;
231 object.TauTag = TauTag;
232 object.Eem = Eem;
233 object.Ehad = Ehad;
234 object.Edges[0] = Edges[0];
235 object.Edges[1] = Edges[1];
236 object.Edges[2] = Edges[2];
237 object.Edges[3] = Edges[3];
238 object.DeltaEta = DeltaEta;
239 object.DeltaPhi = DeltaPhi;
240 object.Momentum = Momentum;
241 object.Position = Position;
[43c646a]242 object.Area = Area;
[a0431dc]243 object.Dxy = Dxy;
244 object.SDxy = SDxy;
245 object.Xd = Xd;
246 object.Yd = Yd;
247 object.Zd = Zd;
[d7d2da3]248
[24d005f]249 object.NCharged = NCharged;
250 object.NNeutrals = NNeutrals;
251 object.Beta = Beta;
252 object.BetaStar = BetaStar;
253 object.MeanSqDeltaR = MeanSqDeltaR;
254 object.PTD = PTD;
255 object.FracPt[0] = FracPt[0];
256 object.FracPt[1] = FracPt[1];
257 object.FracPt[2] = FracPt[2];
258 object.FracPt[3] = FracPt[3];
259 object.FracPt[4] = FracPt[4];
[63178fb]260 object.Tau[0] = Tau[0];
261 object.Tau[1] = Tau[1];
262 object.Tau[2] = Tau[2];
263 object.Tau[3] = Tau[3];
264 object.Tau[4] = Tau[4];
[e4c3fef]265
[d7d2da3]266 object.fFactory = fFactory;
267 object.fArray = 0;
268
269 if(fArray && fArray->GetEntriesFast() > 0)
270 {
271 TIter itArray(fArray);
272 TObjArray *array = object.GetCandidates();
273 while((candidate = static_cast<Candidate *>(itArray.Next())))
274 {
275 array->Add(candidate);
276 }
277 }
278}
279
280//------------------------------------------------------------------------------
281
282void Candidate::Clear(Option_t* option)
283{
284 SetUniqueID(0);
285 ResetBit(kIsReferenced);
286 PID = 0;
287 Status = 0;
288 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
289 Charge = 0;
290 Mass = 0.0;
291 IsPU = 0;
292 IsConstituent = 0;
293 BTag = 0;
294 TauTag = 0;
295 Eem = 0.0;
296 Ehad = 0.0;
297 Edges[0] = 0.0;
298 Edges[1] = 0.0;
299 Edges[2] = 0.0;
300 Edges[3] = 0.0;
301 DeltaEta = 0.0;
302 DeltaPhi = 0.0;
303 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
304 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
305 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[a0431dc]306 Dxy = 0.0;
307 SDxy = 0.0;
308 Xd = 0.0;
309 Yd = 0.0;
310 Zd = 0.0;
[24d005f]311 NCharged = 0;
312 NNeutrals = 0;
313 Beta = 0.0;
314 BetaStar = 0.0;
315 MeanSqDeltaR = 0.0;
316 PTD = 0.0;
317 FracPt[0] = 0.0;
318 FracPt[1] = 0.0;
319 FracPt[2] = 0.0;
320 FracPt[3] = 0.0;
321 FracPt[4] = 0.0;
[63178fb]322 Tau[0] = 0.0;
323 Tau[1] = 0.0;
324 Tau[2] = 0.0;
325 Tau[3] = 0.0;
326 Tau[4] = 0.0;
[e4c3fef]327
[d7d2da3]328 fArray = 0;
329}
Note: See TracBrowser for help on using the repository browser.