diff --git a/src/Analyses/ALEPH_2001_S4656318.cc b/src/Analyses/ALEPH_2001_S4656318.cc --- a/src/Analyses/ALEPH_2001_S4656318.cc +++ b/src/Analyses/ALEPH_2001_S4656318.cc @@ -1,128 +1,128 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/ChargedFinalState.hh" /// @todo Use inline PID functions instead #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) ) #define IS_BHADRON_PDGID(id) ( ((abs(id)/100)%10 == 5) || (abs(id) >= 5000 && abs(id) <= 5999) ) namespace Rivet { /// @brief DELPHI b-fragmentation measurement /// @author Hendrik Hoeth class ALEPH_2001_S4656318 : public Analysis { public: /// Constructor ALEPH_2001_S4656318() : Analysis("ALEPH_2001_S4656318") { } /// @name Analysis methods //@{ /// Book projections and histograms void init() { declare(Beam(), "Beams"); declare(ChargedFinalState(), "FS"); _histXbweak = bookHisto1D(1, 1, 1); _histXbprim = bookHisto1D(1, 1, 2); _histMeanXbweak = bookProfile1D(7, 1, 1); _histMeanXbprim = bookProfile1D(7, 1, 2); } void analyze(const Event& e) { const FinalState& fs = apply(e, "FS"); const size_t numParticles = fs.particles().size(); // Even if we only generate hadronic events, we still need a cut on numCharged >= 2. if (numParticles < 2) { MSG_DEBUG("Failed ncharged cut"); vetoEvent; } MSG_DEBUG("Passed ncharged cut"); // Get event weight for histo filling const double weight = e.weight(); // Get beams and average beam momentum const ParticlePair& beams = apply(e, "Beams").beams(); const double meanBeamMom = ( beams.first.p3().mod() + beams.second.p3().mod() ) / 2.0; MSG_DEBUG("Avg beam momentum = " << meanBeamMom); - foreach (const GenParticle* p, particles(e.genEvent())) { - const GenVertex* pv = p->production_vertex(); - const GenVertex* dv = p->end_vertex(); + foreach (const GenParticlePtr p, particles(e.genEvent())) { + const GenVertexPtr pv = p->production_vertex(); + const GenVertexPtr dv = p->end_vertex(); if (IS_BHADRON_PDGID(p->pdg_id())) { const double xp = p->momentum().e()/meanBeamMom; // If the B-hadron has a parton as parent, call it primary B-hadron: if (pv) { bool is_primary = false; for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin(); pp != pv->particles_in_const_end() ; ++pp) { if (IS_PARTON_PDGID((*pp)->pdg_id())) is_primary = true; } if (is_primary) { _histXbprim->fill(xp, weight); _histMeanXbprim->fill(_histMeanXbprim->bin(0).xMid(), xp, weight); } } // If the B-hadron has no B-hadron as a child, it decayed weakly: if (dv) { bool is_weak = true; for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; pp != dv->particles_out_const_end() ; ++pp) { if (IS_BHADRON_PDGID((*pp)->pdg_id())) { is_weak = false; } } if (is_weak) { _histXbweak->fill(xp, weight); _histMeanXbweak->fill(_histMeanXbweak->bin(0).xMid(), xp, weight); } } } } } // Finalize void finalize() { normalize(_histXbprim); normalize(_histXbweak); } private: /// Store the weighted sums of numbers of charged / charged+neutral /// particles - used to calculate average number of particles for the /// inclusive single particle distributions' normalisations. Histo1DPtr _histXbprim; Histo1DPtr _histXbweak; Profile1DPtr _histMeanXbprim; Profile1DPtr _histMeanXbweak; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ALEPH_2001_S4656318); } diff --git a/src/Analyses/ARGUS_1993_S2653028.cc b/src/Analyses/ARGUS_1993_S2653028.cc --- a/src/Analyses/ARGUS_1993_S2653028.cc +++ b/src/Analyses/ARGUS_1993_S2653028.cc @@ -1,177 +1,177 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief BELLE pi+/-, K+/- and proton/antiproton spectrum at Upsilon(4S) /// @author Peter Richardson class ARGUS_1993_S2653028 : public Analysis { public: ARGUS_1993_S2653028() : Analysis("ARGUS_1993_S2653028"), _weightSum(0.) { } void analyze(const Event& e) { const double weight = e.weight(); // Find the upsilons Particles upsilons; // First in unstable final state const UnstableFinalState& ufs = apply(e, "UFS"); foreach (const Particle& p, ufs.particles()) { if (p.pid() == 300553) upsilons.push_back(p); } // Then in whole event if that failed if (upsilons.empty()) { - foreach (const GenParticle* p, particles(e.genEvent())) { + foreach (const GenParticlePtr p, particles(e.genEvent())) { if (p->pdg_id() != 300553) continue; - const GenVertex* pv = p->production_vertex(); + const GenVertexPtr pv = p->production_vertex(); bool passed = true; if (pv) { - foreach (const GenParticle* pp, particles_in(pv)) { + foreach (const GenParticlePtr pp, particles_in(pv)) { if ( p->pdg_id() == pp->pdg_id() ) { passed = false; break; } } } if (passed) upsilons.push_back(Particle(*p)); } } // Find an upsilon foreach (const Particle& p, upsilons) { _weightSum += weight; vector pionsA,pionsB,protonsA,protonsB,kaons; // Find the decay products we want findDecayProducts(p.genParticle(), pionsA, pionsB, protonsA, protonsB, kaons); LorentzTransform cms_boost; if (p.p3().mod() > 1*MeV) cms_boost = LorentzTransform::mkFrameTransformFromBeta(p.momentum().betaVec()); for (size_t ix = 0; ix < pionsA.size(); ++ix) { FourMomentum ptemp(pionsA[ix]->momentum()); FourMomentum p2 = cms_boost.transform(ptemp); double pcm = cms_boost.transform(ptemp).vector3().mod(); _histPiA->fill(pcm,weight); } _multPiA->fill(10.58,double(pionsA.size())*weight); for (size_t ix = 0; ix < pionsB.size(); ++ix) { double pcm = cms_boost.transform(FourMomentum(pionsB[ix]->momentum())).vector3().mod(); _histPiB->fill(pcm,weight); } _multPiB->fill(10.58,double(pionsB.size())*weight); for (size_t ix = 0; ix < protonsA.size(); ++ix) { double pcm = cms_boost.transform(FourMomentum(protonsA[ix]->momentum())).vector3().mod(); _histpA->fill(pcm,weight); } _multpA->fill(10.58,double(protonsA.size())*weight); for (size_t ix = 0; ix < protonsB.size(); ++ix) { double pcm = cms_boost.transform(FourMomentum(protonsB[ix]->momentum())).vector3().mod(); _histpB->fill(pcm,weight); } _multpB->fill(10.58,double(protonsB.size())*weight); for (size_t ix = 0 ;ix < kaons.size(); ++ix) { double pcm = cms_boost.transform(FourMomentum(kaons[ix]->momentum())).vector3().mod(); _histKA->fill(pcm,weight); _histKB->fill(pcm,weight); } _multK->fill(10.58,double(kaons.size())*weight); } } void finalize() { if (_weightSum > 0.) { scale(_histPiA, 1./_weightSum); scale(_histPiB, 1./_weightSum); scale(_histKA , 1./_weightSum); scale(_histKB , 1./_weightSum); scale(_histpA , 1./_weightSum); scale(_histpB , 1./_weightSum); scale(_multPiA, 1./_weightSum); scale(_multPiB, 1./_weightSum); scale(_multK , 1./_weightSum); scale(_multpA , 1./_weightSum); scale(_multpB , 1./_weightSum); } } void init() { declare(UnstableFinalState(), "UFS"); // spectra _histPiA = bookHisto1D(1, 1, 1); _histPiB = bookHisto1D(2, 1, 1); _histKA = bookHisto1D(3, 1, 1); _histKB = bookHisto1D(6, 1, 1); _histpA = bookHisto1D(4, 1, 1); _histpB = bookHisto1D(5, 1, 1); // multiplicities _multPiA = bookHisto1D( 7, 1, 1); _multPiB = bookHisto1D( 8, 1, 1); _multK = bookHisto1D( 9, 1, 1); _multpA = bookHisto1D(10, 1, 1); _multpB = bookHisto1D(11, 1, 1); } // init private: //@{ /// Count of weights double _weightSum; /// Spectra Histo1DPtr _histPiA, _histPiB, _histKA, _histKB, _histpA, _histpB; /// Multiplicities Histo1DPtr _multPiA, _multPiB, _multK, _multpA, _multpB; //@} - void findDecayProducts(const GenParticle* p, - vector& pionsA, vector& pionsB, - vector& protonsA, vector& protonsB, - vector& kaons) + void findDecayProducts(const GenParticlePtr p, + vector& pionsA, vector& pionsB, + vector& protonsA, vector& protonsB, + vector& kaons) { int parentId = p->pdg_id(); - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { int id = abs((*pp)->pdg_id()); if (id == PID::PIPLUS) { if (parentId != PID::LAMBDA && parentId != PID::K0S) { pionsA.push_back(*pp); pionsB.push_back(*pp); } else pionsB.push_back(*pp); } else if (id == PID::PROTON) { if (parentId != PID::LAMBDA && parentId != PID::K0S) { protonsA.push_back(*pp); protonsB.push_back(*pp); } else protonsB.push_back(*pp); } else if (id == PID::KPLUS) { kaons.push_back(*pp); } else if ((*pp)->end_vertex()) findDecayProducts(*pp, pionsA, pionsB, protonsA, protonsB, kaons); } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ARGUS_1993_S2653028); } diff --git a/src/Analyses/ARGUS_1993_S2669951.cc b/src/Analyses/ARGUS_1993_S2669951.cc --- a/src/Analyses/ARGUS_1993_S2669951.cc +++ b/src/Analyses/ARGUS_1993_S2669951.cc @@ -1,192 +1,192 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief Production of the $\eta'(958)$ and $f_0(980)$ in $e^+e^-$ annihilation in the Upsilon region /// @author Peter Richardson class ARGUS_1993_S2669951 : public Analysis { public: ARGUS_1993_S2669951() : Analysis("ARGUS_1993_S2669951"), _count_etaPrime_highZ(2, 0.), _count_etaPrime_allZ(3, 0.), _count_f0(3, 0.), _weightSum_cont(0.), _weightSum_Ups1(0.), _weightSum_Ups2(0.) { } void init() { declare(UnstableFinalState(), "UFS"); _hist_cont_f0 = bookHisto1D(2, 1, 1); _hist_Ups1_f0 = bookHisto1D(3, 1, 1); _hist_Ups2_f0 = bookHisto1D(4, 1, 1); } void analyze(const Event& e) { // Find the Upsilons among the unstables const UnstableFinalState& ufs = apply(e, "UFS"); Particles upsilons; // First in unstable final state foreach (const Particle& p, ufs.particles()) if (p.pid() == 553 || p.pid() == 100553) upsilons.push_back(p); // Then in whole event if fails if (upsilons.empty()) { /// @todo Replace HepMC digging with Particle::descendents etc. calls - foreach (const GenParticle* p, Rivet::particles(e.genEvent())) { + foreach (const GenParticlePtr p, Rivet::particles(e.genEvent())) { if ( p->pdg_id() != 553 && p->pdg_id() != 100553 ) continue; // Discard it if its parent has the same PDG ID code (avoid duplicates) - const GenVertex* pv = p->production_vertex(); + const GenVertexPtr pv = p->production_vertex(); bool passed = true; if (pv) { - foreach (const GenParticle* pp, particles_in(pv)) { + foreach (const GenParticlePtr pp, particles_in(pv)) { if ( p->pdg_id() == pp->pdg_id() ) { passed = false; break; } } } if (passed) upsilons.push_back(Particle(*p)); } } // Finding done, now fill counters const double weight = e.weight(); if (upsilons.empty()) { // Continuum MSG_DEBUG("No Upsilons found => continuum event"); _weightSum_cont += weight; unsigned int nEtaA(0), nEtaB(0), nf0(0); foreach (const Particle& p, ufs.particles()) { const int id = p.abspid(); const double xp = 2.*p.E()/sqrtS(); const double beta = p.p3().mod() / p.E(); if (id == 9010221) { _hist_cont_f0->fill(xp, weight/beta); nf0 += 1; } else if (id == 331) { if (xp > 0.35) nEtaA += 1; nEtaB += 1; } } _count_f0[2] += nf0*weight; _count_etaPrime_highZ[1] += nEtaA*weight; _count_etaPrime_allZ[2] += nEtaB*weight; } else { // Upsilon(s) found MSG_DEBUG("Upsilons found => resonance event"); foreach (const Particle& ups, upsilons) { const int parentId = ups.pid(); ((parentId == 553) ? _weightSum_Ups1 : _weightSum_Ups2) += weight; Particles unstable; // Find the decay products we want findDecayProducts(ups.genParticle(), unstable); LorentzTransform cms_boost; if (ups.p3().mod() > 1*MeV) cms_boost = LorentzTransform::mkFrameTransformFromBeta(ups.momentum().betaVec()); const double mass = ups.mass(); unsigned int nEtaA(0), nEtaB(0), nf0(0); foreach(const Particle& p, unstable) { const int id = p.abspid(); const FourMomentum p2 = cms_boost.transform(p.momentum()); const double xp = 2.*p2.E()/mass; const double beta = p2.p3().mod()/p2.E(); if (id == 9010221) { //< ? ((parentId == 553) ? _hist_Ups1_f0 : _hist_Ups2_f0)->fill(xp, weight/beta); nf0 += 1; } else if (id == 331) { //< ? if (xp > 0.35) nEtaA += 1; nEtaB += 1; } } if (parentId == 553) { _count_f0[0] += nf0*weight; _count_etaPrime_highZ[0] += nEtaA*weight; _count_etaPrime_allZ[0] += nEtaB*weight; } else { _count_f0[1] += nf0*weight; _count_etaPrime_allZ[1] += nEtaB*weight; } } } } void finalize() { // High-Z eta' multiplicity Scatter2DPtr s111 = bookScatter2D(1, 1, 1, true); if (_weightSum_Ups1 > 0) // Point at 9.460 s111->point(0).setY(_count_etaPrime_highZ[0] / _weightSum_Ups1, 0); if (_weightSum_cont > 0) // Point at 9.905 s111->point(1).setY(_count_etaPrime_highZ[1] / _weightSum_cont, 0); // All-Z eta' multiplicity Scatter2DPtr s112 = bookScatter2D(1, 1, 2, true); if (_weightSum_Ups1 > 0) // Point at 9.460 s112->point(0).setY(_count_etaPrime_allZ[0] / _weightSum_Ups1, 0); if (_weightSum_cont > 0) // Point at 9.905 s112->point(1).setY(_count_etaPrime_allZ[2] / _weightSum_cont, 0); if (_weightSum_Ups2 > 0) // Point at 10.02 s112->point(2).setY(_count_etaPrime_allZ[1] / _weightSum_Ups2, 0); // f0 multiplicity Scatter2DPtr s511 = bookScatter2D(5, 1, 1, true); if (_weightSum_Ups1 > 0) // Point at 9.46 s511->point(0).setY(_count_f0[0] / _weightSum_Ups1, 0); if (_weightSum_Ups2 > 0) // Point at 10.02 s511->point(1).setY(_count_f0[1] / _weightSum_Ups2, 0); if (_weightSum_cont > 0) // Point at 10.45 s511->point(2).setY(_count_f0[2] / _weightSum_cont, 0); // Scale histos if (_weightSum_cont > 0.) scale(_hist_cont_f0, 1./_weightSum_cont); if (_weightSum_Ups1 > 0.) scale(_hist_Ups1_f0, 1./_weightSum_Ups1); if (_weightSum_Ups2 > 0.) scale(_hist_Ups2_f0, 1./_weightSum_Ups2); } private: /// @name Counters //@{ vector _count_etaPrime_highZ, _count_etaPrime_allZ, _count_f0; double _weightSum_cont,_weightSum_Ups1,_weightSum_Ups2; //@} /// Histos Histo1DPtr _hist_cont_f0, _hist_Ups1_f0, _hist_Ups2_f0; /// Recursively walk the HepMC tree to find decay products of @a p - void findDecayProducts(const GenParticle* p, Particles& unstable) { - const GenVertex* dv = p->end_vertex(); + void findDecayProducts(const GenParticlePtr p, Particles& unstable) { + const GenVertexPtr dv = p->end_vertex(); /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { const int id = abs((*pp)->pdg_id()); if (id == 331 || id == 9010221) unstable.push_back(Particle(*pp)); else if ((*pp)->end_vertex()) findDecayProducts(*pp, unstable); } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ARGUS_1993_S2669951); } diff --git a/src/Analyses/ARGUS_1993_S2789213.cc b/src/Analyses/ARGUS_1993_S2789213.cc --- a/src/Analyses/ARGUS_1993_S2789213.cc +++ b/src/Analyses/ARGUS_1993_S2789213.cc @@ -1,256 +1,256 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief ARGUS vector meson production /// @author Peter Richardson class ARGUS_1993_S2789213 : public Analysis { public: ARGUS_1993_S2789213() : Analysis("ARGUS_1993_S2789213"), _weightSum_cont(0.),_weightSum_Ups1(0.),_weightSum_Ups4(0.) { } void init() { declare(UnstableFinalState(), "UFS"); _mult_cont_Omega = bookHisto1D( 1, 1, 1); _mult_cont_Rho0 = bookHisto1D( 1, 1, 2); _mult_cont_KStar0 = bookHisto1D( 1, 1, 3); _mult_cont_KStarPlus = bookHisto1D( 1, 1, 4); _mult_cont_Phi = bookHisto1D( 1, 1, 5); _mult_Ups1_Omega = bookHisto1D( 2, 1, 1); _mult_Ups1_Rho0 = bookHisto1D( 2, 1, 2); _mult_Ups1_KStar0 = bookHisto1D( 2, 1, 3); _mult_Ups1_KStarPlus = bookHisto1D( 2, 1, 4); _mult_Ups1_Phi = bookHisto1D( 2, 1, 5); _mult_Ups4_Omega = bookHisto1D( 3, 1, 1); _mult_Ups4_Rho0 = bookHisto1D( 3, 1, 2); _mult_Ups4_KStar0 = bookHisto1D( 3, 1, 3); _mult_Ups4_KStarPlus = bookHisto1D( 3, 1, 4); _mult_Ups4_Phi = bookHisto1D( 3, 1, 5); _hist_cont_KStarPlus = bookHisto1D( 4, 1, 1); _hist_Ups1_KStarPlus = bookHisto1D( 5, 1, 1); _hist_Ups4_KStarPlus = bookHisto1D( 6, 1, 1); _hist_cont_KStar0 = bookHisto1D( 7, 1, 1); _hist_Ups1_KStar0 = bookHisto1D( 8, 1, 1); _hist_Ups4_KStar0 = bookHisto1D( 9, 1, 1); _hist_cont_Rho0 = bookHisto1D(10, 1, 1); _hist_Ups1_Rho0 = bookHisto1D(11, 1, 1); _hist_Ups4_Rho0 = bookHisto1D(12, 1, 1); _hist_cont_Omega = bookHisto1D(13, 1, 1); _hist_Ups1_Omega = bookHisto1D(14, 1, 1); } void analyze(const Event& e) { const double weight = e.weight(); // Find the upsilons Particles upsilons; // First in unstable final state const UnstableFinalState& ufs = apply(e, "UFS"); foreach (const Particle& p, ufs.particles()) if (p.pid() == 300553 || p.pid() == 553) upsilons.push_back(p); // Then in whole event if that failed if (upsilons.empty()) { - foreach (const GenParticle* p, Rivet::particles(e.genEvent())) { + foreach (const GenParticlePtr p, Rivet::particles(e.genEvent())) { if (p->pdg_id() != 300553 && p->pdg_id() != 553) continue; - const GenVertex* pv = p->production_vertex(); + const GenVertexPtr pv = p->production_vertex(); bool passed = true; if (pv) { - foreach (const GenParticle* pp, particles_in(pv)) { + foreach (const GenParticlePtr pp, particles_in(pv)) { if ( p->pdg_id() == pp->pdg_id() ) { passed = false; break; } } } if (passed) upsilons.push_back(Particle(*p)); } } if (upsilons.empty()) { // continuum _weightSum_cont += weight; unsigned int nOmega(0), nRho0(0), nKStar0(0), nKStarPlus(0), nPhi(0); foreach (const Particle& p, ufs.particles()) { int id = p.abspid(); double xp = 2.*p.E()/sqrtS(); double beta = p.p3().mod()/p.E(); if (id == 113) { _hist_cont_Rho0->fill(xp, weight/beta); ++nRho0; } else if (id == 313) { _hist_cont_KStar0->fill(xp, weight/beta); ++nKStar0; } else if (id == 223) { _hist_cont_Omega->fill(xp, weight/beta); ++nOmega; } else if (id == 323) { _hist_cont_KStarPlus->fill(xp,weight/beta); ++nKStarPlus; } else if (id == 333) { ++nPhi; } } /// @todo Replace with Counters and fill one-point Scatters at the end _mult_cont_Omega ->fill(10.45, weight*nOmega ); _mult_cont_Rho0 ->fill(10.45, weight*nRho0 ); _mult_cont_KStar0 ->fill(10.45, weight*nKStar0 ); _mult_cont_KStarPlus->fill(10.45, weight*nKStarPlus); _mult_cont_Phi ->fill(10.45, weight*nPhi ); } else { // found an upsilon foreach (const Particle& ups, upsilons) { const int parentId = ups.pid(); (parentId == 553 ? _weightSum_Ups1 : _weightSum_Ups4) += weight; Particles unstable; // Find the decay products we want findDecayProducts(ups.genParticle(),unstable); /// @todo Update to new LT mk* functions LorentzTransform cms_boost; if (ups.p3().mod() > 0.001) cms_boost = LorentzTransform::mkFrameTransformFromBeta(ups.momentum().betaVec()); double mass = ups.mass(); unsigned int nOmega(0),nRho0(0),nKStar0(0),nKStarPlus(0),nPhi(0); foreach(const Particle & p , unstable) { int id = p.abspid(); FourMomentum p2 = cms_boost.transform(p.momentum()); double xp = 2.*p2.E()/mass; double beta = p2.p3().mod()/p2.E(); if (id == 113) { if (parentId == 553) _hist_Ups1_Rho0->fill(xp,weight/beta); else _hist_Ups4_Rho0->fill(xp,weight/beta); ++nRho0; } else if (id == 313) { if (parentId == 553) _hist_Ups1_KStar0->fill(xp,weight/beta); else _hist_Ups4_KStar0->fill(xp,weight/beta); ++nKStar0; } else if (id == 223) { if (parentId == 553) _hist_Ups1_Omega->fill(xp,weight/beta); ++nOmega; } else if (id == 323) { if (parentId == 553) _hist_Ups1_KStarPlus->fill(xp,weight/beta); else _hist_Ups4_KStarPlus->fill(xp,weight/beta); ++nKStarPlus; } else if (id == 333) { ++nPhi; } } if (parentId == 553) { _mult_Ups1_Omega ->fill(9.46,weight*nOmega ); _mult_Ups1_Rho0 ->fill(9.46,weight*nRho0 ); _mult_Ups1_KStar0 ->fill(9.46,weight*nKStar0 ); _mult_Ups1_KStarPlus->fill(9.46,weight*nKStarPlus); _mult_Ups1_Phi ->fill(9.46,weight*nPhi ); } else { _mult_Ups4_Omega ->fill(10.58,weight*nOmega ); _mult_Ups4_Rho0 ->fill(10.58,weight*nRho0 ); _mult_Ups4_KStar0 ->fill(10.58,weight*nKStar0 ); _mult_Ups4_KStarPlus->fill(10.58,weight*nKStarPlus); _mult_Ups4_Phi ->fill(10.58,weight*nPhi ); } } } } void finalize() { if (_weightSum_cont > 0.) { /// @todo Replace with Counters and fill one-point Scatters at the end scale(_mult_cont_Omega , 1./_weightSum_cont); scale(_mult_cont_Rho0 , 1./_weightSum_cont); scale(_mult_cont_KStar0 , 1./_weightSum_cont); scale(_mult_cont_KStarPlus, 1./_weightSum_cont); scale(_mult_cont_Phi , 1./_weightSum_cont); scale(_hist_cont_KStarPlus, 1./_weightSum_cont); scale(_hist_cont_KStar0 , 1./_weightSum_cont); scale(_hist_cont_Rho0 , 1./_weightSum_cont); scale(_hist_cont_Omega , 1./_weightSum_cont); } if (_weightSum_Ups1 > 0.) { /// @todo Replace with Counters and fill one-point Scatters at the end scale(_mult_Ups1_Omega , 1./_weightSum_Ups1); scale(_mult_Ups1_Rho0 , 1./_weightSum_Ups1); scale(_mult_Ups1_KStar0 , 1./_weightSum_Ups1); scale(_mult_Ups1_KStarPlus, 1./_weightSum_Ups1); scale(_mult_Ups1_Phi , 1./_weightSum_Ups1); scale(_hist_Ups1_KStarPlus, 1./_weightSum_Ups1); scale(_hist_Ups1_KStar0 , 1./_weightSum_Ups1); scale(_hist_Ups1_Rho0 , 1./_weightSum_Ups1); scale(_hist_Ups1_Omega , 1./_weightSum_Ups1); } if (_weightSum_Ups4 > 0.) { /// @todo Replace with Counters and fill one-point Scatters at the end scale(_mult_Ups4_Omega , 1./_weightSum_Ups4); scale(_mult_Ups4_Rho0 , 1./_weightSum_Ups4); scale(_mult_Ups4_KStar0 , 1./_weightSum_Ups4); scale(_mult_Ups4_KStarPlus, 1./_weightSum_Ups4); scale(_mult_Ups4_Phi , 1./_weightSum_Ups4); scale(_hist_Ups4_KStarPlus, 1./_weightSum_Ups4); scale(_hist_Ups4_KStar0 , 1./_weightSum_Ups4); scale(_hist_Ups4_Rho0 , 1./_weightSum_Ups4); } } private: //@{ Histo1DPtr _mult_cont_Omega, _mult_cont_Rho0, _mult_cont_KStar0, _mult_cont_KStarPlus, _mult_cont_Phi; Histo1DPtr _mult_Ups1_Omega, _mult_Ups1_Rho0, _mult_Ups1_KStar0, _mult_Ups1_KStarPlus, _mult_Ups1_Phi; Histo1DPtr _mult_Ups4_Omega, _mult_Ups4_Rho0, _mult_Ups4_KStar0, _mult_Ups4_KStarPlus, _mult_Ups4_Phi; Histo1DPtr _hist_cont_KStarPlus, _hist_Ups1_KStarPlus, _hist_Ups4_KStarPlus; Histo1DPtr _hist_cont_KStar0, _hist_Ups1_KStar0, _hist_Ups4_KStar0 ; Histo1DPtr _hist_cont_Rho0, _hist_Ups1_Rho0, _hist_Ups4_Rho0; Histo1DPtr _hist_cont_Omega, _hist_Ups1_Omega; double _weightSum_cont,_weightSum_Ups1,_weightSum_Ups4; //@} - void findDecayProducts(const GenParticle* p, Particles& unstable) { - const GenVertex* dv = p->end_vertex(); + void findDecayProducts(const GenParticlePtr p, Particles& unstable) { + const GenVertexPtr dv = p->end_vertex(); /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { int id = abs((*pp)->pdg_id()); if (id == 113 || id == 313 || id == 323 || id == 333 || id == 223 ) { unstable.push_back(Particle(*pp)); } else if ((*pp)->end_vertex()) findDecayProducts(*pp, unstable); } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ARGUS_1993_S2789213); } diff --git a/src/Analyses/ATLAS_2011_S9035664.cc b/src/Analyses/ATLAS_2011_S9035664.cc --- a/src/Analyses/ATLAS_2011_S9035664.cc +++ b/src/Analyses/ATLAS_2011_S9035664.cc @@ -1,138 +1,138 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/ChargedFinalState.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief J/psi production at ATLAS class ATLAS_2011_S9035664: public Analysis { public: /// Constructor ATLAS_2011_S9035664() : Analysis("ATLAS_2011_S9035664") {} /// @name Analysis methods //@{ void init() { declare(UnstableFinalState(), "UFS"); _nonPrRapHigh = bookHisto1D( 14, 1, 1); _nonPrRapMedHigh = bookHisto1D( 13, 1, 1); _nonPrRapMedLow = bookHisto1D( 12, 1, 1); _nonPrRapLow = bookHisto1D( 11, 1, 1); _PrRapHigh = bookHisto1D( 18, 1, 1); _PrRapMedHigh = bookHisto1D( 17, 1, 1); _PrRapMedLow = bookHisto1D( 16, 1, 1); _PrRapLow = bookHisto1D( 15, 1, 1); _IncRapHigh = bookHisto1D( 20, 1, 1); _IncRapMedHigh = bookHisto1D( 21, 1, 1); _IncRapMedLow = bookHisto1D( 22, 1, 1); _IncRapLow = bookHisto1D( 23, 1, 1); } void analyze(const Event& e) { // Get event weight for histo filling const double weight = e.weight(); // Final state of unstable particles to get particle spectra const UnstableFinalState& ufs = apply(e, "UFS"); foreach (const Particle& p, ufs.particles()) { if (p.abspid() != 443) continue; - const GenVertex* gv = p.genParticle()->production_vertex(); + const GenVertexPtr gv = p.genParticle()->production_vertex(); bool nonPrompt = false; if (gv) { - foreach (const GenParticle* pi, Rivet::particles(gv, HepMC::ancestors)) { + foreach (const GenParticlePtr pi, Rivet::particles(gv, HepMC::ancestors)) { const PdgId pid2 = pi->pdg_id(); if (PID::isHadron(pid2) && PID::hasBottom(pid2)) { nonPrompt = true; break; } } } double absrap = p.absrap(); double xp = p.perp(); if (absrap<=2.4 and absrap>2.) { if (nonPrompt) _nonPrRapHigh->fill(xp, weight); else if (!nonPrompt) _PrRapHigh->fill(xp, weight); _IncRapHigh->fill(xp, weight); } else if (absrap<=2. and absrap>1.5) { if (nonPrompt) _nonPrRapMedHigh->fill(xp, weight); else if (!nonPrompt) _PrRapMedHigh->fill(xp, weight); _IncRapMedHigh->fill(xp, weight); } else if (absrap<=1.5 and absrap>0.75) { if (nonPrompt) _nonPrRapMedLow->fill(xp, weight); else if (!nonPrompt) _PrRapMedLow->fill(xp, weight); _IncRapMedLow->fill(xp, weight); } else if (absrap<=0.75) { if (nonPrompt) _nonPrRapLow->fill(xp, weight); else if (!nonPrompt) _PrRapLow->fill(xp, weight); _IncRapLow->fill(xp, weight); } } } /// Finalize void finalize() { double factor = crossSection()/nanobarn*0.0593; scale(_PrRapHigh , factor/sumOfWeights()); scale(_PrRapMedHigh , factor/sumOfWeights()); scale(_PrRapMedLow , factor/sumOfWeights()); scale(_PrRapLow , factor/sumOfWeights()); scale(_nonPrRapHigh , factor/sumOfWeights()); scale(_nonPrRapMedHigh, factor/sumOfWeights()); scale(_nonPrRapMedLow , factor/sumOfWeights()); scale(_nonPrRapLow , factor/sumOfWeights()); scale(_IncRapHigh , 1000.*factor/sumOfWeights()); scale(_IncRapMedHigh , 1000.*factor/sumOfWeights()); scale(_IncRapMedLow , 1000.*factor/sumOfWeights()); scale(_IncRapLow , 1000.*factor/sumOfWeights()); } //@} private: Histo1DPtr _nonPrRapHigh; Histo1DPtr _nonPrRapMedHigh; Histo1DPtr _nonPrRapMedLow; Histo1DPtr _nonPrRapLow; Histo1DPtr _PrRapHigh; Histo1DPtr _PrRapMedHigh; Histo1DPtr _PrRapMedLow; Histo1DPtr _PrRapLow; Histo1DPtr _IncRapHigh; Histo1DPtr _IncRapMedHigh; Histo1DPtr _IncRapMedLow; Histo1DPtr _IncRapLow; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ATLAS_2011_S9035664); } diff --git a/src/Analyses/ATLAS_2012_I1094568.cc b/src/Analyses/ATLAS_2012_I1094568.cc --- a/src/Analyses/ATLAS_2012_I1094568.cc +++ b/src/Analyses/ATLAS_2012_I1094568.cc @@ -1,367 +1,367 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/IdentifiedFinalState.hh" #include "Rivet/Projections/LeadingParticlesFinalState.hh" #include "Rivet/Projections/UnstableFinalState.hh" #include "Rivet/Projections/HadronicFinalState.hh" #include "Rivet/Projections/VetoedFinalState.hh" #include "Rivet/Projections/DressedLeptons.hh" #include "Rivet/Projections/FastJets.hh" namespace Rivet { struct ATLAS_2012_I1094568_Plots { // Track which veto region this is, to match the autobooked histograms int region_index; // Lower rapidity boundary or veto region double y_low; // Upper rapidity boundary or veto region double y_high; double vetoJetPt_Q0; double vetoJetPt_Qsum; // Histograms to store the veto jet pT and sum(veto jet pT) histograms. Histo1DPtr _h_vetoJetPt_Q0; Histo1DPtr _h_vetoJetPt_Qsum; // Scatter2Ds for the gap fractions Scatter2DPtr _d_gapFraction_Q0; Scatter2DPtr _d_gapFraction_Qsum; }; /// Top pair production with central jet veto class ATLAS_2012_I1094568 : public Analysis { public: /// Constructor ATLAS_2012_I1094568() : Analysis("ATLAS_2012_I1094568") { } /// Book histograms and initialise projections before the run void init() { const FinalState fs(Cuts::abseta < 4.5); declare(fs, "ALL_FS"); /// Get electrons from truth record IdentifiedFinalState elec_fs(Cuts::abseta < 2.47 && Cuts::pT > 25*GeV); elec_fs.acceptIdPair(PID::ELECTRON); declare(elec_fs, "ELEC_FS"); /// Get muons which pass the initial kinematic cuts: IdentifiedFinalState muon_fs(Cuts::abseta < 2.5 && Cuts::pT > 20*GeV); muon_fs.acceptIdPair(PID::MUON); declare(muon_fs, "MUON_FS"); /// Get all neutrinos. These will not be used to form jets. /// We'll use the highest 2 pT neutrinos to calculate the MET IdentifiedFinalState neutrino_fs(Cuts::abseta < 4.5); neutrino_fs.acceptNeutrinos(); declare(neutrino_fs, "NEUTRINO_FS"); // Final state used as input for jet-finding. // We include everything except the muons and neutrinos VetoedFinalState jet_input(fs); jet_input.vetoNeutrinos(); jet_input.addVetoPairId(PID::MUON); declare(jet_input, "JET_INPUT"); // Get the jets FastJets jets(jet_input, FastJets::ANTIKT, 0.4); declare(jets, "JETS"); // Initialise weight counter m_total_weight = 0.0; // Init histogramming for the various regions m_plots[0].region_index = 1; m_plots[0].y_low = 0.0; m_plots[0].y_high = 0.8; initializePlots(m_plots[0]); // m_plots[1].region_index = 2; m_plots[1].y_low = 0.8; m_plots[1].y_high = 1.5; initializePlots(m_plots[1]); // m_plots[2].region_index = 3; m_plots[2].y_low = 1.5; m_plots[2].y_high = 2.1; initializePlots(m_plots[2]); // m_plots[3].region_index = 4; m_plots[3].y_low = 0.0; m_plots[3].y_high = 2.1; initializePlots(m_plots[3]); } void initializePlots(ATLAS_2012_I1094568_Plots& plots) { const string vetoPt_Q0_name = "TMP/vetoJetPt_Q0_" + to_str(plots.region_index); plots.vetoJetPt_Q0 = 0.0; plots._h_vetoJetPt_Q0 = bookHisto1D(vetoPt_Q0_name, 200, 0.0, 1000.0); plots._d_gapFraction_Q0 = bookScatter2D(plots.region_index, 1, 1); foreach (Point2D p, refData(plots.region_index, 1, 1).points()) { p.setY(0, 0); plots._d_gapFraction_Q0->addPoint(p); } const string vetoPt_Qsum_name = "TMP/vetoJetPt_Qsum_" + to_str(plots.region_index); plots._h_vetoJetPt_Qsum = bookHisto1D(vetoPt_Qsum_name, 200, 0.0, 1000.0); plots._d_gapFraction_Qsum = bookScatter2D(plots.region_index, 2, 1); plots.vetoJetPt_Qsum = 0.0; foreach (Point2D p, refData(plots.region_index, 2, 1).points()) { p.setY(0, 0); plots._d_gapFraction_Qsum->addPoint(p); } } /// Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); /// Get the various sets of final state particles const Particles& elecFS = apply(event, "ELEC_FS").particlesByPt(); const Particles& muonFS = apply(event, "MUON_FS").particlesByPt(); const Particles& neutrinoFS = apply(event, "NEUTRINO_FS").particlesByPt(); // Get all jets with pT > 25 GeV const Jets& jets = apply(event, "JETS").jetsByPt(25.0*GeV); // Keep any jets that pass the initial rapidity cut vector central_jets; foreach(const Jet& j, jets) { if (j.absrap() < 2.4) central_jets.push_back(&j); } // For each of the jets that pass the rapidity cut, only keep those that are not // too close to any leptons vector good_jets; foreach(const Jet* j, central_jets) { bool goodJet = true; foreach (const Particle& e, elecFS) { double elec_jet_dR = deltaR(e.momentum(), j->momentum()); if (elec_jet_dR < 0.4) { goodJet = false; break; } } if (!goodJet) continue; if (!goodJet) continue; foreach (const Particle& m, muonFS) { double muon_jet_dR = deltaR(m.momentum(), j->momentum()); if (muon_jet_dR < 0.4) { goodJet = false; break; } } if (!goodJet) continue; good_jets.push_back(j); } // Get b hadrons with pT > 5 GeV /// @todo This is a hack -- replace with UnstableFinalState vector B_hadrons; vector allParticles = particles(event.genEvent()); for (size_t i = 0; i < allParticles.size(); i++) { - const GenParticle* p = allParticles[i]; + const GenParticlePtr p = allParticles[i]; if (!PID::isHadron(p->pdg_id()) || !PID::hasBottom(p->pdg_id())) continue; if (p->momentum().perp() < 5*GeV) continue; B_hadrons.push_back(p); } // For each of the good jets, check whether any are b-jets (via dR matching) vector b_jets; foreach (const Jet* j, good_jets) { bool isbJet = false; - foreach (const GenParticle* b, B_hadrons) { + foreach (const GenParticlePtr b, B_hadrons) { if (deltaR(j->momentum(), FourMomentum(b->momentum())) < 0.3) isbJet = true; } if (isbJet) b_jets.push_back(j); } // Check the good jets again and keep track of the "additional jets" // i.e. those which are not either of the 2 highest pT b-jets vector veto_jets; int n_bjets_matched = 0; foreach (const Jet* j, good_jets) { bool isBJet = false; foreach (const Jet* b, b_jets) { if (n_bjets_matched == 2) break; if (b == j){isBJet = true; ++ n_bjets_matched;} } if (!isBJet) veto_jets.push_back(j); } // Get the MET by taking the vector sum of all neutrinos /// @todo Use MissingMomentum instead? double MET = 0; FourMomentum p_MET; foreach (const Particle& p, neutrinoFS) { p_MET = p_MET + p.momentum(); } MET = p_MET.pT(); // Now we have everything we need to start doing the event selections bool passed_ee = false; vector vetoJets_ee; // We want exactly 2 electrons... if (elecFS.size() == 2) { // ... with opposite sign charges. if (charge(elecFS[0]) != charge(elecFS[1])) { // Check the MET if (MET >= 40*GeV) { // Do some dilepton mass cuts const double dilepton_mass = (elecFS[0].momentum() + elecFS[1].momentum()).mass(); if (dilepton_mass >= 15*GeV) { if (fabs(dilepton_mass - 91.0*GeV) >= 10.0*GeV) { // We need at least 2 b-jets if (b_jets.size() > 1) { // This event has passed all the cuts; passed_ee = true; } } } } } } bool passed_mumu = false; // Now do the same checks for the mumu channel vector vetoJets_mumu; // So we now want 2 good muons... if (muonFS.size() == 2) { // ...with opposite sign charges. if (charge(muonFS[0]) != charge(muonFS[1])) { // Check the MET if (MET >= 40*GeV) { // and do some di-muon mass cuts const double dilepton_mass = (muonFS.at(0).momentum() + muonFS.at(1).momentum()).mass(); if (dilepton_mass >= 15*GeV) { if (fabs(dilepton_mass - 91.0*GeV) >= 10.0*GeV) { // Need at least 2 b-jets if (b_jets.size() > 1) { // This event has passed all mumu-channel cuts passed_mumu = true; } } } } } } bool passed_emu = false; // Finally, the same again with the emu channel vector vetoJets_emu; // We want exactly 1 electron and 1 muon if (elecFS.size() == 1 && muonFS.size() == 1) { // With opposite sign charges if (charge(elecFS[0]) != charge(muonFS[0])) { // Calculate HT: scalar sum of the pTs of the leptons and all good jets double HT = 0; HT += elecFS[0].pT(); HT += muonFS[0].pT(); foreach (const Jet* j, good_jets) HT += fabs(j->pT()); // Keep events with HT > 130 GeV if (HT > 130.0*GeV) { // And again we want 2 or more b-jets if (b_jets.size() > 1) { passed_emu = true; } } } } if (passed_ee == true || passed_mumu == true || passed_emu == true) { // If the event passes the selection, we use it for all gap fractions m_total_weight += weight; // Loop over each veto jet foreach (const Jet* j, veto_jets) { const double pt = j->pT(); const double rapidity = fabs(j->rapidity()); // Loop over each region for (size_t i = 0; i < 4; ++i) { // If the jet falls into this region, get its pT and increment sum(pT) if (inRange(rapidity, m_plots[i].y_low, m_plots[i].y_high)) { m_plots[i].vetoJetPt_Qsum += pt; // If we've already got a veto jet, don't replace it if (m_plots[i].vetoJetPt_Q0 == 0.0) m_plots[i].vetoJetPt_Q0 = pt; } } } for (size_t i = 0; i < 4; ++i) { m_plots[i]._h_vetoJetPt_Q0->fill(m_plots[i].vetoJetPt_Q0, weight); m_plots[i]._h_vetoJetPt_Qsum->fill(m_plots[i].vetoJetPt_Qsum, weight); m_plots[i].vetoJetPt_Q0 = 0.0; m_plots[i].vetoJetPt_Qsum = 0.0; } } } /// Normalise histograms etc., after the run void finalize() { for (size_t i = 0; i < 4; ++i) { finalizeGapFraction(m_total_weight, m_plots[i]._d_gapFraction_Q0, m_plots[i]._h_vetoJetPt_Q0); finalizeGapFraction(m_total_weight, m_plots[i]._d_gapFraction_Qsum, m_plots[i]._h_vetoJetPt_Qsum); } } /// Convert temporary histos to cumulative efficiency scatters /// @todo Should be possible to replace this with a couple of YODA one-lines for diff -> integral and "efficiency division" void finalizeGapFraction(double total_weight, Scatter2DPtr gapFraction, Histo1DPtr vetoPt) { // Stores the cumulative frequency of the veto jet pT histogram double vetoPtWeightSum = 0.0; // Keep track of which gap fraction point we're currently populating (#final_points != #tmp_bins) size_t fgap_point = 0; for (size_t i = 0; i < vetoPt->numBins(); ++i) { // If we've done the last "final" point, stop if (fgap_point == gapFraction->numPoints()) break; // Increment the cumulative vetoPt counter for this temp histo bin /// @todo Get rid of this and use vetoPt->integral(i+1) when points and bins line up? vetoPtWeightSum += vetoPt->bin(i).sumW(); // If this temp histo bin's upper edge doesn't correspond to the reference point, don't finalise the scatter. // Note that points are ON the bin edges and have no width: they represent the integral up to exactly that point. if ( !fuzzyEquals(vetoPt->bin(i).xMax(), gapFraction->point(fgap_point).x()) ) continue; // Calculate the gap fraction and its uncertainty const double frac = (total_weight != 0.0) ? vetoPtWeightSum/total_weight : 0; const double fracErr = (total_weight != 0.0) ? sqrt(frac*(1-frac)/total_weight) : 0; gapFraction->point(fgap_point).setY(frac, fracErr); ++fgap_point; } } private: // Weight counter double m_total_weight; // Structs containing all the plots, for each event selection ATLAS_2012_I1094568_Plots m_plots[4]; }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ATLAS_2012_I1094568); } diff --git a/src/Analyses/ATLAS_2012_I1118269.cc b/src/Analyses/ATLAS_2012_I1118269.cc --- a/src/Analyses/ATLAS_2012_I1118269.cc +++ b/src/Analyses/ATLAS_2012_I1118269.cc @@ -1,77 +1,77 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Particle.hh" namespace Rivet { class ATLAS_2012_I1118269 : public Analysis { public: ATLAS_2012_I1118269() : Analysis("ATLAS_2012_I1118269") { } void init() { _h_sigma_vs_pt = bookHisto1D(1, 1, 1); _h_sigma_vs_eta = bookHisto1D(2, 1, 1); } /// Perform the per-event analysis void analyze(const Event& event) { double weight = event.weight(); Particles bhadrons; - foreach (const GenParticle* p, particles(event.genEvent())) { + foreach (const GenParticlePtr p, particles(event.genEvent())) { if (!( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) ) continue; - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); /// @todo In future, convert to use built-in 'last B hadron' function bool hasBdaughter = false; if ( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) { // b-hadron selection if (dv) { for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; pp != dv->particles_out_const_end() ; ++pp) { if ( PID::isHadron( (*pp)->pdg_id() ) && PID::hasBottom( (*pp)->pdg_id()) ) { hasBdaughter = true; } } } } if (hasBdaughter) continue; bhadrons += Particle(*p); } foreach (const Particle& particle, bhadrons) { double eta = particle.eta(); double pt = particle.pT(); if (!(inRange(eta, -2.5, 2.5))) continue; if (pt < 9.*GeV) continue; _h_sigma_vs_pt->fill(pt, weight); _h_sigma_vs_eta->fill(fabs(eta), weight); } } void finalize() { scale(_h_sigma_vs_pt, crossSection()/nanobarn/sumOfWeights()); scale(_h_sigma_vs_eta, crossSection()/microbarn/sumOfWeights()); } private: Histo1DPtr _h_sigma_vs_pt; Histo1DPtr _h_sigma_vs_eta; }; // Hook for the plugin system DECLARE_RIVET_PLUGIN(ATLAS_2012_I1118269); } diff --git a/src/Analyses/ATLAS_2012_I1188891.cc b/src/Analyses/ATLAS_2012_I1188891.cc --- a/src/Analyses/ATLAS_2012_I1188891.cc +++ b/src/Analyses/ATLAS_2012_I1188891.cc @@ -1,146 +1,146 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FastJets.hh" #include "Rivet/Tools/BinnedHistogram.hh" #include "Rivet/Projections/ChargedFinalState.hh" #include "Rivet/Particle.hh" namespace Rivet { class ATLAS_2012_I1188891 : public Analysis { public: ATLAS_2012_I1188891() : Analysis("ATLAS_2012_I1188891") { } void init() { const FinalState fs; FastJets fj04(fs, FastJets::ANTIKT, 0.4); declare(fj04, "AntiKT04"); string histotitle[7]={"BBfraction","BCfraction","CCfraction","BUfraction","CUfraction","UUfraction","Total"}; for (int i = 0 ; i < 7 ; i++){ _h_temp[i] = bookHisto1D("TMP/"+histotitle[i],refData(1,1,1)); if (i < 6) { _h_results[i] = bookScatter2D(i+1, 1, 1); } } } void analyze(const Event& event) { double weight = event.weight(); double weight100 = event.weight() * 100.; //to get results in % //keeps jets with pt>20 geV and ordered in decreasing pt Jets jetAr = apply(event, "AntiKT04").jetsByPt(20*GeV); int flav[2]={1,1}; vector leadjets; //get b/c-hadrons vector B_hadrons, C_hadrons; vector allParticles = particles(event.genEvent()); for (size_t i = 0; i < allParticles.size(); i++) { - const GenParticle* p = allParticles.at(i); + const GenParticlePtr p = allParticles.at(i); if(p->momentum().perp()*GeV < 5) continue; if ( (Rivet::PID::isHadron ( p->pdg_id() ) && Rivet::PID::hasBottom( p->pdg_id() ) ) ) { B_hadrons.push_back(p); } if ( (Rivet::PID::isHadron( p->pdg_id() ) && Rivet::PID::hasCharm( p->pdg_id() ) ) ) { C_hadrons.push_back(p); } } //select dijet foreach (const Jet& jet, jetAr) { const double pT = jet.pT(); const double absy = jet.absrap(); bool isBjet = jet.bTagged(); bool isCjet = jet.cTagged(); int jetflav=1; if (isBjet)jetflav=5; else if (isCjet)jetflav=4; if (absy <= 2.1 && leadjets.size() < 2) { if (pT > 500*GeV) continue; if ((leadjets.empty() && pT < 40*GeV) || pT < 20*GeV) continue; leadjets.push_back(jet.momentum()); if (leadjets.size()==1) flav[0] = jetflav; if (leadjets.size()==2) flav[1] = jetflav; } } if (leadjets.size() < 2) vetoEvent; double pBinsLJ[7] = {40.,60.,80.,120.,160.,250.,500.}; int iPBinLJ = -1; for (int k = 0 ; k < 7 ; k++) { if (leadjets[0].pT() > pBinsLJ[k]*GeV) iPBinLJ=k; else break; } bool c_ljpt = (iPBinLJ != -1); bool c_nljpt = leadjets[1].pT() > 20*GeV; bool c_dphi = fabs( deltaPhi(leadjets[0],leadjets[1]) ) > 2.1; bool isDijet = c_ljpt & c_nljpt & c_dphi; if (!isDijet) vetoEvent; _h_temp[6]->fill(leadjets[0].pT(), weight); if (flav[0]==5 && flav[1]==5) // BB dijet _h_temp[0]->fill(leadjets[0].pT(), weight100); if ((flav[0]==5 && flav[1]==4) || (flav[0]==4 && flav[1]==5)) // BC dijet _h_temp[1]->fill(leadjets[0].pT(), weight100); if (flav[0]==4 && flav[1]==4) // CC dijet _h_temp[2]->fill(leadjets[0].pT(), weight100); if ((flav[0]==5 && flav[1]==1) || (flav[0]==1 && flav[1]==5)) // B-light dijet _h_temp[3]->fill(leadjets[0].pT(), weight100); if ((flav[0]==4 && flav[1]==1) || (flav[0]==1 && flav[1]==4)) // C-light dijet _h_temp[4]->fill(leadjets[0].pT(), weight100); if (flav[0]==1 && flav[1]==1) // light-light dijet _h_temp[5]->fill(leadjets[0].pT(), weight100); } void finalize() { divide(_h_temp[0], _h_temp[6], _h_results[0]); divide(_h_temp[1], _h_temp[6], _h_results[1]); divide(_h_temp[2], _h_temp[6], _h_results[2]); divide(_h_temp[3], _h_temp[6], _h_results[3]); divide(_h_temp[4], _h_temp[6], _h_results[4]); divide(_h_temp[5], _h_temp[6], _h_results[5]); } private: Histo1DPtr _h_temp[7]; Scatter2DPtr _h_results[6]; }; DECLARE_RIVET_PLUGIN(ATLAS_2012_I1188891); } diff --git a/src/Analyses/ATLAS_2012_I1204447.cc b/src/Analyses/ATLAS_2012_I1204447.cc --- a/src/Analyses/ATLAS_2012_I1204447.cc +++ b/src/Analyses/ATLAS_2012_I1204447.cc @@ -1,1060 +1,1060 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/ChargedFinalState.hh" #include "Rivet/Projections/VisibleFinalState.hh" #include "Rivet/Projections/VetoedFinalState.hh" #include "Rivet/Projections/IdentifiedFinalState.hh" #include "Rivet/Projections/UnstableFinalState.hh" #include "Rivet/Projections/FastJets.hh" namespace Rivet { class ATLAS_2012_I1204447 : public Analysis { public: /// Constructor ATLAS_2012_I1204447() : Analysis("ATLAS_2012_I1204447") { } /// Book histograms and initialise projections before the run void init() { // To calculate the acceptance without having the fiducial lepton efficiencies included, this part can be turned off _use_fiducial_lepton_efficiency = true; // Random numbers for simulation of ATLAS detector reconstruction efficiency srand(160385); // Read in all signal regions _signal_regions = getSignalRegions(); // Set number of events per signal region to 0 for (size_t i = 0; i < _signal_regions.size(); i++) _eventCountsPerSR[_signal_regions[i]] = 0.0; // Final state including all charged and neutral particles const FinalState fs(-5.0, 5.0, 1*GeV); declare(fs, "FS"); // Final state including all charged particles declare(ChargedFinalState(Cuts::abseta < 2.5 && Cuts::pT > 1*GeV), "CFS"); // Final state including all visible particles (to calculate MET, Jets etc.) declare(VisibleFinalState(Cuts::abseta < 5.0), "VFS"); // Final state including all AntiKt 04 Jets VetoedFinalState vfs; vfs.addVetoPairId(PID::MUON); declare(FastJets(vfs, FastJets::ANTIKT, 0.4), "AntiKtJets04"); // Final state including all unstable particles (including taus) declare(UnstableFinalState(Cuts::abseta < 5.0 && Cuts::pT > 5*GeV), "UFS"); // Final state including all electrons IdentifiedFinalState elecs(Cuts::abseta < 2.47 && Cuts::pT > 10*GeV); elecs.acceptIdPair(PID::ELECTRON); declare(elecs, "elecs"); // Final state including all muons IdentifiedFinalState muons(Cuts::abseta < 2.5 && Cuts::pT > 10*GeV); muons.acceptIdPair(PID::MUON); declare(muons, "muons"); // Book histograms _h_HTlep_all = bookHisto1D("HTlep_all" , 30, 0, 1500); _h_HTjets_all = bookHisto1D("HTjets_all", 30, 0, 1500); _h_MET_all = bookHisto1D("MET_all" , 20, 0, 1000); _h_Meff_all = bookHisto1D("Meff_all" , 30, 0, 3000); _h_e_n = bookHisto1D("e_n" , 10, -0.5, 9.5); _h_mu_n = bookHisto1D("mu_n" , 10, -0.5, 9.5); _h_tau_n = bookHisto1D("tau_n", 10, -0.5, 9.5); _h_pt_1_3l = bookHisto1D("pt_1_3l", 100, 0, 2000); _h_pt_2_3l = bookHisto1D("pt_2_3l", 100, 0, 2000); _h_pt_3_3l = bookHisto1D("pt_3_3l", 100, 0, 2000); _h_pt_1_2ltau = bookHisto1D("pt_1_2ltau", 100, 0, 2000); _h_pt_2_2ltau = bookHisto1D("pt_2_2ltau", 100, 0, 2000); _h_pt_3_2ltau = bookHisto1D("pt_3_2ltau", 100, 0, 2000); _h_excluded = bookHisto1D("excluded", 2, -0.5, 1.5); } /// Perform the per-event analysis void analyze(const Event& event) { // Muons Particles muon_candidates; const Particles charged_tracks = apply(event, "CFS").particles(); const Particles visible_particles = apply(event, "VFS").particles(); foreach (const Particle& mu, apply(event, "muons").particlesByPt()) { // Calculate pTCone30 variable (pT of all tracks within dR<0.3 - pT of muon itself) double pTinCone = -mu.pT(); foreach (const Particle& track, charged_tracks) { if (deltaR(mu.momentum(), track.momentum()) < 0.3) pTinCone += track.pT(); } // Calculate eTCone30 variable (pT of all visible particles within dR<0.3) double eTinCone = 0.; foreach (const Particle& visible_particle, visible_particles) { if (visible_particle.abspid() != PID::MUON && inRange(deltaR(mu.momentum(), visible_particle.momentum()), 0.1, 0.3)) eTinCone += visible_particle.pT(); } // Apply reconstruction efficiency and simulate reco int muon_id = 13; if ( mu.hasAncestor(15) || mu.hasAncestor(-15)) muon_id = 14; const double eff = (_use_fiducial_lepton_efficiency) ? apply_reco_eff(muon_id, mu) : 1.0; const bool keep_muon = rand()/static_cast(RAND_MAX) <= eff; // Keep muon if pTCone30/pT < 0.15 and eTCone30/pT < 0.2 and reconstructed if (keep_muon && pTinCone/mu.pT() <= 0.15 && eTinCone/mu.pT() < 0.2) muon_candidates.push_back(mu); } // Electrons Particles electron_candidates; foreach (const Particle& e, apply(event, "elecs").particlesByPt()) { // Neglect electrons in crack regions if (inRange(e.abseta(), 1.37, 1.52)) continue; // Calculate pTCone30 variable (pT of all tracks within dR<0.3 - pT of electron itself) double pTinCone = -e.pT(); foreach (const Particle& track, charged_tracks) { if (deltaR(e.momentum(), track.momentum()) < 0.3) pTinCone += track.pT(); } // Calculate eTCone30 variable (pT of all visible particles (except muons) within dR<0.3) double eTinCone = 0.; foreach (const Particle& visible_particle, visible_particles) { if (visible_particle.abspid() != PID::MUON && inRange(deltaR(e.momentum(), visible_particle.momentum()), 0.1, 0.3)) eTinCone += visible_particle.pT(); } // Apply reconstruction efficiency and simulate reco int elec_id = 11; if (e.hasAncestor(15) || e.hasAncestor(-15)) elec_id = 12; const double eff = (_use_fiducial_lepton_efficiency) ? apply_reco_eff(elec_id, e) : 1.0; const bool keep_elec = rand()/static_cast(RAND_MAX) <= eff; // Keep electron if pTCone30/pT < 0.13 and eTCone30/pT < 0.2 and reconstructed if (keep_elec && pTinCone/e.pT() <= 0.13 && eTinCone/e.pT() < 0.2) electron_candidates.push_back(e); } // Taus /// @todo This could benefit from a tau finder projection Particles tau_candidates; foreach (const Particle& tau, apply(event, "UFS").particlesByPt()) { // Only pick taus out of all unstable particles if (tau.abspid() != PID::TAU) continue; // Check that tau has decayed into daughter particles /// @todo Huh? Unstable taus with no decay vtx? Can use Particle.isStable()? But why in this situation? if (tau.genParticle()->end_vertex() == 0) continue; // Calculate visible tau pT from pT of tau neutrino in tau decay for pT and |eta| cuts FourMomentum daughter_tau_neutrino_momentum = get_tau_neutrino_mom(tau); Particle tau_vis = tau; tau_vis.setMomentum(tau.momentum()-daughter_tau_neutrino_momentum); // keep only taus in certain eta region and above 15 GeV of visible tau pT if ( tau_vis.pT() <= 15.0*GeV || tau_vis.abseta() > 2.5) continue; // Get prong number (number of tracks) in tau decay and check if tau decays leptonically unsigned int nprong = 0; bool lep_decaying_tau = false; get_prong_number(tau.genParticle(), nprong, lep_decaying_tau); // Apply reconstruction efficiency int tau_id = 15; if (nprong == 1) tau_id = 15; else if (nprong == 3) tau_id = 16; // Get fiducial lepton efficiency simulate reco efficiency const double eff = (_use_fiducial_lepton_efficiency) ? apply_reco_eff(tau_id, tau_vis) : 1.0; const bool keep_tau = rand()/static_cast(RAND_MAX) <= eff; // Keep tau if nprong = 1, it decays hadronically, and it's reconstructed by the detector if ( !lep_decaying_tau && nprong == 1 && keep_tau) tau_candidates.push_back(tau_vis); } // Jets (all anti-kt R=0.4 jets with pT > 25 GeV and eta < 4.9) Jets jet_candidates; foreach (const Jet& jet, apply(event, "AntiKtJets04").jetsByPt(25*GeV)) { if (jet.abseta() < 4.9) jet_candidates.push_back(jet); } // ETmiss Particles vfs_particles = apply(event, "VFS").particles(); FourMomentum pTmiss; foreach (const Particle& p, vfs_particles) pTmiss -= p.momentum(); double eTmiss = pTmiss.pT()/GeV; //------------------ // Overlap removal // electron - electron Particles electron_candidates_2; for (size_t ie = 0; ie < electron_candidates.size(); ++ie) { const Particle & e = electron_candidates[ie]; bool away = true; // If electron pair within dR < 0.1: remove electron with lower pT for (size_t ie2=0; ie2 < electron_candidates_2.size(); ++ie2) { if ( deltaR( e.momentum(), electron_candidates_2[ie2].momentum()) < 0.1 ) { away = false; break; } } // If isolated keep it if ( away ) electron_candidates_2.push_back( e ); } // jet - electron Jets recon_jets; foreach (const Jet& jet, jet_candidates) { bool away = true; // if jet within dR < 0.2 of electron: remove jet foreach (const Particle& e, electron_candidates_2) { if (deltaR(e.momentum(), jet.momentum()) < 0.2) { away = false; break; } } // jet - tau if (away) { // If jet within dR < 0.2 of tau: remove jet foreach (const Particle& tau, tau_candidates) { if (deltaR(tau.momentum(), jet.momentum()) < 0.2) { away = false; break; } } } // If isolated keep it if ( away ) recon_jets.push_back( jet ); } // electron - jet Particles recon_leptons, recon_e; for (size_t ie = 0; ie < electron_candidates_2.size(); ++ie) { const Particle& e = electron_candidates_2[ie]; // If electron within 0.2 < dR < 0.4 from any jets: remove electron bool away = true; foreach (const Jet& jet, recon_jets) { if (deltaR(e.momentum(), jet.momentum()) < 0.4) { away = false; break; } } // electron - muon // if electron within dR < 0.1 of a muon: remove electron if (away) { foreach (const Particle& mu, muon_candidates) { if (deltaR(mu.momentum(), e.momentum()) < 0.1) { away = false; break; } } } // If isolated keep it if (away) { recon_e += e; recon_leptons += e; } } // tau - electron Particles recon_tau; foreach ( const Particle& tau, tau_candidates ) { bool away = true; // If tau within dR < 0.2 of an electron: remove tau foreach ( const Particle& e, recon_e ) { if (deltaR( tau.momentum(), e.momentum()) < 0.2) { away = false; break; } } // tau - muon // If tau within dR < 0.2 of a muon: remove tau if (away) { foreach (const Particle& mu, muon_candidates) { if (deltaR(tau.momentum(), mu.momentum()) < 0.2) { away = false; break; } } } // If isolated keep it if (away) recon_tau.push_back( tau ); } // Muon - jet isolation Particles recon_mu, trigger_mu; // If muon within dR < 0.4 of a jet, remove muon foreach (const Particle& mu, muon_candidates) { bool away = true; foreach (const Jet& jet, recon_jets) { if ( deltaR( mu.momentum(), jet.momentum()) < 0.4 ) { away = false; break; } } if (away) { recon_mu.push_back( mu ); recon_leptons.push_back( mu ); if (mu.abseta() < 2.4) trigger_mu.push_back( mu ); } } // End overlap removal //------------------ // Jet cleaning if (rand()/static_cast(RAND_MAX) <= 0.42) { foreach (const Jet& jet, recon_jets) { const double eta = jet.rapidity(); const double phi = jet.azimuthalAngle(MINUSPI_PLUSPI); if (jet.pT() > 25*GeV && inRange(eta, -0.1, 1.5) && inRange(phi, -0.9, -0.5)) vetoEvent; } } // Post-isolation event cuts // Require at least 3 charged tracks in event if (charged_tracks.size() < 3) vetoEvent; // And at least one e/mu passing trigger if (!( !recon_e .empty() && recon_e[0] .pT() > 25*GeV) && !( !trigger_mu.empty() && trigger_mu[0].pT() > 25*GeV) ) { MSG_DEBUG("Hardest lepton fails trigger"); vetoEvent; } // And only accept events with at least 2 electrons and muons and at least 3 leptons in total if (recon_mu.size() + recon_e.size() + recon_tau.size() < 3 || recon_leptons.size() < 2) vetoEvent; // Now it's worth getting the event weight const double weight = event.weight(); // Sort leptons by decreasing pT sortByPt(recon_leptons); sortByPt(recon_tau); // Calculate HTlep, fill lepton pT histograms & store chosen combination of 3 leptons double HTlep = 0.; Particles chosen_leptons; if ( recon_leptons.size() > 2 ) { _h_pt_1_3l->fill(recon_leptons[0].perp()/GeV, weight); _h_pt_2_3l->fill(recon_leptons[1].perp()/GeV, weight); _h_pt_3_3l->fill(recon_leptons[2].perp()/GeV, weight); HTlep = (recon_leptons[0].pT() + recon_leptons[1].pT() + recon_leptons[2].pT())/GeV; chosen_leptons.push_back( recon_leptons[0] ); chosen_leptons.push_back( recon_leptons[1] ); chosen_leptons.push_back( recon_leptons[2] ); } else { _h_pt_1_2ltau->fill(recon_leptons[0].perp()/GeV, weight); _h_pt_2_2ltau->fill(recon_leptons[1].perp()/GeV, weight); _h_pt_3_2ltau->fill(recon_tau[0].perp()/GeV, weight); HTlep = (recon_leptons[0].pT() + recon_leptons[1].pT() + recon_tau[0].pT())/GeV ; chosen_leptons.push_back( recon_leptons[0] ); chosen_leptons.push_back( recon_leptons[1] ); chosen_leptons.push_back( recon_tau[0] ); } // Number of prompt e/mu and had taus _h_e_n ->fill(recon_e.size() , weight); _h_mu_n ->fill(recon_mu.size() , weight); _h_tau_n->fill(recon_tau.size(), weight); // Calculate HTjets double HTjets = 0.; foreach ( const Jet & jet, recon_jets ) HTjets += jet.perp()/GeV; // Calculate meff double meff = eTmiss + HTjets; Particles all_leptons; foreach ( const Particle & e , recon_e ) { meff += e.perp()/GeV; all_leptons.push_back( e ); } foreach ( const Particle & mu, recon_mu ) { meff += mu.perp()/GeV; all_leptons.push_back( mu ); } foreach ( const Particle & tau, recon_tau ) { meff += tau.perp()/GeV; all_leptons.push_back( tau ); } // Fill histogram of kinematic variables _h_HTlep_all ->fill(HTlep , weight); _h_HTjets_all->fill(HTjets, weight); _h_MET_all ->fill(eTmiss, weight); _h_Meff_all ->fill(meff , weight); // Determine signal region (3l/2ltau, onZ/offZ) string basic_signal_region; if ( recon_mu.size() + recon_e.size() > 2 ) basic_signal_region += "3l_"; else if ( (recon_mu.size() + recon_e.size() == 2) && (recon_tau.size() > 0)) basic_signal_region += "2ltau_"; // Is there an OSSF pair or a three lepton combination with an invariant mass close to the Z mass int onZ = isonZ(chosen_leptons); if (onZ == 1) basic_signal_region += "onZ"; else if (onZ == 0) basic_signal_region += "offZ"; // Check in which signal regions this event falls and adjust event counters fillEventCountsPerSR(basic_signal_region, onZ, HTlep, eTmiss, HTjets, meff, weight); } /// Normalise histograms etc., after the run void finalize() { // Normalize to an integrated luminosity of 1 fb-1 double norm = crossSection()/femtobarn/sumOfWeights(); string best_signal_region = ""; double ratio_best_SR = 0.; // Loop over all signal regions and find signal region with best sensitivity (ratio signal events/visible cross-section) for (size_t i = 0; i < _signal_regions.size(); i++) { double signal_events = _eventCountsPerSR[_signal_regions[i]] * norm; // Use expected upper limits to find best signal region double UL95 = getUpperLimit(_signal_regions[i], false); double ratio = signal_events / UL95; if (ratio > ratio_best_SR) { best_signal_region = _signal_regions[i]; ratio_best_SR = ratio; } } double signal_events_best_SR = _eventCountsPerSR[best_signal_region] * norm; double exp_UL_best_SR = getUpperLimit(best_signal_region, false); double obs_UL_best_SR = getUpperLimit(best_signal_region, true); // Print out result cout << "----------------------------------------------------------------------------------------" << endl; cout << "Best signal region: " << best_signal_region << endl; cout << "Normalized number of signal events in this best signal region (per fb-1): " << signal_events_best_SR << endl; cout << "Efficiency*Acceptance: " << _eventCountsPerSR[best_signal_region]/sumOfWeights() << endl; cout << "Cross-section [fb]: " << crossSection()/femtobarn << endl; cout << "Expected visible cross-section (per fb-1): " << exp_UL_best_SR << endl; cout << "Ratio (signal events / expected visible cross-section): " << ratio_best_SR << endl; cout << "Observed visible cross-section (per fb-1): " << obs_UL_best_SR << endl; cout << "Ratio (signal events / observed visible cross-section): " << signal_events_best_SR/obs_UL_best_SR << endl; cout << "----------------------------------------------------------------------------------------" << endl; cout << "Using the EXPECTED limits (visible cross-section) of the analysis: " << endl; if (signal_events_best_SR > exp_UL_best_SR) { cout << "Since the number of signal events > the visible cross-section, this model/grid point is EXCLUDED with 95% CL." << endl; _h_excluded->fill(1); } else { cout << "Since the number of signal events < the visible cross-section, this model/grid point is NOT EXCLUDED." << endl; _h_excluded->fill(0); } cout << "----------------------------------------------------------------------------------------" << endl; cout << "Using the OBSERVED limits (visible cross-section) of the analysis: " << endl; if (signal_events_best_SR > obs_UL_best_SR) { cout << "Since the number of signal events > the visible cross-section, this model/grid point is EXCLUDED with 95% CL." << endl; _h_excluded->fill(1); } else { cout << "Since the number of signal events < the visible cross-section, this model/grid point is NOT EXCLUDED." << endl; _h_excluded->fill(0); } cout << "----------------------------------------------------------------------------------------" << endl; // Normalize to cross section if (norm != 0) { scale(_h_HTlep_all, norm); scale(_h_HTjets_all, norm); scale(_h_MET_all, norm); scale(_h_Meff_all, norm); scale(_h_pt_1_3l, norm); scale(_h_pt_2_3l, norm); scale(_h_pt_3_3l, norm); scale(_h_pt_1_2ltau, norm); scale(_h_pt_2_2ltau, norm); scale(_h_pt_3_2ltau, norm); scale(_h_e_n, norm); scale(_h_mu_n, norm); scale(_h_tau_n, norm); scale(_h_excluded, signal_events_best_SR); } } /// Helper functions //@{ /// Function giving a list of all signal regions vector getSignalRegions() { // List of basic signal regions vector basic_signal_regions; basic_signal_regions.push_back("3l_offZ"); basic_signal_regions.push_back("3l_onZ"); basic_signal_regions.push_back("2ltau_offZ"); basic_signal_regions.push_back("2ltau_onZ"); // List of kinematic variables vector kinematic_variables; kinematic_variables.push_back("HTlep"); kinematic_variables.push_back("METStrong"); kinematic_variables.push_back("METWeak"); kinematic_variables.push_back("Meff"); kinematic_variables.push_back("MeffStrong"); vector signal_regions; // Loop over all kinematic variables and basic signal regions for (size_t i0 = 0; i0 < kinematic_variables.size(); i0++) { for (size_t i1 = 0; i1 < basic_signal_regions.size(); i1++) { // Is signal region onZ? int onZ = (basic_signal_regions[i1].find("onZ") != string::npos) ? 1 : 0; // Get cut values for this kinematic variable vector cut_values = getCutsPerSignalRegion(kinematic_variables[i0], onZ); // Loop over all cut values for (size_t i2 = 0; i2 < cut_values.size(); i2++) { // push signal region into vector signal_regions.push_back( (kinematic_variables[i0] + "_" + basic_signal_regions[i1] + "_cut_" + toString(i2)) ); } } } return signal_regions; } /// Function giving all cut vales per kinematic variable (taking onZ for MET into account) vector getCutsPerSignalRegion(const string& signal_region, int onZ=0) { vector cutValues; // Cut values for HTlep if (signal_region.compare("HTlep") == 0) { cutValues.push_back(0); cutValues.push_back(100); cutValues.push_back(150); cutValues.push_back(200); cutValues.push_back(300); } // Cut values for METStrong (HTjets > 100 GeV) and METWeak (HTjets < 100 GeV) else if (signal_region.compare("METStrong") == 0 || signal_region.compare("METWeak") == 0) { if (onZ == 0) cutValues.push_back(0); else if (onZ == 1) cutValues.push_back(20); cutValues.push_back(50); cutValues.push_back(75); } // Cut values for Meff and MeffStrong (MET > 75 GeV) if (signal_region.compare("Meff") == 0 || signal_region.compare("MeffStrong") == 0) { cutValues.push_back(0); cutValues.push_back(150); cutValues.push_back(300); cutValues.push_back(500); } return cutValues; } /// function fills map EventCountsPerSR by looping over all signal regions /// and looking if the event falls into this signal region void fillEventCountsPerSR(const string& basic_signal_region, int onZ, double HTlep, double eTmiss, double HTjets, double meff, double weight) { // Get cut values for HTlep, loop over them and add event if cut is passed vector cut_values = getCutsPerSignalRegion("HTlep", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (HTlep > cut_values[i]) _eventCountsPerSR[("HTlep_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for METStrong, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("METStrong", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (eTmiss > cut_values[i] && HTjets > 100.) _eventCountsPerSR[("METStrong_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for METWeak, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("METWeak", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (eTmiss > cut_values[i] && HTjets <= 100.) _eventCountsPerSR[("METWeak_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for Meff, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("Meff", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (meff > cut_values[i]) _eventCountsPerSR[("Meff_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for MeffStrong, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("MeffStrong", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (meff > cut_values[i] && eTmiss > 75.) _eventCountsPerSR[("MeffStrong_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } } /// Function returning 4-vector of daughter-particle if it is a tau neutrino /// @todo Move to TauFinder and make less HepMC-ish FourMomentum get_tau_neutrino_mom(const Particle& p) { assert(p.abspid() == PID::TAU); - const GenVertex* dv = p.genParticle()->end_vertex(); + const GenVertexPtr dv = p.genParticle()->end_vertex(); assert(dv != NULL); for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { if (abs((*pp)->pdg_id()) == PID::NU_TAU) return FourMomentum((*pp)->momentum()); } return FourMomentum(); } /// Function calculating the prong number of taus /// @todo Move to TauFinder and make less HepMC-ish - void get_prong_number(const GenParticle* p, unsigned int& nprong, bool& lep_decaying_tau) { + void get_prong_number(const GenParticlePtr p, unsigned int& nprong, bool& lep_decaying_tau) { assert(p != NULL); //const int tau_barcode = p->barcode(); - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); assert(dv != NULL); for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { // If they have status 1 and are charged they will produce a track and the prong number is +1 if ((*pp)->status() == 1 ) { const int id = (*pp)->pdg_id(); if (Rivet::PID::charge(id) != 0 ) ++nprong; // Check if tau decays leptonically // @todo Can a tau decay include a tau in its decay daughters?! if ((abs(id) == PID::ELECTRON || abs(id) == PID::MUON || abs(id) == PID::TAU) && abs(p->pdg_id()) == PID::TAU) lep_decaying_tau = true; } // If the status of the daughter particle is 2 it is unstable and the further decays are checked else if ((*pp)->status() == 2 ) { get_prong_number(*pp, nprong, lep_decaying_tau); } } } /// Function giving fiducial lepton efficiency double apply_reco_eff(int flavor, const Particle& p) { float pt = p.pT()/GeV; float eta = p.eta(); double eff = 0.; //double err = 0.; if (flavor == 11) { // weight prompt electron -- now including data/MC ID SF in eff. //float rho = 0.820; float p0 = 7.34; float p1 = 0.8977; //float ep0= 0.5 ; float ep1= 0.0087; eff = p1 - p0/pt; //double err0 = ep0/pt; // d(eff)/dp0 //double err1 = ep1; // d(eff)/dp1 //err = sqrt(err0*err0 + err1*err1 - 2*rho*err0*err1); double avgrate = 0.6867; float wz_ele_eta[] = {0.588717,0.603674,0.666135,0.747493,0.762202,0.675051,0.751606,0.745569,0.665333,0.610432,0.592693,}; //float ewz_ele_eta[] ={0.00292902,0.002476,0.00241209,0.00182319,0.00194339,0.00299785,0.00197339,0.00182004,0.00241793,0.00245997,0.00290394,}; int ibin = 3; if (eta >= -2.5 && eta < -2.0) ibin = 0; if (eta >= -2.0 && eta < -1.5) ibin = 1; if (eta >= -1.5 && eta < -1.0) ibin = 2; if (eta >= -1.0 && eta < -0.5) ibin = 3; if (eta >= -0.5 && eta < -0.1) ibin = 4; if (eta >= -0.1 && eta < 0.1) ibin = 5; if (eta >= 0.1 && eta < 0.5) ibin = 6; if (eta >= 0.5 && eta < 1.0) ibin = 7; if (eta >= 1.0 && eta < 1.5) ibin = 8; if (eta >= 1.5 && eta < 2.0) ibin = 9; if (eta >= 2.0 && eta < 2.5) ibin = 10; double eff_eta = wz_ele_eta[ibin]; //double err_eta = ewz_ele_eta[ibin]; eff = (eff*eff_eta)/avgrate; } if (flavor == 12) { // weight electron from tau //float rho = 0.884; float p0 = 6.799; float p1 = 0.842; //float ep0= 0.664; float ep1= 0.016; eff = p1 - p0/pt; //double err0 = ep0/pt; // d(eff)/dp0 //double err1 = ep1; // d(eff)/dp1 //err = sqrt(err0*err0 + err1*err1 - 2*rho*err0*err1); double avgrate = 0.5319; float wz_elet_eta[] = {0.468945,0.465953,0.489545,0.58709,0.59669,0.515829,0.59284,0.575828,0.498181,0.463536,0.481738,}; //float ewz_elet_eta[] ={0.00933795,0.00780868,0.00792679,0.00642083,0.00692652,0.0101568,0.00698452,0.00643524,0.0080002,0.00776238,0.0094699,}; int ibin = 3; if (eta >= -2.5 && eta < -2.0) ibin = 0; if (eta >= -2.0 && eta < -1.5) ibin = 1; if (eta >= -1.5 && eta < -1.0) ibin = 2; if (eta >= -1.0 && eta < -0.5) ibin = 3; if (eta >= -0.5 && eta < -0.1) ibin = 4; if (eta >= -0.1 && eta < 0.1) ibin = 5; if (eta >= 0.1 && eta < 0.5) ibin = 6; if (eta >= 0.5 && eta < 1.0) ibin = 7; if (eta >= 1.0 && eta < 1.5) ibin = 8; if (eta >= 1.5 && eta < 2.0) ibin = 9; if (eta >= 2.0 && eta < 2.5) ibin = 10; double eff_eta = wz_elet_eta[ibin]; //double err_eta = ewz_elet_eta[ibin]; eff = (eff*eff_eta)/avgrate; } if (flavor == 13) {// weight prompt muon //if eta>0.1 float p0 = -18.21; float p1 = 14.83; float p2 = 0.9312; //float ep0= 5.06; float ep1= 1.9; float ep2=0.00069; if ( fabs(eta) < 0.1) { p0 = 7.459; p1 = 2.615; p2 = 0.5138; //ep0 = 10.4; ep1 = 4.934; ep2 = 0.0034; } double arg = ( pt-p0 )/( 2.*p1 ) ; eff = 0.5 * p2 * (1.+erf(arg)); //err = 0.1*eff; } if (flavor == 14) {// weight muon from tau if (fabs(eta) < 0.1) { float p0 = -1.756; float p1 = 12.38; float p2 = 0.4441; //float ep0= 10.39; float ep1= 7.9; float ep2=0.022; double arg = ( pt-p0 )/( 2.*p1 ) ; eff = 0.5 * p2 * (1.+erf(arg)); //err = 0.1*eff; } else { float p0 = 2.102; float p1 = 0.8293; //float ep0= 0.271; float ep1= 0.0083; eff = p1 - p0/pt; //double err0 = ep0/pt; // d(eff)/dp0 //double err1 = ep1; // d(eff)/dp1 //err = sqrt(err0*err0 + err1*err1 - 2*rho*err0*err1); } } if (flavor == 15) {// weight hadronic tau 1p float wz_tau1p[] = {0.0249278,0.146978,0.225049,0.229212,0.21519,0.206152,0.201559,0.197917,0.209249,0.228336,0.193548,}; //float ewz_tau1p[] ={0.00178577,0.00425252,0.00535052,0.00592126,0.00484684,0.00612941,0.00792099,0.0083006,0.0138307,0.015568,0.0501751,}; int ibin = 0; if (pt > 15) ibin = 1; if (pt > 20) ibin = 2; if (pt > 25) ibin = 3; if (pt > 30) ibin = 4; if (pt > 40) ibin = 5; if (pt > 50) ibin = 6; if (pt > 60) ibin = 7; if (pt > 80) ibin = 8; if (pt > 100) ibin = 9; if (pt > 200) ibin = 10; eff = wz_tau1p[ibin]; //err = ewz_tau1p[ibin]; double avgrate = 0.1718; float wz_tau1p_eta[] = {0.162132,0.176393,0.139619,0.178813,0.185144,0.210027,0.203937,0.178688,0.137034,0.164216,0.163713,}; //float ewz_tau1p_eta[] ={0.00706705,0.00617989,0.00506798,0.00525172,0.00581865,0.00865675,0.00599245,0.00529877,0.00506368,0.00617025,0.00726219,}; ibin = 3; if (eta >= -2.5 && eta < -2.0) ibin = 0; if (eta >= -2.0 && eta < -1.5) ibin = 1; if (eta >= -1.5 && eta < -1.0) ibin = 2; if (eta >= -1.0 && eta < -0.5) ibin = 3; if (eta >= -0.5 && eta < -0.1) ibin = 4; if (eta >= -0.1 && eta < 0.1) ibin = 5; if (eta >= 0.1 && eta < 0.5) ibin = 6; if (eta >= 0.5 && eta < 1.0) ibin = 7; if (eta >= 1.0 && eta < 1.5) ibin = 8; if (eta >= 1.5 && eta < 2.0) ibin = 9; if (eta >= 2.0 && eta < 2.5) ibin = 10; double eff_eta = wz_tau1p_eta[ibin]; //double err_eta = ewz_tau1p_eta[ibin]; eff = (eff*eff_eta)/avgrate; } if (flavor == 16) { //weight hadronic tau 3p float wz_tau3p[] = {0.000587199,0.00247181,0.0013031,0.00280112,}; //float ewz_tau3p[] ={0.000415091,0.000617187,0.000582385,0.00197792,}; int ibin = 0; if (pt > 15) ibin = 1; if (pt > 20) ibin = 2; if (pt > 40) ibin = 3; if (pt > 80) ibin = 4; eff = wz_tau3p[ibin]; //err = ewz_tau3p[ibin]; } return eff; } /// Function giving observed upper limit (visible cross-section) double getUpperLimit(const string& signal_region, bool observed) { map upperLimitsObserved; upperLimitsObserved["HTlep_3l_offZ_cut_0"] = 11.; upperLimitsObserved["HTlep_3l_offZ_cut_100"] = 8.7; upperLimitsObserved["HTlep_3l_offZ_cut_150"] = 4.0; upperLimitsObserved["HTlep_3l_offZ_cut_200"] = 4.4; upperLimitsObserved["HTlep_3l_offZ_cut_300"] = 1.6; upperLimitsObserved["HTlep_2ltau_offZ_cut_0"] = 25.; upperLimitsObserved["HTlep_2ltau_offZ_cut_100"] = 14.; upperLimitsObserved["HTlep_2ltau_offZ_cut_150"] = 6.1; upperLimitsObserved["HTlep_2ltau_offZ_cut_200"] = 3.3; upperLimitsObserved["HTlep_2ltau_offZ_cut_300"] = 1.2; upperLimitsObserved["HTlep_3l_onZ_cut_0"] = 48.; upperLimitsObserved["HTlep_3l_onZ_cut_100"] = 38.; upperLimitsObserved["HTlep_3l_onZ_cut_150"] = 14.; upperLimitsObserved["HTlep_3l_onZ_cut_200"] = 7.2; upperLimitsObserved["HTlep_3l_onZ_cut_300"] = 4.5; upperLimitsObserved["HTlep_2ltau_onZ_cut_0"] = 85.; upperLimitsObserved["HTlep_2ltau_onZ_cut_100"] = 53.; upperLimitsObserved["HTlep_2ltau_onZ_cut_150"] = 11.0; upperLimitsObserved["HTlep_2ltau_onZ_cut_200"] = 5.2; upperLimitsObserved["HTlep_2ltau_onZ_cut_300"] = 3.0; upperLimitsObserved["METStrong_3l_offZ_cut_0"] = 2.6; upperLimitsObserved["METStrong_3l_offZ_cut_50"] = 2.1; upperLimitsObserved["METStrong_3l_offZ_cut_75"] = 2.1; upperLimitsObserved["METStrong_2ltau_offZ_cut_0"] = 4.2; upperLimitsObserved["METStrong_2ltau_offZ_cut_50"] = 3.1; upperLimitsObserved["METStrong_2ltau_offZ_cut_75"] = 2.6; upperLimitsObserved["METStrong_3l_onZ_cut_20"] = 11.0; upperLimitsObserved["METStrong_3l_onZ_cut_50"] = 6.4; upperLimitsObserved["METStrong_3l_onZ_cut_75"] = 5.1; upperLimitsObserved["METStrong_2ltau_onZ_cut_20"] = 5.9; upperLimitsObserved["METStrong_2ltau_onZ_cut_50"] = 3.4; upperLimitsObserved["METStrong_2ltau_onZ_cut_75"] = 1.2; upperLimitsObserved["METWeak_3l_offZ_cut_0"] = 11.; upperLimitsObserved["METWeak_3l_offZ_cut_50"] = 5.3; upperLimitsObserved["METWeak_3l_offZ_cut_75"] = 3.1; upperLimitsObserved["METWeak_2ltau_offZ_cut_0"] = 23.; upperLimitsObserved["METWeak_2ltau_offZ_cut_50"] = 4.3; upperLimitsObserved["METWeak_2ltau_offZ_cut_75"] = 3.1; upperLimitsObserved["METWeak_3l_onZ_cut_20"] = 41.; upperLimitsObserved["METWeak_3l_onZ_cut_50"] = 16.; upperLimitsObserved["METWeak_3l_onZ_cut_75"] = 8.0; upperLimitsObserved["METWeak_2ltau_onZ_cut_20"] = 80.; upperLimitsObserved["METWeak_2ltau_onZ_cut_50"] = 4.4; upperLimitsObserved["METWeak_2ltau_onZ_cut_75"] = 1.8; upperLimitsObserved["Meff_3l_offZ_cut_0"] = 11.; upperLimitsObserved["Meff_3l_offZ_cut_150"] = 8.1; upperLimitsObserved["Meff_3l_offZ_cut_300"] = 3.1; upperLimitsObserved["Meff_3l_offZ_cut_500"] = 2.1; upperLimitsObserved["Meff_2ltau_offZ_cut_0"] = 25.; upperLimitsObserved["Meff_2ltau_offZ_cut_150"] = 12.; upperLimitsObserved["Meff_2ltau_offZ_cut_300"] = 3.9; upperLimitsObserved["Meff_2ltau_offZ_cut_500"] = 2.2; upperLimitsObserved["Meff_3l_onZ_cut_0"] = 48.; upperLimitsObserved["Meff_3l_onZ_cut_150"] = 37.; upperLimitsObserved["Meff_3l_onZ_cut_300"] = 11.; upperLimitsObserved["Meff_3l_onZ_cut_500"] = 4.8; upperLimitsObserved["Meff_2ltau_onZ_cut_0"] = 85.; upperLimitsObserved["Meff_2ltau_onZ_cut_150"] = 28.; upperLimitsObserved["Meff_2ltau_onZ_cut_300"] = 5.9; upperLimitsObserved["Meff_2ltau_onZ_cut_500"] = 1.9; upperLimitsObserved["MeffStrong_3l_offZ_cut_0"] = 3.8; upperLimitsObserved["MeffStrong_3l_offZ_cut_150"] = 3.8; upperLimitsObserved["MeffStrong_3l_offZ_cut_300"] = 2.8; upperLimitsObserved["MeffStrong_3l_offZ_cut_500"] = 2.1; upperLimitsObserved["MeffStrong_2ltau_offZ_cut_0"] = 3.9; upperLimitsObserved["MeffStrong_2ltau_offZ_cut_150"] = 4.0; upperLimitsObserved["MeffStrong_2ltau_offZ_cut_300"] = 2.9; upperLimitsObserved["MeffStrong_2ltau_offZ_cut_500"] = 1.5; upperLimitsObserved["MeffStrong_3l_onZ_cut_0"] = 10.0; upperLimitsObserved["MeffStrong_3l_onZ_cut_150"] = 10.0; upperLimitsObserved["MeffStrong_3l_onZ_cut_300"] = 6.8; upperLimitsObserved["MeffStrong_3l_onZ_cut_500"] = 3.9; upperLimitsObserved["MeffStrong_2ltau_onZ_cut_0"] = 1.6; upperLimitsObserved["MeffStrong_2ltau_onZ_cut_150"] = 1.4; upperLimitsObserved["MeffStrong_2ltau_onZ_cut_300"] = 1.5; upperLimitsObserved["MeffStrong_2ltau_onZ_cut_500"] = 0.9; // Expected upper limits are also given but not used in this analysis map upperLimitsExpected; upperLimitsExpected["HTlep_3l_offZ_cut_0"] = 11.; upperLimitsExpected["HTlep_3l_offZ_cut_100"] = 8.5; upperLimitsExpected["HTlep_3l_offZ_cut_150"] = 4.6; upperLimitsExpected["HTlep_3l_offZ_cut_200"] = 3.6; upperLimitsExpected["HTlep_3l_offZ_cut_300"] = 1.9; upperLimitsExpected["HTlep_2ltau_offZ_cut_0"] = 23.; upperLimitsExpected["HTlep_2ltau_offZ_cut_100"] = 14.; upperLimitsExpected["HTlep_2ltau_offZ_cut_150"] = 6.4; upperLimitsExpected["HTlep_2ltau_offZ_cut_200"] = 3.6; upperLimitsExpected["HTlep_2ltau_offZ_cut_300"] = 1.5; upperLimitsExpected["HTlep_3l_onZ_cut_0"] = 33.; upperLimitsExpected["HTlep_3l_onZ_cut_100"] = 25.; upperLimitsExpected["HTlep_3l_onZ_cut_150"] = 12.; upperLimitsExpected["HTlep_3l_onZ_cut_200"] = 6.5; upperLimitsExpected["HTlep_3l_onZ_cut_300"] = 3.1; upperLimitsExpected["HTlep_2ltau_onZ_cut_0"] = 94.; upperLimitsExpected["HTlep_2ltau_onZ_cut_100"] = 61.; upperLimitsExpected["HTlep_2ltau_onZ_cut_150"] = 9.9; upperLimitsExpected["HTlep_2ltau_onZ_cut_200"] = 4.5; upperLimitsExpected["HTlep_2ltau_onZ_cut_300"] = 1.9; upperLimitsExpected["METStrong_3l_offZ_cut_0"] = 3.1; upperLimitsExpected["METStrong_3l_offZ_cut_50"] = 2.4; upperLimitsExpected["METStrong_3l_offZ_cut_75"] = 2.3; upperLimitsExpected["METStrong_2ltau_offZ_cut_0"] = 4.8; upperLimitsExpected["METStrong_2ltau_offZ_cut_50"] = 3.3; upperLimitsExpected["METStrong_2ltau_offZ_cut_75"] = 2.1; upperLimitsExpected["METStrong_3l_onZ_cut_20"] = 8.7; upperLimitsExpected["METStrong_3l_onZ_cut_50"] = 4.9; upperLimitsExpected["METStrong_3l_onZ_cut_75"] = 3.8; upperLimitsExpected["METStrong_2ltau_onZ_cut_20"] = 7.3; upperLimitsExpected["METStrong_2ltau_onZ_cut_50"] = 2.8; upperLimitsExpected["METStrong_2ltau_onZ_cut_75"] = 1.5; upperLimitsExpected["METWeak_3l_offZ_cut_0"] = 10.; upperLimitsExpected["METWeak_3l_offZ_cut_50"] = 4.7; upperLimitsExpected["METWeak_3l_offZ_cut_75"] = 3.0; upperLimitsExpected["METWeak_2ltau_offZ_cut_0"] = 21.; upperLimitsExpected["METWeak_2ltau_offZ_cut_50"] = 4.0; upperLimitsExpected["METWeak_2ltau_offZ_cut_75"] = 2.6; upperLimitsExpected["METWeak_3l_onZ_cut_20"] = 30.; upperLimitsExpected["METWeak_3l_onZ_cut_50"] = 10.; upperLimitsExpected["METWeak_3l_onZ_cut_75"] = 5.4; upperLimitsExpected["METWeak_2ltau_onZ_cut_20"] = 88.; upperLimitsExpected["METWeak_2ltau_onZ_cut_50"] = 5.5; upperLimitsExpected["METWeak_2ltau_onZ_cut_75"] = 2.2; upperLimitsExpected["Meff_3l_offZ_cut_0"] = 11.; upperLimitsExpected["Meff_3l_offZ_cut_150"] = 8.8; upperLimitsExpected["Meff_3l_offZ_cut_300"] = 3.7; upperLimitsExpected["Meff_3l_offZ_cut_500"] = 2.1; upperLimitsExpected["Meff_2ltau_offZ_cut_0"] = 23.; upperLimitsExpected["Meff_2ltau_offZ_cut_150"] = 13.; upperLimitsExpected["Meff_2ltau_offZ_cut_300"] = 4.9; upperLimitsExpected["Meff_2ltau_offZ_cut_500"] = 2.4; upperLimitsExpected["Meff_3l_onZ_cut_0"] = 33.; upperLimitsExpected["Meff_3l_onZ_cut_150"] = 25.; upperLimitsExpected["Meff_3l_onZ_cut_300"] = 9.; upperLimitsExpected["Meff_3l_onZ_cut_500"] = 3.9; upperLimitsExpected["Meff_2ltau_onZ_cut_0"] = 94.; upperLimitsExpected["Meff_2ltau_onZ_cut_150"] = 35.; upperLimitsExpected["Meff_2ltau_onZ_cut_300"] = 6.8; upperLimitsExpected["Meff_2ltau_onZ_cut_500"] = 2.5; upperLimitsExpected["MeffStrong_3l_offZ_cut_0"] = 3.9; upperLimitsExpected["MeffStrong_3l_offZ_cut_150"] = 3.9; upperLimitsExpected["MeffStrong_3l_offZ_cut_300"] = 3.0; upperLimitsExpected["MeffStrong_3l_offZ_cut_500"] = 2.0; upperLimitsExpected["MeffStrong_2ltau_offZ_cut_0"] = 3.8; upperLimitsExpected["MeffStrong_2ltau_offZ_cut_150"] = 3.9; upperLimitsExpected["MeffStrong_2ltau_offZ_cut_300"] = 3.1; upperLimitsExpected["MeffStrong_2ltau_offZ_cut_500"] = 1.6; upperLimitsExpected["MeffStrong_3l_onZ_cut_0"] = 6.9; upperLimitsExpected["MeffStrong_3l_onZ_cut_150"] = 7.1; upperLimitsExpected["MeffStrong_3l_onZ_cut_300"] = 4.9; upperLimitsExpected["MeffStrong_3l_onZ_cut_500"] = 3.0; upperLimitsExpected["MeffStrong_2ltau_onZ_cut_0"] = 2.4; upperLimitsExpected["MeffStrong_2ltau_onZ_cut_150"] = 2.5; upperLimitsExpected["MeffStrong_2ltau_onZ_cut_300"] = 2.0; upperLimitsExpected["MeffStrong_2ltau_onZ_cut_500"] = 1.1; if (observed) return upperLimitsObserved[signal_region]; else return upperLimitsExpected[signal_region]; } /// Function checking if there is an OSSF lepton pair or a combination of 3 leptons with an invariant mass close to the Z mass /// @todo Should the reference Z mass be 91.2? int isonZ (const Particles& particles) { int onZ = 0; double best_mass_2 = 999.; double best_mass_3 = 999.; // Loop over all 2 particle combinations to find invariant mass of OSSF pair closest to Z mass foreach ( const Particle& p1, particles ) { foreach ( const Particle& p2, particles ) { double mass_difference_2_old = fabs(91.0 - best_mass_2); double mass_difference_2_new = fabs(91.0 - (p1.momentum() + p2.momentum()).mass()/GeV); // If particle combination is OSSF pair calculate mass difference to Z mass if ( (p1.pid()*p2.pid() == -121 || p1.pid()*p2.pid() == -169) ) { // Get invariant mass closest to Z mass if (mass_difference_2_new < mass_difference_2_old) best_mass_2 = (p1.momentum() + p2.momentum()).mass()/GeV; // In case there is an OSSF pair take also 3rd lepton into account (e.g. from FSR and photon to electron conversion) foreach ( const Particle & p3 , particles ) { double mass_difference_3_old = fabs(91.0 - best_mass_3); double mass_difference_3_new = fabs(91.0 - (p1.momentum() + p2.momentum() + p3.momentum()).mass()/GeV); if (mass_difference_3_new < mass_difference_3_old) best_mass_3 = (p1.momentum() + p2.momentum() + p3.momentum()).mass()/GeV; } } } } // Pick the minimum invariant mass of the best OSSF pair combination and the best 3 lepton combination // If this mass is in a 20 GeV window around the Z mass, the event is classified as onZ double best_mass = min(best_mass_2, best_mass_3); if (fabs(91.0 - best_mass) < 20) onZ = 1; return onZ; } //@} private: /// Histograms //@{ Histo1DPtr _h_HTlep_all, _h_HTjets_all, _h_MET_all, _h_Meff_all; Histo1DPtr _h_pt_1_3l, _h_pt_2_3l, _h_pt_3_3l, _h_pt_1_2ltau, _h_pt_2_2ltau, _h_pt_3_2ltau; Histo1DPtr _h_e_n, _h_mu_n, _h_tau_n; Histo1DPtr _h_excluded; //@} /// Fiducial efficiencies to model the effects of the ATLAS detector bool _use_fiducial_lepton_efficiency; /// List of signal regions and event counts per signal region vector _signal_regions; map _eventCountsPerSR; }; DECLARE_RIVET_PLUGIN(ATLAS_2012_I1204447); } diff --git a/src/Analyses/ATLAS_2013_I1243871.cc b/src/Analyses/ATLAS_2013_I1243871.cc --- a/src/Analyses/ATLAS_2013_I1243871.cc +++ b/src/Analyses/ATLAS_2013_I1243871.cc @@ -1,280 +1,280 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Tools/Logging.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/IdentifiedFinalState.hh" #include "Rivet/Projections/VetoedFinalState.hh" #include "Rivet/Projections/FastJets.hh" #include "Rivet/Tools/ParticleIdUtils.hh" #include "Rivet/Particle.hh" namespace Rivet { class ATLAS_2013_I1243871 : public Analysis { public: /// Constructor ATLAS_2013_I1243871() : Analysis("ATLAS_2013_I1243871") { } /// Book histograms and initialise projections before the run void init() { // Set up projections const FinalState fs(-4.5, 4.5); declare(fs, "ALL_FS"); /// Get electrons from truth record IdentifiedFinalState elec_fs(Cuts::abseta < 2.47 && Cuts::pT > 25*GeV); elec_fs.acceptIdPair(PID::ELECTRON); declare(elec_fs, "ELEC_FS"); /// Get muons which pass the initial kinematic cuts: IdentifiedFinalState muon_fs(Cuts::abseta < 2.5 && Cuts::pT > 20*GeV); muon_fs.acceptIdPair(PID::MUON); declare(muon_fs, "MUON_FS"); // Final state used as input for jet-finding. // We include everything except the muons and neutrinos VetoedFinalState jet_input(fs); jet_input.vetoNeutrinos(); jet_input.addVetoPairId(PID::MUON); declare(jet_input, "JET_INPUT"); // Get the jets FastJets jets(jet_input, FastJets::ANTIKT, 0.4); declare(jets, "JETS"); // Book histograms for (size_t d = 0; d < 5; ++d) { _p_b_rho[d] = bookProfile1D(d+1, 1, 1); _p_l_rho[d] = bookProfile1D(d+1, 2, 1); _p_b_Psi[d] = bookProfile1D(d+1, 1, 2); _p_l_Psi[d] = bookProfile1D(d+1, 2, 2); } } /// Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); /// Get the various sets of final state particles const ParticleVector& elecFS = apply(event, "ELEC_FS").particlesByPt(); const ParticleVector& muonFS = apply(event, "MUON_FS").particlesByPt(); // Get all jets with pT > 7 GeV (ATLAS standard jet collection) /// @todo Why rewrite the jets collection as a vector of pointers? const Jets& jets = apply(event, "JETS").jetsByPt(7*GeV); vector allJets; foreach(const Jet& j, jets) allJets.push_back(&j); // Keep any jets that pass the pt cut vector pt_jets; foreach (const Jet* j, allJets) { /// @todo Use direct kinematics access const double pt = j->momentum().pT(); const double eta = j->momentum().eta(); if (pt > 25*GeV && fabs(eta) < 2.5) pt_jets.push_back(j); } // Remove jets too close to an electron vector good_jets; foreach (const Jet* j, pt_jets) { bool isElectron = 0; foreach (const Particle& e, elecFS) { const double elec_jet_dR = deltaR(e.momentum(), j->momentum()); if (elec_jet_dR < 0.2) { isElectron = true; break; } } if (!isElectron) good_jets.push_back(j); } // Classify the event type const size_t nElec = elecFS.size(); const size_t nMuon = muonFS.size(); bool isSemilepton = false, isDilepton = false; if (nElec == 1 && nMuon == 0) { isSemilepton = true; } else if (nElec == 0 && nMuon == 1) { isSemilepton = true; } else if (nElec == 2 && nMuon == 0) { if (charge(elecFS[0]) != charge(elecFS[1])) isDilepton = true; } else if (nElec == 1 && nMuon == 1) { if (charge(elecFS[0]) != charge(muonFS[0])) isDilepton = true; } else if (nElec == 0 && nMuon == 2) { if (charge(muonFS[0]) != charge(muonFS[1])) isDilepton = true; } const bool isGoodEvent = (isSemilepton && good_jets.size() >= 4) || (isDilepton && good_jets.size() >= 2); if (!isGoodEvent) vetoEvent; // Select b-hadrons /// @todo Use built-in identification on Particle, avoid HepMC vector b_hadrons; vector allParticles = particles(event.genEvent()); for (size_t i = 0; i < allParticles.size(); i++) { - const GenParticle* p = allParticles.at(i); + const GenParticlePtr p = allParticles.at(i); if ( !(PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) ) continue; if (p->momentum().perp() < 5*GeV) continue; b_hadrons.push_back(p); } // Select b-jets as those containing a b-hadron /// @todo Use built-in dR < 0.3 Jet tagging, avoid HepMC vector b_jets; foreach (const Jet* j, good_jets) { bool isbJet = false; - foreach (const GenParticle* b, b_hadrons) { + foreach (const GenParticlePtr b, b_hadrons) { /// @todo Use direct momentum accessor / delta functions const FourMomentum hadron = b->momentum(); const double hadron_jet_dR = deltaR(j->momentum(), hadron); if (hadron_jet_dR < 0.3) { isbJet = true; break; } } // Check if it is overlapped to any other jet bool isOverlapped = false; foreach (const Jet* k, allJets) { if (j == k) continue; double dRjj = deltaR(j->momentum(), k->momentum()); if (dRjj < 0.8) { isOverlapped = true; break; } } if (isbJet && !isOverlapped) b_jets.push_back(j); } MSG_DEBUG(b_jets.size() << " b-jets selected"); // Select light-jets as the pair of non-b-jets with invariant mass closest to the W mass /// @todo Use built-in b-tagging (dR < 0.3 defn), avoid HepMC const double nominalW = 80.4*GeV; double deltaM = 500*GeV; const Jet* light1 = NULL; const Jet* light2 = NULL; // NB: const Jets, not const pointers! foreach (const Jet* i, good_jets) { bool isbJet1 = false; - foreach (const GenParticle* b, b_hadrons) { + foreach (const GenParticlePtr b, b_hadrons) { /// @todo Use direct momentum accessor / delta functions const FourMomentum hadron = b->momentum(); const double hadron_jet_dR = deltaR(i->momentum(), hadron); if (hadron_jet_dR < 0.3) { isbJet1 = true; break; } } if (isbJet1) continue; foreach (const Jet* j, good_jets) { bool isbJet2 = false; - foreach (const GenParticle* b, b_hadrons) { + foreach (const GenParticlePtr b, b_hadrons) { FourMomentum hadron = b->momentum(); double hadron_jet_dR = deltaR(j->momentum(), hadron); if (hadron_jet_dR < 0.3) { isbJet2 = true; break; } } if (isbJet2) continue; double invMass = (i->momentum()+j->momentum()).mass(); if (fabs(invMass-nominalW) < deltaM){ deltaM = fabs(invMass - nominalW); light1 = i; light2 = j; } } } // Check that both jets are not overlapped, and populate the light jets list vector light_jets; const bool hasGoodLight = light1 != NULL && light2 != NULL && light1 != light2; if (hasGoodLight) { bool isOverlap1 = false, isOverlap2 = false; foreach (const Jet* j, allJets) { if (light1 == j) continue; const double dR1j = deltaR(light1->momentum(), j->momentum()); if (dR1j < 0.8) { isOverlap1 = true; break; } } foreach (const Jet* j, allJets) { if (light2 == j) continue; const double dR2j = deltaR(light2->momentum(), j->momentum()); if (dR2j < 0.8) { isOverlap2 = true; break; } } if (!isOverlap1 && !isOverlap2) { light_jets.push_back(light1); light_jets.push_back(light2); } } MSG_DEBUG(light_jets.size() << " light jets selected"); // Calculate the jet shapes /// @todo Use C++11 vector/array initialization const double binWidth = 0.04; // -> 10 bins from 0.0-0.4 vector ptEdges; ptEdges += {{ 30, 40, 50, 70, 100, 150 }}; // b-jet shapes MSG_DEBUG("Filling b-jet shapes"); foreach (const Jet* bJet, b_jets) { // Work out jet pT bin and skip this jet if out of range const double jetPt = bJet->momentum().pT(); MSG_DEBUG("Jet pT = " << jetPt/GeV << " GeV"); if (!inRange(jetPt/GeV, 30., 150.)) continue; /// @todo Use YODA bin index lookup tools size_t ipt; for (ipt = 0; ipt < 5; ++ipt) if (inRange(jetPt/GeV, ptEdges[ipt], ptEdges[ipt+1])) break; MSG_DEBUG("Jet pT index = " << ipt); // Calculate jet shape vector rings(10, 0); foreach (const Particle& p, bJet->particles()) { const double dR = deltaR(bJet->momentum(), p.momentum()); const size_t idR = (size_t) floor(dR/binWidth); for (size_t i = idR; i < 10; ++i) rings[i] += p.pT(); } // Fill each dR bin of the histos for this jet pT for (int iBin = 0; iBin < 10; ++iBin) { const double rcenter = 0.02 + iBin*binWidth; const double rhoval = (iBin != 0 ? (rings[iBin]-rings[iBin-1]) : rings[iBin]) / binWidth / rings[9]; const double psival = rings[iBin] / rings[9]; MSG_DEBUG(rcenter << ", " << rhoval << ", " << psival); _p_b_rho[ipt]->fill(rcenter, rhoval, weight); _p_b_Psi[ipt]->fill(rcenter, psival, weight); } } // Light jet shapes MSG_DEBUG("Filling light jet shapes"); foreach (const Jet* lJet, light_jets) { // Work out jet pT bin and skip this jet if out of range const double jetPt = lJet->momentum().pT(); MSG_DEBUG("Jet pT = " << jetPt/GeV << " GeV"); if (!inRange(jetPt/GeV, 30., 150.)) continue; /// @todo Use YODA bin index lookup tools size_t ipt; for (ipt = 0; ipt < 5; ++ipt) if (inRange(jetPt/GeV, ptEdges[ipt], ptEdges[ipt+1])) break; MSG_DEBUG("Jet pT index = " << ipt); // Calculate jet shape vector rings(10, 0); foreach (const Particle& p, lJet->particles()) { const double dR = deltaR(lJet->momentum(), p.momentum()); const size_t idR = (size_t) floor(dR/binWidth); for (size_t i = idR; i < 10; ++i) rings[i] += p.pT(); } // Fill each dR bin of the histos for this jet pT for (int iBin = 0; iBin < 10; ++iBin) { const double rcenter = 0.02 + iBin*binWidth; const double rhoval = (iBin != 0 ? (rings[iBin]-rings[iBin-1]) : rings[iBin]) / binWidth / rings[9]; const double psival = rings[iBin] / rings[9]; _p_l_rho[ipt]->fill(rcenter, rhoval, weight); _p_l_Psi[ipt]->fill(rcenter, psival, weight); } } } private: Profile1DPtr _p_b_rho[5]; Profile1DPtr _p_l_rho[5]; Profile1DPtr _p_b_Psi[5]; Profile1DPtr _p_l_Psi[5]; }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ATLAS_2013_I1243871); } diff --git a/src/Analyses/ATLAS_2014_I1282447.cc b/src/Analyses/ATLAS_2014_I1282447.cc --- a/src/Analyses/ATLAS_2014_I1282447.cc +++ b/src/Analyses/ATLAS_2014_I1282447.cc @@ -1,596 +1,596 @@ // -*- C++ -*- // ATLAS W+c analysis ////////////////////////////////////////////////////////////////////////// /* Description of rivet analysis ATLAS_2014_I1282447 W+c production This rivet routine implements the ATLAS W+c analysis. Apart from those histograms, described and published on HEP Data, here are some helper histograms defined, these are: d02-x01-y01, d02-x01-y02 and d08-x01-y01 are ratios, the nominator ("_plus") and denominator ("_minus") histograms are also given, so that the ratios can be reconstructed if need be (e.g. when running on separate samples). d05 and d06 are ratios over inclusive W production. The routine has to be run on a sample for inclusive W production in order to make sure the denominator ("_winc") is correctly filled. The ratios can be constructed using the following sample code: python divideWCharm.py import yoda hists_wc = yoda.read("Rivet_Wc.yoda") hists_winc = yoda.read("Rivet_Winc.yoda") ## division histograms --> ONLY for different plus minus runs # (merge before using yodamerge Rivet_plus.yoda Rivet_minus.yoda > Rivet_Wc.yoda) d02y01_plus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y01_plus"] d02y01_minus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y01_minus"] ratio_d02y01 = d02y01_plus.divide(d02y01_minus) ratio_d02y01.path = "/ATLAS_2014_I1282447/d02-x01-y01" d02y02_plus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y02_plus"] d02y02_minus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y02_minus"] ratio_d02y02= d02y02_plus.divide(d02y02_minus) ratio_d02y02.path = "/ATLAS_2014_I1282447/d02-x01-y02" d08y01_plus = hists_wc["/ATLAS_2014_I1282447/d08-x01-y01_plus"] d08y01_minus = hists_wc["/ATLAS_2014_I1282447/d08-x01-y01_minus"] ratio_d08y01= d08y01_plus.divide(d08y01_minus) ratio_d08y01.path = "/ATLAS_2014_I1282447/d08-x01-y01" # inclusive cross section h_winc = hists_winc["/ATLAS_2014_I1282447/d05-x01-y01"] h_d = hists_wc["/ATLAS_2014_I1282447/d01-x01-y02"] h_dstar= hists_wc["/ATLAS_2014_I1282447/d01-x01-y03"] ratio_wd = h_d.divide(h_winc) ratio_wd.path = "/ATLAS_2014_I1282447/d05-x01-y02" ratio_wdstar = h_d.divide(h_winc) ratio_wdstar.path = "/ATLAS_2014_I1282447/d05-x01-y03" # pT differential h_winc_plus = hists_winc["/ATLAS_2014_I1282447/d06-x01-y01_winc"] h_winc_minus = hists_winc["/ATLAS_2014_I1282447/d06-x01-y02_winc"] h_wd_plus = hists_wc["/ATLAS_2014_I1282447/d06-x01-y01_wplus"] h_wd_minus = hists_wc["/ATLAS_2014_I1282447/d06-x01-y02_wminus"] h_wdstar_plus = hists_wc["/ATLAS_2014_I1282447/d06-x01-y03_wplus"] h_wdstar_minus = hists_wc["/ATLAS_2014_I1282447/d06-x01-y04_wminus"] ratio_wd_plus = h_wd_plus.divide(h_winc_plus) ratio_wd_plus.path = "/ATLAS_2014_I1282447/d06-x01-y01" ratio_wd_minus = h_wd_plus.divide(h_winc_minus) ratio_wd_minus.path = "/ATLAS_2014_I1282447/d06-x01-y02" ratio_wdstar_plus = h_wdstar_plus.divide(h_winc_plus) ratio_wdstar_plus.path = "/ATLAS_2014_I1282447/d06-x01-y03" ratio_wdstar_minus = h_wdstar_plus.divide(h_winc_minus) ratio_wdstar_minus.path = "/ATLAS_2014_I1282447/d06-x01-y04" ratio_wd_plus = h_wd_plus.divide(h_winc_plus) ratio_wd_plus.path = "/ATLAS_2014_I1282447/d06-x01-y01" ratio_wd_minus = h_wd_plus.divide(h_winc_minus) ratio_wd_minus.path = "/ATLAS_2014_I1282447/d06-x01-y02" h_winc_plus= hists_winc["/ATLAS_2014_I1282447/d06-x01-y01_winc"] h_winc_minus= hists_winc["/ATLAS_2014_I1282447/d06-x01-y02_winc"] ## copy other histograms for plotting d01x01y01= hists_wc["/ATLAS_2014_I1282447/d01-x01-y01"] d01x01y01.path = "/ATLAS_2014_I1282447/d01-x01-y01" d01x01y02= hists_wc["/ATLAS_2014_I1282447/d01-x01-y02"] d01x01y02.path = "/ATLAS_2014_I1282447/d01-x01-y02" d01x01y03= hists_wc["/ATLAS_2014_I1282447/d01-x01-y03"] d01x01y03.path = "/ATLAS_2014_I1282447/d01-x01-y03" d03x01y01= hists_wc["/ATLAS_2014_I1282447/d03-x01-y01"] d03x01y01.path = "/ATLAS_2014_I1282447/d03-x01-y01" d03x01y02= hists_wc["/ATLAS_2014_I1282447/d03-x01-y02"] d03x01y02.path = "/ATLAS_2014_I1282447/d03-x01-y02" d04x01y01= hists_wc["/ATLAS_2014_I1282447/d04-x01-y01"] d04x01y01.path = "/ATLAS_2014_I1282447/d04-x01-y01" d04x01y02= hists_wc["/ATLAS_2014_I1282447/d04-x01-y02"] d04x01y02.path = "/ATLAS_2014_I1282447/d04-x01-y02" d04x01y03= hists_wc["/ATLAS_2014_I1282447/d04-x01-y03"] d04x01y03.path = "/ATLAS_2014_I1282447/d04-x01-y03" d04x01y04= hists_wc["/ATLAS_2014_I1282447/d04-x01-y04"] d04x01y04.path = "/ATLAS_2014_I1282447/d04-x01-y04" d07x01y01= hists_wc["/ATLAS_2014_I1282447/d07-x01-y01"] d07x01y01.path = "/ATLAS_2014_I1282447/d07-x01-y01" yoda.write([ratio_d02y01,ratio_d02y02,ratio_d08y01, ratio_wd ,ratio_wdstar,ratio_wd_plus,ratio_wd_minus ,ratio_wdstar_plus,ratio_wdstar_minus,d01x01y01,d01x01y02,d01x01y03,d03x01y01,d03x01y02,d04x01y01,d04x01y02,d04x01y03,d04x01y04,d07x01y01],"validation.yoda") */ ////////////////////////////////////////////////////////////////////////// #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" #include "Rivet/Projections/ZFinder.hh" #include "Rivet/Projections/WFinder.hh" #include "Rivet/Projections/FastJets.hh" #include "Rivet/Projections/ChargedFinalState.hh" #include "Rivet/Projections/VetoedFinalState.hh" namespace Rivet { class ATLAS_2014_I1282447 : public Analysis { public: /// Constructor ATLAS_2014_I1282447() : Analysis("ATLAS_2014_I1282447") { setNeedsCrossSection(true); } public: /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { /// @todo Initialise and register projections here UnstableFinalState fs; Cut cuts = Cuts::etaIn(-2.5, 2.5) & (Cuts::pT > 20*GeV); /// should use sample WITHOUT QED radiation off the electron WFinder wfinder_born_el(fs, cuts, PID::ELECTRON, 25*GeV, 8000*GeV, 15*GeV, 0.1, WFinder::CLUSTERALL, WFinder::TRACK); declare(wfinder_born_el, "WFinder_born_el"); WFinder wfinder_born_mu(fs, cuts, PID::MUON , 25*GeV, 8000*GeV, 15*GeV, 0.1, WFinder::CLUSTERALL, WFinder::TRACK); declare(wfinder_born_mu, "WFinder_born_mu"); // all hadrons that could be coming from a charm decay -- // -- for safety, use region -3.5 - 3.5 declare(UnstableFinalState(Cuts::abseta <3.5), "hadrons"); // Input for the jets: no neutrinos, no muons, and no electron which passed the electron cuts // also: NO electron, muon or tau (needed due to ATLAS jet truth reconstruction feature) VetoedFinalState veto; veto.addVetoOnThisFinalState(wfinder_born_el); veto.addVetoOnThisFinalState(wfinder_born_mu); veto.addVetoPairId(PID::ELECTRON); veto.addVetoPairId(PID::MUON); veto.addVetoPairId(PID::TAU); FastJets jets(veto, FastJets::ANTIKT, 0.4); declare(jets, "jets"); // Book histograms // charge separated integrated cross sections _hist_wcjet_charge = bookHisto1D("d01-x01-y01"); _hist_wd_charge = bookHisto1D("d01-x01-y02"); _hist_wdstar_charge = bookHisto1D("d01-x01-y03"); // charge integrated total cross sections _hist_wcjet_ratio = bookScatter2D("d02-x01-y01"); _hist_wd_ratio = bookScatter2D("d02-x01-y02"); _hist_wcjet_minus = bookHisto1D("d02-x01-y01_minus"); _hist_wd_minus = bookHisto1D("d02-x01-y02_minus"); _hist_wcjet_plus = bookHisto1D("d02-x01-y01_plus"); _hist_wd_plus = bookHisto1D("d02-x01-y02_plus"); // eta distributions _hist_wplus_wcjet_eta_lep = bookHisto1D("d03-x01-y01"); _hist_wminus_wcjet_eta_lep = bookHisto1D("d03-x01-y02"); _hist_wplus_wdminus_eta_lep = bookHisto1D("d04-x01-y01"); _hist_wminus_wdplus_eta_lep = bookHisto1D("d04-x01-y02"); _hist_wplus_wdstar_eta_lep = bookHisto1D("d04-x01-y03"); _hist_wminus_wdstar_eta_lep = bookHisto1D("d04-x01-y04"); // ratio of cross section (WD over W inclusive) // postprocess! _hist_w_inc = bookHisto1D("d05-x01-y01"); _hist_wd_winc_ratio = bookScatter2D("d05-x01-y02"); _hist_wdstar_winc_ratio = bookScatter2D("d05-x01-y03"); // ratio of cross section (WD over W inclusive -- function of pT of D meson) _hist_wplusd_wplusinc_pt_ratio = bookScatter2D("d06-x01-y01"); _hist_wminusd_wminusinc_pt_ratio = bookScatter2D("d06-x01-y02"); _hist_wplusdstar_wplusinc_pt_ratio = bookScatter2D("d06-x01-y03"); _hist_wminusdstar_wminusinc_pt_ratio = bookScatter2D("d06-x01-y04"); // could use for postprocessing! _hist_wplusd_wplusinc_pt = bookHisto1D("d06-x01-y01_wplus"); _hist_wminusd_wminusinc_pt = bookHisto1D("d06-x01-y02_wminus"); _hist_wplusdstar_wplusinc_pt = bookHisto1D("d06-x01-y03_wplus"); _hist_wminusdstar_wminusinc_pt = bookHisto1D("d06-x01-y04_wminus"); _hist_wplus_winc = bookHisto1D("d06-x01-y01_winc"); _hist_wminus_winc = bookHisto1D("d06-x01-y02_winc"); // jet multiplicity of charge integrated W+cjet cross section (+0 or +1 jet in addition to the charm jet) _hist_wcjet_jets = bookHisto1D("d07-x01-y01"); // jet multiplicity of W+cjet cross section ratio (+0 or +1 jet in addition to the charm jet) _hist_wcjet_jets_ratio = bookScatter2D("d08-x01-y01"); _hist_wcjet_jets_plus = bookHisto1D("d08-x01-y01_plus"); _hist_wcjet_jets_minus = bookHisto1D("d08-x01-y01_minus"); } /// Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); double charge_weight = 0; // account for OS/SS events int lepton_charge = 0; double lepton_eta = 0.; /// Find leptons const WFinder& wfinder_born_el = apply(event, "WFinder_born_el"); const WFinder& wfinder_born_mu = apply(event, "WFinder_born_mu"); if(wfinder_born_el.empty() && wfinder_born_mu.empty() ) { MSG_DEBUG("No W bosons found"); vetoEvent; } bool keepevent = false; //check electrons if(!wfinder_born_el.empty()) { const FourMomentum& nu = wfinder_born_el.constituentNeutrinos()[0].momentum(); if(wfinder_born_el.mT() > 40*GeV && nu.pT() > 25*GeV) { keepevent = true; lepton_charge = wfinder_born_el.constituentLeptons()[0].charge(); lepton_eta = fabs(wfinder_born_el.constituentLeptons()[0].pseudorapidity()); } } //check muons if(!wfinder_born_mu.empty()) { const FourMomentum& nu = wfinder_born_mu.constituentNeutrinos()[0].momentum(); if(wfinder_born_mu.mT() > 40*GeV && nu.pT() > 25*GeV) { keepevent = true; lepton_charge = wfinder_born_mu.constituentLeptons()[0].charge(); lepton_eta = fabs(wfinder_born_mu.constituentLeptons()[0].pseudorapidity()); } } if(!keepevent) { MSG_DEBUG("event does not pass mT and MET cuts"); vetoEvent; } if (lepton_charge > 0) { _hist_wplus_winc->fill(10., weight); _hist_wplus_winc->fill(16., weight); _hist_wplus_winc->fill(30., weight); _hist_wplus_winc->fill(60., weight); _hist_w_inc->fill(+1, weight); } else if (lepton_charge < 0) { _hist_wminus_winc->fill(10., weight); _hist_wminus_winc->fill(16., weight); _hist_wminus_winc->fill(30., weight); _hist_wminus_winc->fill(60., weight); _hist_w_inc->fill(-1, weight); } // Find hadrons in the event const UnstableFinalState& fs = apply(event, "hadrons"); /// FIND Different channels // 1: wcjet // get jets const Jets& jets = apply(event, "jets").jetsByPt(Cuts::pT>25.0*GeV && Cuts::abseta<2.5); // loop over jets to select jets used to match to charm Jets js; int matched_charmHadron = 0; double charm_charge = 0.; int njets = 0; int nj = 0; bool mat_jet = false; double ptcharm = 0; if(matched_charmHadron > -1) { foreach(const Jet& j, jets) { mat_jet = false; njets++; foreach(const Particle& p, fs.particles()) { - const GenParticle* part = p.genParticle(); + const GenParticlePtr part = p.genParticle(); if(p.hasCharm()) { //if(isFromBDecay(p)) continue; if(p.fromBottom()) continue; if(p.pT() < 5*GeV ) continue; if(hasCharmedChildren(part)) continue; if(deltaR(p, j) < 0.3) { mat_jet = true; if(p.pT() > ptcharm) { charm_charge = part->pdg_id(); ptcharm = p.pT(); } } } } if(mat_jet) nj++; } if (charm_charge * lepton_charge > 0) charge_weight = -1; else charge_weight = +1; if(nj == 1) { if (lepton_charge > 0) { _hist_wcjet_charge ->fill( 1, weight*charge_weight); _hist_wcjet_plus ->fill( 0, weight*charge_weight); _hist_wplus_wcjet_eta_lep ->fill(lepton_eta, weight*charge_weight); _hist_wcjet_jets_plus ->fill(njets-1 , weight*charge_weight); } else if (lepton_charge < 0) { _hist_wcjet_charge ->fill( -1, weight*charge_weight); _hist_wcjet_minus ->fill( 0, weight*charge_weight); _hist_wminus_wcjet_eta_lep->fill(lepton_eta, weight*charge_weight); _hist_wcjet_jets_minus ->fill(njets-1 , weight*charge_weight); } _hist_wcjet_jets->fill(njets-1, weight*charge_weight); } } // // 1/2: w+d(*) meson foreach(const Particle& p, fs.particles()) { - const GenParticle* part = p.genParticle(); + const GenParticlePtr part = p.genParticle(); if(p.pT() < 8*GeV) continue; if(fabs(p.eta()) > 2.2) continue; // W+D if(abs(part->pdg_id()) == 411) { if(lepton_charge * part->pdg_id() > 0) charge_weight = -1; else charge_weight = +1; // fill histos if (lepton_charge > 0) { _hist_wd_charge ->fill( 1, weight*charge_weight); _hist_wd_plus ->fill( 0, weight*charge_weight); _hist_wplus_wdminus_eta_lep->fill(lepton_eta, weight*charge_weight); _hist_wplusd_wplusinc_pt ->fill( p.pT(), weight*charge_weight); } else if (lepton_charge < 0) { _hist_wd_charge ->fill( -1, weight*charge_weight); _hist_wd_minus ->fill( 0, weight*charge_weight); _hist_wminus_wdplus_eta_lep->fill(lepton_eta, weight*charge_weight); _hist_wminusd_wminusinc_pt ->fill(p.pT() , weight*charge_weight); } } // W+Dstar if( abs(part->pdg_id()) == 413 ) { if (lepton_charge*part->pdg_id() > 0) charge_weight = -1; else charge_weight = +1; if (lepton_charge > 0) { _hist_wdstar_charge->fill(+1, weight*charge_weight); _hist_wd_plus->fill( 0, weight*charge_weight); _hist_wplus_wdstar_eta_lep->fill( lepton_eta, weight*charge_weight); _hist_wplusdstar_wplusinc_pt->fill( p.pT(), weight*charge_weight); } else if (lepton_charge < 0) { _hist_wdstar_charge->fill(-1, weight*charge_weight); _hist_wd_minus->fill(0, weight*charge_weight); _hist_wminus_wdstar_eta_lep->fill(lepton_eta, weight*charge_weight); _hist_wminusdstar_wminusinc_pt->fill(p.pT(), weight*charge_weight); } } } }// end of analyse function /// Normalise histograms etc., after the run void finalize() { /// @todo Normalise, scale and otherwise manipulate histograms here const double sf( crossSection() / sumOfWeights() ); // norm to cross section // d01 scale(_hist_wcjet_charge, sf); scale(_hist_wd_charge, sf); scale(_hist_wdstar_charge, sf); //d02 scale(_hist_wcjet_plus, sf); scale(_hist_wcjet_minus, sf); scale(_hist_wd_plus, sf); scale(_hist_wd_minus, sf); divide(_hist_wcjet_plus, _hist_wcjet_minus, _hist_wcjet_ratio); divide(_hist_wd_plus, _hist_wd_minus, _hist_wd_ratio ); //d03 scale(_hist_wplus_wcjet_eta_lep, sf); scale(_hist_wminus_wcjet_eta_lep, sf); //d04 scale(_hist_wplus_wdminus_eta_lep, crossSection()/sumOfWeights()); scale(_hist_wminus_wdplus_eta_lep, crossSection()/sumOfWeights()); scale(_hist_wplus_wdstar_eta_lep , crossSection()/sumOfWeights()); scale(_hist_wminus_wdstar_eta_lep, crossSection()/sumOfWeights()); //d05 scale(_hist_w_inc, 0.01 * sf); // in percent --> /100 divide(_hist_wd_charge, _hist_w_inc, _hist_wd_winc_ratio ); divide(_hist_wdstar_charge, _hist_w_inc, _hist_wdstar_winc_ratio); //d06, in percentage! scale(_hist_wplusd_wplusinc_pt, sf); scale(_hist_wminusd_wminusinc_pt, sf); scale(_hist_wplusdstar_wplusinc_pt, sf); scale(_hist_wminusdstar_wminusinc_pt, sf); scale(_hist_wplus_winc, 0.01 * sf); // in percent --> /100 scale(_hist_wminus_winc, 0.01 * sf); // in percent --> /100 divide(_hist_wplusd_wplusinc_pt, _hist_wplus_winc , _hist_wplusd_wplusinc_pt_ratio ); divide(_hist_wminusd_wminusinc_pt, _hist_wminus_winc, _hist_wminusd_wminusinc_pt_ratio ); divide(_hist_wplusdstar_wplusinc_pt, _hist_wplus_winc , _hist_wplusdstar_wplusinc_pt_ratio ); divide(_hist_wminusdstar_wminusinc_pt, _hist_wminus_winc, _hist_wminusdstar_wminusinc_pt_ratio); //d07 scale(_hist_wcjet_jets, sf); //d08 scale(_hist_wcjet_jets_minus, sf); scale(_hist_wcjet_jets_plus, sf); divide(_hist_wcjet_jets_plus, _hist_wcjet_jets_minus , _hist_wcjet_jets_ratio); } //@} private: // Data members like post-cuts event weight counters go here // Check whether particle comes from b-decay bool isFromBDecay(const Particle& p) { bool isfromB = false; if(p.genParticle() == NULL) return false; - const GenParticle* part = p.genParticle(); - const GenVertex* ivtx = const_cast(part->production_vertex()); + const GenParticlePtr part = p.genParticle(); + const GenVertexPtr ivtx = const_cast(part->production_vertex()); while(ivtx) { if(ivtx->particles_in_size() < 1) { isfromB = false; break; } const HepMC::GenVertex::particles_in_const_iterator iPart_invtx = ivtx->particles_in_const_begin(); part = (*iPart_invtx); if(!part) { isfromB = false; break; } isfromB = PID::hasBottom(part->pdg_id()); if(isfromB == true) break; - ivtx = const_cast(part->production_vertex()); + ivtx = const_cast(part->production_vertex()); if( part->pdg_id() == 2212 || !ivtx ) break; // reached beam } return isfromB; } // Check whether particle has charmed children bool hasCharmedChildren(const GenParticle *part) { bool hasCharmedChild = false; if(part == NULL) return false; - const GenVertex* ivtx = const_cast(part->end_vertex()); + const GenVertexPtr ivtx = const_cast(part->end_vertex()); if(ivtx == NULL) return false; // if (ivtx->particles_out_size() < 2) return false; HepMC::GenVertex::particles_out_const_iterator iPart_invtx = ivtx->particles_out_const_begin(); HepMC::GenVertex::particles_out_const_iterator end_invtx = ivtx->particles_out_const_end(); for( ; iPart_invtx != end_invtx; iPart_invtx++ ) { - const GenParticle* p2 = (*iPart_invtx); + const GenParticlePtr p2 = (*iPart_invtx); if( p2 == part) continue; hasCharmedChild = PID::hasCharm(p2->pdg_id()); if(hasCharmedChild == true) break; hasCharmedChild = hasCharmedChildren(p2); if(hasCharmedChild == true) break; } return hasCharmedChild; } private: /// @name Histograms //@{ //d01-x01- Histo1DPtr _hist_wcjet_charge; Histo1DPtr _hist_wd_charge; Histo1DPtr _hist_wdstar_charge; //d02-x01- Scatter2DPtr _hist_wcjet_ratio; Scatter2DPtr _hist_wd_ratio; Histo1DPtr _hist_wcjet_plus; Histo1DPtr _hist_wd_plus; Histo1DPtr _hist_wcjet_minus; Histo1DPtr _hist_wd_minus; //d03-x01- Histo1DPtr _hist_wplus_wcjet_eta_lep; Histo1DPtr _hist_wminus_wcjet_eta_lep; //d04-x01- Histo1DPtr _hist_wplus_wdminus_eta_lep; Histo1DPtr _hist_wminus_wdplus_eta_lep; //d05-x01- Histo1DPtr _hist_wplus_wdstar_eta_lep; Histo1DPtr _hist_wminus_wdstar_eta_lep; // postprocessing histos //d05-x01 Histo1DPtr _hist_w_inc; Scatter2DPtr _hist_wd_winc_ratio; Scatter2DPtr _hist_wdstar_winc_ratio; //d06-x01 Histo1DPtr _hist_wplus_winc; Histo1DPtr _hist_wminus_winc; Scatter2DPtr _hist_wplusd_wplusinc_pt_ratio; Scatter2DPtr _hist_wminusd_wminusinc_pt_ratio; Scatter2DPtr _hist_wplusdstar_wplusinc_pt_ratio; Scatter2DPtr _hist_wminusdstar_wminusinc_pt_ratio; Histo1DPtr _hist_wplusd_wplusinc_pt ; Histo1DPtr _hist_wminusd_wminusinc_pt; Histo1DPtr _hist_wplusdstar_wplusinc_pt; Histo1DPtr _hist_wminusdstar_wminusinc_pt; // d07-x01 Histo1DPtr _hist_wcjet_jets ; //d08-x01 Scatter2DPtr _hist_wcjet_jets_ratio ; Histo1DPtr _hist_wcjet_jets_plus ; Histo1DPtr _hist_wcjet_jets_minus; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ATLAS_2014_I1282447); } diff --git a/src/Analyses/ATLAS_2014_I1306615.cc b/src/Analyses/ATLAS_2014_I1306615.cc --- a/src/Analyses/ATLAS_2014_I1306615.cc +++ b/src/Analyses/ATLAS_2014_I1306615.cc @@ -1,487 +1,487 @@ /* * Rivet routine for H->yy differential cross-sections measurement * arXiv: http://arxiv.org/abs/ARXIV:1407.4222 * HepData: http://hepdata.cedar.ac.uk/view/ins1306615 * Author: Michaela Queitsch-Maitland */ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/DressedLeptons.hh" #include "Rivet/Projections/VetoedFinalState.hh" #include "Rivet/Projections/FastJets.hh" namespace Rivet { class ATLAS_2014_I1306615 : public Analysis { public: // Constructor ATLAS_2014_I1306615() : Analysis("ATLAS_2014_I1306615") { } public: // Book histograms and initialise projections before the run void init() { // Final state // All particles within |eta| < 5.0 const FinalState FS(Cuts::abseta<5.0); declare(FS,"FS"); // Project photons with pT > 25 GeV and |eta| < 2.37 IdentifiedFinalState ph_FS(Cuts::abseta<2.37 && Cuts::pT>25.0*GeV); ph_FS.acceptIdPair(PID::PHOTON); declare(ph_FS, "PH_FS"); // Project photons for dressing IdentifiedFinalState ph_dressing_FS(FS); ph_dressing_FS.acceptIdPair(PID::PHOTON); // Project bare electrons IdentifiedFinalState el_bare_FS(FS); el_bare_FS.acceptIdPair(PID::ELECTRON); declare(el_bare_FS,"el_bare_FS"); // Project dressed electrons with pT > 15 GeV and |eta| < 2.47 DressedLeptons el_dressed_FS(ph_dressing_FS, el_bare_FS, 0.1, Cuts::abseta < 2.47 && Cuts::pT > 15*GeV, true, false); declare(el_dressed_FS,"EL_DRESSED_FS"); // Project bare muons IdentifiedFinalState mu_bare_FS(FS); mu_bare_FS.acceptIdPair(PID::MUON); // Project dressed muons with pT > 15 GeV and |eta| < 2.47 //DressedLeptons mu_dressed_FS(ph_dressing_FS, mu_bare_FS, 0.1, true, -2.47, 2.47, 15.0*GeV, false); DressedLeptons mu_dressed_FS(ph_dressing_FS, mu_bare_FS, 0.1, Cuts::abseta < 2.47 && Cuts::pT > 15*GeV, true, false); declare(mu_dressed_FS,"MU_DRESSED_FS"); // Final state excluding muons and neutrinos (for jet building and photon isolation) VetoedFinalState veto_mu_nu_FS(FS); veto_mu_nu_FS.vetoNeutrinos(); veto_mu_nu_FS.addVetoPairId(PID::MUON); declare(veto_mu_nu_FS, "VETO_MU_NU_FS"); // Build the anti-kT R=0.4 jets, using FinalState particles (vetoing muons and neutrinos) FastJets jets(veto_mu_nu_FS, FastJets::ANTIKT, 0.4); declare(jets, "JETS"); // Book histograms // 1D distributions _h_pT_yy = bookHisto1D(1,1,1); _h_y_yy = bookHisto1D(2,1,1); _h_Njets30 = bookHisto1D(3,1,1); _h_Njets50 = bookHisto1D(4,1,1); _h_pT_j1 = bookHisto1D(5,1,1); _h_y_j1 = bookHisto1D(6,1,1); _h_HT = bookHisto1D(7,1,1); _h_pT_j2 = bookHisto1D(8,1,1); _h_Dy_jj = bookHisto1D(9,1,1); _h_Dphi_yy_jj = bookHisto1D(10,1,1); _h_cosTS_CS = bookHisto1D(11,1,1); _h_cosTS_CS_5bin = bookHisto1D(12,1,1); _h_Dphi_jj = bookHisto1D(13,1,1); _h_pTt_yy = bookHisto1D(14,1,1); _h_Dy_yy = bookHisto1D(15,1,1); _h_tau_jet = bookHisto1D(16,1,1); _h_sum_tau_jet = bookHisto1D(17,1,1); _h_y_j2 = bookHisto1D(18,1,1); _h_pT_j3 = bookHisto1D(19,1,1); _h_m_jj = bookHisto1D(20,1,1); _h_pT_yy_jj = bookHisto1D(21,1,1); // 2D distributions of cosTS_CS x pT_yy _h_cosTS_pTyy_low = bookHisto1D(22,1,1); _h_cosTS_pTyy_high = bookHisto1D(22,1,2); _h_cosTS_pTyy_rest = bookHisto1D(22,1,3); // 2D distributions of Njets x pT_yy _h_pTyy_Njets0 = bookHisto1D(23,1,1); _h_pTyy_Njets1 = bookHisto1D(23,1,2); _h_pTyy_Njets2 = bookHisto1D(23,1,3); _h_pTj1_excl = bookHisto1D(24,1,1); // Fiducial regions _h_fidXSecs = bookHisto1D(29,1,1); } // Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); _weight = weight; // Get final state particles const ParticleVector& FS_ptcls = apply(event, "FS").particles(); const ParticleVector& ptcls_veto_mu_nu = apply(event, "VETO_MU_NU_FS").particles(); const ParticleVector& photons = apply(event, "PH_FS").particlesByPt(); const vector& el_dressed = apply(event, "EL_DRESSED_FS").dressedLeptons(); const vector& mu_dressed = apply(event, "MU_DRESSED_FS").dressedLeptons(); // For isolation calculation float dR_iso = 0.4; float ETcut_iso = 14.0; FourMomentum ET_iso; // Fiducial selection: pT > 25 GeV, |eta| < 2.37 and isolation (in cone deltaR = 0.4) is < 14 GeV vector fid_photons; foreach (const Particle& ph, photons) { // Veto photons from hadron or tau decay if ( fromHadronDecay(ph) ) continue; // Calculate isolation ET_iso = - ph.momentum(); // Loop over fs truth particles (excluding muons and neutrinos) foreach (const Particle& p, ptcls_veto_mu_nu) { // Check if the truth particle is in a cone of 0.4 if ( deltaR(ph.momentum(), p.momentum()) < dR_iso ) ET_iso += p.momentum(); } // Check isolation if ( ET_iso.Et() > ETcut_iso ) continue; // Fill vector of photons passing fiducial selection fid_photons.push_back(&ph); } if(fid_photons.size() < 2) vetoEvent; const FourMomentum& y1 = fid_photons[0]->momentum(); const FourMomentum& y2 = fid_photons[1]->momentum(); double m_yy = (y1 + y2).mass(); // Relative pT cuts if ( y1.pT() < 0.35 * m_yy || y2.pT() < 0.25 * m_yy ) vetoEvent; // Mass window cut if ( m_yy < 105 || m_yy > 160 ) vetoEvent; // -------------------------------------------- // // Passed diphoton baseline fiducial selection! // // -------------------------------------------- // // Electron selection vector good_el; foreach(const DressedLepton& els, el_dressed) { const Particle& el = els.constituentLepton(); if ( el.momentum().pT() < 15 ) continue; if ( fabs(el.momentum().eta()) > 2.47 ) continue; if ( deltaR(el.momentum(), y1) < 0.4 ) continue; if ( deltaR(el.momentum(), y2) < 0.4 ) continue; if ( fromHadronDecay(el) ) continue; // Veto electrons from hadron or tau decay good_el.push_back(&el); } // Muon selection vector good_mu; foreach(const DressedLepton& mus, mu_dressed) { const Particle& mu = mus.constituentLepton(); if ( mu.momentum().pT() < 15 ) continue; if ( fabs(mu.momentum().eta()) > 2.47 ) continue; if ( deltaR(mu.momentum(), y1) < 0.4 ) continue; if ( deltaR(mu.momentum(), y2) < 0.4 ) continue; if ( fromHadronDecay(mu) ) continue; // Veto muons from hadron or tau decay good_mu.push_back(&mu); } // Find prompt, invisible particles for missing ET calculation // Based on VisibleFinalState projection FourMomentum invisible(0,0,0,0); foreach (const Particle& p, FS_ptcls) { // Veto non-prompt particles (from hadron or tau decay) if ( fromHadronDecay(p) ) continue; // Charged particles are visible if ( PID::threeCharge( p.pid() ) != 0 ) continue; // Neutral hadrons are visible if ( PID::isHadron( p.pid() ) ) continue; // Photons are visible if ( p.pid() == PID::PHOTON ) continue; // Gluons are visible (for parton level analyses) if ( p.pid() == PID::GLUON ) continue; // Everything else is invisible invisible += p.momentum(); } double MET = invisible.Et(); // Jet selection // Get jets with pT > 25 GeV and |rapidity| < 4.4 //const Jets& jets = apply(event, "JETS").jetsByPt(25.0*GeV, MAXDOUBLE, -4.4, 4.4, RAPIDITY); const Jets& jets = apply(event, "JETS").jetsByPt(Cuts::pT>25.0*GeV && Cuts::absrap <4.4); vector jets_25; vector jets_30; vector jets_50; foreach (const Jet& jet, jets) { bool passOverlap = true; // Overlap with leading photons if ( deltaR(y1, jet.momentum()) < 0.4 ) passOverlap = false; if ( deltaR(y2, jet.momentum()) < 0.4 ) passOverlap = false; // Overlap with good electrons foreach (const Particle* el, good_el) if ( deltaR(el->momentum(), jet.momentum()) < 0.2 ) passOverlap = false; if ( ! passOverlap ) continue; if ( fabs(jet.momentum().eta()) < 2.4 || ( fabs(jet.momentum().eta()) > 2.4 && jet.momentum().pT() > 30 ) ) jets_25.push_back(&jet); if ( jet.momentum().pT() > 30 ) jets_30.push_back(&jet); if ( jet.momentum().pT() > 50 ) jets_50.push_back(&jet); } // Fiducial regions _h_fidXSecs->fill(1,_weight); if ( jets_30.size() >= 1 ) _h_fidXSecs->fill(2, _weight); if ( jets_30.size() >= 2 ) _h_fidXSecs->fill(3, _weight); if ( jets_30.size() >= 3 ) _h_fidXSecs->fill(4, _weight); if ( jets_30.size() >= 2 && passVBFCuts(y1 + y2, jets_30.at(0)->momentum(), jets_30.at(1)->momentum()) ) _h_fidXSecs->fill(5, _weight); if ( (good_el.size() + good_mu.size()) > 0 ) _h_fidXSecs->fill(6, _weight); if ( MET > 80 ) _h_fidXSecs->fill(7, _weight); // Fill histograms // Inclusive variables _pT_yy = (y1 + y2).pT(); _y_yy = fabs( (y1 + y2).rapidity() ); _cosTS_CS = cosTS_CS(y1, y2); _pTt_yy = pTt(y1, y2); _Dy_yy = fabs( deltaRap(y1, y2) ); _Njets30 = jets_30.size() > 3 ? 3 : jets_30.size(); _Njets50 = jets_50.size() > 3 ? 3 : jets_50.size(); _h_Njets30->fill(_Njets30, _weight); _h_Njets50->fill(_Njets50, _weight); _pT_j1 = jets_30.size() > 0 ? jets_30.at(0)->momentum().pT() : 0.; _pT_j2 = jets_30.size() > 1 ? jets_30.at(1)->momentum().pT() : 0.; _pT_j3 = jets_30.size() > 2 ? jets_30.at(2)->momentum().pT() : 0.; _HT = 0.0; foreach (const Jet* jet, jets_30) _HT += jet->momentum().pT(); _tau_jet = tau_jet_max(y1 + y2, jets_25); _sum_tau_jet = sum_tau_jet(y1 + y2, jets_25); _h_pT_yy ->fill(_pT_yy ,_weight); _h_y_yy ->fill(_y_yy ,_weight); _h_pT_j1 ->fill(_pT_j1 ,_weight); _h_cosTS_CS ->fill(_cosTS_CS ,_weight); _h_cosTS_CS_5bin->fill(_cosTS_CS ,_weight); _h_HT ->fill(_HT ,_weight); _h_pTt_yy ->fill(_pTt_yy ,_weight); _h_Dy_yy ->fill(_Dy_yy ,_weight); _h_tau_jet ->fill(_tau_jet ,_weight); _h_sum_tau_jet ->fill(_sum_tau_jet,_weight); // >=1 jet variables if ( jets_30.size() >= 1 ) { FourMomentum j1 = jets_30[0]->momentum(); _y_j1 = fabs( j1.rapidity() ); _h_pT_j2->fill(_pT_j2 ,_weight); _h_y_j1 ->fill(_y_j1 ,_weight); } // >=2 jet variables if ( jets_30.size() >= 2 ) { FourMomentum j1 = jets_30[0]->momentum(); FourMomentum j2 = jets_30[1]->momentum(); _Dy_jj = fabs( deltaRap(j1, j2) ); _Dphi_jj = fabs( deltaPhi(j1, j2) ); _Dphi_yy_jj = fabs( deltaPhi(y1 + y2, j1 + j2) ); _m_jj = (j1 + j2).mass(); _pT_yy_jj = (y1 + y2 + j1 + j2).pT(); _y_j2 = fabs( j2.rapidity() ); _h_Dy_jj ->fill(_Dy_jj ,_weight); _h_Dphi_jj ->fill(_Dphi_jj ,_weight); _h_Dphi_yy_jj ->fill(_Dphi_yy_jj,_weight); _h_m_jj ->fill(_m_jj ,_weight); _h_pT_yy_jj ->fill(_pT_yy_jj ,_weight); _h_pT_j3 ->fill(_pT_j3 ,_weight); _h_y_j2 ->fill(_y_j2 ,_weight); } // 2D distributions of cosTS_CS x pT_yy if ( _pT_yy < 80 ) _h_cosTS_pTyy_low->fill(_cosTS_CS, _weight); else if ( _pT_yy > 80 && _pT_yy < 200 ) _h_cosTS_pTyy_high->fill(_cosTS_CS,_weight); else if ( _pT_yy > 200 ) _h_cosTS_pTyy_rest->fill(_cosTS_CS,_weight); // 2D distributions of pT_yy x Njets if ( _Njets30 == 0 ) _h_pTyy_Njets0->fill(_pT_yy, _weight); else if ( _Njets30 == 1 ) _h_pTyy_Njets1->fill(_pT_yy, _weight); else if ( _Njets30 >= 2 ) _h_pTyy_Njets2->fill(_pT_yy, _weight); if ( _Njets30 == 1 ) _h_pTj1_excl->fill(_pT_j1, _weight); } // Normalise histograms after the run void finalize() { const double xs = crossSectionPerEvent()/femtobarn; scale(_h_pT_yy, xs); scale(_h_y_yy, xs); scale(_h_pT_j1, xs); scale(_h_y_j1, xs); scale(_h_HT, xs); scale(_h_pT_j2, xs); scale(_h_Dy_jj, xs); scale(_h_Dphi_yy_jj, xs); scale(_h_cosTS_CS, xs); scale(_h_cosTS_CS_5bin, xs); scale(_h_Dphi_jj, xs); scale(_h_pTt_yy, xs); scale(_h_Dy_yy, xs); scale(_h_tau_jet, xs); scale(_h_sum_tau_jet, xs); scale(_h_y_j2, xs); scale(_h_pT_j3, xs); scale(_h_m_jj, xs); scale(_h_pT_yy_jj, xs); scale(_h_cosTS_pTyy_low, xs); scale(_h_cosTS_pTyy_high, xs); scale(_h_cosTS_pTyy_rest, xs); scale(_h_pTyy_Njets0, xs); scale(_h_pTyy_Njets1, xs); scale(_h_pTyy_Njets2, xs); scale(_h_pTj1_excl, xs); scale(_h_Njets30, xs); scale(_h_Njets50, xs); scale(_h_fidXSecs, xs); } // Trace event record to see if particle came from a hadron (or a tau from a hadron decay) // Based on fromDecay() function bool fromHadronDecay(const Particle& p ) { - const GenVertex* prodVtx = p.genParticle()->production_vertex(); + const GenVertexPtr prodVtx = p.genParticle()->production_vertex(); if (prodVtx == NULL) return false; - foreach (const GenParticle* ancestor, particles(prodVtx, HepMC::ancestors)) { + foreach (const GenParticlePtr ancestor, particles(prodVtx, HepMC::ancestors)) { const PdgId pid = ancestor->pdg_id(); if (ancestor->status() == 2 && PID::isHadron(pid)) return true; if (ancestor->status() == 2 && (abs(pid) == PID::TAU && fromHadronDecay(ancestor))) return true; } return false; } // VBF-enhanced dijet topology selection cuts bool passVBFCuts(const FourMomentum &H, const FourMomentum &j1, const FourMomentum &j2) { return ( fabs(deltaRap(j1, j2)) > 2.8 && (j1 + j2).mass() > 400 && fabs(deltaPhi(H, j1 + j2)) > 2.6 ); } // Cosine of the decay angle in the Collins-Soper frame double cosTS_CS(const FourMomentum &y1, const FourMomentum &y2) { return fabs( ( (y1.E() + y1.pz())* (y2.E() - y2.pz()) - (y1.E() - y1.pz()) * (y2.E() + y2.pz()) ) / ((y1 + y2).mass() * sqrt(pow((y1 + y2).mass(), 2) + pow((y1 + y2).pt(), 2)) ) ); } // Diphoton pT along thrust axis double pTt(const FourMomentum &y1, const FourMomentum &y2) { return fabs(y1.px() * y2.py() - y2.px() * y1.py()) / (y1 - y2).pT()*2; } // Tau of jet (see paper for description) // tau_jet = mT/(2*cosh(y*)), where mT = pT (+) m, and y* = rapidty in Higgs rest frame double tau_jet( const FourMomentum &H, const FourMomentum &jet ) { return sqrt( pow(jet.pT(),2) + pow(jet.mass(),2) ) / (2.0 * cosh( jet.rapidity() - H.rapidity() ) ); } // Maximal (leading) tau_jet (see paper for description) double tau_jet_max( const FourMomentum &H, const vector jets, double tau_jet_cut = 8. ) { double max_tj = 0; for (size_t i=0; i < jets.size(); ++i) { FourMomentum jet = jets[i]->momentum(); if ( tau_jet(H, jet) > tau_jet_cut ) max_tj = max( tau_jet(H, jet), max_tj ); } return max_tj; } // Scalar sum of tau for all jets (see paper for description) double sum_tau_jet( const FourMomentum &H, const vector jets, double tau_jet_cut = 8. ) { double sum_tj = 0; for (size_t i=0; i < jets.size(); ++i) { FourMomentum jet = jets[i]->momentum(); if ( tau_jet(H, jet) > tau_jet_cut ) sum_tj += tau_jet(H, jet); } return sum_tj; } private: Histo1DPtr _h_pT_yy; Histo1DPtr _h_y_yy; Histo1DPtr _h_Njets30; Histo1DPtr _h_Njets50; Histo1DPtr _h_pT_j1; Histo1DPtr _h_y_j1; Histo1DPtr _h_HT; Histo1DPtr _h_pT_j2; Histo1DPtr _h_Dy_jj; Histo1DPtr _h_Dphi_yy_jj; Histo1DPtr _h_cosTS_CS; Histo1DPtr _h_cosTS_CS_5bin; Histo1DPtr _h_Dphi_jj; Histo1DPtr _h_pTt_yy; Histo1DPtr _h_Dy_yy; Histo1DPtr _h_tau_jet; Histo1DPtr _h_sum_tau_jet; Histo1DPtr _h_y_j2; Histo1DPtr _h_pT_j3; Histo1DPtr _h_m_jj; Histo1DPtr _h_pT_yy_jj; Histo1DPtr _h_cosTS_pTyy_low; Histo1DPtr _h_cosTS_pTyy_high; Histo1DPtr _h_cosTS_pTyy_rest; Histo1DPtr _h_pTyy_Njets0; Histo1DPtr _h_pTyy_Njets1; Histo1DPtr _h_pTyy_Njets2; Histo1DPtr _h_pTj1_excl; Histo1DPtr _h_fidXSecs; double _weight; int _Njets30; int _Njets50; double _pT_yy; double _y_yy; double _cosTS_CS; double _pT_j1; double _m_jj; double _y_j1; double _HT; double _pT_j2; double _y_j2; double _Dphi_yy_jj; double _pT_yy_jj; double _Dphi_jj; double _Dy_jj; double _pT_j3; double _pTt_yy; double _Dy_yy; double _tau_jet; double _sum_tau_jet; }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ATLAS_2014_I1306615); } diff --git a/src/Analyses/ATLAS_2014_I1327229.cc b/src/Analyses/ATLAS_2014_I1327229.cc --- a/src/Analyses/ATLAS_2014_I1327229.cc +++ b/src/Analyses/ATLAS_2014_I1327229.cc @@ -1,1330 +1,1330 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/ChargedFinalState.hh" #include "Rivet/Projections/VisibleFinalState.hh" #include "Rivet/Projections/VetoedFinalState.hh" #include "Rivet/Projections/IdentifiedFinalState.hh" #include "Rivet/Projections/UnstableFinalState.hh" #include "Rivet/Projections/FastJets.hh" namespace Rivet { class ATLAS_2014_I1327229 : public Analysis { public: /// Constructor ATLAS_2014_I1327229() : Analysis("ATLAS_2014_I1327229") { } /// Book histograms and initialise projections before the run void init() { // To calculate the acceptance without having the fiducial lepton efficiencies included, this part can be turned off _use_fiducial_lepton_efficiency = true; // Random numbers for simulation of ATLAS detector reconstruction efficiency /// @todo Replace with SmearedParticles etc. srand(160385); // Read in all signal regions _signal_regions = getSignalRegions(); // Set number of events per signal region to 0 for (size_t i = 0; i < _signal_regions.size(); i++) _eventCountsPerSR[_signal_regions[i]] = 0.0; // Final state including all charged and neutral particles const FinalState fs(-5.0, 5.0, 1*GeV); declare(fs, "FS"); // Final state including all charged particles declare(ChargedFinalState(-2.5, 2.5, 1*GeV), "CFS"); // Final state including all visible particles (to calculate MET, Jets etc.) declare(VisibleFinalState(-5.0,5.0),"VFS"); // Final state including all AntiKt 04 Jets VetoedFinalState vfs; vfs.addVetoPairId(PID::MUON); declare(FastJets(vfs, FastJets::ANTIKT, 0.4), "AntiKtJets04"); // Final state including all unstable particles (including taus) declare(UnstableFinalState(Cuts::abseta < 5.0 && Cuts::pT > 5*GeV),"UFS"); // Final state including all electrons IdentifiedFinalState elecs(Cuts::abseta < 2.47 && Cuts::pT > 10*GeV); elecs.acceptIdPair(PID::ELECTRON); declare(elecs, "elecs"); // Final state including all muons IdentifiedFinalState muons(Cuts::abseta < 2.5 && Cuts::pT > 10*GeV); muons.acceptIdPair(PID::MUON); declare(muons, "muons"); /// Book histograms: _h_HTlep_all = bookHisto1D("HTlep_all", 30,0,3000); _h_HTjets_all = bookHisto1D("HTjets_all", 30,0,3000); _h_MET_all = bookHisto1D("MET_all", 30,0,1500); _h_Meff_all = bookHisto1D("Meff_all", 50,0,5000); _h_min_pT_all = bookHisto1D("min_pT_all", 50, 0, 2000); _h_mT_all = bookHisto1D("mT_all", 50, 0, 2000); _h_e_n = bookHisto1D("e_n", 10, -0.5, 9.5); _h_mu_n = bookHisto1D("mu_n", 10, -0.5, 9.5); _h_tau_n = bookHisto1D("tau_n", 10, -0.5, 9.5); _h_pt_1_3l = bookHisto1D("pt_1_3l", 100, 0, 2000); _h_pt_2_3l = bookHisto1D("pt_2_3l", 100, 0, 2000); _h_pt_3_3l = bookHisto1D("pt_3_3l", 100, 0, 2000); _h_pt_1_2ltau = bookHisto1D("pt_1_2ltau", 100, 0, 2000); _h_pt_2_2ltau = bookHisto1D("pt_2_2ltau", 100, 0, 2000); _h_pt_3_2ltau = bookHisto1D("pt_3_2ltau", 100, 0, 2000); _h_excluded = bookHisto1D("excluded", 2, -0.5, 1.5); } /// Perform the per-event analysis void analyze(const Event& event) { // Muons Particles muon_candidates; const Particles charged_tracks = apply(event, "CFS").particles(); const Particles visible_particles = apply(event, "VFS").particles(); for (const Particle& mu : apply(event, "muons").particlesByPt() ) { // Calculate pTCone30 variable (pT of all tracks within dR<0.3 - pT of muon itself) double pTinCone = -mu.pT(); for (const Particle& track : charged_tracks ) { if (deltaR(mu.momentum(),track.momentum()) < 0.3 ) pTinCone += track.pT(); } // Calculate eTCone30 variable (pT of all visible particles within dR<0.3) double eTinCone = 0.; for (const Particle& visible_particle : visible_particles) { if (visible_particle.abspid() != PID::MUON && inRange(deltaR(mu.momentum(),visible_particle.momentum()), 0.1, 0.3)) eTinCone += visible_particle.pT(); } // Apply reconstruction efficiency and simulate reconstruction int muon_id = 13; if (mu.hasAncestor(PID::TAU) || mu.hasAncestor(-PID::TAU)) muon_id = 14; const double eff = (_use_fiducial_lepton_efficiency) ? apply_reco_eff(muon_id,mu) : 1.0; const bool keep_muon = rand()/static_cast(RAND_MAX)<=eff; // Keep muon if pTCone30/pT < 0.15 and eTCone30/pT < 0.2 and reconstructed if (keep_muon && pTinCone/mu.pT() <= 0.1 && eTinCone/mu.pT() < 0.1) muon_candidates.push_back(mu); } // Electrons Particles electron_candidates; for (const Particle& e : apply(event, "elecs").particlesByPt() ) { // Neglect electrons in crack regions if (inRange(e.abseta(), 1.37, 1.52)) continue; // Calculate pTCone30 variable (pT of all tracks within dR<0.3 - pT of electron itself) double pTinCone = -e.pT(); for (const Particle& track : charged_tracks) { if (deltaR(e.momentum(), track.momentum()) < 0.3 ) pTinCone += track.pT(); } // Calculate eTCone30 variable (pT of all visible particles (except muons) within dR<0.3) double eTinCone = 0.; for (const Particle& visible_particle : visible_particles) { if (visible_particle.abspid() != PID::MUON && inRange(deltaR(e.momentum(),visible_particle.momentum()), 0.1, 0.3)) eTinCone += visible_particle.pT(); } // Apply reconstruction efficiency and simulate reconstruction int elec_id = 11; if (e.hasAncestor(15) || e.hasAncestor(-15)) elec_id = 12; const double eff = (_use_fiducial_lepton_efficiency) ? apply_reco_eff(elec_id,e) : 1.0; const bool keep_elec = rand()/static_cast(RAND_MAX)<=eff; // Keep electron if pTCone30/pT < 0.13 and eTCone30/pT < 0.2 and reconstructed if (keep_elec && pTinCone/e.pT() <= 0.1 && eTinCone/e.pT() < 0.1) electron_candidates.push_back(e); } // Taus Particles tau_candidates; for (const Particle& tau : apply(event, "UFS").particles() ) { // Only pick taus out of all unstable particles if ( tau.abspid() != PID::TAU) continue; // Check that tau has decayed into daughter particles if (tau.genParticle()->end_vertex() == 0) continue; // Calculate visible tau momentum using the tau neutrino momentum in the tau decay FourMomentum daughter_tau_neutrino_momentum = get_tau_neutrino_momentum(tau); Particle tau_vis = tau; tau_vis.setMomentum(tau.momentum()-daughter_tau_neutrino_momentum); // keep only taus in certain eta region and above 15 GeV of visible tau pT if ( tau_vis.pT()/GeV <= 15.0 || tau_vis.abseta() > 2.5) continue; // Get prong number (number of tracks) in tau decay and check if tau decays leptonically unsigned int nprong = 0; bool lep_decaying_tau = false; get_prong_number(tau.genParticle(),nprong,lep_decaying_tau); // Apply reconstruction efficiency and simulate reconstruction int tau_id = 15; if (nprong == 1) tau_id = 15; else if (nprong == 3) tau_id = 16; const double eff = (_use_fiducial_lepton_efficiency) ? apply_reco_eff(tau_id,tau_vis) : 1.0; const bool keep_tau = rand()/static_cast(RAND_MAX)<=eff; // Keep tau if nprong = 1, it decays hadronically and it is reconstructed if ( !lep_decaying_tau && nprong == 1 && keep_tau) tau_candidates.push_back(tau_vis); } // Jets (all anti-kt R=0.4 jets with pT > 30 GeV and eta < 4.9 Jets jet_candidates; for (const Jet& jet : apply(event, "AntiKtJets04").jetsByPt(30.0*GeV) ) { if (jet.abseta() < 4.9 ) jet_candidates.push_back(jet); } // ETmiss Particles vfs_particles = apply(event, "VFS").particles(); FourMomentum pTmiss; for (const Particle& p : vfs_particles) pTmiss -= p.momentum(); double eTmiss = pTmiss.pT()/GeV; // ------------------------- // Overlap removal // electron - electron Particles electron_candidates_2; for(size_t ie = 0; ie < electron_candidates.size(); ++ie) { const Particle& e = electron_candidates[ie]; bool away = true; // If electron pair within dR < 0.1: remove electron with lower pT for(size_t ie2 = 0; ie2 < electron_candidates_2.size(); ++ie2) { if (deltaR(e.momentum(),electron_candidates_2[ie2].momentum()) < 0.1 ) { away = false; break; } } // If isolated keep it if ( away ) electron_candidates_2.push_back( e ); } // jet - electron Jets recon_jets; for (const Jet& jet : jet_candidates) { bool away = true; // If jet within dR < 0.2 of electron: remove jet for (const Particle& e : electron_candidates_2) { if (deltaR(e.momentum(), jet.momentum()) < 0.2 ) { away = false; break; } } // jet - tau if ( away ) { // If jet within dR < 0.2 of tau: remove jet for (const Particle& tau : tau_candidates) { if (deltaR(tau.momentum(), jet.momentum()) < 0.2 ) { away = false; break; } } } // If isolated keep it if ( away ) recon_jets.push_back( jet ); } // electron - jet Particles recon_leptons, recon_e; for (size_t ie = 0; ie < electron_candidates_2.size(); ++ie) { const Particle& e = electron_candidates_2[ie]; // If electron within 0.2 < dR < 0.4 from any jets: remove electron bool away = true; for (const Jet& jet : recon_jets) { if (deltaR(e.momentum(), jet.momentum()) < 0.4 ) { away = false; break; } } // electron - muon // If electron within dR < 0.1 of a muon: remove electron if (away) { for (const Particle& mu : muon_candidates) { if (deltaR(mu.momentum(),e.momentum()) < 0.1) { away = false; break; } } } // If isolated keep it if ( away ) { recon_e.push_back( e ); recon_leptons.push_back( e ); } } // tau - electron Particles recon_tau; for (const Particle& tau : tau_candidates) { bool away = true; // If tau within dR < 0.2 of an electron: remove tau for (const Particle & e : recon_e) { if (deltaR(tau.momentum(),e.momentum()) < 0.2 ) { away = false; break; } } // tau - muon // If tau within dR < 0.2 of a muon: remove tau if (away) { for (const Particle& mu : muon_candidates) { if (deltaR(tau.momentum(), mu.momentum()) < 0.2 ) { away = false; break; } } } // If isolated keep it if (away) recon_tau.push_back( tau ); } // muon - jet Particles recon_mu, trigger_mu; // If muon within dR < 0.4 of a jet: remove muon for (const Particle& mu : muon_candidates ) { bool away = true; for (const Jet& jet : recon_jets) { if (deltaR(mu.momentum(), jet.momentum()) < 0.4 ) { away = false; break; } } if (away) { recon_mu.push_back( mu ); recon_leptons.push_back( mu ); if (mu.abseta() < 2.4) trigger_mu.push_back( mu ); } } // End overlap removal // --------------------- // Jet cleaning if (rand()/static_cast(RAND_MAX) <= 0.42) { for (const Jet& jet : recon_jets ) { const double eta = jet.rapidity(); const double phi = jet.azimuthalAngle(MINUSPI_PLUSPI); if(jet.pT() > 25*GeV && inRange(eta,-0.1,1.5) && inRange(phi,-0.9,-0.5)) vetoEvent; } } // Event selection // Require at least 3 charged tracks in event if (charged_tracks.size() < 3) vetoEvent; // And at least one e/mu passing trigger if( !( !recon_e.empty() && recon_e[0].pT()>26.*GeV) && !( !trigger_mu.empty() && trigger_mu[0].pT()>26.*GeV) ) { MSG_DEBUG("Hardest lepton fails trigger"); vetoEvent; } // And only accept events with at least 2 electrons and muons and at least 3 leptons in total if (recon_mu.size() + recon_e.size() + recon_tau.size() < 3 || recon_leptons.size() < 2) vetoEvent; // Getting the event weight const double weight = event.weight(); // Sort leptons by decreasing pT sortByPt(recon_leptons); sortByPt(recon_tau); // Calculate HTlep, fill lepton pT histograms & store chosen combination of 3 leptons double HTlep = 0.; Particles chosen_leptons; if (recon_leptons.size() > 2) { _h_pt_1_3l->fill(recon_leptons[0].pT()/GeV, weight); _h_pt_2_3l->fill(recon_leptons[1].pT()/GeV, weight); _h_pt_3_3l->fill(recon_leptons[2].pT()/GeV, weight); HTlep = (recon_leptons[0].pT() + recon_leptons[1].pT() + recon_leptons[2].pT())/GeV; chosen_leptons.push_back( recon_leptons[0] ); chosen_leptons.push_back( recon_leptons[1] ); chosen_leptons.push_back( recon_leptons[2] ); } else { _h_pt_1_2ltau->fill(recon_leptons[0].pT()/GeV, weight); _h_pt_2_2ltau->fill(recon_leptons[1].pT()/GeV, weight); _h_pt_3_2ltau->fill(recon_tau[0].pT()/GeV, weight); HTlep = recon_leptons[0].pT()/GeV + recon_leptons[1].pT()/GeV + recon_tau[0].pT()/GeV; chosen_leptons.push_back( recon_leptons[0] ); chosen_leptons.push_back( recon_leptons[1] ); chosen_leptons.push_back( recon_tau[0] ); } // Calculate mT and mTW variable Particles mT_leptons; Particles mTW_leptons; for (size_t i1 = 0; i1 < 3; i1 ++) { for (size_t i2 = i1+1; i2 < 3; i2 ++) { double OSSF_inv_mass = isOSSF_mass(chosen_leptons[i1],chosen_leptons[i2]); if (OSSF_inv_mass != 0.) { for (size_t i3 = 0; i3 < 3 ; i3 ++) { if (i3 != i2 && i3 != i1) { mT_leptons.push_back(chosen_leptons[i3]); if ( fabs(91.0 - OSSF_inv_mass) < 20. ) mTW_leptons.push_back(chosen_leptons[i3]); } } } else { mT_leptons.push_back(chosen_leptons[0]); mTW_leptons.push_back(chosen_leptons[0]); } } } sortByPt(mT_leptons); sortByPt(mTW_leptons); double mT = sqrt(2*pTmiss.pT()/GeV*mT_leptons[0].pT()/GeV*(1-cos(pTmiss.phi()-mT_leptons[0].phi()))); double mTW = sqrt(2*pTmiss.pT()/GeV*mTW_leptons[0].pT()/GeV*(1-cos(pTmiss.phi()-mTW_leptons[0].phi()))); // Calculate Min pT variable double min_pT = chosen_leptons[2].pT()/GeV; // Number of prompt e/mu and had taus _h_e_n->fill(recon_e.size(),weight); _h_mu_n->fill(recon_mu.size(),weight); _h_tau_n->fill(recon_tau.size(),weight); // Calculate HTjets variable double HTjets = 0.; for (const Jet& jet : recon_jets) HTjets += jet.pT()/GeV; // Calculate meff variable double meff = eTmiss + HTjets; Particles all_leptons; for (const Particle& e : recon_e ) { meff += e.pT()/GeV; all_leptons.push_back( e ); } for (const Particle& mu : recon_mu) { meff += mu.pT()/GeV; all_leptons.push_back( mu ); } for (const Particle& tau : recon_tau) { meff += tau.pT()/GeV; all_leptons.push_back( tau ); } // Fill histograms of kinematic variables _h_HTlep_all->fill(HTlep,weight); _h_HTjets_all->fill(HTjets,weight); _h_MET_all->fill(eTmiss,weight); _h_Meff_all->fill(meff,weight); _h_min_pT_all->fill(min_pT,weight); _h_mT_all->fill(mT,weight); // Determine signal region (3l / 2ltau , onZ / offZ OSSF / offZ no-OSSF) // 3l vs. 2ltau string basic_signal_region; if (recon_mu.size() + recon_e.size() > 2) basic_signal_region += "3l_"; else if ( (recon_mu.size() + recon_e.size() == 2) && (recon_tau.size() > 0)) basic_signal_region += "2ltau_"; // Is there an OSSF pair or a three lepton combination with an invariant mass close to the Z mass int onZ = isonZ(chosen_leptons); if (onZ == 1) basic_signal_region += "onZ"; else if (onZ == 0) { bool OSSF = isOSSF(chosen_leptons); if (OSSF) basic_signal_region += "offZ_OSSF"; else basic_signal_region += "offZ_noOSSF"; } // Check in which signal regions this event falls and adjust event counters // INFO: The b-jet signal regions of the paper are not included in this Rivet implementation fillEventCountsPerSR(basic_signal_region,onZ,HTlep,eTmiss,HTjets,meff,min_pT,mTW,weight); } /// Normalise histograms etc., after the run void finalize() { // Normalize to an integrated luminosity of 1 fb-1 double norm = crossSection()/femtobarn/sumOfWeights(); string best_signal_region = ""; double ratio_best_SR = 0.; // Loop over all signal regions and find signal region with best sensitivity (ratio signal events/visible cross-section) for (size_t i = 0; i < _signal_regions.size(); i++) { double signal_events = _eventCountsPerSR[_signal_regions[i]] * norm; // Use expected upper limits to find best signal region: double UL95 = getUpperLimit(_signal_regions[i],false); double ratio = signal_events / UL95; if (ratio > ratio_best_SR) { best_signal_region = _signal_regions.at(i); ratio_best_SR = ratio; } } double signal_events_best_SR = _eventCountsPerSR[best_signal_region] * norm; double exp_UL_best_SR = getUpperLimit(best_signal_region, false); double obs_UL_best_SR = getUpperLimit(best_signal_region, true); // Print out result cout << "----------------------------------------------------------------------------------------" << endl; cout << "Number of total events: " << sumOfWeights() << endl; cout << "Best signal region: " << best_signal_region << endl; cout << "Normalized number of signal events in this best signal region (per fb-1): " << signal_events_best_SR << endl; cout << "Efficiency*Acceptance: " << _eventCountsPerSR[best_signal_region]/sumOfWeights() << endl; cout << "Cross-section [fb]: " << crossSection()/femtobarn << endl; cout << "Expected visible cross-section (per fb-1): " << exp_UL_best_SR << endl; cout << "Ratio (signal events / expected visible cross-section): " << ratio_best_SR << endl; cout << "Observed visible cross-section (per fb-1): " << obs_UL_best_SR << endl; cout << "Ratio (signal events / observed visible cross-section): " << signal_events_best_SR/obs_UL_best_SR << endl; cout << "----------------------------------------------------------------------------------------" << endl; cout << "Using the EXPECTED limits (visible cross-section) of the analysis: " << endl; if (signal_events_best_SR > exp_UL_best_SR) { cout << "Since the number of signal events > the visible cross-section, this model/grid point is EXCLUDED with 95% C.L." << endl; _h_excluded->fill(1); } else { cout << "Since the number of signal events < the visible cross-section, this model/grid point is NOT EXCLUDED." << endl; _h_excluded->fill(0); } cout << "----------------------------------------------------------------------------------------" << endl; cout << "Using the OBSERVED limits (visible cross-section) of the analysis: " << endl; if (signal_events_best_SR > obs_UL_best_SR) { cout << "Since the number of signal events > the visible cross-section, this model/grid point is EXCLUDED with 95% C.L." << endl; _h_excluded->fill(1); } else { cout << "Since the number of signal events < the visible cross-section, this model/grid point is NOT EXCLUDED." << endl; _h_excluded->fill(0); } cout << "----------------------------------------------------------------------------------------" << endl; cout << "INFO: The b-jet signal regions of the paper are not included in this Rivet implementation." << endl; cout << "----------------------------------------------------------------------------------------" << endl; /// Normalize to cross section if (norm != 0) { scale(_h_HTlep_all, norm); scale(_h_HTjets_all, norm); scale(_h_MET_all, norm); scale(_h_Meff_all, norm); scale(_h_min_pT_all, norm); scale(_h_mT_all, norm); scale(_h_pt_1_3l, norm); scale(_h_pt_2_3l, norm); scale(_h_pt_3_3l, norm); scale(_h_pt_1_2ltau, norm); scale(_h_pt_2_2ltau, norm); scale(_h_pt_3_2ltau, norm); scale(_h_e_n, norm); scale(_h_mu_n, norm); scale(_h_tau_n, norm); scale(_h_excluded, norm); } } /// Helper functions //@{ /// Function giving a list of all signal regions vector getSignalRegions() { // List of basic signal regions vector basic_signal_regions; basic_signal_regions.push_back("3l_offZ_OSSF"); basic_signal_regions.push_back("3l_offZ_noOSSF"); basic_signal_regions.push_back("3l_onZ"); basic_signal_regions.push_back("2ltau_offZ_OSSF"); basic_signal_regions.push_back("2ltau_offZ_noOSSF"); basic_signal_regions.push_back("2ltau_onZ"); // List of kinematic variables vector kinematic_variables; kinematic_variables.push_back("HTlep"); kinematic_variables.push_back("METStrong"); kinematic_variables.push_back("METWeak"); kinematic_variables.push_back("Meff"); kinematic_variables.push_back("MeffStrong"); kinematic_variables.push_back("MeffMt"); kinematic_variables.push_back("MinPt"); vector signal_regions; // Loop over all kinematic variables and basic signal regions for (size_t i0 = 0; i0 < kinematic_variables.size(); i0++) { for (size_t i1 = 0; i1 < basic_signal_regions.size(); i1++) { // Is signal region onZ? int onZ = (basic_signal_regions[i1].find("onZ") != string::npos) ? 1 : 0; // Get cut values for this kinematic variable vector cut_values = getCutsPerSignalRegion(kinematic_variables[i0], onZ); // Loop over all cut values for (size_t i2 = 0; i2 < cut_values.size(); i2++) { // Push signal region into vector signal_regions.push_back( kinematic_variables[i0] + "_" + basic_signal_regions[i1] + "_cut_" + toString(cut_values[i2]) ); } } } return signal_regions; } /// Function giving all cut values per kinematic variable vector getCutsPerSignalRegion(const string& signal_region, int onZ = 0) { vector cutValues; // Cut values for HTlep if (signal_region.compare("HTlep") == 0) { cutValues.push_back(0); cutValues.push_back(200); cutValues.push_back(500); cutValues.push_back(800); } // Cut values for MinPt else if (signal_region.compare("MinPt") == 0) { cutValues.push_back(0); cutValues.push_back(50); cutValues.push_back(100); cutValues.push_back(150); } // Cut values for METStrong (HTjets > 150 GeV) and METWeak (HTjets < 150 GeV) else if (signal_region.compare("METStrong") == 0 || signal_region.compare("METWeak") == 0) { cutValues.push_back(0); cutValues.push_back(100); cutValues.push_back(200); cutValues.push_back(300); } // Cut values for Meff if (signal_region.compare("Meff") == 0) { cutValues.push_back(0); cutValues.push_back(600); cutValues.push_back(1000); cutValues.push_back(1500); } // Cut values for MeffStrong (MET > 100 GeV) if ((signal_region.compare("MeffStrong") == 0 || signal_region.compare("MeffMt") == 0) && onZ ==1) { cutValues.push_back(0); cutValues.push_back(600); cutValues.push_back(1200); } return cutValues; } /// function fills map _eventCountsPerSR by looping over all signal regions /// and looking if the event falls into this signal region void fillEventCountsPerSR(const string& basic_signal_region, int onZ, double HTlep, double eTmiss, double HTjets, double meff, double min_pT, double mTW, double weight) { // Get cut values for HTlep, loop over them and add event if cut is passed vector cut_values = getCutsPerSignalRegion("HTlep", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (HTlep > cut_values[i]) _eventCountsPerSR[("HTlep_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for MinPt, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("MinPt", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (min_pT > cut_values[i]) _eventCountsPerSR[("MinPt_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for METStrong, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("METStrong", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (eTmiss > cut_values[i] && HTjets > 150.) _eventCountsPerSR[("METStrong_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for METWeak, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("METWeak", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (eTmiss > cut_values[i] && HTjets <= 150.) _eventCountsPerSR[("METWeak_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for Meff, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("Meff", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (meff > cut_values[i]) _eventCountsPerSR[("Meff_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for MeffStrong, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("MeffStrong", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (meff > cut_values[i] && eTmiss > 100.) _eventCountsPerSR[("MeffStrong_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } // Get cut values for MeffMt, loop over them and add event if cut is passed cut_values = getCutsPerSignalRegion("MeffMt", onZ); for (size_t i = 0; i < cut_values.size(); i++) { if (meff > cut_values[i] && mTW > 100. && onZ == 1) _eventCountsPerSR[("MeffMt_" + basic_signal_region + "_cut_" + toString(cut_values[i]))] += weight; } } /// Function returning 4-momentum of daughter-particle if it is a tau neutrino FourMomentum get_tau_neutrino_momentum(const Particle& p) { assert(p.abspid() == PID::TAU); - const GenVertex* dv = p.genParticle()->end_vertex(); + const GenVertexPtr dv = p.genParticle()->end_vertex(); assert(dv != NULL); // Loop over all daughter particles for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { if (abs((*pp)->pdg_id()) == PID::NU_TAU) return FourMomentum((*pp)->momentum()); } return FourMomentum(); } /// Function calculating the prong number of taus - void get_prong_number(const GenParticle* p, unsigned int& nprong, bool& lep_decaying_tau) { + void get_prong_number(const GenParticlePtr p, unsigned int& nprong, bool& lep_decaying_tau) { assert(p != NULL); - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); assert(dv != NULL); for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { // If they have status 1 and are charged they will produce a track and the prong number is +1 if ((*pp)->status() == 1 ) { const int id = (*pp)->pdg_id(); if (Rivet::PID::charge(id) != 0 ) ++nprong; // Check if tau decays leptonically if (( abs(id) == PID::ELECTRON || abs(id) == PID::MUON || abs(id) == PID::TAU ) && abs(p->pdg_id()) == PID::TAU) lep_decaying_tau = true; } // If the status of the daughter particle is 2 it is unstable and the further decays are checked else if ((*pp)->status() == 2 ) { get_prong_number((*pp),nprong,lep_decaying_tau); } } } /// Function giving fiducial lepton efficiency double apply_reco_eff(int flavor, const Particle& p) { double pt = p.pT()/GeV; double eta = p.eta(); double eff = 0.; if (flavor == 11) { // weight prompt electron -- now including data/MC ID SF in eff. double avgrate = 0.685; const static double wz_ele[] = {0.0256,0.522,0.607,0.654,0.708,0.737,0.761,0.784,0.815,0.835,0.851,0.841,0.898}; // double ewz_ele[] = {0.000257,0.00492,0.00524,0.00519,0.00396,0.00449,0.00538,0.00513,0.00773,0.00753,0.0209,0.0964,0.259}; int ibin = 0; if(pt > 10 && pt < 15) ibin = 0; if(pt > 15 && pt < 20) ibin = 1; if(pt > 20 && pt < 25) ibin = 2; if(pt > 25 && pt < 30) ibin = 3; if(pt > 30 && pt < 40) ibin = 4; if(pt > 40 && pt < 50) ibin = 5; if(pt > 50 && pt < 60) ibin = 6; if(pt > 60 && pt < 80) ibin = 7; if(pt > 80 && pt < 100) ibin = 8; if(pt > 100 && pt < 200) ibin = 9; if(pt > 200 && pt < 400) ibin = 10; if(pt > 400 && pt < 600) ibin = 11; if(pt > 600) ibin = 12; double eff_pt = 0.; eff_pt = wz_ele[ibin]; eta = fabs(eta); const static double wz_ele_eta[] = {0.65,0.714,0.722,0.689,0.635,0.615}; // double ewz_ele_eta[] = {0.00642,0.00355,0.00335,0.004,0.00368,0.00422}; ibin = 0; if(eta > 0 && eta < 0.1) ibin = 0; if(eta > 0.1 && eta < 0.5) ibin = 1; if(eta > 0.5 && eta < 1.0) ibin = 2; if(eta > 1.0 && eta < 1.5) ibin = 3; if(eta > 1.5 && eta < 2.0) ibin = 4; if(eta > 2.0 && eta < 2.5) ibin = 5; double eff_eta = 0.; eff_eta = wz_ele_eta[ibin]; eff = (eff_pt * eff_eta) / avgrate; } if (flavor == 12) { // weight electron from tau double avgrate = 0.476; const static double wz_ele[] = {0.00855,0.409,0.442,0.55,0.632,0.616,0.615,0.642,0.72,0.617}; // double ewz_ele[] = {0.000573,0.0291,0.0366,0.0352,0.0363,0.0474,0.0628,0.0709,0.125,0.109}; int ibin = 0; if(pt > 10 && pt < 15) ibin = 0; if(pt > 15 && pt < 20) ibin = 1; if(pt > 20 && pt < 25) ibin = 2; if(pt > 25 && pt < 30) ibin = 3; if(pt > 30 && pt < 40) ibin = 4; if(pt > 40 && pt < 50) ibin = 5; if(pt > 50 && pt < 60) ibin = 6; if(pt > 60 && pt < 80) ibin = 7; if(pt > 80 && pt < 100) ibin = 8; if(pt > 100) ibin = 9; double eff_pt = 0.; eff_pt = wz_ele[ibin]; eta = fabs(eta); const static double wz_ele_eta[] = {0.546,0.5,0.513,0.421,0.47,0.433}; //double ewz_ele_eta[] = {0.0566,0.0257,0.0263,0.0263,0.0303,0.0321}; ibin = 0; if(eta > 0 && eta < 0.1) ibin = 0; if(eta > 0.1 && eta < 0.5) ibin = 1; if(eta > 0.5 && eta < 1.0) ibin = 2; if(eta > 1.0 && eta < 1.5) ibin = 3; if(eta > 1.5 && eta < 2.0) ibin = 4; if(eta > 2.0 && eta < 2.5) ibin = 5; double eff_eta = 0.; eff_eta = wz_ele_eta[ibin]; eff = (eff_pt * eff_eta) / avgrate; } if (flavor == 13) { // weight prompt muon int ibin = 0; if(pt > 10 && pt < 15) ibin = 0; if(pt > 15 && pt < 20) ibin = 1; if(pt > 20 && pt < 25) ibin = 2; if(pt > 25 && pt < 30) ibin = 3; if(pt > 30 && pt < 40) ibin = 4; if(pt > 40 && pt < 50) ibin = 5; if(pt > 50 && pt < 60) ibin = 6; if(pt > 60 && pt < 80) ibin = 7; if(pt > 80 && pt < 100) ibin = 8; if(pt > 100 && pt < 200) ibin = 9; if(pt > 200 && pt < 400) ibin = 10; if(pt > 400) ibin = 11; if(fabs(eta) < 0.1) { const static double wz_mu[] = {0.00705,0.402,0.478,0.49,0.492,0.499,0.527,0.512,0.53,0.528,0.465,0.465}; //double ewz_mu[] = {0.000298,0.0154,0.017,0.0158,0.0114,0.0123,0.0155,0.0133,0.0196,0.0182,0.0414,0.0414}; double eff_pt = 0.; eff_pt = wz_mu[ibin]; eff = eff_pt; } if(fabs(eta) > 0.1) { const static double wz_mu[] = {0.0224,0.839,0.887,0.91,0.919,0.923,0.925,0.925,0.922,0.918,0.884,0.834}; //double ewz_mu[] = {0.000213,0.00753,0.0074,0.007,0.00496,0.00534,0.00632,0.00583,0.00849,0.00804,0.0224,0.0963}; double eff_pt = 0.; eff_pt = wz_mu[ibin]; eff = eff_pt; } } if (flavor == 14) { // weight muon from tau int ibin = 0; if(pt > 10 && pt < 15) ibin = 0; if(pt > 15 && pt < 20) ibin = 1; if(pt > 20 && pt < 25) ibin = 2; if(pt > 25 && pt < 30) ibin = 3; if(pt > 30 && pt < 40) ibin = 4; if(pt > 40 && pt < 50) ibin = 5; if(pt > 50 && pt < 60) ibin = 6; if(pt > 60 && pt < 80) ibin = 7; if(pt > 80 && pt < 100) ibin = 8; if(pt > 100) ibin = 9; if(fabs(eta) < 0.1) { const static double wz_mu[] = {0.0,0.664,0.124,0.133,0.527,0.283,0.495,0.25,0.5,0.331}; //double ewz_mu[] = {0.0,0.192,0.0437,0.0343,0.128,0.107,0.202,0.125,0.25,0.191}; double eff_pt = 0.; eff_pt = wz_mu[ibin]; eff = eff_pt; } if(fabs(eta) > 0.1) { const static double wz_mu[] = {0.0,0.617,0.655,0.676,0.705,0.738,0.712,0.783,0.646,0.745}; //double ewz_mu[] = {0.0,0.043,0.0564,0.0448,0.0405,0.0576,0.065,0.0825,0.102,0.132}; double eff_pt = 0.; eff_pt = wz_mu[ibin]; eff = eff_pt; } } if (flavor == 15) { // weight hadronic tau 1p double avgrate = 0.16; const static double wz_tau1p[] = {0.0,0.0311,0.148,0.229,0.217,0.292,0.245,0.307,0.227,0.277}; //double ewz_tau1p[] = {0.0,0.00211,0.0117,0.0179,0.0134,0.0248,0.0264,0.0322,0.0331,0.0427}; int ibin = 0; if(pt > 10 && pt < 15) ibin = 0; if(pt > 15 && pt < 20) ibin = 1; if(pt > 20 && pt < 25) ibin = 2; if(pt > 25 && pt < 30) ibin = 3; if(pt > 30 && pt < 40) ibin = 4; if(pt > 40 && pt < 50) ibin = 5; if(pt > 50 && pt < 60) ibin = 6; if(pt > 60 && pt < 80) ibin = 7; if(pt > 80 && pt < 100) ibin = 8; if(pt > 100) ibin = 9; double eff_pt = 0.; eff_pt = wz_tau1p[ibin]; const static double wz_tau1p_eta[] = {0.166,0.15,0.188,0.175,0.142,0.109}; //double ewz_tau1p_eta[] ={0.0166,0.00853,0.0097,0.00985,0.00949,0.00842}; ibin = 0; if(eta > 0.0 && eta < 0.1) ibin = 0; if(eta > 0.1 && eta < 0.5) ibin = 1; if(eta > 0.5 && eta < 1.0) ibin = 2; if(eta > 1.0 && eta < 1.5) ibin = 3; if(eta > 1.5 && eta < 2.0) ibin = 4; if(eta > 2.0 && eta < 2.5) ibin = 5; double eff_eta = 0.; eff_eta = wz_tau1p_eta[ibin]; eff = (eff_pt * eff_eta) / avgrate; } return eff; } /// Function giving observed and expected upper limits (on the visible cross-section) double getUpperLimit(const string& signal_region, bool observed) { map upperLimitsObserved; map upperLimitsExpected; upperLimitsObserved["HTlep_3l_offZ_OSSF_cut_0"] = 2.435; upperLimitsObserved["HTlep_3l_offZ_OSSF_cut_200"] = 0.704; upperLimitsObserved["HTlep_3l_offZ_OSSF_cut_500"] = 0.182; upperLimitsObserved["HTlep_3l_offZ_OSSF_cut_800"] = 0.147; upperLimitsObserved["HTlep_2ltau_offZ_OSSF_cut_0"] = 13.901; upperLimitsObserved["HTlep_2ltau_offZ_OSSF_cut_200"] = 1.677; upperLimitsObserved["HTlep_2ltau_offZ_OSSF_cut_500"] = 0.141; upperLimitsObserved["HTlep_2ltau_offZ_OSSF_cut_800"] = 0.155; upperLimitsObserved["HTlep_3l_offZ_noOSSF_cut_0"] = 1.054; upperLimitsObserved["HTlep_3l_offZ_noOSSF_cut_200"] = 0.341; upperLimitsObserved["HTlep_3l_offZ_noOSSF_cut_500"] = 0.221; upperLimitsObserved["HTlep_3l_offZ_noOSSF_cut_800"] = 0.140; upperLimitsObserved["HTlep_2ltau_offZ_noOSSF_cut_0"] = 4.276; upperLimitsObserved["HTlep_2ltau_offZ_noOSSF_cut_200"] = 0.413; upperLimitsObserved["HTlep_2ltau_offZ_noOSSF_cut_500"] = 0.138; upperLimitsObserved["HTlep_2ltau_offZ_noOSSF_cut_800"] = 0.150; upperLimitsObserved["HTlep_3l_onZ_cut_0"] = 29.804; upperLimitsObserved["HTlep_3l_onZ_cut_200"] = 3.579; upperLimitsObserved["HTlep_3l_onZ_cut_500"] = 0.466; upperLimitsObserved["HTlep_3l_onZ_cut_800"] = 0.298; upperLimitsObserved["HTlep_2ltau_onZ_cut_0"] = 205.091; upperLimitsObserved["HTlep_2ltau_onZ_cut_200"] = 3.141; upperLimitsObserved["HTlep_2ltau_onZ_cut_500"] = 0.290; upperLimitsObserved["HTlep_2ltau_onZ_cut_800"] = 0.157; upperLimitsObserved["METStrong_3l_offZ_OSSF_cut_0"] = 1.111; upperLimitsObserved["METStrong_3l_offZ_OSSF_cut_100"] = 0.354; upperLimitsObserved["METStrong_3l_offZ_OSSF_cut_200"] = 0.236; upperLimitsObserved["METStrong_3l_offZ_OSSF_cut_300"] = 0.150; upperLimitsObserved["METStrong_2ltau_offZ_OSSF_cut_0"] = 1.881; upperLimitsObserved["METStrong_2ltau_offZ_OSSF_cut_100"] = 0.406; upperLimitsObserved["METStrong_2ltau_offZ_OSSF_cut_200"] = 0.194; upperLimitsObserved["METStrong_2ltau_offZ_OSSF_cut_300"] = 0.134; upperLimitsObserved["METStrong_3l_offZ_noOSSF_cut_0"] = 0.770; upperLimitsObserved["METStrong_3l_offZ_noOSSF_cut_100"] = 0.295; upperLimitsObserved["METStrong_3l_offZ_noOSSF_cut_200"] = 0.149; upperLimitsObserved["METStrong_3l_offZ_noOSSF_cut_300"] = 0.140; upperLimitsObserved["METStrong_2ltau_offZ_noOSSF_cut_0"] = 2.003; upperLimitsObserved["METStrong_2ltau_offZ_noOSSF_cut_100"] = 0.806; upperLimitsObserved["METStrong_2ltau_offZ_noOSSF_cut_200"] = 0.227; upperLimitsObserved["METStrong_2ltau_offZ_noOSSF_cut_300"] = 0.138; upperLimitsObserved["METStrong_3l_onZ_cut_0"] = 6.383; upperLimitsObserved["METStrong_3l_onZ_cut_100"] = 0.959; upperLimitsObserved["METStrong_3l_onZ_cut_200"] = 0.549; upperLimitsObserved["METStrong_3l_onZ_cut_300"] = 0.182; upperLimitsObserved["METStrong_2ltau_onZ_cut_0"] = 10.658; upperLimitsObserved["METStrong_2ltau_onZ_cut_100"] = 0.637; upperLimitsObserved["METStrong_2ltau_onZ_cut_200"] = 0.291; upperLimitsObserved["METStrong_2ltau_onZ_cut_300"] = 0.227; upperLimitsObserved["METWeak_3l_offZ_OSSF_cut_0"] = 1.802; upperLimitsObserved["METWeak_3l_offZ_OSSF_cut_100"] = 0.344; upperLimitsObserved["METWeak_3l_offZ_OSSF_cut_200"] = 0.189; upperLimitsObserved["METWeak_3l_offZ_OSSF_cut_300"] = 0.148; upperLimitsObserved["METWeak_2ltau_offZ_OSSF_cut_0"] = 12.321; upperLimitsObserved["METWeak_2ltau_offZ_OSSF_cut_100"] = 0.430; upperLimitsObserved["METWeak_2ltau_offZ_OSSF_cut_200"] = 0.137; upperLimitsObserved["METWeak_2ltau_offZ_OSSF_cut_300"] = 0.134; upperLimitsObserved["METWeak_3l_offZ_noOSSF_cut_0"] = 0.562; upperLimitsObserved["METWeak_3l_offZ_noOSSF_cut_100"] = 0.153; upperLimitsObserved["METWeak_3l_offZ_noOSSF_cut_200"] = 0.154; upperLimitsObserved["METWeak_3l_offZ_noOSSF_cut_300"] = 0.141; upperLimitsObserved["METWeak_2ltau_offZ_noOSSF_cut_0"] = 2.475; upperLimitsObserved["METWeak_2ltau_offZ_noOSSF_cut_100"] = 0.244; upperLimitsObserved["METWeak_2ltau_offZ_noOSSF_cut_200"] = 0.141; upperLimitsObserved["METWeak_2ltau_offZ_noOSSF_cut_300"] = 0.142; upperLimitsObserved["METWeak_3l_onZ_cut_0"] = 24.769; upperLimitsObserved["METWeak_3l_onZ_cut_100"] = 0.690; upperLimitsObserved["METWeak_3l_onZ_cut_200"] = 0.198; upperLimitsObserved["METWeak_3l_onZ_cut_300"] = 0.138; upperLimitsObserved["METWeak_2ltau_onZ_cut_0"] = 194.360; upperLimitsObserved["METWeak_2ltau_onZ_cut_100"] = 0.287; upperLimitsObserved["METWeak_2ltau_onZ_cut_200"] = 0.144; upperLimitsObserved["METWeak_2ltau_onZ_cut_300"] = 0.130; upperLimitsObserved["Meff_3l_offZ_OSSF_cut_0"] = 2.435; upperLimitsObserved["Meff_3l_offZ_OSSF_cut_600"] = 0.487; upperLimitsObserved["Meff_3l_offZ_OSSF_cut_1000"] = 0.156; upperLimitsObserved["Meff_3l_offZ_OSSF_cut_1500"] = 0.140; upperLimitsObserved["Meff_2ltau_offZ_OSSF_cut_0"] = 13.901; upperLimitsObserved["Meff_2ltau_offZ_OSSF_cut_600"] = 0.687; upperLimitsObserved["Meff_2ltau_offZ_OSSF_cut_1000"] = 0.224; upperLimitsObserved["Meff_2ltau_offZ_OSSF_cut_1500"] = 0.155; upperLimitsObserved["Meff_3l_offZ_noOSSF_cut_0"] = 1.054; upperLimitsObserved["Meff_3l_offZ_noOSSF_cut_600"] = 0.249; upperLimitsObserved["Meff_3l_offZ_noOSSF_cut_1000"] = 0.194; upperLimitsObserved["Meff_3l_offZ_noOSSF_cut_1500"] = 0.145; upperLimitsObserved["Meff_2ltau_offZ_noOSSF_cut_0"] = 4.276; upperLimitsObserved["Meff_2ltau_offZ_noOSSF_cut_600"] = 0.772; upperLimitsObserved["Meff_2ltau_offZ_noOSSF_cut_1000"] = 0.218; upperLimitsObserved["Meff_2ltau_offZ_noOSSF_cut_1500"] = 0.204; upperLimitsObserved["Meff_3l_onZ_cut_0"] = 29.804; upperLimitsObserved["Meff_3l_onZ_cut_600"] = 2.933; upperLimitsObserved["Meff_3l_onZ_cut_1000"] = 0.912; upperLimitsObserved["Meff_3l_onZ_cut_1500"] = 0.225; upperLimitsObserved["Meff_2ltau_onZ_cut_0"] = 205.091; upperLimitsObserved["Meff_2ltau_onZ_cut_600"] = 1.486; upperLimitsObserved["Meff_2ltau_onZ_cut_1000"] = 0.641; upperLimitsObserved["Meff_2ltau_onZ_cut_1500"] = 0.204; upperLimitsObserved["MeffStrong_3l_offZ_OSSF_cut_0"] = 0.479; upperLimitsObserved["MeffStrong_3l_offZ_OSSF_cut_600"] = 0.353; upperLimitsObserved["MeffStrong_3l_offZ_OSSF_cut_1200"] = 0.187; upperLimitsObserved["MeffStrong_2ltau_offZ_OSSF_cut_0"] = 0.617; upperLimitsObserved["MeffStrong_2ltau_offZ_OSSF_cut_600"] = 0.320; upperLimitsObserved["MeffStrong_2ltau_offZ_OSSF_cut_1200"] = 0.281; upperLimitsObserved["MeffStrong_3l_offZ_noOSSF_cut_0"] = 0.408; upperLimitsObserved["MeffStrong_3l_offZ_noOSSF_cut_600"] = 0.240; upperLimitsObserved["MeffStrong_3l_offZ_noOSSF_cut_1200"] = 0.150; upperLimitsObserved["MeffStrong_2ltau_offZ_noOSSF_cut_0"] = 0.774; upperLimitsObserved["MeffStrong_2ltau_offZ_noOSSF_cut_600"] = 0.417; upperLimitsObserved["MeffStrong_2ltau_offZ_noOSSF_cut_1200"] = 0.266; upperLimitsObserved["MeffStrong_3l_onZ_cut_0"] = 1.208; upperLimitsObserved["MeffStrong_3l_onZ_cut_600"] = 0.837; upperLimitsObserved["MeffStrong_3l_onZ_cut_1200"] = 0.269; upperLimitsObserved["MeffStrong_2ltau_onZ_cut_0"] = 0.605; upperLimitsObserved["MeffStrong_2ltau_onZ_cut_600"] = 0.420; upperLimitsObserved["MeffStrong_2ltau_onZ_cut_1200"] = 0.141; upperLimitsObserved["MeffMt_3l_onZ_cut_0"] = 1.832; upperLimitsObserved["MeffMt_3l_onZ_cut_600"] = 0.862; upperLimitsObserved["MeffMt_3l_onZ_cut_1200"] = 0.222; upperLimitsObserved["MeffMt_2ltau_onZ_cut_0"] = 1.309; upperLimitsObserved["MeffMt_2ltau_onZ_cut_600"] = 0.481; upperLimitsObserved["MeffMt_2ltau_onZ_cut_1200"] = 0.146; upperLimitsObserved["MinPt_3l_offZ_OSSF_cut_0"] = 2.435; upperLimitsObserved["MinPt_3l_offZ_OSSF_cut_50"] = 0.500; upperLimitsObserved["MinPt_3l_offZ_OSSF_cut_100"] = 0.203; upperLimitsObserved["MinPt_3l_offZ_OSSF_cut_150"] = 0.128; upperLimitsObserved["MinPt_2ltau_offZ_OSSF_cut_0"] = 13.901; upperLimitsObserved["MinPt_2ltau_offZ_OSSF_cut_50"] = 0.859; upperLimitsObserved["MinPt_2ltau_offZ_OSSF_cut_100"] = 0.158; upperLimitsObserved["MinPt_2ltau_offZ_OSSF_cut_150"] = 0.155; upperLimitsObserved["MinPt_3l_offZ_noOSSF_cut_0"] = 1.054; upperLimitsObserved["MinPt_3l_offZ_noOSSF_cut_50"] = 0.295; upperLimitsObserved["MinPt_3l_offZ_noOSSF_cut_100"] = 0.148; upperLimitsObserved["MinPt_3l_offZ_noOSSF_cut_150"] = 0.137; upperLimitsObserved["MinPt_2ltau_offZ_noOSSF_cut_0"] = 4.276; upperLimitsObserved["MinPt_2ltau_offZ_noOSSF_cut_50"] = 0.314; upperLimitsObserved["MinPt_2ltau_offZ_noOSSF_cut_100"] = 0.134; upperLimitsObserved["MinPt_2ltau_offZ_noOSSF_cut_150"] = 0.140; upperLimitsObserved["MinPt_3l_onZ_cut_0"] = 29.804; upperLimitsObserved["MinPt_3l_onZ_cut_50"] = 1.767; upperLimitsObserved["MinPt_3l_onZ_cut_100"] = 0.690; upperLimitsObserved["MinPt_3l_onZ_cut_150"] = 0.301; upperLimitsObserved["MinPt_2ltau_onZ_cut_0"] = 205.091; upperLimitsObserved["MinPt_2ltau_onZ_cut_50"] = 1.050; upperLimitsObserved["MinPt_2ltau_onZ_cut_100"] = 0.155; upperLimitsObserved["MinPt_2ltau_onZ_cut_150"] = 0.146; upperLimitsObserved["nbtag_3l_offZ_OSSF_cut_0"] = 2.435; upperLimitsObserved["nbtag_3l_offZ_OSSF_cut_1"] = 0.865; upperLimitsObserved["nbtag_3l_offZ_OSSF_cut_2"] = 0.474; upperLimitsObserved["nbtag_2ltau_offZ_OSSF_cut_0"] = 13.901; upperLimitsObserved["nbtag_2ltau_offZ_OSSF_cut_1"] = 1.566; upperLimitsObserved["nbtag_2ltau_offZ_OSSF_cut_2"] = 0.426; upperLimitsObserved["nbtag_3l_offZ_noOSSF_cut_0"] = 1.054; upperLimitsObserved["nbtag_3l_offZ_noOSSF_cut_1"] = 0.643; upperLimitsObserved["nbtag_3l_offZ_noOSSF_cut_2"] = 0.321; upperLimitsObserved["nbtag_2ltau_offZ_noOSSF_cut_0"] = 4.276; upperLimitsObserved["nbtag_2ltau_offZ_noOSSF_cut_1"] = 2.435; upperLimitsObserved["nbtag_2ltau_offZ_noOSSF_cut_2"] = 1.073; upperLimitsObserved["nbtag_3l_onZ_cut_0"] = 29.804; upperLimitsObserved["nbtag_3l_onZ_cut_1"] = 3.908; upperLimitsObserved["nbtag_3l_onZ_cut_2"] = 0.704; upperLimitsObserved["nbtag_2ltau_onZ_cut_0"] = 205.091; upperLimitsObserved["nbtag_2ltau_onZ_cut_1"] = 9.377; upperLimitsObserved["nbtag_2ltau_onZ_cut_2"] = 0.657; upperLimitsExpected["HTlep_3l_offZ_OSSF_cut_0"] = 2.893; upperLimitsExpected["HTlep_3l_offZ_OSSF_cut_200"] = 1.175; upperLimitsExpected["HTlep_3l_offZ_OSSF_cut_500"] = 0.265; upperLimitsExpected["HTlep_3l_offZ_OSSF_cut_800"] = 0.155; upperLimitsExpected["HTlep_2ltau_offZ_OSSF_cut_0"] = 14.293; upperLimitsExpected["HTlep_2ltau_offZ_OSSF_cut_200"] = 1.803; upperLimitsExpected["HTlep_2ltau_offZ_OSSF_cut_500"] = 0.159; upperLimitsExpected["HTlep_2ltau_offZ_OSSF_cut_800"] = 0.155; upperLimitsExpected["HTlep_3l_offZ_noOSSF_cut_0"] = 0.836; upperLimitsExpected["HTlep_3l_offZ_noOSSF_cut_200"] = 0.340; upperLimitsExpected["HTlep_3l_offZ_noOSSF_cut_500"] = 0.218; upperLimitsExpected["HTlep_3l_offZ_noOSSF_cut_800"] = 0.140; upperLimitsExpected["HTlep_2ltau_offZ_noOSSF_cut_0"] = 4.132; upperLimitsExpected["HTlep_2ltau_offZ_noOSSF_cut_200"] = 0.599; upperLimitsExpected["HTlep_2ltau_offZ_noOSSF_cut_500"] = 0.146; upperLimitsExpected["HTlep_2ltau_offZ_noOSSF_cut_800"] = 0.148; upperLimitsExpected["HTlep_3l_onZ_cut_0"] = 32.181; upperLimitsExpected["HTlep_3l_onZ_cut_200"] = 4.879; upperLimitsExpected["HTlep_3l_onZ_cut_500"] = 0.473; upperLimitsExpected["HTlep_3l_onZ_cut_800"] = 0.266; upperLimitsExpected["HTlep_2ltau_onZ_cut_0"] = 217.801; upperLimitsExpected["HTlep_2ltau_onZ_cut_200"] = 3.676; upperLimitsExpected["HTlep_2ltau_onZ_cut_500"] = 0.235; upperLimitsExpected["HTlep_2ltau_onZ_cut_800"] = 0.150; upperLimitsExpected["METStrong_3l_offZ_OSSF_cut_0"] = 1.196; upperLimitsExpected["METStrong_3l_offZ_OSSF_cut_100"] = 0.423; upperLimitsExpected["METStrong_3l_offZ_OSSF_cut_200"] = 0.208; upperLimitsExpected["METStrong_3l_offZ_OSSF_cut_300"] = 0.158; upperLimitsExpected["METStrong_2ltau_offZ_OSSF_cut_0"] = 2.158; upperLimitsExpected["METStrong_2ltau_offZ_OSSF_cut_100"] = 0.461; upperLimitsExpected["METStrong_2ltau_offZ_OSSF_cut_200"] = 0.186; upperLimitsExpected["METStrong_2ltau_offZ_OSSF_cut_300"] = 0.138; upperLimitsExpected["METStrong_3l_offZ_noOSSF_cut_0"] = 0.495; upperLimitsExpected["METStrong_3l_offZ_noOSSF_cut_100"] = 0.284; upperLimitsExpected["METStrong_3l_offZ_noOSSF_cut_200"] = 0.150; upperLimitsExpected["METStrong_3l_offZ_noOSSF_cut_300"] = 0.146; upperLimitsExpected["METStrong_2ltau_offZ_noOSSF_cut_0"] = 1.967; upperLimitsExpected["METStrong_2ltau_offZ_noOSSF_cut_100"] = 0.732; upperLimitsExpected["METStrong_2ltau_offZ_noOSSF_cut_200"] = 0.225; upperLimitsExpected["METStrong_2ltau_offZ_noOSSF_cut_300"] = 0.147; upperLimitsExpected["METStrong_3l_onZ_cut_0"] = 7.157; upperLimitsExpected["METStrong_3l_onZ_cut_100"] = 1.342; upperLimitsExpected["METStrong_3l_onZ_cut_200"] = 0.508; upperLimitsExpected["METStrong_3l_onZ_cut_300"] = 0.228; upperLimitsExpected["METStrong_2ltau_onZ_cut_0"] = 12.441; upperLimitsExpected["METStrong_2ltau_onZ_cut_100"] = 0.534; upperLimitsExpected["METStrong_2ltau_onZ_cut_200"] = 0.243; upperLimitsExpected["METStrong_2ltau_onZ_cut_300"] = 0.218; upperLimitsExpected["METWeak_3l_offZ_OSSF_cut_0"] = 2.199; upperLimitsExpected["METWeak_3l_offZ_OSSF_cut_100"] = 0.391; upperLimitsExpected["METWeak_3l_offZ_OSSF_cut_200"] = 0.177; upperLimitsExpected["METWeak_3l_offZ_OSSF_cut_300"] = 0.144; upperLimitsExpected["METWeak_2ltau_offZ_OSSF_cut_0"] = 12.431; upperLimitsExpected["METWeak_2ltau_offZ_OSSF_cut_100"] = 0.358; upperLimitsExpected["METWeak_2ltau_offZ_OSSF_cut_200"] = 0.150; upperLimitsExpected["METWeak_2ltau_offZ_OSSF_cut_300"] = 0.135; upperLimitsExpected["METWeak_3l_offZ_noOSSF_cut_0"] = 0.577; upperLimitsExpected["METWeak_3l_offZ_noOSSF_cut_100"] = 0.214; upperLimitsExpected["METWeak_3l_offZ_noOSSF_cut_200"] = 0.155; upperLimitsExpected["METWeak_3l_offZ_noOSSF_cut_300"] = 0.140; upperLimitsExpected["METWeak_2ltau_offZ_noOSSF_cut_0"] = 2.474; upperLimitsExpected["METWeak_2ltau_offZ_noOSSF_cut_100"] = 0.382; upperLimitsExpected["METWeak_2ltau_offZ_noOSSF_cut_200"] = 0.144; upperLimitsExpected["METWeak_2ltau_offZ_noOSSF_cut_300"] = 0.146; upperLimitsExpected["METWeak_3l_onZ_cut_0"] = 26.305; upperLimitsExpected["METWeak_3l_onZ_cut_100"] = 1.227; upperLimitsExpected["METWeak_3l_onZ_cut_200"] = 0.311; upperLimitsExpected["METWeak_3l_onZ_cut_300"] = 0.188; upperLimitsExpected["METWeak_2ltau_onZ_cut_0"] = 205.198; upperLimitsExpected["METWeak_2ltau_onZ_cut_100"] = 0.399; upperLimitsExpected["METWeak_2ltau_onZ_cut_200"] = 0.166; upperLimitsExpected["METWeak_2ltau_onZ_cut_300"] = 0.140; upperLimitsExpected["Meff_3l_offZ_OSSF_cut_0"] = 2.893; upperLimitsExpected["Meff_3l_offZ_OSSF_cut_600"] = 0.649; upperLimitsExpected["Meff_3l_offZ_OSSF_cut_1000"] = 0.252; upperLimitsExpected["Meff_3l_offZ_OSSF_cut_1500"] = 0.150; upperLimitsExpected["Meff_2ltau_offZ_OSSF_cut_0"] = 14.293; upperLimitsExpected["Meff_2ltau_offZ_OSSF_cut_600"] = 0.657; upperLimitsExpected["Meff_2ltau_offZ_OSSF_cut_1000"] = 0.226; upperLimitsExpected["Meff_2ltau_offZ_OSSF_cut_1500"] = 0.154; upperLimitsExpected["Meff_3l_offZ_noOSSF_cut_0"] = 0.836; upperLimitsExpected["Meff_3l_offZ_noOSSF_cut_600"] = 0.265; upperLimitsExpected["Meff_3l_offZ_noOSSF_cut_1000"] = 0.176; upperLimitsExpected["Meff_3l_offZ_noOSSF_cut_1500"] = 0.146; upperLimitsExpected["Meff_2ltau_offZ_noOSSF_cut_0"] = 4.132; upperLimitsExpected["Meff_2ltau_offZ_noOSSF_cut_600"] = 0.678; upperLimitsExpected["Meff_2ltau_offZ_noOSSF_cut_1000"] = 0.243; upperLimitsExpected["Meff_2ltau_offZ_noOSSF_cut_1500"] = 0.184; upperLimitsExpected["Meff_3l_onZ_cut_0"] = 32.181; upperLimitsExpected["Meff_3l_onZ_cut_600"] = 3.219; upperLimitsExpected["Meff_3l_onZ_cut_1000"] = 0.905; upperLimitsExpected["Meff_3l_onZ_cut_1500"] = 0.261; upperLimitsExpected["Meff_2ltau_onZ_cut_0"] = 217.801; upperLimitsExpected["Meff_2ltau_onZ_cut_600"] = 1.680; upperLimitsExpected["Meff_2ltau_onZ_cut_1000"] = 0.375; upperLimitsExpected["Meff_2ltau_onZ_cut_1500"] = 0.178; upperLimitsExpected["MeffStrong_3l_offZ_OSSF_cut_0"] = 0.571; upperLimitsExpected["MeffStrong_3l_offZ_OSSF_cut_600"] = 0.386; upperLimitsExpected["MeffStrong_3l_offZ_OSSF_cut_1200"] = 0.177; upperLimitsExpected["MeffStrong_2ltau_offZ_OSSF_cut_0"] = 0.605; upperLimitsExpected["MeffStrong_2ltau_offZ_OSSF_cut_600"] = 0.335; upperLimitsExpected["MeffStrong_2ltau_offZ_OSSF_cut_1200"] = 0.249; upperLimitsExpected["MeffStrong_3l_offZ_noOSSF_cut_0"] = 0.373; upperLimitsExpected["MeffStrong_3l_offZ_noOSSF_cut_600"] = 0.223; upperLimitsExpected["MeffStrong_3l_offZ_noOSSF_cut_1200"] = 0.150; upperLimitsExpected["MeffStrong_2ltau_offZ_noOSSF_cut_0"] = 0.873; upperLimitsExpected["MeffStrong_2ltau_offZ_noOSSF_cut_600"] = 0.428; upperLimitsExpected["MeffStrong_2ltau_offZ_noOSSF_cut_1200"] = 0.210; upperLimitsExpected["MeffStrong_3l_onZ_cut_0"] = 2.034; upperLimitsExpected["MeffStrong_3l_onZ_cut_600"] = 1.093; upperLimitsExpected["MeffStrong_3l_onZ_cut_1200"] = 0.293; upperLimitsExpected["MeffStrong_2ltau_onZ_cut_0"] = 0.690; upperLimitsExpected["MeffStrong_2ltau_onZ_cut_600"] = 0.392; upperLimitsExpected["MeffStrong_2ltau_onZ_cut_1200"] = 0.156; upperLimitsExpected["MeffMt_3l_onZ_cut_0"] = 2.483; upperLimitsExpected["MeffMt_3l_onZ_cut_600"] = 0.845; upperLimitsExpected["MeffMt_3l_onZ_cut_1200"] = 0.255; upperLimitsExpected["MeffMt_2ltau_onZ_cut_0"] = 1.448; upperLimitsExpected["MeffMt_2ltau_onZ_cut_600"] = 0.391; upperLimitsExpected["MeffMt_2ltau_onZ_cut_1200"] = 0.146; upperLimitsExpected["MinPt_3l_offZ_OSSF_cut_0"] = 2.893; upperLimitsExpected["MinPt_3l_offZ_OSSF_cut_50"] = 0.703; upperLimitsExpected["MinPt_3l_offZ_OSSF_cut_100"] = 0.207; upperLimitsExpected["MinPt_3l_offZ_OSSF_cut_150"] = 0.143; upperLimitsExpected["MinPt_2ltau_offZ_OSSF_cut_0"] = 14.293; upperLimitsExpected["MinPt_2ltau_offZ_OSSF_cut_50"] = 0.705; upperLimitsExpected["MinPt_2ltau_offZ_OSSF_cut_100"] = 0.149; upperLimitsExpected["MinPt_2ltau_offZ_OSSF_cut_150"] = 0.155; upperLimitsExpected["MinPt_3l_offZ_noOSSF_cut_0"] = 0.836; upperLimitsExpected["MinPt_3l_offZ_noOSSF_cut_50"] = 0.249; upperLimitsExpected["MinPt_3l_offZ_noOSSF_cut_100"] = 0.135; upperLimitsExpected["MinPt_3l_offZ_noOSSF_cut_150"] = 0.136; upperLimitsExpected["MinPt_2ltau_offZ_noOSSF_cut_0"] = 4.132; upperLimitsExpected["MinPt_2ltau_offZ_noOSSF_cut_50"] = 0.339; upperLimitsExpected["MinPt_2ltau_offZ_noOSSF_cut_100"] = 0.149; upperLimitsExpected["MinPt_2ltau_offZ_noOSSF_cut_150"] = 0.145; upperLimitsExpected["MinPt_3l_onZ_cut_0"] = 32.181; upperLimitsExpected["MinPt_3l_onZ_cut_50"] = 2.260; upperLimitsExpected["MinPt_3l_onZ_cut_100"] = 0.438; upperLimitsExpected["MinPt_3l_onZ_cut_150"] = 0.305; upperLimitsExpected["MinPt_2ltau_onZ_cut_0"] = 217.801; upperLimitsExpected["MinPt_2ltau_onZ_cut_50"] = 1.335; upperLimitsExpected["MinPt_2ltau_onZ_cut_100"] = 0.162; upperLimitsExpected["MinPt_2ltau_onZ_cut_150"] = 0.149; upperLimitsExpected["nbtag_3l_offZ_OSSF_cut_0"] = 2.893; upperLimitsExpected["nbtag_3l_offZ_OSSF_cut_1"] = 0.923; upperLimitsExpected["nbtag_3l_offZ_OSSF_cut_2"] = 0.452; upperLimitsExpected["nbtag_2ltau_offZ_OSSF_cut_0"] = 14.293; upperLimitsExpected["nbtag_2ltau_offZ_OSSF_cut_1"] = 1.774; upperLimitsExpected["nbtag_2ltau_offZ_OSSF_cut_2"] = 0.549; upperLimitsExpected["nbtag_3l_offZ_noOSSF_cut_0"] = 0.836; upperLimitsExpected["nbtag_3l_offZ_noOSSF_cut_1"] = 0.594; upperLimitsExpected["nbtag_3l_offZ_noOSSF_cut_2"] = 0.298; upperLimitsExpected["nbtag_2ltau_offZ_noOSSF_cut_0"] = 4.132; upperLimitsExpected["nbtag_2ltau_offZ_noOSSF_cut_1"] = 2.358; upperLimitsExpected["nbtag_2ltau_offZ_noOSSF_cut_2"] = 0.958; upperLimitsExpected["nbtag_3l_onZ_cut_0"] = 32.181; upperLimitsExpected["nbtag_3l_onZ_cut_1"] = 3.868; upperLimitsExpected["nbtag_3l_onZ_cut_2"] = 0.887; upperLimitsExpected["nbtag_2ltau_onZ_cut_0"] = 217.801; upperLimitsExpected["nbtag_2ltau_onZ_cut_1"] = 9.397; upperLimitsExpected["nbtag_2ltau_onZ_cut_2"] = 0.787; if (observed) return upperLimitsObserved[signal_region]; else return upperLimitsExpected[signal_region]; } /// Function checking if there is an OSSF lepton pair or a combination of 3 leptons with an invariant mass close to the Z mass int isonZ (const Particles& particles) { int onZ = 0; double best_mass_2 = 999.; double best_mass_3 = 999.; // Loop over all 2 particle combinations to find invariant mass of OSSF pair closest to Z mass for (const Particle& p1 : particles) { for (const Particle& p2 : particles) { double mass_difference_2_old = fabs(91.0 - best_mass_2); double mass_difference_2_new = fabs(91.0 - (p1.momentum() + p2.momentum()).mass()/GeV); // If particle combination is OSSF pair calculate mass difference to Z mass if ((p1.pid()*p2.pid() == -121 || p1.pid()*p2.pid() == -169)) { // Get invariant mass closest to Z mass if (mass_difference_2_new < mass_difference_2_old) best_mass_2 = (p1.momentum() + p2.momentum()).mass()/GeV; // In case there is an OSSF pair take also 3rd lepton into account (e.g. from FSR and photon to electron conversion) for (const Particle& p3 : particles ) { double mass_difference_3_old = fabs(91.0 - best_mass_3); double mass_difference_3_new = fabs(91.0 - (p1.momentum() + p2.momentum() + p3.momentum()).mass()/GeV); if (mass_difference_3_new < mass_difference_3_old) best_mass_3 = (p1.momentum() + p2.momentum() + p3.momentum()).mass()/GeV; } } } } // Pick the minimum invariant mass of the best OSSF pair combination and the best 3 lepton combination double best_mass = min(best_mass_2,best_mass_3); // if this mass is in a 20 GeV window around the Z mass, the event is classified as onZ if ( fabs(91.0 - best_mass) < 20. ) onZ = 1; return onZ; } /// function checking if two leptons are an OSSF lepton pair and giving out the invariant mass (0 if no OSSF pair) double isOSSF_mass (const Particle& p1, const Particle& p2) { double inv_mass = 0.; // Is particle combination OSSF pair? if ((p1.pid()*p2.pid() == -121 || p1.pid()*p2.pid() == -169)) { // Get invariant mass inv_mass = (p1.momentum() + p2.momentum()).mass()/GeV; } return inv_mass; } /// Function checking if there is an OSSF lepton pair bool isOSSF (const Particles& particles) { for (size_t i1=0 ; i1 < 3 ; i1 ++) { for (size_t i2 = i1+1 ; i2 < 3 ; i2 ++) { if ((particles[i1].pid()*particles[i2].pid() == -121 || particles[i1].pid()*particles[i2].pid() == -169)) { return true; } } } return false; } //@} private: /// Histograms //@{ Histo1DPtr _h_HTlep_all, _h_HTjets_all, _h_MET_all, _h_Meff_all, _h_min_pT_all, _h_mT_all; Histo1DPtr _h_pt_1_3l, _h_pt_2_3l, _h_pt_3_3l, _h_pt_1_2ltau, _h_pt_2_2ltau, _h_pt_3_2ltau; Histo1DPtr _h_e_n, _h_mu_n, _h_tau_n; Histo1DPtr _h_excluded; //@} /// Fiducial efficiencies to model the effects of the ATLAS detector bool _use_fiducial_lepton_efficiency; /// List of signal regions and event counts per signal region vector _signal_regions; map _eventCountsPerSR; }; DECLARE_RIVET_PLUGIN(ATLAS_2014_I1327229); } diff --git a/src/Analyses/BABAR_2003_I593379.cc b/src/Analyses/BABAR_2003_I593379.cc --- a/src/Analyses/BABAR_2003_I593379.cc +++ b/src/Analyses/BABAR_2003_I593379.cc @@ -1,186 +1,186 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief Babar charmonium spectra /// @author Peter Richardson class BABAR_2003_I593379 : public Analysis { public: BABAR_2003_I593379() : Analysis("BABAR_2003_I593379"), _weightSum(0.) { } void analyze(const Event& e) { const double weight = e.weight(); // Find the charmonia Particles upsilons; // First in unstable final state const UnstableFinalState& ufs = apply(e, "UFS"); foreach (const Particle& p, ufs.particles()) if (p.pid() == 300553) upsilons.push_back(p); // Then in whole event if fails if (upsilons.empty()) { - foreach (const GenParticle* p, Rivet::particles(e.genEvent())) { + foreach (const GenParticlePtr p, Rivet::particles(e.genEvent())) { if (p->pdg_id() != 300553) continue; - const GenVertex* pv = p->production_vertex(); + const GenVertexPtr pv = p->production_vertex(); bool passed = true; if (pv) { - foreach (const GenParticle* pp, particles_in(pv)) { + foreach (const GenParticlePtr pp, particles_in(pv)) { if ( p->pdg_id() == pp->pdg_id() ) { passed = false; break; } } } if (passed) upsilons.push_back(Particle(*p)); } } // Find upsilons foreach (const Particle& p, upsilons) { _weightSum += weight; // Find the charmonium resonances /// @todo Use Rivet::Particles - vector allJpsi, primaryJpsi, Psiprime, all_chi_c1, all_chi_c2, primary_chi_c1, primary_chi_c2; + vector allJpsi, primaryJpsi, Psiprime, all_chi_c1, all_chi_c2, primary_chi_c1, primary_chi_c2; findDecayProducts(p.genParticle(), allJpsi, primaryJpsi, Psiprime, all_chi_c1, all_chi_c2, primary_chi_c1, primary_chi_c2); const LorentzTransform cms_boost = LorentzTransform::mkFrameTransformFromBeta(p.mom().betaVec()); for (size_t i = 0; i < allJpsi.size(); i++) { const double pcm = cms_boost.transform(FourMomentum(allJpsi[i]->momentum())).p(); _hist_all_Jpsi->fill(pcm, weight); } _mult_JPsi->fill(10.58, weight*double(allJpsi.size())); for (size_t i = 0; i < primaryJpsi.size(); i++) { const double pcm = cms_boost.transform(FourMomentum(primaryJpsi[i]->momentum())).p(); _hist_primary_Jpsi->fill(pcm, weight); } _mult_JPsi_direct->fill(10.58, weight*double(primaryJpsi.size())); for (size_t i=0; imomentum())).p(); _hist_Psi_prime->fill(pcm, weight); } _mult_Psi2S->fill(10.58, weight*double(Psiprime.size())); for (size_t i = 0; i < all_chi_c1.size(); i++) { const double pcm = cms_boost.transform(FourMomentum(all_chi_c1[i]->momentum())).p(); _hist_chi_c1->fill(pcm, weight); } _mult_chi_c1->fill(10.58, weight*double(all_chi_c1.size())); _mult_chi_c1_direct->fill(10.58, weight*double(primary_chi_c1.size())); for (size_t i = 0; i < all_chi_c2.size(); i++) { const double pcm = cms_boost.transform(FourMomentum(all_chi_c2[i]->momentum())).p(); _hist_chi_c2->fill(pcm, weight); } _mult_chi_c2->fill(10.58, weight*double(all_chi_c2.size())); _mult_chi_c2_direct->fill(10.58, weight*double(primary_chi_c2.size())); } } // analyze void finalize() { scale(_hist_all_Jpsi , 0.5*0.1/_weightSum); scale(_hist_chi_c1 , 0.5*0.1/_weightSum); scale(_hist_chi_c2 , 0.5*0.1/_weightSum); scale(_hist_Psi_prime , 0.5*0.1/_weightSum); scale(_hist_primary_Jpsi , 0.5*0.1/_weightSum); scale(_mult_JPsi , 0.5*100./_weightSum); scale(_mult_JPsi_direct , 0.5*100./_weightSum); scale(_mult_chi_c1 , 0.5*100./_weightSum); scale(_mult_chi_c1_direct, 0.5*100./_weightSum); scale(_mult_chi_c2 , 0.5*100./_weightSum); scale(_mult_chi_c2_direct, 0.5*100./_weightSum); scale(_mult_Psi2S , 0.5*100./_weightSum); } // finalize void init() { declare(UnstableFinalState(), "UFS"); _mult_JPsi = bookHisto1D(1, 1, 1); _mult_JPsi_direct = bookHisto1D(1, 1, 2); _mult_chi_c1 = bookHisto1D(1, 1, 3); _mult_chi_c1_direct = bookHisto1D(1, 1, 4); _mult_chi_c2 = bookHisto1D(1, 1, 5); _mult_chi_c2_direct = bookHisto1D(1, 1, 6); _mult_Psi2S = bookHisto1D(1, 1, 7); _hist_all_Jpsi = bookHisto1D(6, 1, 1); _hist_chi_c1 = bookHisto1D(7, 1, 1); _hist_chi_c2 = bookHisto1D(7, 1, 2); _hist_Psi_prime = bookHisto1D(8, 1, 1); _hist_primary_Jpsi = bookHisto1D(10, 1, 1); } // init private: //@{ // count of weights double _weightSum; /// Histograms Histo1DPtr _hist_all_Jpsi; Histo1DPtr _hist_chi_c1; Histo1DPtr _hist_chi_c2; Histo1DPtr _hist_Psi_prime; Histo1DPtr _hist_primary_Jpsi; Histo1DPtr _mult_JPsi; Histo1DPtr _mult_JPsi_direct; Histo1DPtr _mult_chi_c1; Histo1DPtr _mult_chi_c1_direct; Histo1DPtr _mult_chi_c2; Histo1DPtr _mult_chi_c2_direct; Histo1DPtr _mult_Psi2S; //@} - void findDecayProducts(const GenParticle* p, - vector& allJpsi, - vector& primaryJpsi, - vector& Psiprime, - vector& all_chi_c1, vector& all_chi_c2, - vector& primary_chi_c1, vector& primary_chi_c2) { - const GenVertex* dv = p->end_vertex(); + void findDecayProducts(const GenParticlePtr p, + vector& allJpsi, + vector& primaryJpsi, + vector& Psiprime, + vector& all_chi_c1, vector& all_chi_c2, + vector& primary_chi_c1, vector& primary_chi_c2) { + const GenVertexPtr dv = p->end_vertex(); bool isOnium = false; /// @todo Use better looping for (GenVertex::particles_in_const_iterator pp = dv->particles_in_const_begin() ; pp != dv->particles_in_const_end() ; ++pp) { int id = (*pp)->pdg_id(); id = id%1000; id -= id%10; id /= 10; if (id==44) isOnium = true; } /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { int id = (*pp)->pdg_id(); if (id==100443) { Psiprime.push_back(*pp); } else if (id==20443) { all_chi_c1.push_back(*pp); if (!isOnium) primary_chi_c1.push_back(*pp); } else if (id==445) { all_chi_c2.push_back(*pp); if (!isOnium) primary_chi_c2.push_back(*pp); } else if (id==443) { allJpsi.push_back(*pp); if (!isOnium) primaryJpsi.push_back(*pp); } if ((*pp)->end_vertex()) { findDecayProducts(*pp, allJpsi, primaryJpsi, Psiprime, all_chi_c1, all_chi_c2, primary_chi_c1, primary_chi_c2); } } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BABAR_2003_I593379); } diff --git a/src/Analyses/BABAR_2005_S6181155.cc b/src/Analyses/BABAR_2005_S6181155.cc --- a/src/Analyses/BABAR_2005_S6181155.cc +++ b/src/Analyses/BABAR_2005_S6181155.cc @@ -1,145 +1,145 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief BABAR Xi_c baryons from fragmentation /// @author Peter Richardson class BABAR_2005_S6181155 : public Analysis { public: BABAR_2005_S6181155() : Analysis("BABAR_2005_S6181155") { } void init() { declare(Beam(), "Beams"); declare(UnstableFinalState(), "UFS"); _histOnResonanceA = bookHisto1D(1,1,1); _histOnResonanceB = bookHisto1D(2,1,1); _histOffResonance = bookHisto1D(2,1,2); _sigma = bookHisto1D(3,1,1); _histOnResonanceA_norm = bookHisto1D(4,1,1); _histOnResonanceB_norm = bookHisto1D(5,1,1); _histOffResonance_norm = bookHisto1D(5,1,2); } void analyze(const Event& e) { const double weight = e.weight(); // Loop through unstable FS particles and look for charmed mesons/baryons const UnstableFinalState& ufs = apply(e, "UFS"); const Beam beamproj = apply(e, "Beams"); const ParticlePair& beams = beamproj.beams(); const FourMomentum mom_tot = beams.first.momentum() + beams.second.momentum(); const LorentzTransform cms_boost = LorentzTransform::mkFrameTransformFromBeta(mom_tot.betaVec()); const double s = sqr(beamproj.sqrtS()); const bool onresonance = fuzzyEquals(beamproj.sqrtS()/GeV, 10.58, 2E-3); foreach (const Particle& p, ufs.particles()) { // 3-momentum in CMS frame const double mom = cms_boost.transform(p.momentum()).vector3().mod(); // Only looking at Xi_c^0 if (p.abspid() != 4132 ) continue; if (onresonance) { _histOnResonanceA_norm->fill(mom,weight); _histOnResonanceB_norm->fill(mom,weight); } else { _histOffResonance_norm->fill(mom,s/sqr(10.58)*weight); } MSG_DEBUG("mom = " << mom); // off-resonance cross section if (checkDecay(p.genParticle())) { if (onresonance) { _histOnResonanceA->fill(mom,weight); _histOnResonanceB->fill(mom,weight); } else { _histOffResonance->fill(mom,s/sqr(10.58)*weight); _sigma->fill(10.6,weight); } } } } void finalize() { scale(_histOnResonanceA, crossSection()/femtobarn/sumOfWeights()); scale(_histOnResonanceB, crossSection()/femtobarn/sumOfWeights()); scale(_histOffResonance, crossSection()/femtobarn/sumOfWeights()); scale(_sigma , crossSection()/femtobarn/sumOfWeights()); normalize(_histOnResonanceA_norm); normalize(_histOnResonanceB_norm); normalize(_histOffResonance_norm); } private: //@{ /// Histograms Histo1DPtr _histOnResonanceA; Histo1DPtr _histOnResonanceB; Histo1DPtr _histOffResonance; Histo1DPtr _sigma ; Histo1DPtr _histOnResonanceA_norm; Histo1DPtr _histOnResonanceB_norm; Histo1DPtr _histOffResonance_norm; //@} - bool checkDecay(const GenParticle* p) { + bool checkDecay(const GenParticlePtr p) { unsigned int nstable = 0, npip = 0, npim = 0; unsigned int nXim = 0, nXip = 0; findDecayProducts(p, nstable, npip, npim, nXip, nXim); int id = p->pdg_id(); // Xi_c if (id == 4132) { if (nstable == 2 && nXim == 1 && npip == 1) return true; } else if (id == -4132) { if (nstable == 2 && nXip == 1 && npim == 1) return true; } return false; } - void findDecayProducts(const GenParticle* p, + void findDecayProducts(const GenParticlePtr p, unsigned int& nstable, unsigned int& npip, unsigned int& npim, unsigned int& nXip, unsigned int& nXim) { - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { int id = (*pp)->pdg_id(); if (id==3312) { ++nXim; ++nstable; } else if (id == -3312) { ++nXip; ++nstable; } else if(id == 111 || id == 221) { ++nstable; } else if ((*pp)->end_vertex()) { findDecayProducts(*pp, nstable, npip, npim, nXip, nXim); } else { if (id != 22) ++nstable; if (id == 211) ++npip; else if(id == -211) ++npim; } } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BABAR_2005_S6181155); } diff --git a/src/Analyses/BABAR_2007_S7266081.cc b/src/Analyses/BABAR_2007_S7266081.cc --- a/src/Analyses/BABAR_2007_S7266081.cc +++ b/src/Analyses/BABAR_2007_S7266081.cc @@ -1,181 +1,181 @@ // -*- C++ -*- #include #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief BABAR tau lepton to three charged hadrons /// @author Peter Richardson class BABAR_2007_S7266081 : public Analysis { public: BABAR_2007_S7266081() : Analysis("BABAR_2007_S7266081"), _weight_total(0), _weight_pipipi(0), _weight_Kpipi(0), _weight_KpiK(0), _weight_KKK(0) { } void init() { declare(UnstableFinalState(), "UFS"); _hist_pipipi_pipipi = bookHisto1D( 1, 1, 1); _hist_pipipi_pipi = bookHisto1D( 2, 1, 1); _hist_Kpipi_Kpipi = bookHisto1D( 3, 1, 1); _hist_Kpipi_Kpi = bookHisto1D( 4, 1, 1); _hist_Kpipi_pipi = bookHisto1D( 5, 1, 1); _hist_KpiK_KpiK = bookHisto1D( 6, 1, 1); _hist_KpiK_KK = bookHisto1D( 7, 1, 1); _hist_KpiK_piK = bookHisto1D( 8, 1, 1); _hist_KKK_KKK = bookHisto1D( 9, 1, 1); _hist_KKK_KK = bookHisto1D(10, 1, 1); } void analyze(const Event& e) { double weight = e.weight(); // Find the taus Particles taus; foreach(const Particle& p, apply(e, "UFS").particles(Cuts::pid==PID::TAU)) { _weight_total += weight; Particles pip, pim, Kp, Km; unsigned int nstable = 0; // Get the boost to the rest frame LorentzTransform cms_boost; if (p.p3().mod() > 1*MeV) cms_boost = LorentzTransform::mkFrameTransformFromBeta(p.momentum().betaVec()); // Find the decay products we want findDecayProducts(p.genParticle(), nstable, pip, pim, Kp, Km); if (p.pid() < 0) { swap(pip, pim); swap(Kp, Km ); } if (nstable != 4) continue; // pipipi if (pim.size() == 2 && pip.size() == 1) { _weight_pipipi += weight; _hist_pipipi_pipipi-> fill((pip[0].momentum()+pim[0].momentum()+pim[1].momentum()).mass(), weight); _hist_pipipi_pipi-> fill((pip[0].momentum()+pim[0].momentum()).mass(), weight); _hist_pipipi_pipi-> fill((pip[0].momentum()+pim[1].momentum()).mass(), weight); } else if (pim.size() == 1 && pip.size() == 1 && Km.size() == 1) { _weight_Kpipi += weight; _hist_Kpipi_Kpipi-> fill((pim[0].momentum()+pip[0].momentum()+Km[0].momentum()).mass(), weight); _hist_Kpipi_Kpi-> fill((pip[0].momentum()+Km[0].momentum()).mass(), weight); _hist_Kpipi_pipi-> fill((pim[0].momentum()+pip[0].momentum()).mass(), weight); } else if (Kp.size() == 1 && Km.size() == 1 && pim.size() == 1) { _weight_KpiK += weight; _hist_KpiK_KpiK-> fill((Kp[0].momentum()+Km[0].momentum()+pim[0].momentum()).mass(), weight); _hist_KpiK_KK-> fill((Kp[0].momentum()+Km[0].momentum()).mass(), weight); _hist_KpiK_piK-> fill((Kp[0].momentum()+pim[0].momentum()).mass(), weight); } else if (Kp.size() == 1 && Km.size() == 2) { _weight_KKK += weight; _hist_KKK_KKK-> fill((Kp[0].momentum()+Km[0].momentum()+Km[1].momentum()).mass(), weight); _hist_KKK_KK-> fill((Kp[0].momentum()+Km[0].momentum()).mass(), weight); _hist_KKK_KK-> fill((Kp[0].momentum()+Km[1].momentum()).mass(), weight); } } } void finalize() { if (_weight_pipipi > 0.) { scale(_hist_pipipi_pipipi, 1.0/_weight_pipipi); scale(_hist_pipipi_pipi , 0.5/_weight_pipipi); } if (_weight_Kpipi > 0.) { scale(_hist_Kpipi_Kpipi , 1.0/_weight_Kpipi); scale(_hist_Kpipi_Kpi , 1.0/_weight_Kpipi); scale(_hist_Kpipi_pipi , 1.0/_weight_Kpipi); } if (_weight_KpiK > 0.) { scale(_hist_KpiK_KpiK , 1.0/_weight_KpiK); scale(_hist_KpiK_KK , 1.0/_weight_KpiK); scale(_hist_KpiK_piK , 1.0/_weight_KpiK); } if (_weight_KKK > 0.) { scale(_hist_KKK_KKK , 1.0/_weight_KKK); scale(_hist_KKK_KK , 0.5/_weight_KKK); } /// @note Using autobooking for these scatters since their x values are not really obtainable from the MC data bookScatter2D(11, 1, 1, true)->point(0).setY(100*_weight_pipipi/_weight_total, 100*sqrt(_weight_pipipi)/_weight_total); bookScatter2D(12, 1, 1, true)->point(0).setY(100*_weight_Kpipi/_weight_total, 100*sqrt(_weight_Kpipi)/_weight_total); bookScatter2D(13, 1, 1, true)->point(0).setY(100*_weight_KpiK/_weight_total, 100*sqrt(_weight_KpiK)/_weight_total); bookScatter2D(14, 1, 1, true)->point(0).setY(100*_weight_KKK/_weight_total, 100*sqrt(_weight_KKK)/_weight_total); } private: //@{ // Histograms Histo1DPtr _hist_pipipi_pipipi, _hist_pipipi_pipi; Histo1DPtr _hist_Kpipi_Kpipi, _hist_Kpipi_Kpi, _hist_Kpipi_pipi; Histo1DPtr _hist_KpiK_KpiK, _hist_KpiK_KK, _hist_KpiK_piK; Histo1DPtr _hist_KKK_KKK, _hist_KKK_KK; // Weights counters double _weight_total, _weight_pipipi, _weight_Kpipi, _weight_KpiK, _weight_KKK; //@} - void findDecayProducts(const GenParticle* p, + void findDecayProducts(const GenParticlePtr p, unsigned int & nstable, Particles& pip, Particles& pim, Particles& Kp, Particles& Km) { - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { int id = (*pp)->pdg_id(); if (id == PID::PI0 ) ++nstable; else if (id == PID::K0S) ++nstable; else if (id == PID::PIPLUS) { pip.push_back(Particle(**pp)); ++nstable; } else if (id == PID::PIMINUS) { pim.push_back(Particle(**pp)); ++nstable; } else if (id == PID::KPLUS) { Kp.push_back(Particle(**pp)); ++nstable; } else if (id == PID::KMINUS) { Km.push_back(Particle(**pp)); ++nstable; } else if ((*pp)->end_vertex()) { findDecayProducts(*pp, nstable, pip, pim, Kp, Km); } else ++nstable; } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BABAR_2007_S7266081); } diff --git a/src/Analyses/BABAR_2013_I1238276.cc b/src/Analyses/BABAR_2013_I1238276.cc --- a/src/Analyses/BABAR_2013_I1238276.cc +++ b/src/Analyses/BABAR_2013_I1238276.cc @@ -1,117 +1,117 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/ChargedFinalState.hh" namespace Rivet { /// @brief BaBar pion, kaon and proton production in the continuum /// @author Peter Richardson class BABAR_2013_I1238276 : public Analysis { public: BABAR_2013_I1238276() : Analysis("BABAR_2013_I1238276") { } void init() { declare(Beam(), "Beams"); declare(ChargedFinalState(), "FS"); _histPion_no_dec = bookHisto1D(1,1,1); _histKaon_no_dec = bookHisto1D(1,1,2); _histProton_no_dec = bookHisto1D(1,1,3); _histPion_dec = bookHisto1D(2,1,1); _histKaon_dec = bookHisto1D(2,1,2); _histProton_dec = bookHisto1D(2,1,3); } void analyze(const Event& e) { const double weight = e.weight(); // Loop through charged FS particles and look for charmed mesons/baryons const ChargedFinalState& fs = apply(e, "FS"); const Beam beamproj = apply(e, "Beams"); const ParticlePair& beams = beamproj.beams(); const FourMomentum mom_tot = beams.first.momentum() + beams.second.momentum(); const LorentzTransform cms_boost = LorentzTransform::mkFrameTransformFromBeta(mom_tot.betaVec()); MSG_DEBUG("CMS Energy sqrt s = " << beamproj.sqrtS()); foreach (const Particle& p, fs.particles()) { // check if prompt or not - const GenParticle* pmother = p.genParticle(); - const GenVertex* ivertex = pmother->production_vertex(); + const GenParticlePtr pmother = p.genParticle(); + const GenVertexPtr ivertex = pmother->production_vertex(); bool prompt = true; while (ivertex) { int n_inparts = ivertex->particles_in_size(); if (n_inparts < 1) break; pmother = particles(ivertex, HepMC::parents)[0]; // first mother particle int mother_pid = abs(pmother->pdg_id()); if (mother_pid==PID::K0S || mother_pid==PID::LAMBDA) { prompt = false; break; } else if (mother_pid<6) { break; } ivertex = pmother->production_vertex(); } // momentum in CMS frame const double mom = cms_boost.transform(p.momentum()).vector3().mod(); const int PdgId = p.abspid(); MSG_DEBUG("pdgID = " << PdgId << " Momentum = " << mom); switch (PdgId) { case PID::PIPLUS: if(prompt) _histPion_no_dec->fill(mom,weight); _histPion_dec ->fill(mom,weight); break; case PID::KPLUS: if(prompt) _histKaon_no_dec->fill(mom,weight); _histKaon_dec ->fill(mom,weight); break; case PID::PROTON: if(prompt) _histProton_no_dec->fill(mom,weight); _histProton_dec ->fill(mom,weight); default : break; } } } void finalize() { scale(_histPion_no_dec ,1./sumOfWeights()); scale(_histKaon_no_dec ,1./sumOfWeights()); scale(_histProton_no_dec,1./sumOfWeights()); scale(_histPion_dec ,1./sumOfWeights()); scale(_histKaon_dec ,1./sumOfWeights()); scale(_histProton_dec ,1./sumOfWeights()); } private: //@{ // Histograms for continuum data (sqrt(s) = 10.52 GeV) // no K_S and Lambda decays Histo1DPtr _histPion_no_dec; Histo1DPtr _histKaon_no_dec; Histo1DPtr _histProton_no_dec; // including decays Histo1DPtr _histPion_dec; Histo1DPtr _histKaon_dec; Histo1DPtr _histProton_dec; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BABAR_2013_I1238276); } diff --git a/src/Analyses/BELLE_2001_S4598261.cc b/src/Analyses/BELLE_2001_S4598261.cc --- a/src/Analyses/BELLE_2001_S4598261.cc +++ b/src/Analyses/BELLE_2001_S4598261.cc @@ -1,106 +1,106 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief BELLE pi0 spectrum at Upsilon(4S) /// @author Peter Richardson class BELLE_2001_S4598261 : public Analysis { public: BELLE_2001_S4598261() : Analysis("BELLE_2001_S4598261"), _weightSum(0.) { } void init() { declare(UnstableFinalState(), "UFS"); _histdSigDp = bookHisto1D(1, 1, 1); // spectrum _histMult = bookHisto1D(2, 1, 1); // multiplicity } void analyze(const Event& e) { const double weight = e.weight(); // Find the upsilons Particles upsilons; // First in unstable final state const UnstableFinalState& ufs = apply(e, "UFS"); foreach (const Particle& p, ufs.particles()) if (p.pid()==300553) upsilons.push_back(p); // Then in whole event if fails if (upsilons.empty()) { - foreach (const GenParticle* p, Rivet::particles(e.genEvent())) { + foreach (const GenParticlePtr p, Rivet::particles(e.genEvent())) { if (p->pdg_id() != 300553) continue; - const GenVertex* pv = p->production_vertex(); + const GenVertexPtr pv = p->production_vertex(); bool passed = true; if (pv) { /// @todo Use better looping for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin() ; pp != pv->particles_in_const_end() ; ++pp) { if ( p->pdg_id() == (*pp)->pdg_id() ) { passed = false; break; } } } if (passed) upsilons.push_back(Particle(p)); } } // Find upsilons foreach (const Particle& p, upsilons) { _weightSum += weight; // Find the neutral pions from the decay vector pions; findDecayProducts(p.genParticle(), pions); const LorentzTransform cms_boost = LorentzTransform::mkFrameTransformFromBeta(p.momentum().betaVec()); for (size_t ix=0; ixmomentum())).p(); _histdSigDp->fill(pcm,weight); } _histMult->fill(0., pions.size()*weight); } } void finalize() { scale(_histdSigDp, 1./_weightSum); scale(_histMult , 1./_weightSum); } private: //@{ // count of weights double _weightSum; /// Histograms Histo1DPtr _histdSigDp; Histo1DPtr _histMult; //@} - void findDecayProducts(const GenParticle* p, vector& pions) { - const GenVertex* dv = p->end_vertex(); + void findDecayProducts(const GenParticlePtr p, vector& pions) { + const GenVertexPtr dv = p->end_vertex(); /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { const int id = (*pp)->pdg_id(); if (id == 111) { pions.push_back(*pp); } else if ((*pp)->end_vertex()) findDecayProducts(*pp, pions); } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BELLE_2001_S4598261); } diff --git a/src/Analyses/BELLE_2008_I786560.cc b/src/Analyses/BELLE_2008_I786560.cc --- a/src/Analyses/BELLE_2008_I786560.cc +++ b/src/Analyses/BELLE_2008_I786560.cc @@ -1,112 +1,112 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// @brief BELLE tau lepton to pi pi /// @author Peter Richardson class BELLE_2008_I786560 : public Analysis { public: BELLE_2008_I786560() : Analysis("BELLE_2008_I786560"), _weight_total(0), _weight_pipi(0) { } void init() { declare(UnstableFinalState(), "UFS"); _hist_pipi = bookHisto1D( 1, 1, 1); } void analyze(const Event& e) { // Find the taus Particles taus; const UnstableFinalState& ufs = apply(e, "UFS"); foreach (const Particle& p, ufs.particles()) { if (p.abspid() != PID::TAU) continue; _weight_total += 1.; Particles pip, pim, pi0; unsigned int nstable = 0; // get the boost to the rest frame LorentzTransform cms_boost; if (p.p3().mod() > 1*MeV) cms_boost = LorentzTransform::mkFrameTransformFromBeta(p.momentum().betaVec()); // find the decay products we want findDecayProducts(p.genParticle(), nstable, pip, pim, pi0); if (p.pid() < 0) { swap(pip, pim); } if (nstable != 3) continue; // pipi if (pim.size() == 1 && pi0.size() == 1) { _weight_pipi += 1.; _hist_pipi->fill((pi0[0].momentum()+pim[0].momentum()).mass2(),1.); } } } void finalize() { if (_weight_pipi > 0.) scale(_hist_pipi, 1./_weight_pipi); } private: //@{ // Histograms Histo1DPtr _hist_pipi; // Weights counters double _weight_total, _weight_pipi; //@} - void findDecayProducts(const GenParticle* p, + void findDecayProducts(const GenParticlePtr p, unsigned int & nstable, Particles& pip, Particles& pim, Particles& pi0) { - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); /// @todo Use better looping for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin(); pp != dv->particles_out_const_end(); ++pp) { int id = (*pp)->pdg_id(); if (id == PID::PI0 ) { pi0.push_back(Particle(**pp)); ++nstable; } else if (id == PID::K0S) ++nstable; else if (id == PID::PIPLUS) { pip.push_back(Particle(**pp)); ++nstable; } else if (id == PID::PIMINUS) { pim.push_back(Particle(**pp)); ++nstable; } else if (id == PID::KPLUS) { ++nstable; } else if (id == PID::KMINUS) { ++nstable; } else if ((*pp)->end_vertex()) { findDecayProducts(*pp, nstable, pip, pim, pi0); } else ++nstable; } } }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BELLE_2008_I786560); } diff --git a/src/Analyses/CDF_2008_S8095620.cc b/src/Analyses/CDF_2008_S8095620.cc --- a/src/Analyses/CDF_2008_S8095620.cc +++ b/src/Analyses/CDF_2008_S8095620.cc @@ -1,187 +1,187 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FastJets.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/VetoedFinalState.hh" #include "Rivet/Projections/InvMassFinalState.hh" namespace Rivet { /// @brief CDF Run II Z + b-jet cross-section measurement class CDF_2008_S8095620 : public Analysis { public: /// Constructor. /// jet cuts: |eta| <= 1.5 CDF_2008_S8095620() : Analysis("CDF_2008_S8095620"), _Rjet(0.7), _JetPtCut(20.), _JetEtaCut(1.5), _Lep1PtCut(18.), _Lep2PtCut(10.), _LepEtaCut(3.2), _sumWeightSelected(0.0) { } /// @name Analysis methods //@{ void init() { // Set up projections const FinalState fs(-3.2, 3.2); declare(fs, "FS"); // Create a final state with any e+e- or mu+mu- pair with // invariant mass 76 -> 106 GeV and ET > 18 (Z decay products) vector > vids; vids.push_back(make_pair(PID::ELECTRON, PID::POSITRON)); vids.push_back(make_pair(PID::MUON, PID::ANTIMUON)); FinalState fs2(-3.2, 3.2); InvMassFinalState invfs(fs2, vids, 76*GeV, 106*GeV); declare(invfs, "INVFS"); // Make a final state without the Z decay products for jet clustering VetoedFinalState vfs(fs); vfs.addVetoOnThisFinalState(invfs); declare(vfs, "VFS"); declare(FastJets(vfs, FastJets::CDFMIDPOINT, 0.7), "Jets"); // Book histograms _dStot = bookHisto1D(1, 1, 1); _dSdET = bookHisto1D(2, 1, 1); _dSdETA = bookHisto1D(3, 1, 1); _dSdZpT = bookHisto1D(4, 1, 1); _dSdNJet = bookHisto1D(5, 1, 1); _dSdNbJet = bookHisto1D(6, 1, 1); } // Do the analysis void analyze(const Event& event) { // Check we have an l+l- pair that passes the kinematic cuts // Get the Z decay products (mu+mu- or e+e- pair) const InvMassFinalState& invMassFinalState = apply(event, "INVFS"); const Particles& ZDecayProducts = invMassFinalState.particles(); // make sure we have 2 Z decay products (mumu or ee) if (ZDecayProducts.size() < 2) vetoEvent; //new cuts double Lep1Pt = ZDecayProducts[0].perp(); double Lep2Pt = ZDecayProducts[1].perp(); double Lep1Eta = fabs(ZDecayProducts[0].rapidity()); double Lep2Eta = fabs(ZDecayProducts[1].rapidity()); if (Lep1Eta > _LepEtaCut || Lep2Eta > _LepEtaCut) vetoEvent; if (ZDecayProducts[0].abspid()==13 && ((Lep1Eta > 1.5 || Lep2Eta > 1.5) || (Lep1Eta > 1.0 && Lep2Eta > 1.0))) { vetoEvent; } if (Lep1Pt > Lep2Pt) { if (Lep1Pt < _Lep1PtCut || Lep2Pt < _Lep2PtCut) vetoEvent; } else { if (Lep1Pt < _Lep2PtCut || Lep2Pt < _Lep1PtCut) vetoEvent; } _sumWeightSelected += event.weight(); /// @todo: write out a warning if there are more than two decay products FourMomentum Zmom = ZDecayProducts[0].momentum() + ZDecayProducts[1].momentum(); // Put all b-quarks in a vector /// @todo Use a b-hadron search rather than b-quarks for tagging Particles bquarks; - foreach (const GenParticle* p, particles(event.genEvent())) { + foreach (const GenParticlePtr p, particles(event.genEvent())) { if (std::abs(p->pdg_id()) == PID::BQUARK) { bquarks += Particle(*p); } } // Get jets const FastJets& jetpro = apply(event, "Jets"); MSG_DEBUG("Jet multiplicity before any pT cut = " << jetpro.size()); const PseudoJets& jets = jetpro.pseudoJetsByPt(); MSG_DEBUG("jetlist size = " << jets.size()); int numBJet = 0; int numJet = 0; // for each b-jet plot the ET and the eta of the jet, normalise to the total cross section at the end // for each event plot N jet and pT(Z), normalise to the total cross section at the end for (PseudoJets::const_iterator jt = jets.begin(); jt != jets.end(); ++jt) { // select jets that pass the kinematic cuts if (jt->perp() > _JetPtCut && fabs(jt->rapidity()) <= _JetEtaCut) { numJet++; // does the jet contain a b-quark? bool bjet = false; foreach (const Particle& bquark, bquarks) { if (deltaR(jt->rapidity(), jt->phi(), bquark.rapidity(),bquark.phi()) <= _Rjet) { bjet = true; break; } } // end loop around b-jets if (bjet) { numBJet++; _dSdET->fill(jt->perp(),event.weight()); _dSdETA->fill(fabs(jt->rapidity()),event.weight()); } } } // end loop around jets // wasn't asking for b-jets before!!!! if(numJet > 0 && numBJet > 0) _dSdNJet->fill(numJet,event.weight()); if(numBJet > 0) { _dStot->fill(1960.0,event.weight()); _dSdNbJet->fill(numBJet,event.weight()); _dSdZpT->fill(Zmom.pT(),event.weight()); } } // Finalize void finalize() { // normalise histograms // scale by 1 / the sum-of-weights of events that pass the Z cuts // since the cross sections are normalized to the inclusive // Z cross sections. double Scale = 1.0; if (_sumWeightSelected != 0.0) Scale = 1.0/_sumWeightSelected; scale(_dStot,Scale); scale(_dSdET,Scale); scale(_dSdETA,Scale); scale(_dSdNJet,Scale); scale(_dSdNbJet,Scale); scale(_dSdZpT,Scale); } //@} private: double _Rjet; double _JetPtCut; double _JetEtaCut; double _Lep1PtCut; double _Lep2PtCut; double _LepEtaCut; double _sumWeightSelected; //@{ /// Histograms Histo1DPtr _dStot; Histo1DPtr _dSdET; Histo1DPtr _dSdETA; Histo1DPtr _dSdNJet; Histo1DPtr _dSdNbJet; Histo1DPtr _dSdZpT; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CDF_2008_S8095620); } diff --git a/src/Analyses/CMS_2011_S8941262.cc b/src/Analyses/CMS_2011_S8941262.cc --- a/src/Analyses/CMS_2011_S8941262.cc +++ b/src/Analyses/CMS_2011_S8941262.cc @@ -1,76 +1,76 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/IdentifiedFinalState.hh" #include "Rivet/Particle.hh" namespace Rivet { class CMS_2011_S8941262 : public Analysis { public: /// Constructor CMS_2011_S8941262() : Analysis("CMS_2011_S8941262") { } /// Book histograms and initialise projections before the run void init() { _h_total = bookHisto1D(1, 1, 1); _h_mupt = bookHisto1D(2, 1, 1); _h_mueta = bookHisto1D(3, 1, 1); nbtot=0.; nbmutot=0.; IdentifiedFinalState ifs(Cuts::abseta < 2.1 && Cuts::pT > 6*GeV); ifs.acceptIdPair(PID::MUON); declare(ifs, "IFS"); } /// Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); // a b-quark must have been produced /// @todo Ouch. Use hadron tagging... int nb = 0; - foreach (const GenParticle* p, particles(event.genEvent())) { + foreach (const GenParticlePtr p, particles(event.genEvent())) { if (abs(p->pdg_id()) == PID::BQUARK) nb += 1; } if (nb == 0) vetoEvent; nbtot += weight; // Event must contain a muon Particles muons = apply(event, "IFS").particlesByPt(); if (muons.size() < 1) vetoEvent; nbmutot += weight; FourMomentum pmu = muons[0].momentum(); _h_total->fill( 7000/GeV, weight); _h_mupt->fill( pmu.pT()/GeV, weight); _h_mueta->fill( pmu.eta()/GeV, weight); } /// Normalise histograms etc., after the run void finalize() { scale(_h_total, crossSection()/microbarn/sumOfWeights()); scale(_h_mupt, crossSection()/nanobarn/sumOfWeights()); scale(_h_mueta, crossSection()/nanobarn/sumOfWeights()); } private: double nbtot, nbmutot; Histo1DPtr _h_total; Histo1DPtr _h_mupt; Histo1DPtr _h_mueta; }; // Hook for the plugin system DECLARE_RIVET_PLUGIN(CMS_2011_S8941262); } diff --git a/src/Analyses/CMS_2013_I1256943.cc b/src/Analyses/CMS_2013_I1256943.cc --- a/src/Analyses/CMS_2013_I1256943.cc +++ b/src/Analyses/CMS_2013_I1256943.cc @@ -1,188 +1,188 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/ZFinder.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// CMS cross-section and angular correlations in Z boson + b-hadrons events at 7 TeV class CMS_2013_I1256943 : public Analysis { public: /// Constructor CMS_2013_I1256943() : Analysis("CMS_2013_I1256943") { } /// Add projections and book histograms void init() { _sumW = 0; _sumW50 = 0; _sumWpT = 0; FinalState fs(Cuts::abseta < 2.4 && Cuts::pT > 20*GeV); declare(fs, "FS"); UnstableFinalState ufs(Cuts::abseta < 2 && Cuts::pT > 15*GeV); declare(ufs, "UFS"); Cut zetacut = Cuts::abseta < 2.4; ZFinder zfindermu(fs, zetacut, PID::MUON, 81.0*GeV, 101.0*GeV, 0.1, ZFinder::NOCLUSTER, ZFinder::TRACK, 91.2*GeV); declare(zfindermu, "ZFinderMu"); ZFinder zfinderel(fs, zetacut, PID::ELECTRON, 81.0*GeV, 101.0*GeV, 0.1, ZFinder::NOCLUSTER, ZFinder::TRACK, 91.2*GeV); declare(zfinderel, "ZFinderEl"); // Histograms in non-boosted region of Z pT _h_dR_BB = bookHisto1D(1, 1, 1); _h_dphi_BB = bookHisto1D(2, 1, 1); _h_min_dR_ZB = bookHisto1D(3, 1, 1); _h_A_ZBB = bookHisto1D(4, 1, 1); // Histograms in boosted region of Z pT (pT > 50 GeV) _h_dR_BB_boost = bookHisto1D(5, 1, 1); _h_dphi_BB_boost = bookHisto1D(6, 1, 1); _h_min_dR_ZB_boost = bookHisto1D(7, 1, 1); _h_A_ZBB_boost = bookHisto1D(8, 1, 1); _h_min_ZpT = bookHisto1D(9,1,1); } /// Do the analysis void analyze(const Event& e) { vector Bmom; const UnstableFinalState& ufs = apply(e, "UFS"); const ZFinder& zfindermu = apply(e, "ZFinderMu"); const ZFinder& zfinderel = apply(e, "ZFinderEl"); // Look for a Z --> mu+ mu- event in the final state if (zfindermu.empty() && zfinderel.empty()) vetoEvent; const Particles& z = !zfindermu.empty() ? zfindermu.bosons() : zfinderel.bosons(); const bool is_boosted = ( z[0].pT() > 50*GeV ); // Loop over the unstable particles foreach (const Particle& p, ufs.particles()) { const PdgId pid = p.pid(); // Look for particles with a bottom quark if (PID::hasBottom(pid)) { bool good_B = false; - const GenParticle* pgen = p.genParticle(); - const GenVertex* vgen = pgen -> end_vertex(); + const GenParticlePtr pgen = p.genParticle(); + const GenVertexPtr vgen = pgen -> end_vertex(); // Loop over the decay products of each unstable particle. // Look for a couple of B hadrons. for (GenVertex::particles_out_const_iterator it = vgen->particles_out_const_begin(); it != vgen->particles_out_const_end(); ++it) { // If the particle produced has a bottom quark do not count it and go to the next loop cycle. if (!( PID::hasBottom( (*it)->pdg_id() ) ) ) { good_B = true; continue; } else { good_B = false; break; } } if (good_B ) Bmom.push_back( p.momentum() ); } else continue; } // If there are more than two B's in the final state veto the event if (Bmom.size() != 2 ) vetoEvent; // Calculate the observables double dphiBB = deltaPhi(Bmom[0], Bmom[1]); double dRBB = deltaR(Bmom[0], Bmom[1]); const FourMomentum& pZ = z[0].momentum(); const bool closest_B = ( deltaR(pZ, Bmom[0]) < deltaR(pZ, Bmom[1]) ); const double mindR_ZB = closest_B ? deltaR(pZ, Bmom[0]) : deltaR(pZ, Bmom[1]); const double maxdR_ZB = closest_B ? deltaR(pZ, Bmom[1]) : deltaR(pZ, Bmom[0]); const double AZBB = ( maxdR_ZB - mindR_ZB ) / ( maxdR_ZB + mindR_ZB ); // Get event weight for histogramming const double weight = e.weight(); // Fill the histograms in the non-boosted region _h_dphi_BB->fill(dphiBB, weight); _h_dR_BB->fill(dRBB, weight); _h_min_dR_ZB->fill(mindR_ZB, weight); _h_A_ZBB->fill(AZBB, weight); _sumW += weight; _sumWpT += weight; // Fill the histograms in the boosted region if (is_boosted) { _sumW50 += weight; _h_dphi_BB_boost->fill(dphiBB, weight); _h_dR_BB_boost->fill(dRBB, weight); _h_min_dR_ZB_boost->fill(mindR_ZB, weight); _h_A_ZBB_boost->fill(AZBB, weight); } // Fill Z pT (cumulative) histogram _h_min_ZpT->fill(0, weight); if (pZ.pT() > 40*GeV ) { _sumWpT += weight; _h_min_ZpT->fill(40, weight); } if (pZ.pT() > 80*GeV ) { _sumWpT += weight; _h_min_ZpT->fill(80, weight); } if (pZ.pT() > 120*GeV ) { _sumWpT += weight; _h_min_ZpT->fill(120, weight); } Bmom.clear(); } /// Finalize void finalize() { // Normalize excluding overflow bins (d'oh) normalize(_h_dR_BB, 0.7*crossSection()*_sumW/sumOfWeights(), false); // d01-x01-y01 normalize(_h_dphi_BB, 0.53*crossSection()*_sumW/sumOfWeights(), false); // d02-x01-y01 normalize(_h_min_dR_ZB, 0.84*crossSection()*_sumW/sumOfWeights(), false); // d03-x01-y01 normalize(_h_A_ZBB, 0.2*crossSection()*_sumW/sumOfWeights(), false); // d04-x01-y01 normalize(_h_dR_BB_boost, 0.84*crossSection()*_sumW50/sumOfWeights(), false); // d05-x01-y01 normalize(_h_dphi_BB_boost, 0.63*crossSection()*_sumW50/sumOfWeights(), false); // d06-x01-y01 normalize(_h_min_dR_ZB_boost, 1*crossSection()*_sumW50/sumOfWeights(), false); // d07-x01-y01 normalize(_h_A_ZBB_boost, 0.25*crossSection()*_sumW50/sumOfWeights(), false); // d08-x01-y01 normalize(_h_min_ZpT, 40*crossSection()*_sumWpT/sumOfWeights(), false); // d09-x01-y01 } private: /// @name Weight counters //@{ double _sumW, _sumW50, _sumWpT; //@} /// @name Histograms //@{ Histo1DPtr _h_dphi_BB, _h_dR_BB, _h_min_dR_ZB, _h_A_ZBB; Histo1DPtr _h_dphi_BB_boost, _h_dR_BB_boost, _h_min_dR_ZB_boost, _h_A_ZBB_boost, _h_min_ZpT; //@} }; // Hook for the plugin system DECLARE_RIVET_PLUGIN(CMS_2013_I1256943); } diff --git a/src/Analyses/CMS_2015_I1370682.cc b/src/Analyses/CMS_2015_I1370682.cc --- a/src/Analyses/CMS_2015_I1370682.cc +++ b/src/Analyses/CMS_2015_I1370682.cc @@ -1,612 +1,612 @@ #include "Rivet/Analysis.hh" #include "Rivet/Math/LorentzTrans.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/FastJets.hh" namespace Rivet { namespace { //< only visible in this compilation unit /// @brief Pseudo top finder /// /// Find top quark in the particle level. /// The definition is based on the agreement at the LHC working group. class PseudoTop : public FinalState { public: /// @name Standard constructors and destructors. //@{ /// The default constructor. May specify the minimum and maximum /// pseudorapidity \f$ \eta \f$ and the min \f$ p_T \f$ (in GeV). PseudoTop(double lepR = 0.1, double lepMinPt = 20, double lepMaxEta = 2.4, double jetR = 0.4, double jetMinPt = 30, double jetMaxEta = 4.7) : FinalState(-MAXDOUBLE, MAXDOUBLE, 0*GeV), _lepR(lepR), _lepMinPt(lepMinPt), _lepMaxEta(lepMaxEta), _jetR(jetR), _jetMinPt(jetMinPt), _jetMaxEta(jetMaxEta) { setName("PseudoTop"); } enum TTbarMode {CH_NONE=-1, CH_FULLHADRON = 0, CH_SEMILEPTON, CH_FULLLEPTON}; enum DecayMode {CH_HADRON = 0, CH_MUON, CH_ELECTRON}; TTbarMode mode() const { if (!_isValid) return CH_NONE; if (_mode1 == CH_HADRON && _mode2 == CH_HADRON) return CH_FULLHADRON; else if ( _mode1 != CH_HADRON && _mode2 != CH_HADRON) return CH_FULLLEPTON; else return CH_SEMILEPTON; } DecayMode mode1() const {return _mode1;} DecayMode mode2() const {return _mode2;} /// Clone on the heap. virtual unique_ptr clone() const { return unique_ptr(new PseudoTop(*this)); } //@} public: Particle t1() const {return _t1;} Particle t2() const {return _t2;} Particle b1() const {return _b1;} Particle b2() const {return _b2;} ParticleVector wDecays1() const {return _wDecays1;} ParticleVector wDecays2() const {return _wDecays2;} Jets jets() const {return _jets;} Jets bjets() const {return _bjets;} Jets ljets() const {return _ljets;} protected: // Apply the projection to the event void project(const Event& e); // override; ///< @todo Re-enable when C++11 allowed void cleanup(std::map >& v, const bool doCrossCleanup=false) const; private: const double _lepR, _lepMinPt, _lepMaxEta; const double _jetR, _jetMinPt, _jetMaxEta; //constexpr ///< @todo Re-enable when C++11 allowed static double _tMass; // = 172.5*GeV; ///< @todo Re-enable when C++11 allowed //constexpr ///< @todo Re-enable when C++11 allowed static double _wMass; // = 80.4*GeV; ///< @todo Re-enable when C++11 allowed private: bool _isValid; DecayMode _mode1, _mode2; Particle _t1, _t2; Particle _b1, _b2; ParticleVector _wDecays1, _wDecays2; Jets _jets, _bjets, _ljets; }; // More implementation below the analysis code } /// Pseudo-top analysis from CMS class CMS_2015_I1370682 : public Analysis { public: CMS_2015_I1370682() : Analysis("CMS_2015_I1370682"), _applyCorrection(true), _doShapeOnly(false) { } void init() { declare(PseudoTop(0.1, 20, 2.4, 0.5, 30, 2.4), "ttbar"); // Lepton + Jet channel _hSL_topPt = bookHisto1D("d15-x01-y01"); // 1/sigma dsigma/dpt(top) _hSL_topPtTtbarSys = bookHisto1D("d16-x01-y01"); // 1/sigma dsigma/dpt*(top) _hSL_topY = bookHisto1D("d17-x01-y01"); // 1/sigma dsigma/dy(top) _hSL_ttbarDelPhi = bookHisto1D("d18-x01-y01"); // 1/sigma dsigma/ddeltaphi(t,tbar) _hSL_topPtLead = bookHisto1D("d19-x01-y01"); // 1/sigma dsigma/dpt(t1) _hSL_topPtSubLead = bookHisto1D("d20-x01-y01"); // 1/sigma dsigma/dpt(t2) _hSL_ttbarPt = bookHisto1D("d21-x01-y01"); // 1/sigma dsigma/dpt(ttbar) _hSL_ttbarY = bookHisto1D("d22-x01-y01"); // 1/sigma dsigma/dy(ttbar) _hSL_ttbarMass = bookHisto1D("d23-x01-y01"); // 1/sigma dsigma/dm(ttbar) // Dilepton channel _hDL_topPt = bookHisto1D("d24-x01-y01"); // 1/sigma dsigma/dpt(top) _hDL_topPtTtbarSys = bookHisto1D("d25-x01-y01"); // 1/sigma dsigma/dpt*(top) _hDL_topY = bookHisto1D("d26-x01-y01"); // 1/sigma dsigma/dy(top) _hDL_ttbarDelPhi = bookHisto1D("d27-x01-y01"); // 1/sigma dsigma/ddeltaphi(t,tbar) _hDL_topPtLead = bookHisto1D("d28-x01-y01"); // 1/sigma dsigma/dpt(t1) _hDL_topPtSubLead = bookHisto1D("d29-x01-y01"); // 1/sigma dsigma/dpt(t2) _hDL_ttbarPt = bookHisto1D("d30-x01-y01"); // 1/sigma dsigma/dpt(ttbar) _hDL_ttbarY = bookHisto1D("d31-x01-y01"); // 1/sigma dsigma/dy(ttbar) _hDL_ttbarMass = bookHisto1D("d32-x01-y01"); // 1/sigma dsigma/dm(ttbar) } void analyze(const Event& event) { // Get the ttbar candidate const PseudoTop& ttbar = apply(event, "ttbar"); if ( ttbar.mode() == PseudoTop::CH_NONE ) vetoEvent; const FourMomentum& t1P4 = ttbar.t1().momentum(); const FourMomentum& t2P4 = ttbar.t2().momentum(); const double pt1 = std::max(t1P4.pT(), t2P4.pT()); const double pt2 = std::min(t1P4.pT(), t2P4.pT()); const double dPhi = deltaPhi(t1P4, t2P4); const FourMomentum ttP4 = t1P4 + t2P4; const FourMomentum t1P4AtCM = LorentzTransform::mkFrameTransformFromBeta(ttP4.betaVec()).transform(t1P4); const double weight = event.weight(); if ( ttbar.mode() == PseudoTop::CH_SEMILEPTON ) { const Particle lCand1 = ttbar.wDecays1()[0]; // w1 dau0 is the lepton in the PseudoTop if (lCand1.pT() < 33*GeV || lCand1.abseta() > 2.1) vetoEvent; _hSL_topPt->fill(t1P4.pT(), weight); _hSL_topPt->fill(t2P4.pT(), weight); _hSL_topPtTtbarSys->fill(t1P4AtCM.pT(), weight); _hSL_topY->fill(t1P4.rapidity(), weight); _hSL_topY->fill(t2P4.rapidity(), weight); _hSL_ttbarDelPhi->fill(dPhi, weight); _hSL_topPtLead->fill(pt1, weight); _hSL_topPtSubLead->fill(pt2, weight); _hSL_ttbarPt->fill(ttP4.pT(), weight); _hSL_ttbarY->fill(ttP4.rapidity(), weight); _hSL_ttbarMass->fill(ttP4.mass(), weight); } else if ( ttbar.mode() == PseudoTop::CH_FULLLEPTON ) { const Particle lCand1 = ttbar.wDecays1()[0]; // dau0 are the lepton in the PseudoTop const Particle lCand2 = ttbar.wDecays2()[0]; // dau0 are the lepton in the PseudoTop if (lCand1.pT() < 20*GeV || lCand1.abseta() > 2.4) vetoEvent; if (lCand2.pT() < 20*GeV || lCand2.abseta() > 2.4) vetoEvent; _hDL_topPt->fill(t1P4.pT(), weight); _hDL_topPt->fill(t2P4.pT(), weight); _hDL_topPtTtbarSys->fill(t1P4AtCM.pT(), weight); _hDL_topY->fill(t1P4.rapidity(), weight); _hDL_topY->fill(t2P4.rapidity(), weight); _hDL_ttbarDelPhi->fill(dPhi, weight); _hDL_topPtLead->fill(pt1, weight); _hDL_topPtSubLead->fill(pt2, weight); _hDL_ttbarPt->fill(ttP4.pT(), weight); _hDL_ttbarY->fill(ttP4.rapidity(), weight); _hDL_ttbarMass->fill(ttP4.mass(), weight); } } void finalize() { if ( _applyCorrection ) { // Correction functions for TOP-12-028 paper, (parton bin height)/(pseudotop bin height) const double ch15[] = { 5.473609, 4.941048, 4.173346, 3.391191, 2.785644, 2.371346, 2.194161, 2.197167, }; const double ch16[] = { 5.470905, 4.948201, 4.081982, 3.225532, 2.617519, 2.239217, 2.127878, 2.185918, }; const double ch17[] = { 10.003667, 4.546519, 3.828115, 3.601018, 3.522194, 3.524694, 3.600951, 3.808553, 4.531891, 9.995370, }; const double ch18[] = { 4.406683, 4.054041, 3.885393, 4.213646, }; const double ch19[] = { 6.182537, 5.257703, 4.422280, 3.568402, 2.889408, 2.415878, 2.189974, 2.173210, }; const double ch20[] = { 5.199874, 4.693318, 3.902882, 3.143785, 2.607877, 2.280189, 2.204124, 2.260829, }; const double ch21[] = { 6.053523, 3.777506, 3.562251, 3.601356, 3.569347, 3.410472, }; const double ch22[] = { 11.932351, 4.803773, 3.782709, 3.390775, 3.226806, 3.218982, 3.382678, 3.773653, 4.788191, 11.905338, }; const double ch23[] = { 7.145255, 5.637595, 4.049882, 3.025917, 2.326430, 1.773824, 1.235329, }; const double ch24[] = { 2.268193, 2.372063, 2.323975, 2.034655, 1.736793, }; const double ch25[] = { 2.231852, 2.383086, 2.341894, 2.031318, 1.729672, 1.486993, }; const double ch26[] = { 3.993526, 2.308249, 2.075136, 2.038297, 2.036302, 2.078270, 2.295817, 4.017713, }; const double ch27[] = { 2.205978, 2.175010, 2.215376, 2.473144, }; const double ch28[] = { 2.321077, 2.371895, 2.338871, 2.057821, 1.755382, }; const double ch29[] = { 2.222707, 2.372591, 2.301688, 1.991162, 1.695343, }; const double ch30[] = { 2.599677, 2.026855, 2.138620, 2.229553, }; const double ch31[] = { 5.791779, 2.636219, 2.103642, 1.967198, 1.962168, 2.096514, 2.641189, 5.780828, }; const double ch32[] = { 2.006685, 2.545525, 2.477745, 2.335747, 2.194226, 2.076500, }; applyCorrection(_hSL_topPt, ch15); applyCorrection(_hSL_topPtTtbarSys, ch16); applyCorrection(_hSL_topY, ch17); applyCorrection(_hSL_ttbarDelPhi, ch18); applyCorrection(_hSL_topPtLead, ch19); applyCorrection(_hSL_topPtSubLead, ch20); applyCorrection(_hSL_ttbarPt, ch21); applyCorrection(_hSL_ttbarY, ch22); applyCorrection(_hSL_ttbarMass, ch23); applyCorrection(_hDL_topPt, ch24); applyCorrection(_hDL_topPtTtbarSys, ch25); applyCorrection(_hDL_topY, ch26); applyCorrection(_hDL_ttbarDelPhi, ch27); applyCorrection(_hDL_topPtLead, ch28); applyCorrection(_hDL_topPtSubLead, ch29); applyCorrection(_hDL_ttbarPt, ch30); applyCorrection(_hDL_ttbarY, ch31); applyCorrection(_hDL_ttbarMass, ch32); } if ( _doShapeOnly ) { normalize(_hSL_topPt ); normalize(_hSL_topPtTtbarSys); normalize(_hSL_topY ); normalize(_hSL_ttbarDelPhi ); normalize(_hSL_topPtLead ); normalize(_hSL_topPtSubLead ); normalize(_hSL_ttbarPt ); normalize(_hSL_ttbarY ); normalize(_hSL_ttbarMass ); normalize(_hDL_topPt ); normalize(_hDL_topPtTtbarSys); normalize(_hDL_topY ); normalize(_hDL_ttbarDelPhi ); normalize(_hDL_topPtLead ); normalize(_hDL_topPtSubLead ); normalize(_hDL_ttbarPt ); normalize(_hDL_ttbarY ); normalize(_hDL_ttbarMass ); } else { const double s = 1./sumOfWeights(); scale(_hSL_topPt , s); scale(_hSL_topPtTtbarSys, s); scale(_hSL_topY , s); scale(_hSL_ttbarDelPhi , s); scale(_hSL_topPtLead , s); scale(_hSL_topPtSubLead , s); scale(_hSL_ttbarPt , s); scale(_hSL_ttbarY , s); scale(_hSL_ttbarMass , s); scale(_hDL_topPt , s); scale(_hDL_topPtTtbarSys, s); scale(_hDL_topY , s); scale(_hDL_ttbarDelPhi , s); scale(_hDL_topPtLead , s); scale(_hDL_topPtSubLead , s); scale(_hDL_ttbarPt , s); scale(_hDL_ttbarY , s); scale(_hDL_ttbarMass , s); } } void applyCorrection(Histo1DPtr h, const double* cf) { vector& bins = h->bins(); for (size_t i=0, n=bins.size(); i >& v, const bool doCrossCleanup) const { vector >::iterator> toErase; set usedLeg1, usedLeg2; if ( !doCrossCleanup ) { /// @todo Reinstate when C++11 allowed: for (auto key = v.begin(); key != v.end(); ++key) { for (map >::iterator key = v.begin(); key != v.end(); ++key) { const size_t leg1 = key->second.first; const size_t leg2 = key->second.second; if (usedLeg1.find(leg1) == usedLeg1.end() and usedLeg2.find(leg2) == usedLeg2.end()) { usedLeg1.insert(leg1); usedLeg2.insert(leg2); } else { toErase.push_back(key); } } } else { /// @todo Reinstate when C++11 allowed: for (auto key = v.begin(); key != v.end(); ++key) { for (map >::iterator key = v.begin(); key != v.end(); ++key) { const size_t leg1 = key->second.first; const size_t leg2 = key->second.second; if (usedLeg1.find(leg1) == usedLeg1.end() and usedLeg1.find(leg2) == usedLeg1.end()) { usedLeg1.insert(leg1); usedLeg1.insert(leg2); } else { toErase.push_back(key); } } } /// @todo Reinstate when C++11 allowed: for (auto& key : toErase) v.erase(key); for (size_t i = 0; i < toErase.size(); ++i) v.erase(toErase[i]); } void PseudoTop::project(const Event& e) { // Leptons : do the lepton clustering anti-kt R=0.1 using stable photons and leptons not from hadron decay // Neutrinos : neutrinos not from hadron decay // MET : vector sum of all invisible particles in x-y plane // Jets : anti-kt R=0.4 using all particles excluding neutrinos and particles used in lepton clustering // add ghost B hadrons during the jet clustering to identify B jets. // W->lv : dressed lepton and neutrino pairs // W->jj : light flavored dijet // W candidate : select lv or jj pairs which minimise |mW1-80.4|+|mW2-80.4| // lepton-neutrino pair will be selected with higher priority // t->Wb : W candidate + b jet // t candidate : select Wb pairs which minimise |mtop1-172.5|+|mtop2-172.5| _isValid = false; _theParticles.clear(); _wDecays1.clear(); _wDecays2.clear(); _jets.clear(); _bjets.clear(); _ljets.clear(); _mode1 = _mode2 = CH_HADRON; // Collect final state particles Particles pForLep, pForJet; Particles neutrinos; // Prompt neutrinos /// @todo Avoid this unsafe jump into HepMC -- all this can be done properly via VisibleFS and HeavyHadrons projections - for (const GenParticle* p : Rivet::particles(e.genEvent())) { + for (const GenParticlePtr p : Rivet::particles(e.genEvent())) { const int status = p->status(); const int pdgId = p->pdg_id(); if (status == 1) { Particle rp = *p; if (!PID::isHadron(pdgId) && !rp.fromHadron()) { // Collect particles not from hadron decay if (rp.isNeutrino()) { // Prompt neutrinos are kept in separate collection neutrinos.push_back(rp); } else if (pdgId == 22 || rp.isLepton()) { // Leptons and photons for the dressing pForLep.push_back(rp); } } else if (!rp.isNeutrino()) { // Use all particles from hadron decay pForJet.push_back(rp); } } else if (PID::isHadron(pdgId) && PID::hasBottom(pdgId)) { // NOTE: Consider B hadrons with pT > 5GeV - not in CMS proposal //if ( p->momentum().perp() < 5 ) continue; // Do unstable particles, to be used in the ghost B clustering // Use last B hadrons only bool isLast = true; for (const GenParticlePtr pp : Rivet::particles(p->end_vertex(), HepMC::children)) { if (PID::hasBottom(pp->pdg_id())) { isLast = false; break; } } if (!isLast) continue; // Rescale momentum by 10^-20 Particle ghost(pdgId, FourMomentum(p->momentum())*1e-20/p->momentum().rho()); pForJet.push_back(ghost); } } // Start object building from trivial thing - prompt neutrinos sortByPt(neutrinos); // Proceed to lepton dressing const PseudoJets lep_pjs = mkPseudoJets(pForLep); const fastjet::JetDefinition lep_jdef(fastjet::antikt_algorithm, _lepR); const Jets leps_all = mkJets(fastjet::ClusterSequence(lep_pjs, lep_jdef).inclusive_jets()); const Jets leps_sel = sortByPt(filterBy(leps_all, Cuts::pT > _lepMinPt)); // FastJets fjLep(FastJets::ANTIKT, _lepR); // fjLep.calc(pForLep); Jets leptons; vector leptonsId; set dressedIdxs; for (const Jet& lep : leps_sel) { if (lep.abseta() > _lepMaxEta) continue; double leadingPt = -1; int leptonId = 0; for (const Particle& p : lep.particles()) { /// @warning Barcodes aren't future-proof in HepMC dressedIdxs.insert(p.genParticle()->barcode()); if (p.isLepton() && p.pT() > leadingPt) { leadingPt = p.pT(); leptonId = p.pid(); } } if (leptonId == 0) continue; leptons.push_back(lep); leptonsId.push_back(leptonId); } // Re-use particles not used in lepton dressing for (const Particle& rp : pForLep) { /// @warning Barcodes aren't future-proof in HepMC const int barcode = rp.genParticle()->barcode(); // Skip if the particle is used in dressing if (dressedIdxs.find(barcode) != dressedIdxs.end()) continue; // Put back to be used in jet clustering pForJet.push_back(rp); } // Then do the jet clustering const PseudoJets jet_pjs = mkPseudoJets(pForJet); const fastjet::JetDefinition jet_jdef(fastjet::antikt_algorithm, _jetR); const Jets jets_all = mkJets(fastjet::ClusterSequence(jet_pjs, jet_jdef).inclusive_jets()); const Jets jets_sel = sortByPt(filterBy(jets_all, Cuts::pT > _jetMinPt)); // FastJets fjJet(FastJets::ANTIKT, _jetR); //fjJet.useInvisibles(); // NOTE: CMS proposal to remove neutrinos (AB: wouldn't work anyway, since they were excluded from clustering inputs) // fjJet.calc(pForJet); for (const Jet& jet : jets_sel) { if (jet.abseta() > _jetMaxEta) continue; _jets.push_back(jet); bool isBJet = false; for (const Particle& rp : jet.particles()) { if (PID::hasBottom(rp.pdgId())) { isBJet = true; break; } } if ( isBJet ) _bjets.push_back(jet); else _ljets.push_back(jet); } // Every building blocks are ready. Continue to pseudo-W and pseudo-top combination if (_bjets.size() < 2) return; // Ignore single top for now map > wLepCandIdxs; map > wHadCandIdxs; // Collect leptonic-decaying W's for (size_t iLep = 0, nLep = leptons.size(); iLep < nLep; ++iLep) { const Jet& lep = leptons.at(iLep); for (size_t iNu = 0, nNu = neutrinos.size(); iNu < nNu; ++iNu) { const Particle& nu = neutrinos.at(iNu); const double m = (lep.momentum()+nu.momentum()).mass(); const double dm = std::abs(m-_wMass); wLepCandIdxs[dm] = make_pair(iLep, iNu); } } // Continue to hadronic decaying W's for (size_t i = 0, nLjet = _ljets.size(); i < nLjet; ++i) { const Jet& ljet1 = _ljets[i]; for (size_t j = i+1; j < nLjet; ++j) { const Jet& ljet2 = _ljets[j]; const double m = (ljet1.momentum()+ljet2.momentum()).mass(); const double dm = std::abs(m-_wMass); wHadCandIdxs[dm] = make_pair(i, j); } } // Cleanup W candidate, choose pairs with minimum dm if they share decay products cleanup(wLepCandIdxs); cleanup(wHadCandIdxs, true); const size_t nWLepCand = wLepCandIdxs.size(); const size_t nWHadCand = wHadCandIdxs.size(); if (nWLepCand + nWHadCand < 2) return; // We skip single top int w1Q = 1, w2Q = -1; int w1dau1Id = 1, w2dau1Id = -1; FourMomentum w1dau1LVec, w1dau2LVec; FourMomentum w2dau1LVec, w2dau2LVec; if (nWLepCand == 0) { // Full hadronic case const pair& idPair1 = wHadCandIdxs.begin()->second; const pair& idPair2 = (++wHadCandIdxs.begin())->second; ///< @todo Reinstate std::next const Jet& w1dau1 = _ljets[idPair1.first]; const Jet& w1dau2 = _ljets[idPair1.second]; const Jet& w2dau1 = _ljets[idPair2.first]; const Jet& w2dau2 = _ljets[idPair2.second]; w1dau1LVec = w1dau1.momentum(); w1dau2LVec = w1dau2.momentum(); w2dau1LVec = w2dau1.momentum(); w2dau2LVec = w2dau2.momentum(); } else if (nWLepCand == 1) { // Semi-leptonic case const pair& idPair1 = wLepCandIdxs.begin()->second; const pair& idPair2 = wHadCandIdxs.begin()->second; const Jet& w1dau1 = leptons[idPair1.first]; const Particle& w1dau2 = neutrinos[idPair1.second]; const Jet& w2dau1 = _ljets[idPair2.first]; const Jet& w2dau2 = _ljets[idPair2.second]; w1dau1LVec = w1dau1.momentum(); w1dau2LVec = w1dau2.momentum(); w2dau1LVec = w2dau1.momentum(); w2dau2LVec = w2dau2.momentum(); w1dau1Id = leptonsId[idPair1.first]; w1Q = w1dau1Id > 0 ? -1 : 1; w2Q = -w1Q; switch (w1dau1Id) { case 13: case -13: _mode1 = CH_MUON; break; case 11: case -11: _mode1 = CH_ELECTRON; break; } } else { // Full leptonic case const pair& idPair1 = wLepCandIdxs.begin()->second; const pair& idPair2 = (++wLepCandIdxs.begin())->second; ///< @todo Reinstate std::next const Jet& w1dau1 = leptons[idPair1.first]; const Particle& w1dau2 = neutrinos[idPair1.second]; const Jet& w2dau1 = leptons[idPair2.first]; const Particle& w2dau2 = neutrinos[idPair2.second]; w1dau1LVec = w1dau1.momentum(); w1dau2LVec = w1dau2.momentum(); w2dau1LVec = w2dau1.momentum(); w2dau2LVec = w2dau2.momentum(); w1dau1Id = leptonsId[idPair1.first]; w2dau1Id = leptonsId[idPair2.first]; w1Q = w1dau1Id > 0 ? -1 : 1; w2Q = w2dau1Id > 0 ? -1 : 1; switch (w1dau1Id) { case 13: case -13: _mode1 = CH_MUON; break; case 11: case -11: _mode1 = CH_ELECTRON; break; } switch (w2dau1Id) { case 13: case -13: _mode2 = CH_MUON; break; case 11: case -11: _mode2 = CH_ELECTRON; break; } } const FourMomentum w1LVec = w1dau1LVec+w1dau2LVec; const FourMomentum w2LVec = w2dau1LVec+w2dau2LVec; // Combine b jets double sumDm = 1e9; FourMomentum b1LVec, b2LVec; for (size_t i = 0, n = _bjets.size(); i < n; ++i) { const Jet& bjet1 = _bjets[i]; const double mtop1 = (w1LVec+bjet1.momentum()).mass(); const double dmtop1 = std::abs(mtop1-_tMass); for (size_t j=0; j= 1e9) return; // Failed to make top, but this should not happen. const FourMomentum t1LVec = w1LVec + b1LVec; const FourMomentum t2LVec = w2LVec + b2LVec; // Put all of them into candidate collection _t1 = Particle(w1Q*6, t1LVec); _b1 = Particle(w1Q*5, b1LVec); _wDecays1.push_back(Particle(w1dau1Id, w1dau1LVec)); _wDecays1.push_back(Particle(-w1dau1Id+w1Q, w1dau2LVec)); _t2 = Particle(w2Q*6, t2LVec); _b2 = Particle(w2Q*5, b2LVec); _wDecays2.push_back(Particle(w2dau1Id, w2dau1LVec)); _wDecays2.push_back(Particle(-w2dau1Id+w2Q, w2dau2LVec)); _isValid = true; } } } diff --git a/src/Analyses/DELPHI_2002_069_CONF_603.cc b/src/Analyses/DELPHI_2002_069_CONF_603.cc --- a/src/Analyses/DELPHI_2002_069_CONF_603.cc +++ b/src/Analyses/DELPHI_2002_069_CONF_603.cc @@ -1,129 +1,129 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/ChargedFinalState.hh" /// @todo Use inline PID functions instead #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) ) #define IS_BHADRON_PDGID(id) ( ((abs(id)/100)%10 == 5) || (abs(id) >= 5000 && abs(id) <= 5999) ) namespace Rivet { /// @brief DELPHI b-fragmentation measurement /// @author Hendrik Hoeth class DELPHI_2002_069_CONF_603 : public Analysis { public: /// Constructor DELPHI_2002_069_CONF_603() : Analysis("DELPHI_2002_069_CONF_603") { } /// @name Analysis methods //@{ /// Book projections and histograms void init() { declare(Beam(), "Beams"); declare(ChargedFinalState(), "FS"); _histXbprim = bookHisto1D(1, 1, 1); _histXbweak = bookHisto1D(2, 1, 1); _histMeanXbprim = bookProfile1D(4, 1, 1); _histMeanXbweak = bookProfile1D(5, 1, 1); } void analyze(const Event& e) { const FinalState& fs = apply(e, "FS"); const size_t numParticles = fs.particles().size(); // Even if we only generate hadronic events, we still need a cut on numCharged >= 2. if (numParticles < 2) { MSG_DEBUG("Failed ncharged cut"); vetoEvent; } MSG_DEBUG("Passed ncharged cut"); // Get event weight for histo filling const double weight = e.weight(); // Get beams and average beam momentum const ParticlePair& beams = apply(e, "Beams").beams(); const double meanBeamMom = ( beams.first.p3().mod() + beams.second.p3().mod() ) / 2.0; MSG_DEBUG("Avg beam momentum = " << meanBeamMom); - foreach (const GenParticle* p, particles(e.genEvent())) { - const GenVertex* pv = p->production_vertex(); - const GenVertex* dv = p->end_vertex(); + foreach (const GenParticlePtr p, particles(e.genEvent())) { + const GenVertexPtr pv = p->production_vertex(); + const GenVertexPtr dv = p->end_vertex(); if (IS_BHADRON_PDGID(p->pdg_id())) { const double xp = p->momentum().e()/meanBeamMom; // If the B-hadron has a parton as parent, call it primary B-hadron: if (pv) { bool is_primary = false; for (GenVertex::particles_in_const_iterator pp = pv->particles_in_const_begin(); pp != pv->particles_in_const_end() ; ++pp) { if (IS_PARTON_PDGID((*pp)->pdg_id())) is_primary = true; } if (is_primary) { _histXbprim->fill(xp, weight); _histMeanXbprim->fill(_histMeanXbprim->bin(0).xMid(), xp, weight); } } // If the B-hadron has no B-hadron as a child, it decayed weakly: if (dv) { bool is_weak = true; for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; pp != dv->particles_out_const_end() ; ++pp) { if (IS_BHADRON_PDGID((*pp)->pdg_id())) { is_weak = false; } } if (is_weak) { _histXbweak->fill(xp, weight); _histMeanXbweak->fill(_histMeanXbweak->bin(0).xMid(), xp, weight); } } } } } // Finalize void finalize() { normalize(_histXbprim); normalize(_histXbweak); } private: /// Store the weighted sums of numbers of charged / charged+neutral /// particles - used to calculate average number of particles for the /// inclusive single particle distributions' normalisations. Histo1DPtr _histXbprim; Histo1DPtr _histXbweak; Profile1DPtr _histMeanXbprim; Profile1DPtr _histMeanXbweak; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DELPHI_2002_069_CONF_603); } diff --git a/src/Analyses/H1_1994_S2919893.cc b/src/Analyses/H1_1994_S2919893.cc --- a/src/Analyses/H1_1994_S2919893.cc +++ b/src/Analyses/H1_1994_S2919893.cc @@ -1,226 +1,226 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Math/Constants.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/DISKinematics.hh" namespace Rivet { /// @brief H1 energy flow and charged particle spectra /// @author Peter Richardson /// Based on the equivalent HZTool analysis class H1_1994_S2919893 : public Analysis { public: /// Constructor H1_1994_S2919893() : Analysis("H1_1994_S2919893") { // Initialise member variables _w77 = make_pair(0.0, 0.0); _w122 = make_pair(0.0, 0.0); _w169 = make_pair(0.0, 0.0); _w117 = make_pair(0.0, 0.0); _wEnergy = make_pair(0.0, 0.0); } /// @name Analysis methods //@{ /// Initialise projections and histograms void init() { // Projections declare(DISLepton(), "Lepton"); declare(DISKinematics(), "Kinematics"); declare(FinalState(), "FS"); // Histos _histEnergyFlowLowX = bookHisto1D(1, 1, 1); _histEnergyFlowHighX = bookHisto1D(1, 1, 2); _histEECLowX = bookHisto1D(2, 1, 1); _histEECHighX = bookHisto1D(2, 1, 2); _histSpectraW77 = bookHisto1D(3, 1, 1); _histSpectraW122 = bookHisto1D(3, 1, 2); _histSpectraW169 = bookHisto1D(3, 1, 3); _histSpectraW117 = bookHisto1D(3, 1, 4); _histPT2 = bookProfile1D(4, 1, 1); } /// Analyse each event void analyze(const Event& event) { // Get the DIS kinematics const DISKinematics& dk = apply(event, "Kinematics"); const double x = dk.x(); const double w2 = dk.W2(); const double w = sqrt(w2); // Momentum of the scattered lepton const DISLepton& dl = apply(event,"Lepton"); const FourMomentum leptonMom = dl.out(); const double ptel = leptonMom.pT(); const double enel = leptonMom.E(); const double thel = leptonMom.angle(dk.beamHadron().mom())/degree; // Extract the particles other than the lepton const FinalState& fs = apply(event, "FS"); Particles particles; particles.reserve(fs.particles().size()); - const GenParticle* dislepGP = dl.out().genParticle(); + const GenParticlePtr dislepGP = dl.out().genParticle(); foreach (const Particle& p, fs.particles()) { - const GenParticle* loopGP = p.genParticle(); + const GenParticlePtr loopGP = p.genParticle(); if (loopGP == dislepGP) continue; particles.push_back(p); } // Cut on the forward energy double efwd = 0.0; foreach (const Particle& p, particles) { const double th = p.angle(dk.beamHadron())/degree; if (inRange(th, 4.4, 15)) efwd += p.E(); } // Apply the cuts // Lepton energy and angle, w2 and forward energy MSG_DEBUG("enel/GeV = " << enel/GeV << ", thel = " << thel << ", w2 = " << w2 << ", efwd/GeV = " << efwd/GeV); bool cut = enel/GeV > 14. && thel > 157. && thel < 172.5 && w2 >= 3000. && efwd/GeV > 0.5; if (!cut) vetoEvent; // Weight of the event const double weight = event.weight(); (x < 1e-3 ? _wEnergy.first : _wEnergy.second) += weight; // Boost to hadronic CM const LorentzTransform hcmboost = dk.boostHCM(); // Loop over the particles long ncharged(0); for (size_t ip1 = 0; ip1 < particles.size(); ++ip1) { const Particle& p = particles[ip1]; const double th = p.angle(dk.beamHadron().momentum()) / degree; // Boost momentum to lab const FourMomentum hcmMom = hcmboost.transform(p.momentum()); // Angular cut if (th <= 4.4) continue; // Energy flow histogram const double et = fabs(hcmMom.Et()); const double eta = hcmMom.eta(); (x < 1e-3 ? _histEnergyFlowLowX : _histEnergyFlowHighX)->fill(eta, et*weight); if (PID::threeCharge(p.pid()) != 0) { /// @todo Use units in w comparisons... what are the units? if (w > 50. && w <= 200.) { double xf= 2 * hcmMom.z() / w; double pt2 = hcmMom.pT2(); if (w > 50. && w <= 100.) { _histSpectraW77 ->fill(xf, weight); } else if (w > 100. && w <= 150.) { _histSpectraW122->fill(xf, weight); } else if (w > 150. && w <= 200.) { _histSpectraW169->fill(xf, weight); } _histSpectraW117->fill(xf, weight); /// @todo Is this profile meant to be filled with 2 weight factors? _histPT2->fill(xf, pt2*weight/GeV2, weight); ++ncharged; } } // Energy-energy correlation if (th <= 8.) continue; double phi1 = p.phi(ZERO_2PI); double eta1 = p.eta(); double et1 = fabs(p.momentum().Et()); for (size_t ip2 = ip1+1; ip2 < particles.size(); ++ip2) { const Particle& p2 = particles[ip2]; //double th2 = beamAngle(p2.momentum(), order); double th2 = p2.angle(dk.beamHadron().momentum()) / degree; if (th2 <= 8.) continue; double phi2 = p2.phi(ZERO_2PI); /// @todo Use angle function double deltaphi = phi1 - phi2; if (fabs(deltaphi) > PI) deltaphi = fabs(fabs(deltaphi) - TWOPI); double eta2 = p2.eta(); double omega = sqrt(sqr(eta1-eta2) + sqr(deltaphi)); double et2 = fabs(p2.momentum().Et()); double wt = et1*et2 / sqr(ptel) * weight; (x < 1e-3 ? _histEECLowX : _histEECHighX)->fill(omega, wt); } } // Factors for normalization if (w > 50. && w <= 200.) { if (w <= 100.) { _w77.first += ncharged*weight; _w77.second += weight; } else if (w <= 150.) { _w122.first += ncharged*weight; _w122.second += weight; } else { _w169.first += ncharged*weight; _w169.second += weight; } _w117.first += ncharged*weight; _w117.second += weight; } } // Normalize inclusive single particle distributions to the average number of charged particles per event. void finalize() { normalize(_histSpectraW77, _w77.first/_w77.second); normalize(_histSpectraW122, _w122.first/_w122.second); normalize(_histSpectraW169, _w169.first/_w169.second); normalize(_histSpectraW117, _w117.first/_w117.second); scale(_histEnergyFlowLowX , 1./_wEnergy.first ); scale(_histEnergyFlowHighX, 1./_wEnergy.second); scale(_histEECLowX , 1./_wEnergy.first ); scale(_histEECHighX, 1./_wEnergy.second); } //@} private: /// Polar angle with right direction of the beam inline double beamAngle(const FourVector& v, bool order) { double thel = v.polarAngle()/degree; if (thel < 0) thel += 180.; if (!order) thel = 180 - thel; return thel; } /// @name Histograms //@{ Histo1DPtr _histEnergyFlowLowX, _histEnergyFlowHighX; Histo1DPtr _histEECLowX, _histEECHighX; Histo1DPtr _histSpectraW77, _histSpectraW122, _histSpectraW169, _histSpectraW117; Profile1DPtr _histPT2; //@} /// @name Storage of weights to calculate averages for normalisation //@{ pair _w77, _w122, _w169, _w117, _wEnergy; //@} }; DECLARE_RIVET_PLUGIN(H1_1994_S2919893); } diff --git a/src/Analyses/H1_2000_S4129130.cc b/src/Analyses/H1_2000_S4129130.cc --- a/src/Analyses/H1_2000_S4129130.cc +++ b/src/Analyses/H1_2000_S4129130.cc @@ -1,259 +1,259 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Math/Constants.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/DISKinematics.hh" namespace Rivet { /// @brief H1 energy flow and charged particle spectra /// /// @author Peter Richardson /// /// Based on the HZTOOL analysis HZ99091 class H1_2000_S4129130 : public Analysis { public: /// Constructor H1_2000_S4129130() : Analysis("H1_2000_S4129130") { } /// @name Analysis methods //@{ /// Initialise projections and histograms void init() { // Projections declare(DISLepton(), "Lepton"); declare(DISKinematics(), "Kinematics"); declare(FinalState(), "FS"); // Histos Histo1DPtr h; // Histograms and weight vectors for low Q^2 a for (size_t ix = 0; ix < 17; ++ix) { h = bookHisto1D(ix+1, 1, 1); _histETLowQa.push_back(h); _weightETLowQa.push_back(0.); } // Histograms and weight vectors for high Q^2 a for (size_t ix = 0; ix < 7; ++ix) { h = bookHisto1D(ix+18, 1, 1); _histETHighQa.push_back(h); _weightETHighQa.push_back(0.); } // Histograms and weight vectors for low Q^2 b for (size_t ix = 0; ix < 5; ++ix) { h = bookHisto1D(ix+25, 1, 1); _histETLowQb.push_back(h); _weightETLowQb.push_back(0.); } // Histograms and weight vectors for high Q^2 b for (size_t ix = 0; ix < 3; ++ix) { h = bookHisto1D(30+ix, 1, 1); _histETHighQb.push_back(h); _weightETHighQb.push_back(0.0); } // Histograms for the averages _histAverETCentral = bookProfile1D(33, 1, 1); _histAverETFrag = bookProfile1D(34, 1, 1); } /// Analyze each event void analyze(const Event& event) { // DIS kinematics const DISKinematics& dk = apply(event, "Kinematics"); double q2 = dk.Q2(); double x = dk.x(); double y = dk.y(); double w2 = dk.W2(); // Kinematics of the scattered lepton const DISLepton& dl = apply(event,"Lepton"); const FourMomentum leptonMom = dl.out(); const double enel = leptonMom.E(); const double thel = 180 - leptonMom.angle(dl.in().mom())/degree; // Extract the particles other than the lepton const FinalState& fs = apply(event, "FS"); Particles particles; particles.reserve(fs.size()); - const GenParticle* dislepGP = dl.out().genParticle(); ///< @todo Is the GenParticle stuff necessary? (Not included in Particle::==?) + const GenParticlePtr dislepGP = dl.out().genParticle(); ///< @todo Is the GenParticle stuff necessary? (Not included in Particle::==?) foreach (const Particle& p, fs.particles()) { - const GenParticle* loopGP = p.genParticle(); + const GenParticlePtr loopGP = p.genParticle(); if (loopGP == dislepGP) continue; particles.push_back(p); } // Cut on the forward energy double efwd = 0.; foreach (const Particle& p, particles) { const double th = 180 - p.angle(dl.in())/degree; if (inRange(th, 4.4, 15.0)) efwd += p.E(); } // There are four possible selections for events bool evcut[4]; // Low Q2 selection a evcut[0] = enel/GeV > 12. && w2 >= 4400.*GeV2 && efwd/GeV > 0.5 && inRange(thel,157.,176.); // Low Q2 selection b evcut[1] = enel/GeV > 12. && inRange(y,0.3,0.5); // High Q2 selection a evcut[2] = inRange(thel,12.,150.) && inRange(y,0.05,0.6) && w2 >= 4400.*GeV2 && efwd > 0.5; // High Q2 selection b evcut[3] = inRange(thel,12.,150.) && inRange(y,0.05,0.6) && inRange(w2,27110.*GeV2,45182.*GeV2); // Veto if fails all cuts /// @todo Can we use all()? if (! (evcut[0] || evcut[1] || evcut[2] || evcut[3]) ) vetoEvent; // Find the bins int bin[4] = {-1,-1,-1,-1}; // For the low Q2 selection a) if (q2 > 2.5*GeV && q2 <= 5.*GeV) { if (x > 0.00005 && x <= 0.0001 ) bin[0] = 0; if (x > 0.0001 && x <= 0.0002 ) bin[0] = 1; if (x > 0.0002 && x <= 0.00035) bin[0] = 2; if (x > 0.00035 && x <= 0.0010 ) bin[0] = 3; } else if (q2 > 5.*GeV && q2 <= 10.*GeV) { if (x > 0.0001 && x <= 0.0002 ) bin[0] = 4; if (x > 0.0002 && x <= 0.00035) bin[0] = 5; if (x > 0.00035 && x <= 0.0007 ) bin[0] = 6; if (x > 0.0007 && x <= 0.0020 ) bin[0] = 7; } else if (q2 > 10.*GeV && q2 <= 20.*GeV) { if (x > 0.0002 && x <= 0.0005) bin[0] = 8; if (x > 0.0005 && x <= 0.0008) bin[0] = 9; if (x > 0.0008 && x <= 0.0015) bin[0] = 10; if (x > 0.0015 && x <= 0.040 ) bin[0] = 11; } else if (q2 > 20.*GeV && q2 <= 50.*GeV) { if (x > 0.0005 && x <= 0.0014) bin[0] = 12; if (x > 0.0014 && x <= 0.0030) bin[0] = 13; if (x > 0.0030 && x <= 0.0100) bin[0] = 14; } else if (q2 > 50.*GeV && q2 <= 100.*GeV) { if (x >0.0008 && x <= 0.0030) bin[0] = 15; if (x >0.0030 && x <= 0.0200) bin[0] = 16; } // check in one of the bins evcut[0] &= bin[0] >= 0; // For the low Q2 selection b) if (q2 > 2.5*GeV && q2 <= 5. *GeV) bin[1] = 0; if (q2 > 5. *GeV && q2 <= 10. *GeV) bin[1] = 1; if (q2 > 10.*GeV && q2 <= 20. *GeV) bin[1] = 2; if (q2 > 20.*GeV && q2 <= 50. *GeV) bin[1] = 3; if (q2 > 50.*GeV && q2 <= 100.*GeV) bin[1] = 4; // check in one of the bins evcut[1] &= bin[1] >= 0; // for the high Q2 selection a) if (q2 > 100.*GeV && q2 <= 400.*GeV) { if (x > 0.00251 && x <= 0.00631) bin[2] = 0; if (x > 0.00631 && x <= 0.0158 ) bin[2] = 1; if (x > 0.0158 && x <= 0.0398 ) bin[2] = 2; } else if (q2 > 400.*GeV && q2 <= 1100.*GeV) { if (x > 0.00631 && x <= 0.0158 ) bin[2] = 3; if (x > 0.0158 && x <= 0.0398 ) bin[2] = 4; if (x > 0.0398 && x <= 1. ) bin[2] = 5; } else if (q2 > 1100.*GeV && q2 <= 100000.*GeV) { if (x > 0. && x <= 1.) bin[2] = 6; } // check in one of the bins evcut[2] &= bin[2] >= 0; // for the high Q2 selection b) if (q2 > 100.*GeV && q2 <= 220.*GeV) bin[3] = 0; else if (q2 > 220.*GeV && q2 <= 400.*GeV) bin[3] = 1; else if (q2 > 400. ) bin[3] = 2; // check in one of*GeV the bins evcut[3] &= bin[3] >= 0; // Veto if fails all cuts after bin selection /// @todo Can we use all()? if (! (evcut[0] || evcut[1] || evcut[2] || evcut[3])) vetoEvent; // Increment the count for normalisation const double weight = event.weight(); if (evcut[0]) _weightETLowQa [bin[0]] += weight; if (evcut[1]) _weightETLowQb [bin[1]] += weight; if (evcut[2]) _weightETHighQa[bin[2]] += weight; if (evcut[3]) _weightETHighQb[bin[3]] += weight; // Boost to hadronic CoM const LorentzTransform hcmboost = dk.boostHCM(); // Loop over the particles double etcent = 0; double etfrag = 0; foreach (const Particle& p, particles) { // Boost momentum to CMS const FourMomentum hcmMom = hcmboost.transform(p.momentum()); double et = fabs(hcmMom.Et()); double eta = hcmMom.eta(); // Averages in central and forward region if (fabs(eta) < .5 ) etcent += et; if (eta > 2 && eta <= 3.) etfrag += et; // Histograms of Et flow if (evcut[0]) _histETLowQa [bin[0]]->fill(eta, et*weight); if (evcut[1]) _histETLowQb [bin[1]]->fill(eta, et*weight); if (evcut[2]) _histETHighQa[bin[2]]->fill(eta, et*weight); if (evcut[3]) _histETHighQb[bin[3]]->fill(eta, et*weight); } // Fill histograms for the average quantities if (evcut[1] || evcut[3]) { _histAverETCentral->fill(q2, etcent, weight); _histAverETFrag ->fill(q2, etfrag, weight); } } // Finalize void finalize() { // Normalization of the Et distributions /// @todo Simplify by using normalize() instead? Are all these being normalized to area=1? for (size_t ix = 0; ix < 17; ++ix) if (_weightETLowQa[ix] != 0) scale(_histETLowQa[ix], 1/_weightETLowQa[ix]); for (size_t ix = 0; ix < 7; ++ix) if (_weightETHighQa[ix] != 0) scale(_histETHighQa[ix], 1/_weightETHighQa[ix]); for (size_t ix = 0; ix < 5; ++ix) if (_weightETLowQb[ix] != 0) scale(_histETLowQb[ix], 1/_weightETLowQb[ix]); for (size_t ix = 0; ix < 3; ++ix) if (_weightETHighQb[ix] != 0) scale(_histETHighQb[ix], 1/_weightETHighQb[ix]); } //@} private: /// @name Histograms //@{ vector _histETLowQa; vector _histETHighQa; vector _histETLowQb; vector _histETHighQb; Profile1DPtr _histAverETCentral; Profile1DPtr _histAverETFrag; //@} /// @name storage of weights for normalisation //@{ vector _weightETLowQa; vector _weightETHighQa; vector _weightETLowQb; vector _weightETHighQb; //@} }; DECLARE_RIVET_PLUGIN(H1_2000_S4129130); } diff --git a/src/Analyses/LHCB_2010_I867355.cc b/src/Analyses/LHCB_2010_I867355.cc --- a/src/Analyses/LHCB_2010_I867355.cc +++ b/src/Analyses/LHCB_2010_I867355.cc @@ -1,90 +1,90 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Particle.hh" namespace Rivet { class LHCB_2010_I867355 : public Analysis { public: LHCB_2010_I867355() : Analysis("LHCB_2010_I867355") { } void init() { //@ Results are presented for two different fragmentation functions, LEP and Tevatron. Therefore, we have two sets of histograms. _h_sigma_vs_eta_lep = bookHisto1D(1, 1, 1); _h_sigma_vs_eta_tvt = bookHisto1D(1, 1, 2); _h_sigma_total_lep = bookHisto1D(2, 1, 1); _h_sigma_total_tvt = bookHisto1D(2, 1, 2); } /// Perform the per-event analysis void analyze(const Event& event) { double weight = event.weight(); Particles bhadrons; - foreach (const GenParticle* p, particles(event.genEvent())) { + foreach (const GenParticlePtr p, particles(event.genEvent())) { if (!( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) ) continue; - const GenVertex* dv = p->end_vertex(); + const GenVertexPtr dv = p->end_vertex(); bool hasBdaughter = false; if ( PID::isHadron( p->pdg_id() ) && PID::hasBottom( p->pdg_id() )) { // selecting b-hadrons if (dv) { for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; pp != dv->particles_out_const_end() ; ++pp) { if (PID::isHadron( (*pp)->pdg_id() ) && PID::hasBottom( (*pp)->pdg_id() )) { hasBdaughter = true; } } } } if (hasBdaughter) continue; // continue if the daughter is another b-hadron bhadrons += Particle(*p); } foreach (const Particle& particle, bhadrons) { // take fabs() to use full statistics and then multiply weight by 0.5 because LHCb is single-sided double eta = fabs(particle.eta()); _h_sigma_vs_eta_lep->fill( eta, 0.5*weight ); _h_sigma_vs_eta_tvt->fill( eta, 0.5*weight ); _h_sigma_total_lep->fill( eta, 0.5*weight ); // histogram for full kinematic range _h_sigma_total_tvt->fill( eta, 0.5*weight ); // histogram for full kinematic range } } void finalize() { double norm = crossSection()/microbarn/sumOfWeights(); double binwidth = 4.; // integrated over full rapidity space from 2 to 6. // to get the avergae of b and bbar, we scale with 0.5 scale(_h_sigma_vs_eta_lep, 0.5*norm); scale(_h_sigma_vs_eta_tvt, 0.5*norm); scale(_h_sigma_total_lep, 0.5*norm*binwidth); scale(_h_sigma_total_tvt, 0.5*norm*binwidth); } private: Histo1DPtr _h_sigma_total_lep; Histo1DPtr _h_sigma_total_tvt; Histo1DPtr _h_sigma_vs_eta_lep; Histo1DPtr _h_sigma_vs_eta_tvt; }; // Hook for the plugin system DECLARE_RIVET_PLUGIN(LHCB_2010_I867355); } diff --git a/src/Analyses/LHCB_2010_S8758301.cc b/src/Analyses/LHCB_2010_S8758301.cc --- a/src/Analyses/LHCB_2010_S8758301.cc +++ b/src/Analyses/LHCB_2010_S8758301.cc @@ -1,341 +1,341 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" #include "Rivet/Math/Constants.hh" #include "Rivet/Math/Units.hh" #include "HepMC/GenEvent.h" #include "HepMC/GenParticle.h" #include "HepMC/GenVertex.h" #include "HepMC/SimpleVector.h" namespace Rivet { using namespace HepMC; using namespace std; // Lifetime cut: longest living ancestor ctau < 10^-11 [m] namespace { const double MAX_CTAU = 1.0E-11; // [m] const double MIN_PT = 0.0001; // [GeV/c] } class LHCB_2010_S8758301 : public Analysis { public: /// @name Constructors etc. //@{ /// Constructor LHCB_2010_S8758301() : Analysis("LHCB_2010_S8758301"), sumKs0_30(0.0), sumKs0_35(0.0), sumKs0_40(0.0), sumKs0_badnull(0), sumKs0_badlft(0), sumKs0_all(0), sumKs0_outup(0), sumKs0_outdwn(0), sum_low_pt_loss(0), sum_high_pt_loss(0) { } //@} /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { MSG_DEBUG("Initializing analysis!"); fillMap(partLftMap); _h_K0s_pt_30 = bookHisto1D(1,1,1); _h_K0s_pt_35 = bookHisto1D(1,1,2); _h_K0s_pt_40 = bookHisto1D(1,1,3); _h_K0s_pt_y_30 = bookHisto1D(2,1,1); _h_K0s_pt_y_35 = bookHisto1D(2,1,2); _h_K0s_pt_y_40 = bookHisto1D(2,1,3); _h_K0s_pt_y_all = bookHisto1D(3,1,1); declare(UnstableFinalState(), "UFS"); } /// Perform the per-event analysis void analyze(const Event& event) { int id; double y, pT; const double weight = event.weight(); const UnstableFinalState& ufs = apply(event, "UFS"); double ancestor_lftime; foreach (const Particle& p, ufs.particles()) { id = p.pid(); if ((id != 310) && (id != -310)) continue; sumKs0_all ++; ancestor_lftime = 0.; - const GenParticle* long_ancestor = getLongestLivedAncestor(p, ancestor_lftime); + const GenParticlePtr long_ancestor = getLongestLivedAncestor(p, ancestor_lftime); if ( !(long_ancestor) ) { sumKs0_badnull ++; continue; } if ( ancestor_lftime > MAX_CTAU ) { sumKs0_badlft ++; MSG_DEBUG("Ancestor " << long_ancestor->pdg_id() << ", ctau: " << ancestor_lftime << " [m]"); continue; } const FourMomentum& qmom = p.momentum(); y = 0.5 * log((qmom.E() + qmom.pz())/(qmom.E() - qmom.pz())); pT = sqrt((qmom.px() * qmom.px()) + (qmom.py() * qmom.py())); if (pT < MIN_PT) { sum_low_pt_loss ++; MSG_DEBUG("Small pT K^0_S: " << pT << " GeV/c."); } if (pT > 1.6) { sum_high_pt_loss ++; } if (y > 2.5 && y < 4.0) { _h_K0s_pt_y_all->fill(pT, weight); if (y > 2.5 && y < 3.0) { _h_K0s_pt_y_30->fill(pT, weight); _h_K0s_pt_30->fill(pT, weight); sumKs0_30 += weight; } else if (y > 3.0 && y < 3.5) { _h_K0s_pt_y_35->fill(pT, weight); _h_K0s_pt_35->fill(pT, weight); sumKs0_35 += weight; } else if (y > 3.5 && y < 4.0) { _h_K0s_pt_y_40->fill(pT, weight); _h_K0s_pt_40->fill(pT, weight); sumKs0_40 += weight; } } else if (y < 2.5) { sumKs0_outdwn ++; } else if (y > 4.0) { sumKs0_outup ++; } } } /// Normalise histograms etc., after the run void finalize() { MSG_DEBUG("Total number Ks0: " << sumKs0_all << endl << "Sum of weights: " << sumOfWeights() << endl << "Weight Ks0 (2.5 < y < 3.0): " << sumKs0_30 << endl << "Weight Ks0 (3.0 < y < 3.5): " << sumKs0_35 << endl << "Weight Ks0 (3.5 < y < 4.0): " << sumKs0_40 << endl << "Nb. unprompt Ks0 [null mother]: " << sumKs0_badnull << endl << "Nb. unprompt Ks0 [mother lifetime exceeded]: " << sumKs0_badlft << endl << "Nb. Ks0 (y > 4.0): " << sumKs0_outup << endl << "Nb. Ks0 (y < 2.5): " << sumKs0_outdwn << endl << "Nb. Ks0 (pT < " << (MIN_PT/MeV) << " MeV/c): " << sum_low_pt_loss << endl << "Nb. Ks0 (pT > 1.6 GeV/c): " << sum_high_pt_loss << endl << "Cross-section [mb]: " << crossSection()/millibarn << endl << "Nb. events: " << numEvents()); // Compute cross-section; multiply by bin width for correct scaling // cross-section given by Rivet in pb double xsection_factor = crossSection()/sumOfWeights(); // Multiply bin width for correct scaling, xsection in mub scale(_h_K0s_pt_30, 0.2*xsection_factor/microbarn); scale(_h_K0s_pt_35, 0.2*xsection_factor/microbarn); scale(_h_K0s_pt_40, 0.2*xsection_factor/microbarn); // Divide by dy (rapidity window width), xsection in mb scale(_h_K0s_pt_y_30, xsection_factor/0.5/millibarn); scale(_h_K0s_pt_y_35, xsection_factor/0.5/millibarn); scale(_h_K0s_pt_y_40, xsection_factor/0.5/millibarn); scale(_h_K0s_pt_y_all, xsection_factor/1.5/millibarn); } //@} private: /// Get particle lifetime from hardcoded data double getLifeTime(int pid) { double lft = -1.0; if (pid < 0) pid = - pid; // Correct Pythia6 PIDs for f0(980), f0(1370) mesons if (pid == 10331) pid = 30221; if (pid == 10221) pid = 9010221; map::iterator pPartLft = partLftMap.find(pid); // search stable particle list if (pPartLft == partLftMap.end()) { if (pid <= 100) return 0.0; for (unsigned int i=0; i < sizeof(stablePDGIds)/sizeof(unsigned int); i++ ) { if (pid == stablePDGIds[i]) { lft = 0.0; break; } } } else { lft = (*pPartLft).second; } if (lft < 0.0) MSG_ERROR("Could not determine lifetime for particle with PID " << pid << "... This K_s^0 will be considered unprompt!"); return lft; } - const GenParticle* getLongestLivedAncestor(const Particle& p, double& lifeTime) { - const GenParticle* ret = NULL; + const GenParticlePtr getLongestLivedAncestor(const Particle& p, double& lifeTime) { + const GenParticlePtr ret = NULL; lifeTime = 1.; if (p.genParticle() == NULL) return NULL; - const GenParticle* pmother = p.genParticle(); + const GenParticlePtr pmother = p.genParticle(); double longest_ctau = 0.; double mother_ctau; int mother_pid, n_inparts; - const GenVertex* ivertex = pmother->production_vertex(); + const GenVertexPtr ivertex = pmother->production_vertex(); while (ivertex) { n_inparts = ivertex->particles_in_size(); if (n_inparts < 1) {ret = NULL; break;} // error: should never happen! const GenVertex::particles_in_const_iterator iPart_invtx = ivertex->particles_in_const_begin(); pmother = (*iPart_invtx); // first mother particle mother_pid = pmother->pdg_id(); ivertex = pmother->production_vertex(); // get next vertex if ( (mother_pid == 2212) || (mother_pid <= 100) ) { if (ret == NULL) ret = pmother; continue; } mother_ctau = getLifeTime(mother_pid); if (mother_ctau < 0.) { ret= NULL; break; } // error:should never happen! if (mother_ctau > longest_ctau) { longest_ctau = mother_ctau; ret = pmother; } } if (ret) lifeTime = longest_ctau * c_light; return ret; } // Fill the PDG Id to Lifetime[seconds] map // Data was extract from LHCb Particle Table using ParticleSvc bool fillMap(map &m) { m[6] = 4.707703E-25; m[11] = 1.E+16; m[12] = 1.E+16; m[13] = 2.197019E-06; m[14] = 1.E+16; m[15] = 2.906E-13; m[16] = 1.E+16; m[22] = 1.E+16; m[23] = 2.637914E-25; m[24] = 3.075758E-25; m[25] = 9.4E-26; m[35] = 9.4E-26; m[36] = 9.4E-26; m[37] = 9.4E-26; m[84] = 3.335641E-13; m[85] = 1.290893E-12; m[111] = 8.4E-17; m[113] = 4.405704E-24; m[115] = 6.151516E-24; m[117] = 4.088275E-24; m[119] = 2.102914E-24; m[130] = 5.116E-08; m[150] = 1.525E-12; m[211] = 2.6033E-08; m[213] = 4.405704E-24; m[215] = 6.151516E-24; m[217] = 4.088275E-24; m[219] = 2.102914E-24; m[221] = 5.063171E-19; m[223] = 7.752794E-23; m[225] = 3.555982E-24; m[227] = 3.91793E-24; m[229] = 2.777267E-24; m[310] = 8.953E-11; m[313] = 1.308573E-23; m[315] = 6.038644E-24; m[317] = 4.139699E-24; m[319] = 3.324304E-24; m[321] = 1.238E-08; m[323] = 1.295693E-23; m[325] = 6.682357E-24; m[327] = 4.139699E-24; m[329] = 3.324304E-24; m[331] = 3.210791E-21; m[333] = 1.545099E-22; m[335] = 9.016605E-24; m[337] = 7.565657E-24; m[350] = 1.407125E-12; m[411] = 1.04E-12; m[413] = 6.856377E-21; m[415] = 1.778952E-23; m[421] = 4.101E-13; m[423] = 1.000003E-19; m[425] = 1.530726E-23; m[431] = 5.E-13; m[433] = 1.000003E-19; m[435] = 3.291061E-23; m[441] = 2.465214E-23; m[443] = 7.062363E-21; m[445] = 3.242425E-22; m[510] = 1.525E-12; m[511] = 1.525E-12; m[513] = 1.000019E-19; m[515] = 1.31E-23; m[521] = 1.638E-12; m[523] = 1.000019E-19; m[525] = 1.31E-23; m[530] = 1.536875E-12; m[531] = 1.472E-12; m[533] = 1.E-19; m[535] = 1.31E-23; m[541] = 4.5E-13; m[553] = 1.218911E-20; m[1112] = 4.539394E-24; m[1114] = 5.578069E-24; m[1116] = 1.994582E-24; m[1118] = 2.269697E-24; m[1212] = 4.539394E-24; m[1214] = 5.723584E-24; m[1216] = 1.994582E-24; m[1218] = 1.316424E-24; m[2112] = 8.857E+02; m[2114] = 5.578069E-24; m[2116] = 4.388081E-24; m[2118] = 2.269697E-24; m[2122] = 4.539394E-24; m[2124] = 5.723584E-24; m[2126] = 1.994582E-24; m[2128] = 1.316424E-24; m[2212] = 1.E+16; m[2214] = 5.578069E-24; m[2216] = 4.388081E-24; m[2218] = 2.269697E-24; m[2222] = 4.539394E-24; m[2224] = 5.578069E-24; m[2226] = 1.994582E-24; m[2228] = 2.269697E-24; m[3112] = 1.479E-10; m[3114] = 1.670589E-23; m[3116] = 5.485102E-24; m[3118] = 3.656734E-24; m[3122] = 2.631E-10; m[3124] = 4.219309E-23; m[3126] = 8.227653E-24; m[3128] = 3.291061E-24; m[3212] = 7.4E-20; m[3214] = 1.828367E-23; m[3216] = 5.485102E-24; m[3218] = 3.656734E-24; m[3222] = 8.018E-11; m[3224] = 1.838582E-23; m[3226] = 5.485102E-24; m[3228] = 3.656734E-24; m[3312] = 1.639E-10; m[3314] = 6.648608E-23; m[3322] = 2.9E-10; m[3324] = 7.233101E-23; m[3334] = 8.21E-11; m[4112] = 2.991874E-22; m[4114] = 4.088274E-23; m[4122] = 2.E-13; m[4132] = 1.12E-13; m[4212] = 3.999999E-22; m[4214] = 3.291061E-22; m[4222] = 2.951624E-22; m[4224] = 4.417531E-23; m[4232] = 4.42E-13; m[4332] = 6.9E-14; m[4412] = 3.335641E-13; m[4422] = 3.335641E-13; m[4432] = 3.335641E-13; m[5112] = 1.E-19; m[5122] = 1.38E-12; m[5132] = 1.42E-12; m[5142] = 1.290893E-12; m[5212] = 1.E-19; m[5222] = 1.E-19; m[5232] = 1.42E-12; m[5242] = 1.290893E-12; m[5312] = 1.E-19; m[5322] = 1.E-19; m[5332] = 1.55E-12; m[5342] = 1.290893E-12; m[5442] = 1.290893E-12; m[5512] = 1.290893E-12; m[5522] = 1.290893E-12; m[5532] = 1.290893E-12; m[5542] = 1.290893E-12; m[10111] = 2.48382E-24; m[10113] = 4.635297E-24; m[10115] = 2.54136E-24; m[10211] = 2.48382E-24; m[10213] = 4.635297E-24; m[10215] = 2.54136E-24; m[10223] = 1.828367E-24; m[10225] = 3.636531E-24; m[10311] = 2.437823E-24; m[10313] = 7.313469E-24; m[10315] = 3.538775E-24; m[10321] = 2.437823E-24; m[10323] = 7.313469E-24; m[10325] = 3.538775E-24; m[10331] = 4.804469E-24; m[10411] = 4.38E-24; m[10413] = 3.29E-23; m[10421] = 4.38E-24; m[10423] = 3.22653E-23; m[10431] = 6.5821E-22; m[10433] = 6.5821E-22; m[10441] = 6.453061E-23; m[10511] = 4.39E-24; m[10513] = 1.65E-23; m[10521] = 4.39E-24; m[10523] = 1.65E-23; m[10531] = 4.39E-24; m[10533] = 1.65E-23; m[11114] = 2.194041E-24; m[11116] = 1.828367E-24; m[11212] = 1.880606E-24; m[11216] = 1.828367E-24; m[12112] = 2.194041E-24; m[12114] = 2.194041E-24; m[12116] = 5.063171E-24; m[12126] = 1.828367E-24; m[12212] = 2.194041E-24; m[12214] = 2.194041E-24; m[12216] = 5.063171E-24; m[12224] = 2.194041E-24; m[12226] = 1.828367E-24; m[13112] = 6.582122E-24; m[13114] = 1.09702E-23; m[13116] = 5.485102E-24; m[13122] = 1.316424E-23; m[13124] = 1.09702E-23; m[13126] = 6.928549E-24; m[13212] = 6.582122E-24; m[13214] = 1.09702E-23; m[13216] = 5.485102E-24; m[13222] = 6.582122E-24; m[13224] = 1.09702E-23; m[13226] = 5.485102E-24; m[13312] = 4.135667E-22; m[13314] = 2.742551E-23; m[13324] = 2.742551E-23; m[14122] = 1.828367E-22; m[20022] = 1.E+16; m[20113] = 1.567172E-24; m[20213] = 1.567172E-24; m[20223] = 2.708692E-23; m[20313] = 3.782829E-24; m[20315] = 2.384827E-24; m[20323] = 3.782829E-24; m[20325] = 2.384827E-24; m[20333] = 1.198929E-23; m[20413] = 2.63E-24; m[20423] = 2.63E-24; m[20433] = 6.5821E-22; m[20443] = 7.395643E-22; m[20513] = 2.63E-24; m[20523] = 2.63E-24; m[20533] = 2.63E-24; m[21112] = 2.632849E-24; m[21114] = 3.291061E-24; m[21212] = 2.632849E-24; m[21214] = 6.582122E-24; m[22112] = 4.388081E-24; m[22114] = 3.291061E-24; m[22122] = 2.632849E-24; m[22124] = 6.582122E-24; m[22212] = 4.388081E-24; m[22214] = 3.291061E-24; m[22222] = 2.632849E-24; m[22224] = 3.291061E-24; m[23112] = 7.313469E-24; m[23114] = 2.991874E-24; m[23122] = 4.388081E-24; m[23124] = 6.582122E-24; m[23126] = 3.291061E-24; m[23212] = 7.313469E-24; m[23214] = 2.991874E-24; m[23222] = 7.313469E-24; m[23224] = 2.991874E-24; m[30113] = 2.632849E-24; m[30213] = 2.632849E-24; m[30221] = 1.880606E-24; m[30223] = 2.089563E-24; m[30313] = 2.056913E-24; m[30323] = 2.056913E-24; m[30443] = 2.419898E-23; m[31114] = 1.880606E-24; m[31214] = 3.291061E-24; m[32112] = 3.989164E-24; m[32114] = 1.880606E-24; m[32124] = 3.291061E-24; m[32212] = 3.989164E-24; m[32214] = 1.880606E-24; m[32224] = 1.880606E-24; m[33122] = 1.880606E-23; m[42112] = 6.582122E-24; m[42212] = 6.582122E-24; m[43122] = 2.194041E-24; m[53122] = 4.388081E-24; m[100111] = 1.645531E-24; m[100113] = 1.64553E-24; m[100211] = 1.645531E-24; m[100213] = 1.64553E-24; m[100221] = 1.196749E-23; m[100223] = 3.061452E-24; m[100313] = 2.837122E-24; m[100323] = 2.837122E-24; m[100331] = 4.459432E-25; m[100333] = 4.388081E-24; m[100441] = 4.701516E-23; m[100443] = 2.076379E-21; m[100553] = 2.056913E-20; m[200553] = 3.242425E-20; m[300553] = 3.210791E-23; m[9000111] = 8.776163E-24; m[9000211] = 8.776163E-24; m[9000443] = 8.227652E-24; m[9000553] = 5.983747E-24; m[9010111] = 3.164482E-24; m[9010211] = 3.164482E-24; m[9010221] = 9.403031E-24; m[9010443] = 8.438618E-24; m[9010553] = 8.3318E-24; m[9020221] = 8.093281E-23; m[9020443] = 1.061633E-23; m[9030221] = 6.038644E-24; m[9042413] = 2.07634E-21; m[9050225] = 1.394517E-24; m[9060225] = 3.291061E-24; m[9080225] = 4.388081E-24; m[9090225] = 2.056913E-24; m[9910445] = 2.07634E-21; m[9920443] = 2.07634E-21; return true; } /// @name Histograms //@{ Histo1DPtr _h_K0s_pt_y_30; // histogram for 2.5 < y < 3.0 (d2sigma) Histo1DPtr _h_K0s_pt_y_35; // histogram for 3.0 < y < 3.5 (d2sigma) Histo1DPtr _h_K0s_pt_y_40; // histogram for 3.5 < y < 4.0 (d2sigma) Histo1DPtr _h_K0s_pt_30; // histogram for 2.5 < y < 3.0 (sigma) Histo1DPtr _h_K0s_pt_35; // histogram for 3.0 < y < 3.5 (sigma) Histo1DPtr _h_K0s_pt_40; // histogram for 3.5 < y < 4.0 (sigma) Histo1DPtr _h_K0s_pt_y_all; // histogram for 2.5 < y < 4.0 (d2sigma) double sumKs0_30; // Sum of weights 2.5 < y < 3.0 double sumKs0_35; // Sum of weights 3.0 < y < 3.5 double sumKs0_40; // Sum of weights 3.5 < y < 4.0 // Various counters mainly for debugging and comparisons between different generators size_t sumKs0_badnull; // Nb of particles for which mother could not be identified size_t sumKs0_badlft; // Nb of mesons with long lived mothers size_t sumKs0_all; // Nb of all Ks0 generated size_t sumKs0_outup; // Nb of mesons with y > 4.0 size_t sumKs0_outdwn; // Nb of mesons with y < 2.5 size_t sum_low_pt_loss; // Nb of mesons with very low pT (indicates when units are mixed-up) size_t sum_high_pt_loss; // Nb of mesons with pT > 1.6 GeV/c // Map between PDG id and particle lifetimes in seconds std::map partLftMap; // Set of PDG Ids for stable particles (PDG Id <= 100 are considered stable) static const int stablePDGIds[205]; //@} }; // Actual initialization according to ISO C++ requirements const int LHCB_2010_S8758301::stablePDGIds[205] = { 311, 543, 545, 551, 555, 557, 1103, 2101, 2103, 2203, 3101, 3103, 3201, 3203, 3303, 4101, 4103, 4124, 4201, 4203, 4301, 4303, 4312, 4314, 4322, 4324, 4334, 4403, 4414, 4424, 4434, 4444, 5101, 5103, 5114, 5201, 5203, 5214, 5224, 5301, 5303, 5314, 5324, 5334, 5401, 5403, 5412, 5414, 5422, 5424, 5432, 5434, 5444, 5503, 5514, 5524, 5534, 5544, 5554, 10022, 10333, 10335, 10443, 10541, 10543, 10551, 10553, 10555, 11112, 12118, 12122, 12218, 12222, 13316, 13326, 20543, 20553, 20555, 23314, 23324, 30343, 30353, 30363, 30553, 33314, 33324, 41214, 42124, 52114, 52214, 100311, 100315, 100321, 100325, 100411, 100413, 100421, 100423, 100551, 100555, 100557, 110551, 110553, 110555, 120553, 120555, 130553, 200551, 200555, 210551, 210553, 220553, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 1000011, 1000012, 1000013, 1000014, 1000015, 1000016, 1000021, 1000022, 1000023, 1000024, 1000025, 1000035, 1000037, 1000039, 2000001, 2000002, 2000003, 2000004, 2000005, 2000006, 2000011, 2000012, 2000013, 2000014, 2000015, 2000016, 3000111, 3000113, 3000211, 3000213, 3000221, 3000223, 3000331, 3100021, 3100111, 3100113, 3200111, 3200113, 3300113, 3400113, 4000001, 4000002, 4000011, 4000012, 5000039, 9000221, 9900012, 9900014, 9900016, 9900023, 9900024, 9900041, 9900042}; // Hook for the plugin system DECLARE_RIVET_PLUGIN(LHCB_2010_S8758301); } diff --git a/src/Analyses/LHCB_2011_I917009.cc b/src/Analyses/LHCB_2011_I917009.cc --- a/src/Analyses/LHCB_2011_I917009.cc +++ b/src/Analyses/LHCB_2011_I917009.cc @@ -1,323 +1,323 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { class LHCB_2011_I917009 : public Analysis { public: /// @name Constructors etc. //@{ /// Constructor LHCB_2011_I917009() : Analysis("LHCB_2011_I917009"), rap_beam(0.0), pt_min(0.0), pt1_edge(0.65), pt2_edge(1.0), pt3_edge(2.5), rap_min(2.), rap_max(0.0), dsShift(0) { } //@} public: /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { int y_nbins = 4; fillMap(partLftMap); if (fuzzyEquals(sqrtS(), 0.9*TeV)) { rap_beam = 6.87; rap_max = 4.; pt_min = 0.25; } else if (fuzzyEquals(sqrtS(), 7*TeV)) { rap_beam = 8.92; rap_max = 4.5; pt_min = 0.15; y_nbins = 5; dsShift = 8; } else { MSG_ERROR("Incompatible beam energy!"); } // Create the sets of temporary histograms that will be used to make the ratios in the finalize() for (size_t i = 0; i < 12; ++i) _tmphistos[i] = YODA::Histo1D(y_nbins, rap_min, rap_max); for (size_t i = 12; i < 15; ++i) _tmphistos[i] = YODA::Histo1D(refData(dsShift+5, 1, 1)); for (size_t i = 15; i < 18; ++i) _tmphistos[i] = YODA::Histo1D(y_nbins, rap_beam - rap_max, rap_beam - rap_min); declare(UnstableFinalState(), "UFS"); } /// Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); const UnstableFinalState& ufs = apply(event, "UFS"); double ancestor_lftsum = 0.0; double y, pT; int id; int partIdx = -1; foreach (const Particle& p, ufs.particles()) { id = p.pid(); // continue if particle not a K0s nor (anti-)Lambda if ( (id == 310) || (id == -310) ) { partIdx = 2; } else if ( id == 3122 ) { partIdx = 1; } else if ( id == -3122 ) { partIdx = 0; } else { continue; } ancestor_lftsum = getMotherLifeTimeSum(p); // Lifetime cut: ctau sum of all particle ancestors < 10^-9 m according to the paper (see eq. 5) const double MAX_CTAU = 1.0E-9; // [m] if ( (ancestor_lftsum < 0.0) || (ancestor_lftsum > MAX_CTAU) ) continue; const FourMomentum& qmom = p.momentum(); y = log((qmom.E() + qmom.pz())/(qmom.E() - qmom.pz()))/2.; // skip this particle if it has too high or too low rapidity (extremely rare cases when E = +- pz) if ( std::isnan(y) || std::isinf(y) ) continue; y = fabs(y); if (!inRange(y, rap_min, rap_max)) continue; pT = sqrt((qmom.px() * qmom.px()) + (qmom.py() * qmom.py())); if (!inRange(pT, pt_min, pt3_edge)) continue; // Filling corresponding temporary histograms for pT intervals if (inRange(pT, pt_min, pt1_edge)) _tmphistos[partIdx*3].fill(y, weight); if (inRange(pT, pt1_edge, pt2_edge)) _tmphistos[partIdx*3+1].fill(y, weight); if (inRange(pT, pt2_edge, pt3_edge)) _tmphistos[partIdx*3+2].fill(y, weight); // Fill histo in rapidity for whole pT interval _tmphistos[partIdx+9].fill(y, weight); // Fill histo in pT for whole rapidity interval _tmphistos[partIdx+12].fill(pT, weight); // Fill histo in rapidity loss for whole pT interval _tmphistos[partIdx+15].fill(rap_beam - y, weight); } } // Generate the ratio histograms void finalize() { int dsId = dsShift + 1; for (size_t j = 0; j < 3; ++j) { /// @todo Compactify to two one-liners Scatter2DPtr s1 = bookScatter2D(dsId, 1, j+1); divide(_tmphistos[j], _tmphistos[3+j], s1); Scatter2DPtr s2 = bookScatter2D(dsId+1, 1, j+1); divide(_tmphistos[j], _tmphistos[6+j], s2); } dsId += 2; for (size_t j = 3; j < 6; ++j) { /// @todo Compactify to two one-liners Scatter2DPtr s1 = bookScatter2D(dsId, 1, 1); divide(_tmphistos[3*j], _tmphistos[3*j+1], s1); dsId += 1; Scatter2DPtr s2 = bookScatter2D(dsId, 1, 1); divide(_tmphistos[3*j], _tmphistos[3*j+2], s2); dsId += 1; } } //@} private: // Get particle lifetime from hardcoded data double getLifeTime(int pid) { double lft = -1.0; if (pid < 0) pid = - pid; // Correct Pythia6 PIDs for f0(980), f0(1370) mesons if (pid == 10331) pid = 30221; if (pid == 10221) pid = 9010221; map::iterator pPartLft = partLftMap.find(pid); // search stable particle list if (pPartLft == partLftMap.end()) { if (pid <= 100) return 0.0; for (size_t i=0; i < sizeof(stablePDGIds)/sizeof(unsigned int); i++) { if (pid == stablePDGIds[i]) { lft = 0.0; break; } } } else { lft = (*pPartLft).second; } if (lft < 0.0 && PID::isHadron(pid)) { MSG_ERROR("Could not determine lifetime for particle with PID " << pid << "... This V^0 will be considered unprompt!"); } return lft; } // Data members like post-cuts event weight counters go here const double getMotherLifeTimeSum(const Particle& p) { if (p.genParticle() == NULL) return -1.; double lftSum = 0.; double plft = 0.; - const GenParticle* part = p.genParticle(); - const GenVertex* ivtx = part->production_vertex(); + const GenParticlePtr part = p.genParticle(); + const GenVertexPtr ivtx = part->production_vertex(); while (ivtx) { if (ivtx->particles_in_size() < 1) { lftSum = -1.; break; }; const GenVertex::particles_in_const_iterator iPart_invtx = ivtx->particles_in_const_begin(); part = (*iPart_invtx); if ( !(part) ) { lftSum = -1.; break; }; ivtx = part->production_vertex(); if ( (part->pdg_id() == 2212) || !(ivtx) ) break; //reached beam plft = getLifeTime(part->pdg_id()); if (plft < 0.) { lftSum = -1.; break; }; lftSum += plft; }; return (lftSum * c_light); } /// @name Private variables //@{ // The rapidity of the beam according to the selected beam energy double rap_beam; // The edges of the intervals of transverse momentum double pt_min, pt1_edge, pt2_edge, pt3_edge; // The limits of the rapidity window double rap_min; double rap_max; // Indicates which set of histograms will be output to yoda file (according to beam energy) int dsShift; // Map between PDG id and particle lifetimes in seconds std::map partLftMap; // Set of PDG Ids for stable particles (PDG Id <= 100 are considered stable) static const int stablePDGIds[205]; //@} /// @name Helper histograms //@{ /// Histograms are defined in the following order: anti-Lambda, Lambda and K0s. /// First 3 suites of 3 histograms correspond to each particle in bins of y for the 3 pT intervals. (9 histos) /// Next 3 histograms contain the particles in y bins for the whole pT interval (3 histos) /// Next 3 histograms contain the particles in y_loss bins for the whole pT interval (3 histos) /// Last 3 histograms contain the particles in pT bins for the whole rapidity (y) interval (3 histos) YODA::Histo1D _tmphistos[18]; //@} // Fill the PDG Id to Lifetime[seconds] map // Data was extracted from LHCb Particle Table through LHCb::ParticlePropertySvc bool fillMap(map& m) { m[6] = 4.707703E-25; m[11] = 1.E+16; m[12] = 1.E+16; m[13] = 2.197019E-06; m[14] = 1.E+16; m[15] = 2.906E-13; m[16] = 1.E+16; m[22] = 1.E+16; m[23] = 2.637914E-25; m[24] = 3.075758E-25; m[25] = 9.4E-26; m[35] = 9.4E-26; m[36] = 9.4E-26; m[37] = 9.4E-26; m[84] = 3.335641E-13; m[85] = 1.290893E-12; m[111] = 8.4E-17; m[113] = 4.405704E-24; m[115] = 6.151516E-24; m[117] = 4.088275E-24; m[119] = 2.102914E-24; m[130] = 5.116E-08; m[150] = 1.525E-12; m[211] = 2.6033E-08; m[213] = 4.405704E-24; m[215] = 6.151516E-24; m[217] = 4.088275E-24; m[219] = 2.102914E-24; m[221] = 5.063171E-19; m[223] = 7.752794E-23; m[225] = 3.555982E-24; m[227] = 3.91793E-24; m[229] = 2.777267E-24; m[310] = 8.953E-11; m[313] = 1.308573E-23; m[315] = 6.038644E-24; m[317] = 4.139699E-24; m[319] = 3.324304E-24; m[321] = 1.238E-08; m[323] = 1.295693E-23; m[325] = 6.682357E-24; m[327] = 4.139699E-24; m[329] = 3.324304E-24; m[331] = 3.210791E-21; m[333] = 1.545099E-22; m[335] = 9.016605E-24; m[337] = 7.565657E-24; m[350] = 1.407125E-12; m[411] = 1.04E-12; m[413] = 6.856377E-21; m[415] = 1.778952E-23; m[421] = 4.101E-13; m[423] = 1.000003E-19; m[425] = 1.530726E-23; m[431] = 5.E-13; m[433] = 1.000003E-19; m[435] = 3.291061E-23; m[441] = 2.465214E-23; m[443] = 7.062363E-21; m[445] = 3.242425E-22; m[510] = 1.525E-12; m[511] = 1.525E-12; m[513] = 1.000019E-19; m[515] = 1.31E-23; m[521] = 1.638E-12; m[523] = 1.000019E-19; m[525] = 1.31E-23; m[530] = 1.536875E-12; m[531] = 1.472E-12; m[533] = 1.E-19; m[535] = 1.31E-23; m[541] = 4.5E-13; m[553] = 1.218911E-20; m[1112] = 4.539394E-24; m[1114] = 5.578069E-24; m[1116] = 1.994582E-24; m[1118] = 2.269697E-24; m[1212] = 4.539394E-24; m[1214] = 5.723584E-24; m[1216] = 1.994582E-24; m[1218] = 1.316424E-24; m[2112] = 8.857E+02; m[2114] = 5.578069E-24; m[2116] = 4.388081E-24; m[2118] = 2.269697E-24; m[2122] = 4.539394E-24; m[2124] = 5.723584E-24; m[2126] = 1.994582E-24; m[2128] = 1.316424E-24; m[2212] = 1.E+16; m[2214] = 5.578069E-24; m[2216] = 4.388081E-24; m[2218] = 2.269697E-24; m[2222] = 4.539394E-24; m[2224] = 5.578069E-24; m[2226] = 1.994582E-24; m[2228] = 2.269697E-24; m[3112] = 1.479E-10; m[3114] = 1.670589E-23; m[3116] = 5.485102E-24; m[3118] = 3.656734E-24; m[3122] = 2.631E-10; m[3124] = 4.219309E-23; m[3126] = 8.227653E-24; m[3128] = 3.291061E-24; m[3212] = 7.4E-20; m[3214] = 1.828367E-23; m[3216] = 5.485102E-24; m[3218] = 3.656734E-24; m[3222] = 8.018E-11; m[3224] = 1.838582E-23; m[3226] = 5.485102E-24; m[3228] = 3.656734E-24; m[3312] = 1.639E-10; m[3314] = 6.648608E-23; m[3322] = 2.9E-10; m[3324] = 7.233101E-23; m[3334] = 8.21E-11; m[4112] = 2.991874E-22; m[4114] = 4.088274E-23; m[4122] = 2.E-13; m[4132] = 1.12E-13; m[4212] = 3.999999E-22; m[4214] = 3.291061E-22; m[4222] = 2.951624E-22; m[4224] = 4.417531E-23; m[4232] = 4.42E-13; m[4332] = 6.9E-14; m[4412] = 3.335641E-13; m[4422] = 3.335641E-13; m[4432] = 3.335641E-13; m[5112] = 1.E-19; m[5122] = 1.38E-12; m[5132] = 1.42E-12; m[5142] = 1.290893E-12; m[5212] = 1.E-19; m[5222] = 1.E-19; m[5232] = 1.42E-12; m[5242] = 1.290893E-12; m[5312] = 1.E-19; m[5322] = 1.E-19; m[5332] = 1.55E-12; m[5342] = 1.290893E-12; m[5442] = 1.290893E-12; m[5512] = 1.290893E-12; m[5522] = 1.290893E-12; m[5532] = 1.290893E-12; m[5542] = 1.290893E-12; m[10111] = 2.48382E-24; m[10113] = 4.635297E-24; m[10115] = 2.54136E-24; m[10211] = 2.48382E-24; m[10213] = 4.635297E-24; m[10215] = 2.54136E-24; m[10223] = 1.828367E-24; m[10225] = 3.636531E-24; m[10311] = 2.437823E-24; m[10313] = 7.313469E-24; m[10315] = 3.538775E-24; m[10321] = 2.437823E-24; m[10323] = 7.313469E-24; m[10325] = 3.538775E-24; m[10331] = 4.804469E-24; m[10411] = 4.38E-24; m[10413] = 3.29E-23; m[10421] = 4.38E-24; m[10423] = 3.22653E-23; m[10431] = 6.5821E-22; m[10433] = 6.5821E-22; m[10441] = 6.453061E-23; m[10511] = 4.39E-24; m[10513] = 1.65E-23; m[10521] = 4.39E-24; m[10523] = 1.65E-23; m[10531] = 4.39E-24; m[10533] = 1.65E-23; m[11114] = 2.194041E-24; m[11116] = 1.828367E-24; m[11212] = 1.880606E-24; m[11216] = 1.828367E-24; m[12112] = 2.194041E-24; m[12114] = 2.194041E-24; m[12116] = 5.063171E-24; m[12126] = 1.828367E-24; m[12212] = 2.194041E-24; m[12214] = 2.194041E-24; m[12216] = 5.063171E-24; m[12224] = 2.194041E-24; m[12226] = 1.828367E-24; m[13112] = 6.582122E-24; m[13114] = 1.09702E-23; m[13116] = 5.485102E-24; m[13122] = 1.316424E-23; m[13124] = 1.09702E-23; m[13126] = 6.928549E-24; m[13212] = 6.582122E-24; m[13214] = 1.09702E-23; m[13216] = 5.485102E-24; m[13222] = 6.582122E-24; m[13224] = 1.09702E-23; m[13226] = 5.485102E-24; m[13314] = 2.742551E-23; m[13324] = 2.742551E-23; m[14122] = 1.828367E-22; m[20022] = 1.E+16; m[20113] = 1.567172E-24; m[20213] = 1.567172E-24; m[20223] = 2.708692E-23; m[20313] = 3.782829E-24; m[20315] = 2.384827E-24; m[20323] = 3.782829E-24; m[20325] = 2.384827E-24; m[20333] = 1.198929E-23; m[20413] = 2.63E-24; m[20423] = 2.63E-24; m[20433] = 6.5821E-22; m[20443] = 7.395643E-22; m[20513] = 2.63E-24; m[20523] = 2.63E-24; m[20533] = 2.63E-24; m[21112] = 2.632849E-24; m[21114] = 3.291061E-24; m[21212] = 2.632849E-24; m[21214] = 6.582122E-24; m[22112] = 4.388081E-24; m[22114] = 3.291061E-24; m[22122] = 2.632849E-24; m[22124] = 6.582122E-24; m[22212] = 4.388081E-24; m[22214] = 3.291061E-24; m[22222] = 2.632849E-24; m[22224] = 3.291061E-24; m[23112] = 7.313469E-24; m[23114] = 2.991874E-24; m[23122] = 4.388081E-24; m[23124] = 6.582122E-24; m[23126] = 3.291061E-24; m[23212] = 7.313469E-24; m[23214] = 2.991874E-24; m[23222] = 7.313469E-24; m[23224] = 2.991874E-24; m[30113] = 2.632849E-24; m[30213] = 2.632849E-24; m[30221] = 1.880606E-24; m[30223] = 2.089563E-24; m[30313] = 2.056913E-24; m[30323] = 2.056913E-24; m[30443] = 2.419898E-23; m[31114] = 1.880606E-24; m[31214] = 3.291061E-24; m[32112] = 3.989164E-24; m[32114] = 1.880606E-24; m[32124] = 3.291061E-24; m[32212] = 3.989164E-24; m[32214] = 1.880606E-24; m[32224] = 1.880606E-24; m[33122] = 1.880606E-23; m[42112] = 6.582122E-24; m[42212] = 6.582122E-24; m[43122] = 2.194041E-24; m[53122] = 4.388081E-24; m[100111] = 1.645531E-24; m[100113] = 1.64553E-24; m[100211] = 1.645531E-24; m[100213] = 1.64553E-24; m[100221] = 1.196749E-23; m[100223] = 3.061452E-24; m[100313] = 2.837122E-24; m[100323] = 2.837122E-24; m[100331] = 4.459432E-25; m[100333] = 4.388081E-24; m[100441] = 4.701516E-23; m[100443] = 2.076379E-21; m[100553] = 2.056913E-20; m[200553] = 3.242425E-20; m[300553] = 3.210791E-23; m[9000111] = 8.776163E-24; m[9000211] = 8.776163E-24; m[9000443] = 8.227652E-24; m[9000553] = 5.983747E-24; m[9010111] = 3.164482E-24; m[9010211] = 3.164482E-24; m[9010221] = 9.403031E-24; m[9010443] = 8.438618E-24; m[9010553] = 8.3318E-24; m[9020443] = 1.061633E-23; m[9030221] = 6.038644E-24; m[9042413] = 2.07634E-21; m[9050225] = 1.394517E-24; m[9060225] = 3.291061E-24; m[9080225] = 4.388081E-24; m[9090225] = 2.056913E-24; m[9910445] = 2.07634E-21; m[9920443] = 2.07634E-21; return true; } }; const int LHCB_2011_I917009::stablePDGIds[205] = { 311, 543, 545, 551, 555, 557, 1103, 2101, 2103, 2203, 3101, 3103, 3201, 3203, 3303, 4101, 4103, 4124, 4201, 4203, 4301, 4303, 4312, 4314, 4322, 4324, 4334, 4403, 4414, 4424, 4434, 4444, 5101, 5103, 5114, 5201, 5203, 5214, 5224, 5301, 5303, 5314, 5324, 5334, 5401, 5403, 5412, 5414, 5422, 5424, 5432, 5434, 5444, 5503, 5514, 5524, 5534, 5544, 5554, 10022, 10333, 10335, 10443, 10541, 10543, 10551, 10553, 10555, 11112, 12118, 12122, 12218, 12222, 13316, 13326, 20543, 20553, 20555, 23314, 23324, 30343, 30353, 30363, 30553, 33314, 33324, 41214, 42124, 52114, 52214, 100311, 100315, 100321, 100325, 100411, 100413, 100421, 100423, 100551, 100555, 100557, 110551, 110553, 110555, 120553, 120555, 130553, 200551, 200555, 210551, 210553, 220553, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 1000011, 1000012, 1000013, 1000014, 1000015, 1000016, 1000021, 1000022, 1000023, 1000024, 1000025, 1000035, 1000037, 1000039, 2000001, 2000002, 2000003, 2000004, 2000005, 2000006, 2000011, 2000012, 2000013, 2000014, 2000015, 2000016, 3000111, 3000113, 3000211, 3000213, 3000221, 3000223, 3000331, 3100021, 3100111, 3100113, 3200111, 3200113, 3300113, 3400113, 4000001, 4000002, 4000011, 4000012, 5000039, 9000221, 9900012, 9900014, 9900016, 9900023, 9900024, 9900041, 9900042 }; // Hook for the plugin system DECLARE_RIVET_PLUGIN(LHCB_2011_I917009); } diff --git a/src/Analyses/LHCB_2012_I1119400.cc b/src/Analyses/LHCB_2012_I1119400.cc --- a/src/Analyses/LHCB_2012_I1119400.cc +++ b/src/Analyses/LHCB_2012_I1119400.cc @@ -1,357 +1,357 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/ChargedFinalState.hh" namespace Rivet { class LHCB_2012_I1119400 : public Analysis { public: /// @name Constructors etc. //@{ /// Constructor LHCB_2012_I1119400() : Analysis("LHCB_2012_I1119400"), _p_min(5.0), _pt_min(0.0),_pt1_edge(0.8), _pt2_edge(1.2), //_eta_nbins(4), _eta_min(2.5), _eta_max(4.5) { } //@} public: /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { fillMap(_partLftMap); int id_shift = 0; if (fuzzyEquals(sqrtS(), 7*TeV)) id_shift = 1; // define ratios if second pdgid in pair is -1, it means that is a antiparticle/particle ratio _ratiotype["pbarp"] = make_pair(2212, -1); _ratiotype["kminuskplus"] = make_pair(321, -1); _ratiotype["piminuspiplus"] = make_pair(211, -1); _ratiotype["ppi"] = make_pair(2212, 211); _ratiotype["kpi"] = make_pair(321, 211); _ratiotype["pk"] = make_pair(2212, 321); std::map _hepdataid; _hepdataid["pbarp"] = 1 + id_shift; _hepdataid["kminuskplus"] = 3 + id_shift; _hepdataid["piminuspiplus"] = 5 + id_shift; _hepdataid["ppi"] = 7 + id_shift; _hepdataid["kpi"] = 9 + id_shift; _hepdataid["pk"] = 11 + id_shift; std::map >::iterator it; // booking histograms for (it=_ratiotype.begin(); it!=_ratiotype.end(); it++) { _h_ratio_lowpt [it->first] = bookScatter2D(_hepdataid[it->first], 1, 1); _h_ratio_midpt [it->first] = bookScatter2D(_hepdataid[it->first], 1, 2); _h_ratio_highpt[it->first] = bookScatter2D(_hepdataid[it->first], 1, 3); _h_num_lowpt [it->first] = bookHisto1D ("TMP/num_l_"+it->first,refData(_hepdataid[it->first], 1, 1)); _h_num_midpt [it->first] = bookHisto1D ("TMP/num_m_"+it->first,refData(_hepdataid[it->first], 1, 2)); _h_num_highpt [it->first] = bookHisto1D ("TMP/num_h_"+it->first,refData(_hepdataid[it->first], 1, 3)); _h_den_lowpt [it->first] = bookHisto1D ("TMP/den_l_"+it->first,refData(_hepdataid[it->first], 1, 1)); _h_den_midpt [it->first] = bookHisto1D ("TMP/den_m_"+it->first,refData(_hepdataid[it->first], 1, 2)); _h_den_highpt [it->first] = bookHisto1D ("TMP/den_h_"+it->first,refData(_hepdataid[it->first], 1, 3)); } declare(ChargedFinalState(_eta_min, _eta_max, _pt_min*GeV), "CFS"); } // Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); const ChargedFinalState& cfs = apply(event, "CFS"); foreach (const Particle& p, cfs.particles()) { int id = p.pid(); // continue if particle not a proton, a kaon or a pion if ( !( (abs(id) == 211) || (abs(id) == 321) || (abs(id) == 2212))) { continue; } // cut in momentum const FourMomentum& qmom = p.momentum(); if (qmom.p3().mod() < _p_min) continue; // Lifetime cut: ctau sum of all particle ancestors < 10^-9 m according to the paper (see eq. 5) const double MAX_CTAU = 1.0e-9; // [m] double ancestor_lftsum = getMotherLifeTimeSum(p); if ( (ancestor_lftsum < 0.0) || (ancestor_lftsum > MAX_CTAU) ) continue; double eta = qmom.eta(); double pT = qmom.pT(); std::map >::iterator it; for (it=_ratiotype.begin(); it!=_ratiotype.end(); it++) { // check what type of ratio is if ((it->second.second)==-1) { // check ptbin if (pT < _pt1_edge) { // filling histos for numerator and denominator if (id == -abs(it->second.first)) _h_num_lowpt[it->first]->fill(eta, weight); if (id == abs(it->second.first)) _h_den_lowpt[it->first]->fill(eta, weight); } else if (pT < _pt2_edge) { // filling histos for numerator and denominator if (id == -abs(it->second.first)) _h_num_midpt[it->first]->fill(eta, weight); if (id == abs(it->second.first)) _h_den_midpt[it->first]->fill(eta, weight); } else { // filling histos for numerator and denominator if (id == -abs(it->second.first)) _h_num_highpt[it->first]->fill(eta, weight); if (id == abs(it->second.first)) _h_den_highpt[it->first]->fill(eta, weight); } } else { // check what type of ratio is if (pT < _pt1_edge) { // filling histos for numerator and denominator if (abs(id) == abs(it->second.first)) _h_num_lowpt[it->first]->fill(eta, weight); if (abs(id) == abs(it->second.second)) _h_den_lowpt[it->first]->fill(eta, weight); } else if (pT < _pt2_edge) { // filling histos for numerator and denominator if (abs(id) == abs(it->second.first)) _h_num_midpt[it->first]->fill(eta, weight); if (abs(id) == abs(it->second.second)) _h_den_midpt[it->first]->fill(eta, weight); } else { // filling histos for numerator and denominator if (abs(id) == abs(it->second.first)) _h_num_highpt[it->first]->fill(eta, weight); if (abs(id) == abs(it->second.second)) _h_den_highpt[it->first]->fill(eta, weight); } } } } } // Generate the ratio histograms void finalize() { std::map >::iterator it; // booking histograms for (it=_ratiotype.begin(); it!=_ratiotype.end(); it++) { divide(_h_num_lowpt[it->first], _h_den_lowpt[it->first], _h_ratio_lowpt[it->first]); divide(_h_num_midpt[it->first], _h_den_midpt[it->first], _h_ratio_midpt[it->first]); divide(_h_num_highpt[it->first], _h_den_highpt[it->first], _h_ratio_highpt[it->first]); } } //@} private: // Get particle lifetime from hardcoded data double getLifeTime(int pid) { pid = abs(pid); double lft = -1.0; map::iterator pPartLft = _partLftMap.find(pid); // search stable particle list if (pPartLft == _partLftMap.end()) { if (pid <= 100) return 0.0; for (size_t i=0; i < sizeof(_stablePDGIds)/sizeof(unsigned int); i++) { if (pid == _stablePDGIds[i]) { lft = 0.0; break; } } } else { lft = (*pPartLft).second; } if (lft < 0.0 && PID::isHadron(pid)) { MSG_WARNING("Lifetime map imcomplete --- " << pid << "... assume zero lifetime"); lft = 0.0; } return lft; } // Data members like post-cuts event weight counters go here const double getMotherLifeTimeSum(const Particle& p) { if (p.genParticle() == NULL) return -1.; double lftSum = 0.; double plft = 0.; - const GenParticle* part = p.genParticle(); - const GenVertex* ivtx = part->production_vertex(); + const GenParticlePtr part = p.genParticle(); + const GenVertexPtr ivtx = part->production_vertex(); while(ivtx) { if (ivtx->particles_in_size() < 1) { lftSum = -1.; break; }; const GenVertex::particles_in_const_iterator iPart_invtx = ivtx->particles_in_const_begin(); part = (*iPart_invtx); if ( !(part) ) { lftSum = -1.; break; }; ivtx = part->production_vertex(); if ( (part->pdg_id() == 2212) || !(ivtx) ) break; // reached beam plft = getLifeTime(part->pdg_id()); if (plft < 0.) { lftSum = -1.; break; }; lftSum += plft; }; return (lftSum * c_light); } /// @name Private variables // Momentum threshold double _p_min; // The edges of the intervals of transversal momentum double _pt_min; double _pt1_edge; double _pt2_edge; // The limits of the pseudorapidity window //int _eta_nbins; double _eta_min; double _eta_max; // Map between PDG id and particle lifetimes in seconds std::map _partLftMap; // Set of PDG Ids for stable particles (PDG Id <= 100 are considered stable) static const int _stablePDGIds[205]; // Define histograms // ratio std::map _h_ratio_lowpt; std::map _h_ratio_midpt; std::map _h_ratio_highpt; // numerator std::map _h_num_lowpt; std::map _h_num_midpt; std::map _h_num_highpt; // denominator std::map _h_den_lowpt; std::map _h_den_midpt; std::map _h_den_highpt; // Map of ratios and IDs of numerator and denominator std::map > _ratiotype; // Fill the PDG Id to Lifetime[seconds] map // Data was extracted from LHCb Particle Table through LHCb::ParticlePropertySvc bool fillMap(map &m) { m[6] = 4.707703E-25; m[11] = 1.E+16; m[12] = 1.E+16; m[13] = 2.197019E-06; m[14] = 1.E+16; m[15] = 2.906E-13; m[16] = 1.E+16; m[22] = 1.E+16; m[23] = 2.637914E-25; m[24] = 3.075758E-25; m[25] = 9.4E-26; m[35] = 9.4E-26; m[36] = 9.4E-26; m[37] = 9.4E-26; m[84] = 3.335641E-13; m[85] = 1.290893E-12; m[111] = 8.4E-17; m[113] = 4.405704E-24; m[115] = 6.151516E-24; m[117] = 4.088275E-24; m[119] = 2.102914E-24; m[130] = 5.116E-08; m[150] = 1.525E-12; m[211] = 2.6033E-08; m[213] = 4.405704E-24; m[215] = 6.151516E-24; m[217] = 4.088275E-24; m[219] = 2.102914E-24; m[221] = 5.063171E-19; m[223] = 7.752794E-23; m[225] = 3.555982E-24; m[227] = 3.91793E-24; m[229] = 2.777267E-24; m[310] = 8.953E-11; m[313] = 1.308573E-23; m[315] = 6.038644E-24; m[317] = 4.139699E-24; m[319] = 3.324304E-24; m[321] = 1.238E-08; m[323] = 1.295693E-23; m[325] = 6.682357E-24; m[327] = 4.139699E-24; m[329] = 3.324304E-24; m[331] = 3.210791E-21; m[333] = 1.545099E-22; m[335] = 9.016605E-24; m[337] = 7.565657E-24; m[350] = 1.407125E-12; m[411] = 1.04E-12; m[413] = 6.856377E-21; m[415] = 1.778952E-23; m[421] = 4.101E-13; m[423] = 1.000003E-19; m[425] = 1.530726E-23; m[431] = 5.E-13; m[433] = 1.000003E-19; m[435] = 3.291061E-23; m[441] = 2.465214E-23; m[443] = 7.062363E-21; m[445] = 3.242425E-22; m[510] = 1.525E-12; m[511] = 1.525E-12; m[513] = 1.000019E-19; m[515] = 1.31E-23; m[521] = 1.638E-12; m[523] = 1.000019E-19; m[525] = 1.31E-23; m[530] = 1.536875E-12; m[531] = 1.472E-12; m[533] = 1.E-19; m[535] = 1.31E-23; m[541] = 4.5E-13; m[553] = 1.218911E-20; m[1112] = 4.539394E-24; m[1114] = 5.578069E-24; m[1116] = 1.994582E-24; m[1118] = 2.269697E-24; m[1212] = 4.539394E-24; m[1214] = 5.723584E-24; m[1216] = 1.994582E-24; m[1218] = 1.316424E-24; m[2112] = 8.857E+02; m[2114] = 5.578069E-24; m[2116] = 4.388081E-24; m[2118] = 2.269697E-24; m[2122] = 4.539394E-24; m[2124] = 5.723584E-24; m[2126] = 1.994582E-24; m[2128] = 1.316424E-24; m[2212] = 1.E+16; m[2214] = 5.578069E-24; m[2216] = 4.388081E-24; m[2218] = 2.269697E-24; m[2222] = 4.539394E-24; m[2224] = 5.578069E-24; m[2226] = 1.994582E-24; m[2228] = 2.269697E-24; m[3112] = 1.479E-10; m[3114] = 1.670589E-23; m[3116] = 5.485102E-24; m[3118] = 3.656734E-24; m[3122] = 2.631E-10; m[3124] = 4.219309E-23; m[3126] = 8.227653E-24; m[3128] = 3.291061E-24; m[3212] = 7.4E-20; m[3214] = 1.828367E-23; m[3216] = 5.485102E-24; m[3218] = 3.656734E-24; m[3222] = 8.018E-11; m[3224] = 1.838582E-23; m[3226] = 5.485102E-24; m[3228] = 3.656734E-24; m[3312] = 1.639E-10; m[3314] = 6.648608E-23; m[3322] = 2.9E-10; m[3324] = 7.233101E-23; m[3334] = 8.21E-11; m[4112] = 2.991874E-22; m[4114] = 4.088274E-23; m[4122] = 2.E-13; m[4132] = 1.12E-13; m[4212] = 3.999999E-22; m[4214] = 3.291061E-22; m[4222] = 2.951624E-22; m[4224] = 4.417531E-23; m[4232] = 4.42E-13; m[4332] = 6.9E-14; m[4412] = 3.335641E-13; m[4422] = 3.335641E-13; m[4432] = 3.335641E-13; m[5112] = 1.E-19; m[5122] = 1.38E-12; m[5132] = 1.42E-12; m[5142] = 1.290893E-12; m[5212] = 1.E-19; m[5222] = 1.E-19; m[5232] = 1.42E-12; m[5242] = 1.290893E-12; m[5312] = 1.E-19; m[5322] = 1.E-19; m[5332] = 1.55E-12; m[5342] = 1.290893E-12; m[5442] = 1.290893E-12; m[5512] = 1.290893E-12; m[5522] = 1.290893E-12; m[5532] = 1.290893E-12; m[5542] = 1.290893E-12; m[10111] = 2.48382E-24; m[10113] = 4.635297E-24; m[10115] = 2.54136E-24; m[10211] = 2.48382E-24; m[10213] = 4.635297E-24; m[10215] = 2.54136E-24; m[10223] = 1.828367E-24; m[10225] = 3.636531E-24; m[10311] = 2.437823E-24; m[10313] = 7.313469E-24; m[10315] = 3.538775E-24; m[10321] = 2.437823E-24; m[10323] = 7.313469E-24; m[10325] = 3.538775E-24; m[10331] = 4.804469E-24; m[10411] = 4.38E-24; m[10413] = 3.29E-23; m[10421] = 4.38E-24; m[10423] = 3.22653E-23; m[10431] = 6.5821E-22; m[10433] = 6.5821E-22; m[10441] = 6.453061E-23; m[10511] = 4.39E-24; m[10513] = 1.65E-23; m[10521] = 4.39E-24; m[10523] = 1.65E-23; m[10531] = 4.39E-24; m[10533] = 1.65E-23; m[11114] = 2.194041E-24; m[11116] = 1.828367E-24; m[11212] = 1.880606E-24; m[11216] = 1.828367E-24; m[12112] = 2.194041E-24; m[12114] = 2.194041E-24; m[12116] = 5.063171E-24; m[12126] = 1.828367E-24; m[12212] = 2.194041E-24; m[12214] = 2.194041E-24; m[12216] = 5.063171E-24; m[12224] = 2.194041E-24; m[12226] = 1.828367E-24; m[13112] = 6.582122E-24; m[13114] = 1.09702E-23; m[13116] = 5.485102E-24; m[13122] = 1.316424E-23; m[13124] = 1.09702E-23; m[13126] = 6.928549E-24; m[13212] = 6.582122E-24; m[13214] = 1.09702E-23; m[13216] = 5.485102E-24; m[13222] = 6.582122E-24; m[13224] = 1.09702E-23; m[13226] = 5.485102E-24; m[13314] = 2.742551E-23; m[13324] = 2.742551E-23; m[14122] = 1.828367E-22; m[20022] = 1.E+16; m[20113] = 1.567172E-24; m[20213] = 1.567172E-24; m[20223] = 2.708692E-23; m[20313] = 3.782829E-24; m[20315] = 2.384827E-24; m[20323] = 3.782829E-24; m[20325] = 2.384827E-24; m[20333] = 1.198929E-23; m[20413] = 2.63E-24; m[20423] = 2.63E-24; m[20433] = 6.5821E-22; m[20443] = 7.395643E-22; m[20513] = 2.63E-24; m[20523] = 2.63E-24; m[20533] = 2.63E-24; m[21112] = 2.632849E-24; m[21114] = 3.291061E-24; m[21212] = 2.632849E-24; m[21214] = 6.582122E-24; m[22112] = 4.388081E-24; m[22114] = 3.291061E-24; m[22122] = 2.632849E-24; m[22124] = 6.582122E-24; m[22212] = 4.388081E-24; m[22214] = 3.291061E-24; m[22222] = 2.632849E-24; m[22224] = 3.291061E-24; m[23112] = 7.313469E-24; m[23114] = 2.991874E-24; m[23122] = 4.388081E-24; m[23124] = 6.582122E-24; m[23126] = 3.291061E-24; m[23212] = 7.313469E-24; m[23214] = 2.991874E-24; m[23222] = 7.313469E-24; m[23224] = 2.991874E-24; m[30113] = 2.632849E-24; m[30213] = 2.632849E-24; m[30221] = 1.880606E-24; m[30223] = 2.089563E-24; m[30313] = 2.056913E-24; m[30323] = 2.056913E-24; m[30443] = 2.419898E-23; m[31114] = 1.880606E-24; m[31214] = 3.291061E-24; m[32112] = 3.989164E-24; m[32114] = 1.880606E-24; m[32124] = 3.291061E-24; m[32212] = 3.989164E-24; m[32214] = 1.880606E-24; m[32224] = 1.880606E-24; m[33122] = 1.880606E-23; m[42112] = 6.582122E-24; m[42212] = 6.582122E-24; m[43122] = 2.194041E-24; m[53122] = 4.388081E-24; m[100111] = 1.645531E-24; m[100113] = 1.64553E-24; m[100211] = 1.645531E-24; m[100213] = 1.64553E-24; m[100221] = 1.196749E-23; m[100223] = 3.061452E-24; m[100313] = 2.837122E-24; m[100323] = 2.837122E-24; m[100331] = 4.459432E-25; m[100333] = 4.388081E-24; m[100441] = 4.701516E-23; m[100443] = 2.076379E-21; m[100553] = 2.056913E-20; m[200553] = 3.242425E-20; m[300553] = 3.210791E-23; m[9000111] = 8.776163E-24; m[9000211] = 8.776163E-24; m[9000443] = 8.227652E-24; m[9000553] = 5.983747E-24; m[9010111] = 3.164482E-24; m[9010211] = 3.164482E-24; m[9010221] = 9.403031E-24; m[9010443] = 8.438618E-24; m[9010553] = 8.3318E-24; m[9020443] = 1.061633E-23; m[9030221] = 6.038644E-24; m[9042413] = 2.07634E-21; m[9050225] = 1.394517E-24; m[9060225] = 3.291061E-24; m[9080225] = 4.388081E-24; m[9090225] = 2.056913E-24; m[9910445] = 2.07634E-21; m[9920443] = 2.07634E-21; return true; } }; const int LHCB_2012_I1119400::_stablePDGIds[205] = { 311, 543, 545, 551, 555, 557, 1103, 2101, 2103, 2203, 3101, 3103, 3201, 3203, 3303, 4101, 4103, 4124, 4201, 4203, 4301, 4303, 4312, 4314, 4322, 4324, 4334, 4403, 4414, 4424, 4434, 4444, 5101, 5103, 5114, 5201, 5203, 5214, 5224, 5301, 5303, 5314, 5324, 5334, 5401, 5403, 5412, 5414, 5422, 5424, 5432, 5434, 5444, 5503, 5514, 5524, 5534, 5544, 5554, 10022, 10333, 10335, 10443, 10541, 10543, 10551, 10553, 10555, 11112, 12118, 12122, 12218, 12222, 13316, 13326, 20543, 20553, 20555, 23314, 23324, 30343, 30353, 30363, 30553, 33314, 33324, 41214, 42124, 52114, 52214, 100311, 100315, 100321, 100325, 100411, 100413, 100421, 100423, 100551, 100555, 100557, 110551, 110553, 110555, 120553, 120555, 130553, 200551, 200555, 210551, 210553, 220553, 1000001, 1000002, 1000003, 1000004, 1000005, 1000006, 1000011, 1000012, 1000013, 1000014, 1000015, 1000016, 1000021, 1000022, 1000023, 1000024, 1000025, 1000035, 1000037, 1000039, 2000001, 2000002, 2000003, 2000004, 2000005, 2000006, 2000011, 2000012, 2000013, 2000014, 2000015, 2000016, 3000111, 3000113, 3000211, 3000213, 3000221, 3000223, 3000331, 3100021, 3100111, 3100113, 3200111, 3200113, 3300113, 3400113, 4000001, 4000002, 4000011, 4000012, 5000039, 9000221, 9900012, 9900014, 9900016, 9900023, 9900024, 9900041, 9900042 }; // Plugin hook DECLARE_RIVET_PLUGIN(LHCB_2012_I1119400); } diff --git a/src/Analyses/LHCB_2014_I1281685.cc b/src/Analyses/LHCB_2014_I1281685.cc --- a/src/Analyses/LHCB_2014_I1281685.cc +++ b/src/Analyses/LHCB_2014_I1281685.cc @@ -1,1178 +1,1178 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/ChargedFinalState.hh" namespace Rivet { /// Charged particle multiplicities and densities in $pp$ collisions at $\sqrt{s} = 7$ TeV class LHCB_2014_I1281685 : public Analysis { public: /// @name Constructors etc. //@{ /// Constructor LHCB_2014_I1281685() : Analysis("LHCB_2014_I1281685"), _p_min(2.0), _pt_min(0.2), _eta_min(2.0), _eta_max(4.8), _maxlft(1.0e-11) { } //@} /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { fillMap(_partLftMap); // Projections declare(ChargedFinalState(_eta_min, _eta_max, _pt_min*GeV), "CFS"); // Book histograms _h_mult_total = bookHisto1D("d03-x01-y01", 50, 0.5, 50.5); _h_mult_eta[0] = bookHisto1D("d04-x01-y01", 21, -0.5, 20.5); //eta=[2.0,2.5] _h_mult_eta[1] = bookHisto1D("d04-x01-y02", 21, -0.5, 20.5); //eta=[2.5,3.0] _h_mult_eta[2] = bookHisto1D("d04-x01-y03", 21, -0.5, 20.5); //eta=[3.0,3.5] _h_mult_eta[3] = bookHisto1D("d04-x01-y04", 21, -0.5, 20.5); //eta=[3.5,4.0] _h_mult_eta[4] = bookHisto1D("d04-x01-y05", 21, -0.5, 20.5); //eta=[4.0,4.5] _h_mult_pt[0] = bookHisto1D("d05-x01-y01", 21, -0.5, 20.5); //pT=[0.2,0.3]GeV _h_mult_pt[1] = bookHisto1D("d05-x01-y02", 21, -0.5, 20.5); //pT=[0.3,0.4]GeV _h_mult_pt[2] = bookHisto1D("d05-x01-y03", 21, -0.5, 20.5); //pT=[0.4,0.6]GeV _h_mult_pt[3] = bookHisto1D("d05-x01-y04", 21, -0.5, 20.5); //pT=[0.6,1.0]GeV _h_mult_pt[4] = bookHisto1D("d05-x01-y05", 21, -0.5, 20.5); //pT=[1.0,2.0]GeV _h_dndeta = bookHisto1D("d01-x01-y01", 14, 2.0, 4.8); //eta=[2,4.8] _h_dndpt = bookHisto1D("d02-x01-y01", 18, 0.2, 2.0); //pT =[0,2]GeV // Counters _sumW = 0; } /// Perform the per-event analysis void analyze(const Event& event) { // Variable to store multiplicities per event int LHCbcountAll = 0; //count particles fulfiling all requirements int LHCbcountEta[8] = {0,0,0,0,0,0,0,0}; //count per eta-bin int LHCbcountPt[7] = {0,0,0,0,0,0,0}; //count per pT-bin vector val_dNdEta; vector val_dNdPt; val_dNdEta.clear(); val_dNdPt.clear(); const ChargedFinalState& cfs = apply(event, "CFS"); foreach (const Particle& p, cfs.particles()) { int id = p.pdgId(); // continue if particle is not a pion, kaon, proton, muon or electron if ( !( (abs(id) == 211) || (abs(id) == 321) || (abs(id) == 2212) || (abs(id) == 13) || (abs(id) == 11)) ) { continue; } const FourMomentum& qmom = p.momentum(); const double eta = p.momentum().eta(); const double pT = p.momentum().pT(); //minimum momentum if (qmom.p3().mod() < _p_min) continue; //minimum tr. momentum if (pT < _pt_min) continue; //eta range if ((eta < _eta_min) || (eta > _eta_max)) continue; /* Select only prompt particles via lifetime */ //Sum of all mother lifetimes (PDG lifetime) < 10ps double ancestors_sumlft = getAncestorSumLifetime(p); if( (ancestors_sumlft > _maxlft) || (ancestors_sumlft < 0) ) continue; //after all cuts; LHCbcountAll++; //count particles in whole kin. range //in eta bins if( eta >2.0 && eta <= 2.5) LHCbcountEta[0]++; if( eta >2.5 && eta <= 3.0) LHCbcountEta[1]++; if( eta >3.0 && eta <= 3.5) LHCbcountEta[2]++; if( eta >3.5 && eta <= 4.0) LHCbcountEta[3]++; if( eta >4.0 && eta <= 4.5) LHCbcountEta[4]++; if( eta >2.0 && eta <= 4.8) LHCbcountEta[5]++; //cross-check //in pT bins if( pT > 0.2 && pT <= 0.3) LHCbcountPt[0]++; if( pT > 0.3 && pT <= 0.4) LHCbcountPt[1]++; if( pT > 0.4 && pT <= 0.6) LHCbcountPt[2]++; if( pT > 0.6 && pT <= 1.0) LHCbcountPt[3]++; if( pT > 1.0 && pT <= 2.0) LHCbcountPt[4]++; if( pT > 0.2) LHCbcountPt[5]++; //cross-check //particle densities -> need proper normalization (finalize) val_dNdPt.push_back( pT ); val_dNdEta.push_back( eta ); }//end foreach // Fill histograms only, if at least 1 particle pre event was within the // kinematic range of the analysis! if (LHCbcountAll) { const double weight = event.weight(); _sumW += weight; _h_mult_total->fill(LHCbcountAll, weight); _h_mult_eta[0]->fill(LHCbcountEta[0], weight); _h_mult_eta[1]->fill(LHCbcountEta[1], weight); _h_mult_eta[2]->fill(LHCbcountEta[2], weight); _h_mult_eta[3]->fill(LHCbcountEta[3], weight); _h_mult_eta[4]->fill(LHCbcountEta[4], weight); _h_mult_pt[0]->fill(LHCbcountPt[0], weight); _h_mult_pt[1]->fill(LHCbcountPt[1], weight); _h_mult_pt[2]->fill(LHCbcountPt[2], weight); _h_mult_pt[3]->fill(LHCbcountPt[3], weight); _h_mult_pt[4]->fill(LHCbcountPt[4], weight); for (size_t part = 0; part < val_dNdEta.size(); part++) _h_dndeta->fill(val_dNdEta[part], weight); for (size_t part = 0; part < val_dNdPt.size(); part++) _h_dndpt->fill(val_dNdPt[part], weight); } } /// Normalise histograms etc., after the run void finalize() { const double scalefactor = 1.0/_sumW; // normalize multiplicity histograms by nEvents const double scale1k = 1000.; // to match '10^3' scale in reference histograms scale( _h_dndeta, scalefactor ); scale( _h_dndpt, scalefactor*0.1 ); //additional factor 0.1 for [0.1 GeV/c] scale( _h_mult_total, scalefactor*scale1k); _h_mult_eta[0]->scaleW( scalefactor*scale1k ); _h_mult_eta[1]->scaleW( scalefactor*scale1k ); _h_mult_eta[2]->scaleW( scalefactor*scale1k ); _h_mult_eta[3]->scaleW( scalefactor*scale1k ); _h_mult_eta[4]->scaleW( scalefactor*scale1k ); _h_mult_pt[0]->scaleW( scalefactor*scale1k ); _h_mult_pt[1]->scaleW( scalefactor*scale1k ); _h_mult_pt[2]->scaleW( scalefactor*scale1k ); _h_mult_pt[3]->scaleW( scalefactor*scale1k ); _h_mult_pt[4]->scaleW( scalefactor*scale1k ); } //@} private: // Get mean PDG lifetime for particle with PID double getLifetime(int pid) { double lft = 0.; map::iterator pPartLft = _partLftMap.find(pid); if (pPartLft != _partLftMap.end()) { lft = (*pPartLft).second; } else { // allow identifying missing life times only in debug mode MSG_DEBUG("Could not determine lifetime for particle with PID " << pid << "... Assume non-prompt particle"); lft = -1; } return lft; } // Get sum of all ancestor particles const double getAncestorSumLifetime(const Particle& p) { double lftSum = 0.; double plft = 0.; - const GenParticle* part = p.genParticle(); + const GenParticlePtr part = p.genParticle(); if ( 0 == part ) return -1; - const GenVertex* ivtx = part->production_vertex(); + const GenVertexPtr ivtx = part->production_vertex(); while(ivtx) { if (ivtx->particles_in_size() < 1) { lftSum = -1.; break; }; const GenVertex::particles_in_const_iterator iPart_invtx = ivtx->particles_in_const_begin(); part = (*iPart_invtx); if ( !(part) ) { lftSum = -1.; break; }; ivtx = part->production_vertex(); if ( (part->pdg_id() == 2212) || !(ivtx) ) break; // reached beam plft = getLifetime(part->pdg_id()); if (plft < 0.) { lftSum = -1.; break; }; lftSum += plft; } return (lftSum); } /// Hard-coded map linking PDG ID with PDG lifetime[s] (converted from ParticleTable.txt) bool fillMap(map& m) { // PDGID = LIFETIME m[22] = 1.000000e+016; m[-11] = 1.000000e+016; m[11] = 1.000000e+016; m[12] = 1.000000e+016; m[-13] = 2.197036e-006; m[13] = 2.197036e-006; m[111] = 8.438618e-017; m[211] = 2.603276e-008; m[-211] = 2.603276e-008; m[130] = 5.174624e-008; m[321] = 1.238405e-008; m[-321] = 1.238405e-008; m[2112] = 885.646128; m[2212] = 1.000000e+016; m[-2212] = 1.000000e+016; m[310] = 8.934603e-011; m[221] = 5.578070e-019; m[3122] = 2.631796e-010; m[3222] = 8.018178e-011; m[3212] = 7.395643e-020; m[3112] = 1.479129e-010; m[3322] = 2.899613e-010; m[3312] = 1.637344e-010; m[3334] = 8.207135e-011; m[-2112] = 885.646128; m[-3122] = 2.631796e-010; m[-3222] = 8.018178e-011; m[-3212] = 7.395643e-020; m[-3112] = 1.479129e-010; m[-3322] = 2.899613e-010; m[-3312] = 1.637344e-010; m[-3334] = 8.207135e-011; m[113] = 4.411610e-024; m[213] = 4.411610e-024; m[-213] = 4.411610e-024; m[223] = 7.798723e-023; m[333] = 1.545099e-022; m[323] = 1.295693e-023; m[-323] = 1.295693e-023; m[313] = 1.298249e-023; m[-313] = 1.298249e-023; m[20213] = 1.500000e-024; m[-20213] = 1.500000e-024; m[450000000] = 1.000000e+015; m[460000000] = 1.000000e+015; m[470000000] = 1.000000e+015; m[480000000] = 1.000000e+015; m[490000000] = 1.000000e+015; m[20022] = 1.000000e+016; m[-15] = 2.906014e-013; m[15] = 2.906014e-013; m[24] = 3.104775e-025; m[-24] = 3.104775e-025; m[23] = 2.637914e-025; m[411] = 1.051457e-012; m[-411] = 1.051457e-012; m[421] = 4.116399e-013; m[-421] = 4.116399e-013; m[431] = 4.904711e-013; m[-431] = 4.904711e-013; m[4122] = 1.994582e-013; m[-4122] = 1.994582e-013; m[443] = 7.565657e-021; m[413] = 6.856377e-021; m[-413] = 6.856377e-021; m[423] = 1.000003e-019; m[-423] = 1.000003e-019; m[433] = 1.000003e-019; m[-433] = 1.000003e-019; m[521] = 1.671000e-012; m[-521] = 1.671000e-012; m[511] = 1.536000e-012; m[-511] = 1.536000e-012; m[531] = 1.461000e-012; m[-531] = 1.461000e-012; m[541] = 4.600000e-013; m[-541] = 4.600000e-013; m[5122] = 1.229000e-012; m[-5122] = 1.229000e-012; m[4112] = 4.388081e-022; m[-4112] = 4.388081e-022; m[4212] = 3.999999e-022; m[-4212] = 3.999999e-022; m[4222] = 3.291060e-022; m[-4222] = 3.291060e-022; m[25] = 9.400000e-026; m[35] = 9.400000e-026; m[36] = 9.400000e-026; m[37] = 9.400000e-026; m[-37] = 9.400000e-026; m[4312] = 9.800002e-014; m[-4312] = 9.800002e-014; m[4322] = 3.500001e-013; m[-4322] = 3.500001e-013; m[4332] = 6.453061e-014; m[-4332] = 6.453061e-014; m[4132] = 9.824063e-014; m[-4132] = 9.824063e-014; m[4232] = 4.417532e-013; m[-4232] = 4.417532e-013; m[5222] = 1.000000e-019; m[-5222] = 1.000000e-019; m[5212] = 1.000000e-019; m[-5212] = 1.000000e-019; m[5112] = 1.000000e-019; m[-5112] = 1.000000e-019; m[5312] = 1.000000e-019; m[-5312] = 1.000000e-019; m[5322] = 1.000000e-019; m[-5322] = 1.000000e-019; m[5332] = 1.550000e-012; m[-5332] = 1.550000e-012; m[5132] = 1.390000e-012; m[-5132] = 1.390000e-012; m[5232] = 1.390000e-012; m[-5232] = 1.390000e-012; m[100443] = 2.194041e-021; m[331] = 3.258476e-021; m[441] = 4.113826e-023; m[10441] = 4.063038e-023; m[20443] = 7.154480e-022; m[445] = 3.164482e-022; m[9000111] = 1.149997e-023; m[9000211] = 1.149997e-023; m[-9000211] = 1.149997e-023; m[20113] = 1.500000e-024; m[115] = 6.151516e-024; m[215] = 6.151516e-024; m[-215] = 6.151516e-024; m[10323] = 7.313469e-024; m[-10323] = 7.313469e-024; m[10313] = 7.313469e-024; m[-10313] = 7.313469e-024; m[20323] = 3.782829e-024; m[-20323] = 3.782829e-024; m[20313] = 3.782829e-024; m[-20313] = 3.782829e-024; m[10321] = 2.238817e-024; m[-10321] = 2.238817e-024; m[10311] = 2.238817e-024; m[-10311] = 2.238817e-024; m[325] = 6.682357e-024; m[-325] = 6.682357e-024; m[315] = 6.038644e-024; m[-315] = 6.038644e-024; m[10411] = 4.380000e-024; m[20413] = 2.630000e-024; m[10413] = 3.290000e-023; m[-415] = 2.632849e-023; m[-10411] = 4.380000e-024; m[-20413] = 2.630000e-024; m[-10413] = 3.290000e-023; m[415] = 2.632849e-023; m[10421] = 4.380000e-024; m[20423] = 2.630000e-024; m[10423] = 3.482604e-023; m[-425] = 2.861792e-023; m[-10421] = 4.380000e-024; m[-20423] = 2.630000e-024; m[-10423] = 3.482604e-023; m[425] = 2.861792e-023; m[10431] = 6.582100e-022; m[20433] = 6.582100e-022; m[10433] = 6.582100e-022; m[435] = 4.388100e-023; m[-10431] = 6.582100e-022; m[-20433] = 6.582100e-022; m[-10433] = 6.582100e-022; m[-435] = 4.388100e-023; m[2224] = 5.485102e-024; m[2214] = 5.485102e-024; m[2114] = 5.485102e-024; m[1114] = 5.485102e-024; m[-2224] = 5.485102e-024; m[-2214] = 5.485102e-024; m[-2114] = 5.485102e-024; m[-1114] = 5.485102e-024; m[-523] = 1.000019e-019; m[523] = 1.000019e-019; m[513] = 1.000019e-019; m[-513] = 1.000019e-019; m[533] = 1.000000e-019; m[-533] = 1.000000e-019; m[10521] = 4.390000e-024; m[20523] = 2.630000e-024; m[10523] = 1.650000e-023; m[525] = 1.310000e-023; m[-10521] = 4.390000e-024; m[-20523] = 2.630000e-024; m[-10523] = 1.650000e-023; m[-525] = 1.310000e-023; m[10511] = 4.390000e-024; m[20513] = 2.630000e-024; m[10513] = 1.650000e-023; m[515] = 1.310000e-023; m[-10511] = 4.390000e-024; m[-20513] = 2.630000e-024; m[-10513] = 1.650000e-023; m[-515] = 1.310000e-023; m[10531] = 4.390000e-024; m[20533] = 2.630000e-024; m[10533] = 1.650000e-023; m[535] = 1.310000e-023; m[-10531] = 4.390000e-024; m[-20533] = 2.630000e-024; m[-10533] = 1.650000e-023; m[-535] = 1.310000e-023; m[14] = 1.000000e+016; m[-14] = 1.000000e+016; m[-12] = 1.000000e+016; m[1] = 0.000000e+000; m[-1] = 0.000000e+000; m[2] = 0.000000e+000; m[-2] = 0.000000e+000; m[3] = 0.000000e+000; m[-3] = 0.000000e+000; m[4] = 0.000000e+000; m[-4] = 0.000000e+000; m[5] = 0.000000e+000; m[-5] = 0.000000e+000; m[6] = 4.707703e-025; m[-6] = 4.707703e-025; m[7] = 0.000000e+000; m[-7] = 0.000000e+000; m[8] = 0.000000e+000; m[-8] = 0.000000e+000; m[16] = 1.000000e+016; m[-16] = 1.000000e+016; m[17] = 0.000000e+000; m[-17] = 0.000000e+000; m[18] = 0.000000e+000; m[-18] = 0.000000e+000; m[21] = 0.000000e+000; m[32] = 0.000000e+000; m[33] = 0.000000e+000; m[34] = 0.000000e+000; m[-34] = 0.000000e+000; m[39] = 0.000000e+000; m[41] = 0.000000e+000; m[-41] = 0.000000e+000; m[42] = 0.000000e+000; m[-42] = 0.000000e+000; m[43] = 0.000000e+000; m[44] = 0.000000e+000; m[-44] = 0.000000e+000; m[81] = 0.000000e+000; m[82] = 0.000000e+000; m[-82] = 0.000000e+000; m[83] = 0.000000e+000; m[84] = 3.335641e-013; m[-84] = 3.335641e-013; m[85] = 1.290893e-012; m[-85] = 1.290893e-012; m[86] = 0.000000e+000; m[-86] = 0.000000e+000; m[87] = 0.000000e+000; m[-87] = 0.000000e+000; m[88] = 0.000000e+000; m[90] = 0.000000e+000; m[91] = 0.000000e+000; m[92] = 0.000000e+000; m[93] = 0.000000e+000; m[94] = 0.000000e+000; m[95] = 0.000000e+000; m[96] = 0.000000e+000; m[97] = 0.000000e+000; m[98] = 0.000000e+000; m[99] = 0.000000e+000; m[117] = 4.088275e-024; m[119] = 1.828367e-024; m[217] = 4.088275e-024; m[-217] = 4.088275e-024; m[219] = 1.828367e-024; m[-219] = 1.828367e-024; m[225] = 3.555982e-024; m[227] = 3.917930e-024; m[229] = 3.392846e-024; m[311] = 1.000000e+016; m[-311] = 1.000000e+016; m[317] = 4.139699e-024; m[-317] = 4.139699e-024; m[319] = 3.324304e-024; m[-319] = 3.324304e-024; m[327] = 4.139699e-024; m[-327] = 4.139699e-024; m[329] = 3.324304e-024; m[-329] = 3.324304e-024; m[335] = 8.660687e-024; m[337] = 7.565657e-024; m[543] = 0.000000e+000; m[-543] = 0.000000e+000; m[545] = 0.000000e+000; m[-545] = 0.000000e+000; m[551] = 0.000000e+000; m[553] = 1.253738e-020; m[555] = 1.000000e+016; m[557] = 0.000000e+000; m[-450000000] = 0.000000e+000; m[-490000000] = 0.000000e+000; m[-460000000] = 0.000000e+000; m[-470000000] = 0.000000e+000; m[1103] = 0.000000e+000; m[-1103] = 0.000000e+000; m[1112] = 4.388081e-024; m[-1112] = 4.388081e-024; m[1116] = 1.880606e-024; m[-1116] = 1.880606e-024; m[1118] = 2.194041e-024; m[-1118] = 2.194041e-024; m[1212] = 4.388081e-024; m[-1212] = 4.388081e-024; m[1214] = 5.485102e-024; m[-1214] = 5.485102e-024; m[1216] = 1.880606e-024; m[-1216] = 1.880606e-024; m[1218] = 1.462694e-024; m[-1218] = 1.462694e-024; m[2101] = 0.000000e+000; m[-2101] = 0.000000e+000; m[2103] = 0.000000e+000; m[-2103] = 0.000000e+000; m[2116] = 4.388081e-024; m[-2116] = 4.388081e-024; m[2118] = 2.194041e-024; m[-2118] = 2.194041e-024; m[2122] = 4.388081e-024; m[-2122] = 4.388081e-024; m[2124] = 5.485102e-024; m[-2124] = 5.485102e-024; m[2126] = 1.880606e-024; m[-2126] = 1.880606e-024; m[2128] = 1.462694e-024; m[-2128] = 1.462694e-024; m[2203] = 0.000000e+000; m[-2203] = 0.000000e+000; m[2216] = 4.388081e-024; m[-2216] = 4.388081e-024; m[2218] = 2.194041e-024; m[-2218] = 2.194041e-024; m[2222] = 4.388081e-024; m[-2222] = 4.388081e-024; m[2226] = 1.880606e-024; m[-2226] = 1.880606e-024; m[2228] = 2.194041e-024; m[-2228] = 2.194041e-024; m[3101] = 0.000000e+000; m[-3101] = 0.000000e+000; m[3103] = 0.000000e+000; m[-3103] = 0.000000e+000; m[3114] = 1.670589e-023; m[-3114] = 1.670589e-023; m[3116] = 5.485102e-024; m[-3116] = 5.485102e-024; m[3118] = 3.656734e-024; m[-3118] = 3.656734e-024; m[3124] = 4.219309e-023; m[-3124] = 4.219309e-023; m[3126] = 8.227653e-024; m[-3126] = 8.227653e-024; m[3128] = 3.291061e-024; m[-3128] = 3.291061e-024; m[3201] = 0.000000e+000; m[-3201] = 0.000000e+000; m[3203] = 0.000000e+000; m[-3203] = 0.000000e+000; m[3214] = 1.828367e-023; m[-3214] = 1.828367e-023; m[3216] = 5.485102e-024; m[-3216] = 5.485102e-024; m[3218] = 3.656734e-024; m[-3218] = 3.656734e-024; m[3224] = 1.838582e-023; m[-3224] = 1.838582e-023; m[3226] = 5.485102e-024; m[-3226] = 5.485102e-024; m[3228] = 3.656734e-024; m[-3228] = 3.656734e-024; m[3303] = 0.000000e+000; m[-3303] = 0.000000e+000; m[3314] = 6.648608e-023; m[-3314] = 6.648608e-023; m[3324] = 7.233101e-023; m[-3324] = 7.233101e-023; m[4101] = 0.000000e+000; m[-4101] = 0.000000e+000; m[4103] = 0.000000e+000; m[-4103] = 0.000000e+000; m[4114] = 0.000000e+000; m[-4114] = 0.000000e+000; m[4201] = 0.000000e+000; m[-4201] = 0.000000e+000; m[4203] = 0.000000e+000; m[-4203] = 0.000000e+000; m[4214] = 3.291061e-022; m[-4214] = 3.291061e-022; m[4224] = 0.000000e+000; m[-4224] = 0.000000e+000; m[4301] = 0.000000e+000; m[-4301] = 0.000000e+000; m[4303] = 0.000000e+000; m[-4303] = 0.000000e+000; m[4314] = 0.000000e+000; m[-4314] = 0.000000e+000; m[4324] = 0.000000e+000; m[-4324] = 0.000000e+000; m[4334] = 0.000000e+000; m[-4334] = 0.000000e+000; m[4403] = 0.000000e+000; m[-4403] = 0.000000e+000; m[4412] = 3.335641e-013; m[-4412] = 3.335641e-013; m[4414] = 3.335641e-013; m[-4414] = 3.335641e-013; m[4422] = 3.335641e-013; m[-4422] = 3.335641e-013; m[4424] = 3.335641e-013; m[-4424] = 3.335641e-013; m[4432] = 3.335641e-013; m[-4432] = 3.335641e-013; m[4434] = 3.335641e-013; m[-4434] = 3.335641e-013; m[4444] = 3.335641e-013; m[-4444] = 3.335641e-013; m[5101] = 0.000000e+000; m[-5101] = 0.000000e+000; m[5103] = 0.000000e+000; m[-5103] = 0.000000e+000; m[5114] = 0.000000e+000; m[-5114] = 0.000000e+000; m[5142] = 1.290893e-012; m[-5142] = 1.290893e-012; m[5201] = 0.000000e+000; m[-5201] = 0.000000e+000; m[5203] = 0.000000e+000; m[-5203] = 0.000000e+000; m[5214] = 0.000000e+000; m[-5214] = 0.000000e+000; m[5224] = 0.000000e+000; m[-5224] = 0.000000e+000; m[5242] = 1.290893e-012; m[-5242] = 1.290893e-012; m[5301] = 0.000000e+000; m[-5301] = 0.000000e+000; m[5303] = 0.000000e+000; m[-5303] = 0.000000e+000; m[5314] = 0.000000e+000; m[-5314] = 0.000000e+000; m[5324] = 0.000000e+000; m[-5324] = 0.000000e+000; m[5334] = 0.000000e+000; m[-5334] = 0.000000e+000; m[5342] = 1.290893e-012; m[-5342] = 1.290893e-012; m[5401] = 0.000000e+000; m[-5401] = 0.000000e+000; m[5403] = 0.000000e+000; m[-5403] = 0.000000e+000; m[5412] = 1.290893e-012; m[-5412] = 1.290893e-012; m[5414] = 1.290893e-012; m[-5414] = 1.290893e-012; m[5422] = 1.290893e-012; m[-5422] = 1.290893e-012; m[5424] = 1.290893e-012; m[-5424] = 1.290893e-012; m[5432] = 1.290893e-012; m[-5432] = 1.290893e-012; m[5434] = 1.290893e-012; m[-5434] = 1.290893e-012; m[5442] = 1.290893e-012; m[-5442] = 1.290893e-012; m[5444] = 1.290893e-012; m[-5444] = 1.290893e-012; m[5503] = 0.000000e+000; m[-5503] = 0.000000e+000; m[5512] = 1.290893e-012; m[-5512] = 1.290893e-012; m[5514] = 1.290893e-012; m[-5514] = 1.290893e-012; m[5522] = 1.290893e-012; m[-5522] = 1.290893e-012; m[5524] = 1.290893e-012; m[-5524] = 1.290893e-012; m[5532] = 1.290893e-012; m[-5532] = 1.290893e-012; m[5534] = 1.290893e-012; m[-5534] = 1.290893e-012; m[5542] = 1.290893e-012; m[-5542] = 1.290893e-012; m[5544] = 1.290893e-012; m[-5544] = 1.290893e-012; m[5554] = 1.290893e-012; m[-5554] = 1.290893e-012; m[10022] = 0.000000e+000; m[10111] = 2.483820e-024; m[10113] = 4.635297e-024; m[10115] = 2.541360e-024; m[10211] = 2.483820e-024; m[-10211] = 2.483820e-024; m[10213] = 4.635297e-024; m[-10213] = 4.635297e-024; m[10215] = 2.541360e-024; m[-10215] = 2.541360e-024; m[9010221] = 1.316424e-023; m[10223] = 1.828367e-024; m[10225] = 0.000000e+000; m[10315] = 3.538775e-024; m[-10315] = 3.538775e-024; m[10325] = 3.538775e-024; m[-10325] = 3.538775e-024; m[10331] = 5.265698e-024; m[10333] = 0.000000e+000; m[10335] = 0.000000e+000; m[10443] = 0.000000e+000; m[10541] = 0.000000e+000; m[-10541] = 0.000000e+000; m[10543] = 0.000000e+000; m[-10543] = 0.000000e+000; m[10551] = 1.000000e+016; m[10553] = 0.000000e+000; m[10555] = 0.000000e+000; m[11112] = 0.000000e+000; m[-11112] = 0.000000e+000; m[11114] = 2.194041e-024; m[-11114] = 2.194041e-024; m[11116] = 1.880606e-024; m[-11116] = 1.880606e-024; m[11212] = 1.880606e-024; m[-11212] = 1.880606e-024; m[11216] = 0.000000e+000; m[-11216] = 0.000000e+000; m[12112] = 1.880606e-024; m[-12112] = 1.880606e-024; m[12114] = 2.194041e-024; m[-12114] = 2.194041e-024; m[12116] = 5.063171e-024; m[-12116] = 5.063171e-024; m[12118] = 0.000000e+000; m[-12118] = 0.000000e+000; m[12122] = 0.000000e+000; m[-12122] = 0.000000e+000; m[12126] = 1.880606e-024; m[-12126] = 1.880606e-024; m[12212] = 1.880606e-024; m[-12212] = 1.880606e-024; m[12214] = 2.194041e-024; m[-12214] = 2.194041e-024; m[12216] = 5.063171e-024; m[-12216] = 5.063171e-024; m[12218] = 0.000000e+000; m[-12218] = 0.000000e+000; m[12222] = 0.000000e+000; m[-12222] = 0.000000e+000; m[12224] = 2.194041e-024; m[-12224] = 2.194041e-024; m[12226] = 1.880606e-024; m[-12226] = 1.880606e-024; m[13112] = 6.582122e-024; m[-13112] = 6.582122e-024; m[13114] = 1.097020e-023; m[-13114] = 1.097020e-023; m[13116] = 5.485102e-024; m[-13116] = 5.485102e-024; m[13122] = 1.316424e-023; m[-13122] = 1.316424e-023; m[13124] = 1.097020e-023; m[-13124] = 1.097020e-023; m[13126] = 6.928549e-024; m[-13126] = 6.928549e-024; m[13212] = 6.582122e-024; m[-13212] = 6.582122e-024; m[13214] = 1.097020e-023; m[-13214] = 1.097020e-023; m[13216] = 5.485102e-024; m[-13216] = 5.485102e-024; m[13222] = 6.582122e-024; m[-13222] = 6.582122e-024; m[13224] = 1.097020e-023; m[-13224] = 1.097020e-023; m[13226] = 5.485102e-024; m[-13226] = 5.485102e-024; m[13314] = 2.742551e-023; m[-13314] = 2.742551e-023; m[13316] = 0.000000e+000; m[-13316] = 0.000000e+000; m[13324] = 2.742551e-023; m[-13324] = 2.742551e-023; m[13326] = 0.000000e+000; m[-13326] = 0.000000e+000; m[14122] = 1.828367e-022; m[-14122] = 1.828367e-022; m[14124] = 0.000000e+000; m[-14124] = 0.000000e+000; m[10221] = 2.194040e-024; m[20223] = 2.742551e-023; m[20315] = 2.384827e-024; m[-20315] = 2.384827e-024; m[20325] = 2.384827e-024; m[-20325] = 2.384827e-024; m[20333] = 1.185968e-023; m[20543] = 0.000000e+000; m[-20543] = 0.000000e+000; m[20553] = 1.000000e+016; m[20555] = 0.000000e+000; m[21112] = 2.632849e-024; m[-21112] = 2.632849e-024; m[21114] = 3.291061e-024; m[-21114] = 3.291061e-024; m[21212] = 2.632849e-024; m[-21212] = 2.632849e-024; m[21214] = 6.582122e-024; m[-21214] = 6.582122e-024; m[22112] = 4.388081e-024; m[-22112] = 4.388081e-024; m[22114] = 3.291061e-024; m[-22114] = 3.291061e-024; m[22122] = 2.632849e-024; m[-22122] = 2.632849e-024; m[22124] = 6.582122e-024; m[-22124] = 6.582122e-024; m[22212] = 4.388081e-024; m[-22212] = 4.388081e-024; m[22214] = 3.291061e-024; m[-22214] = 3.291061e-024; m[22222] = 2.632849e-024; m[-22222] = 2.632849e-024; m[22224] = 3.291061e-024; m[-22224] = 3.291061e-024; m[23112] = 7.313469e-024; m[-23112] = 7.313469e-024; m[23114] = 2.991874e-024; m[-23114] = 2.991874e-024; m[23122] = 4.388081e-024; m[-23122] = 4.388081e-024; m[23124] = 6.582122e-024; m[-23124] = 6.582122e-024; m[23126] = 3.291061e-024; m[-23126] = 3.291061e-024; m[23212] = 7.313469e-024; m[-23212] = 7.313469e-024; m[23214] = 2.991874e-024; m[-23214] = 2.991874e-024; m[23222] = 7.313469e-024; m[-23222] = 7.313469e-024; m[23224] = 2.991874e-024; m[-23224] = 2.991874e-024; m[23314] = 0.000000e+000; m[-23314] = 0.000000e+000; m[23324] = 0.000000e+000; m[-23324] = 0.000000e+000; m[30113] = 2.742551e-024; m[30213] = 2.742551e-024; m[-30213] = 2.742551e-024; m[30223] = 2.991874e-024; m[30313] = 2.056913e-024; m[-30313] = 2.056913e-024; m[30323] = 2.056913e-024; m[-30323] = 2.056913e-024; m[30343] = 0.000000e+000; m[-30343] = 0.000000e+000; m[30353] = 0.000000e+000; m[-30353] = 0.000000e+000; m[30363] = 0.000000e+000; m[-30363] = 0.000000e+000; m[30411] = 0.000000e+000; m[-30411] = 0.000000e+000; m[30413] = 0.000000e+000; m[-30413] = 0.000000e+000; m[30421] = 0.000000e+000; m[-30421] = 0.000000e+000; m[30423] = 0.000000e+000; m[-30423] = 0.000000e+000; m[30443] = 2.789035e-023; m[30553] = 0.000000e+000; m[31114] = 1.880606e-024; m[-31114] = 1.880606e-024; m[31214] = 4.388081e-024; m[-31214] = 4.388081e-024; m[32112] = 4.388081e-024; m[-32112] = 4.388081e-024; m[32114] = 1.880606e-024; m[-32114] = 1.880606e-024; m[32124] = 4.388081e-024; m[-32124] = 4.388081e-024; m[32212] = 4.388081e-024; m[-32212] = 4.388081e-024; m[32214] = 1.880606e-024; m[-32214] = 1.880606e-024; m[32224] = 1.880606e-024; m[-32224] = 1.880606e-024; m[33122] = 1.880606e-023; m[-33122] = 1.880606e-023; m[33314] = 0.000000e+000; m[-33314] = 0.000000e+000; m[33324] = 0.000000e+000; m[-33324] = 0.000000e+000; m[41214] = 0.000000e+000; m[-41214] = 0.000000e+000; m[42112] = 6.582122e-024; m[-42112] = 6.582122e-024; m[42124] = 0.000000e+000; m[-42124] = 0.000000e+000; m[42212] = 6.582122e-024; m[-42212] = 6.582122e-024; m[43122] = 2.194041e-024; m[-43122] = 2.194041e-024; m[52114] = 0.000000e+000; m[-52114] = 0.000000e+000; m[52214] = 0.000000e+000; m[-52214] = 0.000000e+000; m[53122] = 4.388081e-024; m[-53122] = 4.388081e-024; m[100111] = 1.645531e-024; m[100113] = 2.123265e-024; m[100211] = 1.645531e-024; m[-100211] = 1.645531e-024; m[100213] = 2.123265e-024; m[-100213] = 2.123265e-024; m[100221] = 1.196749e-023; m[100223] = 3.871836e-024; m[100225] = 0.000000e+000; m[100311] = 0.000000e+000; m[-100311] = 0.000000e+000; m[100313] = 2.837122e-024; m[-100313] = 2.837122e-024; m[100315] = 0.000000e+000; m[-100315] = 0.000000e+000; m[100321] = 0.000000e+000; m[-100321] = 0.000000e+000; m[100323] = 2.837122e-024; m[-100323] = 2.837122e-024; m[100325] = 0.000000e+000; m[-100325] = 0.000000e+000; m[100331] = 0.000000e+000; m[100333] = 4.388081e-024; m[100335] = 3.291061e-024; m[100441] = 0.000000e+000; m[100551] = 0.000000e+000; m[100553] = 1.495937e-020; m[100555] = 1.000000e+016; m[100557] = 0.000000e+000; m[110551] = 1.000000e+016; m[110553] = 0.000000e+000; m[110555] = 0.000000e+000; m[120553] = 1.000000e+016; m[120555] = 0.000000e+000; m[130553] = 0.000000e+000; m[200111] = 3.134344e-024; m[200211] = 3.134344e-024; m[-200211] = 3.134344e-024; m[200551] = 0.000000e+000; m[200553] = 2.502708e-020; m[200555] = 0.000000e+000; m[210551] = 0.000000e+000; m[210553] = 0.000000e+000; m[220553] = 0.000000e+000; m[300553] = 4.701516e-023; m[9000221] = 0.000000e+000; m[9000443] = 1.265793e-023; m[9000553] = 5.983747e-024; m[9010443] = 8.438618e-024; m[9010553] = 8.331800e-024; m[9020221] = 6.038644e-024; m[9020443] = 1.530726e-023; m[9060225] = 4.388081e-024; m[9070225] = 2.056913e-024; m[1000001] = 0.000000e+000; m[-1000001] = 0.000000e+000; m[1000002] = 0.000000e+000; m[-1000002] = 0.000000e+000; m[1000003] = 0.000000e+000; m[-1000003] = 0.000000e+000; m[1000004] = 0.000000e+000; m[-1000004] = 0.000000e+000; m[1000005] = 0.000000e+000; m[-1000005] = 0.000000e+000; m[1000006] = 0.000000e+000; m[-1000006] = 0.000000e+000; m[1000011] = 0.000000e+000; m[-1000011] = 0.000000e+000; m[1000012] = 0.000000e+000; m[-1000012] = 0.000000e+000; m[1000013] = 0.000000e+000; m[-1000013] = 0.000000e+000; m[1000014] = 0.000000e+000; m[-1000014] = 0.000000e+000; m[1000015] = 0.000000e+000; m[-1000015] = 0.000000e+000; m[1000016] = 0.000000e+000; m[-1000016] = 0.000000e+000; m[1000021] = 0.000000e+000; m[1000022] = 0.000000e+000; m[1000023] = 0.000000e+000; m[1000024] = 0.000000e+000; m[-1000024] = 0.000000e+000; m[1000025] = 0.000000e+000; m[1000035] = 0.000000e+000; m[1000037] = 0.000000e+000; m[-1000037] = 0.000000e+000; m[1000039] = 0.000000e+000; m[2000001] = 0.000000e+000; m[-2000001] = 0.000000e+000; m[2000002] = 0.000000e+000; m[-2000002] = 0.000000e+000; m[2000003] = 0.000000e+000; m[-2000003] = 0.000000e+000; m[2000004] = 0.000000e+000; m[-2000004] = 0.000000e+000; m[2000005] = 0.000000e+000; m[-2000005] = 0.000000e+000; m[2000006] = 0.000000e+000; m[-2000006] = 0.000000e+000; m[2000011] = 0.000000e+000; m[-2000011] = 0.000000e+000; m[2000012] = 0.000000e+000; m[-2000012] = 0.000000e+000; m[2000013] = 0.000000e+000; m[-2000013] = 0.000000e+000; m[2000014] = 0.000000e+000; m[-2000014] = 0.000000e+000; m[2000015] = 0.000000e+000; m[-2000015] = 0.000000e+000; m[2000016] = 0.000000e+000; m[-2000016] = 0.000000e+000; m[3000111] = 0.000000e+000; m[3000113] = 0.000000e+000; m[3000211] = 0.000000e+000; m[-3000211] = 0.000000e+000; m[3000213] = 0.000000e+000; m[-3000213] = 0.000000e+000; m[3000221] = 0.000000e+000; m[3000223] = 0.000000e+000; m[3000331] = 0.000000e+000; m[3100021] = 0.000000e+000; m[3100111] = 0.000000e+000; m[3100113] = 0.000000e+000; m[3200111] = 0.000000e+000; m[3200113] = 0.000000e+000; m[3300113] = 0.000000e+000; m[3400113] = 0.000000e+000; m[4000001] = 0.000000e+000; m[-4000001] = 0.000000e+000; m[4000002] = 0.000000e+000; m[-4000002] = 0.000000e+000; m[4000011] = 0.000000e+000; m[-4000011] = 0.000000e+000; m[4000012] = 0.000000e+000; m[-4000012] = 0.000000e+000; m[5000039] = 0.000000e+000; m[9900012] = 0.000000e+000; m[9900014] = 0.000000e+000; m[9900016] = 0.000000e+000; m[9900023] = 0.000000e+000; m[9900024] = 0.000000e+000; m[-9900024] = 0.000000e+000; m[9900041] = 0.000000e+000; m[-9900041] = 0.000000e+000; m[9900042] = 0.000000e+000; m[-9900042] = 0.000000e+000; m[1027013000] = 0.000000e+000; m[1012006000] = 0.000000e+000; m[1063029000] = 0.000000e+000; m[1014007000] = 0.000000e+000; m[1016008000] = 0.000000e+000; m[1028014000] = 0.000000e+000; m[1065029000] = 0.000000e+000; m[1009004000] = 0.000000e+000; m[1019009000] = 0.000000e+000; m[1056026000] = 0.000000e+000; m[1207082000] = 0.000000e+000; m[1208082000] = 0.000000e+000; m[1029014000] = 0.000000e+000; m[1206082000] = 0.000000e+000; m[1054026000] = 0.000000e+000; m[1018008000] = 0.000000e+000; m[1030014000] = 0.000000e+000; m[1057026000] = 0.000000e+000; m[1204082000] = 0.000000e+000; m[-99000000] = 0.000000e+000; m[1028013000] = 0.000000e+000; m[1040018000] = 0.000000e+000; m[1011005000] = 0.000000e+000; m[1012005000] = 0.000000e+000; m[1013006000] = 0.000000e+000; m[1014006000] = 0.000000e+000; m[1052024000] = 0.000000e+000; m[1024012000] = 0.000000e+000; m[1026012000] = 0.000000e+000; m[1027012000] = 0.000000e+000; m[1015007000] = 0.000000e+000; m[1022010000] = 0.000000e+000; m[1058028000] = 0.000000e+000; m[1060028000] = 0.000000e+000; m[1062028000] = 0.000000e+000; m[1064028000] = 0.000000e+000; m[1007003000] = 0.000000e+000; m[1025012000] = 0.000000e+000; m[1053024000] = 0.000000e+000; m[1055025000] = 0.000000e+000; m[1008004000] = 0.000000e+000; m[1010004000] = 0.000000e+000; m[1010005000] = 0.000000e+000; m[1016007000] = 0.000000e+000; m[1017008000] = 0.000000e+000; m[1019008000] = 0.000000e+000; m[1023010000] = 0.000000e+000; m[1024011000] = 0.000000e+000; m[1031015000] = 0.000000e+000; m[1039017000] = 0.000000e+000; m[1040017000] = 0.000000e+000; m[1036018000] = 0.000000e+000; m[1050024000] = 0.000000e+000; m[1054024000] = 0.000000e+000; m[1059026000] = 0.000000e+000; m[1061028000] = 0.000000e+000; m[1063028000] = 0.000000e+000; m[1092042000] = 0.000000e+000; m[1095042000] = 0.000000e+000; m[1096042000] = 0.000000e+000; m[1097042000] = 0.000000e+000; m[1098042000] = 0.000000e+000; m[1100042000] = 0.000000e+000; m[1108046000] = 0.000000e+000; // Added by hand: m[9902210] = 0.000000e+000; //diffractive p-state -> assume no lifetime return true; } private: /// @name Histograms //@{ Histo1DPtr _h_mult_total; // full kinematic range Histo1DPtr _h_mult_eta[5]; // in eta bins Histo1DPtr _h_mult_pt[5]; // in pT bins Histo1DPtr _h_dndeta; // density dn/deta Histo1DPtr _h_dndpt; // density dn/dpT //@} /// @name Private variables double _p_min; double _pt_min; double _eta_min; double _eta_max; double _maxlft; /// Count selected events double _sumW; map _partLftMap; // Map }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(LHCB_2014_I1281685); } diff --git a/src/Analyses/MC_IDENTIFIED.cc b/src/Analyses/MC_IDENTIFIED.cc --- a/src/Analyses/MC_IDENTIFIED.cc +++ b/src/Analyses/MC_IDENTIFIED.cc @@ -1,104 +1,104 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableFinalState.hh" namespace Rivet { /// Generic analysis looking at various distributions of final state particles /// @todo Rename as MC_HADRONS class MC_IDENTIFIED : public Analysis { public: /// Constructor MC_IDENTIFIED() : Analysis("MC_IDENTIFIED") { } public: /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Projections const FinalState cnfs(Cuts::abseta < 5.0 && Cuts::pT > 500*MeV); declare(cnfs, "FS"); declare(UnstableFinalState(Cuts::abseta < 5.0 && Cuts::pT > 500*MeV), "UFS"); // Histograms // @todo Choose E/pT ranged based on input energies... can't do anything about kin. cuts, though _histStablePIDs = bookHisto1D("MultsStablePIDs", 3335, -0.5, 3334.5); _histDecayedPIDs = bookHisto1D("MultsDecayedPIDs", 3335, -0.5, 3334.5); _histAllPIDs = bookHisto1D("MultsAllPIDs", 3335, -0.5, 3334.5); _histEtaPi = bookHisto1D("EtaPi", 25, 0, 5); _histEtaK = bookHisto1D("EtaK", 25, 0, 5); _histEtaLambda = bookHisto1D("EtaLambda", 25, 0, 5); } /// Perform the per-event analysis void analyze(const Event& event) { const double weight = event.weight(); // Unphysical (debug) plotting of all PIDs in the event, physical or otherwise - foreach (const GenParticle* gp, particles(event.genEvent())) { + foreach (const GenParticlePtr gp, particles(event.genEvent())) { _histAllPIDs->fill(abs(gp->pdg_id()), weight); } // Charged + neutral final state PIDs const FinalState& cnfs = apply(event, "FS"); foreach (const Particle& p, cnfs.particles()) { _histStablePIDs->fill(p.abspid(), weight); } // Unstable PIDs and identified particle eta spectra const UnstableFinalState& ufs = apply(event, "UFS"); foreach (const Particle& p, ufs.particles()) { _histDecayedPIDs->fill(p.pid(), weight); const double eta_abs = p.abseta(); const PdgId pid = p.abspid(); //if (PID::isMeson(pid) && PID::hasStrange()) { if (pid == 211 || pid == 111) _histEtaPi->fill(eta_abs, weight); else if (pid == 321 || pid == 130 || pid == 310) _histEtaK->fill(eta_abs, weight); else if (pid == 3122) _histEtaLambda->fill(eta_abs, weight); } } /// Finalize void finalize() { scale(_histStablePIDs, 1/sumOfWeights()); scale(_histDecayedPIDs, 1/sumOfWeights()); scale(_histAllPIDs, 1/sumOfWeights()); scale(_histEtaPi, 1/sumOfWeights()); scale(_histEtaK, 1/sumOfWeights()); scale(_histEtaLambda, 1/sumOfWeights()); } //@} private: /// @name Histograms //@{ Histo1DPtr _histStablePIDs, _histDecayedPIDs, _histAllPIDs; Histo1DPtr _histEtaPi, _histEtaK, _histEtaLambda; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MC_IDENTIFIED); } diff --git a/src/Analyses/SLD_2002_S4869273.cc b/src/Analyses/SLD_2002_S4869273.cc --- a/src/Analyses/SLD_2002_S4869273.cc +++ b/src/Analyses/SLD_2002_S4869273.cc @@ -1,107 +1,107 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/ChargedFinalState.hh" /// @todo Use inline PID functions instead #define IS_PARTON_PDGID(id) ( abs(id) <= 100 && abs(id) != 22 && (abs(id) < 11 || abs(id) > 18) ) #define IS_BHADRON_PDGID(id) ( ((abs(id)/100)%10 == 5) || (abs(id) >= 5000 && abs(id) <= 5999) ) namespace Rivet { /// @brief SLD b-fragmentation measurement /// @author Peter Richardson class SLD_2002_S4869273 : public Analysis { public: /// Constructor SLD_2002_S4869273() : Analysis("SLD_2002_S4869273") { } /// @name Analysis methods //@{ /// Book projections and histograms void init() { declare(Beam(), "Beams"); declare(ChargedFinalState(), "FS"); _histXbweak = bookHisto1D(1, 1, 1); } void analyze(const Event& e) { const FinalState& fs = apply(e, "FS"); const size_t numParticles = fs.particles().size(); // Even if we only generate hadronic events, we still need a cut on numCharged >= 2. if (numParticles < 2) { MSG_DEBUG("Failed ncharged cut"); vetoEvent; } MSG_DEBUG("Passed ncharged cut"); // Get event weight for histo filling const double weight = e.weight(); // Get beams and average beam momentum const ParticlePair& beams = apply(e, "Beams").beams(); const double meanBeamMom = ( beams.first.p3().mod() + beams.second.p3().mod() ) / 2.0; MSG_DEBUG("Avg beam momentum = " << meanBeamMom); - foreach (const GenParticle* p, particles(e.genEvent())) { - const GenVertex* dv = p->end_vertex(); + foreach (const GenParticlePtr p, particles(e.genEvent())) { + const GenVertexPtr dv = p->end_vertex(); if (IS_BHADRON_PDGID(p->pdg_id())) { const double xp = p->momentum().e()/meanBeamMom; // If the B-hadron has no B-hadron as a child, it decayed weakly: if (dv) { bool is_weak = true; for (GenVertex::particles_out_const_iterator pp = dv->particles_out_const_begin() ; pp != dv->particles_out_const_end() ; ++pp) { if (IS_BHADRON_PDGID((*pp)->pdg_id())) { is_weak = false; } } if (is_weak) { _histXbweak->fill(xp, weight); } } } } } // Finalize void finalize() { normalize(_histXbweak); } private: /// Store the weighted sums of numbers of charged / charged+neutral /// particles - used to calculate average number of particles for the /// inclusive single particle distributions' normalisations. Histo1DPtr _histXbweak; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SLD_2002_S4869273); }