diff --git a/analyses/pluginBELLE/BELLE_2008_I764099.cc b/analyses/pluginBELLE/BELLE_2008_I764099.cc --- a/analyses/pluginBELLE/BELLE_2008_I764099.cc +++ b/analyses/pluginBELLE/BELLE_2008_I764099.cc @@ -1,140 +1,140 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class BELLE_2008_I764099 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(BELLE_2008_I764099); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); book(_nUps1pipi, "TMP/nUps1pipi"); book(_nUps2pipi, "TMP/nUps2pipi"); book(_nUps3pipi, "TMP/nUps3pipi"); book(_nUps1KK, "TMP/nUps1KK"); } void findChildren(const Particle & p,map & nRes, int &ncount) { for (const Particle &child : p.children()) { if(child.children().empty()) { --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); for (const Particle& p : fs.particles()) { nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; if(p.pid() != 553 && p.pid() != 100553 && p.pid() != 200553 ) continue; map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==321 || abs(val.first)==211) { continue; } else if(val.second!=0) { matched = false; break; } } if(matched) { if(nRes[211]==1 && nRes[-211]==1 ) { if(p.pid()==553) _nUps1pipi->fill(); if(p.pid()==100553) _nUps2pipi->fill(); if(p.pid()==200553) _nUps3pipi->fill(); } else if(nRes[321]==1 && nRes[-321]==1) { if(p.pid()==553) _nUps1KK->fill(); } } } } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /picobarn; for(unsigned int ix=1;ix<5;++ix) { - double sigma,error; + double sigma = 0.0, error = 0.0; if(ix==1) { sigma = _nUps1pipi->val()*fact; error = _nUps1pipi->err()*fact; } else if(ix==2) { sigma = _nUps2pipi->val()*fact; error = _nUps2pipi->err()*fact; } else if(ix==3) { sigma = _nUps3pipi->val()*fact; error = _nUps3pipi->err()*fact; } else if(ix==4) { sigma = _nUps1KK->val()*fact; error = _nUps1KK->err()*fact; } Scatter2D temphisto(refData(ix, 1, 1)); Scatter2DPtr mult; book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nUps1pipi,_nUps2pipi,_nUps3pipi,_nUps1KK; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BELLE_2008_I764099); } diff --git a/analyses/pluginBELLE/BELLE_2017_I1613517.cc b/analyses/pluginBELLE/BELLE_2017_I1613517.cc --- a/analyses/pluginBELLE/BELLE_2017_I1613517.cc +++ b/analyses/pluginBELLE/BELLE_2017_I1613517.cc @@ -1,168 +1,168 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class BELLE_2017_I1613517 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(BELLE_2017_I1613517); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); // Book histograms book(_c_DpDmS, "/TMP/sigma_DpDmS"); book(_c_DpSDmS, "/TMP/sigma_DpSDmS"); } void findChildren(const Particle & p,map & nRes, int &ncount) { for(const Particle &child : p.children()) { if(child.children().empty()) { nRes[child.pid()]-=1; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); // total hadronic and muonic cross sections map nCount; int ntotal(0); for (const Particle& p : fs.particles()) { nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) vetoEvent; // unstable charm analysis const FinalState& ufs = apply(event, "UFS"); for(unsigned int ix=0;ix nRes = nCount; int ncount = ntotal; findChildren(p1,nRes,ncount); bool matched=false; int sign = p1.pid()/id1; // loop over the other fs particles for(unsigned int iy=ix+1;iy nRes2 = nRes; int ncount2 = ncount; findChildren(p2,nRes2,ncount2); if(ncount2!=0) continue; matched=true; for(auto const & val : nRes2) { if(val.second!=0) { matched = false; break; } } if(matched) { if(id1==413 && id2==413) { _c_DpSDmS->fill(); } else if((id1==411 && id2==413) || (id1==413 && id2==411)) { _c_DpDmS->fill(); } break; } } if(matched) break; } } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights()/nanobarn; for(unsigned int iy=1;iy<3;++iy) { - double sigma,error; + double sigma = 0.0, error = 0.0; if(iy==1) { sigma = _c_DpDmS->val()*fact; error = _c_DpDmS->err()*fact; } else if(iy==2) { sigma = _c_DpSDmS->val()*fact; error = _c_DpSDmS->err()*fact; } Scatter2D temphisto(refData(1, 1, iy)); Scatter2DPtr mult; book(mult, 1, 1, iy); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _c_DpDmS, _c_DpSDmS; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BELLE_2017_I1613517); } diff --git a/analyses/pluginCESR/CLEO_1999_I474676.cc b/analyses/pluginCESR/CLEO_1999_I474676.cc --- a/analyses/pluginCESR/CLEO_1999_I474676.cc +++ b/analyses/pluginCESR/CLEO_1999_I474676.cc @@ -1,125 +1,125 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CLEO_1999_I474676 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CLEO_1999_I474676); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); book(_nUps2pipi, "TMP/nUps2pipi"); book(_nUps3pipi, "TMP/nUps3pipi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { for (const Particle &child : p.children()) { if(child.children().empty()) { --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); for (const Particle& p : fs.particles()) { nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; if(p.pid() != 100553 && p.pid() != 200553 ) continue; map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second!=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) { if(p.pid()==100553) _nUps2pipi->fill(); if(p.pid()==200553) _nUps3pipi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /picobarn; for(unsigned int ix=1;ix<3;++ix) { - double sigma,error; + double sigma = 0.0,error = 0.0; if(ix==1) { sigma = _nUps3pipi->val()*fact; error = _nUps3pipi->err()*fact; } else if(ix==2) { sigma = _nUps2pipi->val()*fact; error = _nUps2pipi->err()*fact; } Scatter2D temphisto(refData(1, 1, ix)); Scatter2DPtr mult; book(mult, 1, 1, ix); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nUps2pipi,_nUps3pipi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CLEO_1999_I474676); } diff --git a/analyses/pluginFrascati/GAMMAGAMMA_1981_I158474.cc b/analyses/pluginFrascati/GAMMAGAMMA_1981_I158474.cc --- a/analyses/pluginFrascati/GAMMAGAMMA_1981_I158474.cc +++ b/analyses/pluginFrascati/GAMMAGAMMA_1981_I158474.cc @@ -1,180 +1,180 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class GAMMAGAMMA_1981_I158474 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(GAMMAGAMMA_1981_I158474); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); book(_n3pi, "TMP/n3pi"); book(_n4pi, "TMP/n4pi"); book(_n5pi, "TMP/n5pi"); book(_n6pi, "TMP/n6pi"); book(_n35pi, "TMP/n35pi"); book(_n46pi, "TMP/n46pi"); book(_nC2, "TMP/nC2"); book(_nC4, "TMP/nC4"); book(_nmu, "TMP/nmu"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); for (const Particle& p : fs.particles()) { nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) _nmu->fill(); else { if(ntotal==3 && nCount[211] == 1 && nCount[-211]==1 && nCount[111]==1 ) { _n3pi->fill(); } if(ntotal==4 && nCount[211] == 1 && nCount[-211]==1 && nCount[111]==2 ) { _n4pi->fill(); } if(ntotal==5 && nCount[211] == 2 && nCount[-211]==2 && nCount[111]==1 ) { _n5pi->fill(); } if(ntotal==6 && nCount[211] == 2 && nCount[-211]==2 && nCount[111]==2 ) { _n6pi->fill(); } if(nCount[211] == 1 && nCount[-211]==1 && ntotal == 2+nCount[111]) { _nC2->fill(); } if(nCount[211] == 2 && nCount[-211]==2 && ntotal == 4+nCount[111]) { _nC4->fill(); } if((nCount[211]+nCount[-211]+nCount[111])==ntotal ) { if(ntotal==3 || ntotal ==5) _n35pi->fill(); else if(ntotal==4 || ntotal==6) _n46pi ->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /nanobarn; for(unsigned int ix=1;ix<7;++ix) { - double sigma,error; + double sigma = 0.0, error = 0.0; if(ix==1) { sigma = _n3pi->val()*fact; error = _n3pi->err()*fact; } else if(ix==2) { sigma = _n4pi->val()*fact; error = _n4pi->err()*fact; } else if(ix==3) { sigma = _n5pi->val()*fact; error = _n5pi->err()*fact; } else if(ix==4) { sigma = _n6pi->val()*fact; error = _n6pi->err()*fact; } else if(ix==5) { sigma = _n35pi->val()*fact; error = _n35pi->err()*fact; } else if(ix==6) { sigma = _n46pi->val()*fact; error = _n46pi->err()*fact; } Scatter2D temphisto(refData(1, 1, ix)); Scatter2DPtr mult; book(mult, 1, 1, ix); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } for(unsigned int ix=1;ix<3;++ix) { Scatter1D R = (ix==1? *_nC2 : *_nC4)/ *_nmu; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double sig_h = (ix ==1 ? _nC2 : _nC4)->val()*fact; double err_h = (ix ==1 ? _nC2 : _nC4)->err()*fact; double sig_m = _nmu->val()*fact; double err_m = _nmu->err()*fact; Scatter2D temphisto(refData(2, 1, ix)); std::ostringstream title; if(ix==1) title << "sigma_2pi"; else title << "sigma_4pi"; Scatter2DPtr hadrons; book(hadrons, title.str()); Scatter2DPtr muons; book(muons, "sigma_muons"); Scatter2DPtr mult; book(mult, 2,1,ix); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); if(ix==1) muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); if(ix==1) muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _n3pi,_n4pi,_n5pi,_n6pi,_n35pi,_n46pi,_nC2,_nC4,_nmu; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(GAMMAGAMMA_1981_I158474); } diff --git a/analyses/pluginMC/MC_DIS_Check.cc b/analyses/pluginMC/MC_DIS_Check.cc --- a/analyses/pluginMC/MC_DIS_Check.cc +++ b/analyses/pluginMC/MC_DIS_Check.cc @@ -1,82 +1,81 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/FastJets.hh" #include "Rivet/Projections/DISKinematics.hh" namespace Rivet { /// @brief A simple analysis to illustrate how to use the /// DISKinematics projection together with different options. class MC_DIS_Check : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MC_DIS_Check); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections. Note that the definition // of the scattered lepton can be influenced by sepcifying // options as declared in the .info file. DISLepton lepton(options()); declare(lepton, "Lepton"); declare(DISKinematics(lepton), "Kinematics"); // Book histograms - _hist_Q2 = bookHisto1D("Q2",logspace(100,0.1, 1000.0)); - _hist_y = bookHisto1D("y",100,0.,1.); - _hist_x = bookHisto1D("xBj",logspace(100,0.00001, 1.0)); + book(_hist_Q2, "Q2",logspace(100,0.1, 1000.0)); + book(_hist_y, "y",100,0.,1.); + book(_hist_x, "xBj",logspace(100,0.00001, 1.0)); } /// Perform the per-event analysis void analyze(const Event& event) { // Get the DIS kinematics const DISKinematics& dk = apply(event, "Kinematics"); if ( dk.failed() ) return; double x = dk.x(); double y = dk.y(); double Q2 = dk.Q2(); // Weight of the event - const double weight = event.weight(); - _hist_Q2->fill(Q2,weight); - _hist_y->fill(y,weight); - _hist_x->fill(x,weight); + _hist_Q2->fill(Q2); + _hist_y->fill(y); + _hist_x->fill(x); /// @todo Do the event by event analysis here } /// Normalise histograms etc., after the run void finalize() { normalize(_hist_Q2); // normalize to unity normalize(_hist_y); // normalize to unity } //@} /// The histograms. Histo1DPtr _hist_Q2, _hist_y, _hist_x; }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MC_DIS_Check); } diff --git a/analyses/pluginMC/MC_Eta_Decay.cc b/analyses/pluginMC/MC_Eta_Decay.cc --- a/analyses/pluginMC/MC_Eta_Decay.cc +++ b/analyses/pluginMC/MC_Eta_Decay.cc @@ -1,247 +1,258 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class MC_Eta_Decay : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MC_Eta_Decay); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(UnstableParticles(), "UFS"); // Book histograms double meta[2]={547.45, 957.78}; for(unsigned int ix=0;ix<2;++ix) { std::ostringstream title; title << "_" << ix; - _mgammagamma .push_back(bookHisto1D("mgammagamma" +title.str(),200,0.,meta[ix]) ); - _mpi0gamma .push_back(bookHisto1D("mpi0gamma" +title.str(),200,0.,meta[ix])) ; - _mpipgamma .push_back(bookHisto1D("mpipgamma" +title.str(),200,0.,meta[ix])); - _mpimgamma .push_back(bookHisto1D("mpimgamma" +title.str(),200,0.,meta[ix])); - _photonenergy.push_back(bookHisto1D("photonenergy"+title.str(),200,0.,meta[ix])); - _mpippim .push_back(bookHisto1D("mpippim" +title.str(),200,0.,meta[ix])); - _dpippim .push_back(bookHisto1D("dpippim" +title.str(),200,200.,meta[ix])); - _dpi0pi0 .push_back(bookHisto1D("dpi0pi0" +title.str(),200,200.,meta[ix])); - _dpi0pip .push_back(bookHisto1D("dpi0pip" +title.str(),200,200.,meta[ix])); - _dpi0pim .push_back(bookHisto1D("dpi0pim" +title.str(),200,200.,meta[ix])); + _mgammagamma.push_back(Histo1DPtr()); + book(_mgammagamma.back(), "mgammagamma" +title.str(),200,0.,meta[ix]); + _mpi0gamma.push_back(Histo1DPtr()); + book(_mpi0gamma.back(), "mpi0gamma" +title.str(),200,0.,meta[ix]); + _mpipgamma.push_back(Histo1DPtr()); + book(_mpipgamma.back(), "mpipgamma" +title.str(),200,0.,meta[ix]); + _mpimgamma.push_back(Histo1DPtr()); + book(_mpimgamma.back(), "mpimgamma" +title.str(),200,0.,meta[ix]); + _photonenergy.push_back(Histo1DPtr()); + book(_photonenergy.back(), "photonenergy"+title.str(),200,0.,meta[ix]); + _mpippim.push_back(Histo1DPtr()); + book(_mpippim.back(), "mpippim" +title.str(),200,0.,meta[ix]); + _dpippim.push_back(Histo1DPtr()); + book(_dpippim.back(), "dpippim" +title.str(),200,200.,meta[ix]); + _dpi0pi0.push_back(Histo1DPtr()); + book(_dpi0pi0.back(), "dpi0pi0" +title.str(),200,200.,meta[ix]); + _dpi0pip.push_back(Histo1DPtr()); + book(_dpi0pip.back(), "dpi0pip" +title.str(),200,200.,meta[ix]); + _dpi0pim.push_back(Histo1DPtr()); + book(_dpi0pim.back(), "dpi0pim" +title.str(),200,200.,meta[ix]); } - _dpi0pi0.push_back(bookHisto1D("dpi0pi0_2",200,200.,500. )); - _dpippim.push_back(bookHisto1D("dpippim_2",200,200.,500. )); - _dpipeta=bookHisto1D("dpipeta",200,500.,meta[1]) ; - _dpimeta=bookHisto1D("dpimeta",200,500.,meta[1]) ; - _dpi0eta=bookHisto1D("dpi0eta",200,500.,meta[1]) ; + _dpi0pi0.push_back(Histo1DPtr()); + book(_dpi0pi0.back(), "dpi0pi0_2",200,200.,500. ); + _dpippim.push_back(Histo1DPtr()); + book(_dpippim.back(), "dpippim_2",200,200.,500. ); + book(_dpipeta, "dpipeta",200,500.,meta[1]) ; + book(_dpimeta, "dpimeta",200,500.,meta[1]) ; + book(_dpi0eta, "dpi0eta",200,500.,meta[1]) ; } void findDecayProducts(const Particle & mother, unsigned int & nstable, Particles& pip, Particles& pim, Particles& pi0, Particles& eta, Particles& gamma) { for(const Particle & p : mother.children()) { - int id = p.pdgId(); + int id = p.pid(); if ( id == PID::ETA ) { eta.push_back(p); ++nstable; } else if ( id == PID::PHOTON ) { gamma.push_back(p); ++nstable; } else if (id == PID::PIPLUS) { pip.push_back(p); ++nstable; } else if (id == PID::PIMINUS) { pim.push_back(p); ++nstable; } else if (id == PID::PI0 ) { pi0.push_back(p); ++nstable; } else if (id == PID::K0S || id == PID::K0L || id == PID::KPLUS || id == PID::KMINUS) ++nstable; else if ( !p.children().empty() ) { findDecayProducts(p,nstable,pip,pim,pi0,eta,gamma); } else ++nstable; } } /// Perform the per-event analysis void analyze(const Event& event) { - double weight = event.weight(); // Loop over f_1 mesons for(const Particle& meson : apply(event, "UFS"). particles(Cuts::pid==221||Cuts::pid==331)) { unsigned int nstable(0); Particles pip, pim, pi0, eta, gamma; findDecayProducts(meson,nstable,pip, pim, pi0, eta, gamma); - unsigned int imeson = meson.pdgId()==221 ? 0 : 1; + unsigned int imeson = meson.pid()==221 ? 0 : 1; // pi0 gamma gamma if(nstable==3 && pi0.size()==1 && gamma.size()==2) { - _mgammagamma[imeson]->fill((gamma[0].momentum()+gamma[1].momentum()).mass()/MeV,weight); - _mpi0gamma [imeson]->fill(( pi0[0].momentum()+gamma[0].momentum()).mass()/MeV,weight); - _mpi0gamma [imeson]->fill(( pi0[0].momentum()+gamma[1].momentum()).mass()/MeV,weight); + _mgammagamma[imeson]->fill((gamma[0].momentum()+gamma[1].momentum()).mass()/MeV); + _mpi0gamma [imeson]->fill(( pi0[0].momentum()+gamma[0].momentum()).mass()/MeV); + _mpi0gamma [imeson]->fill(( pi0[0].momentum()+gamma[1].momentum()).mass()/MeV); } // pi+pi-gamma analysis else if(nstable==3 && pip.size()==1 && pim.size()==1 && gamma.size()==1) { FourMomentum ptemp = pip[0].momentum()+pim[0].momentum(); double mpipi = ptemp.mass(); - _mpippim[imeson]->fill(mpipi/MeV,weight); + _mpippim[imeson]->fill(mpipi/MeV); double egamma = 0.5*(meson.mass()*meson.mass()-mpipi*mpipi)/meson.mass(); - _photonenergy[imeson]->fill(egamma/MeV,weight); - _mpipgamma[imeson]->fill((pip[0].momentum()+gamma[0].momentum()).mass()/MeV,weight); - _mpimgamma[imeson]->fill((pim[0].momentum()+gamma[0].momentum()).mass()/MeV,weight); + _photonenergy[imeson]->fill(egamma/MeV); + _mpipgamma[imeson]->fill((pip[0].momentum()+gamma[0].momentum()).mass()/MeV); + _mpimgamma[imeson]->fill((pim[0].momentum()+gamma[0].momentum()).mass()/MeV); } else if(nstable==3&& pi0.size()==3) { - _dpi0pi0[imeson]->fill((pi0[0].momentum()+pi0[1].momentum()).mass()/MeV,weight); - _dpi0pi0[imeson]->fill((pi0[0].momentum()+pi0[2].momentum()).mass()/MeV,weight); - _dpi0pi0[imeson]->fill((pi0[1].momentum()+pi0[2].momentum()).mass()/MeV,weight); + _dpi0pi0[imeson]->fill((pi0[0].momentum()+pi0[1].momentum()).mass()/MeV); + _dpi0pi0[imeson]->fill((pi0[0].momentum()+pi0[2].momentum()).mass()/MeV); + _dpi0pi0[imeson]->fill((pi0[1].momentum()+pi0[2].momentum()).mass()/MeV); } else if(nstable==3&& pip.size()==1&&pim.size()==1&&pi0.size()==1) { - _dpi0pip[imeson]->fill((pi0[0].momentum()+pip[0].momentum()).mass()/MeV,weight); - _dpi0pim[imeson]->fill((pi0[0].momentum()+pim[0].momentum()).mass()/MeV,weight); - _dpippim[imeson]->fill((pip[0].momentum()+pim[0].momentum()).mass()/MeV,weight); + _dpi0pip[imeson]->fill((pi0[0].momentum()+pip[0].momentum()).mass()/MeV); + _dpi0pim[imeson]->fill((pi0[0].momentum()+pim[0].momentum()).mass()/MeV); + _dpippim[imeson]->fill((pip[0].momentum()+pim[0].momentum()).mass()/MeV); } else if(nstable==3&& pi0.size()==2&&eta.size()==1) { - _dpi0pi0[2]->fill((pi0[0].momentum()+pi0[1].momentum()).mass()/MeV,weight); - _dpi0eta ->fill((pi0[0].momentum()+eta[0].momentum()).mass()/MeV,weight); - _dpi0eta ->fill((pi0[1].momentum()+eta[0].momentum()).mass()/MeV,weight); + _dpi0pi0[2]->fill((pi0[0].momentum()+pi0[1].momentum()).mass()/MeV); + _dpi0eta ->fill((pi0[0].momentum()+eta[0].momentum()).mass()/MeV); + _dpi0eta ->fill((pi0[1].momentum()+eta[0].momentum()).mass()/MeV); } else if(nstable==3&& pip.size()==1&&pim.size()==1&&eta.size()==1) { - _dpippim[2]->fill((pip[0].momentum()+pim[0].momentum()).mass()/MeV,weight); - _dpipeta ->fill((pip[0].momentum()+eta[0].momentum()).mass()/MeV,weight); - _dpimeta ->fill((pim[0].momentum()+eta[0].momentum()).mass()/MeV,weight); + _dpippim[2]->fill((pip[0].momentum()+pim[0].momentum()).mass()/MeV); + _dpipeta ->fill((pip[0].momentum()+eta[0].momentum()).mass()/MeV); + _dpimeta ->fill((pim[0].momentum()+eta[0].momentum()).mass()/MeV); } } } /// Normalise histograms etc., after the run void finalize() { // normalize to unity for(unsigned int ix=0;ix<2;++ix) { normalize(_mgammagamma[ix]); normalize(_mpi0gamma[ix]); normalize(_mpipgamma[ix]); normalize(_mpimgamma[ix]); normalize(_mpippim[ix]); normalize(_photonenergy[ix]); normalize(_dpippim[ix]); normalize(_dpi0pi0[ix]); normalize(_dpi0pip[ix]); normalize(_dpi0pim[ix]); } normalize(_dpi0pi0[2]); normalize(_dpippim[2]); normalize(_dpipeta); normalize(_dpimeta); normalize(_dpi0eta); } //@} /** * Histograms for the decay \f$\eta\to\pi^0\gamma\gamma\f$ */ //@{ /** * Histogram for the mass of \f$\gamma\gamma\f$ */ vector _mgammagamma; /** * Histogrma for the mass of \f$\pi^0\gamma\f$ */ vector _mpi0gamma; //@} /** * Histograms for the decay \f$\eta\to\pi^+\pi^-\gamma\f$ */ //@{ /** * Histogram for the mass of \f$\pi^+\gamma\f$ */ vector _mpipgamma; /** * Histogram for the mass of \f$\pi^-\gamma\f$ */ vector _mpimgamma; /** * Histogram for the mass of \f$\pi^+\pi^-\f$ */ vector _mpippim; /** * Histogram for the photon energy */ vector _photonenergy; //@} /** * Histograms for the decay \f$\eta\pi\pi\pi\f$ and \f$\eta'\to\eta\pi\pi\f$. */ //@{ /** * Histogram for the mass of \f$\pi^+\pi^-\f$ */ vector _dpippim; /** * Histogram for the mass of \f$\pi^0\pi^0\f$ */ vector _dpi0pi0; /** * Histogram for the mass of \f$\pi^0\pi^+\f$ */ vector _dpi0pip; /** * Histogram for the mass of \f$\pi^0\pi^-\f$ */ vector _dpi0pim; /** * Histogram for the mass of \f$\pi^+\eta\f$ */ Histo1DPtr _dpipeta; /** * Histogram for the mass of \f$\pi^-\eta\f$ */ Histo1DPtr _dpimeta; /** * Histogram for the mass of \f$\pi^0\eta\f$ */ Histo1DPtr _dpi0eta; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MC_Eta_Decay); } diff --git a/analyses/pluginMisc/NMD_1974_I745.cc b/analyses/pluginMisc/NMD_1974_I745.cc --- a/analyses/pluginMisc/NMD_1974_I745.cc +++ b/analyses/pluginMisc/NMD_1974_I745.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class NMD_1974_I745 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(NMD_1974_I745); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /nanobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D(1, 1, 1); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 2); + Scatter2DPtr hadrons; + book(hadrons, 1, 1, 1); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 2); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(NMD_1974_I745); } diff --git a/analyses/pluginMisc/PDG_Upsilon_4S_HADRON_MULTIPLICITIES.cc b/analyses/pluginMisc/PDG_Upsilon_4S_HADRON_MULTIPLICITIES.cc --- a/analyses/pluginMisc/PDG_Upsilon_4S_HADRON_MULTIPLICITIES.cc +++ b/analyses/pluginMisc/PDG_Upsilon_4S_HADRON_MULTIPLICITIES.cc @@ -1,120 +1,120 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Tools/Cuts.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class PDG_Upsilon_4S_HADRON_MULTIPLICITIES : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(PDG_Upsilon_4S_HADRON_MULTIPLICITIES); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(UnstableParticles(), "UFS"); for(int ix : _ihistos) - _histos[ix] = bookHisto1D(ix, 1, 1); + book(_histos[ix], ix, 1, 1); + book(_wSum, "/TMP/SumWeights"); } /// Perform the per-event analysis void analyze(const Event& event) { - double weight = event.weight(); for(const Particle& meson : apply(event, "UFS").particles(Cuts::pid==300553)) { - _wSum += weight; + _wSum->fill(); map ncount; findDecayProducts(meson,ncount); - _histos[29]->fill(10.579,double(ncount[411]+ncount[-411])*weight); - _histos[30]->fill(10.579,double(ncount[421]+ncount[-421])*weight); - _histos[31]->fill(10.579,double(ncount[413]+ncount[-413])*weight); - _histos[32]->fill(10.579,double(ncount[423]+ncount[-423])*weight); - _histos[33]->fill(10.579,double(ncount[431]+ncount[-431])*weight); - _histos[34]->fill(10.579,double(ncount[433]+ncount[-433])*weight); - _histos[48]->fill(10.579,double(ncount[443])*weight); - _histos[50]->fill(10.579,double(ncount[100443])*weight); - _histos[51]->fill(10.579,double(ncount[20443])*weight); - _histos[53]->fill(10.579,double(ncount[445])*weight); - _histos[60]->fill(10.579,double(ncount[321]+ncount[-321])*weight); - _histos[61]->fill(10.579,double(ncount[321])*weight); - _histos[62]->fill(10.579,double(ncount[-321])*weight); - _histos[63]->fill(10.579,double(ncount[130]+ncount[310])*weight); - _histos[64]->fill(10.579,double(ncount[323]+ncount[-323])*weight); - _histos[65]->fill(10.579,double(ncount[313]+ncount[-313])*weight); - _histos[87]->fill(10.579,double(ncount[211]+ncount[-211])*weight); - _histos[88]->fill(10.579,double(ncount[111])*weight); - _histos[89]->fill(10.579,double(ncount[221])*weight); - _histos[90]->fill(10.579,double(ncount[113])*weight); - _histos[92]->fill(10.579,double(ncount[333])*weight); - _histos[96]->fill(10.579,double(ncount[4122]+ncount[-4122])*weight); - _histos[104]->fill(10.579,double(ncount[-4222])*weight); - _histos[106]->fill(10.579,double(ncount[-4112])*weight); - _histos[110]->fill(10.579,double(ncount[2212]+ncount[-2212])*weight); - _histos[113]->fill(10.579,double(ncount[3122]+ncount[-3122])*weight); - _histos[116]->fill(10.579,double(ncount[3312]+ncount[-3312])*weight); + _histos[29]->fill(10.579,double(ncount[411]+ncount[-411])); + _histos[30]->fill(10.579,double(ncount[421]+ncount[-421])); + _histos[31]->fill(10.579,double(ncount[413]+ncount[-413])); + _histos[32]->fill(10.579,double(ncount[423]+ncount[-423])); + _histos[33]->fill(10.579,double(ncount[431]+ncount[-431])); + _histos[34]->fill(10.579,double(ncount[433]+ncount[-433])); + _histos[48]->fill(10.579,double(ncount[443])); + _histos[50]->fill(10.579,double(ncount[100443])); + _histos[51]->fill(10.579,double(ncount[20443])); + _histos[53]->fill(10.579,double(ncount[445])); + _histos[60]->fill(10.579,double(ncount[321]+ncount[-321])); + _histos[61]->fill(10.579,double(ncount[321])); + _histos[62]->fill(10.579,double(ncount[-321])); + _histos[63]->fill(10.579,double(ncount[130]+ncount[310])); + _histos[64]->fill(10.579,double(ncount[323]+ncount[-323])); + _histos[65]->fill(10.579,double(ncount[313]+ncount[-313])); + _histos[87]->fill(10.579,double(ncount[211]+ncount[-211])); + _histos[88]->fill(10.579,double(ncount[111])); + _histos[89]->fill(10.579,double(ncount[221])); + _histos[90]->fill(10.579,double(ncount[113])); + _histos[92]->fill(10.579,double(ncount[333])); + _histos[96]->fill(10.579,double(ncount[4122]+ncount[-4122])); + _histos[104]->fill(10.579,double(ncount[-4222])); + _histos[106]->fill(10.579,double(ncount[-4112])); + _histos[110]->fill(10.579,double(ncount[2212]+ncount[-2212])); + _histos[113]->fill(10.579,double(ncount[3122]+ncount[-3122])); + _histos[116]->fill(10.579,double(ncount[3312]+ncount[-3312])); } } void findDecayProducts(const Particle & mother, map & ncount) { for(const Particle & p : mother.children()) { - int id = p.pdgId(); + int id = p.pid(); if(p.children().empty()) { ncount[id] += 1; } else { // check particle is not a child or itself, eg copy or from photon radiation bool isChild(false); for(const Particle & p2 : p.children()) { - if(p2.pdgId()==id) { + if(p2.pid()==id) { isChild = true; break; } } if(!isChild) ncount[id] += 1; findDecayProducts(p,ncount); } } } /// Normalise histograms etc., after the run void finalize() { for(auto hist : _histos) { - scale(hist.second, 1./_wSum); + scale(hist.second, 1./_wSum->sumW()); } } //@} /// @name Histograms //@{ vector _ihistos={29 ,30 ,31 ,32 ,33 ,34 ,48 ,50 ,51 ,53 ,60 ,61 ,62 ,63 , 64 ,65 ,87 ,88 ,89 ,90 ,92 ,96 ,104,106,110,113,116}; map _histos; - double _wSum = 0.; + CounterPtr _wSum; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(PDG_Upsilon_4S_HADRON_MULTIPLICITIES); } diff --git a/analyses/pluginNovosibirsk/CMD2_1995_I406880.cc b/analyses/pluginNovosibirsk/CMD2_1995_I406880.cc --- a/analyses/pluginNovosibirsk/CMD2_1995_I406880.cc +++ b/analyses/pluginNovosibirsk/CMD2_1995_I406880.cc @@ -1,147 +1,148 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_1995_I406880 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_1995_I406880); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _nKpKm = bookCounter("TMP/KpKm"); - _nK0K0 = bookCounter("TMP/K0K0"); - _n3pi = bookCounter("TMP/3pi"); - _numEtaGamma = bookCounter("TMP/EtaGamma"); + book(_nKpKm, "TMP/KpKm"); + book(_nK0K0, "TMP/K0K0"); + book(_n3pi, "TMP/3pi"); + book(_numEtaGamma, "TMP/EtaGamma"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2) { if(nCount[321]==1 && nCount[-321]==1) - _nKpKm->fill(event.weight()); + _nKpKm->fill(); else if(nCount[130]==1 && nCount[310]==1) - _nK0K0->fill(event.weight()); + _nK0K0->fill(); } else if(ntotal==3 && nCount[211] == 1 && nCount[-211] == 1 && nCount[111] == 1) - _n3pi->fill(event.weight()); + _n3pi->fill(); const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(val.first==22) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaGamma->fill(event.weight()); + _numEtaGamma->fill(); } } } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<5;++ix) { double sigma = 0., error = 0.; if(ix==1) { sigma = _nKpKm->val(); error = _nKpKm->err(); } else if(ix==2) { sigma = _nK0K0->val(); error = _nK0K0->err(); } else if(ix==3) { sigma = _n3pi->val(); error = _n3pi->err(); } else if(ix==4) { sigma = _numEtaGamma->val(); error = _numEtaGamma->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, ix)); - Scatter2DPtr mult = bookScatter2D(1, 1, ix); + Scatter2DPtr mult; + book(mult, 1, 1, ix); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nKpKm,_nK0K0,_n3pi,_numEtaGamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_1995_I406880); } diff --git a/analyses/pluginNovosibirsk/CMD2_1998_I480170.cc b/analyses/pluginNovosibirsk/CMD2_1998_I480170.cc --- a/analyses/pluginNovosibirsk/CMD2_1998_I480170.cc +++ b/analyses/pluginNovosibirsk/CMD2_1998_I480170.cc @@ -1,85 +1,86 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_1998_I480170 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_1998_I480170); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _num3pi = bookCounter("TMP/num3"); + book(_num3pi, "TMP/num3"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[-211]==1&&nCount[211]==1&&nCount[111]==1) - _num3pi->fill(event.weight()); + _num3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _num3pi->val(); double error = _num3pi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _num3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_1998_I480170); } diff --git a/analyses/pluginNovosibirsk/CMD2_1999_I483994.cc b/analyses/pluginNovosibirsk/CMD2_1999_I483994.cc --- a/analyses/pluginNovosibirsk/CMD2_1999_I483994.cc +++ b/analyses/pluginNovosibirsk/CMD2_1999_I483994.cc @@ -1,142 +1,143 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_1999_I483994 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_1999_I483994); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _ncharged = bookCounter("TMP/charged"); - _nneutral = bookCounter("TMP/neutral"); - _nomega = bookCounter("TMP/omega"); + book(_ncharged, "TMP/charged"); + book(_nneutral, "TMP/neutral"); + book(_nomega, "TMP/omega"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==4) { if( nCount[211] == 2 && nCount[-211] == 2 ) - _ncharged->fill(event.weight()); + _ncharged->fill(); else if( nCount[211] == 1 && nCount[-211] == 1 && nCount[111] == 2) - _nneutral->fill(event.weight()); + _nneutral->fill(); } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==223) { + if(p.pid()==223) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // omega pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==111) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _nomega->fill(event.weight()); + _nomega->fill(); } } } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<4;++ix) { double sigma = 0., error = 0.; if(ix==1) { sigma = _ncharged->val(); error = _ncharged->err(); } else if(ix==2) { sigma = _nneutral->val(); error = _nneutral->err(); } else if(ix==3) { sigma = _nomega->val(); error = _nomega->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _ncharged,_nneutral,_nomega; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_1999_I483994); } diff --git a/analyses/pluginNovosibirsk/CMD2_1999_I498859.cc b/analyses/pluginNovosibirsk/CMD2_1999_I498859.cc --- a/analyses/pluginNovosibirsk/CMD2_1999_I498859.cc +++ b/analyses/pluginNovosibirsk/CMD2_1999_I498859.cc @@ -1,80 +1,81 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_1999_I498859 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_1999_I498859); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_1999_I498859); } diff --git a/analyses/pluginNovosibirsk/CMD2_1999_I502164.cc b/analyses/pluginNovosibirsk/CMD2_1999_I502164.cc --- a/analyses/pluginNovosibirsk/CMD2_1999_I502164.cc +++ b/analyses/pluginNovosibirsk/CMD2_1999_I502164.cc @@ -1,88 +1,89 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_1999_I502164 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_1999_I502164); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); - _nK0K0 = bookCounter("TMP/K0K0"); + book(_nK0K0, "TMP/K0K0"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[130]==1 && nCount[310]==1) - _nK0K0->fill(event.weight()); + _nK0K0->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nK0K0->val(); double error = _nK0K0->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; for(unsigned int ix=1;ix<5;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nK0K0; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_1999_I502164); } diff --git a/analyses/pluginNovosibirsk/CMD2_1999_I503154.cc b/analyses/pluginNovosibirsk/CMD2_1999_I503154.cc --- a/analyses/pluginNovosibirsk/CMD2_1999_I503154.cc +++ b/analyses/pluginNovosibirsk/CMD2_1999_I503154.cc @@ -1,123 +1,124 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_1999_I503154 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_1999_I503154); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaGamma = bookCounter("TMP/EtaGamma"); + book(_numEtaGamma, "TMP/EtaGamma"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(val.first==22) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaGamma->fill(event.weight()); + _numEtaGamma->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numEtaGamma->val(); double error = _numEtaGamma->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numEtaGamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_1999_I503154); } diff --git a/analyses/pluginNovosibirsk/CMD2_2000_I511375.cc b/analyses/pluginNovosibirsk/CMD2_2000_I511375.cc --- a/analyses/pluginNovosibirsk/CMD2_2000_I511375.cc +++ b/analyses/pluginNovosibirsk/CMD2_2000_I511375.cc @@ -1,81 +1,82 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2000_I511375 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2000_I511375); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=4) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2000_I511375); } diff --git a/analyses/pluginNovosibirsk/CMD2_2000_I523691.cc b/analyses/pluginNovosibirsk/CMD2_2000_I523691.cc --- a/analyses/pluginNovosibirsk/CMD2_2000_I523691.cc +++ b/analyses/pluginNovosibirsk/CMD2_2000_I523691.cc @@ -1,85 +1,86 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2000_I523691 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2000_I523691); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _num3pi = bookCounter("TMP/num3"); + book(_num3pi, "TMP/num3"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[-211]==1&&nCount[211]==1&&nCount[111]==1) - _num3pi->fill(event.weight()); + _num3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _num3pi->val(); double error = _num3pi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _num3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2000_I523691); } diff --git a/analyses/pluginNovosibirsk/CMD2_2000_I531667.cc b/analyses/pluginNovosibirsk/CMD2_2000_I531667.cc --- a/analyses/pluginNovosibirsk/CMD2_2000_I531667.cc +++ b/analyses/pluginNovosibirsk/CMD2_2000_I531667.cc @@ -1,80 +1,81 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2000_I531667 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2000_I531667); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=4) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2000_I531667); } diff --git a/analyses/pluginNovosibirsk/CMD2_2000_I532970.cc b/analyses/pluginNovosibirsk/CMD2_2000_I532970.cc --- a/analyses/pluginNovosibirsk/CMD2_2000_I532970.cc +++ b/analyses/pluginNovosibirsk/CMD2_2000_I532970.cc @@ -1,165 +1,166 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2000_I532970 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2000_I532970); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numOmegaPiPi = bookCounter("TMP/OmegaPiPi"); - _numEtaPiPi = bookCounter("TMP/EtaPiPi"); - _num5Pi = bookCounter("TMP/5Pi"); + book(_numOmegaPiPi, "TMP/OmegaPiPi"); + book(_numEtaPiPi, "TMP/EtaPiPi"); + book(_num5Pi, "TMP/5Pi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); bool foundRes = false; - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the eta - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) { - _numEtaPiPi->fill(event.weight()); + _numEtaPiPi->fill(); foundRes = true; } } // find the eta - else if(p.pdgId()==223) { + else if(p.pid()==223) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) { - _numOmegaPiPi->fill(event.weight()); + _numOmegaPiPi->fill(); foundRes = true; } } } if(foundRes) vetoEvent; if(nCount[-211]==2&&nCount[211]==2&&nCount[111]==1) - _num5Pi->fill(event.weight()); + _num5Pi->fill(); } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<4;++ix) { double sigma,error; if(ix==1) { sigma = _numOmegaPiPi->val(); error = _numOmegaPiPi->err(); } else if(ix==2) { sigma = _numEtaPiPi->val(); error = _numEtaPiPi->err(); } else { sigma = _num5Pi->val(); error = _num5Pi->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _numEtaPiPi,_numOmegaPiPi,_num5Pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2000_I532970); } diff --git a/analyses/pluginNovosibirsk/CMD2_2001_I554522.cc b/analyses/pluginNovosibirsk/CMD2_2001_I554522.cc --- a/analyses/pluginNovosibirsk/CMD2_2001_I554522.cc +++ b/analyses/pluginNovosibirsk/CMD2_2001_I554522.cc @@ -1,123 +1,124 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2001_I554522 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2001_I554522); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaGamma = bookCounter("TMP/EtaGamma"); + book(_numEtaGamma, "TMP/EtaGamma"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(val.first==22) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaGamma->fill(event.weight()); + _numEtaGamma->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numEtaGamma->val(); double error = _numEtaGamma->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numEtaGamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2001_I554522); } diff --git a/analyses/pluginNovosibirsk/CMD2_2002_I568807.cc b/analyses/pluginNovosibirsk/CMD2_2002_I568807.cc --- a/analyses/pluginNovosibirsk/CMD2_2002_I568807.cc +++ b/analyses/pluginNovosibirsk/CMD2_2002_I568807.cc @@ -1,81 +1,82 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2002_I568807 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2002_I568807); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 2)); - Scatter2DPtr mult = bookScatter2D(1, 1, 2); + Scatter2DPtr mult; + book(mult, 1, 1, 2); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2002_I568807); } diff --git a/analyses/pluginNovosibirsk/CMD2_2003_I601222.cc b/analyses/pluginNovosibirsk/CMD2_2003_I601222.cc --- a/analyses/pluginNovosibirsk/CMD2_2003_I601222.cc +++ b/analyses/pluginNovosibirsk/CMD2_2003_I601222.cc @@ -1,86 +1,87 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2003_I601222 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2003_I601222); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); - _nK0K0 = bookCounter("TMP/K0K0"); + book(_nK0K0, "TMP/K0K0"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[130]==1 && nCount[310]==1) - _nK0K0->fill(event.weight()); + _nK0K0->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nK0K0->val(); double error = _nK0K0->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nK0K0; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2003_I601222); } diff --git a/analyses/pluginNovosibirsk/CMD2_2003_I616446.cc b/analyses/pluginNovosibirsk/CMD2_2003_I616446.cc --- a/analyses/pluginNovosibirsk/CMD2_2003_I616446.cc +++ b/analyses/pluginNovosibirsk/CMD2_2003_I616446.cc @@ -1,108 +1,109 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2003_I616446 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2003_I616446); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numOmegaPi = bookCounter("TMP/OmegaPi"); + book(_numOmegaPi, "TMP/OmegaPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]+=1; + nRes[child.pid()]+=1; ++ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // three particles (pi0 pi0 gamma) if(ntotal!=3) vetoEvent; const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==223) { + if(p.pid()==223) { map nRes; int ncount(0); findChildren(p,nRes,ncount); // only omega to pi0 gamma mode if(ncount!=2) continue; if(nRes[111]!=1 || nRes[22]!=1) continue; // omega pi0 if(nCount[111]-nRes[111]==1) - _numOmegaPi->fill(event.weight()); + _numOmegaPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { Scatter2D temphisto(refData(1, 1, 1)); double sigma = _numOmegaPi->val(); double error = _numOmegaPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } /// @name Histograms //@{ CounterPtr _numOmegaPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2003_I616446); } diff --git a/analyses/pluginNovosibirsk/CMD2_2004_I630009.cc b/analyses/pluginNovosibirsk/CMD2_2004_I630009.cc --- a/analyses/pluginNovosibirsk/CMD2_2004_I630009.cc +++ b/analyses/pluginNovosibirsk/CMD2_2004_I630009.cc @@ -1,87 +1,88 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2004_I630009 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2004_I630009); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _numPiPiGamma = bookCounter("TMP/PiPiGamma"); + book(_numPiPiGamma, "TMP/PiPiGamma"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // three particles (pi0 pi0 gamma) if(ntotal!=3) vetoEvent; if(nCount[111]==2 && nCount[22]==1) - _numPiPiGamma->fill(event.weight()); + _numPiPiGamma->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _numPiPiGamma->val(); double error = _numPiPiGamma->err(); sigma *= crossSection()/ sumOfWeights() /picobarn; error *= crossSection()/ sumOfWeights() /picobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numPiPiGamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2004_I630009); } diff --git a/analyses/pluginNovosibirsk/CMD2_2004_I648023.cc b/analyses/pluginNovosibirsk/CMD2_2004_I648023.cc --- a/analyses/pluginNovosibirsk/CMD2_2004_I648023.cc +++ b/analyses/pluginNovosibirsk/CMD2_2004_I648023.cc @@ -1,81 +1,82 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2004_I648023 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2004_I648023); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=4) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2004_I648023); } diff --git a/analyses/pluginNovosibirsk/CMD2_2005_I658856.cc b/analyses/pluginNovosibirsk/CMD2_2005_I658856.cc --- a/analyses/pluginNovosibirsk/CMD2_2005_I658856.cc +++ b/analyses/pluginNovosibirsk/CMD2_2005_I658856.cc @@ -1,136 +1,137 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2005_I658856 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2005_I658856); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaGamma = bookCounter("TMP/EtaGamma"); - _numPi0Gamma = bookCounter("TMP/Pi0Gamma"); + book(_numEtaGamma, "TMP/EtaGamma"); + book(_numPi0Gamma, "TMP/Pi0Gamma"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[22]==1 && nCount[111]==1) - _numPi0Gamma->fill(event.weight()); + _numPi0Gamma->fill(); const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(val.first==22) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaGamma->fill(event.weight()); + _numEtaGamma->fill(); } } } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); double sigma,error; if(ix==1) { sigma = _numEtaGamma->val(); error = _numEtaGamma->err(); } else { sigma = _numPi0Gamma->val(); error = _numPi0Gamma->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _numEtaGamma,_numPi0Gamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2005_I658856); } diff --git a/analyses/pluginNovosibirsk/CMD2_2006_I728191.cc b/analyses/pluginNovosibirsk/CMD2_2006_I728191.cc --- a/analyses/pluginNovosibirsk/CMD2_2006_I728191.cc +++ b/analyses/pluginNovosibirsk/CMD2_2006_I728191.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2006_I728191 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2006_I728191); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter2D temphisto(refData(3, 1, 1)); double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; - Scatter2DPtr mult = bookScatter2D(3, 1, 1); + Scatter2DPtr mult; + book(mult, 3, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2006_I728191); } diff --git a/analyses/pluginNovosibirsk/CMD2_2007_I728302.cc b/analyses/pluginNovosibirsk/CMD2_2007_I728302.cc --- a/analyses/pluginNovosibirsk/CMD2_2007_I728302.cc +++ b/analyses/pluginNovosibirsk/CMD2_2007_I728302.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2007_I728302 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2007_I728302); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; - Scatter2DPtr mult = bookScatter2D(2, 1, 1); + Scatter2DPtr mult; + book(mult, 2, 1, 1); Scatter2D temphisto(refData(2, 1, 1)); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2007_I728302); } diff --git a/analyses/pluginNovosibirsk/CMD2_2008_I782516.cc b/analyses/pluginNovosibirsk/CMD2_2008_I782516.cc --- a/analyses/pluginNovosibirsk/CMD2_2008_I782516.cc +++ b/analyses/pluginNovosibirsk/CMD2_2008_I782516.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD2_2008_I782516 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD2_2008_I782516); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nkaon = bookCounter("TMP/kaon"); + book(_nkaon, "TMP/kaon"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::KPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::KPLUS) vetoEvent; } - _nkaon->fill(event.weight()); + _nkaon->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nkaon->val(); double error = _nkaon->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nkaon; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD2_2008_I782516); } diff --git a/analyses/pluginNovosibirsk/CMD3_2016_I1385598.cc b/analyses/pluginNovosibirsk/CMD3_2016_I1385598.cc --- a/analyses/pluginNovosibirsk/CMD3_2016_I1385598.cc +++ b/analyses/pluginNovosibirsk/CMD3_2016_I1385598.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD3_2016_I1385598 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD3_2016_I1385598); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nproton = bookCounter("TMP/proton"); + book(_nproton, "TMP/proton"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PROTON) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PROTON) vetoEvent; } - _nproton->fill(event.weight()); + _nproton->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nproton->val(); double error = _nproton->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 6)); - Scatter2DPtr mult = bookScatter2D(1, 1, 6); + Scatter2DPtr mult; + book(mult, 1, 1, 6); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nproton; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD3_2016_I1385598); } diff --git a/analyses/pluginNovosibirsk/CMD3_2016_I1395968.cc b/analyses/pluginNovosibirsk/CMD3_2016_I1395968.cc --- a/analyses/pluginNovosibirsk/CMD3_2016_I1395968.cc +++ b/analyses/pluginNovosibirsk/CMD3_2016_I1395968.cc @@ -1,85 +1,86 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD3_2016_I1395968 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD3_2016_I1395968); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _cKpKmpippim = bookCounter("TMP/KpKmpippim"); + book(_cKpKmpippim, "TMP/KpKmpippim"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=4) vetoEvent; if(nCount[321]==1 && nCount[-321]==1 && nCount[211]==1 && nCount[-211]==1) - _cKpKmpippim->fill(event.weight()); + _cKpKmpippim->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _cKpKmpippim->val(); double error = _cKpKmpippim->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 6)); - Scatter2DPtr mult = bookScatter2D(1, 1, 6); + Scatter2DPtr mult; + book(mult, 1, 1, 6); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _cKpKmpippim; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD3_2016_I1395968); } diff --git a/analyses/pluginNovosibirsk/CMD3_2016_I1444990.cc b/analyses/pluginNovosibirsk/CMD3_2016_I1444990.cc --- a/analyses/pluginNovosibirsk/CMD3_2016_I1444990.cc +++ b/analyses/pluginNovosibirsk/CMD3_2016_I1444990.cc @@ -1,85 +1,86 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD3_2016_I1444990 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD3_2016_I1444990); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); - _nK0K0 = bookCounter("TMP/K0K0"); + book(_nK0K0, "TMP/K0K0"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[130]==1 && nCount[310]==1) - _nK0K0->fill(event.weight()); + _nK0K0->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nK0K0->val(); double error = _nK0K0->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 6)); - Scatter2DPtr mult = bookScatter2D(1, 1, 6); + Scatter2DPtr mult; + book(mult, 1, 1, 6); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nK0K0; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD3_2016_I1444990); } diff --git a/analyses/pluginNovosibirsk/CMD_1985_I221309.cc b/analyses/pluginNovosibirsk/CMD_1985_I221309.cc --- a/analyses/pluginNovosibirsk/CMD_1985_I221309.cc +++ b/analyses/pluginNovosibirsk/CMD_1985_I221309.cc @@ -1,83 +1,84 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CMD_1985_I221309 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CMD_1985_I221309); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CMD_1985_I221309); } diff --git a/analyses/pluginNovosibirsk/MD1_1986_I364141.cc b/analyses/pluginNovosibirsk/MD1_1986_I364141.cc --- a/analyses/pluginNovosibirsk/MD1_1986_I364141.cc +++ b/analyses/pluginNovosibirsk/MD1_1986_I364141.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MD1_1986_I364141 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MD1_1986_I364141); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MD1_1986_I364141); } diff --git a/analyses/pluginNovosibirsk/ND_1991_I321108.cc b/analyses/pluginNovosibirsk/ND_1991_I321108.cc --- a/analyses/pluginNovosibirsk/ND_1991_I321108.cc +++ b/analyses/pluginNovosibirsk/ND_1991_I321108.cc @@ -1,241 +1,242 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class ND_1991_I321108 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(ND_1991_I321108); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _nOmegaPi = bookCounter("TMP/OmegaPi"); - _n2Pi = bookCounter("TMP/2Pi"); - _n3Pi = bookCounter("TMP/3Pi"); - _n4PiC = bookCounter("TMP/4PiC"); - _n4PiN = bookCounter("TMP/4PiN"); - _nEtaPiPi = bookCounter("TMP/EtaPiPi"); - _nKC = bookCounter("TMP/KC"); - _nKN = bookCounter("TMP/KN"); - _n5Pi = bookCounter("TMP/5Pi"); + book(_nOmegaPi, "TMP/OmegaPi"); + book(_n2Pi, "TMP/2Pi"); + book(_n3Pi, "TMP/3Pi"); + book(_n4PiC, "TMP/4PiC"); + book(_n4PiN, "TMP/4PiN"); + book(_nEtaPiPi, "TMP/EtaPiPi"); + book(_nKC, "TMP/KC"); + book(_nKN, "TMP/KN"); + book(_n5Pi, "TMP/5Pi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2) { if(nCount[211]==1&&nCount[-211]==1) - _n2Pi->fill(event.weight()); + _n2Pi->fill(); if(nCount[321]==1&&nCount[-321]==1) - _nKC->fill(event.weight()); + _nKC->fill(); if(nCount[310]==1&&nCount[130]==1) - _nKN->fill(event.weight()); + _nKN->fill(); } else if(ntotal==3) { if(nCount[211]==1&&nCount[-211]==1&&nCount[111]==1) - _n3Pi->fill(event.weight()); + _n3Pi->fill(); } else if(ntotal==4) { if(nCount[211]==2&&nCount[-211]==2) - _n4PiC->fill(event.weight()); + _n4PiC->fill(); else if(nCount[211]==1&&nCount[-211]==1&&nCount[111]==2) - _n4PiN->fill(event.weight()); + _n4PiN->fill(); } else if(ntotal==5) { if(nCount[211]==2&&nCount[-211]==2&&nCount[111]==1) - _n5Pi->fill(event.weight()); + _n5Pi->fill(); } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the eta - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _nEtaPiPi->fill(event.weight()); + _nEtaPiPi->fill(); } - else if(p.pdgId()==223) { + else if(p.pid()==223) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==111) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _nOmegaPi->fill(event.weight()); + _nOmegaPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<15;++ix) { unsigned int ymax=2; double sigma(0.),error(0.); if(ix<=4) { sigma = _nOmegaPi->val(); error = _nOmegaPi->err(); } else if(ix==5) { sigma = _n3Pi->val(); error = _n3Pi->err(); } else if(ix==6) { sigma = _nEtaPiPi->val(); error = _nEtaPiPi->err(); } else if(ix==7) { sigma = _n4PiC->val(); error = _n4PiC->err(); } else if(ix==8) { sigma = _n4PiN->val(); error = _n4PiN->err(); } else if(ix==9) { continue; } else if(ix==10) { ymax=5; } else if(ix==11) { sigma = _n2Pi->val(); error = _n2Pi->err(); } else if(ix==12) { sigma = _nKC->val(); error = _nKC->err(); } else if(ix==13) { sigma = _nKN->val(); error = _nKN->err(); } else if(ix==14) { sigma = _n5Pi->val(); error = _n5Pi->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; for(unsigned int iy=1;iyval(); error = _n4PiC->err(); } else if(iy==2) { sigma = _n4PiN->val(); error = _n4PiN->err(); } else if(iy==3) { sigma = _nOmegaPi->val(); error = _nOmegaPi->err(); } else { sigma = _n3Pi->val(); error = _n3Pi->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; } Scatter2D temphisto(refData(ix, 1, iy)); - Scatter2DPtr mult = bookScatter2D(ix, 1, iy); + Scatter2DPtr mult; + book(mult, ix, 1, iy); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } } //@} /// @name Histograms //@{ CounterPtr _nOmegaPi,_n2Pi,_n3Pi,_n4PiC,_n4PiN,_nEtaPiPi,_nKC,_nKN,_n5Pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(ND_1991_I321108); } diff --git a/analyses/pluginNovosibirsk/OLYA_1981_I173076.cc b/analyses/pluginNovosibirsk/OLYA_1981_I173076.cc --- a/analyses/pluginNovosibirsk/OLYA_1981_I173076.cc +++ b/analyses/pluginNovosibirsk/OLYA_1981_I173076.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/FastJets.hh" namespace Rivet { /// @brief Add a short analysis description here class OLYA_1981_I173076 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(OLYA_1981_I173076); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nkaon = bookCounter("TMP/kaon"); + book(_nkaon, "TMP/kaon"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::KPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::KPLUS) vetoEvent; } - _nkaon->fill(event.weight()); + _nkaon->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nkaon->val(); double error = _nkaon->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nkaon; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(OLYA_1981_I173076); } diff --git a/analyses/pluginNovosibirsk/OLYA_1984_I208231.cc b/analyses/pluginNovosibirsk/OLYA_1984_I208231.cc --- a/analyses/pluginNovosibirsk/OLYA_1984_I208231.cc +++ b/analyses/pluginNovosibirsk/OLYA_1984_I208231.cc @@ -1,79 +1,80 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class OLYA_1984_I208231 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(OLYA_1984_I208231); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(OLYA_1984_I208231); } diff --git a/analyses/pluginNovosibirsk/SND_1999_I508003.cc b/analyses/pluginNovosibirsk/SND_1999_I508003.cc --- a/analyses/pluginNovosibirsk/SND_1999_I508003.cc +++ b/analyses/pluginNovosibirsk/SND_1999_I508003.cc @@ -1,88 +1,89 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_1999_I508003 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_1999_I508003); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _num3pi = bookCounter("TMP/num3"); + book(_num3pi, "TMP/num3"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[-211]==1&&nCount[211]==1&&nCount[111]==1) - _num3pi->fill(event.weight()); + _num3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _num3pi->val(); double error = _num3pi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _num3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_1999_I508003); } diff --git a/analyses/pluginNovosibirsk/SND_2000_I503946.cc b/analyses/pluginNovosibirsk/SND_2000_I503946.cc --- a/analyses/pluginNovosibirsk/SND_2000_I503946.cc +++ b/analyses/pluginNovosibirsk/SND_2000_I503946.cc @@ -1,112 +1,113 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2000_I503946 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2000_I503946); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numOmegaPi = bookCounter("TMP/OmegaPi"); + book(_numOmegaPi, "TMP/OmegaPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]+=1; + nRes[child.pid()]+=1; ++ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // three particles (pi0 pi0 gamma) if(ntotal!=3) vetoEvent; const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==223) { + if(p.pid()==223) { map nRes; int ncount(0); findChildren(p,nRes,ncount); // only omega to pi0 gamma mode if(ncount!=2) continue; if(nRes[111]!=1 || nRes[22]!=1) continue; // omega pi0 if(nCount[111]-nRes[111]==1) - _numOmegaPi->fill(event.weight()); + _numOmegaPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numOmegaPi->val(); double error = _numOmegaPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numOmegaPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2000_I503946); } diff --git a/analyses/pluginNovosibirsk/SND_2000_I524221.cc b/analyses/pluginNovosibirsk/SND_2000_I524221.cc --- a/analyses/pluginNovosibirsk/SND_2000_I524221.cc +++ b/analyses/pluginNovosibirsk/SND_2000_I524221.cc @@ -1,135 +1,136 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2000_I524221 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2000_I524221); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaGamma = bookCounter("TMP/EtaGamma"); - _numPi0Gamma = bookCounter("TMP/Pi0Gamma"); + book(_numEtaGamma, "TMP/EtaGamma"); + book(_numPi0Gamma, "TMP/Pi0Gamma"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[22]==1 && nCount[111]==1) - _numPi0Gamma->fill(event.weight()); + _numPi0Gamma->fill(); const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the eta - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(val.first==22) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaGamma->fill(event.weight()); + _numEtaGamma->fill(); } } } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<3;++ix) { double sigma,error; if(ix==1) { sigma = _numEtaGamma->val(); error = _numEtaGamma->err(); } else { sigma = _numPi0Gamma->val(); error = _numPi0Gamma->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, ix)); - Scatter2DPtr mult = bookScatter2D(1, 1, ix); + Scatter2DPtr mult; + book(mult, 1, 1, ix); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _numEtaGamma,_numPi0Gamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2000_I524221); } diff --git a/analyses/pluginNovosibirsk/SND_2000_I527752.cc b/analyses/pluginNovosibirsk/SND_2000_I527752.cc --- a/analyses/pluginNovosibirsk/SND_2000_I527752.cc +++ b/analyses/pluginNovosibirsk/SND_2000_I527752.cc @@ -1,111 +1,112 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2000_I527752 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2000_I527752); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numOmegaPi = bookCounter("TMP/OmegaPi"); + book(_numOmegaPi, "TMP/OmegaPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]+=1; + nRes[child.pid()]+=1; ++ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // three particles (pi0 pi0 gamma) if(ntotal!=3) vetoEvent; const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==223) { + if(p.pid()==223) { map nRes; int ncount(0); findChildren(p,nRes,ncount); // only omega to pi0 gamma mode if(ncount!=2) continue; if(nRes[111]!=1 || nRes[22]!=1) continue; // omega pi0 if(nCount[111]-nRes[111]==1) - _numOmegaPi->fill(event.weight()); + _numOmegaPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numOmegaPi->val(); double error = _numOmegaPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numOmegaPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2000_I527752); } diff --git a/analyses/pluginNovosibirsk/SND_2001_I533574.cc b/analyses/pluginNovosibirsk/SND_2001_I533574.cc --- a/analyses/pluginNovosibirsk/SND_2001_I533574.cc +++ b/analyses/pluginNovosibirsk/SND_2001_I533574.cc @@ -1,111 +1,112 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2001_I533574 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2001_I533574); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _nKpKm = bookCounter("TMP/KpKm"); - _nK0K0 = bookCounter("TMP/K0K0"); - _n3pi = bookCounter("TMP/3pi"); + book(_nKpKm, "TMP/KpKm"); + book(_nK0K0, "TMP/K0K0"); + book(_n3pi, "TMP/3pi"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2) { if(nCount[321]==1 && nCount[-321]==1) - _nKpKm->fill(event.weight()); + _nKpKm->fill(); else if(nCount[130]==1 && nCount[310]==1) - _nK0K0->fill(event.weight()); + _nK0K0->fill(); } else if(ntotal==3 && nCount[211] == 1 && nCount[-211] == 1 && nCount[111] == 1) - _n3pi->fill(event.weight()); + _n3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { for(unsigned int iy=1;iy<3;++iy) { for(unsigned int ix=1;ix<5;++ix) { double sigma = 0., error = 0.; if(ix==1) { sigma = _nKpKm->val(); error = _nKpKm->err(); } else if(ix==2) { sigma = _nK0K0->val(); error = _nK0K0->err(); } else if(ix==3) { sigma = _nK0K0->val(); error = _nK0K0->err(); } else if(ix==4) { sigma = _n3pi->val(); error = _n3pi->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(iy, 1, ix)); - Scatter2DPtr mult = bookScatter2D(iy, 1, ix); + Scatter2DPtr mult; + book(mult, iy, 1, ix); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } } //@} /// @name Histograms //@{ CounterPtr _nKpKm,_nK0K0,_n3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2001_I533574); } diff --git a/analyses/pluginNovosibirsk/SND_2001_I579319.cc b/analyses/pluginNovosibirsk/SND_2001_I579319.cc --- a/analyses/pluginNovosibirsk/SND_2001_I579319.cc +++ b/analyses/pluginNovosibirsk/SND_2001_I579319.cc @@ -1,97 +1,98 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2001_I579319 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2001_I579319); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion1 = bookCounter("TMP/pion1"); - _npion2 = bookCounter("TMP/pion2"); + book(_npion1, "TMP/pion1"); + book(_npion2, "TMP/pion2"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=4) vetoEvent; if(nCount[-211]==2&&nCount[211]==2) - _npion1->fill(event.weight()); + _npion1->fill(); else if(nCount[-211]==1&&nCount[211]==1&&nCount[111]==2) - _npion2->fill(event.weight()); + _npion2->fill(); } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<3;++ix) { double sigma,error; if(ix==1) { sigma = _npion1->val(); error = _npion1->err(); } else { sigma = _npion2->val(); error = _npion2->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _npion1,_npion2; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2001_I579319); } diff --git a/analyses/pluginNovosibirsk/SND_2002_I582183.cc b/analyses/pluginNovosibirsk/SND_2002_I582183.cc --- a/analyses/pluginNovosibirsk/SND_2002_I582183.cc +++ b/analyses/pluginNovosibirsk/SND_2002_I582183.cc @@ -1,88 +1,89 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2002_I582183 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2002_I582183); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _num3pi = bookCounter("TMP/num3"); + book(_num3pi, "TMP/num3"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[-211]==1&&nCount[211]==1&&nCount[111]==1) - _num3pi->fill(event.weight()); + _num3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _num3pi->val(); double error = _num3pi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _num3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2002_I582183); } diff --git a/analyses/pluginNovosibirsk/SND_2002_I587084.cc b/analyses/pluginNovosibirsk/SND_2002_I587084.cc --- a/analyses/pluginNovosibirsk/SND_2002_I587084.cc +++ b/analyses/pluginNovosibirsk/SND_2002_I587084.cc @@ -1,88 +1,89 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2002_I587084 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2002_I587084); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _numPiPiGamma = bookCounter("TMP/PiPiGamma"); + book(_numPiPiGamma, "TMP/PiPiGamma"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // three particles (pi0 pi0 gamma) if(ntotal!=3) vetoEvent; if(nCount[111]==2 && nCount[22]==1) - _numPiPiGamma->fill(event.weight()); + _numPiPiGamma->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _numPiPiGamma->val(); double error = _numPiPiGamma->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numPiPiGamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2002_I587084); } diff --git a/analyses/pluginNovosibirsk/SND_2003_I612867.cc b/analyses/pluginNovosibirsk/SND_2003_I612867.cc --- a/analyses/pluginNovosibirsk/SND_2003_I612867.cc +++ b/analyses/pluginNovosibirsk/SND_2003_I612867.cc @@ -1,84 +1,85 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2003_I612867 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2003_I612867); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); - _numPi0Gamma = bookCounter("TMP/Pi0Gamma"); + book(_numPi0Gamma, "TMP/Pi0Gamma"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[22]==1 && nCount[111]==1) - _numPi0Gamma->fill(event.weight()); + _numPi0Gamma->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _numPi0Gamma->val(); double error = _numPi0Gamma->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numPi0Gamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2003_I612867); } diff --git a/analyses/pluginNovosibirsk/SND_2003_I619011.cc b/analyses/pluginNovosibirsk/SND_2003_I619011.cc --- a/analyses/pluginNovosibirsk/SND_2003_I619011.cc +++ b/analyses/pluginNovosibirsk/SND_2003_I619011.cc @@ -1,88 +1,89 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2003_I619011 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2003_I619011); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _num3pi = bookCounter("TMP/num3"); + book(_num3pi, "TMP/num3"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[-211]==1&&nCount[211]==1&&nCount[111]==1) - _num3pi->fill(event.weight()); + _num3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _num3pi->val(); double error = _num3pi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _num3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2003_I619011); } diff --git a/analyses/pluginNovosibirsk/SND_2005_I686349.cc b/analyses/pluginNovosibirsk/SND_2005_I686349.cc --- a/analyses/pluginNovosibirsk/SND_2005_I686349.cc +++ b/analyses/pluginNovosibirsk/SND_2005_I686349.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2005_I686349 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2005_I686349); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2005_I686349); } diff --git a/analyses/pluginNovosibirsk/SND_2006_I717778.cc b/analyses/pluginNovosibirsk/SND_2006_I717778.cc --- a/analyses/pluginNovosibirsk/SND_2006_I717778.cc +++ b/analyses/pluginNovosibirsk/SND_2006_I717778.cc @@ -1,122 +1,123 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2006_I717778 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2006_I717778); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaGamma = bookCounter("TMP/EtaGamma"); + book(_numEtaGamma, "TMP/EtaGamma"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(val.first==22) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaGamma->fill(event.weight()); + _numEtaGamma->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numEtaGamma->val(); double error = _numEtaGamma->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _numEtaGamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2006_I717778); } diff --git a/analyses/pluginNovosibirsk/SND_2006_I720035.cc b/analyses/pluginNovosibirsk/SND_2006_I720035.cc --- a/analyses/pluginNovosibirsk/SND_2006_I720035.cc +++ b/analyses/pluginNovosibirsk/SND_2006_I720035.cc @@ -1,86 +1,87 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2006_I720035 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2006_I720035); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); - _nK0K0 = bookCounter("TMP/K0K0"); + book(_nK0K0, "TMP/K0K0"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[130]==1 && nCount[310]==1) - _nK0K0->fill(event.weight()); + _nK0K0->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nK0K0->val(); double error = _nK0K0->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nK0K0; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2006_I720035); } diff --git a/analyses/pluginNovosibirsk/SND_2007_I755881.cc b/analyses/pluginNovosibirsk/SND_2007_I755881.cc --- a/analyses/pluginNovosibirsk/SND_2007_I755881.cc +++ b/analyses/pluginNovosibirsk/SND_2007_I755881.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2007_I755881 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2007_I755881); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nkaon = bookCounter("TMP/kaon"); + book(_nkaon, "TMP/kaon"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::KPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::KPLUS) vetoEvent; } - _nkaon->fill(event.weight()); + _nkaon->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nkaon->val(); double error = _nkaon->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nkaon; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2007_I755881); } diff --git a/analyses/pluginNovosibirsk/SND_2014_I1275333.cc b/analyses/pluginNovosibirsk/SND_2014_I1275333.cc --- a/analyses/pluginNovosibirsk/SND_2014_I1275333.cc +++ b/analyses/pluginNovosibirsk/SND_2014_I1275333.cc @@ -1,121 +1,122 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2014_I1275333 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2014_I1275333); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaGamma = bookCounter("TMP/EtaGamma"); + book(_numEtaGamma, "TMP/EtaGamma"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=1) continue; bool matched = true; for(auto const & val : nRes) { if(val.first==22) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaGamma->fill(event.weight()); + _numEtaGamma->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numEtaGamma->val(); double error = _numEtaGamma->err(); sigma *= crossSection()/ sumOfWeights() /picobarn; error *= crossSection()/ sumOfWeights() /picobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numEtaGamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2014_I1275333); } diff --git a/analyses/pluginNovosibirsk/SND_2014_I1321689.cc b/analyses/pluginNovosibirsk/SND_2014_I1321689.cc --- a/analyses/pluginNovosibirsk/SND_2014_I1321689.cc +++ b/analyses/pluginNovosibirsk/SND_2014_I1321689.cc @@ -1,86 +1,87 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2014_I1321689 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2014_I1321689); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nneutron = bookCounter("TMP/neutron"); + book(_nneutron, "TMP/neutron"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::NEUTRON) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::NEUTRON) vetoEvent; } - _nneutron->fill(event.weight()); + _nneutron->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nneutron->val(); double error = _nneutron->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nneutron; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2014_I1321689); } diff --git a/analyses/pluginNovosibirsk/SND_2015_I1332929.cc b/analyses/pluginNovosibirsk/SND_2015_I1332929.cc --- a/analyses/pluginNovosibirsk/SND_2015_I1332929.cc +++ b/analyses/pluginNovosibirsk/SND_2015_I1332929.cc @@ -1,120 +1,121 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2015_I1332929 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2015_I1332929); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaPiPi = bookCounter("TMP/EtaPiPi"); + book(_numEtaPiPi, "TMP/EtaPiPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaPiPi->fill(event.weight()); + _numEtaPiPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numEtaPiPi->val(); double error = _numEtaPiPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numEtaPiPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2015_I1332929); } diff --git a/analyses/pluginNovosibirsk/SND_2015_I1389908.cc b/analyses/pluginNovosibirsk/SND_2015_I1389908.cc --- a/analyses/pluginNovosibirsk/SND_2015_I1389908.cc +++ b/analyses/pluginNovosibirsk/SND_2015_I1389908.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2015_I1389908 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2015_I1389908); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _num3pi = bookCounter("TMP/num3"); + book(_num3pi, "TMP/num3"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[-211]==1&&nCount[211]==1&&nCount[111]==1) - _num3pi->fill(event.weight()); + _num3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _num3pi->val(); double error = _num3pi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _num3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2015_I1389908); } diff --git a/analyses/pluginNovosibirsk/SND_2016_I1418483.cc b/analyses/pluginNovosibirsk/SND_2016_I1418483.cc --- a/analyses/pluginNovosibirsk/SND_2016_I1418483.cc +++ b/analyses/pluginNovosibirsk/SND_2016_I1418483.cc @@ -1,83 +1,84 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2016_I1418483 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2016_I1418483); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); - _numPi0Gamma = bookCounter("TMP/Pi0Gamma"); + book(_numPi0Gamma, "TMP/Pi0Gamma"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[22]==1 && nCount[111]==1) - _numPi0Gamma->fill(event.weight()); + _numPi0Gamma->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _numPi0Gamma->val(); double error = _numPi0Gamma->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 5)); - Scatter2DPtr mult = bookScatter2D(1, 1, 5); + Scatter2DPtr mult; + book(mult, 1, 1, 5); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numPi0Gamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2016_I1418483); } diff --git a/analyses/pluginNovosibirsk/SND_2016_I1471515.cc b/analyses/pluginNovosibirsk/SND_2016_I1471515.cc --- a/analyses/pluginNovosibirsk/SND_2016_I1471515.cc +++ b/analyses/pluginNovosibirsk/SND_2016_I1471515.cc @@ -1,122 +1,123 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2016_I1471515 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2016_I1471515); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _nOmegaEtaPi= bookCounter("/TMP/nOmegaEtaPi"); + book(_nOmegaEtaPi, "/TMP/nOmegaEtaPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]-=1; + nRes[child.pid()]-=1; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; - if(p.pdgId()!=223) continue; + if(p.pid()!=223) continue; map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); - foreach (const Particle& p2, ufs.particles()) { - if(p2.pdgId()!=221) continue; + for (const Particle& p2 : ufs.particles()) { + if(p2.pid()!=221) continue; map nResB = nRes; int ncountB = ncount; findChildren(p2,nResB,ncountB); if(ncountB!=1) continue; bool matched2 = true; for(auto const & val : nResB) { if(val.first==111) { if(val.second!=1) { matched2 = false; break; } } else if(val.second!=0) { matched2 = false; break; } } if(matched2) { - _nOmegaEtaPi->fill(event.weight()); + _nOmegaEtaPi->fill(); break; } } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _nOmegaEtaPi->val(); double error = _nOmegaEtaPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 6)); - Scatter2DPtr mult = bookScatter2D(1, 1, 6); + Scatter2DPtr mult; + book(mult, 1, 1, 6); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nOmegaEtaPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2016_I1471515); } diff --git a/analyses/pluginNovosibirsk/SND_2016_I1473343.cc b/analyses/pluginNovosibirsk/SND_2016_I1473343.cc --- a/analyses/pluginNovosibirsk/SND_2016_I1473343.cc +++ b/analyses/pluginNovosibirsk/SND_2016_I1473343.cc @@ -1,115 +1,116 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2016_I1473343 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2016_I1473343); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _nOmegaEta= bookCounter("/TMP/nOmegaEta"); + book(_nOmegaEta, "/TMP/nOmegaEta"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]-=1; + nRes[child.pid()]-=1; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; - if(p.pdgId()!=223) continue; + if(p.pid()!=223) continue; map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); - foreach (const Particle& p2, ufs.particles()) { - if(p2.pdgId()!=221) continue; + for (const Particle& p2 : ufs.particles()) { + if(p2.pid()!=221) continue; map nResB = nRes; int ncountB = ncount; findChildren(p2,nResB,ncountB); if(ncountB!=0) continue; bool matched2 = true; for(auto const & val : nResB) { if(val.second!=0) { matched2 = false; break; } } if(matched2) { - _nOmegaEta->fill(event.weight()); + _nOmegaEta->fill(); break; } } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _nOmegaEta->val(); double error = _nOmegaEta->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nOmegaEta; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2016_I1473343); } diff --git a/analyses/pluginNovosibirsk/SND_2016_I1484677.cc b/analyses/pluginNovosibirsk/SND_2016_I1484677.cc --- a/analyses/pluginNovosibirsk/SND_2016_I1484677.cc +++ b/analyses/pluginNovosibirsk/SND_2016_I1484677.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2016_I1484677 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2016_I1484677); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nkaon = bookCounter("TMP/kaon"); + book(_nkaon, "TMP/kaon"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::KPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::KPLUS) vetoEvent; } - _nkaon->fill(event.weight()); + _nkaon->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nkaon->val(); double error = _nkaon->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nkaon; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2016_I1484677); } diff --git a/analyses/pluginNovosibirsk/SND_2016_I1489182.cc b/analyses/pluginNovosibirsk/SND_2016_I1489182.cc --- a/analyses/pluginNovosibirsk/SND_2016_I1489182.cc +++ b/analyses/pluginNovosibirsk/SND_2016_I1489182.cc @@ -1,111 +1,112 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2016_I1489182 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2016_I1489182); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numOmegaPi = bookCounter("TMP/OmegaPi"); + book(_numOmegaPi, "TMP/OmegaPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]+=1; + nRes[child.pid()]+=1; ++ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // three particles (pi0 pi0 gamma) if(ntotal!=3) vetoEvent; const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==223) { + if(p.pid()==223) { map nRes; int ncount(0); findChildren(p,nRes,ncount); // only omega to pi0 gamma mode if(ncount!=2) continue; if(nRes[111]!=1 || nRes[22]!=1) continue; // omega pi0 if(nCount[111]-nRes[111]==1) - _numOmegaPi->fill(event.weight()); + _numOmegaPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numOmegaPi->val(); double error = _numOmegaPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numOmegaPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2016_I1489182); } diff --git a/analyses/pluginNovosibirsk/SND_2018_I1637194.cc b/analyses/pluginNovosibirsk/SND_2018_I1637194.cc --- a/analyses/pluginNovosibirsk/SND_2018_I1637194.cc +++ b/analyses/pluginNovosibirsk/SND_2018_I1637194.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2018_I1637194 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2018_I1637194); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _nKKpi= bookCounter( "/TMP/nKKpi" ); + book(_nKKpi, "/TMP/nKKpi" ); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==3 && nCount[130]==1 && nCount[310]==1 && nCount[111] ==1) - _nKKpi->fill(event.weight()); + _nKKpi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nKKpi->val(); double error = _nKKpi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nKKpi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2018_I1637194); } diff --git a/analyses/pluginNovosibirsk/SND_2018_I1638368.cc b/analyses/pluginNovosibirsk/SND_2018_I1638368.cc --- a/analyses/pluginNovosibirsk/SND_2018_I1638368.cc +++ b/analyses/pluginNovosibirsk/SND_2018_I1638368.cc @@ -1,120 +1,121 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2018_I1638368 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2018_I1638368); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaPiPi = bookCounter("TMP/EtaPiPi"); + book(_numEtaPiPi, "TMP/EtaPiPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaPiPi->fill(event.weight()); + _numEtaPiPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numEtaPiPi->val(); double error = _numEtaPiPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numEtaPiPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2018_I1638368); } diff --git a/analyses/pluginNovosibirsk/SND_2018_I1693737.cc b/analyses/pluginNovosibirsk/SND_2018_I1693737.cc --- a/analyses/pluginNovosibirsk/SND_2018_I1693737.cc +++ b/analyses/pluginNovosibirsk/SND_2018_I1693737.cc @@ -1,115 +1,116 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2018_I1693737 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2018_I1693737); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _nKKEta= bookCounter("/TMP/nKKEta"); + book(_nKKEta, "/TMP/nKKEta"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]-=1; + nRes[child.pid()]-=1; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; - if(p.pdgId()!=221) continue; + if(p.pid()!=221) continue; map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==321) { if(val.second!=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) { - _nKKEta->fill(event.weight()); + _nKKEta->fill(); break; } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _nKKEta->val(); double error = _nKKEta->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nKKEta; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2018_I1693737); } diff --git a/analyses/pluginNovosibirsk/SND_2018_I1694988.cc b/analyses/pluginNovosibirsk/SND_2018_I1694988.cc --- a/analyses/pluginNovosibirsk/SND_2018_I1694988.cc +++ b/analyses/pluginNovosibirsk/SND_2018_I1694988.cc @@ -1,81 +1,82 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class SND_2018_I1694988 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(SND_2018_I1694988); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); - _numPi0Gamma = bookCounter("TMP/Pi0Gamma"); + book(_numPi0Gamma, "TMP/Pi0Gamma"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[22]==1 && nCount[111]==1) - _numPi0Gamma->fill(event.weight()); + _numPi0Gamma->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _numPi0Gamma->val(); double error = _numPi0Gamma->err(); sigma *= crossSection()/ sumOfWeights() /picobarn; error *= crossSection()/ sumOfWeights() /picobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numPi0Gamma; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(SND_2018_I1694988); } diff --git a/analyses/pluginOrsay/DM1_1978_I134061.cc b/analyses/pluginOrsay/DM1_1978_I134061.cc --- a/analyses/pluginOrsay/DM1_1978_I134061.cc +++ b/analyses/pluginOrsay/DM1_1978_I134061.cc @@ -1,79 +1,80 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1978_I134061 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1978_I134061); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1978_I134061); } diff --git a/analyses/pluginOrsay/DM1_1979_I132828.cc b/analyses/pluginOrsay/DM1_1979_I132828.cc --- a/analyses/pluginOrsay/DM1_1979_I132828.cc +++ b/analyses/pluginOrsay/DM1_1979_I132828.cc @@ -1,79 +1,80 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1979_I132828 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1979_I132828); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=4) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1979_I132828); } diff --git a/analyses/pluginOrsay/DM1_1979_I141565.cc b/analyses/pluginOrsay/DM1_1979_I141565.cc --- a/analyses/pluginOrsay/DM1_1979_I141565.cc +++ b/analyses/pluginOrsay/DM1_1979_I141565.cc @@ -1,80 +1,81 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1979_I141565 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1979_I141565); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _nProton= bookCounter( "/TMP/nProton" ); + book(_nProton, "/TMP/nProton" ); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); // total hadronic and muonic cross sections map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[2212]==1 && nCount[-2212]==1) - _nProton->fill(event.weight()); + _nProton->fill(); } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /nanobarn; double sigma = _nProton->val()*fact; double error = _nProton->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nProton; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1979_I141565); } diff --git a/analyses/pluginOrsay/DM1_1980_I140174.cc b/analyses/pluginOrsay/DM1_1980_I140174.cc --- a/analyses/pluginOrsay/DM1_1980_I140174.cc +++ b/analyses/pluginOrsay/DM1_1980_I140174.cc @@ -1,83 +1,84 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1980_I140174 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1980_I140174); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _n3pi = bookCounter("TMP/3pi"); + book(_n3pi, "TMP/3pi"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==3 && nCount[211] == 1 && nCount[-211] == 1 && nCount[111] == 1) - _n3pi->fill(event.weight()); + _n3pi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _n3pi->val(); double error = _n3pi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _n3pi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1980_I140174); } diff --git a/analyses/pluginOrsay/DM1_1981_I156053.cc b/analyses/pluginOrsay/DM1_1981_I156053.cc --- a/analyses/pluginOrsay/DM1_1981_I156053.cc +++ b/analyses/pluginOrsay/DM1_1981_I156053.cc @@ -1,85 +1,86 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1981_I156053 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1981_I156053); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nKSKL = bookCounter("TMP/nKSKL"); + book(_nKSKL, "TMP/nKSKL"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[130]==1 && nCount[310]==1) - _nKSKL->fill(event.weight()); + _nKSKL->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nKSKL->val(); double error = _nKSKL->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nKSKL; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1981_I156053); } diff --git a/analyses/pluginOrsay/DM1_1981_I156054.cc b/analyses/pluginOrsay/DM1_1981_I156054.cc --- a/analyses/pluginOrsay/DM1_1981_I156054.cc +++ b/analyses/pluginOrsay/DM1_1981_I156054.cc @@ -1,81 +1,82 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1981_I156054 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1981_I156054); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nkaon = bookCounter("TMP/kaon"); + book(_nkaon, "TMP/kaon"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::KPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::KPLUS) vetoEvent; } - _nkaon->fill(event.weight()); + _nkaon->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nkaon->val(); double error = _nkaon->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nkaon; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1981_I156054); } diff --git a/analyses/pluginOrsay/DM1_1981_I166353.cc b/analyses/pluginOrsay/DM1_1981_I166353.cc --- a/analyses/pluginOrsay/DM1_1981_I166353.cc +++ b/analyses/pluginOrsay/DM1_1981_I166353.cc @@ -1,75 +1,76 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1981_I166353 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1981_I166353); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _num3pip3pim = bookCounter("TMP/num3pip3pim"); + book(_num3pip3pim, "TMP/num3pip3pim"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); int ntotal(0); - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=211) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=211) vetoEvent; ++ntotal; } if(ntotal!=6) vetoEvent; - _num3pip3pim->fill(event.weight()); + _num3pip3pim->fill(); } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /nanobarn; double sigma = _num3pip3pim->val()*fact; double error = _num3pip3pim->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _num3pip3pim; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1981_I166353); } diff --git a/analyses/pluginOrsay/DM1_1981_I166964.cc b/analyses/pluginOrsay/DM1_1981_I166964.cc --- a/analyses/pluginOrsay/DM1_1981_I166964.cc +++ b/analyses/pluginOrsay/DM1_1981_I166964.cc @@ -1,117 +1,118 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1981_I166964 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1981_I166964); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _nomega = bookCounter("TMP/omega"); + book(_nomega, "TMP/omega"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==223) { + if(p.pid()==223) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // omega pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _nomega->fill(event.weight()); + _nomega->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /nanobarn; double sigma = _nomega->val()*fact; double error = _nomega->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nomega; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1981_I166964); } diff --git a/analyses/pluginOrsay/DM1_1982_I168552.cc b/analyses/pluginOrsay/DM1_1982_I168552.cc --- a/analyses/pluginOrsay/DM1_1982_I168552.cc +++ b/analyses/pluginOrsay/DM1_1982_I168552.cc @@ -1,78 +1,79 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1982_I168552 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1982_I168552); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=4) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1982_I168552); } diff --git a/analyses/pluginOrsay/DM1_1982_I169382.cc b/analyses/pluginOrsay/DM1_1982_I169382.cc --- a/analyses/pluginOrsay/DM1_1982_I169382.cc +++ b/analyses/pluginOrsay/DM1_1982_I169382.cc @@ -1,83 +1,84 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1982_I169382 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1982_I169382); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _cKpKmpippim = bookCounter("TMP/KpKmpippim"); + book(_cKpKmpippim, "TMP/KpKmpippim"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=4) vetoEvent; if(nCount[321]==1 && nCount[-321]==1 && nCount[211]==1 && nCount[-211]==1) - _cKpKmpippim->fill(event.weight()); + _cKpKmpippim->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _cKpKmpippim->val(); double error = _cKpKmpippim->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _cKpKmpippim; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1982_I169382); } diff --git a/analyses/pluginOrsay/DM1_1982_I176801.cc b/analyses/pluginOrsay/DM1_1982_I176801.cc --- a/analyses/pluginOrsay/DM1_1982_I176801.cc +++ b/analyses/pluginOrsay/DM1_1982_I176801.cc @@ -1,85 +1,86 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM1_1982_I176801 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM1_1982_I176801); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); - _nKKpi= bookCounter("/TMP/nKKpi"); + book(_nKKpi, "/TMP/nKKpi"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[310]==1 && ((nCount[ 211]==1&&nCount[-321]==1)|| (nCount[-211]==1&&nCount[ 321]==1))) - _nKKpi->fill(event.weight()); + _nKKpi->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nKKpi->val(); double error = _nKKpi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nKKpi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM1_1982_I176801); } diff --git a/analyses/pluginOrsay/DM2_1983_I190558.cc b/analyses/pluginOrsay/DM2_1983_I190558.cc --- a/analyses/pluginOrsay/DM2_1983_I190558.cc +++ b/analyses/pluginOrsay/DM2_1983_I190558.cc @@ -1,81 +1,82 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/FastJets.hh" namespace Rivet { /// @brief Add a short analysis description here class DM2_1983_I190558 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM2_1983_I190558); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nproton = bookCounter("TMP/proton"); + book(_nproton, "TMP/proton"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PROTON) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PROTON) vetoEvent; } - _nproton->fill(event.weight()); + _nproton->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nproton->val(); double error = _nproton->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nproton; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM2_1983_I190558); } diff --git a/analyses/pluginOrsay/DM2_1988_I262690.cc b/analyses/pluginOrsay/DM2_1988_I262690.cc --- a/analyses/pluginOrsay/DM2_1988_I262690.cc +++ b/analyses/pluginOrsay/DM2_1988_I262690.cc @@ -1,82 +1,83 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM2_1988_I262690 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM2_1988_I262690); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _nkaon = bookCounter("TMP/kaon"); + book(_nkaon, "TMP/kaon"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::KPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::KPLUS) vetoEvent; } - _nkaon->fill(event.weight()); + _nkaon->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nkaon->val(); double error = _nkaon->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nkaon; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM2_1988_I262690); } diff --git a/analyses/pluginOrsay/DM2_1988_I264144.cc b/analyses/pluginOrsay/DM2_1988_I264144.cc --- a/analyses/pluginOrsay/DM2_1988_I264144.cc +++ b/analyses/pluginOrsay/DM2_1988_I264144.cc @@ -1,119 +1,120 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class DM2_1988_I264144 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM2_1988_I264144); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _numEtaPiPi = bookCounter("TMP/EtaPiPi"); + book(_numEtaPiPi, "TMP/EtaPiPi"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==221) { + if(p.pid()==221) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // eta pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _numEtaPiPi->fill(event.weight()); + _numEtaPiPi->fill(); } } } /// Normalise histograms etc., after the run void finalize() { double sigma = _numEtaPiPi->val(); double error = _numEtaPiPi->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _numEtaPiPi; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM2_1988_I264144); } diff --git a/analyses/pluginOrsay/DM2_1989_I267118.cc b/analyses/pluginOrsay/DM2_1989_I267118.cc --- a/analyses/pluginOrsay/DM2_1989_I267118.cc +++ b/analyses/pluginOrsay/DM2_1989_I267118.cc @@ -1,81 +1,82 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM2_1989_I267118 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM2_1989_I267118); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _npion = bookCounter("TMP/pion"); + book(_npion, "TMP/pion"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); if(fs.particles().size()!=2) vetoEvent; - foreach (const Particle& p, fs.particles()) { - if(abs(p.pdgId())!=PID::PIPLUS) vetoEvent; + for (const Particle& p : fs.particles()) { + if(abs(p.pid())!=PID::PIPLUS) vetoEvent; } - _npion->fill(event.weight()); + _npion->fill(); } /// Normalise histograms etc., after the run void finalize() { double sigma = _npion->val(); double error = _npion->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _npion; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM2_1989_I267118); } diff --git a/analyses/pluginOrsay/DM2_1990_I297706.cc b/analyses/pluginOrsay/DM2_1990_I297706.cc --- a/analyses/pluginOrsay/DM2_1990_I297706.cc +++ b/analyses/pluginOrsay/DM2_1990_I297706.cc @@ -1,149 +1,150 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class DM2_1990_I297706 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM2_1990_I297706); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _nProton= bookCounter( "/TMP/nProton" ); - _nLambda= bookCounter( "/TMP/nLambda" ); + book(_nProton, "/TMP/nProton" ); + book(_nLambda, "/TMP/nLambda" ); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]-=1; + nRes[child.pid()]-=1; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); // total hadronic and muonic cross sections map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==2 && nCount[2212]==1 && nCount[-2212]==1) - _nProton->fill(event.weight()); + _nProton->fill(); // find the Lambdas const FinalState& ufs = apply(event, "UFS"); for(unsigned int ix=0;ix nRes = nCount; int ncount = ntotal; findChildren(p1,nRes,ncount); for(unsigned int iy=ix+1;iy nRes2 = nRes; int ncount2 = ncount; findChildren(p2,nRes2,ncount2); if(ncount2!=0) continue; matched=true; for(auto const & val : nRes2) { if(val.second!=0) { matched = false; break; } } if(matched) { - _nLambda->fill(event.weight()); + _nLambda->fill(); break; } } if(matched) break; } } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /picobarn; for(unsigned int ix=1;ix<3;++ix) { double sigma,error; if(ix==1) { sigma = _nProton->val()*fact; error = _nProton->err()*fact; } else { sigma = _nLambda->val()*fact; error = _nLambda->err()*fact; } Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nProton,_nLambda; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM2_1990_I297706); } diff --git a/analyses/pluginOrsay/DM2_1991_I318558.cc b/analyses/pluginOrsay/DM2_1991_I318558.cc --- a/analyses/pluginOrsay/DM2_1991_I318558.cc +++ b/analyses/pluginOrsay/DM2_1991_I318558.cc @@ -1,95 +1,96 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class DM2_1991_I318558 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM2_1991_I318558); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms for(unsigned int ix=1;ix<3;++ix) { stringstream ss; ss << "TMP/n" << ix; - _nMeson[ix]= bookCounter(ss.str()); + book(_nMeson[ix], ss.str()); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal!=3) vetoEvent; if(nCount[310]==1 && ((nCount[ 211]==1&&nCount[-321]==1)|| (nCount[-211]==1&&nCount[ 321]==1))) - _nMeson[1]->fill(event.weight()); + _nMeson[1]->fill(); else if(nCount[321]==1 && nCount[-321]==1 && nCount[111]==1) - _nMeson[2]->fill(event.weight()); + _nMeson[2]->fill(); } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<3;++ix) { double sigma = _nMeson[ix]->val(); double error = _nMeson[ix]->err(); sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nMeson[3]; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM2_1991_I318558); } diff --git a/analyses/pluginOrsay/DM2_1992_I339265.cc b/analyses/pluginOrsay/DM2_1992_I339265.cc --- a/analyses/pluginOrsay/DM2_1992_I339265.cc +++ b/analyses/pluginOrsay/DM2_1992_I339265.cc @@ -1,133 +1,134 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class DM2_1992_I339265 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(DM2_1992_I339265); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _n3pi = bookCounter("TMP/3pi"); - _nomega = bookCounter("TMP/omega"); + book(_n3pi, "TMP/3pi"); + book(_nomega, "TMP/omega"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - --nRes[child.pdgId()]; + --nRes[child.pid()]; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } if(ntotal==3 && nCount[211] == 1 && nCount[-211] == 1 && nCount[111] == 1) - _n3pi->fill(event.weight()); + _n3pi->fill(); const FinalState& ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles()) { + for (const Particle& p : ufs.particles()) { if(p.children().empty()) continue; // find the omega - if(p.pdgId()==223) { + if(p.pid()==223) { map nRes = nCount; int ncount = ntotal; findChildren(p,nRes,ncount); // omega pi+pi- if(ncount!=2) continue; bool matched = true; for(auto const & val : nRes) { if(abs(val.first)==211) { if(val.second !=1) { matched = false; break; } } else if(val.second!=0) { matched = false; break; } } if(matched) - _nomega->fill(event.weight()); + _nomega->fill(); } } } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<3;++ix) { double sigma = 0., error = 0.; if(ix==1) { sigma = _n3pi->val(); error = _n3pi->err(); } else if(ix==2) { sigma = _nomega->val(); error = _nomega->err(); } sigma *= crossSection()/ sumOfWeights() /nanobarn; error *= crossSection()/ sumOfWeights() /nanobarn; Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/MeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _n3pi,_nomega; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(DM2_1992_I339265); } diff --git a/analyses/pluginPetra/CELLO_1981_I166365.cc b/analyses/pluginPetra/CELLO_1981_I166365.cc --- a/analyses/pluginPetra/CELLO_1981_I166365.cc +++ b/analyses/pluginPetra/CELLO_1981_I166365.cc @@ -1,102 +1,105 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CELLO_1981_I166365 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CELLO_1981_I166365); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CELLO_1981_I166365); } diff --git a/analyses/pluginPetra/CELLO_1984_I202783.cc b/analyses/pluginPetra/CELLO_1984_I202783.cc --- a/analyses/pluginPetra/CELLO_1984_I202783.cc +++ b/analyses/pluginPetra/CELLO_1984_I202783.cc @@ -1,102 +1,105 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CELLO_1984_I202783 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CELLO_1984_I202783); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(2, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(2, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 2, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CELLO_1984_I202783); } diff --git a/analyses/pluginPetra/CELLO_1987_I236981.cc b/analyses/pluginPetra/CELLO_1987_I236981.cc --- a/analyses/pluginPetra/CELLO_1987_I236981.cc +++ b/analyses/pluginPetra/CELLO_1987_I236981.cc @@ -1,102 +1,105 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CELLO_1987_I236981 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CELLO_1987_I236981); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CELLO_1987_I236981); } diff --git a/analyses/pluginPetra/JADE_1979_I142874.cc b/analyses/pluginPetra/JADE_1979_I142874.cc --- a/analyses/pluginPetra/JADE_1979_I142874.cc +++ b/analyses/pluginPetra/JADE_1979_I142874.cc @@ -1,75 +1,76 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/ChargedFinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class JADE_1979_I142874 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(JADE_1979_I142874); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(ChargedFinalState(), "FS"); // Book histograms - _nHadrons= bookCounter("TMP/hadrons"); + book(_nHadrons, "TMP/hadrons"); } /// Perform the per-event analysis void analyze(const Event& event) { const ChargedFinalState& fs = apply(event, "FS"); - _nHadrons->fill(fs.particles().size()*event.weight()); + _nHadrons->fill(fs.particles().size()); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nHadrons->val()/sumOfWeights(); double error = _nHadrons->err()/sumOfWeights(); Scatter2D temphisto(refData(2, 1, 1)); - Scatter2DPtr mult = bookScatter2D(2, 1, 1); + Scatter2DPtr mult; + book(mult, 2, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nHadrons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(JADE_1979_I142874); } diff --git a/analyses/pluginPetra/JADE_1987_I234905.cc b/analyses/pluginPetra/JADE_1987_I234905.cc --- a/analyses/pluginPetra/JADE_1987_I234905.cc +++ b/analyses/pluginPetra/JADE_1987_I234905.cc @@ -1,101 +1,104 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class JADE_1987_I234905 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(JADE_1987_I234905); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(JADE_1987_I234905); } diff --git a/analyses/pluginPetra/MARKJ_1979_I141976.cc b/analyses/pluginPetra/MARKJ_1979_I141976.cc --- a/analyses/pluginPetra/MARKJ_1979_I141976.cc +++ b/analyses/pluginPetra/MARKJ_1979_I141976.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKJ_1979_I141976 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKJ_1979_I141976); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKJ_1979_I141976); } diff --git a/analyses/pluginPetra/MARKJ_1980_I158857.cc b/analyses/pluginPetra/MARKJ_1980_I158857.cc --- a/analyses/pluginPetra/MARKJ_1980_I158857.cc +++ b/analyses/pluginPetra/MARKJ_1980_I158857.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKJ_1980_I158857 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKJ_1980_I158857); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKJ_1980_I158857); } diff --git a/analyses/pluginPetra/MARKJ_1982_I166369.cc b/analyses/pluginPetra/MARKJ_1982_I166369.cc --- a/analyses/pluginPetra/MARKJ_1982_I166369.cc +++ b/analyses/pluginPetra/MARKJ_1982_I166369.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKJ_1982_I166369 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKJ_1982_I166369); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKJ_1982_I166369); } diff --git a/analyses/pluginPetra/MARKJ_1983_I182337.cc b/analyses/pluginPetra/MARKJ_1983_I182337.cc --- a/analyses/pluginPetra/MARKJ_1983_I182337.cc +++ b/analyses/pluginPetra/MARKJ_1983_I182337.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKJ_1983_I182337 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKJ_1983_I182337); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(4, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(4, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 4, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKJ_1983_I182337); } diff --git a/analyses/pluginPetra/MARKJ_1984_I196567.cc b/analyses/pluginPetra/MARKJ_1984_I196567.cc --- a/analyses/pluginPetra/MARKJ_1984_I196567.cc +++ b/analyses/pluginPetra/MARKJ_1984_I196567.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKJ_1984_I196567 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKJ_1984_I196567); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKJ_1984_I196567); } diff --git a/analyses/pluginPetra/MARKJ_1986_I230297.cc b/analyses/pluginPetra/MARKJ_1986_I230297.cc --- a/analyses/pluginPetra/MARKJ_1986_I230297.cc +++ b/analyses/pluginPetra/MARKJ_1986_I230297.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKJ_1986_I230297 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKJ_1986_I230297); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKJ_1986_I230297); } diff --git a/analyses/pluginPetra/PLUTO_1979_I140294.cc b/analyses/pluginPetra/PLUTO_1979_I140294.cc --- a/analyses/pluginPetra/PLUTO_1979_I140294.cc +++ b/analyses/pluginPetra/PLUTO_1979_I140294.cc @@ -1,103 +1,106 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class PLUTO_1979_I140294 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(PLUTO_1979_I140294); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - ostringstream title; + std::ostringstream title; title << "d0" << ix << "_sigma"; - Scatter2DPtr hadrons = bookScatter2D(title.str() + "_hadrons"); - Scatter2DPtr muons = bookScatter2D(title.str() + "_muons" ); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, title.str() + "_hadrons"); + Scatter2DPtr muons; + book(muons, title.str() + "_muons" ); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(PLUTO_1979_I140294); } diff --git a/analyses/pluginPetra/PLUTO_1979_I140818.cc b/analyses/pluginPetra/PLUTO_1979_I140818.cc --- a/analyses/pluginPetra/PLUTO_1979_I140818.cc +++ b/analyses/pluginPetra/PLUTO_1979_I140818.cc @@ -1,90 +1,91 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class PLUTO_1979_I140818 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(PLUTO_1979_I140818); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) vetoEvent; // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /nanobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; Scatter2D temphisto(refData(2, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D(2, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, 2, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); } else { hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(PLUTO_1979_I140818); } diff --git a/analyses/pluginPetra/PLUTO_1979_I142517.cc b/analyses/pluginPetra/PLUTO_1979_I142517.cc --- a/analyses/pluginPetra/PLUTO_1979_I142517.cc +++ b/analyses/pluginPetra/PLUTO_1979_I142517.cc @@ -1,101 +1,104 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class PLUTO_1979_I142517 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(PLUTO_1979_I142517); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /nanobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(PLUTO_1979_I142517); } diff --git a/analyses/pluginPetra/PLUTO_1980_I152291.cc b/analyses/pluginPetra/PLUTO_1980_I152291.cc --- a/analyses/pluginPetra/PLUTO_1980_I152291.cc +++ b/analyses/pluginPetra/PLUTO_1980_I152291.cc @@ -1,103 +1,106 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class PLUTO_1980_I152291 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(PLUTO_1980_I152291); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - ostringstream title; + std::ostringstream title; title << "d0" << ix << "_sigma"; - Scatter2DPtr hadrons = bookScatter2D(title.str() + "_hadrons"); - Scatter2DPtr muons = bookScatter2D(title.str() + "_muons" ); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, title.str() + "_hadrons"); + Scatter2DPtr muons; + book(muons, title.str() + "_muons" ); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(PLUTO_1980_I152291); } diff --git a/analyses/pluginPetra/PLUTO_1982_I166799.cc b/analyses/pluginPetra/PLUTO_1982_I166799.cc --- a/analyses/pluginPetra/PLUTO_1982_I166799.cc +++ b/analyses/pluginPetra/PLUTO_1982_I166799.cc @@ -1,117 +1,120 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class PLUTO_1982_I166799 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(PLUTO_1982_I166799); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /nanobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } // cross section Scatter2D temphisto2(refData(2, 1, 1)); - hadrons = bookScatter2D(2, 1, 1); + book(hadrons, 2, 1, 1); for (size_t b = 0; b < temphisto2.numPoints(); b++) { const double x = temphisto2.point(b).x(); pair ex = temphisto2.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); } else { hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(PLUTO_1982_I166799); } diff --git a/analyses/pluginPetra/TASSO_1979_I140303.cc b/analyses/pluginPetra/TASSO_1979_I140303.cc --- a/analyses/pluginPetra/TASSO_1979_I140303.cc +++ b/analyses/pluginPetra/TASSO_1979_I140303.cc @@ -1,101 +1,104 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class TASSO_1979_I140303 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TASSO_1979_I140303); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TASSO_1979_I140303); } diff --git a/analyses/pluginPetra/TASSO_1980_I143690.cc b/analyses/pluginPetra/TASSO_1980_I143690.cc --- a/analyses/pluginPetra/TASSO_1980_I143690.cc +++ b/analyses/pluginPetra/TASSO_1980_I143690.cc @@ -1,101 +1,104 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class TASSO_1980_I143690 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TASSO_1980_I143690); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else { - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TASSO_1980_I143690); } diff --git a/analyses/pluginPetra/TASSO_1982_I176887.cc b/analyses/pluginPetra/TASSO_1982_I176887.cc --- a/analyses/pluginPetra/TASSO_1982_I176887.cc +++ b/analyses/pluginPetra/TASSO_1982_I176887.cc @@ -1,102 +1,105 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class TASSO_1982_I176887 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TASSO_1982_I176887); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; for(unsigned int ix=1;ix<4;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - ostringstream title; + std::ostringstream title; title << "d0" << ix << "_sigma"; - Scatter2DPtr hadrons = bookScatter2D(title.str() + "_hadrons"); - Scatter2DPtr muons = bookScatter2D(title.str() + "_muons" ); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, title.str() + "_hadrons"); + Scatter2DPtr muons; + book(muons, title.str() + "_muons" ); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TASSO_1982_I176887); } diff --git a/analyses/pluginPetra/TASSO_1984_I195333.cc b/analyses/pluginPetra/TASSO_1984_I195333.cc --- a/analyses/pluginPetra/TASSO_1984_I195333.cc +++ b/analyses/pluginPetra/TASSO_1984_I195333.cc @@ -1,248 +1,252 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/Sphericity.hh" #include "Rivet/Projections/Thrust.hh" namespace Rivet { /// @brief Add a short analysis description here class TASSO_1984_I195333 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TASSO_1984_I195333); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections const FinalState fs; declare(fs, "FS"); declare(Sphericity(fs), "Sphericity"); declare(Thrust(fs), "Thrust"); // counters for R - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); - _h_weight = 0.; + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); + book(_h_weight, "/TMP/HWeight"); unsigned int iloc(0); if(fuzzyEquals(sqrtS()/GeV, 14 , 1E-3)) iloc = 1; else if(fuzzyEquals(sqrtS()/GeV, 22 , 1E-3)) iloc = 2; else if(fuzzyEquals(sqrtS()/GeV, 34 , 1E-3)) iloc = 3; if(iloc!=0) { - _h_mult = bookHisto1D( 3,1,iloc); - _h_p = bookHisto1D( 5,1,iloc); - _h_xp = bookHisto1D( 6,1,iloc); - _h_pl = bookHisto1D( 7,1,iloc); - _h_pt = bookHisto1D( 8,1,iloc); - _h_pt2 = bookHisto1D( 9,1,iloc); - _h_xl = bookHisto1D(10,1,iloc); - _h_xT = bookHisto1D(11,1,iloc); - _h_S = bookHisto1D(12,1,iloc); - _h_T = bookHisto1D(13,1,iloc); - _h_y = bookHisto1D(14,1,iloc); + book(_h_mult, 3,1,iloc); + book(_h_p, 5,1,iloc); + book(_h_xp, 6,1,iloc); + book(_h_pl, 7,1,iloc); + book(_h_pt, 8,1,iloc); + book(_h_pt2, 9,1,iloc); + book(_h_xl, 10,1,iloc); + book(_h_xT, 11,1,iloc); + book(_h_S, 12,1,iloc); + book(_h_T, 13,1,iloc); + book(_h_y, 14,1,iloc); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); unsigned int nCharged(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - if(PID::isCharged(p.pdgId())) ++nCharged; + if(PID::isCharged(p.pid())) ++nCharged; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) { - _c_muons->fill(event.weight()); + _c_muons->fill(); return; } // everything else - _c_hadrons->fill(event.weight()); - _h_weight +=event.weight(); - _n_charged.fill(nCharged,event.weight()); - _n_total.fill(ntotal,event.weight()); + _c_hadrons->fill(); + _h_weight->fill(); + _n_charged.fill(nCharged); + _n_total.fill(ntotal); // thrust const Thrust& thrust = apply(event, "Thrust"); - _thrust.fill(thrust.thrust(),event.weight()); + _thrust.fill(thrust.thrust()); // sphericity const Sphericity& sphericity = apply(event, "Sphericity"); - _sphericity.fill(sphericity.sphericity(), event.weight()); + _sphericity.fill(sphericity.sphericity()); // global distributions - if(_h_mult) _h_mult->fill(nCharged,event.weight()); - if(_h_S) _h_S ->fill(sphericity.sphericity(), event.weight()); - if(_h_T) _h_T ->fill(thrust.thrust(), event.weight()); + if(_h_mult) _h_mult->fill(nCharged); + if(_h_S) _h_S ->fill(sphericity.sphericity()); + if(_h_T) _h_T ->fill(thrust.thrust()); // single particle distributions - foreach (const Particle& p, fs.particles()) { - if(!PID::isCharged(p.pdgId())) continue; + for (const Particle& p : fs.particles()) { + if(!PID::isCharged(p.pid())) continue; const Vector3 mom3 = p.p3(); double pp = mom3.mod(); _p_total.fill(pp); - if(_h_p) _h_p ->fill(pp,event.weight()); - if(_h_xp) _h_xp->fill(2.*pp/sqrtS(),event.weight()); + if(_h_p) _h_p ->fill(pp); + if(_h_xp) _h_xp->fill(2.*pp/sqrtS()); const double mom = dot(sphericity.sphericityAxis(), mom3); - _p_l.fill(fabs(mom),event.weight()); - if(_h_pl) _h_pl->fill(fabs(mom),event.weight()); - if(_h_xl) _h_xl->fill(2.*fabs(mom)/sqrtS(),event.weight()); + _p_l.fill(fabs(mom)); + if(_h_pl) _h_pl->fill(fabs(mom)); + if(_h_xl) _h_xl->fill(2.*fabs(mom)/sqrtS()); const double pTin = dot(mom3, sphericity.sphericityMajorAxis()); - _pt2_in.fill(sqr(pTin),event.weight()); + _pt2_in.fill(sqr(pTin)); const double pTout = dot(mom3, sphericity.sphericityMinorAxis()); - _pt2_out.fill(sqr(pTout),event.weight()); + _pt2_out.fill(sqr(pTout)); double pT = sqr(pTin) + sqr(pTout); - _pt2.fill(pT,event.weight()); - if(_h_pt2) _h_pt2->fill(pT,event.weight()); + _pt2.fill(pT); + if(_h_pt2) _h_pt2->fill(pT); pT=sqrt(pT); - _pt.fill(pT,event.weight()); - if(_h_pt) _h_pt->fill(pT,event.weight()); - if(_h_xT) _h_xT->fill(2.*pT/sqrtS(),event.weight()); + _pt.fill(pT); + if(_h_pt) _h_pt->fill(pT); + if(_h_xT) _h_xT->fill(2.*pT/sqrtS()); if(_h_y) { const double rap = 0.5 * log((p.E() + mom) / (p.E() - mom)); - _h_y->fill(fabs(rap),event.weight()); + _h_y->fill(fabs(rap)); } } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } // charged particle multiplicity distribution if(_h_mult) normalize(_h_mult,2.); for(unsigned int iy=1;iy<12;++iy) { - double value,error; + double value = 0.0, error = 0.0; if(iy==1) { value = _n_charged.xMean(); error = _n_charged.xStdErr(); } else if(iy==2) { double num = _n_charged.xMean(); double den = _n_total.xMean(); value = num/den; error = value*sqrt(sqr(_n_charged.xStdErr()/num)+sqr(_n_total.xStdErr()/den)); } else if(iy==3) { value = _n_charged.xStdDev(); error = _n_charged.xStdErr(); } else if(iy==4) { value = _sphericity.xMean(); error = _sphericity.xStdErr(); } else if(iy==5) { value = _thrust.xMean(); error = _thrust.xStdErr(); } else if(iy==6) { value = _p_total.xMean(); error = _p_total.xStdErr(); } else if(iy==7) { value = _p_l.xMean(); error = _p_l.xStdErr(); } else if(iy==8) { value = _pt.xMean(); error = _pt.xStdErr(); } else if(iy==9) { value = _pt2.xMean(); error = _pt2.xStdErr(); } else if(iy==10) { value = _pt2_in.xMean(); error = _pt2_in.xStdErr(); } else if(iy==11) { value = _pt2_out.xMean(); error = _pt2_out.xStdErr(); } Scatter2D temphisto(refData(4, 1, iy)); - Scatter2DPtr mult = bookScatter2D(4, 1, iy); + Scatter2DPtr mult; + book(mult, 4, 1, iy); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, value, ex, make_pair(error,error)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } // scale the distributions - scale(_h_p ,1./_h_weight); - scale(_h_xp ,1./_h_weight); - scale(_h_pl ,1./_h_weight); - scale(_h_pt ,1./_h_weight); - scale(_h_pt2,1./_h_weight); - scale(_h_xl ,1./_h_weight); - scale(_h_xT ,1./_h_weight); - scale(_h_S ,1./_h_weight); - scale(_h_T ,1./_h_weight); - scale(_h_y ,1./_h_weight); + scale(_h_p ,1./_h_weight->sumW()); + scale(_h_xp ,1./_h_weight->sumW()); + scale(_h_pl ,1./_h_weight->sumW()); + scale(_h_pt ,1./_h_weight->sumW()); + scale(_h_pt2,1./_h_weight->sumW()); + scale(_h_xl ,1./_h_weight->sumW()); + scale(_h_xT ,1./_h_weight->sumW()); + scale(_h_S ,1./_h_weight->sumW()); + scale(_h_T ,1./_h_weight->sumW()); + scale(_h_y ,1./_h_weight->sumW()); } //@} /// @name Histograms //@{ Histo1DPtr _h_mult,_h_p,_h_xp,_h_pl,_h_pt,_h_pt2,_h_xl,_h_xT,_h_S,_h_T,_h_y; CounterPtr _c_hadrons, _c_muons; YODA::Dbn1D _n_charged,_n_total,_sphericity,_thrust,_p_total, _p_l,_pt,_pt2,_pt2_in,_pt2_out; - double _h_weight; + CounterPtr _h_weight; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TASSO_1984_I195333); } diff --git a/analyses/pluginPetra/TASSO_1984_I199468.cc b/analyses/pluginPetra/TASSO_1984_I199468.cc --- a/analyses/pluginPetra/TASSO_1984_I199468.cc +++ b/analyses/pluginPetra/TASSO_1984_I199468.cc @@ -1,101 +1,104 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class TASSO_1984_I199468 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TASSO_1984_I199468); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - ostringstream title; + std::ostringstream title; title << "d0" << ix; - Scatter2DPtr hadrons = bookScatter2D(title.str()+"_sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D(title.str()+"_sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, title.str()+"_sigma_hadrons"); + Scatter2DPtr muons; + book(muons, title.str()+"_sigma_muons" ); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TASSO_1984_I199468); } diff --git a/analyses/pluginSLAC/CRYSTAL_BALL_1986_I238081.cc b/analyses/pluginSLAC/CRYSTAL_BALL_1986_I238081.cc --- a/analyses/pluginSLAC/CRYSTAL_BALL_1986_I238081.cc +++ b/analyses/pluginSLAC/CRYSTAL_BALL_1986_I238081.cc @@ -1,141 +1,145 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class CRYSTAL_BALL_1986_I238081 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CRYSTAL_BALL_1986_I238081); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); - _c_D_star = bookCounter("/TMP/sigma_D_star"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); + book(_c_D_star, "/TMP/sigma_D_star"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); const FinalState& ufs = apply(event, "UFS"); bool found = false; - foreach(const Particle & p, ufs.particles()) { - if(abs(p.pdgId())!=413 && abs(p.pdgId())!=423) continue; + for (const Particle & p : ufs.particles()) { + if(abs(p.pid())!=413 && abs(p.pid())!=423) continue; bool fs = true; - foreach(const Particle & child, p.children()) { - if(child.pdgId()==p.pdgId()) { + for (const Particle & child : p.children()) { + if(child.pid()==p.pid()) { fs = false; break; } } if(fs) { found = true; break; } } if(found) - _c_D_star->fill(event.weight()); + _c_D_star->fill(); } /// Normalise histograms etc., after the run void finalize() { // R Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } // D* fact = crossSection()/ sumOfWeights() /nanobarn; double sigma = _c_D_star->val()*fact; double error = _c_D_star->err()*fact; Scatter2D temphisto2(refData(2, 1, 1)); - Scatter2DPtr mult2 = bookScatter2D(2, 1, 1); + Scatter2DPtr mult2; + book(mult2, 2, 1, 1); for (size_t b = 0; b < temphisto2.numPoints(); b++) { const double x = temphisto2.point(b).x(); pair ex = temphisto2.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult2 ->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult2 ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons,_c_D_star; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CRYSTAL_BALL_1986_I238081); } diff --git a/analyses/pluginSLAC/CRYSTAL_BALL_1990_I294419.cc b/analyses/pluginSLAC/CRYSTAL_BALL_1990_I294419.cc --- a/analyses/pluginSLAC/CRYSTAL_BALL_1990_I294419.cc +++ b/analyses/pluginSLAC/CRYSTAL_BALL_1990_I294419.cc @@ -1,103 +1,106 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class CRYSTAL_BALL_1990_I294419 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(CRYSTAL_BALL_1990_I294419); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; for(unsigned int ix=1;ix<3;++ix) { Scatter2D temphisto(refData(ix, 1, 1)); - ostringstream title; + std::ostringstream title; title << "d0" << ix; - Scatter2DPtr hadrons = bookScatter2D(title.str()+"sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D(title.str()+"sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, title.str()+"sigma_hadrons"); + Scatter2DPtr muons; + book(muons, title.str()+"sigma_muons" ); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(CRYSTAL_BALL_1990_I294419); } diff --git a/analyses/pluginSLAC/MAC_1985_I206052.cc b/analyses/pluginSLAC/MAC_1985_I206052.cc --- a/analyses/pluginSLAC/MAC_1985_I206052.cc +++ b/analyses/pluginSLAC/MAC_1985_I206052.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MAC_1985_I206052 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MAC_1985_I206052); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MAC_1985_I206052); } diff --git a/analyses/pluginSLAC/MARKII_1979_I143939.cc b/analyses/pluginSLAC/MARKII_1979_I143939.cc --- a/analyses/pluginSLAC/MARKII_1979_I143939.cc +++ b/analyses/pluginSLAC/MARKII_1979_I143939.cc @@ -1,180 +1,183 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKII_1979_I143939 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKII_1979_I143939); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); declare(UnstableParticles(), "UFS"); - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); - _c_DD = bookCounter("/TMP/sigma_DD"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); + book(_c_DD, "/TMP/sigma_DD"); } void findChildren(const Particle & p,map & nRes, int &ncount) { - foreach(const Particle &child, p.children()) { + for (const Particle &child : p.children()) { if(child.children().empty()) { - nRes[child.pdgId()]-=1; + nRes[child.pid()]-=1; --ncount; } else findChildren(child,nRes,ncount); } } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); // total hadronic and muonic cross sections map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); // identified final state with D mesons const FinalState& ufs = apply(event, "UFS"); for(unsigned int ix=0;ix nRes = nCount; int ncount = ntotal; findChildren(p1,nRes,ncount); // loop over the other fs particles for(unsigned int iy=ix+1;iy nRes2 = nRes; int ncount2 = ncount; findChildren(p2,nRes2,ncount2); if(ncount2!=0) continue; matched=true; for(auto const & val : nRes2) { if(val.second!=0) { matched = false; break; } } if(matched) { - _c_DD ->fill(event.weight()); + _c_DD ->fill(); break; } } if(matched) break; } } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /nanobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(2, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(2,1,1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 2,1,1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } double sigma = _c_DD->val()*fact; double error = _c_DD->err()*fact; Scatter2D temphisto2(refData(3, 1, 1)); - mult = bookScatter2D(3,1,1); + book(mult, 3,1,1); for (size_t b = 0; b < temphisto2.numPoints(); b++) { const double x = temphisto2.point(b).x(); pair ex = temphisto2.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons, _c_DD; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKII_1979_I143939); } diff --git a/analyses/pluginSLAC/MARKII_1991_I295286.cc b/analyses/pluginSLAC/MARKII_1991_I295286.cc --- a/analyses/pluginSLAC/MARKII_1991_I295286.cc +++ b/analyses/pluginSLAC/MARKII_1991_I295286.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKII_1991_I295286 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKII_1991_I295286); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKII_1991_I295286); } diff --git a/analyses/pluginSLAC/MARKI_1975_I100592.cc b/analyses/pluginSLAC/MARKI_1975_I100592.cc --- a/analyses/pluginSLAC/MARKI_1975_I100592.cc +++ b/analyses/pluginSLAC/MARKI_1975_I100592.cc @@ -1,85 +1,86 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/ChargedFinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKI_1975_I100592 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKI_1975_I100592); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(ChargedFinalState(), "FS"); // Book histograms - _nHadrons= bookCounter("TMP/hadrons"); - _nEvent= bookCounter("TMP/event"); + book(_nHadrons, "TMP/hadrons"); + book(_nEvent, "TMP/event"); } /// Perform the per-event analysis void analyze(const Event& event) { const ChargedFinalState& fs = apply(event, "FS"); - _nEvent->fill(event.weight()); - _nHadrons->fill(fs.particles().size()*event.weight()); + _nEvent->fill(); + _nHadrons->fill(fs.particles().size()); } /// Normalise histograms etc., after the run void finalize() { for(unsigned int ix=1;ix<3;++ix) { double sigma,error; if(ix==1) { sigma = _nEvent->val()*crossSection()/ sumOfWeights() /nanobarn; error = _nEvent->err()*crossSection()/ sumOfWeights() /nanobarn; } else { sigma = _nHadrons->val()/sumOfWeights(); error = _nHadrons->err()/sumOfWeights(); } Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _nHadrons,_nEvent; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKI_1975_I100592); } diff --git a/analyses/pluginSLAC/MARKI_1975_I100733.cc b/analyses/pluginSLAC/MARKI_1975_I100733.cc --- a/analyses/pluginSLAC/MARKI_1975_I100733.cc +++ b/analyses/pluginSLAC/MARKI_1975_I100733.cc @@ -1,113 +1,116 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKI_1975_I100733 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKI_1975_I100733); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); - // if(inRange(sqrtS()/GeV,2.999,3.001)) - // _h_charged = bookHisto1D(3, 1, 1); - // else if(inRange(sqrtS()/GeV,4.799,4.801)) - // _h_charged = bookHisto1D(3, 1, 2); - // else if(inRange(sqrtS()/GeV,7.399,7.401)) - // _h_charged = bookHisto1D(3, 1, 3); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); + // // if(inRange(sqrtS()/GeV,2.999,3.001)) + // book(_h_charged, 3, 1, 1); + // // else if(inRange(sqrtS()/GeV,4.799,4.801)) + // book(_h_charged, 3, 1, 2); + // // else if(inRange(sqrtS()/GeV,7.399,7.401)) + // book(_h_charged, 3, 1, 3); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; - // if(PID::isCharged(p.pdgId())&&_h_charged&&abs(p.pdgId())!=13) { + // if(PID::isCharged(p.pid())&&_h_charged&&abs(p.pid())!=13) { // double x = 2.*p.p3().mod()/sqrtS(); - // _h_charged->fill(x,event.weight()); + // _h_charged->fill(x); // } } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { // if(_h_charged) { // //scale(_h_charged, crossSection()/ sumOfWeights() /microbarn*sqr(sqrtS())); // } // R Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /nanobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D(1,1,1); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(2,1,1); + Scatter2DPtr hadrons; + book(hadrons, 1,1,1); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 2,1,1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; // Histo1DPtr _h_charged; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKI_1975_I100733); } diff --git a/analyses/pluginSLAC/MARKI_1976_I108144.cc b/analyses/pluginSLAC/MARKI_1976_I108144.cc --- a/analyses/pluginSLAC/MARKI_1976_I108144.cc +++ b/analyses/pluginSLAC/MARKI_1976_I108144.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKI_1976_I108144 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKI_1976_I108144); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKI_1976_I108144); } diff --git a/analyses/pluginSLAC/MARKI_1977_I119979.cc b/analyses/pluginSLAC/MARKI_1977_I119979.cc --- a/analyses/pluginSLAC/MARKI_1977_I119979.cc +++ b/analyses/pluginSLAC/MARKI_1977_I119979.cc @@ -1,101 +1,105 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKI_1977_I119979 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKI_1977_I119979); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { // R Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /nanobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("simga_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult1 = bookScatter2D(1,1,1); - Scatter2DPtr mult2 = bookScatter2D(2,1,1); + Scatter2DPtr hadrons; + book(hadrons, "simga_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult1; + book(mult1, 1,1,1); + Scatter2DPtr mult2; + book(mult2, 2,1,1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult1 ->addPoint(x, rval, ex, rerr); mult2 ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult1 ->addPoint(x, 0., ex, make_pair(0.,.0)); mult2 ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKI_1977_I119979); } diff --git a/analyses/pluginSLAC/MARKI_1982_I169326.cc b/analyses/pluginSLAC/MARKI_1982_I169326.cc --- a/analyses/pluginSLAC/MARKI_1982_I169326.cc +++ b/analyses/pluginSLAC/MARKI_1982_I169326.cc @@ -1,75 +1,76 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/ChargedFinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class MARKI_1982_I169326 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(MARKI_1982_I169326); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(ChargedFinalState(), "FS"); // Book histograms - _nHadrons= bookCounter("TMP/hadrons"); + book(_nHadrons, "TMP/hadrons"); } /// Perform the per-event analysis void analyze(const Event& event) { const ChargedFinalState& fs = apply(event, "FS"); - _nHadrons->fill(fs.particles().size()*event.weight()); + _nHadrons->fill(fs.particles().size()); } /// Normalise histograms etc., after the run void finalize() { double sigma = _nHadrons->val()/sumOfWeights(); double error = _nHadrons->err()/sumOfWeights(); Scatter2D temphisto(refData(6, 1, 1)); - Scatter2DPtr mult = bookScatter2D(6, 1, 1); + Scatter2DPtr mult; + book(mult, 6, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _nHadrons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(MARKI_1982_I169326); } diff --git a/analyses/pluginTristan/AMY_1990_I294525.cc b/analyses/pluginTristan/AMY_1990_I294525.cc --- a/analyses/pluginTristan/AMY_1990_I294525.cc +++ b/analyses/pluginTristan/AMY_1990_I294525.cc @@ -1,98 +1,101 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class AMY_1990_I294525 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(AMY_1990_I294525); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(AMY_1990_I294525); } diff --git a/analyses/pluginTristan/TOPAZ_1990_I283003.cc b/analyses/pluginTristan/TOPAZ_1990_I283003.cc --- a/analyses/pluginTristan/TOPAZ_1990_I283003.cc +++ b/analyses/pluginTristan/TOPAZ_1990_I283003.cc @@ -1,98 +1,101 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class TOPAZ_1990_I283003 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TOPAZ_1990_I283003); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TOPAZ_1990_I283003); } diff --git a/analyses/pluginTristan/TOPAZ_1993_I353845.cc b/analyses/pluginTristan/TOPAZ_1993_I353845.cc --- a/analyses/pluginTristan/TOPAZ_1993_I353845.cc +++ b/analyses/pluginTristan/TOPAZ_1993_I353845.cc @@ -1,97 +1,98 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class TOPAZ_1993_I353845 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TOPAZ_1993_I353845); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /picobarn; for(unsigned int ix=2;ix<5;ix+=2) { double sigma,error; if(ix==2) { sigma = _c_hadrons->val()*fact; error = _c_hadrons->err()*fact; } else { sigma = _c_muons ->val()*fact; error = _c_muons ->err()*fact; } Scatter2D temphisto(refData(ix, 1, 1)); - Scatter2DPtr mult = bookScatter2D(ix, 1, 1); + Scatter2DPtr mult; + book(mult, ix, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TOPAZ_1993_I353845); } diff --git a/analyses/pluginTristan/TOPAZ_1995_I381777.cc b/analyses/pluginTristan/TOPAZ_1995_I381777.cc --- a/analyses/pluginTristan/TOPAZ_1995_I381777.cc +++ b/analyses/pluginTristan/TOPAZ_1995_I381777.cc @@ -1,87 +1,88 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class TOPAZ_1995_I381777 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(TOPAZ_1995_I381777); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) vetoEvent; // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /picobarn; double sigma = _c_hadrons->val()*fact; double error = _c_hadrons->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(TOPAZ_1995_I381777); } diff --git a/analyses/pluginTristan/VENUS_1987_I251274.cc b/analyses/pluginTristan/VENUS_1987_I251274.cc --- a/analyses/pluginTristan/VENUS_1987_I251274.cc +++ b/analyses/pluginTristan/VENUS_1987_I251274.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class VENUS_1987_I251274 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(VENUS_1987_I251274); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(VENUS_1987_I251274); } diff --git a/analyses/pluginTristan/VENUS_1990_I283774.cc b/analyses/pluginTristan/VENUS_1990_I283774.cc --- a/analyses/pluginTristan/VENUS_1990_I283774.cc +++ b/analyses/pluginTristan/VENUS_1990_I283774.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class VENUS_1990_I283774 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(VENUS_1990_I283774); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(VENUS_1990_I283774); } diff --git a/analyses/pluginTristan/VENUS_1990_I296392.cc b/analyses/pluginTristan/VENUS_1990_I296392.cc --- a/analyses/pluginTristan/VENUS_1990_I296392.cc +++ b/analyses/pluginTristan/VENUS_1990_I296392.cc @@ -1,99 +1,102 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class VENUS_1990_I296392 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(VENUS_1990_I296392); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); - _c_muons = bookCounter("/TMP/sigma_muons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); + book(_c_muons, "/TMP/sigma_muons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) - _c_muons->fill(event.weight()); + _c_muons->fill(); // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { Scatter1D R = *_c_hadrons/ *_c_muons; double rval = R.point(0).x(); pair rerr = R.point(0).xErrs(); double fact = crossSection()/ sumOfWeights() /picobarn; double sig_h = _c_hadrons->val()*fact; double err_h = _c_hadrons->err()*fact; double sig_m = _c_muons ->val()*fact; double err_m = _c_muons ->err()*fact; Scatter2D temphisto(refData(3, 1, 1)); - Scatter2DPtr hadrons = bookScatter2D("sigma_hadrons"); - Scatter2DPtr muons = bookScatter2D("sigma_muons" ); - Scatter2DPtr mult = bookScatter2D(3, 1, 1); + Scatter2DPtr hadrons; + book(hadrons, "sigma_hadrons"); + Scatter2DPtr muons; + book(muons, "sigma_muons" ); + Scatter2DPtr mult; + book(mult, 3, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, rval, ex, rerr); hadrons->addPoint(x, sig_h, ex, make_pair(err_h,err_h)); muons ->addPoint(x, sig_m, ex, make_pair(err_m,err_m)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); hadrons->addPoint(x, 0., ex, make_pair(0.,.0)); muons ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons, _c_muons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(VENUS_1990_I296392); } diff --git a/analyses/pluginTristan/VENUS_1999_I500179.cc b/analyses/pluginTristan/VENUS_1999_I500179.cc --- a/analyses/pluginTristan/VENUS_1999_I500179.cc +++ b/analyses/pluginTristan/VENUS_1999_I500179.cc @@ -1,87 +1,88 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/FinalState.hh" namespace Rivet { /// @brief Add a short analysis description here class VENUS_1999_I500179 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(VENUS_1999_I500179); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(FinalState(), "FS"); // Book histograms - _c_hadrons = bookCounter("/TMP/sigma_hadrons"); + book(_c_hadrons, "/TMP/sigma_hadrons"); } /// Perform the per-event analysis void analyze(const Event& event) { const FinalState& fs = apply(event, "FS"); map nCount; int ntotal(0); - foreach (const Particle& p, fs.particles()) { - nCount[p.pdgId()] += 1; + for (const Particle& p : fs.particles()) { + nCount[p.pid()] += 1; ++ntotal; } // mu+mu- + photons if(nCount[-13]==1 and nCount[13]==1 && ntotal==2+nCount[22]) vetoEvent; // everything else else - _c_hadrons->fill(event.weight()); + _c_hadrons->fill(); } /// Normalise histograms etc., after the run void finalize() { double fact = crossSection()/ sumOfWeights() /picobarn; double sigma = _c_hadrons->val()*fact; double error = _c_hadrons->err()*fact; Scatter2D temphisto(refData(1, 1, 1)); - Scatter2DPtr mult = bookScatter2D(1, 1, 1); + Scatter2DPtr mult; + book(mult, 1, 1, 1); for (size_t b = 0; b < temphisto.numPoints(); b++) { const double x = temphisto.point(b).x(); pair ex = temphisto.point(b).xErrs(); pair ex2 = ex; if(ex2.first ==0.) ex2. first=0.0001; if(ex2.second==0.) ex2.second=0.0001; if (inRange(sqrtS()/GeV, x-ex2.first, x+ex2.second)) { mult ->addPoint(x, sigma, ex, make_pair(error,error)); } else { mult ->addPoint(x, 0., ex, make_pair(0.,.0)); } } } //@} /// @name Histograms //@{ CounterPtr _c_hadrons; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(VENUS_1999_I500179); } diff --git a/bin/rivet b/bin/rivet --- a/bin/rivet +++ b/bin/rivet @@ -1,688 +1,673 @@ #! /usr/bin/env python """\ Run Rivet analyses on HepMC events read from a file or Unix pipe Examples: %(prog)s [options] [ ...] or mkfifo fifo.hepmc my_generator -o fifo.hepmc & %(prog)s [options] fifo.hepmc ENVIRONMENT: * RIVET_ANALYSIS_PATH: list of paths to be searched for plugin analysis libraries at runtime * RIVET_DATA_PATH: list of paths to be searched for data files (defaults to use analysis path) * RIVET_WEIGHT_INDEX: the numerical weight-vector index to use in this run (default = 0; -1 = ignore weights) * See the documentation for more environment variables. """ from __future__ import print_function import os, sys ## Load the rivet module try: import rivet except: ## If rivet loading failed, try to bootstrap the Python path! try: # TODO: Is this a good idea? Maybe just notify the user that their PYTHONPATH is wrong? import commands modname = sys.modules[__name__].__file__ binpath = os.path.dirname(modname) rivetconfigpath = os.path.join(binpath, "rivet-config") rivetpypath = commands.getoutput(rivetconfigpath + " --pythonpath") sys.path.append(rivetpypath) import rivet except: sys.stderr.write("The rivet Python module could not be loaded: is your PYTHONPATH set correctly?\n") sys.exit(5) rivet.util.check_python_version() rivet.util.set_process_name("rivet") import time, datetime, logging, signal ## Parse command line options import argparse parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("ARGS", nargs="*") parser.add_argument("--version", dest="SHOW_VERSION", action="store_true", default=False, help="show Rivet version") anagroup = parser.add_argument_group("Analysis handling") anagroup.add_argument("-a", "--analysis", "--analyses", dest="ANALYSES", action="append", default=[], metavar="ANA", help="add an analysis (or comma-separated list of analyses) to the processing list.") anagroup.add_argument("--list-analyses", "--list", dest="LIST_ANALYSES", action="store_true", default=False, help="show the list of available analyses' names. With -v, it shows the descriptions, too") anagroup.add_argument("--list-keywords", "--keywords", dest="LIST_KEYWORDS", action="store_true", default=False, help="show the list of available keywords.") anagroup.add_argument("--list-used-analyses", action="store_true", dest="LIST_USED_ANALYSES", default=False, help="list the analyses used by this command (after subtraction of inappropriate ones)") anagroup.add_argument("--show-analysis", "--show-analyses", "--show", dest="SHOW_ANALYSES", action="append", default=[], help="show the details of an analysis") anagroup.add_argument("--show-bibtex", dest="SHOW_BIBTEX", action="store_true", default=False, help="show BibTeX entries for all used analyses") anagroup.add_argument("--analysis-path", dest="ANALYSIS_PATH", metavar="PATH", default=None, help="specify the analysis search path (cf. $RIVET_ANALYSIS_PATH).") # TODO: remove/deprecate the append? anagroup.add_argument("--analysis-path-append", dest="ANALYSIS_PATH_APPEND", metavar="PATH", default=None, help="append to the analysis search path (cf. $RIVET_ANALYSIS_PATH).") anagroup.add_argument("--pwd", dest="ANALYSIS_PATH_PWD", action="store_true", default=False, help="append the current directory (pwd) to the analysis/data search paths (cf. $RIVET_ANALYSIS_PATH).") extragroup = parser.add_argument_group("Extra run settings") extragroup.add_argument("-o", "-H", "--histo-file", dest="HISTOFILE", default="Rivet.yoda", help="specify the output histo file path (default = %(default)s)") extragroup.add_argument("-p", "--preload-file", dest="PRELOADFILE", default=None, help="specify and old yoda file to initialize (default = %(default)s)") extragroup.add_argument("--no-histo-file", dest="WRITE_DATA", action="store_false", default=True, help="don't write out any histogram file at the end of the run (default = write)") extragroup.add_argument("-x", "--cross-section", dest="CROSS_SECTION", default=None, metavar="XS", help="specify the signal process cross-section in pb") extragroup.add_argument("-n", "--nevts", dest="MAXEVTNUM", type=int, default=None, metavar="NUM", help="restrict the max number of events to process") extragroup.add_argument("--nskip", dest="EVTSKIPNUM", type=int, default=0, metavar="NUM", help="skip NUM events read from input before beginning processing") extragroup.add_argument("--runname", dest="RUN_NAME", default=None, metavar="NAME", help="give an optional run name, to be prepended as a 'top level directory' in histo paths") extragroup.add_argument("--ignore-beams", dest="IGNORE_BEAMS", action="store_true", default=False, help="ignore input event beams when checking analysis compatibility. " "WARNING: analyses may not work correctly, or at all, with inappropriate beams") extragroup.add_argument("-d", "--dump", "--histo-interval", dest="DUMP_PERIOD", type=int, default=1000, metavar="NUM", help="specify the number of events between histogram file updates, " "default = %(default)s. Set to 0 to only write out at the end of the run. " "Note that intermediate histograms will be those from the analyze step " "only, except for analyses explicitly declared Reentrant for which the " "finalize function is executed first.") timinggroup = parser.add_argument_group("Timeouts and periodic operations") timinggroup.add_argument("--event-timeout", dest="EVENT_TIMEOUT", type=int, default=21600, metavar="NSECS", help="max time in whole seconds to wait for an event to be generated from the specified source (default = %(default)s)") timinggroup.add_argument("--run-timeout", dest="RUN_TIMEOUT", type=int, default=None, metavar="NSECS", help="max time in whole seconds to wait for the run to finish. This can be useful on batch systems such " "as the LCG Grid where tokens expire on a fixed wall-clock and can render long Rivet runs unable to write " "out the final histogram file (default = unlimited)") - verbgroup = parser.add_argument_group("Verbosity control") parser.add_argument("-l", dest="NATIVE_LOG_STRS", action="append", default=[], help="set a log level in the Rivet library") verbgroup.add_argument("-v", "--verbose", action="store_const", const=logging.DEBUG, dest="LOGLEVEL", default=logging.INFO, help="print debug (very verbose) messages") verbgroup.add_argument("-q", "--quiet", action="store_const", const=logging.WARNING, dest="LOGLEVEL", default=logging.INFO, help="be very quiet") args = parser.parse_args() -timinggroup = OptionGroup(parser, "Timeouts and periodic operations") -timinggroup.add_option("--event-timeout", dest="EVENT_TIMEOUT", type="int", - default=21600, metavar="NSECS", - help="max time in whole seconds to wait for an event to be generated from the specified source (default = %default)") -timinggroup.add_option("--run-timeout", dest="RUN_TIMEOUT", type="int", - default=None, metavar="NSECS", - help="max time in whole seconds to wait for the run to finish. This can be useful on batch systems such " - "as the LCG Grid where tokens expire on a fixed wall-clock and can render long Rivet runs unable to write " - "out the final histogram file (default = unlimited)") -timinggroup.add_option("--histo-interval", dest="HISTO_WRITE_INTERVAL", type=int, - default=1000, help="specify the number of events between histogram file updates, default = %default. " - "Set to 0 to only write out at the end of the run. Note that intermediate histograms will be those " - "from the analyze step only: analysis finalizing is currently not executed until the end of the run.") -parser.add_option_group(timinggroup) ## Print the version and exit if args.SHOW_VERSION: print("rivet v%s" % rivet.version()) sys.exit(0) ## Override/modify analysis search path if args.ANALYSIS_PATH: rivet.setAnalysisLibPaths(args.ANALYSIS_PATH.split(":")) rivet.setAnalysisDataPaths(args.ANALYSIS_PATH.split(":")) if args.ANALYSIS_PATH_APPEND: for ap in args.ANALYSIS_PATH_APPEND.split(":"): rivet.addAnalysisLibPath(ap) rivet.addAnalysisDataPath(ap) if args.ANALYSIS_PATH_PWD: rivet.addAnalysisLibPath(os.path.abspath(".")) rivet.addAnalysisDataPath(os.path.abspath(".")) ## Configure logging logging.basicConfig(level=args.LOGLEVEL, format="%(message)s") for l in args.NATIVE_LOG_STRS: name, level = None, None try: name, level = l.split("=") except: name = "Rivet" level = l ## Fix name if name != "Rivet" and not name.startswith("Rivet."): name = "Rivet." + name try: ## Get right error type level = rivet.LEVELS.get(level.upper(), None) logging.debug("Setting log level: %s %d" % (name, level)) rivet.setLogLevel(name, level) except: logging.warning("Couldn't process logging string '%s'" % l) ############################ ## Listing available analyses/keywords def getAnalysesByKeyword(alist, kstring): add, veto, ret = [], [], [] bits = [i for i in kstring.replace("^@", "@^").split("@") if len(i) > 0] for b in bits: if b.startswith("^"): veto.append(b.strip("^")) else: add.append(b) add = set(add) veto = set(veto) for a in alist: kwds = set([i.lower() for i in rivet.AnalysisLoader.getAnalysis(a).keywords()]) if kwds.intersection(veto) and len(kwds.intersection(add)) == len(list(add)): ret.append(a) return ret ## List of analyses all_analyses = rivet.AnalysisLoader.analysisNames() if args.LIST_ANALYSES: ## Treat args as case-insensitive regexes if present regexes = None if args.ARGS: import re regexes = [re.compile(arg, re.I) for arg in args.ARGS] # import tempfile, subprocess # tf, tfpath = tempfile.mkstemp(prefix="rivet-list.") names = [] msg = [] for aname in all_analyses: if not regexes: toshow = True else: toshow = False for regex in regexes: if regex.search(aname): toshow = True break if toshow: names.append(aname) msg.append('') if args.LOGLEVEL <= logging.INFO: a = rivet.AnalysisLoader.getAnalysis(aname) st = "" if a.status() == "VALIDATED" else ("[%s] " % a.status()) # detex will very likely introduce some non-ASCII chars from # greek names in analysis titles. # The u"" prefix and explicit print encoding are necessary for # py2 to handle this properly msg[-1] = u"%s%s" % (st, a.summary()) if args.LOGLEVEL < logging.INFO: if a.keywords(): msg[-1] += u" [%s]" % " ".join(a.keywords()) if a.luminosityfb(): msg[-1] += u" [ \int L = %s fb^{-1} ]" % a.luminosityfb() msg = rivet.util.detex(msg) retlist = '\n'.join([ u"%-25s %s" % (a,m) for a,m in zip(names,msg) ]) if type(u'') is not str: retlist = retlist.encode('utf-8') print(retlist) sys.exit(0) def getKeywords(alist): all_keywords = [] for a in alist: all_keywords.extend(rivet.AnalysisLoader.getAnalysis(a).keywords()) all_keywords = [i.lower() for i in all_keywords] return sorted(list(set(all_keywords))) ## List keywords if args.LIST_KEYWORDS: # a = rivet.AnalysisLoader.getAnalysis(aname) for k in getKeywords(all_analyses): print(k) sys.exit(0) ## Show analyses' details if len(args.SHOW_ANALYSES) > 0: toshow = [] for i, a in enumerate(args.SHOW_ANALYSES): a_up = a.upper() if a_up in all_analyses and a_up not in toshow: toshow.append(a_up) else: ## Treat as a case-insensitive regex import re regex = re.compile(a, re.I) for ana in all_analyses: if regex.search(ana) and a_up not in toshow: toshow.append(ana) msgs = [] for i, name in enumerate(sorted(toshow)): import textwrap ana = rivet.AnalysisLoader.getAnalysis(name) msg = "" msg += name + "\n" msg += (len(name) * "=") + "\n\n" msg += rivet.util.detex(ana.summary()) + "\n\n" msg += "Status: " + ana.status() + "\n\n" # TODO: reduce to only show Inspire in v3 if ana.inspireId(): msg += "Inspire ID: " + ana.inspireId() + "\n" msg += "Inspire URL: http://inspire-hep.net/record/" + ana.inspireId() + "\n" msg += "HepData URL: http://hepdata.net/record/ins" + ana.inspireId() + "\n" elif ana.spiresId(): msg += "Spires ID: " + ana.spiresId() + "\n" msg += "Inspire URL: http://inspire-hep.net/search?p=find+key+" + ana.spiresId() + "\n" msg += "HepData URL: http://hepdata.cedar.ac.uk/view/irn" + ana.spiresId() + "\n" if ana.year(): msg += "Year of publication: " + ana.year() + "\n" if ana.bibKey(): msg += "BibTeX key: " + ana.bibKey() + "\n" msg += "Authors:\n" for a in ana.authors(): msg += " " + a + "\n" msg += "\n" msg += "Description:\n" twrap = textwrap.TextWrapper(width=75, initial_indent=2*" ", subsequent_indent=2*" ") msg += twrap.fill(rivet.util.detex(ana.description())) + "\n\n" if ana.experiment(): msg += "Experiment: " + ana.experiment() if ana.collider(): msg += "(%s)" % ana.collider() msg += "\n" # TODO: move this formatting into Analysis or a helper function? if ana.requiredBeams(): def pid_to_str(pid): if pid == 11: return "e-" elif pid == -11: return "e+" elif pid == 2212: return "p+" elif pid == -2212: return "p-" elif pid == 10000: return "*" else: return str(pid) beamstrs = [] for bp in ana.requiredBeams(): beamstrs.append(pid_to_str(bp[0]) + " " + pid_to_str(bp[1])) msg += "Beams:" + ", ".join(beamstrs) + "\n" if ana.requiredEnergies(): msg += "Beam energies:" + "; ".join(["(%0.1f, %0.1f) GeV\n" % (epair[0], epair[1]) for epair in ana.requiredEnergies()]) else: msg += "Beam energies: ANY\n" if ana.runInfo(): msg += "Run details:\n" twrap = textwrap.TextWrapper(width=75, initial_indent=2*" ", subsequent_indent=4*" ") for l in ana.runInfo().split("\n"): msg += twrap.fill(l) + "\n" if ana.luminosityfb(): msg+= "\nIntegrated data luminosity = %s inverse fb.\n"%ana.luminosityfb() if ana.keywords(): msg += "\nAnalysis keywords:" for k in ana.keywords(): msg += " %s"%k msg+= "\n\n" if ana.references(): msg += "\n" + "References:\n" for r in ana.references(): url = None if r.startswith("arXiv:"): code = r.split()[0].replace("arXiv:", "") url = "http://arxiv.org/abs/" + code elif r.startswith("doi:"): code = r.replace("doi:", "") url = "http://dx.doi.org/" + code if url is not None: r += " - " + url msg += " " + r + "\n" ## Add to the output msgs.append(msg) ## Write the combined messages to a temporary file and page it if msgs: try: import tempfile, subprocess tffd, tfpath = tempfile.mkstemp(prefix="rivet-show.") msgsum = u"\n\n".join(msgs) if type(u'') is not str: msgsum = msgsum.encode('utf-8') os.write(tffd, msgsum) if sys.stdout.isatty(): pager = subprocess.Popen(["less", "-FX", tfpath]) #, stdin=subprocess.PIPE) pager.communicate() else: f = open(tfpath) print(f.read()) f.close() finally: os.unlink(tfpath) #< always clean up sys.exit(0) ############################ ## Actual analysis runs ## We allow comma-separated lists of analysis names -- normalise the list here newanas = [] for a in args.ANALYSES: if "," in a: newanas += a.split(",") elif "@" in a: #< NB. this bans combination of ana lists and keywords in a single arg temp = getAnalysesByKeyword(all_analyses, a) for i in temp: newanas.append(i) else: newanas.append(a) args.ANALYSES = newanas ## Parse supplied cross-section if args.CROSS_SECTION is not None: xsstr = args.CROSS_SECTION try: args.CROSS_SECTION = float(xsstr) except: import re suffmatch = re.search(r"[^\d.]", xsstr) if not suffmatch: raise ValueError("Bad cross-section string: %s" % xsstr) factor = base = None suffstart = suffmatch.start() if suffstart != -1: base = xsstr[:suffstart] suffix = xsstr[suffstart:].lower() if suffix == "mb": factor = 1e+9 elif suffix == "mub": factor = 1e+6 elif suffix == "nb": factor = 1e+3 elif suffix == "pb": factor = 1 elif suffix == "fb": factor = 1e-3 elif suffix == "ab": factor = 1e-6 if factor is None or base is None: raise ValueError("Bad cross-section string: %s" % xsstr) xs = float(base) * factor args.CROSS_SECTION = xs ## Print the available CLI options! #if args.LIST_OPTIONS: # for o in parser.option_list: # print(o.get_opt_string()) # sys.exit(0) ## Set up signal handling RECVD_KILL_SIGNAL = None def handleKillSignal(signum, frame): "Declare us as having been signalled, and return to default handling behaviour" global RECVD_KILL_SIGNAL logging.critical("Signal handler called with signal " + str(signum)) RECVD_KILL_SIGNAL = signum signal.signal(signum, signal.SIG_DFL) ## Signals to handle signal.signal(signal.SIGTERM, handleKillSignal); signal.signal(signal.SIGHUP, handleKillSignal); signal.signal(signal.SIGINT, handleKillSignal); signal.signal(signal.SIGUSR1, handleKillSignal); signal.signal(signal.SIGUSR2, handleKillSignal); try: signal.signal(signal.SIGXCPU, handleKillSignal); except: pass ## Identify HepMC files/streams ## TODO: check readability, deal with stdin if len(args.ARGS) > 0: HEPMCFILES = args.ARGS else: HEPMCFILES = ["-"] ## Event number logging def logNEvt(n, starttime, maxevtnum): if n % 10000 == 0: nevtloglevel = logging.CRITICAL elif n % 1000 == 0: nevtloglevel = logging.WARNING elif n % 100 == 0: nevtloglevel = logging.INFO else: nevtloglevel = logging.DEBUG currenttime = datetime.datetime.now().replace(microsecond=0) elapsedtime = currenttime - starttime logging.log(nevtloglevel, "Event %d (%s elapsed)" % (n, str(elapsedtime))) # if maxevtnum is None: # logging.log(nevtloglevel, "Event %d (%s elapsed)" % (n, str(elapsedtime))) # else: # remainingtime = (maxevtnum-n) * elapsedtime.total_seconds() / float(n) # eta = time.strftime("%a %b %d %H:%M", datetime.localtime(currenttime + remainingtime)) # logging.log(nevtloglevel, "Event %d (%d s elapsed / %d s left) -> ETA: %s" % # (n, elapsedtime, remainingtime, eta)) ## Do some checks on output histo file, before we stat the event loop histo_parentdir = os.path.dirname(os.path.abspath(args.HISTOFILE)) if not os.path.exists(histo_parentdir): logging.error('Parent path of output histogram file does not exist: %s\nExiting.' % histo_parentdir) sys.exit(4) if not os.access(histo_parentdir,os.W_OK): logging.error('Insufficient permissions to write output histogram file to directory %s\nExiting.' % histo_parentdir) sys.exit(4) ## Set up analysis handler RUNNAME = args.RUN_NAME or "" ah = rivet.AnalysisHandler(RUNNAME) ah.setIgnoreBeams(args.IGNORE_BEAMS) for a in args.ANALYSES: ## Print warning message and exit if not a valid analysis name if not rivet.stripOptions(a) in all_analyses: logging.warning("'%s' is not a known Rivet analysis! Do you need to set RIVET_ANALYSIS_PATH or use the --pwd switch?\n" % a) # TODO: lay out more neatly, or even try for a "did you mean XXXX?" heuristic? logging.warning("There are %d currently available analyses:\n" % len(all_analyses) + ", ".join(all_analyses)) sys.exit(1) logging.debug("Adding analysis '%s'" % a) ah.addAnalysis(a) if args.PRELOADFILE is not None: ah.readData(args.PRELOADFILE) if args.DUMP_PERIOD: ah.dump(args.HISTOFILE, args.DUMP_PERIOD) if args.SHOW_BIBTEX: bibs = [] for aname in sorted(ah.analysisNames()): ana = rivet.AnalysisLoader.getAnalysis(aname) bibs.append("% " + aname + "\n" + ana.bibTeX()) if bibs: print("\nBibTeX for used Rivet analyses:\n") print("% --------------------------\n") print("\n\n".join(bibs) + "\n") print("% --------------------------\n") ## Read and process events run = rivet.Run(ah) if args.CROSS_SECTION is not None: logging.info("User-supplied cross-section = %e pb" % args.CROSS_SECTION) run.setCrossSection(args.CROSS_SECTION) if args.LIST_USED_ANALYSES is not None: run.setListAnalyses(args.LIST_USED_ANALYSES) ## Print platform type import platform starttime = datetime.datetime.now().replace(microsecond=0) logging.info("Rivet %s running on machine %s (%s) at %s" % \ (rivet.version(), platform.node(), platform.machine(), str(starttime))) def min_nonnull(a, b): "A version of min which considers None to always be greater than a real number" if a is None: return b if b is None: return a return min(a, b) ## Set up an event timeout handler class TimeoutException(Exception): pass if args.EVENT_TIMEOUT or args.RUN_TIMEOUT: def evttimeouthandler(signum, frame): logging.warn("It has taken more than %d secs to get an event! Is the input event stream working?" % min_nonnull(args.EVENT_TIMEOUT, args.RUN_TIMEOUT)) raise TimeoutException("Event timeout") signal.signal(signal.SIGALRM, evttimeouthandler) ## Init run based on one event hepmcfile = HEPMCFILES[0] ## Apply a file-level weight derived from the filename hepmcfileweight = 1.0 if ":" in hepmcfile: hepmcfile, hepmcfileweight = hepmcfile.rsplit(":", 1) hepmcfileweight = float(hepmcfileweight) try: if args.EVENT_TIMEOUT or args.RUN_TIMEOUT: signal.alarm(min_nonnull(args.EVENT_TIMEOUT, args.RUN_TIMEOUT)) init_ok = run.init(hepmcfile, hepmcfileweight) signal.alarm(0) if not init_ok: logging.error("Failed to initialise using event file '%s'... exiting" % hepmcfile) sys.exit(2) except TimeoutException as te: logging.error("Timeout in initialisation from event file '%s'... exiting" % hepmcfile) sys.exit(3) except Exception as ex: logging.warning("Could not read from '%s' (error=%s)" % (hepmcfile, str(ex))) sys.exit(3) ## Event loop evtnum = 0 for fileidx, hepmcfile in enumerate(HEPMCFILES): ## Apply a file-level weight derived from the filename hepmcfileweight = 1.0 if ":" in hepmcfile: hepmcfile, hepmcfileweight = hepmcfile.rsplit(":", 1) hepmcfileweight = float(hepmcfileweight) ## Open next HepMC file (NB. this doesn't apply to the first file: it was already used for the run init) if fileidx > 0: try: run.openFile(hepmcfile, hepmcfileweight) except Exception as ex: logging.warning("Could not read from '%s' (error=%s)" % (hepmcfile, ex)) continue if not run.readEvent(): logging.warning("Could not read events from '%s'" % hepmcfile) continue ## Announce new file msg = "Reading events from '%s'" % hepmcfile if hepmcfileweight != 1.0: msg += " (file weight = %e)" % hepmcfileweight logging.info(msg) ## The event loop while args.MAXEVTNUM is None or evtnum-args.EVTSKIPNUM < args.MAXEVTNUM: evtnum += 1 ## Optional event skipping if evtnum <= args.EVTSKIPNUM: logging.debug("Skipping event #%i" % evtnum) run.skipEvent(); continue ## Only log the event number once we're actually processing logNEvt(evtnum, starttime, args.MAXEVTNUM) ## Process this event processed_ok = run.processEvent() if not processed_ok: logging.warn("Event processing failed for evt #%i!" % evtnum) break ## Set flag to exit event loop if run timeout exceeded if args.RUN_TIMEOUT and (time.time() - starttime) > args.RUN_TIMEOUT: logging.warning("Run timeout of %d secs exceeded... exiting gracefully" % args.RUN_TIMEOUT) RECVD_KILL_SIGNAL = True ## Exit the loop if signalled if RECVD_KILL_SIGNAL is not None: break ## Read next event (with timeout handling if requested) try: if args.EVENT_TIMEOUT: signal.alarm(args.EVENT_TIMEOUT) read_ok = run.readEvent() signal.alarm(0) if not read_ok: break except TimeoutException as te: logging.error("Timeout in reading event from '%s'... exiting" % hepmcfile) sys.exit(3) ## Print end-of-loop messages loopendtime = datetime.datetime.now().replace(microsecond=0) logging.info("Finished event loop at %s" % str(loopendtime)) logging.info("Cross-section = %e pb" % ah.crossSection()) print() ## Finalize and write out data file run.finalize() if args.WRITE_DATA: ah.writeData(args.HISTOFILE) print() endtime = datetime.datetime.now().replace(microsecond=0) logging.info("Rivet run completed at %s, time elapsed = %s" % (str(endtime), str(endtime-starttime))) print() logging.info("Histograms written to %s" % os.path.abspath(args.HISTOFILE)) diff --git a/src/Core/AnalysisHandler.cc b/src/Core/AnalysisHandler.cc --- a/src/Core/AnalysisHandler.cc +++ b/src/Core/AnalysisHandler.cc @@ -1,752 +1,752 @@ // -*- C++ -*- #include "Rivet/Config/RivetCommon.hh" #include "Rivet/AnalysisHandler.hh" #include "Rivet/Analysis.hh" #include "Rivet/Tools/ParticleName.hh" #include "Rivet/Tools/BeamConstraint.hh" #include "Rivet/Tools/Logging.hh" #include "Rivet/Projections/Beam.hh" #include "YODA/IO.h" #include #include using std::cout; using std::cerr; namespace { inline std::vector split(const std::string& input, const std::string& regex) { // passing -1 as the submatch index parameter performs splitting std::regex re(regex); std::sregex_token_iterator first{input.begin(), input.end(), re, -1}, last; return {first, last}; } } namespace Rivet { AnalysisHandler::AnalysisHandler(const string& runname) : _runname(runname), // *** LEIF *** temporarily removed this // _eventcounter("/_EVTCOUNT"), // _xs(NAN), _xserr(NAN), _initialised(false), _ignoreBeams(false), _defaultWeightIdx(0), _dumpPeriod(0), _dumping(false) { } AnalysisHandler::~AnalysisHandler() { } Log& AnalysisHandler::getLog() const { return Log::getLog("Rivet.Analysis.Handler"); } /// http://stackoverflow.com/questions/4654636/how-to-determine-if-a-string-is-a-number-with-c namespace { bool is_number(const std::string& s) { std::string::const_iterator it = s.begin(); while (it != s.end() && std::isdigit(*it)) ++it; return !s.empty() && it == s.end(); } } /// Check if any of the weightnames is not a number bool AnalysisHandler::haveNamedWeights() const { bool dec=false; for (unsigned int i=0;i<_weightNames.size();++i) { string s = _weightNames[i]; if (!is_number(s)) { dec=true; break; } } return dec; } void AnalysisHandler::init(const GenEvent& ge) { if (_initialised) throw UserError("AnalysisHandler::init has already been called: cannot re-initialize!"); /// @todo Should the Rivet analysis objects know about weight names? setRunBeams(Rivet::beams(ge)); MSG_DEBUG("Initialising the analysis handler"); _eventNumber = ge.event_number(); setWeightNames(ge); if (haveNamedWeights()) MSG_INFO("Using named weights"); else MSG_INFO("NOT using named weights. Using first weight as nominal weight"); _eventCounter = CounterPtr(weightNames(), Counter("_EVTCOUNT")); // Set the cross section based on what is reported by this event. if (ge.cross_section()) { MSG_TRACE("Getting cross section."); double xs = ge.cross_section()->cross_section(); double xserr = ge.cross_section()->cross_section_error(); setCrossSection(xs, xserr); } // Check that analyses are beam-compatible, and remove those that aren't const size_t num_anas_requested = analysisNames().size(); vector anamestodelete; for (const AnaHandle a : analyses()) { if (!_ignoreBeams && !a->isCompatible(beams())) { //MSG_DEBUG(a->name() << " requires beams " << a->requiredBeams() << " @ " << a->requiredEnergies() << " GeV"); anamestodelete.push_back(a->name()); } } for (const string& aname : anamestodelete) { MSG_WARNING("Analysis '" << aname << "' is incompatible with the provided beams: removing"); removeAnalysis(aname); } if (num_anas_requested > 0 && analysisNames().empty()) { cerr << "All analyses were incompatible with the first event's beams\n" << "Exiting, since this probably wasn't intentional!" << endl; exit(1); } // Warn if any analysis' status is not unblemished for (const AnaHandle a : analyses()) { if ( a->info().preliminary() ) { MSG_WARNING("Analysis '" << a->name() << "' is preliminary: be careful, it may change and/or be renamed!"); } else if ( a->info().obsolete() ) { MSG_WARNING("Analysis '" << a->name() << "' is obsolete: please update!"); } else if (( a->info().unvalidated() ) ) { MSG_WARNING("Analysis '" << a->name() << "' is unvalidated: be careful, it may be broken!"); } } // Initialize the remaining analyses _stage = Stage::INIT; for (AnaHandle a : analyses()) { MSG_DEBUG("Initialising analysis: " << a->name()); try { // Allow projection registration in the init phase onwards a->_allowProjReg = true; a->init(); //MSG_DEBUG("Checking consistency of analysis: " << a->name()); //a->checkConsistency(); } catch (const Error& err) { cerr << "Error in " << a->name() << "::init method: " << err.what() << endl; exit(1); } MSG_DEBUG("Done initialising analysis: " << a->name()); } _stage = Stage::OTHER; _initialised = true; MSG_DEBUG("Analysis handler initialised"); } // *** LEIF *** Reinstated this. void AnalysisHandler::setWeightNames(const GenEvent& ge) { /// reroute the print output to a std::stringstream and process /// The iteration is done over a map in hepmc2 so this is safe std::ostringstream stream; ge.weights().print(stream); // Super lame, I know string str = stream.str(); std::regex re("(([^()]+))"); // Regex for stuff enclosed by parentheses () size_t idx = 0; for (std::sregex_iterator i = std::sregex_iterator(str.begin(), str.end(), re); i != std::sregex_iterator(); ++i ) { std::smatch m = *i; vector temp = ::split(m.str(), "[,]"); if (temp.size() ==2) { MSG_DEBUG("Name of weight #" << _weightNames.size() << ": " << temp[0]); // store the default weight based on weight names if (temp[0] == "Weight" || temp[0] == "0" || temp[0] == "Default") { MSG_DEBUG(_weightNames.size() << " is being used as the nominal."); _weightNames.push_back(""); _defaultWeightIdx = idx; } else _weightNames.push_back(temp[0]); idx++; } } } void AnalysisHandler::analyze(const GenEvent& ge) { // Call init with event as template if not already initialised if (!_initialised) init(ge); assert(_initialised); // Ensure that beam details match those from the first event (if we're checking beams) if ( !_ignoreBeams ) { const PdgIdPair beams = Rivet::beamIds(ge); const double sqrts = Rivet::sqrtS(ge); if (!compatible(beams, _beams) || !fuzzyEquals(sqrts, sqrtS())) { cerr << "Event beams mismatch: " << PID::toBeamsString(beams) << " @ " << sqrts/GeV << " GeV" << " vs. first beams " << this->beams() << " @ " << this->sqrtS()/GeV << " GeV" << endl; exit(1); } } // Create the Rivet event wrapper /// @todo Filter/normalize the event here bool strip = ( getEnvParam("RIVET_STRIP_HEPMC", string("NOOOO") ) != "NOOOO" ); Event event(ge, strip); // Weights /// @todo Drop this / just report first weight when we support multiweight events // *** LEIF *** temporarily removed this // _eventcounter.fill(event.weight()); // MSG_DEBUG("Event #" << _eventcounter.numEntries() << " weight = " << event.weight()); // *** LEIF *** temporarily removed this // // Cross-section // #if defined ENABLE_HEPMC_3 // if (ge.cross_section()) { // //@todo HepMC3::GenCrossSection methods aren't const accessible :( // RivetHepMC::GenCrossSection gcs = *(event.genEvent()->cross_section()); // _xs = gcs.xsec(); // _xserr = gcs.xsec_err(); // } // #elif defined HEPMC_HAS_CROSS_SECTION // if (ge.cross_section()) { // _xs = ge.cross_section()->cross_section(); // _xserr = ge.cross_section()->cross_section_error(); // } // #endif // Won't happen for first event because _eventNumber is set in init() if (_eventNumber != ge.event_number()) { /// @todo Can we get away with not passing a matrix? MSG_TRACE("AnalysisHandler::analyze(): Pushing _eventCounter to persistent."); _eventCounter.get()->pushToPersistent(_subEventWeights); // if this is indeed a new event, push the temporary // histograms and reset for (const AnaHandle& a : analyses()) { for (auto ao : a->analysisObjects()) { MSG_TRACE("AnalysisHandler::analyze(): Pushing " << a->name() << "'s " << ao->name() << " to persistent."); ao.get()->pushToPersistent(_subEventWeights); } MSG_TRACE("AnalysisHandler::analyze(): finished pushing " << a->name() << "'s objects to persistent."); } _eventNumber = ge.event_number(); MSG_DEBUG("nominal event # " << _eventCounter.get()->_persistent[0]->numEntries()); MSG_DEBUG("nominal sum of weights: " << _eventCounter.get()->_persistent[0]->sumW()); MSG_DEBUG("Event has " << _subEventWeights.size() << " sub events."); _subEventWeights.clear(); } MSG_TRACE("starting new sub event"); _eventCounter.get()->newSubEvent(); for (const AnaHandle& a : analyses()) { for (auto ao : a->analysisObjects()) { ao.get()->newSubEvent(); } } _subEventWeights.push_back(event.weights()); MSG_DEBUG("Analyzing subevent #" << _subEventWeights.size() - 1 << "."); _eventCounter->fill(); // Run the analyses for (AnaHandle a : analyses()) { MSG_TRACE("About to run analysis " << a->name()); try { a->analyze(event); } catch (const Error& err) { cerr << "Error in " << a->name() << "::analyze method: " << err.what() << endl; exit(1); } MSG_TRACE("Finished running analysis " << a->name()); } - if ( _dumpPeriod > 0 && numEvents()%_dumpPeriod == 0 ) { + if ( _dumpPeriod > 0 && numEvents() > 0 && numEvents()%_dumpPeriod == 0 ) { MSG_INFO("Dumping intermediate results to " << _dumpFile << "."); _dumping = numEvents()/_dumpPeriod; finalize(); writeData(_dumpFile); _dumping = 0; } } void AnalysisHandler::analyze(const GenEvent* ge) { if (ge == nullptr) { MSG_ERROR("AnalysisHandler received null pointer to GenEvent"); //throw Error("AnalysisHandler received null pointer to GenEvent"); } analyze(*ge); } void AnalysisHandler::finalize() { if (!_initialised) return; MSG_INFO("Finalising analyses"); // First push all analyses' objects to persistent MSG_TRACE("AnalysisHandler::finalize(): Pushing analysis objects to persistent."); _eventCounter.get()->pushToPersistent(_subEventWeights); for (const AnaHandle& a : analyses()) { for (auto ao : a->analysisObjects()) ao.get()->pushToPersistent(_subEventWeights); } // First we make copies of all analysis objects. map backupAOs; for (auto ao : getData(false, true, false) ) backupAOs[ao->path()] = YODA::AnalysisObjectPtr(ao->newclone()); // Now we run the (re-entrant) finalize() functions for all analyses. MSG_INFO("Finalising analyses"); for (AnaHandle a : analyses()) { // *** LEIF *** temporarily removed this // a->setCrossSection(_xs); try { if ( !_dumping || a->info().reentrant() ) a->finalize(); else if ( _dumping == 1 ) MSG_INFO("Skipping finalize in periodic dump of " << a->name() << " as it is not declared reentrant."); } catch (const Error& err) { cerr << "Error in " << a->name() << "::finalize method: " << err.what() << endl; exit(1); } } // Now we copy all analysis objects to the list of finalized // ones, and restore the value to their original ones. _finalizedAOs.clear(); for ( auto ao : getYodaAOs(false, false, false) ) _finalizedAOs.push_back(YODA::AnalysisObjectPtr(ao->newclone())); for ( auto ao : getYodaAOs(false, true, false) ) { // TODO: This should be possible to do in a nicer way, with a flag etc. if (ao->path().find("/FINAL") != std::string::npos) continue; auto aoit = backupAOs.find(ao->path()); if ( aoit == backupAOs.end() ) { AnaHandle ana = analysis(split(ao->path(), "/")[0]); if ( ana ) ana->removeAnalysisObject(ao->path()); } else copyao(aoit->second, ao); } // Print out number of events processed const int nevts = numEvents(); MSG_INFO("Processed " << nevts << " event" << (nevts != 1 ? "s" : "")); // // Delete analyses // MSG_DEBUG("Deleting analyses"); // _analyses.clear(); // Print out MCnet boilerplate cout << endl; cout << "The MCnet usage guidelines apply to Rivet: see http://www.montecarlonet.org/GUIDELINES" << endl; cout << "Please acknowledge plots made with Rivet analyses, and cite arXiv:1003.0694 (http://arxiv.org/abs/1003.0694)" << endl; } AnalysisHandler& AnalysisHandler::addAnalysis(const string& analysisname, std::map pars) { // Make an option handle. std::string parHandle = ""; for (map::iterator par = pars.begin(); par != pars.end(); ++par) { parHandle +=":"; parHandle += par->first + "=" + par->second; } return addAnalysis(analysisname + parHandle); } AnalysisHandler& AnalysisHandler::addAnalysis(const string& analysisname) { // Check for a duplicate analysis /// @todo Might we want to be able to run an analysis twice, with different params? /// Requires avoiding histo tree clashes, i.e. storing the histos on the analysis objects. string ananame = analysisname; vector anaopt = split(analysisname, ":"); if ( anaopt.size() > 1 ) ananame = anaopt[0]; AnaHandle analysis( AnalysisLoader::getAnalysis(ananame) ); if (analysis.get() != 0) { // < Check for null analysis. MSG_DEBUG("Adding analysis '" << analysisname << "'"); map opts; for ( int i = 1, N = anaopt.size(); i < N; ++i ) { vector opt = split(anaopt[i], "="); if ( opt.size() != 2 ) { MSG_WARNING("Error in option specification. Skipping analysis " << analysisname); return *this; } if ( !analysis->info().validOption(opt[0], opt[1]) ) { MSG_WARNING("Cannot set option '" << opt[0] << "' to '" << opt[1] << "'. Skipping analysis " << analysisname); return *this; } opts[opt[0]] = opt[1]; } for ( auto opt: opts) { analysis->_options[opt.first] = opt.second; analysis->_optstring += ":" + opt.first + "=" + opt.second; } for (const AnaHandle& a : analyses()) { if (a->name() == analysis->name() ) { MSG_WARNING("Analysis '" << analysisname << "' already registered: skipping duplicate"); return *this; } } analysis->_analysishandler = this; _analyses[analysisname] = analysis; } else { MSG_WARNING("Analysis '" << analysisname << "' not found."); } // MSG_WARNING(_analyses.size()); // for (const AnaHandle& a : _analyses) MSG_WARNING(a->name()); return *this; } AnalysisHandler& AnalysisHandler::removeAnalysis(const string& analysisname) { MSG_DEBUG("Removing analysis '" << analysisname << "'"); if (_analyses.find(analysisname) != _analyses.end()) _analyses.erase(analysisname); // } return *this; } void AnalysisHandler::addData(const std::vector& aos) { for (const YODA::AnalysisObjectPtr ao : aos) { string path = ao->path(); if ( path.substr(0, 5) != "/RAW/" ) { _orphanedPreloads.push_back(ao); continue; } path = path.substr(4); ao->setPath(path); if (path.size() > 1) { // path > "/" try { const string ananame = ::split(path, "/")[0]; AnaHandle a = analysis(ananame); /// @todo FIXXXXX //MultiweightAOPtr mao = ????; /// @todo generate right Multiweight object from ao //a->addAnalysisObject(mao); /// @todo Need to statistically merge... } catch (const Error& e) { MSG_TRACE("Adding analysis object " << path << " to the list of orphans."); _orphanedPreloads.push_back(ao); } } } } void AnalysisHandler::stripOptions(YODA::AnalysisObjectPtr ao, const vector & delopts) const { string path = ao->path(); string ananame = split(path, "/")[0]; vector anaopts = split(ananame, ":"); for ( int i = 1, N = anaopts.size(); i < N; ++i ) for ( auto opt : delopts ) if ( opt == "*" || anaopts[i].find(opt + "=") == 0 ) path.replace(path.find(":" + anaopts[i]), (":" + anaopts[i]).length(), ""); ao->setPath(path); } void AnalysisHandler::mergeYodas(const vector & , const vector & , bool ) {} // void AnalysisHandler::mergeYodas(const vector & aofiles, // const vector & delopts, bool equiv) { // vector< vector > aosv; // vector xsecs; // vector xsecerrs; // vector sows; // set ananames; // _eventCounter->reset(); // // First scan all files and extract analysis objects and add the // // corresponding analyses.. // for (const string& file : aofiles ) { // Scatter1DPtr xsec; // CounterPtr sow; // // For each file make sure that cross section and sum-of-weights // // objects are present and stor all RAW ones in a vector; // vector aos; // try { // /// @todo Use new YODA SFINAE to fill the smart ptr vector directly // vector aos_raw; // YODA::read(file, aos_raw); // for (YODA::AnalysisObject* aor : aos_raw) { // YODA::AnalysisObjectPtr ao(aor); // if ( ao->path().substr(0, 5) != "/RAW/" ) continue; // ao->setPath(ao->path().substr(4)); // if ( ao->path() == "/_XSEC" ) // xsec = dynamic_pointer_cast(ao); // else if ( ao->path() == "/_EVTCOUNT" ) // sow = dynamic_pointer_cast(ao); // else { // stripOptions(ao, delopts); // string ananame = split(ao->path(), "/")[0]; // if ( ananames.insert(ananame).second ) addAnalysis(ananame); // aos.push_back(ao); // } // } // if ( !xsec || !sow ) { // MSG_ERROR( "Error in AnalysisHandler::mergeYodas: The file " << file // << " did not contain weights and cross section info."); // exit(1); // } // xsecs.push_back(xsec->point(0).x()); // sows.push_back(sow); // xsecerrs.push_back(sqr(xsec->point(0).xErrAvg())); // _eventCounter->operator+=(*sow); //< HAHAHAHAHA! // sows.push_back(sow); // aosv.push_back(aos); // } catch (...) { //< YODA::ReadError& // throw UserError("Unexpected error in reading file: " + file); // } // } // // Now calculate the scale to be applied for all bins in a file // // and get the common cross section and sum of weights. // _xs = _xserr = 0.0; // for ( int i = 0, N = sows.size(); i < N; ++i ) { // double effnent = sows[i]->effNumEntries(); // _xs += (equiv? effnent: 1.0)*xsecs[i]; // _xserr += (equiv? sqr(effnent): 1.0)*xsecerrs[i]; // } // vector scales(sows.size(), 1.0); // if ( equiv ) { // _xs /= _eventCounter.effNumEntries(); // _xserr = sqrt(_xserr)/_eventCounter.effNumEntries(); // } else { // _xserr = sqrt(_xserr); // for ( int i = 0, N = sows.size(); i < N; ++i ) // scales[i] = (_eventCounter.sumW()/sows[i]->sumW())*(xsecs[i]/_xs); // } // // Initialize the analyses allowing them to book analysis objects. // for (AnaHandle a : _analyses) { // MSG_DEBUG("Initialising analysis: " << a->name()); // if ( !a->info().reentrant() ) // MSG_WARNING("Analysis " << a->name() << " has not been validated to have " // << "a reentrant finalize method. The result is unpredictable."); // try { // // Allow projection registration in the init phase onwards // a->_allowProjReg = true; // cerr << "sqrtS " << sqrtS() << endl; // a->init(); // //MSG_DEBUG("Checking consistency of analysis: " << a->name()); // //a->checkConsistency(); // } catch (const Error& err) { // cerr << "Error in " << a->name() << "::init method: " << err.what() << endl; // exit(1); // } // MSG_DEBUG("Done initialising analysis: " << a->name()); // } // _initialised = true; // // Get a list of all anaysis objects to handle. // map current; // for ( auto ao : getData(false, true) ) current[ao->path()] = ao; // // Go through all objects to be merged and add them to current // // after appropriate scaling. // for ( int i = 0, N = aosv.size(); i < N; ++i) // for ( auto ao : aosv[i] ) { // if ( ao->path() == "/_XSEC" || ao->path() == "_EVTCOUNT" ) continue; // auto aoit = current.find(ao->path()); // if ( aoit == current.end() ) { // MSG_WARNING("" << ao->path() << " was not properly booked."); // continue; // } // if ( !addaos(aoit->second, ao, scales[i]) ) // MSG_WARNING("Cannot merge objects with path " << ao->path() // <<" of type " << ao->annotation("Type") ); // } // // Now we can simply finalize() the analysis, leaving the // // controlling program to write it out some yoda-file. // finalize(); // } void AnalysisHandler::readData(const string& filename) { vector aos; try { /// @todo Use new YODA SFINAE to fill the smart ptr vector directly vector aos_raw; YODA::read(filename, aos_raw); for (YODA::AnalysisObject* aor : aos_raw) aos.push_back(YODA::AnalysisObjectPtr(aor)); //} catch (const YODA::ReadError & e) { } catch (...) { //< YODA::ReadError& throw UserError("Unexpected error in reading file: " + filename); } if (!aos.empty()) addData(aos); } vector AnalysisHandler::getRivetAOs() const { vector rtn; for (AnaHandle a : analyses()) { for (const auto & ao : a->analysisObjects()) { rtn.push_back(ao); } } rtn.push_back(_eventCounter); rtn.push_back(_xs); return rtn; } vector AnalysisHandler::getYodaAOs(bool includeorphans, bool includetmps, bool usefinalized) const { vector rtn; if (usefinalized) rtn = _finalizedAOs; else { for (auto rao : getRivetAOs()) { // need to set the index // before we can search the PATH rao.get()->setActiveWeightIdx(_defaultWeightIdx); // Exclude paths from final write-out if they contain a "TMP" layer (i.e. matching "/TMP/") if (!includetmps && rao->path().find("/TMP/") != string::npos) continue; for (size_t iW = 0; iW < numWeights(); iW++) { rao.get()->setActiveWeightIdx(iW); rtn.push_back(rao.get()->activeYODAPtr()); } } } // Sort histograms alphanumerically by path before write-out sort(rtn.begin(), rtn.end(), [](YODA::AnalysisObjectPtr a, YODA::AnalysisObjectPtr b) { return a->path() < b->path(); } ); return rtn; } vector AnalysisHandler::getData(bool includeorphans, bool includetmps, bool usefinalized) const { return getYodaAOs(includeorphans, includetmps, usefinalized); } void AnalysisHandler::writeData(const string& filename) const { vector out = _finalizedAOs; set finalana; for ( auto ao : out) finalana.insert(ao->path()); out.reserve(2*out.size()); vector aos = getData(false, true); for ( auto ao : aos ) { ao = YODA::AnalysisObjectPtr(ao->newclone()); ao->setPath("/RAW" + ao->path()); out.push_back(ao); } try { YODA::write(filename, aos.begin(), aos.end()); } catch (...) { //< YODA::WriteError& throw UserError("Unexpected error in writing file: " + filename); } } string AnalysisHandler::runName() const { return _runname; } size_t AnalysisHandler::numEvents() const { return _eventCounter->numEntries(); } std::vector AnalysisHandler::analysisNames() const { std::vector rtn; for (AnaHandle a : analyses()) { rtn.push_back(a->name()); } return rtn; } AnalysisHandler& AnalysisHandler::addAnalyses(const std::vector& analysisnames) { for (const string& aname : analysisnames) { //MSG_DEBUG("Adding analysis '" << aname << "'"); addAnalysis(aname); } return *this; } AnalysisHandler& AnalysisHandler::removeAnalyses(const std::vector& analysisnames) { for (const string& aname : analysisnames) { removeAnalysis(aname); } return *this; } AnalysisHandler& AnalysisHandler::setCrossSection(double xs, double xserr) { _xs = Scatter1DPtr(weightNames(), Scatter1D("_XSEC")); _eventCounter.get()->setActiveWeightIdx(_defaultWeightIdx); double nomwgt = sumW(); // The cross section of each weight variation is the nominal cross section // times the sumW(variation) / sumW(nominal). // This way the cross section will work correctly for (size_t iW = 0; iW < numWeights(); iW++) { _eventCounter.get()->setActiveWeightIdx(iW); double s = sumW() / nomwgt; _xs.get()->setActiveWeightIdx(iW); _xs->addPoint(xs*s, xserr*s); } _eventCounter.get()->unsetActiveWeight(); _xs.get()->unsetActiveWeight(); return *this; } // *** LEIF *** temporarily removed this // bool AnalysisHandler::hasCrossSection() const { // return (!std::isnan(crossSection())); // } AnalysisHandler& AnalysisHandler::addAnalysis(Analysis* analysis) { analysis->_analysishandler = this; // _analyses.insert(AnaHandle(analysis)); _analyses[analysis->name()] = AnaHandle(analysis); return *this; } PdgIdPair AnalysisHandler::beamIds() const { return Rivet::beamIds(beams()); } double AnalysisHandler::sqrtS() const { return Rivet::sqrtS(beams()); } void AnalysisHandler::setIgnoreBeams(bool ignore) { _ignoreBeams=ignore; } } diff --git a/test/testMatVec.cc b/test/testMatVec.cc --- a/test/testMatVec.cc +++ b/test/testMatVec.cc @@ -1,197 +1,197 @@ #include "Rivet/Math/MathUtils.hh" #include "Rivet/Math/Vectors.hh" #include "Rivet/Math/Matrices.hh" // #include "Rivet/Math/MatrixDiag.hh" using namespace Rivet; #include #include #include using namespace std; /// Set up an active Lorentz boost in the z direction LorentzTransform mkLTz(const double beta) { assert(abs(beta) < 1); const double gamma = LorentzTransform::beta2gamma(beta); Matrix<4> rtn = Matrix<4>::mkIdentity(); rtn.set(0, 0, gamma); rtn.set(3, 3, gamma); rtn.set(0, 3, +beta*gamma); //< +ve coeff since active boost rtn.set(3, 0, +beta*gamma); //< +ve coeff since active boost return LorentzTransform(rtn); } int main() { FourVector a(1,0,0,0); cout << a << ": interval = " << a.invariant() << endl; assert(fuzzyEquals(a.invariant(), 1)); a.setZ(1); assert(isZero(a.invariant())); cout << a << ": interval = " << a.invariant() << endl; a.setY(2).setZ(3); cout << a << ": interval = " << a.invariant() << endl; assert(fuzzyEquals(a.invariant(), -12)); cout << a << ": vector = " << a.vector3() << endl << endl; FourMomentum b(1,0,0,0); cout << b << ": mass = " << b.mass() << endl; assert(fuzzyEquals(b.mass2(), 1)); b.setPz(1); cout << b << ": mass = " << b.mass() << endl; assert(isZero(b.mass2())); b.setPy(2).setPz(3).setE(6); cout << b << ": mass = " << b.mass2() << endl; assert(fuzzyEquals(b.mass2(), 23)); cout << b << ": vector = " << b.vector3() << endl << endl; Matrix3 m; m.set(0, 0, 7/4.0); m.set(0, 1, 3 * sqrt(3)/4.0); m.set(1, 0, 3 * sqrt(3)/4.0); m.set(1, 1, 13/4.0); m.set(2, 2, 9); cout << m << endl << endl; // EigenSystem<3> es = diagonalize(m); cout << "Matrices:" << endl; cout << Matrix3() << endl; cout << Matrix3::mkIdentity() << endl; const Matrix3 I3 = Matrix3::mkIdentity(); cout << Matrix3::mkIdentity() * m * I3 << endl; cout << "tr(0) & det(0): " << Matrix3().trace() << ", " << Matrix3().det() << endl; cout << "tr(I3) & det(I3): " << I3.trace() << ", " << I3.det() << endl; Matrix3 m1 = Matrix3::mkIdentity(); Matrix3 m2 = m1; m1.setRow(1, Vector3(1,2,3)); m2.setColumn(1, Vector3(3,2,1)); Matrix3 m3 = Matrix3::mkZero(); cout << m1 << " + " << m2 << " = " << m1 + m2 << endl; m3.setRow(0, Vector3(2,3,0)).setRow(1, Vector3(1,4,3)).setRow(2, Vector3(0,1,2)); cout << m1+m2 << " == " << m3 << ": " << (m1+m2 == m3 ? "true" : "false") << endl; cout << endl; Vector3 v3(1,2,3); cout << "Vector: " << v3 << endl; cout << "Invert: " << v3 << " --> " << -v3 << endl; const Matrix3 rot90(Vector3(0,0,1), PI/2.0); const Matrix3 rot90m(Vector3(0,0,1), -PI/2.0); const Matrix3 rot180(Vector3(0,0,1), PI); const Matrix3 rot180m(Vector3(0,0,1), -PI); const Vector3 v3_90 = rot90*v3; cout << "Rot 90: " << v3 << " ---> " << v3_90 << endl; const Vector3 v3_90m = rot90m*v3; cout << "Rot -90: " << v3 << " ---> " << v3_90m << endl; const Vector3 v3_180 = rot180*v3; cout << "Rot 180: " << v3 << " ---> " << v3_180 << endl; const Vector3 v3_180m = rot180m*v3; cout << "Rot -180: " << v3 << " ---> " << v3_180m << endl; assert(fuzzyEquals(v3_180, v3_180m)); const Vector3 v3_9090 = rot90*rot90*v3; cout << "Rot 2 x 90: " << v3 << " ---> " << v3_9090 << endl; assert(fuzzyEquals(v3_180, v3_9090)); const Vector3 v3_90m90m = rot90m*rot90m*v3; cout << "Rot 2 x -90: " << v3 << " ---> " << v3_90m90m << endl; assert(fuzzyEquals(v3_180, v3_90m90m)); const Vector3 v3_9090m = rot90*rot90m*v3; const Vector3 v3_90m90 = rot90m*rot90*v3; cout << "Rot 90*-90: "<< v3 << " ---> " << v3_9090m << endl; cout << "Rot -90*90: "<< v3 << " ---> " << v3_90m90 << endl; assert(fuzzyEquals(v3, v3_9090m)); assert(fuzzyEquals(v3, v3_90m90)); const Vector3 v3_90i = rot90.inverse()*v3; cout << "Rot (90)^-1: "<< v3 << " ---> " << v3_90i << endl; assert(fuzzyEquals(v3_90i, v3_90m)); const Vector3 v3_9090i = rot90*rot90.inverse()*v3; const Vector3 v3_90i90 = rot90.inverse()*rot90*v3; cout << "Rot 90*(90)^-1: "<< v3 << " ---> " << v3_9090i << endl; cout << "Rot (90)^-1*90: "<< v3 << " ---> " << v3_90i90 << endl; assert(fuzzyEquals(v3, v3_9090i)); assert(fuzzyEquals(v3, v3_90i90)); const Matrix3 rot1(Vector3(0,1,0), PI/180.0); cout << "Rot 0 x 45 x 1: " << v3 << endl; for (size_t i = 0; i < 8; ++i) { for (size_t j = 0; j < 45; ++j) { v3 = rot1*v3; } cout << "Rot " << i+1 << " x 45 x 1: " << v3 << endl; } assert(fuzzyEquals(v3, Vector3(1,2,3))); cout << endl; cout << "Boosts:" << endl; LorentzTransform ltX = LorentzTransform::mkObjTransformFromBeta(Vector3(0.5, 0, 0)); cout << "LTx: " << ltX << endl; cout << "I on LTx: " << ltX.rotate(Matrix3::mkIdentity()) << endl; cout << "Rot90 on LTx: " << ltX.rotate(rot90) << endl; cout << endl; LorentzTransform ltY = LorentzTransform::mkObjTransformFromBeta(Vector3(0, 0.5, 0)); cout << "LTy: " << ltY << endl; cout << "I on LTy: " << ltY.rotate(Matrix3::mkIdentity()) << endl; cout << "Rot90 on LTy: " << ltY.rotate(rot90) << endl; cout << endl; LorentzTransform ltZ = LorentzTransform::mkObjTransformFromBeta(Vector3(0, 0, 0.5)); cout << "LTz: " << ltZ << endl; cout << "I on LTz: " << ltZ.rotate(Matrix3::mkIdentity()) << endl; cout << "Rot90 on LTz: " << ltZ.rotate(rot90) << endl; cout << endl; LorentzTransform ltZ2 = mkLTz(0.5); cout << "LTz': " << ltZ2 << endl; cout << endl; LorentzTransform ltXYZ = LorentzTransform::mkObjTransformFromBeta(Vector3(0.1, -0.2, 0.3)); cout << "LTxyz: " << ltXYZ << endl; cout << "I on LTxyz: " << ltXYZ.rotate(Matrix3::mkIdentity()) << endl; cout << "Rot90 on LTxyz: " << ltXYZ.rotate(rot90) << endl; cout << endl; cout << "X-boosts:" << endl; const FourMomentum p1 = FourMomentum(10, 0, 0, 1); const FourMomentum p2 = ltX.transform(p1); cout << p1 << " -> " << p2 << endl; cout << p2 << " -> " << ltX.inverse().transform(p2) << endl; //cout << p1.boostVector() << endl; - cout << "LT(p1) = " << LorentzTransform::mkFrameTransformFromBeta(p1.boostVector()) << endl; - const FourMomentum p3 = LorentzTransform::mkFrameTransformFromBeta(p1.boostVector()).transform(p1); + cout << "LT(p1) = " << LorentzTransform::mkFrameTransformFromBeta(p1.betaVec()) << endl; + const FourMomentum p3 = LorentzTransform::mkFrameTransformFromBeta(p1.betaVec()).transform(p1); cout << p1 << " -> " << p3 << endl; assert(isZero(p3.x())); assert(isZero(p3.y())); assert(isZero(p3.z())); assert(p3.E() < p1.E()); assert(fuzzyEquals(p3.E(), p1.mass())); cout << endl; // LorentzTransform ltY = LorentzTransform::mkObjTransformFromGamma(Vector3(0, 1.2, 0)); cout << FourMomentum(1,0,0,1) << " -> " //<< "\n " << (ltX * ltY).transform(FourMomentum(1,0,0,1)) << endl; cout << FourMomentum(1,0,0,1) << " -> " //<< "\n " << (ltY * ltX).transform(FourMomentum(1,0,0,1)) << endl; cout << (ltX * ltY).betaVec() << endl; cout << (ltY * ltX).betaVec() << endl; cout << (ltX * ltX.inverse()).betaVec() << endl; // If we are already in the rest frame and there is no boost, then LT is trivial/identity LorentzTransform noBoost; cout << "Element 0,0 should be 1 and is " << noBoost.toMatrix().get(0,0) << endl; assert(noBoost.toMatrix().get(0,0)==1); cout << "Element 0,1 should be 0 and is " << noBoost.toMatrix().get(0,1) << endl; assert(noBoost.toMatrix().get(0,1)==0); cout << "Element 1,0 should be 0 and is " << noBoost.toMatrix().get(1,0) << endl; assert(noBoost.toMatrix().get(1,0)==0); cout << "Element 1,1 should be 1 and is " << noBoost.toMatrix().get(1,1) << endl; assert(noBoost.toMatrix().get(1,1)==1); return EXIT_SUCCESS; }