rivet is hosted by Hepforge, IPPP Durham
CMS_2011_S8973270.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/RivetYODA.hh"
00004 #include "Rivet/Tools/Logging.hh"
00005 #include "Rivet/Projections/FinalState.hh"
00006 #include "Rivet/Projections/UnstableFinalState.hh"
00007 #include "Rivet/Projections/FastJets.hh"
00008 
00009 namespace Rivet {
00010 
00011 
00012   class CMS_2011_S8973270 : public Analysis {
00013   public:
00014 
00015     /// Constructor
00016     CMS_2011_S8973270() : Analysis("CMS_2011_S8973270") {  }
00017 
00018 
00019     void init() {
00020       FinalState fs;
00021       FastJets jetproj(fs, FastJets::ANTIKT, 0.5);
00022       jetproj.useInvisibles();
00023       addProjection(jetproj, "Jets");
00024 
00025       UnstableFinalState ufs;
00026       addProjection(ufs, "UFS");
00027 
00028       // Book histograms
00029       _h_dsigma_dR_56GeV = bookHisto1D(1,1,1);
00030       _h_dsigma_dR_84GeV = bookHisto1D(2,1,1);
00031       _h_dsigma_dR_120GeV = bookHisto1D(3,1,1);
00032       _h_dsigma_dPhi_56GeV = bookHisto1D(4,1,1);
00033       _h_dsigma_dPhi_84GeV = bookHisto1D(5,1,1);
00034       _h_dsigma_dPhi_120GeV = bookHisto1D(6,1,1);
00035 
00036       _countMCDR56 = 0;
00037       _countMCDR84 = 0;
00038       _countMCDR120 = 0;
00039       _countMCDPhi56 = 0;
00040       _countMCDPhi84 = 0;
00041       _countMCDPhi120 = 0;
00042     }
00043 
00044 
00045     /// Perform the per-event analysis
00046     void analyze(const Event& event) {
00047       const double weight = event.weight();
00048 
00049       const Jets& jets = applyProjection<FastJets>(event,"Jets").jetsByPt();
00050       const UnstableFinalState& ufs = applyProjection<UnstableFinalState>(event, "UFS");
00051 
00052       // Find the leading jet pT and eta
00053       if (jets.size() == 0) vetoEvent;
00054       const double ljpT = jets[0].momentum().pT();
00055       const double ljeta = jets[0].momentum().eta();
00056       MSG_DEBUG("Leading jet pT / eta: " << ljpT << " / " << ljeta);
00057 
00058       // Minimum requirement for event
00059       if (ljpT > 56*GeV && fabs(ljeta) < 3.0) {
00060         // Find B hadrons in event
00061         int nab = 0, nb = 0; //counters for all B and independent B hadrons
00062         double etaB1 = 7.7, etaB2 = 7.7;
00063         double phiB1 = 7.7, phiB2 = 7.7;
00064         double pTB1 = 7.7, pTB2 = 7.7;
00065 
00066         foreach (const Particle& p, ufs.particles()) {
00067           int aid = abs(p.pdgId());
00068           if (aid/100 == 5 || aid/1000==5) {
00069             nab++;
00070             // 2J+1 == 1 (mesons) or 2 (baryons)
00071             if (aid%10 == 1 || aid%10 == 2) {
00072               // No B decaying to B
00073               if (aid != 5222 && aid != 5112 && aid != 5212 && aid != 5322) {
00074                 if (nb==0) {
00075                   etaB1 = p.momentum().eta();
00076                   phiB1 = p.momentum().phi();
00077                   pTB1 = p.momentum().pT();
00078                 } else if (nb==1) {
00079                   etaB2 = p.momentum().eta();
00080                   phiB2 = p.momentum().phi();
00081                   pTB2 = p.momentum().pT();
00082                 }
00083                 nb++;
00084               }
00085             }
00086             MSG_DEBUG("ID " << aid <<  " B hadron");
00087           }
00088         }
00089 
00090         if (nb==2 && pTB1 > 15*GeV && pTB2 > 15*GeV && fabs(etaB1) < 2.0 && fabs(etaB2) < 2.0) {
00091           double dPhi = deltaPhi(phiB1, phiB2);
00092           double dR = deltaR(etaB1, phiB1, etaB2, phiB2);
00093           MSG_DEBUG("DR/DPhi " << dR << " " << dPhi);
00094 
00095           // MC counters
00096           if (dR > 2.4) _countMCDR56 += weight;
00097           if (dR > 2.4 && ljpT > 84*GeV) _countMCDR84 += weight;
00098           if (dR > 2.4 && ljpT > 120*GeV) _countMCDR120 += weight;
00099           if (dPhi > 3.*PI/4.) _countMCDPhi56 += weight;
00100           if (dPhi > 3.*PI/4. && ljpT > 84*GeV) _countMCDPhi84 += weight;
00101           if (dPhi > 3.*PI/4. && ljpT > 120*GeV) _countMCDPhi120 += weight;
00102 
00103           _h_dsigma_dR_56GeV->fill(dR, weight);
00104           if (ljpT > 84*GeV) _h_dsigma_dR_84GeV->fill(dR, weight);
00105           if (ljpT > 120*GeV) _h_dsigma_dR_120GeV->fill(dR, weight);
00106           _h_dsigma_dPhi_56GeV->fill(dPhi, weight);
00107           if (ljpT > 84*GeV) _h_dsigma_dPhi_84GeV->fill(dPhi, weight);
00108           if (ljpT > 120*GeV) _h_dsigma_dPhi_120GeV->fill(dPhi, weight);
00109           //MSG_DEBUG("nb " << nb << " " << nab);
00110         }
00111       }
00112     }
00113 
00114 
00115     /// Normalise histograms etc., after the run
00116     void finalize() {
00117       MSG_DEBUG("crossSection " << crossSection() << " sumOfWeights " << sumOfWeights());
00118 
00119       // Hardcoded bin widths
00120       double DRbin = 0.4;
00121       double DPhibin = PI/8.0;
00122       // Find out the correct numbers
00123       double nDataDR56 = 25862.20;
00124       double nDataDR84 = 5675.55;
00125       double nDataDR120 = 1042.72;
00126       double nDataDPhi56 = 24220.00;
00127       double nDataDPhi84 = 4964.00;
00128       double nDataDPhi120 = 919.10;
00129       double normDR56 = (_countMCDR56 > 0.) ? nDataDR56/_countMCDR56 : crossSection()/sumOfWeights();
00130       double normDR84 = (_countMCDR84 > 0.) ? nDataDR84/_countMCDR84 : crossSection()/sumOfWeights();
00131       double normDR120 = (_countMCDR120 > 0.) ? nDataDR120/_countMCDR120 : crossSection()/sumOfWeights();
00132       double normDPhi56 = (_countMCDPhi56 > 0.) ? nDataDPhi56/_countMCDPhi56 : crossSection()/sumOfWeights();
00133       double normDPhi84 = (_countMCDPhi84 > 0.) ? nDataDPhi84/_countMCDPhi84 : crossSection()/sumOfWeights();
00134       double normDPhi120 = (_countMCDPhi120 > 0.) ? nDataDPhi120/_countMCDPhi120 : crossSection()/sumOfWeights();
00135       scale(_h_dsigma_dR_56GeV, normDR56*DRbin);
00136       scale(_h_dsigma_dR_84GeV, normDR84*DRbin);
00137       scale(_h_dsigma_dR_120GeV, normDR120*DRbin);
00138       scale(_h_dsigma_dPhi_56GeV, normDPhi56*DPhibin);
00139       scale(_h_dsigma_dPhi_84GeV, normDPhi84*DPhibin);
00140       scale(_h_dsigma_dPhi_120GeV, normDPhi120*DPhibin);
00141     }
00142 
00143     //@}
00144 
00145 
00146   private:
00147 
00148     /// @name Counters
00149     //@{
00150     double _countMCDR56, _countMCDR84, _countMCDR120;
00151     double _countMCDPhi56, _countMCDPhi84, _countMCDPhi120;
00152     //@}
00153 
00154     /// @name Histograms
00155     //@{
00156     Histo1DPtr _h_dsigma_dR_56GeV, _h_dsigma_dR_84GeV, _h_dsigma_dR_120GeV;
00157     Histo1DPtr _h_dsigma_dPhi_56GeV, _h_dsigma_dPhi_84GeV, _h_dsigma_dPhi_120GeV;
00158     //@}
00159 
00160   };
00161 
00162 
00163   // Hook for the plugin system
00164   DECLARE_RIVET_PLUGIN(CMS_2011_S8973270);
00165 
00166 }