Ejemplo n.º 1
0
void runJVF(){

  cout<<"RUN rmJVFPlots.sh FIRST!"<<endl;

  cout<<endl;
  cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  cout<<"In runJVF.C"<<endl;
  cout<<"Running over "<<nSkims<<" skims"<<endl;
  cout<<endl;

  TChain *jvfSkimChain;
  TChain *nojvfSkimChain;
  string file_jvf;
  string file_nojvf;
  for(int s=0;s<nSkims;s++){

    jvfSkimChain=new TChain("analysisTree");

    nojvfSkimChain=new TChain("analysisTree");
    
    string cur_jvf_skim = "../files/skims_jvf/"+skim_list[s];
    cur_jvf_skim+=".skim.root";
    cout<<"jvfSkimChain->Add("<<cur_jvf_skim.c_str()<<")"<<endl;;
    jvfSkimChain->Add(cur_jvf_skim.c_str());
    
    //tmp
    string cur_nojvf_skim = "../files/skims_nojvf/"+skim_list[s];
    //string cur_nojvf_skim = "../files/skims_jvf/"+skim_list[s];
    cur_nojvf_skim+=".skim.root";
    cout<<"nojvfSkimChain->Add("<<cur_nojvf_skim.c_str()<<")"<<endl;;
    nojvfSkimChain->Add(cur_nojvf_skim.c_str());

    //with jvf cut
    file_jvf=skim_list[s]+",jvf";
    jvfSkimChain->Process("../src/jvf.C+",file_jvf.c_str());

    //without jvf cut
    file_nojvf=skim_list[s]+",nojvf";
    nojvfSkimChain->Process("../src/jvf.C+",file_nojvf.c_str());
    
	
    
  }
  
  delete jvfSkimChain;
  delete nojvfSkimChain;
  cout<<"Histogram files written to ../plots"<<endl;
  cout<<"Don't forget to merge histograms!"<<endl;
  cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  gROOT->ProcessLine(".q");
  return;
}
Ejemplo n.º 2
0
// You declared this function in the extern "C" block of the header.
// R will call this function to drive the processing of the Tree/Chain.
// Except for the name of your class (in this case met), your 
// function should look identical to the below... 
SEXP metToR(SEXP manager, SEXP nEntriesR, SEXP firstEntryR,
	    SEXP initialSizeR, SEXP growthFactorR, SEXP argsR)
{

  try {
    // Pull out the arguments
    Long64_t nEntries = INTEGER(nEntriesR)[0];
    Long64_t firstEntry = INTEGER(firstEntryR)[0];
    int initialSize = INTEGER(initialSizeR)[0];
    double growthFactor = REAL(growthFactorR)[0];

    // Get the Root chain manager
    checkForRootChainManagerPtr(manager);
    RootChainManager* rcm = (RootChainManager*) R_ExternalPtrAddr(manager);
    
    bool verbose = rcm->getVerbose();
    
    // Get the chain we wish to deal with
    TChain* tree = rcm->tree();
    
    // Create the TSelector (replace Met with your class name)
    Met stor(initialSize, growthFactor, verbose, tree->GetTreeOffset() );
                             
    // Process it!
    tree->Process(&stor, "", nEntries, firstEntry);
      
    // Return the data frame
    return stor.rDataFrame();
  }

  catch ( RDataFrameException e ) {
    error(e.what().c_str());
    return 0;
  }
}
Ejemplo n.º 3
0
void run(int nEvents = 100000) {

    TChain* fChain = new TChain("T");

    ifstream sourceFiles("input.txt");
    char line[128];
    int  count = 0;

    while (sourceFiles >> line) {
        fChain->Add(line);      
        ++count;
    }

    cout << count << " files added!" << endl;
    sourceFiles.close();

    TStopwatch timer;
    timer.Start();

    fChain->Process("adcAnalyzer.C+", "", 8*nEvents, 0);

    timer.Stop();

    cout << "\n\nDone!" << endl;
    cout << "CPU Time : " << timer.CpuTime() << " s (total), " << timer.CpuTime()/nEvents << " s (per event)" << endl;
    cout << "RealTime : " << timer.RealTime() << " s (total), " << timer.RealTime()/nEvents << " s (per event)" << endl;
    cout << "\n";
}
//#include "EffMaker.h"
void MakeExpectation()
{
	bool useTProof = false;

 	TChain *Effchain = new TChain("TreeMaker2/PreSelection");
	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning_JECv4/TTJets_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/*.root");

//	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning/WJetsToLNu_HT-200To400_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/*.root");
//	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning/WJetsToLNu_HT-400To600_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/*.root");
//	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning/WJetsToLNu_HT-600ToInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8/*.root");

////	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_3fb/TBarToLeptons_s-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
////	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_3fb/TToLeptons_s-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
//	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning/ST_t-channel_antitop_4f_leptonDecays_13TeV-powheg-pythia8_TuneCUETP8M1/*.root");
//	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning/ST_t-channel_top_4f_leptonDecays_13TeV-powheg-pythia8_TuneCUETP8M1/*.root");
//	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning/ST_tW_antitop_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1/*.root");
//	Effchain->Add("/nfs/dust/cms/user/kurzsimo/LostLepton/mc_spring15_4fb_commissioning/ST_tW_top_5f_inclusiveDecays_13TeV-powheg-pythia8_TuneCUETP8M1/*.root");				
	
	TProof *proof = NULL;

    if(useTProof){
    	proof = TProof::Open("workers=10");
    	Effchain->SetProof();     	
    }

	Effchain->Process("./../ExpecMaker.C++g");

    delete proof;
}
Ejemplo n.º 5
0
//#include "EffMaker.h"
void MakeTagAndProbe()
{
//  	  	TProof *proof = TProof::Open("workers=10");
	// 	TString connect = gSystem.GetFromPipe("pod-info -c");
	// 	TProof *proof = TProof::Open(connect);
	// 	TProof *proof = TProof::Open("workers=20");
	TChain *Effchain = new TChain("TreeMaker2/PreSelection");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/DYJetsToLL_M-50_HT-100to200/*root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/DYJetsToLL_M-50_HT-200to400/*root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/DYJetsToLL_M-50_HT-400to600/*root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/DYJetsToLL_M-50_HT-600toInf/*root");

	// //    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1bbbb_2J_mGl-1000_mLSP-900/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1bbbb_2J_mGl-1500_mLSP-100/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1qqqq_2J_mGl-1000_mLSP-800/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1qqqq_2J_mGl-1400_mLSP-100/*root");
	//    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1tttt_2J_mGl-1200_mLSP-800/*root");
	//    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1tttt_2J_mGl-1500_mLSP-100/*root");
	
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_1000ToInf_13TeV-madgraph_v1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_1000ToInf_13TeV-madgraph_v1_ext1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_250To500_13TeV-madgraph_v1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_250To500_13TeV-madgraph_v1_ext1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT-500To1000_13TeV-madgraph_v1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT-500To1000_13TeV-madgraph_v1_ext1/*root");
	
//  	         	Effchain->SetProof();
//  	Effchain->Process("/afs/desy.de/user/a/adraeger/2015/TagAndProbe.C++g",0,800000);
 	Effchain->Process("/afs/desy.de/user/a/adraeger/2015/TagAndProbe.C++g");
//  	         	Effchain->SetProof(0);
//  	        	delete proof;
}
Ejemplo n.º 6
0
void runMetResolution(){


  cout<<endl;
  cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  cout<<"In runMetResolution.C"<<endl;
  cout<<"Running over "<<nSkims<<" skims"<<endl;
  cout<<endl;

  TChain *skimChain;
  string run_option;
  for(int s=0;s<nSkims;s++){

    skimChain=new TChain("analysisTree");
    string cur_skim = "../files/skims/"+skim_list[s];
    cur_skim+=".skim.root";

    
    skimChain->Add(cur_skim.c_str());

    run_option=skim_list[s];

    
    skimChain->Process("../src/metResolution.C+",run_option.c_str());
        
  }
  

  cout<<"Histogram files written to ../plots/met_resolution_plots"<<endl;
  cout<<"Don't forget to merge histograms!"<<endl;
  cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  gROOT->ProcessLine(".q");
  return;
}
Ejemplo n.º 7
0
Archivo: run.C Proyecto: naodell/FCNH
void run(Long64_t nEntries = 1e4, string args = "TEST muon 2012") 
{

    string libMake = gSystem->GetMakeSharedLib();
    const string delWarn("-Wshadow");
    int pos1 = libMake.find(delWarn);
    libMake= libMake.substr(0, pos1) + libMake.substr(pos1+delWarn.size()+1); 
    gSystem->SetMakeSharedLib(libMake.c_str());

    //container classes
    gROOT->LoadMacro("../src/TCPhysObject.cc+");
    gROOT->LoadMacro("../src/TCTrack.cc+");
    gROOT->LoadMacro("../src/TCEGamma.cc+");
    gROOT->LoadMacro("../src/TCJet.cc+");
    gROOT->LoadMacro("../src/TCMET.cc+");
    gROOT->LoadMacro("../src/TCElectron.cc+");
    gROOT->LoadMacro("../src/TCMuon.cc+");
    gROOT->LoadMacro("../src/TCTau.cc+");
    gROOT->LoadMacro("../src/TCPhoton.cc+");
    gROOT->LoadMacro("../src/TCGenJet.cc+");
    gROOT->LoadMacro("../src/TCGenParticle.cc+");
    gROOT->LoadMacro("../src/TCPrimaryVtx.cc+");
    gROOT->LoadMacro("../src/TCTriggerObject.cc+");

    //analysis plugins (selectors, utiltities, etc.)
    gROOT->LoadMacro("../plugins/HistManager.cc+");
    gROOT->LoadMacro("../plugins/EGammaMvaEleEstimator.cc+");
    gROOT->LoadMacro("../plugins/rochcor2012jan22.C+");
    gROOT->LoadMacro("../plugins/WeightUtils.cc+");
    gROOT->LoadMacro("../plugins/TriggerSelector.cc+");
    gROOT->LoadMacro("../plugins/Selector.cc+");

    TChain* fChain = new TChain("ntupleProducer/eventTree");

    ifstream sourceFiles("input.txt");
    char line[2048];
    int  count = 0;

    while (sourceFiles >> line) {
        fChain->Add(line);      
        ++count;
    }
    cout << count << " files added!"<<endl;
    sourceFiles.close();

    TStopwatch timer;
    timer.Start();

    fChain->Process("fcncAnalyzer.C+", args.c_str(), nEntries, 0);

    cout << "\n\nDone!" << endl;
    cout << "CPU Time : " << timer.CpuTime() << endl;
    cout << "RealTime : " << timer.RealTime() << endl;
    cout << "\n";
}
Ejemplo n.º 8
0
void RunAnalysisAJ(const TString sList="med_JetR05_SjeR01", const TString sPtHard, const TString sPath="data/dataLists/inclAJ")
{
//TChain *chain = CreateChain(Form("%s/%s.txt",sPath.Data(),sList.Data())); if (!chain) return;
//chain->Process("AnalysisTaskUserAJ.C+", Form("%s:DAJ",sList.Data()));
//=============================================================================

  TChain *chain = new TChain("nt"); chain->Add(Form("data/inclAJ/med_JetR05_SjeR01/out_%s.root",sPtHard.Data()));
  chain->Process("AnalysisTaskUserAJ.C+", Form("%s:DAJ",sList.Data()));
//=============================================================================

  return;
}
void doWJets()
{
  // Test run of chainPlot
  cout << "starting" << endl;
  TChain *c = new TChain("physics");
  c->Add("/phys/groups/tev/scratch4/users/gwatts/GRIDDS/mc12_8TeV.117680.AlpgenPythia_P2011C_WenuNp0.merge.NTUP_COMMON.e1477_s1499_s1504_r3658_r3549_p1575/mc12_8TeV.117680.AlpgenPythia_P2011C_WenuNp0.merge.NTUP_COMMON.e1477_s1499_s1504_r3658/*.root.1");
  c->Add("/phys/groups/tev/scratch4/users/gwatts/GRIDDS/mc12_8TeV.117681.AlpgenPythia_P2011C_WenuNp1.merge.NTUP_COMMON.e1477_s1499_s1504_r3658_r3549_p1575/mc12_8TeV/*.root.1");
  c->Add("/phys/groups/tev/scratch4/users/gwatts/GRIDDS/mc12_8TeV.117682.AlpgenPythia_P2011C_WenuNp2.merge.NTUP_COMMON.e1477_s1499_s1504_r3658_r3549_p1575/mc12_8TeV/*.root.1");
  gSystem->CompileMacro("/phys/groups/tev/scratch3/users/will896/WHProduction/Search-for-Hidden-Valley/WJetsPlot.C");
  WJetsPlot *processor = new WJetsPlot();
  cout << "running..." << endl;
  c->Process(processor);
}
Ejemplo n.º 10
0
void runLocal(TString dataset, TString treename = "", Long64_t nentries=TChain::kBigNumber,  Long64_t firstentry = 0)
{
	ProofAna* ana = new ProofAna();

	//Need to provide a TList for local running
	TList* list = new TList();
	ana->SetInputList(list);

	// Load dataset manager stuff, uses same local datasets as PROOF-Lite by design
	TString defaultdir(gSystem->HomeDirectory());
	defaultdir.Append("/.proof");
	TString dsetdir(gEnv->GetValue("ProofLite.Sandbox",defaultdir.Data()));
	dsetdir.Append("/datasets");
	dsetdir.Prepend("dir:");
	TDataSetManagerFile mgr(dsetdir);

	TString dsetfile(dataset);
	dsetfile.Append(".txt");
	dsetfile.Prepend("../filelists/");

	//Register dataset, if non-existent
	if(!mgr.ExistsDataSet(dataset)) {
		TFileCollection* dset = new TFileCollection(dataset,"",dsetfile);
		mgr.RegisterDataSet(dataset,dset,"V"); //This seems to return true regardless of success or failure at the moment
		if(treename.CompareTo("")!=0) {
			cout << "Setting default tree to " << treename << " (local and lite running)" << endl;
			TProof* lite = TProof::Open("lite://");
			if(lite->SetDataSetTreeName(dataset,treename)) {
				cout << "Failure to set default tree to " << treename << endl;
				return;
			}
			delete lite;
		}
	}
	mgr.ShowDataSets();

	// And yes, all this dataset garbage was to get the default tree name
	TFileCollection* dset = mgr.GetDataSet(dataset);
	TString defaultTree = dset->GetDefaultTreeName();

	// Make TChain from TFileCollection...doesn't seem like there is a more direct way
	if(defaultTree.First("/")==0) defaultTree.Remove(0,1);
	TChain* T = new TChain(defaultTree);
	TList* filelist = (TList*)dset->GetList();
	TIter next(filelist);
	TFileInfo* fileinfo = 0;
	while ((fileinfo = (TFileInfo*)next())) T->AddFile(fileinfo->GetCurrentUrl()->GetUrl());

	// Process TChain
	T->Process(ana,"", nentries, firstentry);
}
Ejemplo n.º 11
0
void runDSelector() 
{
    // $(ROOT_ANALYSIS_HOME)/scripts/Load_DSelector.C
    gSystem->AddIncludePath("-I${HALLD_HOME}/${BMS_OSNAME}/include/");
    gSystem->AddIncludePath("-I${ROOT_ANALYSIS_HOME}/${BMS_OSNAME}/include/");
    gSystem->Load("$(ROOT_ANALYSIS_HOME)/$(BMS_OSNAME)/lib/libDSelector.so");

    // load the tree
    TChain *chain = new TChain("pippim_Tree");
    chain->Add("tree_pippim.root");
    // and run it
    chain->Process("DSelector_piDelta.C+", "");

}
Ejemplo n.º 12
0
void tcalibration(TString inFile= "../../data/cj.hld.root", TString outFile= "outFileC.root", TString cFile= "calib.root", TString tFile= "calibOffsets.root", Int_t trigger=2560,  Int_t sEvent =0, Int_t eEvent=0, Int_t build = 0){ //1920
  if(build==1) return;
  ginFile = inFile;
  goutFile = outFile;
  gcFile = cFile; // fine time calibration
  gtFile = tFile; // pilas offsets + walk corrections
  gTrigger = trigger;
  if(gtFile=="") gMode = 0;
  else  gMode = 1;

  TChain* ch = new TChain("T");
  ch->Add(ginFile);
  
  Int_t entries = ch->GetEntries();
  TTSelector *selector = new TTSelector();
  TString option = Form("%d %d",gTrigger,gMode);
  
  if(eEvent==0){
    std::cout<<"Entries in chain:  "<< entries<<std::endl;
    ch->Process(selector,option,entries);
  }else{
    ch->Process(selector,option,eEvent-sEvent,sEvent); 
  }
}
Ejemplo n.º 13
0
/*
 * Instructions:
 * first time use: make sure that you linked the ~/.proof folder to sonas (or some large storage) sinze the temp files might be very large!
 * check also  https://twiki.cern.ch/twiki/bin/viewauth/CMS/HamburgWikiComputingNAFPOD for more information
 * log in to naf
 * load module use -a /afs/desy.de/group/cms/modulefiles/
 * export SCRAM_ARCH=slc6_amd64_gcc491
 * load moduels:
 * module load root
 * module load pod
 * start the POD server: 
 * pod-server start
 * pod-submit -n 80 -r ge
 * wait, check how many servers are running with:
 * pod-info -n
 * when enough have started
 * change to cmsenv root (needed for the proof to funciton with this trees)
 * cmsenv (in enviroment)
 * run root
 * root -l MakePrediction.C
*/
void MakeExpectation()
{
//  	TString connect = gSystem->GetFromPipe("pod-info -c");
// 	TProof *proof = TProof::Open("[email protected]:21001");
//      	TProof *proof = TProof::Open("workers=10");
// // 	TProof *proof = TProof::Open("");
   // 	TProof *proof = TProof::Open("");
    	TString connect = gSystem->GetFromPipe("pod-info -c");
    	TProof *proof = TProof::Open(connect);
	// analyse the trees
// 	TChain *Effchain = new TChain("TreeMaker2/PreSelection");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-200to400/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-400to600/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-600toInf/*root");
// 	TString connect = gSystem.GetFromPipe("pod-info -c");
// 	TProof *proof = TProof::Open(connect);
	TChain *Effchain = new TChain("RA2TreeMaker/PreSelection");
// 	Effchain->Add("/nfs/dust/cms/user/sonnevej/QCD_13TeV_RandS_withreb_finebins_bestMatching_angles_withNeutrinos_everywhere_DeadECALTP_recoPTbins_newsoftware/*.root");
	Effchain->Add("/nfs/dust/cms/user/sonnevej/QCD_13TeV_RandS_withreb_finebins_bestMatching_angles_withNeutrinos_everywhere_DeadECALTP_recoPTbins_newsoftware/*.root");
// 	Effchain->Add("/afs/desy.de/user/a/adraeger/xxl/CMSSW_7_4_15/src/AllHadronicSUSY/QCDBkgRS/test/QCDSmearingClosure_OnMC.root");
// 	Effchain->Add("/nfs/dust/cms/user/sonnevej/QCD_13TeV_GenSmear_finebins_bestMatching_angles_withNeutrinos_everywhere_DeadECALTP_HBHEnoise_newTreeMaker/*.root");
// 	Effchain->Add("/nfs/dust/cms/user/sonnevej/QCD_13TeV_RandS_withreb_finebins_bestMatching_angles_withNeutrinos_everywhere_DeadECALTP_recoPTbins_newsoftware/*300to500*.root");
	

	//    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1bbbb_2J_mGl-1000_mLSP-900/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1bbbb_2J_mGl-1500_mLSP-100/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1qqqq_2J_mGl-1000_mLSP-800/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1qqqq_2J_mGl-1400_mLSP-100/*root");
	//    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1tttt_2J_mGl-1200_mLSP-800/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1tttt_2J_mGl-1500_mLSP-100/*root");
//  	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_1000ToInf_13TeV-madgraph_v1/*root");
//  	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_1000ToInf_13TeV-madgraph_v1_ext1/*root");
//  	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_250To500_13TeV-madgraph_v1/*root");
//  	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_250To500_13TeV-madgraph_v1_ext1/*root");
//  	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT-500To1000_13TeV-madgraph_v1/*root");
//  	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT-500To1000_13TeV-madgraph_v1_ext1/*root");
       	Effchain->SetProof();
	//	Effchain->Process("EffMaker.C+g",0,800000);
	Effchain->Process("Expectation.C++g");
//Effchain->Process("Prediction.C++g",0,1000);
//       	Effchain->SetProof(0);
       	delete proof;
				
				
				// plotting
				std::cout<<"Expectation done.\n";
}
void runTheTree(TString theName){
/*TFile *c = TFile::Open("ElecIDtree_9_1_mz8.root");

TTree *theTree = (TTree*) c->Get("eventsTree");*/

//theTree->Print();
    
    TChain *theTree = new TChain("eventsTree");

theTree->Add("/tmp/hbrun/"+theName+"/fichier_*.root");

    cout << "full nb of events " << theTree->GetEntries() << endl;

theTree->Process("createMuonTree.C+");
//
//
}
Ejemplo n.º 15
0
void runMET()
{
    gROOT->Reset();
    gSystem->Load("libPhysics.so");

    //TProof::Open("[email protected]:21002");
    //TProof::Open("lite://");

    TChain *c = new TChain("hcalTupleTree/tree","");
    //AddToChain(c, "inputMET.txt");
    AddToChain(c, "inputSingleMuon.txt");
    //AddToChain(c, "inputHPD.txt");
    //AddToChain(c, "inputNoBPTX_2015C.txt");
    //AddToChain(c, "inputTestSingleMuon.txt");
    //AddToChain(c, "inputTestNoBPTX_2015C.txt");
    //c->SetProof();
    c->Process("MET.C+g");
    //
}
void MakePrediction(TString infname)
{
  bool useTProof = false;
  TProof *proof = NULL;

  gSystem->Load("libPhysics.so");
  gInterpreter->GenerateDictionary("vector<TLorentzVector>","TLorentzVector.h;vector");
  
  TChain *Effchain = new TChain("TreeMaker2/PreSelection");
  Effchain->Add(infname);

  if(useTProof){
    proof = TProof::Open("workers=2");
    Effchain->SetProof();     	
  }

  Effchain->Process("Prediction.C++g");

  delete proof;
}
void run_root_TSelector_SusySel(TString InputPath) {


    
      cout<<"Have you set up RootCore via  \"source RootCore/scripts/setup.sh\" ?"<<endl;  

      gSystem->Setenv("ROOTCOREDIR", "/data/etp3/jwittkow/analysis_SUSYTools_03_04/RootCore");
      gSystem->SetIncludePath("-I$ROOTCOREDIR/include/");
//       gROOT->ProcessLine("#include <vector>");
      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+"); 

      TString selectorName = "SusySel"; // !!! enter the name of your Selector (without _C.so)

      TChain *ch;
      ch = new TChain("SusySel");


      TString processLine = ".L " + selectorName + ".C++g";
      TString execLine;

      gROOT->ProcessLine(processLine); // need to add this, or PoD at LRZ will not be able to load the .so
      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+");
      ch->Add(InputPath);

//       ch->Add("/data/etp3/jwittkow/analysis_SUSYTools_03_04/WZ_SusySel.root");



      Long64_t nEntries = ch->GetEntries();
      ch->ls();

      cout << "all entries: " << nEntries << endl;
      
      ch->Process("SusySel.C+g");
      
      if (ch) {delete ch; ch=0;}

  abort();
  }
Ejemplo n.º 18
0
void execGetSelector(string infilename = "Event1.root", int nevents = 10)
{
  infilename.append("/T1");
  
  TSelector *sel = TSelector::GetSelector("emptysel.C+O");
  //delete sel;
  //dummy * mydummy = (dummy*)TSelector::GetSelector("dummy.C+");;
  emptysel * mydummy = (emptysel*)sel;

  cout << "In Macro after GetSelector" << endl;
  mydummy->m_testvar = 10; 
  mydummy->printAddress();
  cout << "Testvar before Process: " << mydummy->m_testvar << endl << endl;
 
  //myAnalysis->setGoodRunList("goodruns.xml");
  
  TChain f;
  f.Add(infilename.c_str());
  gErrorIgnoreLevel = kError;
  f.Process(mydummy,"",nevents,2);
  
}
Ejemplo n.º 19
0
//#include "EffMaker.h"
void MakeSync()
{
	// Use this sample for sync: /SMS-T1tttt_2J_mGl-1500_mLSP-100_Tune4C_13TeV-madgraph-tauola/Phys14DR-PU20bx25_tsg_PHYS14_25_V1-v1/MINIAODSIM
  // 	TProof *proof = TProof::Open("workers=10");
  TChain *Effchain = new TChain("TreeMaker2/PreSelection");
//   Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/*.root");
//   Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-200to400/*root");
//   Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-400to600/*root");
//   Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-600toInf/*root");
  
  // 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/oldLeptonDefinitionAndNotMergedCode/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/*.root");
  // 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/oldLeptonDefinitionAndNotMergedCode/WJetsToLNu_HT-200to400/*root");
  // 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/oldLeptonDefinitionAndNotMergedCode/WJetsToLNu_HT-400to600/*root");
  // 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/oldLeptonDefinitionAndNotMergedCode/WJetsToLNu_HT-600toInf/*root");
  
  // 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1bbbb_2J_mGl-1000_mLSP-900/*root");
    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1tttt_2J_mGl-1500_mLSP-100/*root");
  // 	Effchain->SetProof();
  //	Effchain->Process("ExpecMaker.C+",0,80000);
  Effchain->Process("SyncMaker.C++g");
  // 	Effchain->SetProof(0);
  // 	delete proof;
}
    void run_PPToGammaGammaFiles() {

    gROOT->LoadMacro("FlatTreeMaker_Delphes_PPToGammaGammaFiles_C.so");
  
    TChain* fChain = new TChain("Delphes");
    ifstream sourceFiles("PPToGammaGammaFiles.txt");
    char line[128];
    int  count = 0;
    cout<< "Adding files from PPToGammaGammaFiles to chain..."<< endl;
     while (sourceFiles >> line) {
        fChain->Add(line);
        ++count;
     }
    cout << count<<" files added!"<<endl;
    sourceFiles.close();
    TStopwatch timer;
    timer.Start();    
    fChain->Process("FlatTreeMaker_Delphes");

    cout << "\n\nDone!" << endl;
    cout << "CPU Time : " << timer.CpuTime() <<endl;
    cout << "RealTime : " << timer.RealTime() <<endl;                             
    cout <<"\n";
}
Ejemplo n.º 21
0
//#include "EffMaker.h"
void MakeMTW_Studies()
{
	//  	TProof *proof = TProof::Open("workers=10");
	// 	TString connect = gSystem.GetFromPipe("pod-info -c");
	// 	TProof *proof = TProof::Open(connect);
	// 	TProof *proof = TProof::Open("workers=20");
	TChain *Effchain = new TChain("TreeMaker2/PreSelection");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/TTJets_MSDecaysCKM_central_Tune4C_13TeV-madgraph-tauola/*.root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-200to400/*root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-400to600/*root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/WJetsToLNu_HT-600toInf/*root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/TBarToLeptons_s-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/TBarToLeptons_t-channel_Tune4C_CSA14_13TeV-aMCatNLO-tauola/*.root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/TToLeptons_s-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/TToLeptons_t-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
	
	// //    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1bbbb_2J_mGl-1000_mLSP-900/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1bbbb_2J_mGl-1500_mLSP-100/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1qqqq_2J_mGl-1000_mLSP-800/*root");
	//   	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1qqqq_2J_mGl-1400_mLSP-100/*root");
	//    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1tttt_2J_mGl-1200_mLSP-800/*root");
	//    	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/SMS-T1tttt_2J_mGl-1500_mLSP-100/*root");
	
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_1000ToInf_13TeV-madgraph_v1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_1000ToInf_13TeV-madgraph_v1_ext1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_250To500_13TeV-madgraph_v1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT_250To500_13TeV-madgraph_v1_ext1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT-500To1000_13TeV-madgraph_v1/*root");
	// 	Effchain->Add("/nfs/dust/cms/user/adraeger/phys14/mc/QCD_HT-500To1000_13TeV-madgraph_v1_ext1/*root");
	
	//         	Effchain->SetProof();
	//	Effchain->Process("ExpecMaker.C+",0,80000);
	Effchain->Process("/afs/desy.de/user/a/adraeger/2015/MTW_studies.C++g");
	//         	Effchain->SetProof(0);
	//        	delete proof;
}
Ejemplo n.º 22
0
//#include "EffMaker.h"
void MakeExpectation()
{
//  	TProof *proof = TProof::Open("workers=10");
// 	TString connect = gSystem.GetFromPipe("pod-info -c");
// 	TProof *proof = TProof::Open(connect);
// 	TProof *proof = TProof::Open("workers=20");
 	TChain *Effchain = new TChain("TreeMaker2/PreSelection");
      	Effchain->Add("../reduced_trees/13TeV/ttbar_arne/*.root");
       	// Effchain->Add("TreeMaker/mc_light/WJetsToLNu_HT-200to400/*root");
    	//   Effchain->Add("TreeMaker/mc_light/WJetsToLNu_HT-400to600/*root");
     	// Effchain->Add("TreeMaker/mc_light/WJetsToLNu_HT-600toInf/*root");
	// 		Effchain->Add("TreeMaker/mc_light/TBarToLeptons_s-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
	// 		Effchain->Add("TreeMaker/mc_light/TBarToLeptons_t-channel_Tune4C_CSA14_13TeV-aMCatNLO-tauola/*.root");
	// 		Effchain->Add("TreeMaker/mc_light/TToLeptons_s-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
	// 		Effchain->Add("TreeMaker/mc_light/TToLeptons_t-channel-CSA14_Tune4C_13TeV-aMCatNLO-tauola/*.root");
			
// //    	Effchain->Add("TreeMaker/mc_light/SMS-T1bbbb_2J_mGl-1000_mLSP-900/*root");
//   	Effchain->Add("TreeMaker/mc_light/SMS-T1bbbb_2J_mGl-1500_mLSP-100/*root");
//   	Effchain->Add("TreeMaker/mc_light/SMS-T1qqqq_2J_mGl-1000_mLSP-800/*root");
//   	Effchain->Add("TreeMaker/mc_light/SMS-T1qqqq_2J_mGl-1400_mLSP-100/*root");
//    	Effchain->Add("TreeMaker/mc_light/SMS-T1tttt_2J_mGl-1200_mLSP-800/*root");
//    	Effchain->Add("TreeMaker/mc_light/SMS-T1tttt_2J_mGl-1500_mLSP-100/*root");
	
// 	Effchain->Add("TreeMaker/mc_light/QCD_HT_1000ToInf_13TeV-madgraph_v1/*root");
// 	Effchain->Add("TreeMaker/mc_light/QCD_HT_1000ToInf_13TeV-madgraph_v1_ext1/*root");
// 	Effchain->Add("TreeMaker/mc_light/QCD_HT_250To500_13TeV-madgraph_v1/*root");
// 	Effchain->Add("TreeMaker/mc_light/QCD_HT_250To500_13TeV-madgraph_v1_ext1/*root");
// 	Effchain->Add("TreeMaker/mc_light/QCD_HT-500To1000_13TeV-madgraph_v1/*root");
// 	Effchain->Add("TreeMaker/mc_light/QCD_HT-500To1000_13TeV-madgraph_v1_ext1/*root");
	
//         	Effchain->SetProof();
	//	Effchain->Process("ExpecMaker.C+",0,80000);
		Effchain->Process("ExpecMaker.C++g",0,990000000);
//         	Effchain->SetProof(0);
//        	delete proof;
}
void run_TSelector_SusyNtuple_Truth_n0150_WH(TString SysUncertType, TString InputPath) {

//  TString options = TString(""); //TString(tag.c_str()) ;
// //     TString outputfile = "test.root";
//     string richtigerString = InputPath;
// //     int Position = richtigerString.find("mc12_8TeV.");
// //     outputfile = "histos_ZTauTau_" +  richtigerString.substr(Position+10,6)  + "_proof.root";
//     
//     int Position = -1;
//     Position = richtigerString.find("45_bg");
//     if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+6,2)  + ".root";
//     }
//     else{
//       Position = richtigerString.find("45_signal");
//       if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+3,2)  + ".root";
//       }
//     }
//     if(outputfile == ""){
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       cout << "EMPTY OUPTPUTFILE STRING" << endl;
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       abort();
//     }
//     cout << "outputfile= " << outputfile << endl;
    
      cout<<"Have you set up RootCore via  \"source RootCore/scripts/setup.sh\" ?"<<endl;  

      gSystem->Setenv("ROOTCOREDIR", "/data/etp3/jwittkow/analysis_SUSYTools_03_04/RootCore");
      gSystem->SetIncludePath("-I$ROOTCOREDIR/include/");

      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+"); 

      TString selectorName = "TSelector_SusyNtuple_Truth"; // !!! enter the name of your Selector (without _C.so)

      TChain *ch;
      
      ch = new TChain("susyNt");

      TString processLine = ".L " + selectorName + ".cpp++g";
      TString execLine;

      gROOT->ProcessLine(processLine); // need to add this, or PoD at LRZ will not be able to load the .so
      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+");
      ch->Add(InputPath);
//       ch->Add("/data/etp6/jwittkow/SusyNtuples_n0145_bg_new/WZ_SherpaVVtotautauqq/user.sfarrell.mc12_8TeV.157816.Sherpa_CT10_VVtotautauqq.SusyNt.e1515_s1499_s1504_r3658_r3549_p1512_n0145.130708082025/*");



//       ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Egamma/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708161315/user.sfarrell.116519._00003.susyNt.root");
//       ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Egamma/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708161315/*");
// ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Egamma/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708161341/*");  
// ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Egamma/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708161402/*");
// ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Egamma/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708161438/*");
      
//       ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/WH/user.gerbaudo.mc12_8TeV.177501.Herwigpp_sM_wA_noslep_notauhad_WH_2Lep_1.SusyNt.e2149_s1581_s1586_r3658_r3549_p1512_n0150.140109072637/*");
//       ch->Add("/data/etp6/jwittkow/user.gerbaudo.mc12_8TeV.126893.Sherpa_CT10_lllnu_WZ.SusyNt.e1434_s1499_s1504_r3658_r3549_p1512_n0145dev4.131220015824/*");
      
//       ch->Add("/data/etp6/jwittkow/SusyNtuples_n0145_bg_new/ttbar105200/*");

//             ch->Add("/data/etp6/jwittkow/SusyNtuples_n0145_signal_samples/user.gerbaudo.mc12_8TeV.177503.Herwigpp_sM_wA_noslep_notauhad_WH_2Lep_3.SusyNt.e2149_s1581_s1586_r3658_r3549_p1512_n0145.130806161345/user.gerbaudo.023459._00001.susyNt.root");
      
      

	    


      Long64_t nEntries = ch->GetEntries();
      ch->ls();

      cout << "all entries: " << nEntries << endl;


      TSelector_SusyNtuple_Truth* SusyNtupleObject = new TSelector_SusyNtuple_Truth();
//       SusyNtupleObject->buildSumwMap(ch);
//       TString options="NtSys_NOM";
      ch->Process(SusyNtupleObject,SysUncertType);
      delete SusyNtupleObject;
      
      if (ch) {delete ch; ch=0;}

  abort();
  }
Ejemplo n.º 24
0
//to run in ROOT: .x runD3PDSelector.C
void runGangaTTreeCache() {

   cout << "Grid run, TTreeCache Enabled" <<endl;
   
   char *rpath  = getenv( "PWD" );
   std::string filename = "./input.txt";

   if (!( rpath == 0 )) { // if ENV-var not set use default
     std::string path(rpath);
     filename =  path+"/input.txt";
   }

  cout << "Reading input file "<<filename<<endl;
  
  
  TChain *c = new TChain("susy");

//  TFileCollection* fc = new TFileCollection("mylist", "mylist",filename);
//  c->AddFileInfoList((TCollection*)fc->GetList());
  

  std::string argStr;

  char *filechar = filename.c_str(); 
   
  std::ifstream ifs(filechar);

  std::vector<std::string> fileList;

  // split by '\n'
  int nfiles = 0;
  while (std::getline(ifs,argStr)) {
    for (size_t i=0,n; i <= argStr.length(); i=n+1) {
      n = argStr.find_first_of('\n',i);
      if (n == std::string::npos)
        n = argStr.length();
      TString tmp = argStr.substr(i,n-i);//std::string
      nfiles++;
      cout << "Adding file "<<tmp<<" nb "<<nfiles<<endl;
      c->Add(tmp);
    }
  }

   int nentries = c->GetEntries();
   std::cout << "Total number of entries in chain (after all the files) " <<  c->GetEntries() << std::endl;

  //  GD use TTreeCache (disabled by default in ROOT5.28)
  //c->SetCacheSize(100000000);

  //  GD DO NOT use TTreeCache (enabled by default in ROOT5.26)
  c->SetCacheSize(0);

  //c->SetProof();
  c->Process("D3PDSelector.C+O");
 
  // Create AthSummary.txt for the pilot
  ofstream outf("AthSummary.txt"); 
//  outf << "Files read: " << fc->GetNFiles() << std::endl; 
  outf << "Files read: " << nfiles << std::endl; 
  outf << "Events Read: " << nentries << std::endl; 
  outf << "{ \"events\":{\"read\":" << nentries << "} "  << "}" << std::endl;
  outf.close();
  system("cp AthSummary.txt ..");
  
  c->Delete();

  cout << "All done, quitting ROOT..."<<endl;
  
  //quit root
  gApplication->Terminate();

  } 
void run_TSelector_SusyNtuple_excess_n0150_Egamma_GH() {

//  TString options = TString(""); //TString(tag.c_str()) ;
// //     TString outputfile = "test.root";
//     string richtigerString = InputPath;
// //     int Position = richtigerString.find("mc12_8TeV.");
// //     outputfile = "histos_ZTauTau_" +  richtigerString.substr(Position+10,6)  + "_proof.root";
//     
//     int Position = -1;
//     Position = richtigerString.find("45_bg");
//     if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+6,2)  + ".root";
//     }
//     else{
//       Position = richtigerString.find("45_signal");
//       if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+3,2)  + ".root";
//       }
//     }
//     if(outputfile == ""){
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       cout << "EMPTY OUPTPUTFILE STRING" << endl;
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       abort();
//     }
//     cout << "outputfile= " << outputfile << endl;
    
      cout<<"Have you set up RootCore via  \"source RootCore/scripts/setup.sh\" ?"<<endl;  

      gSystem->Setenv("ROOTCOREDIR", "/data/etp3/jwittkow/analysis_SUSYTools_03_04_SusyNt_01_16/RootCore");
      gSystem->SetIncludePath("-I$ROOTCOREDIR/include/");

      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+"); 

      TString selectorName = "TSelector_SusyNtuple_excess"; // !!! enter the name of your Selector (without _C.so)

      TChain *ch;
      
      ch = new TChain("susyNt");

      TString processLine = ".L " + selectorName + ".cpp++g";
      TString execLine;

      gROOT->ProcessLine(processLine); // need to add this, or PoD at LRZ will not be able to load the .so
      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+");
//       ch->Add(InputPath);
//       ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/WH/user.gerbaudo.mc12_8TeV.177501.Herwigpp_sM_wA_noslep_notauhad_WH_2Lep_1.SusyNt.e2149_s1581_s1586_r3658_r3549_p1512_n0150.140109072637/*");
ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodG.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226165537/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodG.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226165741/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodG.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226165834/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodG.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226165950/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodG.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226212240/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodG.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131231013459/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodG.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131231211711/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226170049/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226170139/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226170414/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226170511/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226170703/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226170845/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131226211647/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131231014228/*");
  ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0150/Egamma/user.gerbaudo.group.phys-susy.data12_8TeV.periodH.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0150.131231212508/*");
  
  

  
     

	    


      Long64_t nEntries = ch->GetEntries();
      ch->ls();

      cout << "all entries: " << nEntries << endl;


      TSelector_SusyNtuple_excess* SusyNtupleObject = new TSelector_SusyNtuple_excess();
      SusyNtupleObject->buildSumwMap(ch);
//       TString options="NtSys_NOM";
      ch->Process(SusyNtupleObject);
      delete SusyNtupleObject;
      
      if (ch) {delete ch; ch=0;}

  abort();
  }
void run_root_TSelector_SusyNtuple_Muons() {

//  TString options = TString(""); //TString(tag.c_str()) ;
// //     TString outputfile = "test.root";
//     string richtigerString = InputPath;
// //     int Position = richtigerString.find("mc12_8TeV.");
// //     outputfile = "histos_ZTauTau_" +  richtigerString.substr(Position+10,6)  + "_proof.root";
//     
//     int Position = -1;
//     Position = richtigerString.find("45_bg");
//     if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+6,2)  + ".root";
//     }
//     else{
//       Position = richtigerString.find("45_signal");
//       if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+3,2)  + ".root";
//       }
//     }
//     if(outputfile == ""){
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       cout << "EMPTY OUPTPUTFILE STRING" << endl;
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       abort();
//     }
//     cout << "outputfile= " << outputfile << endl;
    
      cout<<"Have you set up RootCore via  \"source RootCore/scripts/setup.sh\" ?"<<endl;  

      gSystem->Setenv("ROOTCOREDIR", "/data/etp/jwittkowski/analysis_SUSYTools_03_04/RootCore");
      gSystem->SetIncludePath("-I$ROOTCOREDIR/include/");

      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+"); 

      TString selectorName = "TSelector_SusyNtuple"; // !!! enter the name of your Selector (without _C.so)

      TChain *ch;

      ch = new TChain("susyNt");


      TString processLine = ".L " + selectorName + ".cpp++g";
      TString execLine;

      gROOT->ProcessLine(processLine); // need to add this, or PoD at LRZ will not be able to load the .so
      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+");

      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165423/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165447/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165507/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165547/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165619/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165710/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165732/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165801/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165829/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165907/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708165935/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170005/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130709051736/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130709212230/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130709212332/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodB.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130709212411/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodC.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170128/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodC.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170157/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodC.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170223/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodC.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170245/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodC.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170315/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodC.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130709051801/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170353/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170420/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170458/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170524/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170550/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170614/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170645/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130709051836/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodD.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130709212549/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodE.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170738/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodE.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170757/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodE.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170819/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodE.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170844/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodE.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170905/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodE.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708170956/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodG.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171047/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodG.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171104/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodG.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171121/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodG.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171154/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodG.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171226/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodG.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171251/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodH.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171315/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodH.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171342/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodH.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171402/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodH.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171419/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodH.physics_Muons.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708171442/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodI.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171503_rev117460/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodI.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171521/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodI.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171541/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodI.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171559/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodI.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171646/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodI.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130710002540/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171724/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171804/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171839/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171907/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708171941/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708172025/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708172123/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130709052308/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodJ.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130709213130/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodL.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708172211/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodL.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708172233/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodL.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708172252/*");
      ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Muons/user.sfarrell.group.phys-susy.data12_8TeV.periodL.physics_Muons.PhysCont.SusyNt.t0pro14_v01_p1542_n0145.130708172319/*");


      Long64_t nEntries = ch->GetEntries();
      ch->ls();

      cout << "all entries: " << nEntries << endl;


      TSelector_SusyNtuple* susyAna = new TSelector_SusyNtuple();
      susyAna->buildSumwMap(ch);
      ch->Process(susyAna);
      delete susyAna;
      
      if (ch) {delete ch; ch=0;}

  abort();
  }
Ejemplo n.º 27
0
int main() {
   float lumi = 2260.;
   TString dir = "/Users/dygyun/Top/HET_v763";
   //TString dir = "/xrootd/store/user/tjkim/ntuples/hep/V6";
   TFile * fA = TFile::Open(dir+"/hep_TT_powheg.root");
   TFile * fB = TFile::Open(dir+"/hep_TT_powheg.root");
   TFile * fC = TFile::Open(dir+"/hep_WJets.root");
   TFile * fD = TFile::Open(dir+"/hep_DYJets.root");
   TFile * fE = TFile::Open(dir+"/hep_DYJets_10to50.root");
   TFile * fI = TFile::Open(dir+"/hep_SingleTop_t.root");
   TFile * fJ = TFile::Open(dir+"/hep_SingleTbar_t.root");
   TFile * fK = TFile::Open(dir+"/hep_SingleTop_tW.root");
   TFile * fL = TFile::Open(dir+"/hep_SingleTbar_tW.root");
   TFile * fN = TFile::Open(dir+"/hep_WW.root");
   TFile * fO = TFile::Open(dir+"/hep_WZ.root");
   TFile * fM = TFile::Open(dir+"/hep_ZZ.root");
//   TFile * fP = TFile::Open(dir+"/hep_qcd.root");
   
   TH1F * hBsemi = (TH1F*) fA->Get("TopTree/EventSummary");
   TH1F * hB = (TH1F*) fB->Get("TopTree/EventSummary");
   TH1F * hC = (TH1F*) fC->Get("TopTree/EventSummary");
   TH1F * hD = (TH1F*) fD->Get("TopTree/EventSummary");
   TH1F * hE = (TH1F*) fE->Get("TopTree/EventSummary");
   TH1F * hI = (TH1F*) fI->Get("TopTree/EventSummary");
   TH1F * hJ = (TH1F*) fJ->Get("TopTree/EventSummary");
   TH1F * hK = (TH1F*) fK->Get("TopTree/EventSummary");
   TH1F * hL = (TH1F*) fL->Get("TopTree/EventSummary");
   TH1F * hN = (TH1F*) fN->Get("TopTree/EventSummary");
   TH1F * hO = (TH1F*) fO->Get("TopTree/EventSummary");
   TH1F * hM = (TH1F*) fM->Get("TopTree/EventSummary");
 //  TH1F * hP = (TH1F*) fP->Get("");
   int nevt = -1;

   MyAnalysis *A = new MyAnalysis();
   TChain* ch = new TChain("TopTree/events");
   ch->Add(Form("%s/hep_data_json.root",dir.Data()), nevt);
   ch->Process(A);
   
   MyAnalysis_others *B = new MyAnalysis_others(1,1,831.8,lumi,hB->GetBinContent(1));
   TChain* ch2 = new TChain("TopTree/events");
   ch2->Add(Form("%s/hep_TT_powheg.root",dir.Data()), nevt);
   ch2->Process(B);
   //////
   MyAnalysis_Sig *Bsemi = new MyAnalysis_Sig(1,1,831.8,lumi,hBsemi->GetBinContent(1));
   TChain* ch2semi = new TChain("TopTree/events");
   ch2semi->Add(Form("%s/hep_TT_powheg.root",dir.Data()), nevt);
ch2semi->Process(Bsemi);
///////// 
   MyAnalysis *C = new MyAnalysis(1,1,61524,lumi,hC->GetBinContent(2));
   TChain* ch3 = new TChain("TopTree/events");
   ch3->Add(Form("%s/hep_WJets.root",dir.Data()),nevt);
   ch3->Process(C);
   
   MyAnalysis *D = new MyAnalysis(1,1,6025.2,lumi,hD->GetBinContent(1));
   TChain* ch4 = new TChain("TopTree/events");
   ch4->Add(Form("%s/hep_DYJets.root",dir.Data()),nevt);
   ch4->Process(D);
  
   MyAnalysis *E = new MyAnalysis(1,1,18610.0,lumi,hE->GetBinContent(1));
   TChain* ch5 = new TChain("TopTree/events");
   ch5->Add(Form("%s/hep_DYJets_10to50.root",dir.Data()),nevt);
   ch5->Process(E);
 
   MyAnalysis *I = new MyAnalysis(1,1,44.33,lumi,hI->GetBinContent(1));
   TChain* ch6 = new TChain("TopTree/events");
   ch6->Add(Form("%s/hep_SingleTop_t.root",dir.Data()),nevt);
   ch6->Process(I);
  
   MyAnalysis *J = new MyAnalysis(1,1,26.38,lumi,hJ->GetBinContent(1));
   TChain* ch7 = new TChain("TopTree/events");
   ch7->Add(Form("%s/hep_SingleTbar_t.root",dir.Data()),nevt);
   ch7->Process(J);

   MyAnalysis *K = new MyAnalysis(1,1,35.6,lumi,hK->GetBinContent(1));
   TChain* ch8 = new TChain("TopTree/events");
   ch8->Add(Form("%s/hep_SingleTop_tW.root",dir.Data()),nevt);
   ch8->Process(K);

   MyAnalysis *L = new MyAnalysis(1,1,35.6,lumi,hL->GetBinContent(1));
   TChain* ch9 = new TChain("TopTree/events");
   ch9->Add(Form("%s/hep_SingleTbar_tW.root",dir.Data()),nevt);
   ch9->Process(L);
   
   MyAnalysis *N = new MyAnalysis(1,1,118.7,lumi,hN->GetBinContent(1));
   TChain* ch10 = new TChain("TopTree/events");
   ch10->Add(Form("%s/hep_WW.root",dir.Data()),nevt);
   ch10->Process(N);

   MyAnalysis *O = new MyAnalysis(1,1,47.13,lumi,hO->GetBinContent(1));
   TChain* ch11 = new TChain("TopTree/events");
   ch11->Add(Form("%s/hep_WZ.root",dir.Data()),nevt);
   ch11->Process(O);
   
   MyAnalysis *M = new MyAnalysis(1,1,16.523,lumi,hM->GetBinContent(1));
   TChain* ch12 = new TChain("TopTree/events");
   ch12->Add(Form("%s/hep_ZZ.root",dir.Data()),nevt);
   ch12->Process(M);
 
Plotter P;

   for (int i=0; i < 6 ;i++) {
   //for (int i=0; i < D->histograms.size() ;i++) {
     //merge for DY
     D->histograms[i]->Add(E->histograms[i]);
     //merge for SingleTop
     I->histograms[i]->Add(J->histograms[i]);
     I->histograms[i]->Add(K->histograms[i]);
     I->histograms[i]->Add(L->histograms[i]);
    //////merge for VV 
     N->histograms[i]->Add(O->histograms[i]);
     N->histograms[i]->Add(M->histograms[i]);
////tt bkg     
  //   B->histograms[i]->Add(Bhad->histograms[i]);

} 
   P.SetData(A->histograms, std::string("Data"));
   P.AddBg(Bsemi->histograms, std::string("TTbar"));
   P.AddBg(C->histograms, std::string("Wjets"));
   P.AddBg(D->histograms, std::string("DY"));
   P.AddBg(I->histograms, std::string("Single Top"));
   P.AddBg(N->histograms, std::string("VV"));
   
  P.AddBg(B->histograms, std::string("TTOthers"));

   P.Plot(string("results_ABCD.pdf"));

   TFile * outA = TFile::Open("hist_data.root","RECREATE");
   for(int i=0; i < A->histograms.size(); i++){
     TH1F * tmp = (TH1F *) A->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < A->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) A->histograms_2D[i];
     tmp->Write();
   }
   outA->Write();
   outA->Close();

   TFile * outB = TFile::Open("hist_TT_others.root","RECREATE");
   for(int i=0; i < B->histograms.size(); i++){
     TH1F * tmp = (TH1F *) B->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < B->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) B->histograms_2D[i];
     tmp->Write();
   }
   outB->Write();
   outB->Close();

   TFile * outBsemi = TFile::Open("hist_TT_SemiLeptonic.root","RECREATE");
   for(int i=0; i < Bsemi->histograms.size(); i++){
     TH1F * tmp = (TH1F *) Bsemi->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < Bsemi->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) Bsemi->histograms_2D[i];
     tmp->Write();
   }
   outBsemi->Write();
   outBsemi->Close();
   
  TFile * outC = TFile::Open("hist_WJets.root","RECREATE");
   for(int i=0; i < C->histograms.size(); i++){
     TH1F * tmp = (TH1F *) C->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < C->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) C->histograms_2D[i];
     tmp->Write();
   }
   outC->Write();
   outC->Close();

   TFile * outD = TFile::Open("hist_DY.root","RECREATE");
   for(int i=0; i < D->histograms.size(); i++){
     TH1F * tmp = (TH1F *) D->histograms[i];
     tmp->Write();
    }
   for(int i=0; i < D->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) D->histograms_2D[i];
     tmp->Write();
   }
   outD->Write();
   outD->Close();
   
    TFile * outI = TFile::Open("hist_SingleTop.root","RECREATE");
    for(int i=0; i < I->histograms.size(); i++){
      TH1F * tmp = (TH1F *) I->histograms[i];
      tmp->Write();
    }
   for(int i=0; i < I->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) I->histograms_2D[i];
     tmp->Write();
   }
    outI->Write();
    outI->Close();

  TFile * outN = TFile::Open("hist_VV.root","RECREATE");
   for(int i=0; i < N->histograms.size(); i++){
     TH1F * tmp = (TH1F *) N->histograms[i];
     tmp->Write();
   }
   for(int i=0; i < N->histograms_2D.size(); i++){
     TH2D * tmp = (TH2D *) N->histograms_2D[i];
     tmp->Write();
   }
   outN->Write();
   outN->Close();
}
Ejemplo n.º 28
0
void runttgamma(TString sample="all", TString ExtraOpts= "", int workers=8)
{

  //TProof *proof = getProof("lite://",nwrks);
  TString proofOpt(Form("workers=%i",workers));
  //TProof *proof = TProof::Open(proofOpt);
  //if (!proof) {
  //  Printf("runProof: could not start/attach a PROOF session");
  //  return;
  //}

  //proof->SetLogLevel(2); // verbose

  TChain *chain = new TChain("ggNtuplizer/EventTree");
  StrVecMap::iterator ite;//
  bool foundSample = false;
  for ( ite = vsamples.begin(); ite != vsamples.end(); ++ite) {//
    
    std::string name(sample.Data());
    std::string tmpname = (*ite).first;
    if ( name != "all" && name != tmpname ) continue;
    foundSample = true;
    if ( name == "all" ) name = tmpname;
    StrVector location = vsamples[name];
    cout<< "Input sample: "<< name << endl;
    //StrVecMap::iterator ite;
    //for (ite = location.begin(); ite != location.end(); ++ite) {
    for ( size_t i=0; i < location.size(); ++i ) {
    
      //chain->Add(location.c_str());
      chain->Add( location[i].c_str() );
    }
    cout << "List of files:" << endl;
    chain->ls();
    cout << endl;
    //chain->SetProof(); // to run in PROOF mode
    TString opts(Form("sample=%s",name.c_str()));
    if (ExtraOpts != "" ) opts = ExtraOpts + " " + opts;

    ttgamma3 *myselector = new ttgamma3();

    //chain->Process("ttgamma3.C",opts.Data() );
    chain->Process(myselector, opts.Data() );
    cout << "Process: ttgamma.C done" << endl;

  }
  // logs
  
  //TList *logList = proof->GetManager()->GetSessionLogs()->GetListOfLogs();
  //for (int i=1; i< logList->GetSize(); ++i)
  //  {
  //    TProffLogElem *logElem = ( TProofLogElem* ) logList->At( i );
  //    macro = logElem->GetMacro();
  //    macro->SaveSource("data_muons_"+TString(Form("%i",i))+".stdout");
  //  }
  

  //chain->SetProof(0);
  //chain->Delete();
  //delete chain;
  //proof->ClearInput();
  //proof->ClearData();
  //proof->ClearInputData();
  //delete proof;
  if ( foundSample )
    cout << "runttgamma done"<<endl;
  else
    cout << "Error: No sample found with name: " << sample.Data() << endl;
}
void run_root_TSelector_SusyNtuple_ZPlusJetsNEW_1() {

//  TString options = TString(""); //TString(tag.c_str()) ;
// //     TString outputfile = "test.root";
//     string richtigerString = InputPath;
// //     int Position = richtigerString.find("mc12_8TeV.");
// //     outputfile = "histos_ZTauTau_" +  richtigerString.substr(Position+10,6)  + "_proof.root";
//     
//     int Position = -1;
//     Position = richtigerString.find("45_bg");
//     if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+6,2)  + ".root";
//     }
//     else{
//       Position = richtigerString.find("45_signal");
//       if (Position>0){
//       outputfile = "histos_test_" +  richtigerString.substr(Position+3,2)  + ".root";
//       }
//     }
//     if(outputfile == ""){
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       cout << "EMPTY OUPTPUTFILE STRING" << endl;
//       cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
//       abort();
//     }
//     cout << "outputfile= " << outputfile << endl;
    
      cout<<"Have you set up RootCore via  \"source RootCore/scripts/setup.sh\" ?"<<endl;  

      gSystem->Setenv("ROOTCOREDIR", "/data/etp3/jwittkow/analysis_SUSYTools_03_04_SusyNt_01_16/RootCore");
      gSystem->SetIncludePath("-I$ROOTCOREDIR/include/");

      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+"); 

      TString selectorName = "TSelector_SusyNtuple"; // !!! enter the name of your Selector (without _C.so)

      TChain *ch;
      
      ch = new TChain("susyNt");

      TString processLine = ".L " + selectorName + ".cpp++g";
      TString execLine;

      gROOT->ProcessLine(processLine); // need to add this, or PoD at LRZ will not be able to load the .so
      gROOT->ProcessLine(".x $ROOTCOREDIR/scripts/load_packages.C+");
      
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147105.AlpgenPythia_Auto_P2011C_ZeeNp0.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130711110642/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147105.AlpgenPythia_Auto_P2011C_ZeeNp0.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130712075048/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147105.AlpgenPythia_Auto_P2011C_ZeeNp0.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130713000355/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147106.AlpgenPythia_Auto_P2011C_ZeeNp1.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130708185230/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147107.AlpgenPythia_Auto_P2011C_ZeeNp2.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130711110708/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147108.AlpgenPythia_Auto_P2011C_ZeeNp3.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130708185306/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147109.AlpgenPythia_Auto_P2011C_ZeeNp4.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130708185318/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147110.AlpgenPythia_Auto_P2011C_ZeeNp5incl.SusyNt.e1879_s1581_s1586_r3658_r3549_p1512_n0145.130708185332/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147113.AlpgenPythia_Auto_P2011C_ZmumuNp0.SusyNt.e1880_s1581_s1586_r3658_r3549_p1512_n0145.130711110756/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147114.AlpgenPythia_Auto_P2011C_ZmumuNp1.SusyNt.e1880_s1581_s1586_r3658_r3549_p1512_n0145.130711110816/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147115.AlpgenPythia_Auto_P2011C_ZmumuNp2.SusyNt.e1880_s1581_s1586_r3658_r3549_p1512_n0145.130711110839/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147116.AlpgenPythia_Auto_P2011C_ZmumuNp3.SusyNt.e1880_s1581_s1586_r3658_r3549_p1512_n0145.130708185453/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147117.AlpgenPythia_Auto_P2011C_ZmumuNp4.SusyNt.e1880_s1581_s1586_r3658_r3549_p1512_n0145.130708185508/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147118.AlpgenPythia_Auto_P2011C_ZmumuNp5incl.SusyNt.e1880_s1581_s1586_r3658_r3549_p1512_n0145.130708185521/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147121.AlpgenPythia_Auto_P2011C_ZtautauNp0.SusyNt.e1881_s1581_s1586_r3658_r3549_p1512_n0145.130710211438/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147121.AlpgenPythia_Auto_P2011C_ZtautauNp0.SusyNt.e1881_s1581_s1586_r3658_r3549_p1512_n0145.130710211503/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147121.AlpgenPythia_Auto_P2011C_ZtautauNp0.SusyNt.e1881_s1581_s1586_r3658_r3549_p1512_n0145.130711110938/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147122.AlpgenPythia_Auto_P2011C_ZtautauNp1.SusyNt.e1881_s1581_s1586_r3658_r3549_p1512_n0145.130711085119/*");
ch->Add("/data/etp5/jwittkow/SusyNtuples_n0145_bg_new2/user.sfarrell.mc12_8TeV.147122.AlpgenPythia_Auto_P2011C_ZtautauNp1.SusyNt.e1881_s1581_s1586_r3658_r3549_p1512_n0145.130711111032/*");



//       ch->Add(InputPath);
//       ch->Add("/data/etp6/jwittkow/SusyNtuples_n0145_bg_new/WZ_SherpaVVtotautauqq/user.sfarrell.mc12_8TeV.157816.Sherpa_CT10_VVtotautauqq.SusyNt.e1515_s1499_s1504_r3658_r3549_p1512_n0145.130708082025/*");



//       ch->Add("/nobackup/etp2/Josephine.Wittkowski/SusyNtuples_n0145_data/Egamma/user.sfarrell.group.phys-susy.data12_8TeV.periodA.physics_Egamma.PhysCont.SusyNt.repro14_v01_p1542_n0145.130708161315/user.sfarrell.116519._00003.susyNt.root");
      
//       ch->Add("/data/etp6/jwittkow/SusyNtuple_testdir/126893_n0145/*");
//       ch->Add("/data/etp6/jwittkow/user.gerbaudo.mc12_8TeV.126893.Sherpa_CT10_lllnu_WZ.SusyNt.e1434_s1499_s1504_r3658_r3549_p1512_n0145dev4.131220015824/*");
      
//       ch->Add("/data/etp6/jwittkow/SusyNtuples_n0145_bg_new/ttbar105200/*");

//             ch->Add("/data/etp6/jwittkow/SusyNtuples_n0145_signal_samples/user.gerbaudo.mc12_8TeV.177503.Herwigpp_sM_wA_noslep_notauhad_WH_2Lep_3.SusyNt.e2149_s1581_s1586_r3658_r3549_p1512_n0145.130806161345/user.gerbaudo.023459._00001.susyNt.root");
      
      

	    


      Long64_t nEntries = ch->GetEntries();
      ch->ls();

      cout << "all entries: " << nEntries << endl;


      TSelector_SusyNtuple* susyAna = new TSelector_SusyNtuple();
      susyAna->buildSumwMap(ch);
      ch->Process(susyAna);
      delete susyAna;
      
      if (ch) {delete ch; ch=0;}

  abort();
  }
Ejemplo n.º 30
0
int GetBinPrediction()
{

    cout << "Loading Ra2bBin.C" << endl;
    gROOT->ProcessLine(".L RA2bBin.C+");
    cout << "Loading Prediction.C" << endl;
    gROOT->ProcessLine(".L Prediction.C+");
    cout << "Loading Expectation.C" << endl;
    gROOT->ProcessLine(".L Expectation.C+");

    // ------------------------------------------------------------------- //


    Expectation* expec = new Expectation();
    TChain* expectation = new TChain("PredictionTree");
    Prediction* predic = new Prediction();
    TChain* prediction = new TChain("PredictionTree");

    // ------------------------------------------------------------------- //

    ifstream myfile1 ("filelist.txt");

    string root_file;
    if (myfile1.is_open()) {
        while( myfile1.good() ) {
            getline (myfile1,root_file);
            cout << root_file << endl;
            if (root_file.length() > 0) {
                TString path = root_file;
                expectation->Add(path);
                prediction->Add(path);
            }
        }
        myfile1.close();
    }

    // ------------------------------------------------------------------- //

    expectation->Process(expec);
    prediction->Process(predic);

    // ------------------------------------------------------------------- //

    gROOT->SetStyle("Plain");
    gStyle->SetPalette(51, 0);

    // For the canvas:
    gStyle->SetCanvasColor(0);
    gStyle->SetCanvasBorderMode(0);

    // For the Pad:
    gStyle->SetPadColor(0);
    gStyle->SetPadTickX(1);
    gStyle->SetPadTickY(1);
    gStyle->SetPadBorderSize(2);
    gStyle->SetPadBorderMode(0);

    // For the frame:
    gStyle->SetFrameBorderMode(0);

    // For the histo:
    gStyle->SetMarkerSize(0.7);
    gStyle->SetMarkerStyle(20);
    gStyle->SetMarkerColor(1);

    // For the statistics box:
    gStyle->SetOptStat(0);
    gStyle->SetOptFit(1011);

    // Margins:
    gStyle->SetPadBottomMargin(0.25);
    gStyle->SetPadTopMargin(0.15);
    gStyle->SetPadLeftMargin(0.15);
    gStyle->SetPadRightMargin(0.1);

    // For the Global title:
    gStyle->SetOptTitle(0);
    gStyle->SetTitleColor(1);
    gStyle->SetTitleFillColor(10);
    gStyle->SetTitleTextColor(1);
    gStyle->SetTitleFont(42);
    gStyle->SetTitleFontSize(0.05);
    gStyle->SetTitleBorderSize(0);

    // For the axis
    gStyle->SetNdivisions(510, "X");
    gStyle->SetNdivisions(510, "Y");
    gStyle->SetTickLength(0.03);

    // For the axis titles:
    gStyle->SetTitleOffset(1.4, "X");
    gStyle->SetTitleOffset(1.25, "Y");
    gStyle->SetTitleOffset(1.2, "Y");
    gStyle->SetTitleOffset(0.5, "Z");
    gStyle->SetTitleSize(0.05, "XYZ");
    gStyle->SetTitleSize(0.061, "XYZ");
    gStyle->SetTitleFont(42, "XYZ");
    gStyle->SetTitleX(0.15);
    gStyle->SetTitleY(0.99);

    // For the axis labels:
    gStyle->SetLabelSize(0.04, "XYZ");
    gStyle->SetLabelOffset(0.01, "XYZ");
    gStyle->SetLabelFont(42, "XYZ");

    // For the legend
    gStyle->SetLegendBorderSize(0);

    gROOT->ForceStyle();

    enum {cqcd=kRed+3, cltau=kYellow, cllep=kRed+1, czinv=kGreen+1, cdata=kBlack, cpred=kBlue+2};

    TH1F* h_pred = predic->CalcPrediction(predic->yields_2D);
    TH1F* h_exp = expec->yields;

    int NBins = h_pred->GetNbinsX();

    h_pred->SetTitle("");
    h_exp->SetTitle("");

    h_pred->SetLineColor(cqcd );
    h_exp->SetLineColor(cdata);

    h_pred->SetFillColor(cqcd );
    h_exp->SetFillColor(cdata);

    h_pred->SetMarkerColor(cqcd );
    h_exp->SetMarkerColor(cdata);

    h_exp->SetMarkerStyle(20);
    h_exp->SetMarkerSize (1.2);
    h_exp->SetLineWidth(2);

    h_exp->GetYaxis()->SetTitleSize(0.08);
    h_exp->GetYaxis()->SetLabelSize(0.06);

    h_pred->GetYaxis()->SetTitleSize(0.08);
    h_pred->GetYaxis()->SetLabelSize(0.06);

    gStyle->SetHatchesSpacing(0.5);
    gStyle->SetHatchesLineWidth(1);

    TCanvas *c = new TCanvas("c", "c", 1200, 800);
    c->cd();
    TPad *pad1 = new TPad("pad1", "pad1", 0, 0.45, 1, 1);
    pad1->SetFillStyle(4000);
    pad1->Draw();
    pad1->SetLogy();
    pad1->SetTopMargin(0.1);
    pad1->SetBottomMargin(0);
    pad1->SetRightMargin(0.05);
    pad1->SetLeftMargin(0.15);
    pad1->cd();

    TH1F *vFrame1 = pad1->DrawFrame(0.0, 0.1, (double) NBins, 20000.0);
    vFrame1->GetYaxis()->SetTitle("Events");
    vFrame1->GetYaxis()->SetTitleOffset(-1.3);
    vFrame1->GetYaxis()->SetTitleSize(0.15);
    vFrame1->GetYaxis()->SetTitleFont(42);
    vFrame1->GetYaxis()->SetLabelOffset(-0.04);
    vFrame1->GetYaxis()->SetLabelSize(0.05);
    vFrame1->GetYaxis()->SetLabelFont(42);
    vFrame1->GetXaxis()->SetLabelOffset(1.0);
    vFrame1->GetYaxis()->SetTickLength(0.02);
    vFrame1->GetYaxis()->SetTicks("+");
    vFrame1->SetFillStyle(4000);
    h_pred->Draw("same histe");
    h_exp->Draw("same pe");

    TLatex *title = new TLatex(0., 30000, "Simulation, L = 10 fb^{ -1}, #sqrt{s} = 13 TeV");
    title->SetNDC(0);
    title->SetTextFont(42);
    title->SetTextSize(0.06);
    title->Draw("same");

    pad1->cd();
    c->cd();
    TLegend *leg1 = new TLegend(0.7,0.85,0.95,0.93,NULL,"NDC");
    leg1->SetLineColor(0);
    leg1->SetLineStyle(1);
    leg1->SetLineWidth(1);
    leg1->SetFillColor(0);
    leg1->SetFillStyle(4000);
    leg1->SetTextSize(0.025);
    leg1->SetTextFont(42);
    leg1->AddEntry(h_exp, "MC Expectation", "lp");
    leg1->AddEntry(h_pred,  "R+S Prediction", "lf");
    leg1->Draw("same");

    double pred[NBins];
    double pred_err[NBins];
    double exp[NBins];
    double exp_err[NBins];
    double x[NBins];
    double y[NBins];
    double ey_UP[NBins];
    double ey_DN[NBins];
    double r[NBins];
    double r_e[NBins];
    double bins_e[NBins];
    for(int ii=0; ii<NBins; ii++) {
        pred[ii] = h_pred->GetBinContent(ii+1);
        pred_err[ii] = h_pred->GetBinError(ii+1);
        exp[ii] = h_exp->GetBinContent(ii+1);
        exp_err[ii] = h_exp->GetBinError(ii+1);
        bins_e[ii] = 0.5;
        x[ii] = 0.5+ii;
        y[ii] = 0.;
        ey_UP[ii] = pred_err[ii]/pred[ii];
        ey_DN[ii] = pred_err[ii]/pred[ii];
        r[ii] = (pred[ii]-exp[ii])/exp[ii];
        r_e[ii] = sqrt((pred_err[ii]/exp[ii])*(pred_err[ii]/exp[ii])+(exp_err[ii]*pred[ii]/exp[ii]/exp[ii])*(exp_err[ii]*pred[ii]/exp[ii]/exp[ii]));
    }

    TGraphAsymmErrors *ratio = new TGraphAsymmErrors(NBins, x, r, bins_e, bins_e, r_e, r_e);

    ratio->SetMarkerColor(cdata);
    ratio->SetMarkerStyle(20);
    ratio->SetMarkerSize (1.2);
    ratio->SetLineColor(cdata);
    ratio->SetLineWidth(2);

    TH1F *h_ratio = new TH1F("h_ratio_mc", "h_ratio_mc", NBins, 0, NBins);

    h_ratio->SetMarkerColor(cdata);

    h_ratio->SetMarkerStyle(20);
    h_ratio->SetMarkerSize (1.2);
    h_ratio->SetLineWidth(1);
    h_ratio->SetMinimum(-1.2);
    h_ratio->SetMaximum(2.2);

    for (int ibin=1; ibin<=h_exp->GetNbinsX(); ibin++) {
        h_ratio->SetBinContent(ibin, 0);
        h_ratio->SetBinError(ibin, 0);
        h_ratio->GetXaxis()->SetBinLabel(ibin, h_pred->GetXaxis()->GetBinLabel(ibin));
    }

    c->cd();
    TPad *pad2 = new TPad("pad2", "pad2", 0., 0., 1, 0.5);
    pad2->SetTopMargin(0.0);
    pad2->SetRightMargin(0.05);
    pad2->SetLeftMargin(0.15);
    pad2->SetBottomMargin(0.4);
    pad2->Draw("same");
    pad2->cd();

    TH1F *vFrame2 = pad2->DrawFrame(0.0, 0.45, (double) NBins, 1.5);
    vFrame2->GetYaxis()->SetTitle("(Pred.-Exp.)/Exp.");
    vFrame2->GetYaxis()->SetTitleOffset(2.6);
    vFrame2->GetYaxis()->SetTitleSize(0.08);
    vFrame2->GetYaxis()->SetTitleFont(42);
    vFrame2->GetYaxis()->SetLabelOffset(0.08);
    vFrame2->GetYaxis()->SetLabelSize(0.06);
    vFrame2->GetYaxis()->SetLabelFont(42);
    vFrame2->GetXaxis()->SetLabelOffset(1.0);
    vFrame2->GetYaxis()->SetTickLength(-0.02);
    vFrame2->GetYaxis()->SetTicks("+");


    h_ratio->SetTitle("");
    h_ratio->GetYaxis()->SetTitle("(Pred.-Exp.)/Exp.");
    h_ratio->GetYaxis()->SetTitleOffset(0.6);
    h_ratio->GetYaxis()->SetLabelOffset(0.02);
    h_ratio->GetYaxis()->SetTickLength(0.02);
    h_ratio->GetYaxis()->SetTitleSize(0.08);
    h_ratio->GetYaxis()->SetLabelSize(0.06);
    h_ratio->GetXaxis()->SetLabelOffset(0.01);
    h_ratio->Draw("e5");
    ratio->Draw("P0Z");

    c->SaveAs("BinByBinClosure_test.pdf");

    return 1;

}