[b443089] | 1 | /*
|
---|
| 2 | * Delphes: a framework for fast simulation of a generic collider experiment
|
---|
| 3 | * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium
|
---|
[1fa50c2] | 4 | *
|
---|
[b443089] | 5 | * This program is free software: you can redistribute it and/or modify
|
---|
| 6 | * it under the terms of the GNU General Public License as published by
|
---|
| 7 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 8 | * (at your option) any later version.
|
---|
[1fa50c2] | 9 | *
|
---|
[b443089] | 10 | * This program is distributed in the hope that it will be useful,
|
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | * GNU General Public License for more details.
|
---|
[1fa50c2] | 14 | *
|
---|
[b443089] | 15 | * You should have received a copy of the GNU General Public License
|
---|
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 17 | */
|
---|
| 18 |
|
---|
[d7d2da3] | 19 |
|
---|
| 20 | /**
|
---|
| 21 | *
|
---|
| 22 | * Definition of classes to be stored in the root tree.
|
---|
| 23 | * Function CompareXYZ sorts objects by the variable XYZ that MUST be
|
---|
| 24 | * present in the data members of the root tree class of the branch.
|
---|
| 25 | *
|
---|
| 26 | * \author P. Demin - UCL, Louvain-la-Neuve
|
---|
| 27 | *
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | #include "classes/DelphesClasses.h"
|
---|
| 31 |
|
---|
| 32 | #include "classes/DelphesFactory.h"
|
---|
| 33 | #include "classes/SortableObject.h"
|
---|
| 34 |
|
---|
| 35 | CompBase *GenParticle::fgCompare = 0;
|
---|
| 36 | CompBase *Photon::fgCompare = CompPT<Photon>::Instance();
|
---|
| 37 | CompBase *Electron::fgCompare = CompPT<Electron>::Instance();
|
---|
| 38 | CompBase *Muon::fgCompare = CompPT<Muon>::Instance();
|
---|
| 39 | CompBase *Jet::fgCompare = CompPT<Jet>::Instance();
|
---|
| 40 | CompBase *Track::fgCompare = CompPT<Track>::Instance();
|
---|
| 41 | CompBase *Tower::fgCompare = CompE<Tower>::Instance();
|
---|
[8f7db23] | 42 | CompBase *HectorHit::fgCompare = CompE<HectorHit>::Instance();
|
---|
[d7d2da3] | 43 | CompBase *Candidate::fgCompare = CompMomentumPt<Candidate>::Instance();
|
---|
| 44 |
|
---|
| 45 | //------------------------------------------------------------------------------
|
---|
| 46 |
|
---|
[2b3ef28] | 47 | TLorentzVector GenParticle::P4() const
|
---|
[d7d2da3] | 48 | {
|
---|
| 49 | TLorentzVector vec;
|
---|
| 50 | vec.SetPxPyPzE(Px, Py, Pz, E);
|
---|
| 51 | return vec;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 | //------------------------------------------------------------------------------
|
---|
| 55 |
|
---|
[2b3ef28] | 56 | TLorentzVector MissingET::P4() const
|
---|
[4ad7b96] | 57 | {
|
---|
| 58 | TLorentzVector vec;
|
---|
| 59 | vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0);
|
---|
| 60 | return vec;
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | //------------------------------------------------------------------------------
|
---|
| 64 |
|
---|
[2b3ef28] | 65 | TLorentzVector Photon::P4() const
|
---|
[d7d2da3] | 66 | {
|
---|
| 67 | TLorentzVector vec;
|
---|
| 68 | vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
|
---|
| 69 | return vec;
|
---|
| 70 | }
|
---|
| 71 |
|
---|
| 72 | //------------------------------------------------------------------------------
|
---|
| 73 |
|
---|
[2b3ef28] | 74 | TLorentzVector Electron::P4() const
|
---|
[d7d2da3] | 75 | {
|
---|
| 76 | TLorentzVector vec;
|
---|
| 77 | vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
|
---|
| 78 | return vec;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | //------------------------------------------------------------------------------
|
---|
| 82 |
|
---|
[2b3ef28] | 83 | TLorentzVector Muon::P4() const
|
---|
[d7d2da3] | 84 | {
|
---|
| 85 | TLorentzVector vec;
|
---|
| 86 | vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
|
---|
| 87 | return vec;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | //------------------------------------------------------------------------------
|
---|
| 91 |
|
---|
[2b3ef28] | 92 | TLorentzVector Jet::P4() const
|
---|
[d7d2da3] | 93 | {
|
---|
| 94 | TLorentzVector vec;
|
---|
| 95 | vec.SetPtEtaPhiM(PT, Eta, Phi, Mass);
|
---|
| 96 | return vec;
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | //------------------------------------------------------------------------------
|
---|
| 100 |
|
---|
[2b3ef28] | 101 | TLorentzVector Track::P4() const
|
---|
[d7d2da3] | 102 | {
|
---|
| 103 | TLorentzVector vec;
|
---|
| 104 | vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0);
|
---|
| 105 | return vec;
|
---|
| 106 | }
|
---|
| 107 |
|
---|
| 108 | //------------------------------------------------------------------------------
|
---|
| 109 |
|
---|
[2b3ef28] | 110 | TLorentzVector Tower::P4() const
|
---|
[d7d2da3] | 111 | {
|
---|
| 112 | TLorentzVector vec;
|
---|
| 113 | vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0);
|
---|
| 114 | return vec;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | //------------------------------------------------------------------------------
|
---|
| 118 |
|
---|
| 119 | Candidate::Candidate() :
|
---|
| 120 | PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1),
|
---|
| 121 | Charge(0), Mass(0.0),
|
---|
[5d2481f] | 122 | IsPU(0), IsRecoPU(0), IsConstituent(0), IsFromConversion(0),
|
---|
[fe0273c] | 123 | Flavor(0), FlavorAlgo(0), FlavorPhys(0),
|
---|
| 124 | BTag(0), BTagAlgo(0), BTagPhys(0),
|
---|
[edf10ba] | 125 | TauTag(0), Eem(0.0), Ehad(0.0),
|
---|
[d7d2da3] | 126 | DeltaEta(0.0), DeltaPhi(0.0),
|
---|
| 127 | Momentum(0.0, 0.0, 0.0, 0.0),
|
---|
| 128 | Position(0.0, 0.0, 0.0, 0.0),
|
---|
| 129 | Area(0.0, 0.0, 0.0, 0.0),
|
---|
[43c646a] | 130 | Dxy(0), SDxy(0), Xd(0), Yd(0), Zd(0),
|
---|
[a98c7ef] | 131 | TrackResolution(0),
|
---|
[24d005f] | 132 | NCharged(0),
|
---|
| 133 | NNeutrals(0),
|
---|
| 134 | Beta(0),
|
---|
| 135 | BetaStar(0),
|
---|
| 136 | MeanSqDeltaR(0),
|
---|
[da00c35] | 137 | PTD(0),
|
---|
[839deb7] | 138 | NTimeHits(-1),
|
---|
[b62c2da] | 139 | IsolationVar(-999),
|
---|
| 140 | IsolationVarRhoCorr(-999),
|
---|
| 141 | SumPtCharged(-999),
|
---|
| 142 | SumPtNeutral(-999),
|
---|
| 143 | SumPtChargedPU(-999),
|
---|
| 144 | SumPt(-999),
|
---|
[839deb7] | 145 | NSubJetsTrimmed(0),
|
---|
| 146 | NSubJetsPruned(0),
|
---|
| 147 | NSubJetsSoftDropped(0),
|
---|
[da00c35] | 148 | fFactory(0),
|
---|
| 149 | fArray(0)
|
---|
[d7d2da3] | 150 | {
|
---|
[8d200a6] | 151 | int i;
|
---|
[d7d2da3] | 152 | Edges[0] = 0.0;
|
---|
| 153 | Edges[1] = 0.0;
|
---|
| 154 | Edges[2] = 0.0;
|
---|
| 155 | Edges[3] = 0.0;
|
---|
[24d005f] | 156 | FracPt[0] = 0.0;
|
---|
| 157 | FracPt[1] = 0.0;
|
---|
| 158 | FracPt[2] = 0.0;
|
---|
| 159 | FracPt[3] = 0.0;
|
---|
| 160 | FracPt[4] = 0.0;
|
---|
[63178fb] | 161 | Tau[0] = 0.0;
|
---|
| 162 | Tau[1] = 0.0;
|
---|
| 163 | Tau[2] = 0.0;
|
---|
| 164 | Tau[3] = 0.0;
|
---|
| 165 | Tau[4] = 0.0;
|
---|
[8d200a6] | 166 | for(i = 0; i < 5; ++i)
|
---|
| 167 | {
|
---|
| 168 | TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
| 169 | PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
| 170 | SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
| 171 | }
|
---|
[d7d2da3] | 172 | }
|
---|
| 173 |
|
---|
| 174 | //------------------------------------------------------------------------------
|
---|
| 175 |
|
---|
| 176 | void Candidate::AddCandidate(Candidate *object)
|
---|
| 177 | {
|
---|
| 178 | if(!fArray) fArray = fFactory->NewArray();
|
---|
| 179 | fArray->Add(object);
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | //------------------------------------------------------------------------------
|
---|
| 183 |
|
---|
| 184 | TObjArray *Candidate::GetCandidates()
|
---|
| 185 | {
|
---|
| 186 | if(!fArray) fArray = fFactory->NewArray();
|
---|
| 187 | return fArray;
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | //------------------------------------------------------------------------------
|
---|
| 191 |
|
---|
| 192 | Bool_t Candidate::Overlaps(const Candidate *object) const
|
---|
| 193 | {
|
---|
| 194 | const Candidate *candidate;
|
---|
| 195 |
|
---|
| 196 | if(object->GetUniqueID() == GetUniqueID()) return kTRUE;
|
---|
| 197 |
|
---|
| 198 | if(fArray)
|
---|
| 199 | {
|
---|
| 200 | TIter it(fArray);
|
---|
| 201 | while((candidate = static_cast<Candidate *>(it.Next())))
|
---|
| 202 | {
|
---|
| 203 | if(candidate->Overlaps(object)) return kTRUE;
|
---|
| 204 | }
|
---|
| 205 | }
|
---|
| 206 |
|
---|
| 207 | if(object->fArray)
|
---|
| 208 | {
|
---|
| 209 | TIter it(object->fArray);
|
---|
| 210 | while((candidate = static_cast<Candidate *>(it.Next())))
|
---|
| 211 | {
|
---|
| 212 | if(candidate->Overlaps(this)) return kTRUE;
|
---|
| 213 | }
|
---|
| 214 | }
|
---|
| 215 |
|
---|
| 216 | return kFALSE;
|
---|
| 217 | }
|
---|
| 218 |
|
---|
| 219 |
|
---|
| 220 | //------------------------------------------------------------------------------
|
---|
| 221 |
|
---|
| 222 | TObject *Candidate::Clone(const char *newname) const
|
---|
| 223 | {
|
---|
| 224 | Candidate *object = fFactory->NewCandidate();
|
---|
| 225 | Copy(*object);
|
---|
| 226 | return object;
|
---|
| 227 | }
|
---|
| 228 |
|
---|
| 229 | //------------------------------------------------------------------------------
|
---|
| 230 |
|
---|
| 231 | void Candidate::Copy(TObject &obj) const
|
---|
| 232 | {
|
---|
| 233 | Candidate &object = static_cast<Candidate &>(obj);
|
---|
| 234 | Candidate *candidate;
|
---|
| 235 |
|
---|
| 236 | object.PID = PID;
|
---|
| 237 | object.Status = Status;
|
---|
| 238 | object.M1 = M1;
|
---|
| 239 | object.M2 = M2;
|
---|
| 240 | object.D1 = D1;
|
---|
| 241 | object.D2 = D2;
|
---|
| 242 | object.Charge = Charge;
|
---|
| 243 | object.Mass = Mass;
|
---|
| 244 | object.IsPU = IsPU;
|
---|
| 245 | object.IsConstituent = IsConstituent;
|
---|
[5d2481f] | 246 | object.IsFromConversion = IsFromConversion;
|
---|
[fe0273c] | 247 | object.Flavor = Flavor;
|
---|
| 248 | object.FlavorAlgo = FlavorAlgo;
|
---|
| 249 | object.FlavorPhys = FlavorPhys;
|
---|
[d7d2da3] | 250 | object.BTag = BTag;
|
---|
[edf10ba] | 251 | object.BTagAlgo = BTagAlgo;
|
---|
[fe0273c] | 252 | object.BTagPhys = BTagPhys;
|
---|
[d7d2da3] | 253 | object.TauTag = TauTag;
|
---|
| 254 | object.Eem = Eem;
|
---|
| 255 | object.Ehad = Ehad;
|
---|
| 256 | object.Edges[0] = Edges[0];
|
---|
| 257 | object.Edges[1] = Edges[1];
|
---|
| 258 | object.Edges[2] = Edges[2];
|
---|
| 259 | object.Edges[3] = Edges[3];
|
---|
| 260 | object.DeltaEta = DeltaEta;
|
---|
| 261 | object.DeltaPhi = DeltaPhi;
|
---|
| 262 | object.Momentum = Momentum;
|
---|
| 263 | object.Position = Position;
|
---|
[43c646a] | 264 | object.Area = Area;
|
---|
[a0431dc] | 265 | object.Dxy = Dxy;
|
---|
| 266 | object.SDxy = SDxy;
|
---|
| 267 | object.Xd = Xd;
|
---|
| 268 | object.Yd = Yd;
|
---|
| 269 | object.Zd = Zd;
|
---|
[a98c7ef] | 270 | object.TrackResolution = TrackResolution;
|
---|
[24d005f] | 271 | object.NCharged = NCharged;
|
---|
| 272 | object.NNeutrals = NNeutrals;
|
---|
| 273 | object.Beta = Beta;
|
---|
| 274 | object.BetaStar = BetaStar;
|
---|
| 275 | object.MeanSqDeltaR = MeanSqDeltaR;
|
---|
| 276 | object.PTD = PTD;
|
---|
[839deb7] | 277 | object.NTimeHits = NTimeHits;
|
---|
[b62c2da] | 278 | object.IsolationVar = IsolationVar;
|
---|
| 279 | object.IsolationVarRhoCorr = IsolationVarRhoCorr;
|
---|
| 280 | object.SumPtCharged = SumPtCharged;
|
---|
| 281 | object.SumPtNeutral = SumPtNeutral;
|
---|
| 282 | object.SumPtChargedPU = SumPtChargedPU;
|
---|
| 283 | object.SumPt = SumPt;
|
---|
| 284 |
|
---|
[24d005f] | 285 | object.FracPt[0] = FracPt[0];
|
---|
| 286 | object.FracPt[1] = FracPt[1];
|
---|
| 287 | object.FracPt[2] = FracPt[2];
|
---|
| 288 | object.FracPt[3] = FracPt[3];
|
---|
| 289 | object.FracPt[4] = FracPt[4];
|
---|
[63178fb] | 290 | object.Tau[0] = Tau[0];
|
---|
| 291 | object.Tau[1] = Tau[1];
|
---|
| 292 | object.Tau[2] = Tau[2];
|
---|
| 293 | object.Tau[3] = Tau[3];
|
---|
| 294 | object.Tau[4] = Tau[4];
|
---|
[839deb7] | 295 |
|
---|
[de6d698] | 296 | object.TrimmedP4[0] = TrimmedP4[0];
|
---|
| 297 | object.TrimmedP4[1] = TrimmedP4[1];
|
---|
| 298 | object.TrimmedP4[2] = TrimmedP4[2];
|
---|
| 299 | object.TrimmedP4[3] = TrimmedP4[3];
|
---|
| 300 | object.TrimmedP4[4] = TrimmedP4[4];
|
---|
| 301 | object.PrunedP4[0] = PrunedP4[0];
|
---|
| 302 | object.PrunedP4[1] = PrunedP4[1];
|
---|
| 303 | object.PrunedP4[2] = PrunedP4[2];
|
---|
| 304 | object.PrunedP4[3] = PrunedP4[3];
|
---|
| 305 | object.PrunedP4[4] = PrunedP4[4];
|
---|
| 306 | object.SoftDroppedP4[0] = SoftDroppedP4[0];
|
---|
| 307 | object.SoftDroppedP4[1] = SoftDroppedP4[1];
|
---|
| 308 | object.SoftDroppedP4[2] = SoftDroppedP4[2];
|
---|
| 309 | object.SoftDroppedP4[3] = SoftDroppedP4[3];
|
---|
| 310 | object.SoftDroppedP4[4] = SoftDroppedP4[4];
|
---|
| 311 |
|
---|
[edf10ba] | 312 | object.NSubJetsTrimmed = NSubJetsTrimmed;
|
---|
| 313 | object.NSubJetsPruned = NSubJetsPruned;
|
---|
[de6d698] | 314 | object.NSubJetsSoftDropped = NSubJetsSoftDropped;
|
---|
[e4c3fef] | 315 |
|
---|
[d7d2da3] | 316 | object.fFactory = fFactory;
|
---|
| 317 | object.fArray = 0;
|
---|
| 318 |
|
---|
[839deb7] | 319 | // copy cluster timing info
|
---|
| 320 | copy(ECalEnergyTimePairs.begin(), ECalEnergyTimePairs.end(), back_inserter(object.ECalEnergyTimePairs));
|
---|
[3db5282] | 321 |
|
---|
[d7d2da3] | 322 | if(fArray && fArray->GetEntriesFast() > 0)
|
---|
| 323 | {
|
---|
| 324 | TIter itArray(fArray);
|
---|
| 325 | TObjArray *array = object.GetCandidates();
|
---|
| 326 | while((candidate = static_cast<Candidate *>(itArray.Next())))
|
---|
| 327 | {
|
---|
| 328 | array->Add(candidate);
|
---|
| 329 | }
|
---|
| 330 | }
|
---|
| 331 | }
|
---|
| 332 |
|
---|
| 333 | //------------------------------------------------------------------------------
|
---|
| 334 |
|
---|
| 335 | void Candidate::Clear(Option_t* option)
|
---|
| 336 | {
|
---|
[8d200a6] | 337 | int i;
|
---|
[d7d2da3] | 338 | SetUniqueID(0);
|
---|
| 339 | ResetBit(kIsReferenced);
|
---|
| 340 | PID = 0;
|
---|
| 341 | Status = 0;
|
---|
| 342 | M1 = -1; M2 = -1; D1 = -1; D2 = -1;
|
---|
| 343 | Charge = 0;
|
---|
| 344 | Mass = 0.0;
|
---|
| 345 | IsPU = 0;
|
---|
| 346 | IsConstituent = 0;
|
---|
[5d2481f] | 347 | IsFromConversion = 0;
|
---|
[fe0273c] | 348 | Flavor = 0;
|
---|
| 349 | FlavorAlgo = 0;
|
---|
| 350 | FlavorPhys = 0;
|
---|
[d7d2da3] | 351 | BTag = 0;
|
---|
[edf10ba] | 352 | BTagAlgo = 0;
|
---|
[fe0273c] | 353 | BTagPhys = 0;
|
---|
[d7d2da3] | 354 | TauTag = 0;
|
---|
| 355 | Eem = 0.0;
|
---|
| 356 | Ehad = 0.0;
|
---|
| 357 | Edges[0] = 0.0;
|
---|
| 358 | Edges[1] = 0.0;
|
---|
| 359 | Edges[2] = 0.0;
|
---|
| 360 | Edges[3] = 0.0;
|
---|
| 361 | DeltaEta = 0.0;
|
---|
| 362 | DeltaPhi = 0.0;
|
---|
| 363 | Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
| 364 | Position.SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
| 365 | Area.SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
[a0431dc] | 366 | Dxy = 0.0;
|
---|
| 367 | SDxy = 0.0;
|
---|
| 368 | Xd = 0.0;
|
---|
| 369 | Yd = 0.0;
|
---|
| 370 | Zd = 0.0;
|
---|
[a98c7ef] | 371 | TrackResolution = 0.0;
|
---|
[24d005f] | 372 | NCharged = 0;
|
---|
| 373 | NNeutrals = 0;
|
---|
| 374 | Beta = 0.0;
|
---|
| 375 | BetaStar = 0.0;
|
---|
| 376 | MeanSqDeltaR = 0.0;
|
---|
| 377 | PTD = 0.0;
|
---|
[839deb7] | 378 |
|
---|
| 379 | NTimeHits = 0;
|
---|
| 380 | ECalEnergyTimePairs.clear();
|
---|
| 381 |
|
---|
[b62c2da] | 382 | IsolationVar = -999;
|
---|
| 383 | IsolationVarRhoCorr = -999;
|
---|
| 384 | SumPtCharged = -999;
|
---|
| 385 | SumPtNeutral = -999;
|
---|
| 386 | SumPtChargedPU = -999;
|
---|
| 387 | SumPt = -999;
|
---|
[839deb7] | 388 |
|
---|
[24d005f] | 389 | FracPt[0] = 0.0;
|
---|
| 390 | FracPt[1] = 0.0;
|
---|
| 391 | FracPt[2] = 0.0;
|
---|
| 392 | FracPt[3] = 0.0;
|
---|
| 393 | FracPt[4] = 0.0;
|
---|
[63178fb] | 394 | Tau[0] = 0.0;
|
---|
| 395 | Tau[1] = 0.0;
|
---|
| 396 | Tau[2] = 0.0;
|
---|
| 397 | Tau[3] = 0.0;
|
---|
| 398 | Tau[4] = 0.0;
|
---|
[839deb7] | 399 |
|
---|
[8d200a6] | 400 | for(i = 0; i < 5; ++i)
|
---|
| 401 | {
|
---|
| 402 | TrimmedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
[839deb7] | 403 | PrunedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
[8d200a6] | 404 | SoftDroppedP4[i].SetXYZT(0.0, 0.0, 0.0, 0.0);
|
---|
| 405 | }
|
---|
| 406 |
|
---|
[edf10ba] | 407 | NSubJetsTrimmed = 0;
|
---|
| 408 | NSubJetsPruned = 0;
|
---|
[de6d698] | 409 | NSubJetsSoftDropped = 0;
|
---|
[839deb7] | 410 |
|
---|
[d7d2da3] | 411 | fArray = 0;
|
---|
| 412 | }
|
---|