Fork me on GitHub

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

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

reorder variables in Candidate

File size: 6.9 KB
RevLine 
[593]1
[814]2/**
[593]3 *
[814]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.
[593]7 *
[814]8 * $Date: 2008-06-04 13:57:24 $
[593]9 * $Revision: 1.1 $
10 *
[814]11 *
[593]12 * \author P. Demin - UCL, Louvain-la-Neuve
13 *
14 */
15
[687]16#include "classes/DelphesClasses.h"
[593]17
[687]18#include "classes/DelphesFactory.h"
19#include "classes/SortableObject.h"
[593]20
[687]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();
[1361]28CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
[895]29CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
[687]30
[685]31//------------------------------------------------------------------------------
32
[884]33TLorentzVector GenParticle::P4()
34{
35 TLorentzVector vec;
36 vec.SetPxPyPzE(Px, Py, Pz, E);
37 return vec;
38}
39
40//------------------------------------------------------------------------------
41
[1318]42TLorentzVector MissingET::P4()
43{
44 TLorentzVector vec;
45 vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
46 return vec;
47}
48
49//------------------------------------------------------------------------------
50
[884]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
[687]105Candidate::Candidate() :
[1014]106 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
[1088]107 Charge(0), Mass(0.0),
[1074]108 IsPU(0), IsConstituent(0),
109 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
[900]110 DeltaEta(0.0), DeltaPhi(0.0),
[685]111 Momentum(0.0, 0.0, 0.0, 0.0),
112 Position(0.0, 0.0, 0.0, 0.0),
[1088]113 Area(0.0, 0.0, 0.0, 0.0),
[1384]114 Dxy(0), SDxy(0), Xd(0), Yd(0), Zd(0),
[1348]115 NCharged(0),
116 NNeutrals(0),
117 Beta(0),
118 BetaStar(0),
119 MeanSqDeltaR(0),
[1354]120 PTD(0),
121 fFactory(0),
122 fArray(0)
[685]123{
[898]124 Edges[0] = 0.0;
125 Edges[1] = 0.0;
126 Edges[2] = 0.0;
127 Edges[3] = 0.0;
[1348]128 FracPt[0] = 0.0;
129 FracPt[1] = 0.0;
130 FracPt[2] = 0.0;
131 FracPt[3] = 0.0;
132 FracPt[4] = 0.0;
[1380]133 Tau[0] = 0.0;
134 Tau[1] = 0.0;
135 Tau[2] = 0.0;
136 Tau[3] = 0.0;
137 Tau[4] = 0.0;
[685]138}
139
140//------------------------------------------------------------------------------
141
[687]142void Candidate::AddCandidate(Candidate *object)
[680]143{
144 if(!fArray) fArray = fFactory->NewArray();
145 fArray->Add(object);
146}
[685]147
148//------------------------------------------------------------------------------
149
[887]150TObjArray *Candidate::GetCandidates()
151{
152 if(!fArray) fArray = fFactory->NewArray();
153 return fArray;
154}
155
156//------------------------------------------------------------------------------
157
158Bool_t Candidate::Overlaps(const Candidate *object) const
159{
160 const Candidate *candidate;
161
[919]162 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
[891]163
[887]164 if(fArray)
165 {
166 TIter it(fArray);
167 while((candidate = static_cast<Candidate *>(it.Next())))
168 {
169 if(candidate->Overlaps(object)) return kTRUE;
170 }
171 }
172
173 if(object->fArray)
174 {
175 TIter it(object->fArray);
176 while((candidate = static_cast<Candidate *>(it.Next())))
177 {
178 if(candidate->Overlaps(this)) return kTRUE;
179 }
180 }
181
182 return kFALSE;
183}
184
185
186//------------------------------------------------------------------------------
187
[687]188TObject *Candidate::Clone(const char *newname) const
[685]189{
[687]190 Candidate *object = fFactory->NewCandidate();
[685]191 Copy(*object);
192 return object;
193}
194
195//------------------------------------------------------------------------------
196
[687]197void Candidate::Copy(TObject &obj) const
[685]198{
[687]199 Candidate &object = static_cast<Candidate &>(obj);
[891]200 Candidate *candidate;
[686]201
[685]202 object.PID = PID;
[845]203 object.Status = Status;
204 object.M1 = M1;
205 object.M2 = M2;
206 object.D1 = D1;
207 object.D2 = D2;
[685]208 object.Charge = Charge;
209 object.Mass = Mass;
[1014]210 object.IsPU = IsPU;
[1077]211 object.IsConstituent = IsConstituent;
[845]212 object.BTag = BTag;
[926]213 object.TauTag = TauTag;
[845]214 object.Eem = Eem;
215 object.Ehad = Ehad;
[898]216 object.Edges[0] = Edges[0];
217 object.Edges[1] = Edges[1];
218 object.Edges[2] = Edges[2];
219 object.Edges[3] = Edges[3];
[900]220 object.DeltaEta = DeltaEta;
221 object.DeltaPhi = DeltaPhi;
[685]222 object.Momentum = Momentum;
223 object.Position = Position;
[1384]224 object.Area = Area;
[1367]225 object.Dxy = Dxy;
226 object.SDxy = SDxy;
227 object.Xd = Xd;
228 object.Yd = Yd;
229 object.Zd = Zd;
[685]230
[1348]231 object.NCharged = NCharged;
232 object.NNeutrals = NNeutrals;
233 object.Beta = Beta;
234 object.BetaStar = BetaStar;
235 object.MeanSqDeltaR = MeanSqDeltaR;
236 object.PTD = PTD;
237 object.FracPt[0] = FracPt[0];
238 object.FracPt[1] = FracPt[1];
239 object.FracPt[2] = FracPt[2];
240 object.FracPt[3] = FracPt[3];
241 object.FracPt[4] = FracPt[4];
[1380]242 object.Tau[0] = Tau[0];
243 object.Tau[1] = Tau[1];
244 object.Tau[2] = Tau[2];
245 object.Tau[3] = Tau[3];
246 object.Tau[4] = Tau[4];
[1372]247
[685]248 object.fFactory = fFactory;
249 object.fArray = 0;
250
251 if(fArray && fArray->GetEntriesFast() > 0)
252 {
253 TIter itArray(fArray);
[891]254 TObjArray *array = object.GetCandidates();
255 while((candidate = static_cast<Candidate *>(itArray.Next())))
[685]256 {
[891]257 array->Add(candidate);
[685]258 }
259 }
260}
261
262//------------------------------------------------------------------------------
263
[687]264void Candidate::Clear(Option_t* option)
[685]265{
266 SetUniqueID(0);
[919]267 ResetBit(kIsReferenced);
[685]268 PID = 0;
[845]269 Status = 0;
[1014]270 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
[685]271 Charge = 0;
[1014]272 Mass = 0.0;
273 IsPU = 0;
[1074]274 IsConstituent = 0;
[845]275 BTag = 0;
[926]276 TauTag = 0;
[845]277 Eem = 0.0;
278 Ehad = 0.0;
[898]279 Edges[0] = 0.0;
280 Edges[1] = 0.0;
281 Edges[2] = 0.0;
282 Edges[3] = 0.0;
[900]283 DeltaEta = 0.0;
284 DeltaPhi = 0.0;
[685]285 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
286 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
[1088]287 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[1367]288 Dxy = 0.0;
289 SDxy = 0.0;
290 Xd = 0.0;
291 Yd = 0.0;
292 Zd = 0.0;
[1348]293 NCharged = 0;
294 NNeutrals = 0;
295 Beta = 0.0;
296 BetaStar = 0.0;
297 MeanSqDeltaR = 0.0;
298 PTD = 0.0;
299 FracPt[0] = 0.0;
300 FracPt[1] = 0.0;
301 FracPt[2] = 0.0;
302 FracPt[3] = 0.0;
303 FracPt[4] = 0.0;
[1380]304 Tau[0] = 0.0;
305 Tau[1] = 0.0;
306 Tau[2] = 0.0;
307 Tau[3] = 0.0;
308 Tau[4] = 0.0;
[1372]309
[685]310 fArray = 0;
311}
Note: See TracBrowser for help on using the repository browser.