Fork me on GitHub

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

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

add HectorHit class and corresponding ROOT tree branch

File size: 6.4 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),
[1348]114 NCharged(0),
115 NNeutrals(0),
116 Beta(0),
117 BetaStar(0),
118 MeanSqDeltaR(0),
[1354]119 PTD(0),
120 fFactory(0),
121 fArray(0)
[685]122{
[898]123 Edges[0] = 0.0;
124 Edges[1] = 0.0;
125 Edges[2] = 0.0;
126 Edges[3] = 0.0;
[1348]127 FracPt[0] = 0.0;
128 FracPt[1] = 0.0;
129 FracPt[2] = 0.0;
130 FracPt[3] = 0.0;
131 FracPt[4] = 0.0;
[685]132}
133
134//------------------------------------------------------------------------------
135
[687]136void Candidate::AddCandidate(Candidate *object)
[680]137{
138 if(!fArray) fArray = fFactory->NewArray();
139 fArray->Add(object);
140}
[685]141
142//------------------------------------------------------------------------------
143
[887]144TObjArray *Candidate::GetCandidates()
145{
146 if(!fArray) fArray = fFactory->NewArray();
147 return fArray;
148}
149
150//------------------------------------------------------------------------------
151
152Bool_t Candidate::Overlaps(const Candidate *object) const
153{
154 const Candidate *candidate;
155
[919]156 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
[891]157
[887]158 if(fArray)
159 {
160 TIter it(fArray);
161 while((candidate = static_cast<Candidate *>(it.Next())))
162 {
163 if(candidate->Overlaps(object)) return kTRUE;
164 }
165 }
166
167 if(object->fArray)
168 {
169 TIter it(object->fArray);
170 while((candidate = static_cast<Candidate *>(it.Next())))
171 {
172 if(candidate->Overlaps(this)) return kTRUE;
173 }
174 }
175
176 return kFALSE;
177}
178
179
180//------------------------------------------------------------------------------
181
[687]182TObject *Candidate::Clone(const char *newname) const
[685]183{
[687]184 Candidate *object = fFactory->NewCandidate();
[685]185 Copy(*object);
186 return object;
187}
188
189//------------------------------------------------------------------------------
190
[687]191void Candidate::Copy(TObject &obj) const
[685]192{
[687]193 Candidate &object = static_cast<Candidate &>(obj);
[891]194 Candidate *candidate;
[686]195
[685]196 object.PID = PID;
[845]197 object.Status = Status;
198 object.M1 = M1;
199 object.M2 = M2;
200 object.D1 = D1;
201 object.D2 = D2;
[685]202 object.Charge = Charge;
203 object.Mass = Mass;
[1014]204 object.IsPU = IsPU;
[1077]205 object.IsConstituent = IsConstituent;
[845]206 object.BTag = BTag;
[926]207 object.TauTag = TauTag;
[845]208 object.Eem = Eem;
209 object.Ehad = Ehad;
[898]210 object.Edges[0] = Edges[0];
211 object.Edges[1] = Edges[1];
212 object.Edges[2] = Edges[2];
213 object.Edges[3] = Edges[3];
[900]214 object.DeltaEta = DeltaEta;
215 object.DeltaPhi = DeltaPhi;
[685]216 object.Momentum = Momentum;
217 object.Position = Position;
[1088]218 object.Area = Area;
[685]219
[1348]220 object.NCharged = NCharged;
221 object.NNeutrals = NNeutrals;
222 object.Beta = Beta;
223 object.BetaStar = BetaStar;
224 object.MeanSqDeltaR = MeanSqDeltaR;
225 object.PTD = PTD;
226 object.FracPt[0] = FracPt[0];
227 object.FracPt[1] = FracPt[1];
228 object.FracPt[2] = FracPt[2];
229 object.FracPt[3] = FracPt[3];
230 object.FracPt[4] = FracPt[4];
231
[685]232 object.fFactory = fFactory;
233 object.fArray = 0;
234
235 if(fArray && fArray->GetEntriesFast() > 0)
236 {
237 TIter itArray(fArray);
[891]238 TObjArray *array = object.GetCandidates();
239 while((candidate = static_cast<Candidate *>(itArray.Next())))
[685]240 {
[891]241 array->Add(candidate);
[685]242 }
243 }
244}
245
246//------------------------------------------------------------------------------
247
[687]248void Candidate::Clear(Option_t* option)
[685]249{
250 SetUniqueID(0);
[919]251 ResetBit(kIsReferenced);
[685]252 PID = 0;
[845]253 Status = 0;
[1014]254 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
[685]255 Charge = 0;
[1014]256 Mass = 0.0;
257 IsPU = 0;
[1074]258 IsConstituent = 0;
[845]259 BTag = 0;
[926]260 TauTag = 0;
[845]261 Eem = 0.0;
262 Ehad = 0.0;
[898]263 Edges[0] = 0.0;
264 Edges[1] = 0.0;
265 Edges[2] = 0.0;
266 Edges[3] = 0.0;
[900]267 DeltaEta = 0.0;
268 DeltaPhi = 0.0;
[685]269 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
270 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
[1088]271 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
[1348]272
273 NCharged = 0;
274 NNeutrals = 0;
275 Beta = 0.0;
276 BetaStar = 0.0;
277 MeanSqDeltaR = 0.0;
278 PTD = 0.0;
279 FracPt[0] = 0.0;
280 FracPt[1] = 0.0;
281 FracPt[2] = 0.0;
282 FracPt[3] = 0.0;
283 FracPt[4] = 0.0;
284
[685]285 fArray = 0;
286}
Note: See TracBrowser for help on using the repository browser.