/* * Delphes: a framework for fast simulation of a generic collider experiment * Copyright (C) 2012-2014 Universite catholique de Louvain (UCL), Belgium * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * * Definition of classes to be stored in the root tree. * Function CompareXYZ sorts objects by the variable XYZ that MUST be * present in the data members of the root tree class of the branch. * * \author P. Demin - UCL, Louvain-la-Neuve * */ #include "classes/DelphesClasses.h" #include "classes/DelphesFactory.h" #include "classes/SortableObject.h" CompBase *GenParticle::fgCompare = 0; CompBase *Photon::fgCompare = CompPT::Instance(); CompBase *Electron::fgCompare = CompPT::Instance(); CompBase *Muon::fgCompare = CompPT::Instance(); CompBase *Jet::fgCompare = CompPT::Instance(); CompBase *Track::fgCompare = CompPT::Instance(); CompBase *Tower::fgCompare = CompE::Instance(); CompBase *HectorHit::fgCompare = CompE::Instance(); CompBase *Candidate::fgCompare = CompMomentumPt::Instance(); //------------------------------------------------------------------------------ TLorentzVector GenParticle::P4() { TLorentzVector vec; vec.SetPxPyPzE(Px, Py, Pz, E); return vec; } //------------------------------------------------------------------------------ TLorentzVector MissingET::P4() { TLorentzVector vec; vec.SetPtEtaPhiM(MET, Eta, Phi, 0.0); return vec; } //------------------------------------------------------------------------------ TLorentzVector Photon::P4() { TLorentzVector vec; vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0); return vec; } //------------------------------------------------------------------------------ TLorentzVector Electron::P4() { TLorentzVector vec; vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0); return vec; } //------------------------------------------------------------------------------ TLorentzVector Muon::P4() { TLorentzVector vec; vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0); return vec; } //------------------------------------------------------------------------------ TLorentzVector Jet::P4() { TLorentzVector vec; vec.SetPtEtaPhiM(PT, Eta, Phi, Mass); return vec; } //------------------------------------------------------------------------------ TLorentzVector Track::P4() { TLorentzVector vec; vec.SetPtEtaPhiM(PT, Eta, Phi, 0.0); return vec; } //------------------------------------------------------------------------------ TLorentzVector Tower::P4() { TLorentzVector vec; vec.SetPtEtaPhiM(ET, Eta, Phi, 0.0); return vec; } //------------------------------------------------------------------------------ Candidate::Candidate() : PID(0), Status(0), M1(-1), M2(-1), D1(-1), D2(-1), Charge(0), Mass(0.0), IsPU(0), IsRecoPU(0), IsConstituent(0), BTag(0), TauTag(0), Eem(0.0), Ehad(0.0), DeltaEta(0.0), DeltaPhi(0.0), Momentum(0.0, 0.0, 0.0, 0.0), Position(0.0, 0.0, 0.0, 0.0), Area(0.0, 0.0, 0.0, 0.0), Dxy(0), SDxy(0), Xd(0), Yd(0), Zd(0), NCharged(0), NNeutrals(0), NSubJetsTrimmed(0), NSubJetsPruned(0), NSubJetsSoftDropped(0), Beta(0), BetaStar(0), MeanSqDeltaR(0), PTD(0), Ntimes(-1), IsolationVar(-999), IsolationVarRhoCorr(-999), SumPtCharged(-999), SumPtNeutral(-999), SumPtChargedPU(-999), SumPt(-999), fFactory(0), fArray(0) { Edges[0] = 0.0; Edges[1] = 0.0; Edges[2] = 0.0; Edges[3] = 0.0; FracPt[0] = 0.0; FracPt[1] = 0.0; FracPt[2] = 0.0; FracPt[3] = 0.0; FracPt[4] = 0.0; Tau[0] = 0.0; Tau[1] = 0.0; Tau[2] = 0.0; Tau[3] = 0.0; Tau[4] = 0.0; TrimmedP4[0] = 0.0; TrimmedP4[1] = 0.0; TrimmedP4[2] = 0.0; TrimmedP4[3] = 0.0; TrimmedP4[4] = 0.0; PrunedP4[0] = 0.0; PrunedP4[1] = 0.0; PrunedP4[2] = 0.0; PrunedP4[3] = 0.0; PrunedP4[4] = 0.0; SoftDroppedP4[0] = 0.0; SoftDroppedP4[1] = 0.0; SoftDroppedP4[2] = 0.0; SoftDroppedP4[3] = 0.0; SoftDroppedP4[4] = 0.0; } //------------------------------------------------------------------------------ void Candidate::AddCandidate(Candidate *object) { if(!fArray) fArray = fFactory->NewArray(); fArray->Add(object); } //------------------------------------------------------------------------------ TObjArray *Candidate::GetCandidates() { if(!fArray) fArray = fFactory->NewArray(); return fArray; } //------------------------------------------------------------------------------ Bool_t Candidate::Overlaps(const Candidate *object) const { const Candidate *candidate; if(object->GetUniqueID() == GetUniqueID()) return kTRUE; if(fArray) { TIter it(fArray); while((candidate = static_cast(it.Next()))) { if(candidate->Overlaps(object)) return kTRUE; } } if(object->fArray) { TIter it(object->fArray); while((candidate = static_cast(it.Next()))) { if(candidate->Overlaps(this)) return kTRUE; } } return kFALSE; } //------------------------------------------------------------------------------ TObject *Candidate::Clone(const char *newname) const { Candidate *object = fFactory->NewCandidate(); Copy(*object); return object; } //------------------------------------------------------------------------------ void Candidate::Copy(TObject &obj) const { Candidate &object = static_cast(obj); Candidate *candidate; object.PID = PID; object.Status = Status; object.M1 = M1; object.M2 = M2; object.D1 = D1; object.D2 = D2; object.Charge = Charge; object.Mass = Mass; object.IsPU = IsPU; object.IsConstituent = IsConstituent; object.BTag = BTag; object.TauTag = TauTag; object.Eem = Eem; object.Ehad = Ehad; object.Edges[0] = Edges[0]; object.Edges[1] = Edges[1]; object.Edges[2] = Edges[2]; object.Edges[3] = Edges[3]; object.DeltaEta = DeltaEta; object.DeltaPhi = DeltaPhi; object.Momentum = Momentum; object.Position = Position; object.Area = Area; object.Dxy = Dxy; object.SDxy = SDxy; object.Xd = Xd; object.Yd = Yd; object.Zd = Zd; object.NCharged = NCharged; object.NNeutrals = NNeutrals; object.Beta = Beta; object.BetaStar = BetaStar; object.MeanSqDeltaR = MeanSqDeltaR; object.PTD = PTD; object.Ntimes = Ntimes; object.IsolationVar = IsolationVar; object.IsolationVarRhoCorr = IsolationVarRhoCorr; object.SumPtCharged = SumPtCharged; object.SumPtNeutral = SumPtNeutral; object.SumPtChargedPU = SumPtChargedPU; object.SumPt = SumPt; object.FracPt[0] = FracPt[0]; object.FracPt[1] = FracPt[1]; object.FracPt[2] = FracPt[2]; object.FracPt[3] = FracPt[3]; object.FracPt[4] = FracPt[4]; object.Tau[0] = Tau[0]; object.Tau[1] = Tau[1]; object.Tau[2] = Tau[2]; object.Tau[3] = Tau[3]; object.Tau[4] = Tau[4]; object.TrimmedP4[0] = TrimmedP4[0]; object.TrimmedP4[1] = TrimmedP4[1]; object.TrimmedP4[2] = TrimmedP4[2]; object.TrimmedP4[3] = TrimmedP4[3]; object.TrimmedP4[4] = TrimmedP4[4]; object.PrunedP4[0] = PrunedP4[0]; object.PrunedP4[1] = PrunedP4[1]; object.PrunedP4[2] = PrunedP4[2]; object.PrunedP4[3] = PrunedP4[3]; object.PrunedP4[4] = PrunedP4[4]; object.SoftDroppedP4[0] = SoftDroppedP4[0]; object.SoftDroppedP4[1] = SoftDroppedP4[1]; object.SoftDroppedP4[2] = SoftDroppedP4[2]; object.SoftDroppedP4[3] = SoftDroppedP4[3]; object.SoftDroppedP4[4] = SoftDroppedP4[4]; object.NSubJetsTrimmed = NSubJetsTrimmed; object.NSubJetsPruned = NSubJetsPruned; object.NSubJetsSoftDropped = NSubJetsSoftDropped; object.fFactory = fFactory; object.fArray = 0; // Copy cluster timing info copy(Ecal_E_t.begin(),Ecal_E_t.end(),back_inserter(object.Ecal_E_t)); if(fArray && fArray->GetEntriesFast() > 0) { TIter itArray(fArray); TObjArray *array = object.GetCandidates(); while((candidate = static_cast(itArray.Next()))) { array->Add(candidate); } } } //------------------------------------------------------------------------------ void Candidate::Clear(Option_t* option) { SetUniqueID(0); ResetBit(kIsReferenced); PID = 0; Status = 0; M1 = -1; M2 = -1; D1 = -1; D2 = -1; Charge = 0; Mass = 0.0; IsPU = 0; IsConstituent = 0; BTag = 0; TauTag = 0; Eem = 0.0; Ehad = 0.0; Edges[0] = 0.0; Edges[1] = 0.0; Edges[2] = 0.0; Edges[3] = 0.0; DeltaEta = 0.0; DeltaPhi = 0.0; Momentum.SetXYZT(0.0, 0.0, 0.0, 0.0); Position.SetXYZT(0.0, 0.0, 0.0, 0.0); Area.SetXYZT(0.0, 0.0, 0.0, 0.0); Dxy = 0.0; SDxy = 0.0; Xd = 0.0; Yd = 0.0; Zd = 0.0; NCharged = 0; NNeutrals = 0; Beta = 0.0; BetaStar = 0.0; MeanSqDeltaR = 0.0; PTD = 0.0; Ntimes = 0; Ecal_E_t.clear(); IsolationVar = -999; IsolationVarRhoCorr = -999; SumPtCharged = -999; SumPtNeutral = -999; SumPtChargedPU = -999; SumPt = -999; FracPt[0] = 0.0; FracPt[1] = 0.0; FracPt[2] = 0.0; FracPt[3] = 0.0; FracPt[4] = 0.0; Tau[0] = 0.0; Tau[1] = 0.0; Tau[2] = 0.0; Tau[3] = 0.0; Tau[4] = 0.0; TrimmedP4[0]= 0.0; TrimmedP4[1]= 0.0; TrimmedP4[2]= 0.0; TrimmedP4[3]= 0.0; TrimmedP4[4]= 0.0; PrunedP4[0]= 0.0; PrunedP4[1]= 0.0; PrunedP4[2]= 0.0; PrunedP4[3]= 0.0; PrunedP4[4]= 0.0; SoftDroppedP4[0]= 0.0; SoftDroppedP4[1]= 0.0; SoftDroppedP4[2]= 0.0; SoftDroppedP4[3]= 0.0; SoftDroppedP4[4]= 0.0; NSubJetsTrimmed = 0; NSubJetsPruned = 0; NSubJetsSoftDropped = 0; fArray = 0; }