checkmate is hosted by Hepforge, IPPP Durham
DelphesClasses.cc
Go to the documentation of this file.
1 
16 #include "classes/DelphesClasses.h"
17 
18 #include "classes/DelphesFactory.h"
19 #include "classes/SortableObject.h"
20 
21 CompBase *GenParticle::fgCompare = 0;
22 CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
23 CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
24 CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
25 CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
26 CompBase *Track::fgCompare = CompPT<Track>::Instance();
27 CompBase *Tower::fgCompare = CompE<Tower>::Instance();
28 CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
29 
30 //------------------------------------------------------------------------------
31 
32 TLorentzVector GenParticle::P4()
33 {
34  TLorentzVector vec;
35  vec.SetPxPyPzE(Px, Py, Pz, E);
36  return vec;
37 }
38 
39 //------------------------------------------------------------------------------
40 
41 TLorentzVector Photon::P4()
42 {
43  TLorentzVector vec;
44  vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
45  return vec;
46 }
47 
48 //------------------------------------------------------------------------------
49 
50 TLorentzVector Electron::P4()
51 {
52  TLorentzVector vec;
53  vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
54  return vec;
55 }
56 
57 //------------------------------------------------------------------------------
58 
59 TLorentzVector Muon::P4()
60 {
61  TLorentzVector vec;
62  vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
63  return vec;
64 }
65 
66 //------------------------------------------------------------------------------
67 
68 TLorentzVector Jet::P4()
69 {
70  TLorentzVector vec;
71  vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
72  return vec;
73 }
74 
75 //------------------------------------------------------------------------------
76 
77 TLorentzVector Track::P4()
78 {
79  TLorentzVector vec;
80  vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
81  return vec;
82 }
83 
84 //------------------------------------------------------------------------------
85 
86 TLorentzVector Tower::P4()
87 {
88  TLorentzVector vec;
89  vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
90  return vec;
91 }
92 
93 //------------------------------------------------------------------------------
94 
95 Candidate::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  EfficiencyFlags(0), IsolationFlags(0), MiscellaneousFlags(0), BFlags(0), BFlagProb(0), TauFlags(0), TauFlagProb(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 
115 void Candidate::AddCandidate(Candidate *object)
116 {
117  if(!fArray) fArray = fFactory->NewArray();
118  fArray->Add(object);
119 }
120 
121 //------------------------------------------------------------------------------
122 
123 TObjArray *Candidate::GetCandidates()
124 {
125  if(!fArray) fArray = fFactory->NewArray();
126  return fArray;
127 }
128 
129 //------------------------------------------------------------------------------
130 
131 Bool_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 
161 TObject *Candidate::Clone(const char *newname) const
162 {
163  Candidate *object = fFactory->NewCandidate();
164  Copy(*object);
165  return object;
166 }
167 
168 //------------------------------------------------------------------------------
169 
170 void 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.EfficiencyFlags = EfficiencyFlags;
186  object.IsolationFlags = IsolationFlags;
187  object.MiscellaneousFlags = MiscellaneousFlags;
188  object.BFlags = BFlags;
189  object.BFlagProb = BFlagProb;
190  object.TauFlags = TauFlags;
191  object.TauFlagProb = TauFlagProb;
192  object.Eem = Eem;
193  object.Ehad = Ehad;
194  object.Edges[0] = Edges[0];
195  object.Edges[1] = Edges[1];
196  object.Edges[2] = Edges[2];
197  object.Edges[3] = Edges[3];
198  object.DeltaEta = DeltaEta;
199  object.DeltaPhi = DeltaPhi;
200  object.Momentum = Momentum;
201  object.Position = Position;
202  object.Area = Area;
203 
204  object.fFactory = fFactory;
205  object.fArray = 0;
206 
207  if(fArray && fArray->GetEntriesFast() > 0)
208  {
209  TIter itArray(fArray);
210  TObjArray *array = object.GetCandidates();
211  while((candidate = static_cast<Candidate *>(itArray.Next())))
212  {
213  array->Add(candidate);
214  }
215  }
216 }
217 
218 //------------------------------------------------------------------------------
219 
220 void Candidate::Clear(Option_t* option)
221 {
222  SetUniqueID(0);
223  ResetBit(kIsReferenced);
224  PID = 0;
225  Status = 0;
226  M1 = -1; M2 = -1; D1 = -1; D2 = -1;
227  Charge = 0;
228  Mass = 0.0;
229  IsPU = 0;
230  IsConstituent = 0;
231  EfficiencyFlags = 0;
232  IsolationFlags = 0;
233  MiscellaneousFlags = 0;
234  BFlags = 0;
235  BFlagProb = 0;
236  TauFlags = 0;
237  TauFlagProb = 0;
238  Eem = 0.0;
239  Ehad = 0.0;
240  Edges[0] = 0.0;
241  Edges[1] = 0.0;
242  Edges[2] = 0.0;
243  Edges[3] = 0.0;
244  DeltaEta = 0.0;
245  DeltaPhi = 0.0;
246  Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
247  Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
248  Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
249  fArray = 0;
250 }
TLorentzVector P4()
TLorentzVector P4()
TLorentzVector P4()
Float_t Eta
Float_t Eta
Float_t Eta
Float_t PT
Float_t ET
Float_t PT
static CompBase * fgCompare
Float_t Phi
Float_t PT
static CompBase * fgCompare
Float_t Mass
Float_t PT
Float_t Phi
Float_t Eta
TLorentzVector P4()
Float_t Phi
TLorentzVector P4()
static CompBase * fgCompare
TLorentzVector P4()
static CompBase * fgCompare
Float_t Phi
Float_t Eta
static CompBase * fgCompare
static CompBase * fgCompare
Float_t Phi
Float_t Eta
Float_t Phi
Float_t PT
static CompBase * fgCompare
TLorentzVector P4()
Float_t Edges[4]