int main( int argc, char* argv[] ) {

  
  runName = "test_10";
  if( argc>1 ) {
    std::string runName_str(argv[1]);
    runName = runName_str;
  }


  std::string fileName = "PosAn_" + runName + ".root";
  TFile* file = TFile::Open( fileName.c_str() );
  std::cout << "-> Opened file: " << fileName << std::endl;
  
  std::string outputdir = "Plots_" + runName;
  std::string mkdir_command = "mkdir -p " + outputdir;
  system(mkdir_command.c_str());


  TStyle* style = DrawTools::setStyle();
  style->cd();

  drawSinglePositionPlot( outputdir, file, runName, "" );
  drawSinglePositionPlot( outputdir, file, runName, "_singleEle" );

  //drawSinglePlot( outputdir, "cef3_spectrum"      , file, "cef3"     , "ADC Counts", 4, 0., 3500., 10, true );
  //drawSinglePlot( outputdir, "cef3_corr_spectrum" , file, "cef3_corr", "ADC Counts", 4, 0., 3500., 10, true );

  drawSinglePlot( outputdir, "cef3_spectrum_lin"      , file, "cef3"     , "ADC Counts", 4, 0., 3500., 10, false );
  drawSinglePlot( outputdir, "cef3_corr_spectrum_lin" , file, "cef3_corr", "ADC Counts", 4, 0., 3500., 10, false );


  return 0;

}
Esempio n. 2
0
int main( int argc, char* argv[] )  {


  if( argc != 2 ) {
    std::cout << "USAGE: ./drawRhoStudies [dataset]" << std::endl;
    exit(13);
  }


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

  std::string fileName = "RhoStudies_"+dataset+".root";
  TFile* file = TFile::Open(fileName.c_str());

  DrawBase* db = new DrawBase("RhoStudies");
  std::string outputdirName = "RhoStudiesPlots_"+dataset;
  db->set_outputdir(outputdirName);

//drawSinglePlot( db, file, "hcalIsoPID", "HCAL Isolation", "Calo", "EB");
//drawSinglePlot( db, file, "ecalIsoPID", "ECAL Isolation", "Calo", "EB");

  char ofsName[400];
  sprintf( ofsName, "parameters_%s.txt", dataset.c_str());
  ofstream ofs(ofsName);

  ofs <<  "if(TMath::Abs(etaPhot[i]) < 1.44) {" << std::endl;

  std::vector<float> parameters;
  parameters = drawSinglePlot( db, file, "twrHcalIso", "HCAL Isolation", "GeV", "PF", "EB");
  ofs << "  hcaliso = (pid_twrHCAL[i] < ptPhot[i] * pid.hcaliso_rel + " << parameters[0] << " + " << parameters[1] << "*rhoPF - 2.0 + pid.hcaliso_abs );" << std::endl;
  parameters = drawSinglePlot( db, file, "HoverE", "H/E", "", "PF", "EB");
  ofs << "  hovereiso = (pid_HoverE[i] < " << parameters[0] << " + " << parameters[1] << "*rhoPF - 0.02 + pid.hovereiso );" << std::endl;
  parameters = drawSinglePlot( db, file, "jurEcalIso", "ECAL Isolation", "GeV", "PF", "EB");
  ofs << "  ecaliso = (pid_jurECAL[i] < ptPhot[i] * pid.ecaliso_rel + " << parameters[0] << " + " << parameters[1] << "*rhoPF - 2.0 + pid.ecaliso_abs );" << std::endl;
  parameters = drawSinglePlot( db, file, "jurEcalIso", "ECAL Isolation", "GeV", "PF", "EB1");
  parameters = drawSinglePlot( db, file, "jurEcalIso", "ECAL Isolation", "GeV", "PF", "EB2");
  parameters = drawSinglePlot( db, file, "hlwTrackIso", "Track Isolation", "GeV", "PF", "EB");
  ofs << "  ptiso = (pid_hlwTrackNoDz[i] < ptPhot[i] * pid.trackiso_rel + " << parameters[0] << " + " << parameters[1] << "*rhoPF - 1.5 + pid.trackiso_abs);" << std::endl;
  parameters = drawSinglePlot( db, file, "etawid", "#sigma i#eta i#eta", "", "PF", "EB");

  ofs << " }else{" << std::endl;
  parameters = drawSinglePlot( db, file, "twrHcalIso", "HCAL Isolation", "GeV", "PF", "EE");
  ofs << "  hcaliso = (pid_twrHCAL[i] < ptPhot[i] * pid.hcaliso_rel + " << parameters[0] << " + " << parameters[1] << "*rhoPF - 2.0 + pid.hcaliso_abs );" << std::endl;
  parameters = drawSinglePlot( db, file, "HoverE", "H/E", "", "PF", "EE");
  ofs << "  hovereiso = (pid_HoverE[i] < " << parameters[0] << " + " << parameters[1] << "*rhoPF - 0.02 + pid.hovereiso );" << std::endl;
  parameters = drawSinglePlot( db, file, "jurEcalIso", "ECAL Isolation", "GeV", "PF", "EE");
  ofs << "  ecaliso = (pid_jurECAL[i] < ptPhot[i] * pid.ecaliso_rel + " << parameters[0] << " + " << parameters[1] << "*rhoPF - 2.0 + pid.ecaliso_abs );" << std::endl;
  parameters = drawSinglePlot( db, file, "hlwTrackIso", "Track Isolation", "GeV", "PF", "EE");
  ofs << "  ptiso = (pid_hlwTrackNoDz[i] < ptPhot[i] * pid.trackiso_rel + " << parameters[0] << " + " << parameters[1] << "*rhoPF - 1.5 + pid.trackiso_abs);" << std::endl;
  parameters = drawSinglePlot( db, file, "etawid", "#sigma i#eta i#eta", "", "PF", "EE");

  ofs << "}" << std::endl;
  ofs.close();

  drawSinglePlot_Mean( db, file, "twrHcalIso", "HCAL Isolation", "GeV", "PF", "EB");
//  drawSinglePlot_Mean( db, file, "HoverE", "H/E", "", "PF", "EB");
  drawSinglePlot_Mean( db, file, "jurEcalIso", "ECAL Isolation", "GeV", "PF", "EB");
  drawSinglePlot_Mean( db, file, "hlwTrackIso", "Track Isolation", "GeV", "PF", "EB");

  drawSinglePlot_Mean( db, file, "twrHcalIso", "HCAL Isolation", "GeV", "PF", "EE");
//  drawSinglePlot_Mean( db, file, "HoverE", "H/E", "", "PF", "EE");
  drawSinglePlot_Mean( db, file, "jurEcalIso", "ECAL Isolation", "GeV", "PF", "EE");
  drawSinglePlot_Mean( db, file, "hlwTrackIso", "Track Isolation", "GeV", "PF", "EE");

  drawCompare( db, file, "twrHcalIso", "HCAL Isolation", "PF", "EB");
  drawCompare( db, file, "jurEcalIso", "ECAL Isolation", "PF", "EB");
  drawCompare( db, file, "hlwTrackIso", "Track Isolation", "PF", "EB");
  drawCompare( db, file, "HoverE", "H/E", "PF", "EB");

  drawCompare( db, file, "twrHcalIso", "HCAL Isolation", "PF", "EE");
  drawCompare( db, file, "jurEcalIso", "ECAL Isolation", "PF", "EE");
  drawCompare( db, file, "hlwTrackIso", "Track Isolation", "PF", "EE");
  drawCompare( db, file, "HoverE", "H/E", "PF", "EE");

  drawCompare_fullSelection( db, file, "PF", "EB" );
  drawCompare_fullSelection( db, file, "PF", "EE" );

  drawCompare_fullSelection( db, file, "PF", "EB", (bool)true );
  drawCompare_fullSelection( db, file, "PF", "EE", (bool)true );

  return 0;

}