rivet is hosted by Hepforge, IPPP Durham
ATLAS_2014_I1282447.cc
Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // ATLAS W+c analysis
00003 
00004 //////////////////////////////////////////////////////////////////////////
00005 /*
00006   Description of rivet analysis ATLAS_2014_I1282447 W+c production
00007 
00008   This rivet routine implements the ATLAS W+c analysis.
00009   Apart from those histograms, described and published on HEP Data, here
00010   are some helper histograms defined, these are:
00011 
00012   d02-x01-y01, d02-x01-y02 and d08-x01-y01 are ratios, the nominator ("_plus")
00013   and denominator ("_minus") histograms are also given, so that the ratios can
00014   be reconstructed if need be (e.g. when running on separate samples).
00015 
00016   d05 and d06 are ratios over inclusive W production.
00017   The routine has to be run on a sample for inclusive W production in order to
00018   make sure the denominator ("_winc") is correctly filled.
00019 
00020   The ratios can be constructed using the following sample code:
00021   python divideWCharm.py
00022 
00023   import yoda
00024   hists_wc   = yoda.read("Rivet_Wc.yoda")
00025   hists_winc = yoda.read("Rivet_Winc.yoda")
00026 
00027   ## division histograms --> ONLY for different plus minus runs
00028   # (merge before using yodamerge Rivet_plus.yoda Rivet_minus.yoda > Rivet_Wc.yoda)
00029 
00030   d02y01_plus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y01_plus"]
00031   d02y01_minus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y01_minus"]
00032   ratio_d02y01 =  d02y01_plus.divide(d02y01_minus)
00033   ratio_d02y01.path = "/ATLAS_2014_I1282447/d02-x01-y01"
00034 
00035   d02y02_plus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y02_plus"]
00036   d02y02_minus = hists_wc["/ATLAS_2014_I1282447/d02-x01-y02_minus"]
00037   ratio_d02y02=  d02y02_plus.divide(d02y02_minus)
00038   ratio_d02y02.path = "/ATLAS_2014_I1282447/d02-x01-y02"
00039 
00040   d08y01_plus = hists_wc["/ATLAS_2014_I1282447/d08-x01-y01_plus"]
00041   d08y01_minus = hists_wc["/ATLAS_2014_I1282447/d08-x01-y01_minus"]
00042   ratio_d08y01=  d08y01_plus.divide(d08y01_minus)
00043   ratio_d08y01.path = "/ATLAS_2014_I1282447/d08-x01-y01"
00044 
00045   # inclusive cross section
00046   h_winc = hists_winc["/ATLAS_2014_I1282447/d05-x01-y01"]
00047   h_d    = hists_wc["/ATLAS_2014_I1282447/d01-x01-y02"]
00048   h_dstar= hists_wc["/ATLAS_2014_I1282447/d01-x01-y03"]
00049 
00050   ratio_wd      =  h_d.divide(h_winc)
00051   ratio_wd.path = "/ATLAS_2014_I1282447/d05-x01-y02"
00052 
00053   ratio_wdstar      =  h_d.divide(h_winc)
00054   ratio_wdstar.path = "/ATLAS_2014_I1282447/d05-x01-y03"
00055 
00056   # pT differential
00057   h_winc_plus  = hists_winc["/ATLAS_2014_I1282447/d06-x01-y01_winc"]
00058   h_winc_minus = hists_winc["/ATLAS_2014_I1282447/d06-x01-y02_winc"]
00059 
00060   h_wd_plus      = hists_wc["/ATLAS_2014_I1282447/d06-x01-y01_wplus"]
00061   h_wd_minus     = hists_wc["/ATLAS_2014_I1282447/d06-x01-y02_wminus"]
00062   h_wdstar_plus  = hists_wc["/ATLAS_2014_I1282447/d06-x01-y03_wplus"]
00063   h_wdstar_minus = hists_wc["/ATLAS_2014_I1282447/d06-x01-y04_wminus"]
00064 
00065   ratio_wd_plus       =  h_wd_plus.divide(h_winc_plus)
00066   ratio_wd_plus.path  = "/ATLAS_2014_I1282447/d06-x01-y01"
00067   ratio_wd_minus      =  h_wd_plus.divide(h_winc_minus)
00068   ratio_wd_minus.path = "/ATLAS_2014_I1282447/d06-x01-y02"
00069 
00070   ratio_wdstar_plus       =  h_wdstar_plus.divide(h_winc_plus)
00071   ratio_wdstar_plus.path  = "/ATLAS_2014_I1282447/d06-x01-y03"
00072   ratio_wdstar_minus      =  h_wdstar_plus.divide(h_winc_minus)
00073   ratio_wdstar_minus.path = "/ATLAS_2014_I1282447/d06-x01-y04"
00074 
00075   ratio_wd_plus =  h_wd_plus.divide(h_winc_plus)
00076   ratio_wd_plus.path = "/ATLAS_2014_I1282447/d06-x01-y01"
00077   ratio_wd_minus =  h_wd_plus.divide(h_winc_minus)
00078   ratio_wd_minus.path = "/ATLAS_2014_I1282447/d06-x01-y02"
00079 
00080   h_winc_plus= hists_winc["/ATLAS_2014_I1282447/d06-x01-y01_winc"]
00081   h_winc_minus= hists_winc["/ATLAS_2014_I1282447/d06-x01-y02_winc"]
00082 
00083   ## copy other histograms for plotting
00084 
00085   d01x01y01= hists_wc["/ATLAS_2014_I1282447/d01-x01-y01"]
00086   d01x01y01.path = "/ATLAS_2014_I1282447/d01-x01-y01"
00087 
00088   d01x01y02= hists_wc["/ATLAS_2014_I1282447/d01-x01-y02"]
00089   d01x01y02.path = "/ATLAS_2014_I1282447/d01-x01-y02"
00090 
00091   d01x01y03= hists_wc["/ATLAS_2014_I1282447/d01-x01-y03"]
00092   d01x01y03.path = "/ATLAS_2014_I1282447/d01-x01-y03"
00093 
00094   d03x01y01= hists_wc["/ATLAS_2014_I1282447/d03-x01-y01"]
00095   d03x01y01.path = "/ATLAS_2014_I1282447/d03-x01-y01"
00096 
00097   d03x01y02= hists_wc["/ATLAS_2014_I1282447/d03-x01-y02"]
00098   d03x01y02.path = "/ATLAS_2014_I1282447/d03-x01-y02"
00099 
00100   d04x01y01= hists_wc["/ATLAS_2014_I1282447/d04-x01-y01"]
00101   d04x01y01.path = "/ATLAS_2014_I1282447/d04-x01-y01"
00102 
00103   d04x01y02= hists_wc["/ATLAS_2014_I1282447/d04-x01-y02"]
00104   d04x01y02.path = "/ATLAS_2014_I1282447/d04-x01-y02"
00105 
00106   d04x01y03= hists_wc["/ATLAS_2014_I1282447/d04-x01-y03"]
00107   d04x01y03.path = "/ATLAS_2014_I1282447/d04-x01-y03"
00108 
00109   d04x01y04= hists_wc["/ATLAS_2014_I1282447/d04-x01-y04"]
00110   d04x01y04.path = "/ATLAS_2014_I1282447/d04-x01-y04"
00111 
00112   d07x01y01= hists_wc["/ATLAS_2014_I1282447/d07-x01-y01"]
00113   d07x01y01.path = "/ATLAS_2014_I1282447/d07-x01-y01"
00114 
00115   yoda.write([ratio_d02y01,ratio_d02y02,ratio_d08y01, ratio_wd ,ratio_wdstar,ratio_wd_plus,ratio_wd_minus ,ratio_wdstar_plus,ratio_wdstar_minus,d01x01y01,d01x01y02,d01x01y03,d03x01y01,d03x01y02,d04x01y01,d04x01y02,d04x01y03,d04x01y04,d07x01y01],"validation.yoda")
00116 
00117 */
00118 //////////////////////////////////////////////////////////////////////////
00119 
00120 #include "Rivet/Analysis.hh"
00121 #include "Rivet/Projections/UnstableFinalState.hh"
00122 #include "Rivet/Projections/ZFinder.hh"
00123 #include "Rivet/Projections/WFinder.hh"
00124 #include "Rivet/Projections/FastJets.hh"
00125 
00126 #include "Rivet/Projections/ChargedFinalState.hh"
00127 #include "Rivet/Projections/VetoedFinalState.hh"
00128 
00129 namespace Rivet {
00130 
00131   class ATLAS_2014_I1282447 : public Analysis {
00132 
00133   public:
00134 
00135     /// Constructor
00136     ATLAS_2014_I1282447() : Analysis("ATLAS_2014_I1282447")
00137     {
00138       setNeedsCrossSection(true);
00139     }
00140 
00141   public:
00142 
00143     /// @name Analysis methods
00144     //@{
00145 
00146     /// Book histograms and initialise projections before the run
00147     void init() {
00148 
00149       /// @todo Initialise and register projections here
00150       UnstableFinalState fs;
00151 
00152       Cut cuts = Cuts::etaIn(-2.5, 2.5) & (Cuts::pT > 20*GeV);
00153 
00154       /// should use sample WITHOUT QED radiation off the electron
00155       WFinder wfinder_born_el(fs, cuts, PID::ELECTRON, 25*GeV, 8000*GeV, 15*GeV, 0.1, WFinder::CLUSTERALL, WFinder::TRACK);
00156       addProjection(wfinder_born_el, "WFinder_born_el");
00157 
00158       WFinder wfinder_born_mu(fs, cuts, PID::MUON    , 25*GeV, 8000*GeV, 15*GeV, 0.1, WFinder::CLUSTERALL, WFinder::TRACK);
00159       addProjection(wfinder_born_mu, "WFinder_born_mu");
00160 
00161       // all hadrons that could be coming from a charm decay --
00162       // -- for safety, use region -3.5 - 3.5
00163       addProjection(UnstableFinalState(Cuts::abseta <3.5), "hadrons");
00164 
00165       // Input for the jets: no neutrinos, no muons, and no electron which passed the electron cuts
00166       // also: NO electron, muon or tau (needed due to ATLAS jet truth reconstruction feature)
00167       VetoedFinalState veto;
00168 
00169       veto.addVetoOnThisFinalState(wfinder_born_el);
00170       veto.addVetoOnThisFinalState(wfinder_born_mu);
00171       veto.addVetoPairId(PID::ELECTRON);
00172       veto.addVetoPairId(PID::MUON);
00173       veto.addVetoPairId(PID::TAU);
00174 
00175       FastJets jets(veto, FastJets::ANTIKT, 0.4);
00176       addProjection(jets, "jets");
00177 
00178       // Book histograms
00179 
00180       // charge separated integrated cross sections
00181       _hist_wcjet_charge  = bookHisto1D("d01-x01-y01");
00182       _hist_wd_charge     = bookHisto1D("d01-x01-y02");
00183       _hist_wdstar_charge = bookHisto1D("d01-x01-y03");
00184 
00185       // charge integrated total cross sections
00186       _hist_wcjet_ratio = bookScatter2D("d02-x01-y01");
00187       _hist_wd_ratio    = bookScatter2D("d02-x01-y02");
00188 
00189       _hist_wcjet_minus = bookHisto1D("d02-x01-y01_minus");
00190       _hist_wd_minus    = bookHisto1D("d02-x01-y02_minus");
00191 
00192       _hist_wcjet_plus  = bookHisto1D("d02-x01-y01_plus");
00193       _hist_wd_plus     = bookHisto1D("d02-x01-y02_plus");
00194 
00195       // eta distributions
00196       _hist_wplus_wcjet_eta_lep   = bookHisto1D("d03-x01-y01");
00197       _hist_wminus_wcjet_eta_lep  = bookHisto1D("d03-x01-y02");
00198 
00199       _hist_wplus_wdminus_eta_lep = bookHisto1D("d04-x01-y01");
00200       _hist_wminus_wdplus_eta_lep = bookHisto1D("d04-x01-y02");
00201       _hist_wplus_wdstar_eta_lep  = bookHisto1D("d04-x01-y03");
00202       _hist_wminus_wdstar_eta_lep = bookHisto1D("d04-x01-y04");
00203 
00204       // ratio of cross section (WD over W inclusive) // postprocess!
00205       _hist_w_inc             = bookHisto1D("d05-x01-y01");
00206       _hist_wd_winc_ratio     = bookScatter2D("d05-x01-y02");
00207       _hist_wdstar_winc_ratio = bookScatter2D("d05-x01-y03");
00208 
00209       // ratio of cross section (WD over W inclusive -- function of pT of D meson)
00210       _hist_wplusd_wplusinc_pt_ratio       = bookScatter2D("d06-x01-y01");
00211       _hist_wminusd_wminusinc_pt_ratio     = bookScatter2D("d06-x01-y02");
00212       _hist_wplusdstar_wplusinc_pt_ratio   = bookScatter2D("d06-x01-y03");
00213       _hist_wminusdstar_wminusinc_pt_ratio = bookScatter2D("d06-x01-y04");
00214 
00215       // could use for postprocessing!
00216       _hist_wplusd_wplusinc_pt       = bookHisto1D("d06-x01-y01_wplus");
00217       _hist_wminusd_wminusinc_pt     = bookHisto1D("d06-x01-y02_wminus");
00218       _hist_wplusdstar_wplusinc_pt   = bookHisto1D("d06-x01-y03_wplus");
00219       _hist_wminusdstar_wminusinc_pt = bookHisto1D("d06-x01-y04_wminus");
00220 
00221       _hist_wplus_winc  = bookHisto1D("d06-x01-y01_winc");
00222       _hist_wminus_winc = bookHisto1D("d06-x01-y02_winc");
00223 
00224       // jet multiplicity of charge integrated W+cjet cross section (+0 or +1 jet in addition to the charm jet)
00225       _hist_wcjet_jets  = bookHisto1D("d07-x01-y01");
00226 
00227       // jet multiplicity of W+cjet cross section ratio (+0 or +1 jet in addition to the charm jet)
00228       _hist_wcjet_jets_ratio  = bookScatter2D("d08-x01-y01");
00229       _hist_wcjet_jets_plus   = bookHisto1D("d08-x01-y01_plus");
00230       _hist_wcjet_jets_minus  = bookHisto1D("d08-x01-y01_minus");
00231 
00232     }
00233 
00234 
00235     /// Perform the per-event analysis
00236     void analyze(const Event& event) {
00237 
00238       const double weight = event.weight();
00239 
00240       double charge_weight = 0; // account for OS/SS events
00241 
00242       int    lepton_charge = 0;
00243       double lepton_eta    = 0.;
00244 
00245       /// Find leptons
00246       const WFinder& wfinder_born_el = applyProjection<WFinder>(event, "WFinder_born_el");
00247       const WFinder& wfinder_born_mu = applyProjection<WFinder>(event, "WFinder_born_mu");
00248 
00249       if(wfinder_born_el.empty() && wfinder_born_mu.empty() ) {
00250         MSG_DEBUG("No W bosons found");
00251         vetoEvent;
00252       }
00253 
00254       bool keepevent = false;
00255 
00256       //check electrons
00257       if(!wfinder_born_el.empty()) {
00258         const FourMomentum& nu = wfinder_born_el.constituentNeutrinos()[0].momentum();
00259         if(wfinder_born_el.mT() > 40*GeV && nu.pT() > 25*GeV) {
00260           keepevent = true;
00261           lepton_charge = wfinder_born_el.constituentLeptons()[0].charge();
00262           lepton_eta = fabs(wfinder_born_el.constituentLeptons()[0].pseudorapidity());
00263         }
00264       }
00265 
00266       //check muons
00267       if(!wfinder_born_mu.empty()) {
00268         const FourMomentum& nu = wfinder_born_mu.constituentNeutrinos()[0].momentum();
00269         if(wfinder_born_mu.mT() > 40*GeV && nu.pT() > 25*GeV) {
00270           keepevent = true;
00271           lepton_charge = wfinder_born_mu.constituentLeptons()[0].charge();
00272           lepton_eta = fabs(wfinder_born_mu.constituentLeptons()[0].pseudorapidity());
00273         }
00274       }
00275 
00276       if(!keepevent) {
00277         MSG_DEBUG("event does not pass mT and MET cuts");
00278         vetoEvent;
00279       }
00280 
00281       if (lepton_charge > 0) {
00282         _hist_wplus_winc->fill(10., weight);
00283         _hist_wplus_winc->fill(16., weight);
00284         _hist_wplus_winc->fill(30., weight);
00285         _hist_wplus_winc->fill(60., weight);
00286         _hist_w_inc->fill(+1, weight);
00287       }
00288       else if (lepton_charge < 0) {
00289         _hist_wminus_winc->fill(10., weight);
00290         _hist_wminus_winc->fill(16., weight);
00291         _hist_wminus_winc->fill(30., weight);
00292         _hist_wminus_winc->fill(60., weight);
00293         _hist_w_inc->fill(-1, weight);
00294       }
00295 
00296       // Find hadrons in the event
00297       const UnstableFinalState& fs = applyProjection<UnstableFinalState>(event, "hadrons");
00298 
00299       /// FIND Different channels
00300       // 1: wcjet
00301       // get jets
00302       const Jets& jets = applyProjection<FastJets>(event, "jets").jetsByPt(Cuts::pT>25.0*GeV && Cuts::abseta<2.5);
00303       // loop over jets to select jets used to match to charm
00304       Jets js;
00305       int    matched_charmHadron = 0;
00306       double charm_charge = 0.;
00307       int    njets = 0;
00308       int    nj = 0;
00309       bool   mat_jet = false;
00310 
00311       double ptcharm = 0;
00312 
00313       if(matched_charmHadron > -1) {
00314         foreach(const Jet& j, jets) {
00315           mat_jet = false;
00316           njets++;
00317           foreach(const Particle& p, fs.particles()) {
00318             const GenParticle* part = p.genParticle();
00319             if(p.hasCharm()) {
00320               //if(isFromBDecay(p)) continue;
00321               if(p.fromBottom()) continue;
00322               if(p.pT() < 5*GeV ) continue;
00323               if(hasCharmedChildren(part)) continue;
00324               if(deltaR(p, j) < 0.3) {
00325                 mat_jet = true;
00326                 if(p.pT() > ptcharm) {
00327                   charm_charge = part->pdg_id();
00328                   ptcharm = p.pT();
00329                 }
00330               }
00331             }
00332           }
00333           if(mat_jet) nj++;
00334         }
00335 
00336         if (charm_charge * lepton_charge > 0)  charge_weight = -1;
00337         else charge_weight = +1;
00338 
00339         if(nj == 1)  {
00340           if (lepton_charge > 0) {
00341             _hist_wcjet_charge        ->fill(         1, weight*charge_weight);
00342             _hist_wcjet_plus          ->fill(         0, weight*charge_weight);
00343             _hist_wplus_wcjet_eta_lep ->fill(lepton_eta, weight*charge_weight);
00344             _hist_wcjet_jets_plus     ->fill(njets-1   , weight*charge_weight);
00345           }
00346           else if (lepton_charge < 0) {
00347             _hist_wcjet_charge        ->fill(        -1, weight*charge_weight);
00348             _hist_wcjet_minus         ->fill(         0, weight*charge_weight);
00349             _hist_wminus_wcjet_eta_lep->fill(lepton_eta, weight*charge_weight);
00350             _hist_wcjet_jets_minus    ->fill(njets-1   , weight*charge_weight);
00351           }
00352 
00353           _hist_wcjet_jets->fill(njets-1, weight*charge_weight);
00354         }
00355       }
00356 
00357       // // 1/2: w+d(*) meson
00358 
00359       foreach(const Particle& p, fs.particles()) {
00360 
00361         const GenParticle* part = p.genParticle();
00362         if(p.pT() < 8*GeV)       continue;
00363         if(fabs(p.eta()) > 2.2)  continue;
00364 
00365         // W+D
00366         if(abs(part->pdg_id()) == 411) {
00367           if(lepton_charge * part->pdg_id() > 0)  charge_weight = -1;
00368           else                                    charge_weight = +1;
00369 
00370           // fill histos
00371           if (lepton_charge > 0) {
00372             _hist_wd_charge            ->fill(         1, weight*charge_weight);
00373             _hist_wd_plus              ->fill(         0, weight*charge_weight);
00374             _hist_wplus_wdminus_eta_lep->fill(lepton_eta, weight*charge_weight);
00375             _hist_wplusd_wplusinc_pt   ->fill(    p.pT(), weight*charge_weight);
00376           }
00377           else if (lepton_charge < 0) {
00378             _hist_wd_charge            ->fill(        -1, weight*charge_weight);
00379             _hist_wd_minus             ->fill(         0, weight*charge_weight);
00380             _hist_wminus_wdplus_eta_lep->fill(lepton_eta, weight*charge_weight);
00381             _hist_wminusd_wminusinc_pt ->fill(p.pT()    , weight*charge_weight);
00382           }
00383         }
00384 
00385         // W+Dstar
00386         if( abs(part->pdg_id()) == 413 ) {
00387           if (lepton_charge*part->pdg_id() > 0) charge_weight = -1;
00388           else charge_weight = +1;
00389 
00390           if (lepton_charge > 0) {
00391             _hist_wdstar_charge->fill(+1, weight*charge_weight);
00392             _hist_wd_plus->fill( 0, weight*charge_weight);
00393             _hist_wplus_wdstar_eta_lep->fill( lepton_eta, weight*charge_weight);
00394             _hist_wplusdstar_wplusinc_pt->fill(  p.pT(), weight*charge_weight);
00395           }
00396           else if (lepton_charge < 0) {
00397             _hist_wdstar_charge->fill(-1, weight*charge_weight);
00398             _hist_wd_minus->fill(0, weight*charge_weight);
00399             _hist_wminus_wdstar_eta_lep->fill(lepton_eta, weight*charge_weight);
00400             _hist_wminusdstar_wminusinc_pt->fill(p.pT(), weight*charge_weight);
00401           }
00402         }
00403       }
00404     }// end of analyse function
00405 
00406 
00407     /// Normalise histograms etc., after the run
00408     void finalize() {
00409 
00410       /// @todo Normalise, scale and otherwise manipulate histograms here
00411       const double sf( crossSection() / sumOfWeights() );
00412 
00413       // norm to cross section
00414       // d01
00415       scale(_hist_wcjet_charge,  sf);
00416       scale(_hist_wd_charge,     sf);
00417       scale(_hist_wdstar_charge, sf);
00418 
00419       //d02
00420       scale(_hist_wcjet_plus,  sf);
00421       scale(_hist_wcjet_minus, sf);
00422       scale(_hist_wd_plus,     sf);
00423       scale(_hist_wd_minus,    sf);
00424 
00425       divide(_hist_wcjet_plus, _hist_wcjet_minus, _hist_wcjet_ratio);
00426       divide(_hist_wd_plus,    _hist_wd_minus,    _hist_wd_ratio   );
00427 
00428       //d03
00429       scale(_hist_wplus_wcjet_eta_lep,  sf);
00430       scale(_hist_wminus_wcjet_eta_lep, sf);
00431 
00432       //d04
00433       scale(_hist_wplus_wdminus_eta_lep, crossSection()/sumOfWeights());
00434       scale(_hist_wminus_wdplus_eta_lep, crossSection()/sumOfWeights());
00435 
00436       scale(_hist_wplus_wdstar_eta_lep , crossSection()/sumOfWeights());
00437       scale(_hist_wminus_wdstar_eta_lep, crossSection()/sumOfWeights());
00438 
00439       //d05
00440       scale(_hist_w_inc, 0.01 * sf); // in percent --> /100
00441       divide(_hist_wd_charge,     _hist_w_inc, _hist_wd_winc_ratio    );
00442       divide(_hist_wdstar_charge, _hist_w_inc, _hist_wdstar_winc_ratio);
00443 
00444       //d06, in percentage!
00445       scale(_hist_wplusd_wplusinc_pt,       sf);
00446       scale(_hist_wminusd_wminusinc_pt,     sf);
00447       scale(_hist_wplusdstar_wplusinc_pt,   sf);
00448       scale(_hist_wminusdstar_wminusinc_pt, sf);
00449 
00450       scale(_hist_wplus_winc,  0.01 * sf); // in percent --> /100
00451       scale(_hist_wminus_winc, 0.01 * sf); // in percent --> /100
00452 
00453       divide(_hist_wplusd_wplusinc_pt,       _hist_wplus_winc , _hist_wplusd_wplusinc_pt_ratio      );
00454       divide(_hist_wminusd_wminusinc_pt,     _hist_wminus_winc, _hist_wminusd_wminusinc_pt_ratio    );
00455       divide(_hist_wplusdstar_wplusinc_pt,   _hist_wplus_winc , _hist_wplusdstar_wplusinc_pt_ratio  );
00456       divide(_hist_wminusdstar_wminusinc_pt, _hist_wminus_winc, _hist_wminusdstar_wminusinc_pt_ratio);
00457 
00458 
00459       //d07
00460       scale(_hist_wcjet_jets, sf);
00461 
00462       //d08
00463       scale(_hist_wcjet_jets_minus, sf);
00464       scale(_hist_wcjet_jets_plus,  sf);
00465       divide(_hist_wcjet_jets_plus, _hist_wcjet_jets_minus , _hist_wcjet_jets_ratio);
00466     }
00467 
00468     //@}
00469 
00470 
00471   private:
00472 
00473     // Data members like post-cuts event weight counters go here
00474 
00475     // Check whether particle comes from b-decay
00476     bool isFromBDecay(const Particle& p) {
00477 
00478       bool isfromB = false;
00479 
00480       if(p.genParticle() == NULL)  return false;
00481 
00482       const GenParticle* part = p.genParticle();
00483       const GenVertex* ivtx = const_cast<const GenVertex*>(part->production_vertex());
00484       while(ivtx) {
00485         if(ivtx->particles_in_size() < 1) {
00486           isfromB = false;
00487           break;
00488         }
00489         const HepMC::GenVertex::particles_in_const_iterator iPart_invtx = ivtx->particles_in_const_begin();
00490         part = (*iPart_invtx);
00491         if(!part) {
00492           isfromB = false;
00493           break;
00494         }
00495         isfromB = PID::hasBottom(part->pdg_id());
00496         if(isfromB == true)  break;
00497         ivtx = const_cast<const GenVertex*>(part->production_vertex());
00498         if( part->pdg_id() == 2212 || !ivtx )  break; // reached beam
00499       }
00500       return isfromB;
00501     }
00502 
00503 
00504     // Check whether particle has charmed children
00505     bool hasCharmedChildren(const GenParticle *part) {
00506 
00507       bool hasCharmedChild = false;
00508       if(part == NULL)  return false;
00509 
00510       const GenVertex* ivtx = const_cast<const GenVertex*>(part->end_vertex());
00511       if(ivtx == NULL)  return false;
00512 
00513       // if (ivtx->particles_out_size() < 2) return false;
00514       HepMC::GenVertex::particles_out_const_iterator iPart_invtx = ivtx->particles_out_const_begin();
00515       HepMC::GenVertex::particles_out_const_iterator end_invtx = ivtx->particles_out_const_end();
00516 
00517       for( ; iPart_invtx != end_invtx; iPart_invtx++ ) {
00518         const GenParticle* p2 = (*iPart_invtx);
00519         if( p2 == part)  continue;
00520         hasCharmedChild = PID::hasCharm(p2->pdg_id());
00521         if(hasCharmedChild == true)  break;
00522         hasCharmedChild = hasCharmedChildren(p2);
00523         if(hasCharmedChild == true)  break;
00524       }
00525       return hasCharmedChild;
00526     }
00527 
00528 
00529   private:
00530 
00531     /// @name Histograms
00532     //@{
00533 
00534     //d01-x01-
00535     Histo1DPtr   _hist_wcjet_charge;
00536     Histo1DPtr   _hist_wd_charge;
00537     Histo1DPtr   _hist_wdstar_charge;
00538 
00539     //d02-x01-
00540     Scatter2DPtr _hist_wcjet_ratio;
00541     Scatter2DPtr _hist_wd_ratio;
00542     Histo1DPtr _hist_wcjet_plus;
00543     Histo1DPtr _hist_wd_plus;
00544 
00545     Histo1DPtr _hist_wcjet_minus;
00546     Histo1DPtr _hist_wd_minus;
00547 
00548     //d03-x01-
00549     Histo1DPtr _hist_wplus_wcjet_eta_lep;
00550     Histo1DPtr _hist_wminus_wcjet_eta_lep;
00551 
00552     //d04-x01-
00553     Histo1DPtr _hist_wplus_wdminus_eta_lep;
00554     Histo1DPtr _hist_wminus_wdplus_eta_lep;
00555 
00556     //d05-x01-
00557     Histo1DPtr _hist_wplus_wdstar_eta_lep;
00558     Histo1DPtr _hist_wminus_wdstar_eta_lep;
00559 
00560 
00561     // postprocessing histos
00562     //d05-x01
00563     Histo1DPtr _hist_w_inc;
00564     Scatter2DPtr _hist_wd_winc_ratio;
00565     Scatter2DPtr _hist_wdstar_winc_ratio;
00566 
00567     //d06-x01
00568     Histo1DPtr _hist_wplus_winc;
00569     Histo1DPtr _hist_wminus_winc;
00570 
00571     Scatter2DPtr _hist_wplusd_wplusinc_pt_ratio;
00572     Scatter2DPtr _hist_wminusd_wminusinc_pt_ratio;
00573     Scatter2DPtr _hist_wplusdstar_wplusinc_pt_ratio;
00574     Scatter2DPtr _hist_wminusdstar_wminusinc_pt_ratio;
00575 
00576     Histo1DPtr _hist_wplusd_wplusinc_pt ;
00577     Histo1DPtr _hist_wminusd_wminusinc_pt;
00578     Histo1DPtr _hist_wplusdstar_wplusinc_pt;
00579     Histo1DPtr _hist_wminusdstar_wminusinc_pt;
00580 
00581     // d07-x01
00582     Histo1DPtr _hist_wcjet_jets ;
00583 
00584     //d08-x01
00585     Scatter2DPtr  _hist_wcjet_jets_ratio ;
00586     Histo1DPtr    _hist_wcjet_jets_plus ;
00587     Histo1DPtr    _hist_wcjet_jets_minus;
00588     //@}
00589 
00590   };
00591 
00592 
00593   // The hook for the plugin system
00594   DECLARE_RIVET_PLUGIN(ATLAS_2014_I1282447);
00595 
00596 }