rivet is hosted by Hepforge, IPPP Durham
CMS_2013_I1256943.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/ZFinder.hh"
00004 #include "Rivet/Projections/FinalState.hh"
00005 #include "Rivet/Projections/UnstableFinalState.hh"
00006 
00007 namespace Rivet {
00008 
00009 
00010   /// CMS cross-section and angular correlations in Z boson + b-hadrons events at 7 TeV
00011   class CMS_2013_I1256943 : public Analysis {
00012   public:
00013 
00014     /// Constructor
00015     CMS_2013_I1256943()
00016       : Analysis("CMS_2013_I1256943")
00017     {     }
00018 
00019 
00020     /// Add projections and book histograms
00021     void init() {
00022       _sumW = 0;
00023       _sumW50 = 0;
00024       _sumWpT = 0;
00025 
00026       FinalState fs(-2.4, 2.4, 20.0*GeV);
00027       addProjection(fs, "FS");
00028 
00029       UnstableFinalState ufs(-2, 2, 15.0*GeV);
00030       addProjection(ufs, "UFS");
00031 
00032       ZFinder zfindermu(fs, -2.4, 2.4, 0.0*GeV, PID::MUON, 81.0*GeV, 101.0*GeV, 0.1, ZFinder::NOCLUSTER, ZFinder::TRACK, 91.2*GeV);
00033       addProjection(zfindermu, "ZFinderMu");
00034 
00035       ZFinder zfinderel(fs, -2.4, 2.4, 0.0*GeV, PID::ELECTRON, 81.0*GeV, 101.0*GeV, 0.1, ZFinder::NOCLUSTER, ZFinder::TRACK, 91.2*GeV);
00036       addProjection(zfinderel, "ZFinderEl");
00037 
00038       /// Histograms in non-boosted region of Z pT
00039       _h_dR_BB = bookHisto1D(1, 1, 1);
00040       _h_dphi_BB = bookHisto1D(2, 1, 1);
00041       _h_min_dR_ZB = bookHisto1D(3, 1, 1);
00042       _h_A_ZBB = bookHisto1D(4, 1, 1);
00043 
00044       /// Histograms in boosted region of Z pT (pT > 50 GeV)
00045       _h_dR_BB_boost = bookHisto1D(5, 1, 1);
00046       _h_dphi_BB_boost = bookHisto1D(6, 1, 1);
00047       _h_min_dR_ZB_boost = bookHisto1D(7, 1, 1);
00048       _h_A_ZBB_boost = bookHisto1D(8, 1, 1);
00049 
00050       _h_min_ZpT = bookHisto1D(9,1,1);
00051     }
00052 
00053 
00054     /// Do the analysis
00055     void analyze(const Event& e) {
00056       vector<FourMomentum> Bmom;
00057 
00058       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(e, "UFS");
00059       const ZFinder& zfindermu = applyProjection<ZFinder>(e, "ZFinderMu");
00060       const ZFinder& zfinderel = applyProjection<ZFinder>(e, "ZFinderEl");
00061 
00062       // Look for a Z --> mu+ mu- event in the final state
00063       if (zfindermu.empty() && zfinderel.empty()) vetoEvent;
00064 
00065       const Particles& z = !zfindermu.empty() ? zfindermu.bosons() : zfinderel.bosons();
00066       const bool is_boosted = ( z[0].pT() > 50*GeV );
00067 
00068       // Loop over the unstable particles
00069       foreach (const Particle& p, ufs.particles()) {
00070         const PdgId pid = p.pid();
00071 
00072         // Look for particles with a bottom quark
00073         if (PID::hasBottom(pid)) {
00074 
00075           bool good_B = false;
00076           const HepMC::GenParticle* pgen = p.genParticle();
00077           HepMC::GenVertex* vgen = pgen -> end_vertex();
00078 
00079           // Loop over the decay products of each unstable particle.
00080           // Look for a couple of B hadrons.
00081           for (HepMC::GenVertex::particles_out_const_iterator it = vgen->particles_out_const_begin(); it !=  vgen->particles_out_const_end(); ++it) {
00082             // If the particle produced has a bottom quark do not count it and go to the next loop cycle.
00083             if (!( PID::hasBottom( (*it)->pdg_id() ) ) ) {
00084               good_B = true;
00085               continue;
00086             } else {
00087               good_B = false;
00088               break;
00089             }
00090           }
00091           if (good_B ) Bmom.push_back( p.momentum() );
00092         }
00093         else continue;
00094       }
00095 
00096       // If there are more than two B's in the final state veto the event
00097       if (Bmom.size() != 2 ) vetoEvent;
00098 
00099       // Calculate the observables
00100       double dphiBB = fabs(Bmom[0].phi() - Bmom[1].phi());
00101       double dRBB = deltaR(Bmom[0], Bmom[1]);
00102 
00103       const FourMomentum& pZ = z[0].momentum();
00104       const bool closest_B = ( deltaR(pZ, Bmom[0]) < deltaR(pZ, Bmom[1]) );
00105       const double mindR_ZB = closest_B ? deltaR(pZ, Bmom[0]) : deltaR(pZ, Bmom[1]);
00106       const double maxdR_ZB = closest_B ? deltaR(pZ, Bmom[1]) : deltaR(pZ, Bmom[0]);
00107       const double AZBB = ( maxdR_ZB - mindR_ZB ) / ( maxdR_ZB + mindR_ZB );
00108 
00109       // Get event weight for histogramming
00110       const double weight = e.weight();
00111 
00112       // Fill the histograms in the non-boosted region
00113       _h_dphi_BB->fill(dphiBB, weight);
00114       _h_dR_BB->fill(dRBB, weight);
00115       _h_min_dR_ZB->fill(mindR_ZB, weight);
00116       _h_A_ZBB->fill(AZBB, weight);
00117       _sumW += weight;
00118       _sumWpT += weight;
00119 
00120       // Fill the histograms in the boosted region
00121       if (is_boosted) {
00122         _sumW50 += weight;
00123         _h_dphi_BB_boost->fill(dphiBB, weight);
00124         _h_dR_BB_boost->fill(dRBB, weight);
00125         _h_min_dR_ZB_boost->fill(mindR_ZB, weight);
00126         _h_A_ZBB_boost->fill(AZBB, weight);
00127       }
00128 
00129       // Fill Z pT (cumulative) histogram
00130       _h_min_ZpT->fill(0, weight);
00131       if (pZ.pT() > 40*GeV ) {
00132         _sumWpT += weight;
00133         _h_min_ZpT->fill(40, weight);
00134       }
00135       if (pZ.pT() > 80*GeV ) {
00136         _sumWpT += weight;
00137         _h_min_ZpT->fill(80, weight);
00138       }
00139       if (pZ.pT() > 120*GeV ) {
00140         _sumWpT += weight;
00141         _h_min_ZpT->fill(120, weight);
00142       }
00143 
00144       Bmom.clear();
00145     }
00146 
00147 
00148     /// Finalize
00149     void finalize() {
00150 
00151       // Normalize excluding overflow bins (d'oh)
00152       normalize(_h_dR_BB, 0.7*crossSection()*_sumW/sumOfWeights(), false);  // d01-x01-y01
00153       normalize(_h_dphi_BB, 0.53*crossSection()*_sumW/sumOfWeights(), false);   // d02-x01-y01
00154       normalize(_h_min_dR_ZB, 0.84*crossSection()*_sumW/sumOfWeights(), false); // d03-x01-y01
00155       normalize(_h_A_ZBB, 0.2*crossSection()*_sumW/sumOfWeights(), false);  // d04-x01-y01
00156 
00157       normalize(_h_dR_BB_boost, 0.84*crossSection()*_sumW50/sumOfWeights(), false); // d05-x01-y01
00158       normalize(_h_dphi_BB_boost, 0.63*crossSection()*_sumW50/sumOfWeights(), false);   // d06-x01-y01
00159       normalize(_h_min_dR_ZB_boost, 1*crossSection()*_sumW50/sumOfWeights(), false);    // d07-x01-y01
00160       normalize(_h_A_ZBB_boost, 0.25*crossSection()*_sumW50/sumOfWeights(), false); // d08-x01-y01
00161 
00162       normalize(_h_min_ZpT, 40*crossSection()*_sumWpT/sumOfWeights(), false);   // d09-x01-y01
00163     }
00164 
00165 
00166   private:
00167 
00168     /// @name Weight counters
00169     //@{
00170     double _sumW, _sumW50, _sumWpT;
00171     //@}
00172 
00173     /// @name Histograms
00174     //@{
00175     Histo1DPtr _h_dphi_BB, _h_dR_BB, _h_min_dR_ZB, _h_A_ZBB;
00176     Histo1DPtr _h_dphi_BB_boost, _h_dR_BB_boost, _h_min_dR_ZB_boost, _h_A_ZBB_boost, _h_min_ZpT;
00177     //@}
00178 
00179   };
00180 
00181 
00182   // Hook for the plugin system
00183   DECLARE_RIVET_PLUGIN(CMS_2013_I1256943);
00184 
00185 }