rivet is hosted by Hepforge, IPPP Durham
ATLAS_2014_I1306294.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/ZFinder.hh"
00005 #include "Rivet/Projections/FastJets.hh"
00006 #include "Rivet/Projections/HeavyHadrons.hh"
00007 #include "Rivet/Projections/VetoedFinalState.hh"
00008 
00009 namespace Rivet {
00010 
00011   class ATLAS_2014_I1306294 : public Analysis {
00012   public:
00013 
00014     /// @name Constructors etc.
00015     //@{
00016 
00017     /// Constructors
00018     ATLAS_2014_I1306294(std::string name="ATLAS_2014_I1306294") 
00019       : Analysis(name)
00020     {
00021       _mode = 1;
00022       setNeedsCrossSection(true);
00023     }
00024 
00025     //@}
00026 
00027   public:
00028 
00029     /// @name Analysis methods
00030     //@{
00031 
00032     /// Book histograms and initialise projections before the run
00033     void init() {
00034 
00035       FinalState fs;
00036 
00037       Cut cuts = Cuts::etaIn(-2.5,2.5) & (Cuts::pT > 20.0*GeV);
00038 
00039       ZFinder zfinder(fs, cuts, _mode==1? PID::ELECTRON : PID::MUON, 76.0*GeV, 106.0*GeV, 0.1, ZFinder::CLUSTERNODECAY, ZFinder::NOTRACK);
00040       addProjection(zfinder, "ZFinder");
00041 
00042       //FastJets jetpro1( getProjection<ZFinder>("ZFinder").remainingFinalState(), FastJets::ANTIKT, 0.4);
00043       VetoedFinalState jet_fs(fs);
00044       jet_fs.addVetoOnThisFinalState(getProjection<ZFinder>("ZFinder"));
00045       FastJets jetpro1(jet_fs, FastJets::ANTIKT, 0.4);
00046       jetpro1.useInvisibles();
00047       addProjection(jetpro1, "AntiKtJets04");
00048       addProjection(HeavyHadrons(), "BHadrons");
00049 
00050       //Histograms with data binning
00051       _h_bjet_Pt      = bookHisto1D( 3, 1, 1);
00052       _h_bjet_Y       = bookHisto1D( 5, 1, 1);
00053       _h_bjet_Yboost  = bookHisto1D( 7, 1, 1);
00054       _h_bjet_DY20    = bookHisto1D( 9, 1, 1);
00055       _h_bjet_ZdPhi20 = bookHisto1D(11, 1, 1);
00056       _h_bjet_ZdR20   = bookHisto1D(13, 1, 1);
00057       _h_bjet_ZPt     = bookHisto1D(15, 1, 1);
00058       _h_bjet_ZY      = bookHisto1D(17, 1, 1);
00059       _h_2bjet_dR     = bookHisto1D(21, 1, 1);
00060       _h_2bjet_Mbb    = bookHisto1D(23, 1, 1);
00061       _h_2bjet_ZPt    = bookHisto1D(25, 1, 1);
00062       _h_2bjet_ZY     = bookHisto1D(27, 1, 1);
00063     }
00064 
00065       //==========================================================================================
00066 
00067 
00068     /// Perform the per-event analysis
00069     void analyze(const Event& e) {
00070 
00071       
00072       //---------------------------
00073       const double weight = e.weight();
00074 
00075       // -- check we have a Z: 
00076       const ZFinder& zfinder = applyProjection<ZFinder>(e, "ZFinder");
00077       
00078       if(zfinder.bosons().size() != 1)  vetoEvent;
00079       
00080       const ParticleVector boson_s =  zfinder.bosons();
00081       const Particle       boson_f =  boson_s[0]      ;
00082       const ParticleVector zleps   =  zfinder.constituents();
00083       //---------------------------
00084 
00085       
00086       //---------------------------
00087       //------------- stop processing the event if no true b-partons or hadrons are found
00088       const Particles& allBs = applyProjection<HeavyHadrons>(e, "BHadrons").bHadrons(5.0*GeV);
00089       Particles stableBs;
00090       foreach(Particle p, allBs) {
00091         if(p.abseta() < 2.5)  stableBs += p;
00092       }
00093       if( stableBs.empty() )  vetoEvent;
00094 
00095       
00096       //---------------------------
00097       // -- get the b-jets:
00098       const Jets& jets = applyProjection<JetAlg>(e, "AntiKtJets04").jetsByPt(Cuts::pT >20.0*GeV && Cuts::abseta <2.4);
00099       Jets b_jets;
00100       foreach(const Jet& jet, jets) {
00101         //veto overlaps with Z leptons:
00102         bool veto = false;
00103         foreach(const Particle& zlep, zleps) {
00104           if(deltaR(jet, zlep) < 0.5)  veto = true;
00105         }
00106         if(veto) continue;
00107     
00108         foreach(const Particle& bhadron, stableBs) {
00109           if( deltaR(jet, bhadron) <= 0.3 ) {
00110             b_jets.push_back(jet);
00111             break; // match
00112           }
00113           } // end loop on b-hadrons  
00114       }
00115       
00116       //and make sure we have at least 1:
00117       if(b_jets.empty())  vetoEvent;
00118 
00119       //---------------------------
00120       // fill the plots:
00121       const double ZpT = boson_f.pT()/GeV;
00122       const double ZY  = boson_f.absrap();
00123       
00124       _h_bjet_ZPt->fill(ZpT, weight);
00125       _h_bjet_ZY ->fill(ZY,  weight);
00126       
00127       foreach(const Jet& jet, b_jets) {
00128     
00129         _h_bjet_Pt->fill(jet.pT()/GeV, weight );
00130         _h_bjet_Y ->fill(jet.absrap(), weight );
00131         
00132         const double Yboost = 0.5 * fabs(boson_f.rapidity() + jet.rapidity());
00133 
00134         _h_bjet_Yboost->fill(Yboost, weight );
00135         
00136         if(ZpT > 20.) {
00137         
00138           const double ZBDY   = fabs( boson_f.rapidity() - jet.rapidity() );
00139           const double ZBDPHI = fabs( deltaPhi(jet.phi(), boson_f.phi()) );
00140           const double ZBDR   = deltaR(jet, boson_f, RAPIDITY);
00141           _h_bjet_DY20->fill(   ZBDY,   weight);
00142           _h_bjet_ZdPhi20->fill(ZBDPHI, weight);
00143           _h_bjet_ZdR20->fill(  ZBDR,   weight);
00144         }
00145     
00146       } //loop over b-jets
00147       
00148       if (b_jets.size() < 2) return;
00149       
00150       _h_2bjet_ZPt->fill(ZpT, weight);
00151       _h_2bjet_ZY ->fill(ZY,  weight);
00152       
00153       const double BBDR = deltaR(b_jets[0], b_jets[1], RAPIDITY);
00154       const double Mbb  = (b_jets[0].momentum() + b_jets[1].momentum()).mass();
00155       
00156       _h_2bjet_dR ->fill(BBDR, weight);
00157       _h_2bjet_Mbb->fill(Mbb,  weight);
00158       
00159     } // end of analysis loop
00160     
00161     
00162     /// Normalise histograms etc., after the run
00163     void finalize() {
00164       
00165       const double normfac = crossSection() / sumOfWeights();
00166       
00167       scale( _h_bjet_Pt,      normfac);
00168       scale( _h_bjet_Y,       normfac);
00169       scale( _h_bjet_Yboost,  normfac);
00170       scale( _h_bjet_DY20,    normfac);
00171       scale( _h_bjet_ZdPhi20, normfac);
00172       scale( _h_bjet_ZdR20,   normfac);
00173       scale( _h_bjet_ZPt,     normfac);
00174       scale( _h_bjet_ZY,      normfac);
00175       scale( _h_2bjet_dR,     normfac);
00176       scale( _h_2bjet_Mbb,    normfac);
00177       scale( _h_2bjet_ZPt,    normfac);
00178       scale( _h_2bjet_ZY,     normfac);
00179     }
00180     
00181     //@}
00182     
00183     
00184   protected:
00185       
00186     // Data members like post-cuts event weight counters go here
00187     size_t _mode;
00188     
00189     
00190   private:
00191 
00192     Histo1DPtr _h_bjet_Pt;
00193     Histo1DPtr _h_bjet_Y;
00194     Histo1DPtr _h_bjet_Yboost;
00195     Histo1DPtr _h_bjet_DY20;
00196     Histo1DPtr _h_bjet_ZdPhi20;
00197     Histo1DPtr _h_bjet_ZdR20;
00198     Histo1DPtr _h_bjet_ZPt;
00199     Histo1DPtr _h_bjet_ZY;
00200     Histo1DPtr _h_2bjet_dR;
00201     Histo1DPtr _h_2bjet_Mbb;
00202     Histo1DPtr _h_2bjet_ZPt;
00203     Histo1DPtr _h_2bjet_ZY;
00204     
00205   };
00206 
00207 
00208   class ATLAS_2014_I1306294_EL : public ATLAS_2014_I1306294 {
00209   public:
00210     ATLAS_2014_I1306294_EL()
00211       : ATLAS_2014_I1306294("ATLAS_2014_I1306294_EL")
00212     {
00213       _mode = 1;
00214     }
00215   };
00216 
00217   class ATLAS_2014_I1306294_MU : public ATLAS_2014_I1306294 {
00218   public:
00219     ATLAS_2014_I1306294_MU()
00220       : ATLAS_2014_I1306294("ATLAS_2014_I1306294_MU")
00221     {
00222       _mode = 2;
00223     }
00224   };
00225 
00226 
00227   // The hook for the plugin system
00228   DECLARE_RIVET_PLUGIN(ATLAS_2014_I1306294);
00229   DECLARE_RIVET_PLUGIN(ATLAS_2014_I1306294_MU);
00230   DECLARE_RIVET_PLUGIN(ATLAS_2014_I1306294_EL);
00231 
00232 } 
00233