Пример #1
0
void HistFactory::GetInputs(TFile* f, TString prefix_){
  prefix = prefix_;
  file = f;
  std::cout<<" calling define histograms for Mono-H "<<std::endl;
  DefineHistograms();
  std::cout<<" Mono-H histo defined "<<std::endl;
}
Пример #2
0
//------------------------------------------------------------------------------
// Loop
//------------------------------------------------------------------------------
void AnalysisMonoH::Loop(TString analysis, TString filename, float luminosity)
{
  if (fChain == 0) return;

  Setup(analysis, filename, luminosity);


  // Define histograms
  //----------------------------------------------------------------------------
  for (int j=0; j<ncut; j++) {

    for (int k=0; k<=njetbin; k++) {

      TString sbin = (k < njetbin) ? Form("/%djet", k) : "";

      TString directory = scut[j] + sbin;

      root_output->cd();

      if (k < njetbin) gDirectory->mkdir(directory);

      root_output->cd(directory);

      for (int i=ee; i<=ll; i++) {

	TString suffix = "_" + schannel[i];

	DefineHistograms(i, j, k, suffix);

	h_fullpmet         [i][j][k] = new TH1D("h_fullpmet"        + suffix, "", 1000, 0.,  1000);
	h_trkpmet          [i][j][k] = new TH1D("h_trkpmet"         + suffix, "", 1000, 0.,  1000);
        h_deltarl1met      [i][j][k] = new TH1D("h_deltarl1met"     + suffix, "",  100, 0.,     5);
        h_deltarl2met      [i][j][k] = new TH1D("h_deltarl2met"     + suffix, "",  100, 0.,     5);
        h_deltarllmet      [i][j][k] = new TH1D("h_deltarllmet"     + suffix, "",  100, 0.,     5);
	h_deltarjet1met    [i][j][k] = new TH1D("h_deltarjet1met"   + suffix, "",  100, 0.,     5);
	h_deltarjet2met    [i][j][k] = new TH1D("h_deltarjet2met"   + suffix, "",  100, 0.,     5);
	h_deltarjj         [i][j][k] = new TH1D("h_deltarjj"        + suffix, "",  100, 0.,     5);
	h_deltarjjmet      [i][j][k] = new TH1D("h_deltarjjmet"     + suffix, "",  100, 0.,     5);
	h_deltarlep1jet1   [i][j][k] = new TH1D("h_deltarlep1jet1"  + suffix, "",  100, 0.,     5);
	h_deltarlep1jet2   [i][j][k] = new TH1D("h_deltarlep1jet2"  + suffix, "",  100, 0.,     5);
	h_deltarlep2jet1   [i][j][k] = new TH1D("h_deltarlep2jet1"  + suffix, "",  100, 0.,     5);
	h_deltarlep2jet2   [i][j][k] = new TH1D("h_deltarlep2jet2"  + suffix, "",  100, 0.,     5);
       	h_mllstar          [i][j][k] = new TH1D("h_mllstar"         + suffix, "", 3000, 0.,  3000);
       	//h_mnunu            [i][j][k] = new TH1D("h_mnunu"           + suffix, "",   10, 0.,    10);
	h_mr             [i][j][k] = new TH1D("h_mr"              + suffix, "", 2000, 0.,  2000);

	//h_met_m2l         [i][j][k] = new TH2D("h_met_m2l"        + suffix, "", 200,  0,  2000,  100,   0, 200);
	//h_met_deltaphill  [i][j][k] = new TH2D("h_met_deltaphill" + suffix, "", 200,  0,  2000,  100,   0,   5);     
      }
    }
  }

  root_output->cd();
  

  // Loop over events
  //----------------------------------------------------------------------------
  for (Long64_t jentry=0; jentry<_nentries;jentry++) {

    Long64_t ientry = LoadTree(jentry);

    if (ientry < 0) break;

    fChain->GetEntry(jentry);

    PrintProgress(jentry, _nentries);

    EventSetup();


    // Analysis
    //--------------------------------------------------------------------------
    //if (Lepton1.flavour * Lepton2.flavour > 0) continue;
    //if (Lepton1.v.Pt() < 20.) continue;
    //if (Lepton2.v.Pt() < 20.) continue;

    // Let's trust our ntuples
    //--------------------------------------------------------------------------
    if (std_vector_lepton_flavour->at(0)*std_vector_lepton_flavour->at(1) > 0) continue;
    if (std_vector_lepton_pt->at(0) < 20.) continue; 
    if (std_vector_lepton_pt->at(1) < 20.) continue; 
    if (std_vector_lepton_pt->at(2) > 10.) continue; 

    _nelectron = 0;

    if (abs(Lepton1.flavour) == ELECTRON_FLAVOUR) _nelectron++;
    if (abs(Lepton2.flavour) == ELECTRON_FLAVOUR) _nelectron++;

    if      (_nelectron == 2) _channel = ee;
    else if (_nelectron == 1) _channel = em;
    else if (_nelectron == 0) _channel = mm;
    
    _m2l  = mll;
    _pt2l = ptll;


    // Fill histograms
    //--------------------------------------------------------------------------
    bool pass = true;

    // WW cuts   
    FillLevelHistograms(MonoH_00_Has2Leptons, pass);

    pass &= (mll > 12.);
    FillLevelHistograms(MonoH_01_Mll, pass);
    
    pass &= (MET.Et() > 20.);
    FillLevelHistograms(MonoH_02_PfMet, pass);

    bool pass_zveto = (_nelectron == 1 || fabs(mll - Z_MASS) > 15.);
    FillLevelHistograms(MonoH_03_ZVeto, pass && pass_zveto);

    pass &= (mpmet > 45. || (_nelectron == 1 && mpmet > 45.));
    FillLevelHistograms(MonoH_04_MpMet, pass && pass_zveto);

    pass &= (_passdphiveto);
    FillLevelHistograms(MonoH_05_DPhiVeto, pass && pass_zveto);

    pass &= (_nelectron == 1 && ptll > 30. || _nelectron != 1 && ptll > 45.);
    FillLevelHistograms(MonoH_06_Ptll, pass && pass_zveto);

    bool passTopCR = pass && _nbjet20cmvav2l == 1;

    pass &= (_nbjet20cmvav2l == 0);
    FillLevelHistograms(MonoH_07_BVeto, pass && pass_zveto);

    if (_saveminitree && pass && pass_zveto) minitree->Fill();

    //ZH->4l Control Region
    if (AnalysisLeptons[2].v.Pt() > 0 || AnalysisLeptons[3].v.Pt() > 0 ){
      //cout<<"I passed! :)"<<endl;
      
      bool passZHCR = ( (fabs(_mll13 - Z_MASS) < 15. || fabs(_mll23 - Z_MASS) < 15. || fabs(_mll14 - Z_MASS) < 15. || fabs(_mll24 - Z_MASS) < 15. || fabs(_mll34 - Z_MASS) < 15.) && AnalysisLeptons[2].v.Pt() > 20. && AnalysisLeptons[3].v.Pt() > 20.);
      
      FillLevelHistograms(MonoH_08_ZHCR, passZHCR);
      // cout<<"Lepton 3 pT = "<<std_vector_lepton_pt->at(2)<<endl;
      // cout<<"Lepton 4 pT = "<<std_vector_lepton_pt->at(3)<<endl;
      // cout<<"-------------------------------------------"<<endl;
    }

    FillLevelHistograms(MonoH_09_TopCR, passTopCR && pass_zveto);

    //    pass &= (!_foundsoftmuon);
    //    FillLevelHistograms(MonoH_08_SoftMu, pass && pass_zveto);

    // monoH cuts                                                         
    // bool pass_monoh = (pass && pass_zveto);
    // bool pass_drll = (Lepton1.v.DeltaR(Lepton2.v) < 1.5);

    // FillLevelHistograms(MonoH_103_CR, pass_monoh && !pass_drll);

    // pass_monoh &= (_mc < 100.);
    // FillLevelHistograms(MonoH_100_Mc, pass_monoh);
   
    // pass_monoh &= pass_drll;                                                                       
    // FillLevelHistograms(MonoH_101_DRll, pass_monoh); 
  
    // pass_monoh &= (mpmet > 60.);
    // FillLevelHistograms(MonoH_102_MpMet, pass_monoh);

    // pass_monoh &= (mpmet > 100.);
    // FillLevelHistograms(MonoH_09_mpmet100, pass_monoh);

    // pass_monoh &= (mth > 200.);
    // FillLevelHistograms(MonoH_10_mth200, pass_monoh);

    // pass_monoh &= (Lepton1.v.DeltaPhi(MET) > 2.6);
    // FillLevelHistograms(MonoH_11_dphil1met, pass_monoh);

    // pass_monoh &= (Lepton2.v.DeltaPhi(MET) > 2.6);
    // FillLevelHistograms(MonoH_12_dphil2met, pass_monoh);

    // pass_monoh &= (drll < 0.8);
    // FillLevelHistograms(MonoH_13_deltarll, pass_monoh);

    // pass_monoh &= (mtw1 > 160.);
    // FillLevelHistograms(MonoH_14_mtw1, pass_monoh);

    // pass_monoh &= (mtw2 > 100.);
    // FillLevelHistograms(MonoH_15_mtw2, pass_monoh);

    // pass_monoh &= (metTtrk > 100.);
    // FillLevelHistograms(MonoH_16_trkmet, pass_monoh);

  }

  EndJob();
}
Пример #3
0
//------------------------------------------------------------------------------
// Loop
//------------------------------------------------------------------------------
void AnalysisControl::Loop(TString analysis, TString filename, float luminosity)
{
  if (fChain == 0) return;

  Setup(analysis, filename, luminosity);


  // Define histograms
  //----------------------------------------------------------------------------
  root_output->cd();

  for (int j=0; j<ncut; j++) {

    for (int k=0; k<=njetbin; k++) {

      TString sbin = (k < njetbin) ? Form("/%djet", k) : "";

      TString directory = scut[j] + sbin;

      root_output->cd();

      if (k < njetbin) gDirectory->mkdir(directory);

      root_output->cd(directory);

      for (int i=ee; i<=ll; i++) {

	TString suffix = "_" + schannel[i];

	DefineHistograms(i, j, k, suffix);
      }
    }
  }

  root_output->cd();


  // Loop over events
  //----------------------------------------------------------------------------
  for (Long64_t jentry=0; jentry<_nentries;jentry++) {

    Long64_t ientry = LoadTree(jentry);

    if (ientry < 0) break;

    fChain->GetEntry(jentry);

    PrintProgress(jentry, _nentries);

    EventSetup();


    // Analysis
    //--------------------------------------------------------------------------
    _nelectron = 0;

    if (abs(Lepton1.flavour) == ELECTRON_FLAVOUR) _nelectron++;
    if (abs(Lepton2.flavour) == ELECTRON_FLAVOUR) _nelectron++;

    if      (_nelectron == 2) _channel = ee;
    else if (_nelectron == 1) _channel = em;
    else if (_nelectron == 0) _channel = mm;
    
    _m2l  = mll;   // Needs l2Sel
    _pt2l = ptll;  // Needs l2Sel

    bool pass_2l = (Lepton1.flavour * Lepton2.flavour < 0);

    pass_2l &= (Lepton1.v.Pt() > 25.);
    pass_2l &= (Lepton2.v.Pt() > 20.);
    pass_2l &= (std_vector_lepton_pt->at(2) < 10.);
    pass_2l &= (_m2l > 20.);


    bool pass;


    // No cuts
    //--------------------------------------------------------------------------
    pass = true;

    FillLevelHistograms(Control_00_NoCuts, pass);


    // Has 2 tight leptons
    //--------------------------------------------------------------------------
    pass = pass_2l;

    FillLevelHistograms(Control_01_TwoLeptons, pass);

    if (_saveminitree && pass) minitree->Fill();


    // R out/in
    //--------------------------------------------------------------------------
    pass = pass_2l;

    pass &= (_nbjet30csvv2m > 0);

    FillLevelHistograms(Control_02_Routin, pass);


    // WW
    // https://github.com/latinos/PlotsConfigurations/blob/master/Configurations/ControlRegions/WW/Full2016/cuts.py
    //--------------------------------------------------------------------------
    pass =
      mll > 80                         &&
      std_vector_lepton_pt->at(0) > 25 &&
      std_vector_lepton_pt->at(1) > 13 &&
      std_vector_lepton_pt->at(2) < 10 &&
      metPfType1 > 20                  &&
      ptll > 30                        &&
      mth >= 60	                       &&
      (std_vector_jet_pt->at(0) < 20 || std_vector_jet_cmvav2->at(0) < -0.5884) &&
      (std_vector_jet_pt->at(1) < 20 || std_vector_jet_cmvav2->at(1) < -0.5884) &&
      (std_vector_jet_pt->at(2) < 20 || std_vector_jet_cmvav2->at(2) < -0.5884) &&
      (std_vector_jet_pt->at(3) < 20 || std_vector_jet_cmvav2->at(3) < -0.5884) &&
      (std_vector_jet_pt->at(4) < 20 || std_vector_jet_cmvav2->at(4) < -0.5884) &&
      (std_vector_jet_pt->at(5) < 20 || std_vector_jet_cmvav2->at(5) < -0.5884) &&
      (std_vector_jet_pt->at(6) < 20 || std_vector_jet_cmvav2->at(6) < -0.5884) &&
      (std_vector_jet_pt->at(7) < 20 || std_vector_jet_cmvav2->at(7) < -0.5884) &&
      (std_vector_jet_pt->at(8) < 20 || std_vector_jet_cmvav2->at(8) < -0.5884) &&
      (std_vector_jet_pt->at(9) < 20 || std_vector_jet_cmvav2->at(9) < -0.5884);

    FillLevelHistograms(Control_03_WW, pass);

    if (pass) EventDump();


    // Top
    //--------------------------------------------------------------------------
    pass = pass_2l;

    pass &= (_njet > 1);
    pass &= (_nbjet30csvv2m > 0);
    pass &= (_channel == em || fabs(_m2l - Z_MASS) > 15.);
    pass &= (MET.Et() > 45.);

    FillLevelHistograms(Control_04_Top, pass);
  }


  EndJob();
}