Fork me on GitHub

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

Last change on this file since 1202 was 1088, checked in by Pavel Demin, 12 years ago

use 4-vector area

File size: 5.4 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 Photon::P4()
42{
43 TLorentzVector vec;
44 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
45 return vec;
46}
47
48//------------------------------------------------------------------------------
49
50TLorentzVector Electron::P4()
51{
52 TLorentzVector vec;
53 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
54 return vec;
55}
56
57//------------------------------------------------------------------------------
58
59TLorentzVector Muon::P4()
60{
61 TLorentzVector vec;
62 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
63 return vec;
64}
65
66//------------------------------------------------------------------------------
67
68TLorentzVector Jet::P4()
69{
70 TLorentzVector vec;
71 vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
72 return vec;
73}
74
75//------------------------------------------------------------------------------
76
77TLorentzVector Track::P4()
78{
79 TLorentzVector vec;
80 vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
81 return vec;
82}
83
84//------------------------------------------------------------------------------
85
86TLorentzVector Tower::P4()
87{
88 TLorentzVector vec;
89 vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
90 return vec;
91}
92
93//------------------------------------------------------------------------------
94
95Candidate::Candidate() :
96 PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
97 Charge(0), Mass(0.0),
98 IsPU(0), IsConstituent(0),
99 BTag(0), TauTag(0), Eem(0.0), Ehad(0.0),
100 DeltaEta(0.0), DeltaPhi(0.0),
101 Momentum(0.0, 0.0, 0.0, 0.0),
102 Position(0.0, 0.0, 0.0, 0.0),
103 Area(0.0, 0.0, 0.0, 0.0),
104 fFactory(0),
105 fArray(0)
106{
107 Edges[0] = 0.0;
108 Edges[1] = 0.0;
109 Edges[2] = 0.0;
110 Edges[3] = 0.0;
111}
112
113//------------------------------------------------------------------------------
114
115void Candidate::AddCandidate(Candidate *object)
116{
117 if(!fArray) fArray = fFactory->NewArray();
118 fArray->Add(object);
119}
120
121//------------------------------------------------------------------------------
122
123TObjArray *Candidate::GetCandidates()
124{
125 if(!fArray) fArray = fFactory->NewArray();
126 return fArray;
127}
128
129//------------------------------------------------------------------------------
130
131Bool_t Candidate::Overlaps(const Candidate *object) const
132{
133 const Candidate *candidate;
134
135 if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
136
137 if(fArray)
138 {
139 TIter it(fArray);
140 while((candidate = static_cast<Candidate *>(it.Next())))
141 {
142 if(candidate->Overlaps(object)) return kTRUE;
143 }
144 }
145
146 if(object->fArray)
147 {
148 TIter it(object->fArray);
149 while((candidate = static_cast<Candidate *>(it.Next())))
150 {
151 if(candidate->Overlaps(this)) return kTRUE;
152 }
153 }
154
155 return kFALSE;
156}
157
158
159//------------------------------------------------------------------------------
160
161TObject *Candidate::Clone(const char *newname) const
162{
163 Candidate *object = fFactory->NewCandidate();
164 Copy(*object);
165 return object;
166}
167
168//------------------------------------------------------------------------------
169
170void Candidate::Copy(TObject &obj) const
171{
172 Candidate &object = static_cast<Candidate &>(obj);
173 Candidate *candidate;
174
175 object.PID = PID;
176 object.Status = Status;
177 object.M1 = M1;
178 object.M2 = M2;
179 object.D1 = D1;
180 object.D2 = D2;
181 object.Charge = Charge;
182 object.Mass = Mass;
183 object.IsPU = IsPU;
184 object.IsConstituent = IsConstituent;
185 object.BTag = BTag;
186 object.TauTag = TauTag;
187 object.Eem = Eem;
188 object.Ehad = Ehad;
189 object.Edges[0] = Edges[0];
190 object.Edges[1] = Edges[1];
191 object.Edges[2] = Edges[2];
192 object.Edges[3] = Edges[3];
193 object.DeltaEta = DeltaEta;
194 object.DeltaPhi = DeltaPhi;
195 object.Momentum = Momentum;
196 object.Position = Position;
197 object.Area = Area;
198
199 object.fFactory = fFactory;
200 object.fArray = 0;
201
202 if(fArray && fArray->GetEntriesFast() > 0)
203 {
204 TIter itArray(fArray);
205 TObjArray *array = object.GetCandidates();
206 while((candidate = static_cast<Candidate *>(itArray.Next())))
207 {
208 array->Add(candidate);
209 }
210 }
211}
212
213//------------------------------------------------------------------------------
214
215void Candidate::Clear(Option_t* option)
216{
217 SetUniqueID(0);
218 ResetBit(kIsReferenced);
219 PID = 0;
220 Status = 0;
221 M1 = -1; M2 = -1; D1 = -1; D2 = -1;
222 Charge = 0;
223 Mass = 0.0;
224 IsPU = 0;
225 IsConstituent = 0;
226 BTag = 0;
227 TauTag = 0;
228 Eem = 0.0;
229 Ehad = 0.0;
230 Edges[0] = 0.0;
231 Edges[1] = 0.0;
232 Edges[2] = 0.0;
233 Edges[3] = 0.0;
234 DeltaEta = 0.0;
235 DeltaPhi = 0.0;
236 Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
237 Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
238 Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
239 fArray = 0;
240}
Note: See TracBrowser for help on using the repository browser.