Fork me on GitHub

source: svn/trunk/classes/DelphesClasses.cc@ 1377

Last change on this file since 1377 was 1372, checked in by Pavel Demin, 11 years ago

several minor corrections

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