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("TMP/"+histotitle[i],refData(1,1,1));
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 = jet.absrap();
00076 
00077         bool isBjet = jet.bTagged();
00078         bool isCjet = jet.cTagged();
00079 
00080         int jetflav=1;
00081         if      (isBjet)jetflav=5;
00082         else if (isCjet)jetflav=4;
00083 
00084         if (absy <= 2.1 && leadjets.size() < 2) {
00085 
00086           if (pT > 500*GeV) continue;
00087           if ((leadjets.empty() && pT < 40*GeV) || pT < 20*GeV) continue;
00088 
00089           leadjets.push_back(jet.momentum());
00090 
00091           if (leadjets.size()==1) flav[0] = jetflav;
00092           if (leadjets.size()==2) flav[1] = jetflav;
00093         }
00094       }
00095 
00096       if (leadjets.size() < 2) vetoEvent;
00097 
00098 
00099       double pBinsLJ[7] = {40.,60.,80.,120.,160.,250.,500.};
00100       int    iPBinLJ = -1;
00101 
00102       for (int k = 0 ; k < 7 ; k++) {
00103         if (leadjets[0].pT() > pBinsLJ[k]*GeV) iPBinLJ=k;
00104         else break;
00105       }
00106 
00107       bool c_ljpt  = (iPBinLJ != -1);
00108       bool c_nljpt = leadjets[1].pT() > 20*GeV;
00109       bool c_dphi  = fabs( deltaPhi(leadjets[0],leadjets[1]) ) > 2.1;
00110       bool isDijet = c_ljpt & c_nljpt & c_dphi;
00111       if (!isDijet) vetoEvent;
00112 
00113       _h_temp[6]->fill(leadjets[0].pT(), weight);
00114 
00115       if (flav[0]==5 && flav[1]==5)                                  // BB dijet
00116         _h_temp[0]->fill(leadjets[0].pT(), weight100);
00117 
00118       if ((flav[0]==5 && flav[1]==4) || (flav[0]==4 && flav[1]==5))  // BC dijet
00119         _h_temp[1]->fill(leadjets[0].pT(), weight100);
00120 
00121       if (flav[0]==4 && flav[1]==4)                                  // CC dijet
00122         _h_temp[2]->fill(leadjets[0].pT(), weight100);
00123 
00124       if ((flav[0]==5 && flav[1]==1) || (flav[0]==1 && flav[1]==5))  // B-light dijet
00125         _h_temp[3]->fill(leadjets[0].pT(), weight100);
00126 
00127       if ((flav[0]==4 && flav[1]==1) || (flav[0]==1 && flav[1]==4))  // C-light dijet
00128         _h_temp[4]->fill(leadjets[0].pT(), weight100);
00129 
00130       if (flav[0]==1 && flav[1]==1)                                  // light-light dijet
00131         _h_temp[5]->fill(leadjets[0].pT(), weight100);
00132     }
00133 
00134 
00135     void finalize() {
00136       divide(_h_temp[0], _h_temp[6], _h_results[0]);
00137       divide(_h_temp[1], _h_temp[6], _h_results[1]);
00138       divide(_h_temp[2], _h_temp[6], _h_results[2]);
00139       divide(_h_temp[3], _h_temp[6], _h_results[3]);
00140       divide(_h_temp[4], _h_temp[6], _h_results[4]);
00141       divide(_h_temp[5], _h_temp[6], _h_results[5]);
00142     }
00143 
00144   private:
00145 
00146     Histo1DPtr   _h_temp[7];
00147     Scatter2DPtr _h_results[6];
00148   };
00149 
00150   DECLARE_RIVET_PLUGIN(ATLAS_2012_I1188891);
00151 
00152 }