Fork me on GitHub

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

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

reorder variables in Candidate

File size: 6.3 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 *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
29
30//------------------------------------------------------------------------------
31
32TLorentzVector GenParticle::P4()
33{
34 TLorentzVector vec;
35 vec.SetPxPyPzE(Px, Py, Pz, E);
36 return vec;
37}
38
39//------------------------------------------------------------------------------
40
41TLorentzVector MissingET::P4()
42{
43 TLorentzVector vec;
44 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
45 return vec;
46}
47
48//------------------------------------------------------------------------------
49
50TLorentzVector Photon::P4()
51{
52 TLorentzVector vec;
53 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
54 return vec;
55}
56
57//------------------------------------------------------------------------------
58
59TLorentzVector Electron::P4()
60{
61 TLorentzVector vec;
62 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
63 return vec;
64}
65
66//------------------------------------------------------------------------------
67
68TLorentzVector Muon::P4()
69{
70 TLorentzVector vec;
71 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
72 return vec;
73}
74
75//------------------------------------------------------------------------------
76
77TLorentzVector Jet::P4()
78{
79 TLorentzVector vec;
80 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
81 return vec;
82}
83
84//------------------------------------------------------------------------------
85
86TLorentzVector Track::P4()
87{
88 TLorentzVector vec;
89 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
90 return vec;
91}
92
93//------------------------------------------------------------------------------
94
95TLorentzVector Tower::P4()
96{
97 TLorentzVector vec;
98 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
99 return vec;
100}
101
102//------------------------------------------------------------------------------
103
104Candidate::Candidate() :
105 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
106 Charge(0), Mass(0.0),
107 IsPU(0), IsConstituent(0),
108 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
109 DeltaEta(0.0), DeltaPhi(0.0),
110 Momentum(0.0, 0.0, 0.0, 0.0),
111 Position(0.0, 0.0, 0.0, 0.0),
112 Area(0.0, 0.0, 0.0, 0.0),
113 NCharged(0),
114 NNeutrals(0),
115 Beta(0),
116 BetaStar(0),
117 MeanSqDeltaR(0),
118 PTD(0),
119 fFactory(0),
120 fArray(0)
121{
122 Edges[0] = 0.0;
123 Edges[1] = 0.0;
124 Edges[2] = 0.0;
125 Edges[3] = 0.0;
126 FracPt[0] = 0.0;
127 FracPt[1] = 0.0;
128 FracPt[2] = 0.0;
129 FracPt[3] = 0.0;
130 FracPt[4] = 0.0;
131}
132
133//------------------------------------------------------------------------------
134
135void Candidate::AddCandidate(Candidate *object)
136{
137 if(!fArray) fArray = fFactory->NewArray();
138 fArray->Add(object);
139}
140
141//------------------------------------------------------------------------------
142
143TObjArray *Candidate::GetCandidates()
144{
145 if(!fArray) fArray = fFactory->NewArray();
146 return fArray;
147}
148
149//------------------------------------------------------------------------------
150
151Bool_t Candidate::Overlaps(const Candidate *object) const
152{
153 const Candidate *candidate;
154
155 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
156
157 if(fArray)
158 {
159 TIter it(fArray);
160 while((candidate = static_cast<Candidate *>(it.Next())))
161 {
162 if(candidate->Overlaps(object)) return kTRUE;
163 }
164 }
165
166 if(object->fArray)
167 {
168 TIter it(object->fArray);
169 while((candidate = static_cast<Candidate *>(it.Next())))
170 {
171 if(candidate->Overlaps(this)) return kTRUE;
172 }
173 }
174
175 return kFALSE;
176}
177
178
179//------------------------------------------------------------------------------
180
181TObject *Candidate::Clone(const char *newname) const
182{
183 Candidate *object = fFactory->NewCandidate();
184 Copy(*object);
185 return object;
186}
187
188//------------------------------------------------------------------------------
189
190void Candidate::Copy(TObject &obj) const
191{
192 Candidate &object = static_cast<Candidate &>(obj);
193 Candidate *candidate;
194
195 object.PID = PID;
196 object.Status = Status;
197 object.M1 = M1;
198 object.M2 = M2;
199 object.D1 = D1;
200 object.D2 = D2;
201 object.Charge = Charge;
202 object.Mass = Mass;
203 object.IsPU = IsPU;
204 object.IsConstituent = IsConstituent;
205 object.BTag = BTag;
206 object.TauTag = TauTag;
207 object.Eem = Eem;
208 object.Ehad = Ehad;
209 object.Edges[0] = Edges[0];
210 object.Edges[1] = Edges[1];
211 object.Edges[2] = Edges[2];
212 object.Edges[3] = Edges[3];
213 object.DeltaEta = DeltaEta;
214 object.DeltaPhi = DeltaPhi;
215 object.Momentum = Momentum;
216 object.Position = Position;
217 object.Area = Area;
218
219 object.NCharged = NCharged;
220 object.NNeutrals = NNeutrals;
221 object.Beta = Beta;
222 object.BetaStar = BetaStar;
223 object.MeanSqDeltaR = MeanSqDeltaR;
224 object.PTD = PTD;
225 object.FracPt[0] = FracPt[0];
226 object.FracPt[1] = FracPt[1];
227 object.FracPt[2] = FracPt[2];
228 object.FracPt[3] = FracPt[3];
229 object.FracPt[4] = FracPt[4];
230
231 object.fFactory = fFactory;
232 object.fArray = 0;
233
234 if(fArray && fArray->GetEntriesFast() > 0)
235 {
236 TIter itArray(fArray);
237 TObjArray *array = object.GetCandidates();
238 while((candidate = static_cast<Candidate *>(itArray.Next())))
239 {
240 array->Add(candidate);
241 }
242 }
243}
244
245//------------------------------------------------------------------------------
246
247void Candidate::Clear(Option_t* option)
248{
249 SetUniqueID(0);
250 ResetBit(kIsReferenced);
251 PID = 0;
252 Status = 0;
253 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
254 Charge = 0;
255 Mass = 0.0;
256 IsPU = 0;
257 IsConstituent = 0;
258 BTag = 0;
259 TauTag = 0;
260 Eem = 0.0;
261 Ehad = 0.0;
262 Edges[0] = 0.0;
263 Edges[1] = 0.0;
264 Edges[2] = 0.0;
265 Edges[3] = 0.0;
266 DeltaEta = 0.0;
267 DeltaPhi = 0.0;
268 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
269 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
270 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
271
272 NCharged = 0;
273 NNeutrals = 0;
274 Beta = 0.0;
275 BetaStar = 0.0;
276 MeanSqDeltaR = 0.0;
277 PTD = 0.0;
278 FracPt[0] = 0.0;
279 FracPt[1] = 0.0;
280 FracPt[2] = 0.0;
281 FracPt[3] = 0.0;
282 FracPt[4] = 0.0;
283
284 fArray = 0;
285}
Note: See TracBrowser for help on using the repository browser.