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