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