diff --git a/analyses/pluginBABAR/BABAR_2006_I719581.cc b/analyses/pluginBABAR/BABAR_2006_I719581.cc --- a/analyses/pluginBABAR/BABAR_2006_I719581.cc +++ b/analyses/pluginBABAR/BABAR_2006_I719581.cc @@ -1,119 +1,119 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Omega decay asymmetries class BABAR_2006_I719581 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(BABAR_2006_I719581); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(UnstableParticles(), "UFS" ); // Book histograms - _h_ctheta_xic = bookHisto1D(1,1,1); - _h_ctheta_omegac = bookHisto1D(2,1,1); + book(_h_ctheta_xic ,1,1,1); + book(_h_ctheta_omegac,2,1,1); } /// Perform the per-event analysis void analyze(const Event& event) { // loop over Xi_c0 baryons and Omega_c0 baryons - foreach(const Particle& baryon, apply(event, "UFS").particles(Cuts::abspid==4132 || Cuts::abspid==4332 )) { + for(const Particle& baryon : apply(event, "UFS").particles(Cuts::abspid==4132 || Cuts::abspid==4332 )) { int sign = baryon.pid()/baryon.abspid(); if(baryon.children().size()!=2) continue; Particle baryon1,meson1; if(baryon.abspid()==4132) { - if(baryon.children()[0].pdgId()==sign*3334 && - baryon.children()[1].pdgId()==sign*321) { + if(baryon.children()[0].pid()==sign*3334 && + baryon.children()[1].pid()==sign*321) { baryon1 = baryon.children()[0]; meson1 = baryon.children()[1]; } - else if(baryon.children()[1].pdgId()==sign*3332 && - baryon.children()[0].pdgId()==sign*321) { + else if(baryon.children()[1].pid()==sign*3332 && + baryon.children()[0].pid()==sign*321) { baryon1 = baryon.children()[1]; meson1 = baryon.children()[0]; } else continue; } else { - if(baryon.children()[0].pdgId()==sign*3334 && - baryon.children()[1].pdgId()==sign*211) { + if(baryon.children()[0].pid()==sign*3334 && + baryon.children()[1].pid()==sign*211) { baryon1 = baryon.children()[0]; meson1 = baryon.children()[1]; } - else if(baryon.children()[1].pdgId()==sign*3334 && - baryon.children()[0].pdgId()==sign*211) { + else if(baryon.children()[1].pid()==sign*3334 && + baryon.children()[0].pid()==sign*211) { baryon1 = baryon.children()[1]; meson1 = baryon.children()[0]; } else continue; } Particle baryon2,meson2; - if(baryon1.children()[0].pdgId()== sign*3122 && - baryon1.children()[1].pdgId()==-sign*321) { + if(baryon1.children()[0].pid()== sign*3122 && + baryon1.children()[1].pid()==-sign*321) { baryon2 = baryon1.children()[0]; meson2 = baryon1.children()[1]; } - else if(baryon1.children()[1].pdgId()== sign*3122 && - baryon1.children()[0].pdgId()==-sign*321) { + else if(baryon1.children()[1].pid()== sign*3122 && + baryon1.children()[0].pid()==-sign*321) { baryon2 = baryon1.children()[1]; meson2 = baryon1.children()[0]; } else continue; // first boost to the Xic/Omegac rest frame LorentzTransform boost1 = LorentzTransform::mkFrameTransformFromBeta(baryon.momentum().betaVec()); FourMomentum pbaryon1 = boost1.transform(baryon1.momentum()); FourMomentum pbaryon2 = boost1.transform(baryon2.momentum()); // to omega rest frame LorentzTransform boost2 = LorentzTransform::mkFrameTransformFromBeta(pbaryon1.betaVec()); Vector3 axis = pbaryon1.p3().unit(); FourMomentum pp = boost2.transform(pbaryon2); // calculate angle double cTheta = pp.p3().unit().dot(axis); if(baryon.abspid()==4132) _h_ctheta_xic->fill(cTheta,1.); else _h_ctheta_omegac->fill(cTheta,1.); } } /// Normalise histograms etc., after the run void finalize() { normalize(_h_ctheta_xic); normalize(_h_ctheta_omegac); } //@} /// @name Histograms //@{ Histo1DPtr _h_ctheta_xic,_h_ctheta_omegac; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BABAR_2006_I719581); } diff --git a/analyses/pluginBES/BESIII_2019_I1747092.cc b/analyses/pluginBES/BESIII_2019_I1747092.cc --- a/analyses/pluginBES/BESIII_2019_I1747092.cc +++ b/analyses/pluginBES/BESIII_2019_I1747092.cc @@ -1,159 +1,160 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/Beam.hh" #include "Rivet/Projections/FinalState.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief BES psi2s -> Xi*- Xibar*+ class BESIII_2019_I1747092 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(BESIII_2019_I1747092); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(Beam(), "Beams"); declare(UnstableParticles(), "UFS"); declare(FinalState(), "FS"); - _h_xim = bookHisto1D(1, 1, 1); - _h_xip = bookHisto1D(1, 1, 2); + book(_h_xim, 1, 1, 1); + book(_h_xip, 1, 1, 2); } 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) { // get the axis, direction of incoming electron const ParticlePair& beams = apply(event, "Beams").beams(); Vector3 axis; - if(beams.first.pdgId()>0) + if(beams.first.pid()>0) axis = beams.first .momentum().p3().unit(); else axis = beams.second.momentum().p3().unit(); // types of final state particles 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 UnstableParticles & ufs = apply(event, "UFS"); - foreach (const Particle& p, ufs.particles(Cuts::abspid==3314)) { + for (const Particle& p : ufs.particles(Cuts::abspid==3314)) { if(p.children().empty()) continue; map nRes=nCount; int ncount = ntotal; findChildren(p,nRes,ncount); bool matched=false; // check for antiparticle - foreach (const Particle& p2, ufs.particles(Cuts::pid==-p.pdgId())) { + for (const Particle& p2 : ufs.particles(Cuts::pid==-p.pid())) { if(p2.children().empty()) continue; map nRes2=nRes; int ncount2 = ncount; findChildren(p2,nRes2,ncount2); if(ncount2==0) { matched = true; for(auto const & val : nRes2) { if(val.second!=0) { matched = false; break; } } // fond baryon and antibaryon if(matched) { // calc cosine double ctheta1 = p .momentum().p3().unit().dot(axis); double ctheta2 = p2.momentum().p3().unit().dot(axis); if(p.pid()<0) swap(ctheta1,ctheta2); - _h_xim->fill(ctheta1,event.weight()); - _h_xip->fill(ctheta1,event.weight()); + _h_xim->fill(ctheta1); + _h_xip->fill(ctheta1); break; } } } if(matched) break; } } pair > calcAlpha(Histo1DPtr hist) { if(hist->numEntries()==0.) return make_pair(0.,make_pair(0.,0.)); double d = 3./(pow(hist->xMax(),3)-pow(hist->xMin(),3)); double c = 3.*(hist->xMax()-hist->xMin())/(pow(hist->xMax(),3)-pow(hist->xMin(),3)); double sum1(0.),sum2(0.),sum3(0.),sum4(0.),sum5(0.); for (auto bin : hist->bins() ) { double Oi = bin.area(); if(Oi==0.) continue; double a = d*(bin.xMax() - bin.xMin()); double b = d/3.*(pow(bin.xMax(),3) - pow(bin.xMin(),3)); double Ei = bin.areaErr(); sum1 += a*Oi/sqr(Ei); sum2 += b*Oi/sqr(Ei); sum3 += sqr(a)/sqr(Ei); sum4 += sqr(b)/sqr(Ei); sum5 += a*b/sqr(Ei); } // calculate alpha double alpha = (-c*sum1 + sqr(c)*sum2 + sum3 - c*sum5)/(sum1 - c*sum2 + c*sum4 - sum5); // and error double cc = -pow((sum3 + sqr(c)*sum4 - 2*c*sum5),3); double bb = -2*sqr(sum3 + sqr(c)*sum4 - 2*c*sum5)*(sum1 - c*sum2 + c*sum4 - sum5); double aa = sqr(sum1 - c*sum2 + c*sum4 - sum5)*(-sum3 - sqr(c)*sum4 + sqr(sum1 - c*sum2 + c*sum4 - sum5) + 2*c*sum5); double dis = sqr(bb)-4.*aa*cc; if(dis>0.) { dis = sqrt(dis); return make_pair(alpha,make_pair(0.5*(-bb+dis)/aa,-0.5*(-bb-dis)/aa)); } else { return make_pair(alpha,make_pair(0.,0.)); } } /// Normalise histograms etc., after the run void finalize() { normalize(_h_xim,1.,false); normalize(_h_xip,1.,false); - Scatter2DPtr _h_alpha_xi = bookScatter2D(2,1,1); + Scatter2DPtr _h_alpha_xi; + book(_h_alpha_xi, 2,1,1); pair > alpha = calcAlpha(_h_xim); _h_alpha_xi->addPoint(0.5, alpha.first, make_pair(0.5,0.5), make_pair(alpha.second.first,alpha.second.second) ); } //@} /// @name Histograms //@{+ Histo1DPtr _h_xim,_h_xip; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(BESIII_2019_I1747092); } diff --git a/analyses/pluginMisc/WA46_1984_I206647.cc b/analyses/pluginMisc/WA46_1984_I206647.cc --- a/analyses/pluginMisc/WA46_1984_I206647.cc +++ b/analyses/pluginMisc/WA46_1984_I206647.cc @@ -1,183 +1,186 @@ // -*- C++ -*- #include "Rivet/Analysis.hh" #include "Rivet/Projections/UnstableParticles.hh" namespace Rivet { /// @brief Omega decay asymmetries class WA46_1984_I206647 : public Analysis { public: /// Constructor DEFAULT_RIVET_ANALYSIS_CTOR(WA46_1984_I206647); /// @name Analysis methods //@{ /// Book histograms and initialise projections before the run void init() { // Initialise and register projections declare(UnstableParticles(), "UFS" ); // Book histograms - _h_cthetalam = bookHisto1D("cthetaP" ,20,-1,1); - _h_cthetaxi0 = bookHisto1D("cthetaM" ,20,-1,1); - _h_cthetaxim = bookHisto1D("cthetaAll",20,-1,1); + book(_h_cthetalam ,"cthetaP" ,20,-1,1); + book(_h_cthetaxi0 ,"cthetaM" ,20,-1,1); + book(_h_cthetaxim ,"cthetaAll",20,-1,1); } /// Perform the per-event analysis void analyze(const Event& event) { // loop over Omega baryons - foreach(const Particle& Omega, apply(event, "UFS").particles(Cuts::abspid==3334)) { + for(const Particle& Omega : apply(event, "UFS").particles(Cuts::abspid==3334)) { int sign = Omega.pid()/3334; if(Omega.children().size()!=2) continue; Particle baryon1,meson1; if(Omega.children()[0].pid()==sign*3122 && Omega.children()[1].pid()==-sign*321) { baryon1 = Omega.children()[0]; meson1 = Omega.children()[1]; } else if(Omega.children()[1].pid()==sign*3122 && Omega.children()[0].pid()==-sign*321) { baryon1 = Omega.children()[1]; meson1 = Omega.children()[0]; } else if(Omega.children()[0].pid()==sign*3322 && Omega.children()[1].pid()==-sign*211) { baryon1 = Omega.children()[0]; meson1 = Omega.children()[1]; } else if(Omega.children()[1].pid()==sign*3322 && Omega.children()[0].pid()==-sign*211) { baryon1 = Omega.children()[1]; meson1 = Omega.children()[0]; } else if(Omega.children()[0].pid()==sign*3312 && Omega.children()[1].pid()==111) { baryon1 = Omega.children()[0]; meson1 = Omega.children()[1]; } else if(Omega.children()[1].pid()==sign*3312 && Omega.children()[0].pid()==111) { baryon1 = Omega.children()[1]; meson1 = Omega.children()[0]; } else continue; if(baryon1.children().size()!=2) continue; Particle baryon2,meson2; if(baryon1.abspid()==3122) { if(baryon1.children()[0].pid()==sign*2212 && baryon1.children()[1].pid()==-sign*211) { baryon2 = baryon1.children()[0]; meson2 = baryon1.children()[1]; } else if(baryon1.children()[1].pid()==sign*2212 && baryon1.children()[0].pid()==-sign*211) { baryon2 = baryon1.children()[1]; meson2 = baryon1.children()[0]; } else continue; } else if(baryon1.abspid()==3322) { if(baryon1.children()[0].pid()==sign*3122 && baryon1.children()[1].pid()==111) { baryon2 = baryon1.children()[0]; meson2 = baryon1.children()[1]; } else if(baryon1.children()[1].pid()==sign*3122 && baryon1.children()[0].pid()==111) { baryon2 = baryon1.children()[1]; meson2 = baryon1.children()[0]; } else continue; } else if (baryon1.abspid()==3312) { if(baryon1.children()[0].pid()==sign*3122 && baryon1.children()[1].pid()==-sign*211) { baryon2 = baryon1.children()[0]; meson2 = baryon1.children()[1]; } else if(baryon1.children()[1].pid()==sign*3122 && baryon1.children()[0].pid()==-sign*211) { baryon2 = baryon1.children()[1]; meson2 = baryon1.children()[0]; } else continue; } // first boost to the Omega rest frame LorentzTransform boost1 = LorentzTransform::mkFrameTransformFromBeta(Omega.momentum().betaVec()); FourMomentum pbaryon1 = boost1.transform(baryon1.momentum()); FourMomentum pbaryon2 = boost1.transform(baryon2.momentum()); // to lambda rest frame LorentzTransform boost2 = LorentzTransform::mkFrameTransformFromBeta(pbaryon1.betaVec()); Vector3 axis = pbaryon1.p3().unit(); FourMomentum pp = boost2.transform(pbaryon2); // calculate angle double cTheta = pp.p3().unit().dot(axis); if(baryon1.abspid()==3122) - _h_cthetalam->fill(cTheta,event.weight()); + _h_cthetalam->fill(cTheta); else if(baryon1.abspid()==3322) - _h_cthetaxi0->fill(cTheta,event.weight()); + _h_cthetaxi0->fill(cTheta); else if(baryon1.abspid()==3312) - _h_cthetaxim->fill(cTheta,event.weight()); + _h_cthetaxim->fill(cTheta); } } pair calcAlpha(Histo1DPtr hist) { if(hist->numEntries()==0.) return make_pair(0.,0.); double sum1(0.),sum2(0.); for (auto bin : hist->bins() ) { double Oi = bin.area(); if(Oi==0.) continue; double ai = 0.5*(bin.xMax()-bin.xMin()); double bi = 0.5*ai*(bin.xMax()+bin.xMin()); double Ei = bin.areaErr(); sum1 += sqr(bi/Ei); sum2 += bi/sqr(Ei)*(Oi-ai); } return make_pair(sum2/sum1,sqrt(1./sum1)); } /// Normalise histograms etc., after the run void finalize() { normalize(_h_cthetalam); normalize(_h_cthetaxi0); normalize(_h_cthetaxim); // calculate the values of alpha - Scatter2DPtr _h_alphaLam = bookScatter2D(1,1,1); + Scatter2DPtr _h_alphaLam; + book(_h_alphaLam,1,1,1); pair alpha = calcAlpha(_h_cthetalam); _h_alphaLam->addPoint(0.5, alpha.first, make_pair(0.5,0.5), make_pair(alpha.second,alpha.second) ); - Scatter2DPtr _h_alphaXi0 = bookScatter2D(1,1,2); + Scatter2DPtr _h_alphaXi0; + book(_h_alphaXi0,1,1,2); alpha = calcAlpha(_h_cthetaxi0); _h_alphaXi0->addPoint(0.5, alpha.first, make_pair(0.5,0.5), make_pair(alpha.second,alpha.second) ); - Scatter2DPtr _h_alphaXim = bookScatter2D(1,1,3); + Scatter2DPtr _h_alphaXim; + book(_h_alphaXim,1,1,3); alpha = calcAlpha(_h_cthetaxim); _h_alphaXim->addPoint(0.5, alpha.first, make_pair(0.5,0.5), make_pair(alpha.second,alpha.second) ); } //@} /// @name Histograms //@{ Histo1DPtr _h_cthetalam,_h_cthetaxi0,_h_cthetaxim; //@} }; // The hook for the plugin system DECLARE_RIVET_PLUGIN(WA46_1984_I206647); }