rivet is hosted by Hepforge, IPPP Durham
ATLAS_2012_I1188891.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #include "Rivet/Analysis.hh"
00003 #include "Rivet/Projections/FastJets.hh"
00004 #include "Rivet/Tools/BinnedHistogram.hh"
00005 #include "Rivet/Projections/ChargedFinalState.hh"
00006 #include "Rivet/Particle.hh"
00007 
00008 //#include <iostream>
00009 
00010 namespace Rivet {
00011 
00012 
00013   class ATLAS_2012_I1188891 : public Analysis {
00014 
00015   public:
00016 
00017 
00018     ATLAS_2012_I1188891()
00019       : Analysis("ATLAS_2012_I1188891")
00020     {
00021     }
00022 
00023 
00024 
00025   public:
00026 
00027     void init() {
00028 
00029       const FinalState fs;
00030       FastJets fj04(fs,  FastJets::ANTIKT, 0.4);
00031       addProjection(fj04, "AntiKT04");
00032 
00033       string histotitle[7]={"BBfraction","BCfraction","CCfraction","BUfraction","CUfraction","UUfraction","Total"};
00034       for (int i = 0 ; i < 7 ; i++){
00035         _h_temp[i] = bookHisto1D(1, 1, 1, histotitle[i]);
00036         if (i < 6) {
00037           _h_results[i] = bookScatter2D(i+1, 1, 1);
00038         }
00039       }
00040     }
00041 
00042 
00043     void analyze(const Event& event) {
00044 
00045       double weight    = event.weight();
00046       double weight100 = event.weight() * 100.;  //to get results in %
00047 
00048       //keeps jets with pt>20 geV and ordered in decreasing pt
00049       Jets jetAr = applyProjection<FastJets>(event, "AntiKT04").jetsByPt(20*GeV);
00050 
00051       int flav[2]={1,1};
00052       vector<FourMomentum> leadjets;
00053 
00054       //get b/c-hadrons
00055       std::vector<HepMC::GenParticle*> B_hadrons;
00056       std::vector<HepMC::GenParticle*> C_hadrons;
00057       std::vector<HepMC::GenParticle*> allParticles = particles(event.genEvent());
00058       for(unsigned int i = 0; i < allParticles.size(); i++) {
00059         GenParticle* p = allParticles.at(i);
00060         if(p->momentum().perp()*GeV < 5) continue;
00061         if ( (Rivet::PID::isHadron ( p->pdg_id() ) &&
00062               Rivet::PID::hasBottom( p->pdg_id() )    ) ) {
00063           B_hadrons.push_back(p);
00064         }
00065         if ( (Rivet::PID::isHadron( p->pdg_id() ) &&
00066               Rivet::PID::hasCharm( p->pdg_id() )    ) ) {
00067           C_hadrons.push_back(p);
00068         }
00069       }
00070 
00071       //select dijet
00072       foreach (const Jet& jet, jetAr) {
00073 
00074         const double pT   = jet.pT();
00075         const double absy = fabs(jet.rapidity());
00076 
00077         bool isBjet = false;
00078         //not using this
00079         //isBjet = jet.containsBottom();
00080         foreach(HepMC::GenParticle* b, B_hadrons) {
00081           FourMomentum hadron = b->momentum();
00082           double hadron_jet_dR = deltaR(jet.momentum(), hadron);
00083           if(hadron_jet_dR < 0.3) isBjet = true;
00084         }
00085 
00086         bool isCjet = false;
00087         //bool isCjet = jet.containsCharm();
00088         foreach(HepMC::GenParticle* c, C_hadrons) {
00089           FourMomentum hadron = c->momentum();
00090           double hadron_jet_dR = deltaR(jet.momentum(), hadron);
00091           if(hadron_jet_dR < 0.3) isCjet = true;
00092         }
00093 
00094         int jetflav=1;
00095         if      (isBjet)jetflav=5;
00096         else if (isCjet)jetflav=4;
00097 
00098         if (absy <= 2.1 && leadjets.size() < 2) {
00099 
00100           if (pT > 500*GeV) continue;
00101           if ((leadjets.empty() && pT < 40*GeV) || pT < 20*GeV) continue;
00102 
00103           leadjets.push_back(jet.momentum());
00104 
00105           if (leadjets.size()==1) flav[0] = jetflav;
00106           if (leadjets.size()==2) flav[1] = jetflav;
00107         }
00108       }
00109 
00110       if (leadjets.size() < 2) vetoEvent;
00111 
00112 
00113       double pBinsLJ[7] = {40.,60.,80.,120.,160.,250.,500.};
00114       int    iPBinLJ = -1;
00115 
00116       for (int k = 0 ; k < 7 ; k++) {
00117         if (leadjets[0].pT() > pBinsLJ[k]*GeV) iPBinLJ=k;
00118         else break;
00119       }
00120 
00121       bool c_ljpt  = (iPBinLJ != -1);
00122       bool c_nljpt = leadjets[1].pT() > 20*GeV;
00123       bool c_dphi  = fabs( deltaPhi(leadjets[0],leadjets[1]) ) > 2.1;
00124       bool isDijet = c_ljpt & c_nljpt & c_dphi;
00125       if (!isDijet) vetoEvent;
00126 
00127       _h_temp[6]->fill(leadjets[0].pT(), weight);
00128 
00129       if (flav[0]==5 && flav[1]==5)                                  // BB dijet
00130         _h_temp[0]->fill(leadjets[0].pT(), weight100);
00131 
00132       if ((flav[0]==5 && flav[1]==4) || (flav[0]==4 && flav[1]==5))  // BC dijet
00133         _h_temp[1]->fill(leadjets[0].pT(), weight100);
00134 
00135       if (flav[0]==4 && flav[1]==4)                                  // CC dijet
00136         _h_temp[2]->fill(leadjets[0].pT(), weight100);
00137 
00138       if ((flav[0]==5 && flav[1]==1) || (flav[0]==1 && flav[1]==5))  // B-light dijet
00139         _h_temp[3]->fill(leadjets[0].pT(), weight100);
00140 
00141       if ((flav[0]==4 && flav[1]==1) || (flav[0]==1 && flav[1]==4))  // C-light dijet
00142         _h_temp[4]->fill(leadjets[0].pT(), weight100);
00143 
00144       if (flav[0]==1 && flav[1]==1)                                  // light-light dijet
00145         _h_temp[5]->fill(leadjets[0].pT(), weight100);
00146     }
00147 
00148 
00149     void finalize() {
00150       divide(_h_temp[0], _h_temp[6], _h_results[0]);
00151       divide(_h_temp[1], _h_temp[6], _h_results[1]);
00152       divide(_h_temp[2], _h_temp[6], _h_results[2]);
00153       divide(_h_temp[3], _h_temp[6], _h_results[3]);
00154       divide(_h_temp[4], _h_temp[6], _h_results[4]);
00155       divide(_h_temp[5], _h_temp[6], _h_results[5]);
00156     }
00157 
00158   private:
00159 
00160     Histo1DPtr   _h_temp[7];
00161     Scatter2DPtr _h_results[6];
00162   };
00163 
00164   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1188891);
00165 
00166 }