Beispiel #1
0
int main(int argc, char* argv[]) {

  if(  argc != 3 && argc != 4 ) {
    std::cout << "USAGE: ./drawTHq [(string)redntpProdVersion][(string)selType] [bTaggerType=\"CSV\"]" << std::endl;
    exit(23);
  }


  std::string  redntpProdVersion(argv[1]);
  std::string selType(argv[2]);


  std::string bTaggerType = "CSV";
  if( argc>=4 ) {
    std::string bTaggerType_str(argv[3]);
    bTaggerType = bTaggerType_str;
  }


  // no stack is used for shape comparisons between signal
  // and the main backgrounds (diphoton, gammajet and ttbar)
  DrawBase* db = new DrawBase("THq");
  DrawBase* db_stack = new DrawBase("THq_stack");



  db->set_lumiOnRightSide();
  //db->set_lumiNormalization();
  db->set_lumi(19500.);
  db->set_shapeNormalization();
  db->set_drawZeros(false);

  db_stack->set_drawZeros(false);



  std::string outputdir_str = "THq_plots/"+redntpProdVersion+"/THqPlots_DATA_" + selType;
  outputdir_str += "_" + bTaggerType;
  db->set_outputdir(outputdir_str);
  db_stack->set_outputdir(outputdir_str);



  int signalFillColor = 46;

  std::string inputDir="finalizedTrees_"+redntpProdVersion+"/";



  
  
  std::string dataFileName = "HGG_translated_tHq_loose.root";
  //std::string dataFileName = inputDir + "/THq_DATA_Run2012";
  //dataFileName += "_" + selType;
  //dataFileName += "_" + bTaggerType;
  //dataFileName += ".root";
  TFile* dataFile = TFile::Open(dataFileName.c_str());
  db->add_dataFile( dataFile, "data", "Sidebands Data" );
  db_stack->add_dataFile( dataFile, "data", "Data" );


  std::string THqFileName = inputDir + "/THq_tHq_mH125_8TeV_testtest";
  THqFileName += "_" + selType;
  THqFileName += "_" + bTaggerType;
  THqFileName += ".root";
  TFile* THqFile = TFile::Open(THqFileName.c_str());
  db->add_mcFile( THqFile, "THq", "THq (125)", kWhite, 0, -1, kBlack, 2);
  db_stack->add_mcFile( THqFile, "THq", "THq (Ct=-1)", kWhite, 0, -1, kBlack, 2);

  std::string ttHFileName = inputDir + "/THq_TTH_HToGG_M-125_8TeV-pythia6_Summer12-PU_S7_START52_V9-v2";
  ttHFileName += "_" + selType;
  ttHFileName += "_" + bTaggerType;
  ttHFileName += ".root";
  TFile* ttHFile = TFile::Open(ttHFileName.c_str());
  db->add_mcFile( ttHFile,  "TTH", "ttH (125)", kRed+1, 0);
  db_stack->add_mcFile( ttHFile,  "TTH", "ttH (Ct=-1)", kGray, 0);


  //db->drawHisto_fromTree("tree_passedEvents", "pt_bJet", "eventWeight*(run>10000 || isLeptonic)", 20, 0., 250., "pt_bJet", "b-Jet Candidate p_{T}", "GeV");
  db->set_legendTitle("Leptonic Channel");
  db->drawHisto_fromTree("tree_passedEvents", "njets", "eventWeight*(isLeptonic)", 7, 1.5, 8.5, "nJets_lept", "Number of Jets");
  db->drawHisto_fromTree("tree_passedEvents", "nbjets_loose", "eventWeight*(isLeptonic)", 5, 0.5, 5.5, "nBJetsLoose_lept", "Number of Loose b-Jets");
  db->drawHisto_fromTree("tree_passedEvents", "nbjets_medium", "eventWeight*(isLeptonic)", 5, 0.5, 5.5, "nBJetsMedium_lept", "Number of Medium b-Jets");
  db->drawHisto_fromTree("tree_passedEvents", "eta_qJet", "eventWeight*(isLeptonic)", 20, -5., 5.0001, "eta_qJet_lept", "q-Jet Candidate #eta");
  db->drawHisto_fromTree("tree_passedEvents", "charge_lept", "eventWeight*(isLeptonic)", 3, -1.5, 1.5, "charge_lept_lept", "Lepton Charge");
  db->drawHisto_fromTree("tree_passedEvents", "mt_top", "eventWeight*(isLeptonic)", 20, 0., 500., "mt_top_lept", "Top Transverse Mass", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "deltaPhi_top_higgs", "eventWeight*(isLeptonic)", 20, 0., 3.15, "deltaPhi_top_higgs_lept", "#Delta#Phi(top-diphoton)", "rad");
  db->drawHisto_fromTree("tree_passedEvents", "deltaEta_lept_qJet", "eventWeight*(isLeptonic)", 20, 0., 5., "deltaEta_lept_qJet_lept", "#Delta#eta(lepton-qJet)", "");
  db->drawHisto_fromTree("tree_passedEvents", "BDT_lept", "eventWeight*(isLeptonic)", 40, -1., 1.0001, "BDT_lept", "Leptonic Channel BDT");
  db->drawHisto_fromTree("tree_passedEvents", "LD_lept", "eventWeight*(isLeptonic)", 40, 0., 1.0001, "LD_lept", "Leptonic Channel LD");


  db->set_legendTitle("Hadronic Channel");
  db->drawHisto_fromTree("tree_passedEvents", "njets", "eventWeight*(!isLeptonic)", 5, 3.5, 8.5, "nJets_hadr", "Number of Jets");
  db->drawHisto_fromTree("tree_passedEvents", "nCentralJets", "eventWeight*(!isLeptonic)", 7, -0.5, 6.5, "nCentralJets_hadr", "Number of Additional Jets (|#eta| < 2)");
  db->drawHisto_fromTree("tree_passedEvents", "nFwdJets", "eventWeight*(!isLeptonic)", 7, -0.5, 6.5, "nFwdJets_hadr", "Number of Additional Jets (|#eta| > 2)");
  db->drawHisto_fromTree("tree_passedEvents", "nbjets_loose", "eventWeight*(!isLeptonic)", 5, 0.5, 5.5, "nBJetsLoose_hadr", "Number of Loose b-Jets");
  db->drawHisto_fromTree("tree_passedEvents", "nbjets_medium", "eventWeight*(!isLeptonic)", 5, 0.5, 5.5, "nBJetsMedium_hadr", "Number of Medium b-Jets");
  db->drawHisto_fromTree("tree_passedEvents", "m_top", "eventWeight*(!isLeptonic)", 10, 130., 210, "m_top_hadr", "Top Mass", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "m_W", "eventWeight*(!isLeptonic)", 10, 20., 220., "m_W_hadr", "W Mass", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "pt_qJet", "eventWeight*(!isLeptonic)", 20, 45., 245., "pt_qJet_hadr", "p_{T} (qJet)", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "eta_qJet", "eventWeight*(!isLeptonic)", 20, -5., 5., "eta_qJet_hadr", "#eta (qJet)");
  db->drawHisto_fromTree("tree_passedEvents", "epfMet", "eventWeight*(!isLeptonic)", 20, 0., 200., "epfMet_hadr", "Particle Flow #slash{E}_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "Ht", "eventWeight*(!isLeptonic)", 20, 0., 500., "Ht_hadr", "H_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "mHt", "eventWeight*(!isLeptonic)", 25, 0., 500., "mHt_hadr", "#slash{H}_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "mSt", "eventWeight*(!isLeptonic)", 25, 0., 500., "mSt_hadr", "#slash{S}_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "deltaPhi_top_higgs", "eventWeight*(!isLeptonic)", 20, 0., 3.15, "deltaPhi_top_higgs_hadr", "#Delta#Phi(top-diphoton)", "rad");
  db->drawHisto_fromTree("tree_passedEvents", "deltaEta_bJet_qJet", "eventWeight*(!isLeptonic)", 10, 0., 5., "deltaEta_bJet_qJet_hadr", "#Delta#eta(bJet-qJet)", "");
  db->drawHisto_fromTree("tree_passedEvents", "ptPhot1", "eventWeight*(!isLeptonic)", 50, 35., 235., "ptPhot1_hadr", "Leading Photon p_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "ptPhot1*120./mgg", "eventWeight*(!isLeptonic)", 50, 35., 235., "ptRunPhot1_hadr", "Running Leading Photon p_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "ptPhot2", "eventWeight*(!isLeptonic)", 50, 20., 220., "ptPhot2_hadr", "Subleading Photon p_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "ptPhot2*120./mgg", "eventWeight*(!isLeptonic)", 50, 20., 220., "ptRunPhot2_hadr", "Running Subleading Photon p_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "ptgg", "eventWeight*(!isLeptonic)", 50, 0., 250., "ptgg_hadr", "DiPhoton p_{T}", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "deltaR_top_phot_min_hadr", "eventWeight*(!isLeptonic)", 20, 0., 5., "deltaR_top_phot_min_hadr",  "Minimal #DeltaR(top, #gamma)", "");
  db->drawHisto_fromTree("tree_passedEvents", "deltaR_qJet_phot_min_hadr", "eventWeight*(!isLeptonic)", 20, 0., 5., "deltaR_qJet_phot_min_hadr",  "Minimal #DeltaR(qJet, #gamma)", "");


  db_stack->set_lumiNormalization(19500.);
  db_stack->set_mcWeight( "THq", 34. );
  db_stack->set_mcWeight( "TTH", 2.4 );
  db_stack->set_yAxisMax( 6 );
  db_stack->set_legendTitle("Hadronic Channel");
  db_stack->drawHisto_fromTree("tree_passedEvents", "mgg", "eventWeight*(!isLeptonic)", 80, 100., 180., "mgg_hadr", "Diphoton Mass", "GeV");
  db_stack->drawHisto_fromTree("tree_passedEvents", "mgg", "eventWeight*(!isLeptonic && nCentralJets<=1 )", 80, 100., 180., "mgg_hadr_CJV", "Diphoton Mass", "GeV");
  db_stack->set_yAxisMax( 3.6 );
  db_stack->set_legendTitle("Leptonic Channel");
  db_stack->drawHisto_fromTree("tree_passedEvents", "mgg", "eventWeight*(isLeptonic)", 80, 100., 180., "mgg_lept", "Diphoton Mass", "GeV");
  db_stack->drawHisto_fromTree("tree_passedEvents", "mgg", "eventWeight*(isLeptonic && LD_lept>0.25)", 80, 100., 180., "mgg_lept_LD", "Diphoton Mass", "GeV");


  // add all other processes:

  std::string VHFileName = inputDir +  "THq_WH_ZH_HToGG_M-125_8TeV-pythia6_Summer12-PU_S7_START52_V9-v2";
  VHFileName += "_" + selType;
  VHFileName += "_" + bTaggerType;
  VHFileName += ".root";
  TFile* VHFile = TFile::Open(VHFileName.c_str());
  db->add_mcFile( VHFile, "VH", "VH", 42, 0);

  
  std::string GluGluHFileName = inputDir +  "THq_GluGluToHToGG_M-125_8TeV-powheg-pythia6_Summer12-PU_S7_START52_V9-v1";
  GluGluHFileName += "_" + selType;
  GluGluHFileName += "_" + bTaggerType;
  GluGluHFileName += ".root";
  TFile* GluGluHFile = TFile::Open(GluGluHFileName.c_str());
  db->add_mcFile( GluGluHFile, "GluGluH", "ggF H", signalFillColor+1, 0);


  std::string VBFHFileName = inputDir +  "THq_VBF_HToGG_M-125_8TeV-powheg-pythia6_Summer12-PU_S7_START52_V9-v1";
  VBFHFileName += "_" + selType;
  VBFHFileName += "_" + bTaggerType;
  VBFHFileName += ".root";
  TFile* VBFHFile = TFile::Open(VBFHFileName.c_str());
  db->add_mcFile( VBFHFile, "VBFH", "VBF H ", signalFillColor, 0);


  db->reset();
//// inclusive signal file for stack plot
//std::string HToGGFileName = inputDir +  "THq_HToGG_M-125_8TeV-pythia6";
//HToGGFileName += "_" + selType;
//HToGGFileName += "_" + bTaggerType;
//HToGGFileName += ".root";
//TFile* HToGGFile = TFile::Open(HToGGFileName.c_str());






  DrawBase* db2 = new DrawBase("db2");
  db2->set_lumiOnRightSide();
  db2->set_lumiNormalization(19500.);
  db2->set_outputdir(outputdir_str);

  db2->add_dataFile( dataFile, "data", "Sidebands Data" );

  std::string DiPhotonFileName = inputDir +  "THq_DiPhoton_8TeV-pythia6";
  DiPhotonFileName += "_" + selType;
  DiPhotonFileName += "_" + bTaggerType;
  DiPhotonFileName += ".root";
  TFile* DiPhotonFile = TFile::Open(DiPhotonFileName.c_str());
  db2->add_mcFile( DiPhotonFile, "DiPhoton", "Diphoton", 29);

  std::string GammaJetFileName = inputDir +  "THq_GJet_doubleEMEnriched_TuneZ2star_8TeV-pythia6";
  GammaJetFileName += "_" + selType;
  GammaJetFileName += "_" + bTaggerType;
  GammaJetFileName += ".root";
  TFile* GammaJetFile = TFile::Open(GammaJetFileName.c_str());
  db2->add_mcFile( GammaJetFile, "GammaJet", "#gamma + Jet", 38);

  std::string DiBosonFileName = inputDir +  "THq_VV_8TeV";
  DiBosonFileName += "_" + selType;
  DiBosonFileName += "_" + bTaggerType;
  DiBosonFileName += ".root";
  TFile* DiBosonFile = TFile::Open(DiBosonFileName.c_str());
  db2->add_mcFile( DiBosonFile, "DiBoson", "Diboson", 39);


  std::string TriBosonFileName = inputDir +  "THq_VGG_8TeV";
  TriBosonFileName += "_" + selType;
  TriBosonFileName += "_" + bTaggerType;
  TriBosonFileName += ".root";
  TFile* TriBosonFile = TFile::Open(TriBosonFileName.c_str());
  db2->add_mcFile( TriBosonFile, "Vgg", "V#gamma#gamma", 40);


  std::string TTFileName = inputDir +  "THq_TT_8TeV";
  TTFileName += "_" + selType;
  TTFileName += "_" + bTaggerType;
  TTFileName += ".root";
  TFile* TTFile = TFile::Open(TTFileName.c_str());
  db2->add_mcFile( TTFile, "TT", "Top", 44);



  std::string QCDFileName = inputDir +  "THq_QCD_doubleEMEnriched_TuneZ2star_8TeV-pythia6";
  QCDFileName += "_" + selType;
  QCDFileName += "_" + bTaggerType;
  QCDFileName += ".root";
  TFile* QCDFile = TFile::Open(QCDFileName.c_str());
  //db->add_mcFile( QCDFile, "QCD", "QCD", 41);



  // and now set the weights 
  // - inflate the higgs processes
  // - set the sideband/(sideband+SR) scaling in order to compare to data (all)
  float SF = 60./80.;

  //db2->set_mcWeight( "THq", 34.*SF );
  //db2->set_mcWeight( "TTH", 2.4*SF );
  //db2->set_mcWeight( "VH", 2.4*SF );
  //db2->set_mcWeight( "GluGluH", 2.4*SF );
  //db2->set_mcWeight( "VBFH", 2.4*SF );
  db2->set_mcWeight( "DiPhoton", SF );
  db2->set_mcWeight( "GammaJet", SF );
  db2->set_mcWeight( "DiBoson", SF );
  db2->set_mcWeight( "Vgg", SF );
  db2->set_mcWeight( "TT", SF );

  db2->set_drawZeros(true);


  db2->set_getBinLabels(true);
  db2->drawHisto("cutFlow_lept", "", "", "Events", true);
  db2->set_getBinLabels(false);



  return 0;

}
Beispiel #2
0
int main(int argc, char* argv[]) {

  if(  argc != 2 && argc != 3 ) {
    std::cout << "USAGE: ./drawRadion [(string)selType] [bTaggerType=\"JP\"]" << std::endl;
    exit(23);
  }

  std::string selType(argv[1]);

  std::string bTaggerType = "JP";
  if( argc>=3 ) {
    std::string bTaggerType_str(argv[2]);
    bTaggerType = bTaggerType_str;
  }


  DrawBase* db_nostack = new DrawBase("Radion_nostack");
  DrawBase* db_stack   = new DrawBase("Radion_stack");

  db_nostack->set_lumiOnRightSide();
  db_stack->set_lumiOnRightSide();

  db_nostack->set_shapeNormalization();

  db_stack->set_lumiNormalization(19600.);  // chiara
  db_stack->set_noStack(false);

  std::string outputdir_str = "RadionPlots_MConly_" + selType + "_" + bTaggerType;
  db_nostack->set_outputdir(outputdir_str);
  db_stack->set_outputdir(outputdir_str);

  int signalFillColor300  = 46;
  int signalFillColor500  = 4;
  int signalFillColor700  = 3;
  int signalFillColor1000 = 6;

  std::string RadionFileName300 = "finalizedTrees_Radion_presel/Radion_";
  RadionFileName300 += "Radion_M-300_madgraph";
  RadionFileName300 += "_" + selType;
  RadionFileName300 += "_" + bTaggerType;
  RadionFileName300 += ".root";
  TFile* RadionFile300 = TFile::Open(RadionFileName300.c_str());
  db_stack->add_mcFile( RadionFile300, "Radion", "Radion (300)", signalFillColor300, 0);   // chiara: I use 300 for the stack plots

  std::string RadionFileName500 = "finalizedTrees_Radion_presel/Radion_";
  RadionFileName500 += "Radion_M-500_madgraph";
  RadionFileName500 += "_" + selType;
  RadionFileName500 += "_" + bTaggerType;
  RadionFileName500 += ".root";
  TFile* RadionFile500 = TFile::Open(RadionFileName500.c_str());

  std::string RadionFileName700 = "finalizedTrees_Radion_presel/Radion_";
  RadionFileName700 += "Radion_M-700_madgraph";
  RadionFileName700 += "_" + selType;
  RadionFileName700 += "_" + bTaggerType;
  RadionFileName700 += ".root";
  TFile* RadionFile700 = TFile::Open(RadionFileName700.c_str());

  std::string RadionFileName1000 = "finalizedTrees_Radion_presel/Radion_";
  RadionFileName1000 += "Radion_M-1000_madgraph";
  RadionFileName1000 += "_" + selType;
  RadionFileName1000 += "_" + bTaggerType;
  RadionFileName1000 += ".root";
  TFile* RadionFile1000 = TFile::Open(RadionFileName1000.c_str());

  std::string HToGGFileName = "finalizedTrees_Radion_presel/Radion_";
  HToGGFileName += "HToGG_M-125_8TeV-pythia6";
  HToGGFileName += "_" + selType;
  HToGGFileName += "_" + bTaggerType;
  HToGGFileName += ".root";
  TFile* HToGGFile = TFile::Open(HToGGFileName.c_str());
  db_stack->add_mcFile( HToGGFile, "HToGG", "H (125)", 5);

  /*
  std::string HglugluToGGFileName = "finalizedTrees_Radion_presel/Radion_";
  HglugluToGGFileName += "GluGluToHToGG_M-125_8TeV-powheg-pythia6_Summer12-PU_S7_START52_V9-v1";
  HglugluToGGFileName += "_" + selType;
  HglugluToGGFileName += "_" + bTaggerType;
  HglugluToGGFileName += ".root";
  TFile* HglugluToGGFile = TFile::Open(HglugluToGGFileName.c_str());
  db_stack->add_mcFile( HglugluToGGFile, "HToGG gluglu", "H (125), gluglu", 30);

  std::string HvbfToGGFileName = "finalizedTrees_Radion_presel/Radion_";
  HvbfToGGFileName += "VBF_HToGG_M-125_8TeV-powheg-pythia6_Summer12_DR53X-PU_S10_START53_V7A-v1";
  HvbfToGGFileName += "_" + selType;
  HvbfToGGFileName += "_" + bTaggerType;
  HvbfToGGFileName += ".root";
  TFile* HvbfToGGFile = TFile::Open(HvbfToGGFileName.c_str());
  db_stack->add_mcFile( HvbfToGGFile, "HToGG vbf", "H (125), vbf", 30);
  */

  std::string HvhToGGFileName = "finalizedTrees_Radion_presel/Radion_";
  HvhToGGFileName += "WH_ZH_HToGG_M-125_8TeV-pythia6_Summer12_DR53X-PU_S10_START53_V7A-v1";
  HvhToGGFileName += "_" + selType;
  HvhToGGFileName += "_" + bTaggerType;
  HvhToGGFileName += ".root";
  TFile* HvhToGGFile = TFile::Open(HvhToGGFileName.c_str());
  // db_stack->add_mcFile( HvhToGGFile, "HToGG VH", "H (125), VH", 38);

  /*
  std::string HtthToGGFileName = "finalizedTrees_Radion_presel/Radion_";
  HtthToGGFileName += "TTH_HToGG_M-125_8TeV-pythia6_Summer12_DR53X-PU_S10_START53_V7A-v1";
  HtthToGGFileName += "_" + selType;
  HtthToGGFileName += "_" + bTaggerType;
  HtthToGGFileName += ".root";
  TFile* HtthToGGFile = TFile::Open(HtthToGGFileName.c_str());
  db_stack->add_mcFile( HtthToGGFile, "HToGG TTH", "H (125), ttH", 30);
  */

  std::string DiPhotonFileName = "finalizedTrees_Radion_presel/Radion_";
  DiPhotonFileName += "DiPhoton_8TeV-pythia6";
  DiPhotonFileName += "_" + selType;
  DiPhotonFileName += "_" + bTaggerType;
  DiPhotonFileName += ".root";
  TFile* DiPhotonFile = TFile::Open(DiPhotonFileName.c_str());
  db_stack->add_mcFile( DiPhotonFile, "DiPhoton", "Diphoton", 31);

  std::string GammaJetFileName = "finalizedTrees_Radion_presel/Radion_";
  GammaJetFileName += "GJet_doubleEMEnriched_TuneZ2star_8TeV-pythia6";
  GammaJetFileName += "_" + selType;
  GammaJetFileName += "_" + bTaggerType;
  GammaJetFileName += ".root";
  TFile* GammaJetFile = TFile::Open(GammaJetFileName.c_str());
  db_stack->add_mcFile( GammaJetFile, "GammaJet", "#gamma + Jet", 37);

  std::string DiBosonFileName = "finalizedTrees_Radion_presel/Radion_";
  DiBosonFileName += "VV_8TeV";
  DiBosonFileName += "_" + selType;
  DiBosonFileName += "_" + bTaggerType;
  DiBosonFileName += ".root";
  TFile* DiBosonFile = TFile::Open(DiBosonFileName.c_str());
  db_stack->add_mcFile( DiBosonFile, "DiBoson", "Diboson", 38);

  std::string BosonFileName = "finalizedTrees_Radion_presel/Radion_";
  BosonFileName += "V_8TeV";
  BosonFileName += "_" + selType;
  BosonFileName += "_" + bTaggerType;
  BosonFileName += ".root";
  TFile* BosonFile = TFile::Open(BosonFileName.c_str());
  db_stack->add_mcFile( BosonFile, "Bosons", "boson", 39);

  std::string TriBosonFileName = "finalizedTrees_Radion_presel/Radion_";
  TriBosonFileName += "VGG_8TeV";
  TriBosonFileName += "_" + selType;
  TriBosonFileName += "_" + bTaggerType;
  TriBosonFileName += ".root";
  TFile* TriBosonFile = TFile::Open(TriBosonFileName.c_str());
  db_stack->add_mcFile( TriBosonFile, "TriBoson", "V + #gamma#gamma", 40);

  std::string TTFileName = "finalizedTrees_Radion_presel/Radion_";
  TTFileName += "TT_8TeV";
  TTFileName += "_" + selType;
  TTFileName += "_" + bTaggerType;
  TTFileName += ".root";
  TFile* TTFile = TFile::Open(TTFileName.c_str());
  db_stack->add_mcFile( TTFile, "TT", "Top", 44);

  std::string QCDFileName = "finalizedTrees_Radion_presel/Radion_";
  QCDFileName += "QCD_doubleEMEnriched_TuneZ2star_8TeV-pythia6";
  QCDFileName += "_" + selType;
  QCDFileName += "_" + bTaggerType;
  QCDFileName += ".root";
  TFile* QCDFile = TFile::Open(QCDFileName.c_str());
  db_stack->add_mcFile( QCDFile, "QCD", "QCD", 41);


  // only for signal shape comparison
  db_nostack->add_mcFile( RadionFile300,  "Radion", "Radion (300)",  signalFillColor300,  0);
  // db_nostack->add_mcFile( RadionFile500,  "Radion", "Radion (500)",  signalFillColor500,  0);
  // db_nostack->add_mcFile( RadionFile700,  "Radion", "Radion (700)",  signalFillColor700,  0);
  // db_nostack->add_mcFile( RadionFile1000, "Radion", "Radion (1000)", signalFillColor1000, 0);
  db_nostack->add_mcFile( HvhToGGFile,  "HToGG VH", "H (125), VH", 38);
  db_nostack->add_mcFile( DiPhotonFile, "DiPhoton", "Diphoton",    31);


  bool log = true;

  db_nostack->drawHisto("njets", "Number of Jets", "", "Events");
  db_nostack->drawHisto("nbjets_loose",  "Number of b-Jets (Loose)",  "", "Events");
  db_nostack->drawHisto("nbjets_medium", "Number of b-Jets (Medium)", "", "Events");
  db_nostack->drawHisto("nbjets_tight",  "Number of b-Jets (Tight)",  "", "Events");

  db_nostack->drawHisto("ptphot0", "Lead Photon p_{T}",    "GeV");
  db_nostack->drawHisto("ptphot1", "Sublead Photon p_{T}", "GeV");

  db_nostack->drawHisto("runptphot0", "Running Lead Photon p_{T}",    "GeV");

  db_nostack->drawHisto("ptjet0",    "Lead Jet p_{T}",         "GeV");
  db_nostack->drawHisto("ptjet1",    "Sublead Jet p_{T}",      "GeV");
  db_nostack->drawHisto("runptjet0", "Running Lead Jet p_{T}", "GeV");

  db_nostack->drawHisto("etajet0", "Lead Jet eta",         "");
  db_nostack->drawHisto("etajet1", "Sublead Jet eta",      "");
  db_nostack->drawHisto("ptjet1",  "Sublead Jet eta",      "");

  db_nostack->set_rebin(4);
  db_nostack->drawHisto("mjj_preselJ", "Dijet Mass after photon and jets preselection", "GeV");
  db_nostack->drawHisto("mjj_1btag",   "Dijet Mass", "GeV");
  db_nostack->drawHisto("mjj_2btag",   "Dijet Mass", "GeV");

  db_nostack->set_rebin(1);
  db_nostack->drawHisto("mgg_preselG", "DiPhoton Invariant Mass after photon presel", "GeV");
  db_nostack->drawHisto("mgg_preselG", "DiPhoton Invariant Mass after photon presel", "GeV");

  db_nostack->set_rebin(4);
  db_nostack->drawHisto("mggjj",       "4body Mass", "GeV");
  db_nostack->drawHisto("mggjj_1btag", "4body Mass", "GeV");
  db_nostack->drawHisto("mggjj_2btag", "4body Mass", "GeV");

  db_nostack->set_rebin(2);
  db_nostack->drawHisto("ptDiphot",  "Diphoton p_{T}", "GeV");
  db_nostack->drawHisto("etaDiphot", "Diphoton eta", "");
  db_nostack->drawHisto("deltaPhi", "#Delta#Phi(dijet-diphoton)", "rad");
  db_nostack->drawHisto("deltaEta", "#Delta#Eta(dijet-diphoton)", "");
  db_nostack->drawHisto("ptDijet",  "Dijet p_{T}", "GeV");
  db_nostack->drawHisto("etaDijet", "Dijet eta", "");
  db_nostack->drawHisto("ptRatio",  "Dijet p_{T} / Diphoton p_{T}");
  db_nostack->drawHisto("ptDifference", "Dijet p_{T} - Diphoton p_{T}", "GeV");
  db_nostack->drawHisto("zeppen", "Zeppenfeld Variable");

  db_nostack->set_rebin();
  db_nostack->drawHisto("deltaPhiJets", "Jet-Jet #Delta#phi", "rad");
  db_nostack->drawHisto("deltaEtaJets", "Jet-Jet #Delta#eta");
  db_nostack->drawHisto("deltaFabsEtaJets", "Jet-Jet #Delta|#eta|");

  db_nostack->set_rebin();
  db_nostack->drawHisto("deltaEtaDiphot", "Gamma Gamma #Delta#eta");

  db_nostack->set_rebin(2);
  db_nostack->drawHisto("deltaPhi_kinfit", "#Delta#Phi(dijet-diphoton)", "rad");
  db_nostack->drawHisto("ptDijet_kinfit", "Dijet p_{T}", "GeV");
  db_nostack->drawHisto("ptRatio_kinfit", "Dijet p_{T} / Diphoton p_{T}");
  db_nostack->drawHisto("ptDifference_kinfit", "Dijet p_{T} - Diphoton p_{T}", "GeV");
  db_nostack->drawHisto("zeppen_kinfit", "Zeppenfeld Variable");

  db_nostack->set_rebin();
  db_nostack->drawHisto("deltaEtaJets_kinfit", "Jet-Jet #Delta#eta");
  db_nostack->drawHisto("deltaFabsEtaJets_kinfit", "Jet-Jet #Delta|#eta|");

  db_nostack->drawHisto("cosTheta1");
  db_nostack->drawHisto("cosTheta2");
  db_nostack->drawHisto("cosThetaStar");
  db_nostack->drawHisto("helphi");
  db_nostack->drawHisto("helphi1");

  db_nostack->drawHisto("cosThetaStar_jets");
  db_nostack->drawHisto("helicityAngle_V");

  db_nostack->set_rebin(20);
  db_nostack->drawHisto("mVstar", "V* Mass", "GeV");
  db_nostack->set_rebin(5);
  db_nostack->set_xAxisMax(200);
  db_nostack->drawHisto("ptVstar", "V* p_{T}", "GeV");
  db_nostack->set_xAxisMax();
  db_nostack->drawHisto("etaVstar", "V* #eta");
  db_nostack->drawHisto("phiVstar", "V* #phi", "rad");

  db_nostack->drawHisto("mVstar_kinfit", "V* Mass", "GeV");
  db_nostack->drawHisto("ptVstar_kinfit", "V* p_{T}", "GeV");
  db_nostack->drawHisto("etaVstar_kinfit", "V* #eta");
  db_nostack->drawHisto("phiVstar_kinfit", "V* #phi", "rad");

  db_nostack->set_rebin(40);
  db_nostack->drawHisto("kinfit_chiSquareProbH", "KinFit #chi^{2} Prob");

  db_nostack->set_rebin(1);
  db_nostack->set_legendTitle( "1 b-tag Category (EBEB)" );
  db_nostack->drawHisto("mgg_1btag_ebeb", "DiPhoton Invariant Mass", "GeV");
  db_nostack->set_legendTitle( "2 b-tag Category (EBEB)" );
  db_nostack->drawHisto("mgg_2btag_ebeb", "DiPhoton Invariant Mass", "GeV");

  db_nostack->set_legendTitle( "1 b-tag Category (!EBEB)" );
  db_nostack->drawHisto("mgg_1btag_nebeb", "DiPhoton Invariant Mass", "GeV");
  db_nostack->set_legendTitle( "2 b-tag Category (!EBEB)" );
  db_nostack->drawHisto("mgg_2btag_nebeb", "DiPhoton Invariant Mass", "GeV");

  // db_nostack->set_legendTitle( "1 b-tag Category" );
  // db_nostack->drawHisto("mggjj_1btag", "DiPhoton+DiJets Invariant Mass", "GeV");
  // db_nostack->set_legendTitle( "2 b-tag Category" );
  // db_nostack->drawHisto("mggjj_2btag", "DiPhoton+DiJets Invariant Mass", "GeV");


  bool doUL = (selType == "default" );  // chiara

  // final
  db_stack->set_legendTitle( "inclusive" );
  db_stack->drawHisto("mggjj", "DiPhoton+DiJets Invariant Mass", "GeV");
  printYields( db_stack, "incl", doUL );

  db_stack->set_legendTitle( "1 b-tag Category" );
  db_stack->drawHisto("mggjj_1btag", "DiPhoton+DiJets Invariant Mass", "GeV");
  printYields( db_stack, "1tag", doUL );

  db_stack->set_legendTitle( "2 b-tag Category" );
  db_stack->drawHisto("mggjj_2btag", "DiPhoton+DiJets Invariant Mass", "GeV");
  printYields( db_stack, "2tag", doUL );

  return 0;
}
Beispiel #3
0
int main(int argc, char* argv[]) {

  if(  argc != 2 && argc != 3 ) {
    std::cout << "USAGE: ./drawTTZTrilepton [(string)selType] [bTaggerType=\"TCHE\"]" << std::endl;
    exit(23);
  }

  std::string leptType = "ALL";

  std::string selType(argv[1]);

  std::string PUType = "PUHR11_73pb";

  std::string bTaggerType = "TCHE";
  if( argc>=3 ) {
    std::string bTaggerType_str(argv[2]);
    bTaggerType = bTaggerType_str;
  }

  float btag_thresh;
  if( bTaggerType == "TCHE" ) 
    btag_thresh = 3.3;
  else if( bTaggerType == "SSVHE" )
    btag_thresh = 1.74;
  else {
    std::cout << "Btagger: " << bTaggerType << " not supported. Exiting." << std::endl;
    exit(1111);
  }



  DrawBase* db = new DrawBase("TTZTrilepton");

  db->set_lumiOnRightSide();

  std::string outputdir_str = "TTZTrileptonPlots_MConly_" + selType + "_" + bTaggerType + "_" + leptType;
  db->set_outputdir(outputdir_str);

  int signalFillColor = 46;

  std::string TTZFileName = "TTZTrilepton_TTZ_TuneZ2_7TeV-madgraphCMSSW42xPUv3_spadhi";
  TTZFileName += "_" + selType;
  TTZFileName += "_" + bTaggerType;
  //TTZFileName += "_" + PUType;
  TTZFileName += "_" + leptType;
  TTZFileName += ".root";
  TFile* TTZFile = TFile::Open(TTZFileName.c_str());
  db->add_mcFile( TTZFile, "ttZ", "t#bar{t} + Z", signalFillColor, 0);


  std::string mcDYVVFileName = "TTZTrilepton_VV_Summer11";
  mcDYVVFileName += "_" + selType;
  mcDYVVFileName += "_" + bTaggerType;
  //mcVVFileName += "_" + PUType;
  mcDYVVFileName += "_" + leptType;
  mcDYVVFileName += ".root";
  TFile* mcDYVVFile = TFile::Open(mcDYVVFileName.c_str());
  db->add_mcFile( mcDYVVFile, "diboson", "DY+Diboson", 29, 3005);

  std::string mcZJetsFileName = "TTZTrilepton_DYJetsToLL_TuneZ2_M-50_7TeV-madgraph-tauola_Fall11";
  mcZJetsFileName += "_" + selType;
  mcZJetsFileName += "_" + bTaggerType;
  //mcZJetsFileName += "_" + PUType;
  mcZJetsFileName += "_" + leptType;
  mcZJetsFileName += ".root";
  TFile* mcZJetsFile = TFile::Open(mcZJetsFileName.c_str());
  //db->add_mcFile( mcZJetsFile, "ZJets", "Z + jets", 46, 3004);

  //std::string mcTTbarFileName = "TTZTrilepton_TTJets_TuneZ2_7TeV-madgraph-tauola_Summer11-PU_S4_START42_V11-v1";
  std::string mcTTbarFileName = "TTZTrilepton_TTJ_Fall11_highstat";
  mcTTbarFileName += "_" + selType;
  mcTTbarFileName += "_" + bTaggerType;
  //mcTTWFileName += "_" + PUType;
  mcTTbarFileName += "_" + leptType;
  mcTTbarFileName += ".root";
  TFile* mcTTbarFile = TFile::Open(mcTTbarFileName.c_str());
  db->add_mcFile( mcTTbarFile, "TTtW", "t#bar{t}", 39, 3004);


  std::string mcVVFileName = "TTZTrilepton_VV_Summer11";
  mcVVFileName += "_" + selType;
  mcVVFileName += "_" + bTaggerType;
  //mcVVFileName += "_" + PUType;
  mcVVFileName += "_" + leptType;
  mcVVFileName += ".root";
  TFile* mcVVFile = TFile::Open(mcVVFileName.c_str());
  //db->add_mcFile( mcVVFile, "diboson", "Diboson", 29, 3005);



  db->set_shapeNormalization();




  bool log = true;


  //db->set_legendTitle("Trilepton channel");

  db->set_yAxisMaxScale(1.1);

  db->drawHisto("nJets", "Jet Multiplicity", "", "Events", log);
  db->set_xAxisMax(6.5);
  db->drawHisto("nBJets_loose", "b-Jet Multiplicity (loose)", "", "Events", log);
  db->drawHisto("nBJets_medium", "b-Jet Multiplicity (medium)", "", "Events", log);

  db->set_xAxisMax(0);
  db->set_rebin(4);
  db->drawHisto("mZll_prepresel", "Dilepton mass", "GeV", "Events");
  db->drawHisto("mZll", "Dilepton mass", "GeV", "Events");

  db->set_xAxisMax(700);
  db->set_rebin(40);
  db->drawHisto("m3", "M3", "GeV", "Events");


  db->set_rebin(10); 
  db->set_xAxisMax(200.); 
  db->drawHisto("pfMet", "Particle Flow ME_{T}", "GeV", "Events", log);
  db->drawHisto("pfMet_presel", "pfME_{T}", "GeV", "Events", log);
  db->set_rebin(4); 
  db->set_xAxisMax(250.); 
  db->set_xAxisMax();
  db->drawHisto("ptLept3_presel", "Third Lepton p_{T}", "GeV", "Events");
  db->set_xAxisMax(0.15);
  db->set_rebin(); 
  db->drawHisto("combinedIsoRelLept3_presel", "Third Lepton Isolation", "", "Events");


  db->set_xAxisMax();
  db->set_rebin(10);
  db->drawHisto_fromTree("tree_passedEvents", "TMath::Max( TMath::Max(ptJetB1, ptJetB2), TMath::Max(ptJet3, ptJet4) )", "eventWeight", 100, 20., 420., "ptJetMax", "Leading Jet p_{T}", "GeV");
  db->set_xAxisMax(250.);
  db->drawHisto("ptLeptZ1", "Lead Z Lepton p_{T}", "GeV", "Events");
  db->drawHisto("ptJetB1", "Leading b-Tagged Jet p_{T}", "GeV");
  db->set_xAxisMax(150.);
  db->drawHisto("ptLeptZ2", "Sublead Z Lepton p_{T}", "GeV", "Events");

  db->set_xAxisMax(5.);
  db->set_rebin(5);
  std::string axisName = "Leading b-Tag (" + bTaggerType + ")";
  db->drawHisto("bTagJetB1", axisName );
  axisName = "Subleading b-Tag (" + bTaggerType + ")";
  db->drawHisto("bTagJetB2", "Subleading b-Tag");

  db->set_xAxisMax(700);
  db->set_rebin(40);
  db->drawHisto("ht", "H_{T}", "GeV", "Events");
  db->drawHisto("mTW", "M_{T} (ME_{T} + l_{3})", "GeV", "Events");
  db->drawHisto("mT_lZmet", "M_{T} (ME_{T} + Z + l_{3})", "GeV", "Events");

  db->drawHisto("deltaRbb", "", "GeV", "Events");

  db->set_xAxisMax(1000);
  db->drawHisto("mb1jj", "M(b_{1} jj)", "GeV", "Events");
  db->drawHisto("mb2jj", "M(b_{2} jj)", "GeV", "Events");
  db->drawHisto("mbjj_best", "Best M(bjj)", "GeV", "Events");
  db->drawHisto("mbjj_max", "Max M(bjj)", "GeV", "Events");

  db->drawHisto("mb1jjZ", "M(b_{1} jjZ)", "GeV", "Events");
  db->drawHisto("mb2jjZ", "M(b_{2} jjZ)", "GeV", "Events");
  db->drawHisto("mbjjZ_best", "Best M(bjjZ)", "GeV", "Events");
  db->drawHisto("mbjjZ_max", "Max M(bjjZ)", "GeV", "Events");

  db->drawHisto("mTb1W", "M_{T} (ME_{T} + l_{3} + b_{1})", "GeV", "Events");
  db->drawHisto("mTb2W", "M_{T} (ME_{T} + l_{3} + b_{2})", "GeV", "Events");
  db->drawHisto("mTbW_best", "Best M_{T} (ME_{T} + l_{3} + b)", "GeV", "Events");
  db->drawHisto("mTbW_max", "Max M_{T} (ME_{T} + l_{3} + b)", "GeV", "Events");

  db->drawHisto("mTb1WZ", "M_{T} (ME_{T} + l_{3} + b_{1} + Z)", "GeV", "Events");
  db->drawHisto("mTb2WZ", "M_{T} (ME_{T} + l_{3} + b_{2} + Z)", "GeV", "Events");
  db->drawHisto("mTbWZ_best", "Best M_{T} (ME_{T} + l_{3} + b + Z)", "GeV", "Events");
  db->drawHisto("mTbWZ_max", "Max M_{T} (ME_{T} + l_{3} + b + Z)", "GeV", "Events");

  db->set_xAxisMax();
  db->drawHisto("ptZll", "p_{T} (Z)", "GeV", "Events");

  db->set_rebin();
  //db->drawHisto_fromTree("tree_passedEvents", "ht", "eventWeight", 50, 60., 560., "ht", "H_{T}", "GeV");
  //db->drawHisto_fromTree("tree_passedEvents", "ptZll", "eventWeight*(mZll>81. && mZll<101.)", 30, 0., 300., "ptZll", "p_{T} (Z)", "GeV");

  db->drawHisto_fromTree("tree_passedEvents", "mbjjZ_max", "eventWeight*(mZll>81. && mZll<101. && pfMet>30.)", 50, 0., 1000., "mbjjZ_max_met30", "mbjjZ_max", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "mbjjZ_best", "eventWeight*(mZll>81. && mZll<101. && pfMet>30.)", 50, 0., 1000., "mbjjZ_best_met30", "mbjjZ_best", "GeV");





/*

  std::string mcTTWFileName = "TTZTrilepton_TTW_TuneZ2_7TeV-madgraphCMSSW42xPUv2_spadhi";
  mcTTWFileName += "_" + selType;
  mcTTWFileName += "_" + bTaggerType;
  //mcTTWFileName += "_" + PUType;
  mcTTWFileName += "_" + leptType;
  mcTTWFileName += ".root";
  TFile* mcTTWFile = TFile::Open(mcTTWFileName.c_str());
  db->add_mcFile( mcTTWFile, "ttW", "t#bar{t} + W", 33, 3002);


  float lumifb = 4.6;

  db->set_lumiNormalization(lumifb*1000.);
  db->set_noStack(false);

  db->set_rebin(2);
  db->drawHisto( "ptZll", "Z p_{T}", "GeV" );
  drawChannelYieldPlot( db, selType, bTaggerType, lumifb, "", "" );
  drawChannelYieldPlot( db, selType, bTaggerType, lumifb, "ptZll80", "ptZll > 80." );



  std::vector<TH1D*> lastHistosMC;
  float signalYield;
  float channelYieldGen = lumifb * 139 * 0.06 * 0.2 * 0.67;


  db->drawHisto_fromTree("tree_passedEvents", "ptZll", "eventWeight*(mZll>81. && mZll<101.)", 30, 0., 300., "ptZll", "p_{T} (Z)", "GeV");
  db->drawHisto_fromTree("tree_passedEvents", "ptZll", "eventWeight*(mZll>81. && mZll<101. && ptJetB1>20. && ptJetB2>20. && ptJet3>20. && ptJet4>20. )", 30, 0., 300., "ptZll_jetpt20", "p_{T} (Z)", "GeV", "Events");
  lastHistosMC = db->get_lastHistos_mc();
  for( unsigned int iHisto=0; iHisto<lastHistosMC.size(); ++iHisto ) {
    if( lastHistosMC[iHisto]->GetFillColor()==signalFillColor ) {
      signalYield = lastHistosMC[iHisto]->Integral(1, lastHistosMC[iHisto]->GetNbinsX()+1);
      break;
    }
  }
  std::cout << "Signal yield: " << signalYield << " (" << signalYield/channelYieldGen << "%)" << std::endl;
  char selection[1000];
  sprintf( selection, "eventWeight*(mZll>81. && mZll<101. && bTagJetB1>%f && ptJetB1>20. && ptJetB2>20. && ptJet3>20. && ptJet4>20.)", btag_thresh);
  db->drawHisto_fromTree("tree_passedEvents", "ptZll", selection, 30, 0., 300., "ptZll_jetpt20_btag", "p_{T} (Z)", "GeV", "Events");
  lastHistosMC = db->get_lastHistos_mc();
  for( unsigned int iHisto=0; iHisto<lastHistosMC.size(); ++iHisto ) {
    if( lastHistosMC[iHisto]->GetFillColor()==signalFillColor ) {
      signalYield = lastHistosMC[iHisto]->Integral(1, lastHistosMC[iHisto]->GetNbinsX()+1);
      break;
    }
  }
  std::cout << "Signal yield: " << signalYield << " (" << signalYield/channelYieldGen << "%)" << std::endl;
  sprintf(selection, "eventWeight*(mZll>81. && mZll<101. && pfMet>30. && bTagJetB1>%f && ptJetB1>20. && ptJetB2>20. && ptJet3>20. && ptJet4>20.)", btag_thresh);
  db->drawHisto_fromTree("tree_passedEvents", "ptZll", selection, 30, 0., 300., "ptZll_jetpt20_btag_met", "p_{T} (Z)", "GeV", "Events");
  lastHistosMC = db->get_lastHistos_mc();
  for( unsigned int iHisto=0; iHisto<lastHistosMC.size(); ++iHisto ) {
    if( lastHistosMC[iHisto]->GetFillColor()==signalFillColor ) {
      signalYield = lastHistosMC[iHisto]->Integral(1, lastHistosMC[iHisto]->GetNbinsX()+1);
      break;
    }
  }
  std::cout << "Signal yield: " << signalYield << " (" << signalYield/channelYieldGen << "%)" << std::endl;

  sprintf( selection, "eventWeight*(ptZll>100. && mZll>81. && mZll<101. && pfMet>30. && bTagJetB1>%f && ptJetB1>20. && ptJetB2>20. && ptJet3>20. && ptJet4>20.)", btag_thresh);
  db->drawHisto_fromTree("tree_passedEvents", "ptZll", selection, 30, 0., 300., "ptZll_jetpt20_btag_met_ptZll", "p_{T} (Z)", "GeV", "Events");
  lastHistosMC = db->get_lastHistos_mc();
  for( unsigned int iHisto=0; iHisto<lastHistosMC.size(); ++iHisto ) {
    if( lastHistosMC[iHisto]->GetFillColor()==signalFillColor ) {
      signalYield = lastHistosMC[iHisto]->Integral(1, lastHistosMC[iHisto]->GetNbinsX()+1);
      break;
    }
  }
  std::cout << "Signal yield: " << signalYield << " (" << signalYield/channelYieldGen << "%)" << std::endl;



  delete db;
  db = 0;
*/


  return 0;

}