rivet is hosted by Hepforge, IPPP Durham
ATLAS_2014_I1315949.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/ChargedFinalState.hh"
00005 //#include "Rivet/Projections/VetoedFinalState.hh"
00006 #include "Rivet/ParticleName.hh"
00007 #include "Rivet/Projections/ZFinder.hh"
00008 
00009 #include <utility>
00010 
00011 #include <cstdlib>
00012 
00013 namespace Rivet {
00014 
00015   using namespace Cuts;
00016 
00017   class ATLAS_2014_I1315949 : public Analysis {
00018   public:
00019 
00020     /// Constructor
00021     ATLAS_2014_I1315949() 
00022       : Analysis("ATLAS_2014_I1315949")
00023     {    }
00024 
00025     void init() {
00026 
00027       FinalState fs;
00028 
00029       ZFinder zfinder(fs, Cuts::abseta<2.4 && Cuts::pT>20.0*GeV, PID::MUON, 66*GeV, 116*GeV, 0.1, ZFinder::CLUSTERNODECAY);
00030       addProjection(zfinder, "ZFinder");
00031 
00032       ChargedFinalState cfs( zfinder.remainingFinalState() );
00033       addProjection(cfs, "cfs");
00034 
00035 
00036       _h_pTsum_tow    = bookProfile1D( 1, 1, 1);
00037       _h_pTsum_trv    = bookProfile1D( 1, 1, 2);
00038       _h_pTsum_away   = bookProfile1D( 1, 1, 3);
00039       _h_pTsum_tmin   = bookProfile1D( 1, 1, 4);
00040       _h_pTsum_tmax   = bookProfile1D( 1, 1, 5);
00041       _h_pTsum_tdif   = bookProfile1D( 1, 1, 6);
00042 
00043       _h_Nchg_tow     = bookProfile1D( 2, 1, 1);
00044       _h_Nchg_trv     = bookProfile1D( 2, 1, 2);
00045       _h_Nchg_away    = bookProfile1D( 2, 1, 3);
00046       _h_Nchg_tmin    = bookProfile1D( 2, 1, 4);
00047       _h_Nchg_tmax    = bookProfile1D( 2, 1, 5);
00048       _h_Nchg_tdif    = bookProfile1D( 2, 1, 6);
00049 
00050       _h_pTavg_tow    = bookProfile1D( 3, 1, 1);
00051       _h_pTavg_trv    = bookProfile1D( 3, 1, 2);
00052       _h_pTavg_away   = bookProfile1D( 3, 1, 3);
00053 
00054       _h_pTavgvsmult_tow    = bookProfile1D( 4, 1, 1);
00055       _h_pTavgvsmult_trv    = bookProfile1D( 4, 1, 2);
00056       _h_pTavgvsmult_away   = bookProfile1D( 4, 1, 3);
00057 
00058 
00059       // Book sumpt and nch histos
00060       for (int i_reg = 0; i_reg < 4; i_reg++) {
00061         for (int i_bin = 0; i_bin < 6.; i_bin++) {
00062           _h_ptSum_1D[i_reg][i_bin] = bookHisto1D (5, i_reg+1 , i_bin+1);
00063           _h_Nchg_1D[i_reg][i_bin] = bookHisto1D (6, i_reg+1 , i_bin+1);
00064         }
00065       }
00066     }
00067 
00068 
00069     /// Perform the per-event analysis
00070     void analyze(const Event& event) {
00071 
00072       const double weight = event.weight();
00073       const ZFinder& zfinder = applyProjection<ZFinder>(event, "ZFinder");
00074 
00075       if (zfinder.bosons().size() != 1) vetoEvent;
00076 
00077       double  Zpt   = zfinder.bosons()[0].momentum().pT()/GeV;
00078       double  Zphi  = zfinder.bosons()[0].momentum().phi();
00079       double  Zmass = zfinder.bosons()[0].momentum().mass()/GeV;
00080       if(Zmass < 66. || Zmass > 116.) vetoEvent;
00081 
00082       // Initialise counters for Nch and sumPt for all regions
00083       int nTowards(0), nTransverse(0), nLeft(0), nRight(0), nTrmin(0), nTrmax(0), nAway(0);
00084       double ptSumTowards(0.0), ptSumTransverse(0.0), ptSumLeft(0.0), ptSumRight(0.0),
00085              ptSumTrmin(0.0), ptSumTrmax(0.0), ptSumAway(0.0);
00086      
00087       // The charged particles
00088       ParticleVector particles = applyProjection<ChargedFinalState>(event, "cfs").particlesByPt(
00089           Cuts::pT > 0.5*GeV && Cuts::abseta <2.5);
00090 
00091       // Loop over charged particles with pT>500 MeV and |eta|<2.5
00092       foreach(const Particle& p, particles) {
00093         double dphi = p.momentum().phi() - Zphi,
00094                pT   = p.momentum().pT();
00095 
00096         // Get multiples of 2pi right
00097         for(; std::fabs(dphi) > M_PI; dphi += (dphi > 0. ? -2.*M_PI : 2.*M_PI) );
00098 
00099         // Towards region
00100         if( std::fabs(dphi) < M_PI/3. ) {
00101           nTowards++;
00102           ptSumTowards += pT;
00103         } 
00104         // Transverse region
00105         else if( std::fabs(dphi) < 2.*M_PI/3. ) {
00106           nTransverse++;
00107           ptSumTransverse += pT;
00108           if(dphi > 0.) {
00109             nRight++;
00110             ptSumRight += pT;
00111           }
00112           else {
00113             nLeft++;
00114             ptSumLeft += pT;
00115           }
00116         } 
00117         // Away region
00118         else {
00119           nAway++;
00120           ptSumAway += pT;
00121         }
00122       }
00123 
00124       // TransMAX, TransMIN regions
00125       if (ptSumLeft > ptSumRight) {
00126         ptSumTrmax = ptSumLeft;
00127         ptSumTrmin = ptSumRight;
00128         nTrmax     = nLeft;
00129         nTrmin     = nRight;
00130       }
00131       else {
00132     ptSumTrmax = ptSumRight;
00133     ptSumTrmin = ptSumLeft;
00134     nTrmax     = nRight;
00135     nTrmin     = nLeft;
00136       }
00137 
00138       // min max regions have difference are than all other regions
00139       const double area = 5.*2./3.*M_PI;
00140 
00141       // Fill sumPt vs. Zpt region profiles
00142       _h_pTsum_tow->fill( Zpt, ptSumTowards/area,                    weight);
00143       _h_pTsum_trv->fill( Zpt, ptSumTransverse/area,                 weight);
00144       _h_pTsum_away->fill(Zpt, ptSumAway/area,                       weight);
00145       _h_pTsum_tmin->fill(Zpt, ptSumTrmin/(0.5*area),                weight);
00146       _h_pTsum_tmax->fill(Zpt, ptSumTrmax/(0.5*area),                weight);
00147       _h_pTsum_tdif->fill(Zpt, (ptSumTrmax - ptSumTrmin)/(0.5*area), weight);
00148 
00149       // Fill Nch vs. Zpt region profiles
00150       _h_Nchg_tow->fill( Zpt, nTowards/area,                         weight);
00151       _h_Nchg_trv->fill( Zpt, nTransverse/area,                      weight);
00152       _h_Nchg_away->fill(Zpt, nAway/area,                            weight);
00153       _h_Nchg_tmin->fill(Zpt, nTrmin/(0.5*area),                     weight);
00154       _h_Nchg_tmax->fill(Zpt, nTrmax/(0.5*area),                     weight);
00155       _h_Nchg_tdif->fill(Zpt, (nTrmax - nTrmin)/(0.5*area),          weight);
00156 
00157 
00158       // Fill <pT> vs. ZpT profiles
00159       _h_pTavg_tow->fill( Zpt, nTowards    > 0.? ptSumTowards/nTowards       : 0., weight);
00160       _h_pTavg_trv->fill( Zpt, nTransverse > 0.? ptSumTransverse/nTransverse : 0., weight);
00161       _h_pTavg_away->fill(Zpt, nAway       > 0.? ptSumAway/nAway             : 0., weight);
00162        
00163       // Fill <Nch> vs. ZpT profiles
00164       _h_pTavgvsmult_tow->fill( nTowards,    nTowards    > 0.? ptSumTowards/nTowards       : 0., weight);
00165       _h_pTavgvsmult_trv->fill( nTransverse, nTransverse > 0.? ptSumTransverse/nTransverse : 0., weight);
00166       _h_pTavgvsmult_away->fill(nAway,       nAway       > 0.? ptSumAway/nAway             : 0., weight);
00167 
00168       // Determine Zpt region histo to fill
00169       int i_bin(0);
00170       if (inRange(Zpt,0,5)        ) i_bin=0;
00171       if (inRange(Zpt,5,10)       ) i_bin=1;
00172       if (inRange(Zpt,10,20)      ) i_bin=2; 
00173       if (inRange(Zpt,20,50)      ) i_bin=3;
00174       if (inRange(Zpt,50,110)     ) i_bin=4;
00175       if (Zpt>110) i_bin=5;
00176 
00177       // SumPt histos for Zpt region
00178       _h_ptSum_1D[0][i_bin]->fill(ptSumTowards/area,     weight);
00179       _h_ptSum_1D[1][i_bin]->fill(ptSumTransverse/area,  weight);
00180       _h_ptSum_1D[2][i_bin]->fill(ptSumTrmin/(0.5*area), weight);
00181       _h_ptSum_1D[3][i_bin]->fill(ptSumTrmax/(0.5*area), weight);
00182 
00183       // Nch histos for Zpt region
00184       _h_Nchg_1D[0][i_bin]->fill(nTowards/area,          weight);
00185       _h_Nchg_1D[1][i_bin]->fill(nTransverse/area,       weight);
00186       _h_Nchg_1D[2][i_bin]->fill(nTrmin/(0.5*area),      weight);
00187       _h_Nchg_1D[3][i_bin]->fill(nTrmax/(0.5*area),      weight);
00188     }
00189 
00190 
00191     /// Normalise histograms etc., after the run
00192     void finalize() {
00193       for(int i_reg = 0; i_reg < 4; i_reg++) {
00194         for(int i_bin = 0; i_bin < 6; i_bin++) {
00195           normalize( _h_ptSum_1D[i_reg][i_bin] );
00196           normalize( _h_Nchg_1D[ i_reg][i_bin] );
00197         }
00198       }
00199     }
00200 
00201 
00202   private:
00203 
00204     Profile1DPtr _h_pTsum_tow,
00205                  _h_pTsum_trv,
00206                  _h_pTsum_away,
00207                  _h_pTsum_tmin,
00208                  _h_pTsum_tmax,
00209                  _h_pTsum_tdif,
00210 
00211                  _h_Nchg_tow,
00212                  _h_Nchg_trv,
00213                  _h_Nchg_away,
00214                  _h_Nchg_tmin,
00215                  _h_Nchg_tmax,
00216                  _h_Nchg_tdif,
00217 
00218                  _h_pTavg_tow,
00219                  _h_pTavg_trv,
00220                  _h_pTavg_away,
00221                  _h_pTavgvsmult_tow,
00222                  _h_pTavgvsmult_trv,
00223                  _h_pTavgvsmult_away;
00224    
00225     Histo1DPtr   _h_ptSum_1D[4][6], _h_Nchg_1D[4][6];
00226     
00227 
00228   };
00229 
00230   // This global object acts as a hook for the plugin system
00231   DECLARE_RIVET_PLUGIN(ATLAS_2014_I1315949);
00232 
00233 }