Esempio n. 1
0
void runSusyBkg(TString mode = "cluster", TString identifier = "myTest", TString dataset = "su4.susy1118", TString username = "******", bool mcweights = true, bool sys = true) 
{
	//options for mode are local, lite, cluster, or grid

	LoadLibraries();
    
	//General user run options (now set in run command)
	//TString identifier("myTest"); //unique identifier for this job
	//TString dataset("test.example"); //dataset name
	//TString username("bcbutler"); //username for cluster, not important otherwise

	//SetConfig
	TString configfile("../config/periodsB-M.config");

	// Best to leave alone	
	TString pathLite("");
	
	TString pathCluster("root://atlprf01.slac.stanford.edu:2094//atlas/output/");
	pathCluster.Append(username);
	pathCluster.Append("/");

	//Determine eventbuilder from dataset name
	TString eventbuilder(dataset);
	eventbuilder.Remove(0,eventbuilder.Last('.')+1);

	//Filename paths, URLs for PROOF running
	TString url(mode);
	TString path("");
	if(mode.CompareTo("lite")==0) {
		url = "lite://"; //ROOT 5.32
		path = pathLite;
	}
	else if(mode.CompareTo("cluster")==0) {
		url = TString(username+"@atlprf01.slac.stanford.edu");
		path = pathCluster;
	}
	
	//Make an options file, edit as needed
	TFile* options = new TFile("options.root","RECREATE");
	
	//Analyses Configs, change as needed
	bool do0Lepton = true;
	bool do4Jet = false;
	bool do6Jet = false;
	bool doSR1 = true;
	bool doSR2 = true;
	bool doSR3 = true;
	bool do1Electron = true;
	bool do2Electron = true;
	bool do1Muon = true;
	bool do2Muon = true;
	bool doFakeNu = false; //convert Zmumubb to Znunubb
	bool doKillZnunuZbb = false;
	bool doDetail = true;
	bool doLocHad = false;
	bool doPRW = true;
	bool doHFT = true;
	bool doWriteTrees = eventbuilder.CompareTo("event") ? true : false;
	bool noBtagSFs = true;
	bool fancyBtagErr = false;
	bool truthEB = false;
	bool isData = false;
	
	if(dataset.Contains("Egamma_")) {
		do0Lepton = false;
		do1Muon = false;
		do2Muon = false;
		isData = true;
	}
	else if(dataset.Contains("Muons_")) {
		do0Lepton = false;
		do1Electron = false;
		do2Electron = false;
		isData = true;
	}
	else if(dataset.Contains("JetTauEtmiss_")) {
		do1Electron = false;
		do2Electron = false;
		do1Muon = false;
		do2Muon = false;
		isData = true;
	}

	if(truthEB) {
		if(isData) {
			cout << "You are asking to run the truth-based event builder on data?" << endl;
			exit(1);
		}

		//append for truth-only studies, turn of systematics
		eventbuilder.Append("_truth");	
		sys = false;
	}
	
	Config* chain = new Config("chain",configfile); //eventbuilder/mcweights flags in chain config
	chain->AddVec("ANALYSIS");
	chain->Set("MCWEIGHTS",mcweights);
	chain->Set("BTAG",2*(!isData));
	chain->Set("NOBTAGSF",noBtagSFs);	
	chain->Set("FANCYBTAGERR",fancyBtagErr);
	chain->Set("PILE",doPRW);
	chain->Set("HFT",doHFT);
	chain->Set("0LEPTON",do0Lepton);
	chain->Set("1ELECTRON",do1Electron);
	chain->Set("1MUON",do1Muon);
	chain->Set("2ELECTRON",do2Electron);
	chain->Set("2MUON",do2Muon);
	chain->Set("FAKENU",doFakeNu);
	chain->Set("KILLZNUNUZBB",doKillZnunuZbb);	
	chain->Set("LOCHAD",doLocHad);
	//chain->Set("DEBUG",true);

	Config* nom = new Config("nom");
	nom->Set("ANALYSIS","susybkg");
	nom->Set("BTAG",1*(!isData));
	nom->Set("0LEPTON",do0Lepton);
	nom->Set("4JET",do4Jet);
	nom->Set("6JET",do6Jet);
	nom->Set("SR1",doSR1);
	nom->Set("SR2",doSR2);
	nom->Set("SR3",doSR3);
	nom->Set("1ELECTRON",do1Electron);
	nom->Set("1MUON",do1Muon);	
	nom->Set("2ELECTRON",do2Electron);
	nom->Set("2MUON",do2Muon);	
	nom->Set("DETAIL",doDetail);
	nom->Set("WRITETREES",doWriteTrees);
	//nom->Set("DEBUG",true);
	chain->Add("ANALYSIS",nom);
	
	if(dataset.Contains("JetTauEtmiss_")||dataset.Contains("ttslLAr")) {
		Config* larreversed = new Config("larreversed",configfile);
		larreversed->Set("ANALYSIS","susybkg");
		larreversed->Set("MCWEIGHTS",mcweights);
		larreversed->Set("BTAG",0);
		larreversed->Set("PILE",doPRW);
		larreversed->Set("HFT",doHFT);
		larreversed->Set("0LEPTON",do0Lepton);
		larreversed->Set("4JET",do4Jet);
		larreversed->Set("6JET",do6Jet);
		larreversed->Set("SR1",doSR1);
		larreversed->Set("SR2",doSR2);
		larreversed->Set("SR3",doSR3);
		larreversed->Set("1ELECTRON",false);
		larreversed->Set("1MUON",false);
		larreversed->Set("2ELECTRON",false);
		larreversed->Set("2MUON",false);
		larreversed->Set("FAKENU",doFakeNu);
		larreversed->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		larreversed->Set("DETAIL",doDetail);
		larreversed->Set("LOCHAD",doLocHad);
		larreversed->Set("LARVETOREVERSED",true);
		larreversed->Set("WRITETREES",doWriteTrees);
		//larreversed->Set("DEBUG",true);
		larreversed->Write();	
	}
	
	if(dataset.Contains("Egamma_")||dataset.Contains("Muons_")) {
	
		Config* mmnom = new Config("mmnom");
		mmnom->Set("ANALYSIS","susybkg");
		mmnom->Set("BTAG",0);
		mmnom->Set("0LEPTON",false);
		mmnom->Set("4JET",false);
		mmnom->Set("6JET",false);
		mmnom->Set("SR1",doSR1);
		mmnom->Set("SR2",doSR2);
		mmnom->Set("SR3",doSR3);
		mmnom->Set("1ELECTRON",do1Electron);
		mmnom->Set("1MUON",do1Muon);	
		mmnom->Set("2ELECTRON",false);
		mmnom->Set("2MUON",false);	
		mmnom->Set("DETAIL",doDetail);
		mmnom->Set("MM",1);		
		mmnom->Set("WRITETREES",doWriteTrees);
		//mmnom->Set("DEBUG",true);
		chain->Add("ANALYSIS",mmnom);
		
		Config* mmsys = new Config("mmsys");
		mmsys->Set("ANALYSIS","susybkg");
		mmsys->Set("BTAG",0);
		mmsys->Set("0LEPTON",false);
		mmsys->Set("4JET",false);
		mmsys->Set("6JET",false);
		mmsys->Set("SR1",doSR1);
		mmsys->Set("SR2",doSR2);
		mmsys->Set("SR3",doSR3);
		mmsys->Set("1ELECTRON",do1Electron);
		mmsys->Set("1MUON",do1Muon);	
		mmsys->Set("2ELECTRON",false);
		mmsys->Set("2MUON",false);	
		mmsys->Set("DETAIL",doDetail);
		mmsys->Set("MM",2);		
		mmsys->Set("WRITETREES",doWriteTrees);
		//mmsys->Set("DEBUG",true);
		chain->Add("ANALYSIS",mmsys);
		
		Config* mmstat = new Config("mmstat");
		mmstat->Set("ANALYSIS","susybkg");
		mmstat->Set("BTAG",0);
		mmstat->Set("0LEPTON",false);
		mmstat->Set("4JET",false);
		mmstat->Set("6JET",false);
		mmstat->Set("SR1",doSR1);
		mmstat->Set("SR2",doSR2);
		mmstat->Set("SR3",doSR3);
		mmstat->Set("1ELECTRON",do1Electron);
		mmstat->Set("1MUON",do1Muon);	
		mmstat->Set("2ELECTRON",false);
		mmstat->Set("2MUON",false);	
		mmstat->Set("DETAIL",doDetail);
		mmstat->Set("MM",3);		
		mmstat->Set("WRITETREES",doWriteTrees);
		//mmstat->Set("DEBUG",true);
		chain->Add("ANALYSIS",mmstat);
	}

	if((!isData)&&(!dataset.Contains("ttslLAr"))&&sys) {	

		Config* bup = new Config("bup");
		bup->Set("ANALYSIS","susybkg");
		bup->Set("BTAG",2);
		bup->Set("0LEPTON",do0Lepton);
		bup->Set("4JET",do4Jet);
		bup->Set("6JET",do6Jet);
		bup->Set("SR1",doSR1);
		bup->Set("SR2",doSR2);
		bup->Set("SR3",doSR3);
		bup->Set("1ELECTRON",do1Electron);
		bup->Set("1MUON",do1Muon);
		bup->Set("2ELECTRON",do2Electron);
		bup->Set("2MUON",do2Muon);
		bup->Set("WRITETREES",doWriteTrees);
		//bup->Set("DEBUG",true);
		chain->Add("ANALYSIS",bup);

		Config* bdown = new Config("bdown");
		bdown->Set("ANALYSIS","susybkg");
		bdown->Set("BTAG",3);
		bdown->Set("0LEPTON",do0Lepton);
		bdown->Set("4JET",do4Jet);
		bdown->Set("6JET",do6Jet);
		bdown->Set("SR1",doSR1);
		bdown->Set("SR2",doSR2);
		bdown->Set("SR3",doSR3);
		bdown->Set("1ELECTRON",do1Electron);
		bdown->Set("1MUON",do1Muon);
		bdown->Set("2ELECTRON",do2Electron);
		bdown->Set("2MUON",do2Muon);
		bdown->Set("WRITETREES",doWriteTrees);
		//bdown->Set("DEBUG",true);
		chain->Add("ANALYSIS",bdown);
		
		Config* cup = new Config("cup");
		cup->Set("ANALYSIS","susybkg");
		cup->Set("BTAG",4);
		cup->Set("0LEPTON",do0Lepton);
		cup->Set("4JET",do4Jet);
		cup->Set("6JET",do6Jet);
		cup->Set("SR1",doSR1);
		cup->Set("SR2",doSR2);
		cup->Set("SR3",doSR3);
		cup->Set("1ELECTRON",do1Electron);
		cup->Set("1MUON",do1Muon);
		cup->Set("2ELECTRON",do2Electron);
		cup->Set("2MUON",do2Muon);
		cup->Set("WRITETREES",doWriteTrees);
		//cup->Set("DEBUG",true);
		chain->Add("ANALYSIS",cup);

		Config* cdown = new Config("cdown");
		cdown->Set("ANALYSIS","susybkg");
		cdown->Set("BTAG",5);
		cdown->Set("0LEPTON",do0Lepton);
		cdown->Set("4JET",do4Jet);
		cdown->Set("6JET",do6Jet);
		cdown->Set("SR1",doSR1);
		cdown->Set("SR2",doSR2);
		cdown->Set("SR3",doSR3);
		cdown->Set("1ELECTRON",do1Electron);
		cdown->Set("1MUON",do1Muon);
		cdown->Set("2ELECTRON",do2Electron);
		cdown->Set("2MUON",do2Muon);
		cdown->Set("WRITETREES",doWriteTrees);
		//cdown->Set("DEBUG",true);
		chain->Add("ANALYSIS",cdown);
		
		Config* lup = new Config("lup");
		lup->Set("ANALYSIS","susybkg");
		lup->Set("BTAG",6);
		lup->Set("0LEPTON",do0Lepton);
		lup->Set("4JET",do4Jet);
		lup->Set("6JET",do6Jet);
		lup->Set("SR1",doSR1);
		lup->Set("SR2",doSR2);
		lup->Set("SR3",doSR3);
		lup->Set("1ELECTRON",do1Electron);
		lup->Set("1MUON",do1Muon);
		lup->Set("2ELECTRON",do2Electron);
		lup->Set("2MUON",do2Muon);
		lup->Set("WRITETREES",doWriteTrees);
		//lup->Set("DEBUG",true);
		chain->Add("ANALYSIS",lup);

		Config* ldown = new Config("ldown");
		ldown->Set("ANALYSIS","susybkg");
		ldown->Set("BTAG",7);
		ldown->Set("0LEPTON",do0Lepton);
		ldown->Set("4JET",do4Jet);
		ldown->Set("6JET",do6Jet);
		ldown->Set("SR1",doSR1);
		ldown->Set("SR2",doSR2);
		ldown->Set("SR3",doSR3);
		ldown->Set("1ELECTRON",do1Electron);
		ldown->Set("1MUON",do1Muon);
		ldown->Set("2ELECTRON",do2Electron);
		ldown->Set("2MUON",do2Muon);
		ldown->Set("WRITETREES",doWriteTrees);
		//ldown->Set("DEBUG",true);
		chain->Add("ANALYSIS",ldown);
		
		if(fancyBtagErr) {
			for(int i = 0; i<4; ++i) {
				for(int j = 0; j<1; ++j) {
					Config* bstat_up = new Config(TString::Format("bup_%i_%i",i+1,j+1));
					bstat_up->Set("ANALYSIS","susybkg");
					bstat_up->Set("BTAG",8);
					bstat_up->Set("BTAGFLAVOR",0);
					bstat_up->Set("BTAGDIR",0);	
					bstat_up->Set("BTAGPTBIN",i+1);
					bstat_up->Set("BTAGETABIN",j+1);
					bstat_up->Set("0LEPTON",do0Lepton);
					bstat_up->Set("4JET",do4Jet);
					bstat_up->Set("6JET",do6Jet);
					bstat_up->Set("SR1",doSR1);
					bstat_up->Set("SR2",doSR2);
					bstat_up->Set("SR3",doSR3);
					bstat_up->Set("1ELECTRON",do1Electron);
					bstat_up->Set("1MUON",do1Muon);
					bstat_up->Set("2ELECTRON",do2Electron);
					bstat_up->Set("2MUON",do2Muon);
					bstat_up->Set("WRITETREES",doWriteTrees);
					//bstat_up->Set("DEBUG",true);
					chain->Add("ANALYSIS",bstat_up);
					
					Config* bstat_down = new Config(TString::Format("bdown_%i_%i",i+1,j+1));
					bstat_down->Set("ANALYSIS","susybkg");
					bstat_down->Set("BTAG",8);
					bstat_down->Set("BTAGFLAVOR",0);
					bstat_down->Set("BTAGDIR",1);	
					bstat_down->Set("BTAGPTBIN",i+1);
					bstat_down->Set("BTAGETABIN",j+1);
					bstat_down->Set("0LEPTON",do0Lepton);
					bstat_down->Set("4JET",do4Jet);
					bstat_down->Set("6JET",do6Jet);
					bstat_down->Set("SR1",doSR1);
					bstat_down->Set("SR2",doSR2);
					bstat_down->Set("SR3",doSR3);
					bstat_down->Set("1ELECTRON",do1Electron);
					bstat_down->Set("1MUON",do1Muon);
					bstat_down->Set("2ELECTRON",do2Electron);
					bstat_down->Set("2MUON",do2Muon);
					bstat_down->Set("WRITETREES",doWriteTrees);
					//bstat_down->Set("DEBUG",true);
					chain->Add("ANALYSIS",bstat_down);
				}
			}
	
			for(int i = 0; i<1; ++i) {
				for(int j = 0; j<1; ++j) {
					Config* cstat_up = new Config(TString::Format("cup_%i_%i",i+1,j+1));
					cstat_up->Set("ANALYSIS","susybkg");
					cstat_up->Set("BTAG",8);
					cstat_up->Set("BTAGFLAVOR",1);
					cstat_up->Set("BTAGDIR",0);	
					cstat_up->Set("BTAGPTBIN",i+1);
					cstat_up->Set("BTAGETABIN",j+1);
					cstat_up->Set("0LEPTON",do0Lepton);
					cstat_up->Set("4JET",do4Jet);
					cstat_up->Set("6JET",do6Jet);
					cstat_up->Set("SR1",doSR1);
					cstat_up->Set("SR2",doSR2);
					cstat_up->Set("SR3",doSR3);
					cstat_up->Set("1ELECTRON",do1Electron);
					cstat_up->Set("1MUON",do1Muon);
					cstat_up->Set("2ELECTRON",do2Electron);
					cstat_up->Set("2MUON",do2Muon);
					cstat_up->Set("WRITETREES",doWriteTrees);
					//cstat_up->Set("DEBUG",true);
					chain->Add("ANALYSIS",cstat_up);
					
					Config* cstat_down = new Config(TString::Format("cdown_%i_%i",i+1,j+1));
					cstat_down->Set("ANALYSIS","susybkg");
					cstat_down->Set("BTAG",8);
					cstat_down->Set("BTAGFLAVOR",1);
					cstat_down->Set("BTAGDIR",1);	
					cstat_down->Set("BTAGPTBIN",i+1);
					cstat_down->Set("BTAGETABIN",j+1);
					cstat_down->Set("0LEPTON",do0Lepton);
					cstat_down->Set("4JET",do4Jet);
					cstat_down->Set("6JET",do6Jet);
					cstat_down->Set("SR1",doSR1);
					cstat_down->Set("SR2",doSR2);
					cstat_down->Set("SR3",doSR3);
					cstat_down->Set("1ELECTRON",do1Electron);
					cstat_down->Set("1MUON",do1Muon);
					cstat_down->Set("2ELECTRON",do2Electron);
					cstat_down->Set("2MUON",do2Muon);
					cstat_down->Set("WRITETREES",doWriteTrees);
					//cstat_down->Set("DEBUG",true);
					chain->Add("ANALYSIS",cstat_down);
				}
			}
			
			for(int i = 0; i<1; ++i) {
				for(int j = 0; j<1; ++j) {
					Config* lstat_up = new Config(TString::Format("lup_%i_%i",i+1,j+1));
					lstat_up->Set("ANALYSIS","susybkg");
					lstat_up->Set("BTAG",8);
					lstat_up->Set("BTAGFLAVOR",2);
					lstat_up->Set("BTAGDIR",0);	
					lstat_up->Set("BTAGPTBIN",i+1);
					lstat_up->Set("BTAGETABIN",j+1);
					lstat_up->Set("0LEPTON",do0Lepton);
					lstat_up->Set("4JET",do4Jet);
					lstat_up->Set("6JET",do6Jet);
					lstat_up->Set("SR1",doSR1);
					lstat_up->Set("SR2",doSR2);
					lstat_up->Set("SR3",doSR3);
					lstat_up->Set("1ELECTRON",do1Electron);
					lstat_up->Set("1MUON",do1Muon);
					lstat_up->Set("2ELECTRON",do2Electron);
					lstat_up->Set("2MUON",do2Muon);
					lstat_up->Set("WRITETREES",doWriteTrees);
					//lstat_up->Set("DEBUG",true);
					chain->Add("ANALYSIS",lstat_up);
					
					Config* lstat_down = new Config(TString::Format("ldown_%i_%i",i+1,j+1));
					lstat_down->Set("ANALYSIS","susybkg");
					lstat_down->Set("BTAG",8);
					lstat_down->Set("BTAGFLAVOR",2);
					lstat_down->Set("BTAGDIR",1);				
					lstat_down->Set("BTAGPTBIN",i+1);
					lstat_down->Set("BTAGETABIN",j+1);
					lstat_down->Set("0LEPTON",do0Lepton);
					lstat_down->Set("4JET",do4Jet);
					lstat_down->Set("6JET",do6Jet);
					lstat_down->Set("SR1",doSR1);
					lstat_down->Set("SR2",doSR2);
					lstat_down->Set("SR3",doSR3);
					lstat_down->Set("1ELECTRON",do1Electron);
					lstat_down->Set("1MUON",do1Muon);
					lstat_down->Set("2ELECTRON",do2Electron);
					lstat_down->Set("2MUON",do2Muon);
					lstat_down->Set("WRITETREES",doWriteTrees);
					//lstat_down->Set("DEBUG",true);
					chain->Add("ANALYSIS",lstat_down);
				}
			}
		}

		Config* jesup = new Config("jesup",configfile);
		jesup->Set("ANALYSIS","susybkg");
		jesup->Set("MCWEIGHTS",mcweights);
		jesup->Set("JETSYS",1);
		jesup->Set("BTAG",1);
		jesup->Set("NOBTAGSF",noBtagSFs);
		jesup->Set("PILE",doPRW);
		jesup->Set("HFT",doHFT);
		jesup->Set("0LEPTON",do0Lepton);
		jesup->Set("4JET",do4Jet);
		jesup->Set("6JET",do6Jet);
		jesup->Set("SR1",doSR1);
		jesup->Set("SR2",doSR2);
		jesup->Set("SR3",doSR3);
		jesup->Set("1ELECTRON",do1Electron);
		jesup->Set("1MUON",do1Muon);
		jesup->Set("2ELECTRON",do2Electron);
		jesup->Set("2MUON",do2Muon);
		jesup->Set("FAKENU",doFakeNu);
		jesup->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		jesup->Set("WRITETREES",doWriteTrees);
		jesup->Write();
	
		Config* jesdown = new Config("jesdown",configfile);
		jesdown->Set("ANALYSIS","susybkg");
		jesdown->Set("MCWEIGHTS",mcweights);
		jesdown->Set("JETSYS",2);
		jesdown->Set("BTAG",1);
		jesdown->Set("NOBTAGSF",noBtagSFs);
		jesdown->Set("PILE",doPRW);
		jesdown->Set("HFT",doHFT);
		jesdown->Set("0LEPTON",do0Lepton);
		jesdown->Set("4JET",do4Jet);
		jesdown->Set("6JET",do6Jet);
		jesdown->Set("SR1",doSR1);
		jesdown->Set("SR2",doSR2);
		jesdown->Set("SR3",doSR3);
		jesdown->Set("1ELECTRON",do1Electron);
		jesdown->Set("1MUON",do1Muon);
		jesdown->Set("2ELECTRON",do2Electron);
		jesdown->Set("2MUON",do2Muon);
		jesdown->Set("FAKENU",doFakeNu);
		jesdown->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		jesdown->Set("WRITETREES",doWriteTrees);
		jesdown->Write();
		
		Config* jer = new Config("jer",configfile);
		jer->Set("ANALYSIS","susybkg");
		jer->Set("MCWEIGHTS",mcweights);
		jer->Set("JETSYS",3);
		jer->Set("BTAG",1);
		jer->Set("NOBTAGSF",noBtagSFs);
		jer->Set("PILE",doPRW);
		jer->Set("HFT",doHFT);
		jer->Set("0LEPTON",do0Lepton);
		jer->Set("4JET",do4Jet);
		jer->Set("6JET",do6Jet);
		jer->Set("SR1",doSR1);
		jer->Set("SR2",doSR2);
		jer->Set("SR3",doSR3);
		jer->Set("1ELECTRON",do1Electron);
		jer->Set("1MUON",do1Muon);
		jer->Set("2ELECTRON",do2Electron);
		jer->Set("2MUON",do2Muon);
		jer->Set("FAKENU",doFakeNu);
		jer->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		jer->Set("WRITETREES",doWriteTrees);
		jer->Write();

		Config* scalestup = new Config("scalestup",configfile);
		scalestup->Set("ANALYSIS","susybkg");
		scalestup->Set("MCWEIGHTS",mcweights);
		scalestup->Set("METSYS",1);
		scalestup->Set("BTAG",1);
		scalestup->Set("NOBTAGSF",noBtagSFs);
		scalestup->Set("PILE",doPRW);
		scalestup->Set("HFT",doHFT);
		scalestup->Set("0LEPTON",do0Lepton);
		scalestup->Set("4JET",do4Jet);
		scalestup->Set("6JET",do6Jet);
		scalestup->Set("SR1",doSR1);
		scalestup->Set("SR2",doSR2);
		scalestup->Set("SR3",doSR3);
		scalestup->Set("1ELECTRON",do1Electron);
		scalestup->Set("1MUON",do1Muon);
		scalestup->Set("2ELECTRON",do2Electron);
		scalestup->Set("2MUON",do2Muon);
		scalestup->Set("FAKENU",doFakeNu);
		scalestup->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		scalestup->Set("WRITETREES",doWriteTrees);
		scalestup->Write();
	
		Config* scalestdown = new Config("scalestdown",configfile);
		scalestdown->Set("ANALYSIS","susybkg");
		scalestdown->Set("MCWEIGHTS",mcweights);
		scalestdown->Set("METSYS",2);
		scalestdown->Set("BTAG",1);
		scalestdown->Set("NOBTAGSF",noBtagSFs);
		scalestdown->Set("PILE",doPRW);
		scalestdown->Set("HFT",doHFT);
		scalestdown->Set("0LEPTON",do0Lepton);
		scalestdown->Set("4JET",do4Jet);
		scalestdown->Set("6JET",do6Jet);
		scalestdown->Set("SR1",doSR1);
		scalestdown->Set("SR2",doSR2);
		scalestdown->Set("SR3",doSR3);
		scalestdown->Set("1ELECTRON",do1Electron);
		scalestdown->Set("1MUON",do1Muon);
		scalestdown->Set("2ELECTRON",do2Electron);
		scalestdown->Set("2MUON",do2Muon);
		scalestdown->Set("FAKENU",doFakeNu);
		scalestdown->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		scalestdown->Set("WRITETREES",doWriteTrees);
		scalestdown->Write();
		
		Config* resostup = new Config("resostup",configfile);
		resostup->Set("ANALYSIS","susybkg");
		resostup->Set("MCWEIGHTS",mcweights);
		resostup->Set("METSYS",3);
		resostup->Set("BTAG",1);
		resostup->Set("NOBTAGSF",noBtagSFs);
		resostup->Set("PILE",doPRW);
		resostup->Set("HFT",doHFT);
		resostup->Set("0LEPTON",do0Lepton);
		resostup->Set("4JET",do4Jet);
		resostup->Set("6JET",do6Jet);
		resostup->Set("SR1",doSR1);
		resostup->Set("SR2",doSR2);
		resostup->Set("SR3",doSR3);
		resostup->Set("1ELECTRON",do1Electron);
		resostup->Set("1MUON",do1Muon);
		resostup->Set("2ELECTRON",do2Electron);
		resostup->Set("2MUON",do2Muon);
		resostup->Set("FAKENU",doFakeNu);
		resostup->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		resostup->Set("WRITETREES",doWriteTrees);
		resostup->Write();
	
		Config* resostdown = new Config("resostdown",configfile);
		resostdown->Set("ANALYSIS","susybkg");
		resostdown->Set("MCWEIGHTS",mcweights);
		resostdown->Set("METSYS",4);
		resostdown->Set("BTAG",1);
		resostdown->Set("NOBTAGSF",noBtagSFs);
		resostdown->Set("PILE",doPRW);
		resostdown->Set("HFT",doHFT);
		resostdown->Set("0LEPTON",do0Lepton);
		resostdown->Set("4JET",do4Jet);
		resostdown->Set("6JET",do6Jet);
		resostdown->Set("SR1",doSR1);
		resostdown->Set("SR2",doSR2);
		resostdown->Set("SR3",doSR3);
		resostdown->Set("1ELECTRON",do1Electron);
		resostdown->Set("1MUON",do1Muon);
		resostdown->Set("2ELECTRON",do2Electron);
		resostdown->Set("2MUON",do2Muon);
		resostdown->Set("FAKENU",doFakeNu);
		resostdown->Set("KILLZNUNUZBB",doKillZnunuZbb);	
		resostdown->Set("WRITETREES",doWriteTrees);
		resostdown->Write();
	}
	
	//Write chain (nominal analysis + b-tagging systematics/matrix method, identical eventbuilder result, just reweighted)
	chain->Write();	

	//ProofAna global Config object
	Config* confProofAna = new Config("ProofAna");
	//confProofAna->Set("DEBUG",true); 	// "false", 0, "0" etc. also works
	//confProofAna->Set("MERGE",false);	// enable dataset mode
	//confProofAna->Set("NFILES",1000000); 	// how many input files to merge per worker in dataset mode, very large number = 49 output files
	confProofAna->Set("SAVETIMERS",false); 	// ProofAna timer histograms in output file
	//confProofAna->Set("COUNTER",1);
	confProofAna->Set("IDENTIFIER",identifier);
	confProofAna->Set("DATASET",dataset);
	confProofAna->Set("OUTPUTPATH",path);
	confProofAna->Set("EVENTBUILDER",eventbuilder);

	ReadDatasetInfo(dataset,confProofAna); //Reads information used in MC weighting, multi-dataset jobs
	TString treename;
	if(!confProofAna->Get("TREENAME",treename)) {
		cout << "TREENAME not set in dataset config file, exiting" << endl;
		return;
	} 
	confProofAna->Write();	

	bool isAF2 = false;
	confProofAna->Get("AF2",isAF2);	
	WriteSUSYObjDefObject(options, isData, isAF2);
	
	WriteGRLObject(chain->String("GRL"));	
	WriteMuonTrigReweighterObjects(options);
	WriteMuonTriggerSFToolObject(options);
	//WriteMultijetJESUncertaintyObject(options);
	//WriteBTagCalibObject(options,"SV0","5_85");
	//WriteBTagCalibObject(options,"JetFitterCOMBNN","1_80");
	//WriteBTagCalibObject(options,"JetFitterCOMBNN","0_35");
	//WriteBTagCalibObject(options,"JetFitterCOMBNN","-1_25");
	WriteBTagCalibObject(options,"MV1","0_905363");
	WriteBTagCalibObject(options,"MV1","0_601713");
	WriteBTagCalibObject(options,"MV1","0_404219");
	//WriteJERObject(options);
	Write0LeptonPileupReweightingObject(options);
	Write1ElectronPileupReweightingObject(options);
	Write1MuonPileupReweightingObject(options);
	WriteFakeMetEstimator(options);
	WriteSmearingReweightHist(options);
	WriteElectronMMObject(options);
	
	options->Close();
	delete options;
	
	if(mode.CompareTo("local")==0) runLocal(dataset,treename);
  	else if(mode.CompareTo("grid")==0) {
    		TString prefix = "user."+username+"."+identifier;
		runGrid(prefix);
	}
	else runProof(url,dataset,-1,treename);
	
	gSystem->Unlink("options.root");
}
Esempio n. 2
0
void runGRJETSv11(TString mode       = "lite",            // local, lite, or cluster
               TString identifier = "run1",               // tag 
               TString dataset    = "Wprime1200.GRJETSv11",  // dataset name as in the fileList  
               TString username   = "******",           // username (e.g. swiatlow, fizisist)
               bool mcweights     = false,                 // use mc weights?
               bool doHists       = true,                 // do histograms or enable dataset mode 
               bool doSys         = false,                // do systematics 
               bool debug         = false,                // turn on debugging
               int  nWorkers      = 4                     //specify number of workers for proof(-1 for all available)
             ) 
{
    
    ///----------------------------------------------------------------
    /// Load libraries , set the config file, treenam, and cluster info
    ///----------------------------------------------------------------

    TString gridusername = "******";
    cout << "trying to load libraries" << endl;
    loadLibraries();

    cout << " Libraries loaded " << endl;

    // SetConfig
    TString configfile("../config/grjetsv11.config");

    // Change if defaulting to wrong TTree, otherwise leave
    TString treename("jets");
    
    // Best to leave alone  
    TString pathLite("");

    TString pathCluster("root://atlprf01.slac.stanford.edu:2094//atlas/output/");

    pathCluster.Append(username);
    pathCluster.Append("/");



    // Determine eventbuilder from dataset name
    TString eventbuilder(dataset);
    eventbuilder.Remove(0,eventbuilder.Last('.')+1);
    
    ///----------------------------------------------------------------
    /// Filename paths, URLs for PROOF running
    ///----------------------------------------------------------------
    TString url(mode);
    TString path("");
    if (mode.CompareTo("lite")==0) {
        url = "lite://";
        path = pathLite;
    }
    else if(mode.CompareTo("cluster")==0) {
      url = TString(username+"@atlprf01.slac.stanford.edu");
      path = pathCluster;
    }
    // Make an options file, edit as needed
    TFile* options = new TFile("options.root","RECREATE");

    ///----------------------------------------------------------------
    /// Overall Configuration
    ///----------------------------------------------------------------
    bool doPRW           = false;
    bool doBasic         = true;
    bool doTruthLinks    = false;
    bool doTrackJetLinks = true;
    bool doTruthJetLinks = true;
    bool doJetStructure  = true;
    bool doConstituents  = true;
    bool doTruthConstit  = true;
    bool doParentChild   = true;
    bool doTrack         = true;
    bool doLCCluster     = true;
    bool doEMCluster     = false;
    bool doTruth         = true;
    bool doVertex        = true;
    bool doPhotons       = false;
    
    /// JET TYPES
    bool doSomeJetTypes  = false;
    bool doMinJetTypes   = true;
    
    /// SELECTIONS
    float minJetPt       =  20.000;
    float maxJetEta      =   3.199;
    float minFatJetPt    = 100.000;
    float minJetJVF      =   0.750;
    float maxJetTrkDR    =   0.300;
    float maxJetTruthDR  =   0.300;
    TString badJetType   = "AntiKt4LCTopoAOD";
    TString badJetDef    = "isBadLooseMinus";
    
    /// Substructure
    int   nStdJetCut     = 4;
    float lowMassCRcut   = 100.000;
    float threeBodyCRcut =   0.700;
    
    ///----------------------------------------------------------------
    /// Jet types
    ///----------------------------------------------------------------
    
    TString aktCal = "AntiKt10LCTopo";
    TString aktTrk = "AntiKt10TrackZ";
    TString aktTru = "AntiKt10Truth";
    TString caCal  = "CamKt12LCTopo";
    TString caTrk  = "CamKt12TrackZ";
    TString caTru  = "CamKt12Truth";
    
    TString aktCalTrim = "AntiKt10LCTopoTrimmedPtFrac1SmallR20,AntiKt10LCTopoTrimmedPtFrac3SmallR20,AntiKt10LCTopoTrimmedPtFrac5SmallR20,AntiKt10LCTopoTrimmedPtFrac1SmallR30,AntiKt10LCTopoTrimmedPtFrac3SmallR30,AntiKt10LCTopoTrimmedPtFrac5SmallR30";
    TString aktCalPrun = "AntiKt10LCTopoPrunedKtRcutFactor10Zcut5,AntiKt10LCTopoPrunedKtRcutFactor20Zcut5,AntiKt10LCTopoPrunedKtRcutFactor30Zcut5,AntiKt10LCTopoPrunedKtRcutFactor10Zcut10,AntiKt10LCTopoPrunedKtRcutFactor20Zcut10,AntiKt10LCTopoPrunedKtRcutFactor30Zcut10";
    TString aktTrkTrim = "AntiKt10TrackZTrimmedPtFrac1SmallR20,AntiKt10TrackZTrimmedPtFrac3SmallR20,AntiKt10TrackZTrimmedPtFrac5SmallR20,AntiKt10TrackZTrimmedPtFrac1SmallR30,AntiKt10TrackZTrimmedPtFrac3SmallR30,AntiKt10TrackZTrimmedPtFrac5SmallR30";
    TString aktTrkPrun = "AntiKt10TrackZPrunedKtRcutFactor10Zcut5,AntiKt10TrackZPrunedKtRcutFactor20Zcut5,AntiKt10TrackZPrunedKtRcutFactor30Zcut5,AntiKt10TrackZPrunedKtRcutFactor10Zcut10,AntiKt10TrackZPrunedKtRcutFactor20Zcut10,AntiKt10TrackZPrunedKtRcutFactor30Zcut10";
    TString aktTruTrim = "AntiKt10TruthTrimmedPtFrac1SmallR20,AntiKt10TruthTrimmedPtFrac3SmallR20,AntiKt10TruthTrimmedPtFrac5SmallR20,AntiKt10TruthTrimmedPtFrac1SmallR30,AntiKt10TruthTrimmedPtFrac3SmallR30,AntiKt10TruthTrimmedPtFrac5SmallR30";
    TString aktTruPrun = "AntiKt10TruthPrunedKtRcutFactor10Zcut5,AntiKt10TruthPrunedKtRcutFactor20Zcut5,AntiKt10TruthPrunedKtRcutFactor30Zcut5,AntiKt10TruthPrunedKtRcutFactor10Zcut10,AntiKt10TruthPrunedKtRcutFactor20Zcut10,AntiKt10TruthPrunedKtRcutFactor30Zcut10";
    
    TString caCalTrim  = "CamKt12LCTopoTrimmedPtFrac1SmallR20,CamKt12LCTopoTrimmedPtFrac3SmallR20,CamKt12LCTopoTrimmedPtFrac5SmallR20,CamKt12LCTopoTrimmedPtFrac1SmallR30,CamKt12LCTopoTrimmedPtFrac3SmallR30,CamKt12LCTopoTrimmedPtFrac5SmallR30";
    TString caCalPrun  = "CamKt12LCTopoPrunedKtRcutFactor10Zcut5,CamKt12LCTopoPrunedKtRcutFactor20Zcut5,CamKt12LCTopoPrunedKtRcutFactor30Zcut5,CamKt12LCTopoPrunedKtRcutFactor10Zcut10,CamKt12LCTopoPrunedKtRcutFactor20Zcut10,CamKt12LCTopoPrunedKtRcutFactor30Zcut10";
    TString caCalFilt  = "CamKt12LCTopoSplitFilteredmassFraction20minSplitR0,CamKt12LCTopoSplitFilteredmassFraction33minSplitR0,CamKt12LCTopoSplitFilteredmassFraction67minSplitR0";
    TString caTrkTrim  = "CamKt12TrackZTrimmedPtFrac1SmallR20,CamKt12TrackZTrimmedPtFrac3SmallR20,CamKt12TrackZTrimmedPtFrac5SmallR20,CamKt12TrackZTrimmedPtFrac1SmallR30,CamKt12TrackZTrimmedPtFrac3SmallR30,CamKt12TrackZTrimmedPtFrac5SmallR30";
    TString caTrkPrun  = "CamKt12TrackZPrunedKtRcutFactor10Zcut5,CamKt12TrackZPrunedKtRcutFactor20Zcut5,CamKt12TrackZPrunedKtRcutFactor30Zcut5,CamKt12TrackZPrunedKtRcutFactor10Zcut10,CamKt12TrackZPrunedKtRcutFactor20Zcut10,CamKt12TrackZPrunedKtRcutFactor30Zcut10";
    TString caTrkFilt  = "CamKt12TrackZSplitFilteredmassFraction20minSplitR0,CamKt12TrackZSplitFilteredmassFraction33minSplitR0,CamKt12TrackZSplitFilteredmassFraction67minSplitR0";
    TString caTruTrim  = "CamKt12TruthTrimmedPtFrac1SmallR20,CamKt12TruthTrimmedPtFrac3SmallR20,CamKt12TruthTrimmedPtFrac5SmallR20,CamKt12TruthTrimmedPtFrac1SmallR30,CamKt12TruthTrimmedPtFrac3SmallR30,CamKt12TruthTrimmedPtFrac5SmallR30";
    TString caTruPrun  = "CamKt12TruthPrunedKtRcutFactor10Zcut5,CamKt12TruthPrunedKtRcutFactor20Zcut5,CamKt12TruthPrunedKtRcutFactor30Zcut5,CamKt12TruthPrunedKtRcutFactor10Zcut10,CamKt12TruthPrunedKtRcutFactor20Zcut10,CamKt12TruthPrunedKtRcutFactor30Zcut10";
    TString caTruFilt  = "CamKt12TruthSplitFilteredmassFraction20minSplitR0,CamKt12TruthSplitFilteredmassFraction33minSplitR0,CamKt12TruthSplitFilteredmassFraction67minSplitR0";
    
    
    //// Make derived lists
    TString aktData = aktCal + "," + aktTrk + "," + aktCalTrim + "," + aktCalPrun + "," + aktTrkTrim + "," + aktTrkPrun;
    TString aktMC   = aktTru + "," + aktTruTrim + "," + aktTruPrun;
    
    TString caData = caCal + "," + caTrk + "," + caCalTrim + "," + caCalPrun + "," + caCalFilt + "," + caTrkTrim + "," + caTrkPrun + "," + caTrkFilt;
    TString caMC   = caTru + "," + caTruTrim + "," + caTruPrun + "," + caTruFilt;
    
    
    //// DEFAULT FULL LIST
    TString jetTypes = aktData + "," + caData;
    if (!dataset.Contains("data")) jetTypes += "," + aktMC + "," + caMC;

    //// REDUCED SET OF JETS
    if (doSomeJetTypes) {
      jetTypes   = "AntiKt10LCTopo,CamKt12LCTopo,AntiKt10LCTopoTrimmedPtFrac3SmallR30,AntiKt10LCTopoTrimmedPtFrac5SmallR30,CamKt12LCTopoSplitFilteredmassFraction67minSplitR0,AntiKt10TrackZ,CamKt12TrackZ,AntiKt10TrackZTrimmedPtFrac3SmallR30,AntiKt10TrackZTrimmedPtFrac5SmallR30,CamKt12TrackZSplitFilteredmassFraction67minSplitR0";
        if (!dataset.Contains("data")) jetTypes += ",AntiKt10Truth,CamKt12Truth,AntiKt10TruthTrimmedPtFrac3SmallR30,AntiKt10TruthTrimmedPtFrac5SmallR30,CamKt12TruthSplitFilteredmassFraction67minSplitR0";
    }
    
    else if (!doSomeJetTypes && doMinJetTypes) {
      jetTypes   = "AntiKt10LCTopo,CamKt12LCTopo,AntiKt10LCTopoTrimmedPtFrac5SmallR30,CamKt12LCTopoSplitFilteredmassFraction67minSplitR0,AntiKt10TrackZ,CamKt12TrackZ,AntiKt10TrackZTrimmedPtFrac5SmallR30,CamKt12TrackZSplitFilteredmassFraction67minSplitR0";
        if (!dataset.Contains("data")) jetTypes += ",AntiKt10Truth,CamKt12Truth,AntiKt10TruthTrimmedPtFrac5SmallR30,CamKt12TruthSplitFilteredmassFraction67minSplitR0";
    }
        
    //jetTypes = aktCal + "," + aktTrk + "," + aktCalTrim + "," + aktTrkTrim;
    //jetTypes = caCal + "," + caTrk + "," + caCalTrim + "," + caTrkTrim;
    //jetTypes = aktCalPrun + "," + aktTrkPrun + "," + caCalPrun + "," + caTrkPrun;
    //jetTypes = caCalFilt + "," + caTrkFilt;
  
    
    // Be careful when loading up subjettypes and btagtypes: check that 
    // these exist in the D3PD before trying to register them!
    TString subjetTypes = "AntiKt10LCTopoTrimmedSubjetsPtFrac3SmallR30,AntiKt10TrackZTrimmedSubjetsPtFrac3SmallR30,AntiKt10TruthTrimmedSubjetsPtFrac3SmallR30";
    TString btagTypes = "AntiKt10LCTopoTrimmedSubjetsPtFrac3SmallR30";


    ///---------------------------------------------------------------
    /// New jet types! These will be constructed on the fly
    ///---------------------------------------------------------------

    TString baseCustomTrimming = "AntiKtLCTopo15";
    TString ptFracCustomTrimming = "0.05";
    TString smallRCustomTrimming = "0.3";


    ///----------------------------------------------------------------
    /// Nominal Configuration
    ///----------------------------------------------------------------
    Config* chain = new Config("chain",configfile);
    chain->AddVec("ANALYSIS");


    Config* setup = new Config("setup", configfile);
    setup->Set("ANALYSIS","GRJETSexample_setup");
    setup->Set("DEBUG",debug);
    chain->Add("ANALYSIS",setup);

    Config* example = new Config("example", configfile);
    example->Set("ANALYSIS","GRJETSexample");
    example->Set("DEBUG",debug);
    chain->Add("ANALYSIS",example);
    

    cout << endl << "+++ Using jet types: " << jetTypes << endl << endl;


    chain->Set("MCWEIGHTS"       , mcweights       );
    chain->Set("DEBUG"           , debug           );
    chain->Set("PILE"            , doPRW           );
    chain->Set("DOBASIC"         , doBasic         );
    chain->Set("DOTRUTHLINKS"    , doTruthLinks    );
    chain->Set("DOTRACKJETLINKS" , doTrackJetLinks );
    chain->Set("DOTRUTHJETLINKS" , doTruthJetLinks );
    chain->Set("DOJETSTRUCT"     , doJetStructure  );
    chain->Set("DOCONSTIT"       , doConstituents  );
    chain->Set("DOTRUTHCONSTIT"  , doTruthConstit  );
    chain->Set("DOPARENTCHILD"   , doParentChild   );
    chain->Set("DOTRACK"         , doTrack         );
    chain->Set("DOLCCLUSTER"     , doLCCluster     );
    chain->Set("DOEMCLUSTER"     , doEMCluster     );
    chain->Set("DOTRUTH"         , doTruth         );
    chain->Set("DOVTX"           , doVertex        );
    chain->Set("DOPHOTON"        , doPhotons       );
    
    /// Set Systematics
    chain->Set("DOTRACKSYST"     , false           );
    chain->Set("DOJETSYS"        , 0               );
    
    /// Set cuts and jet types and such
    chain->Set("BASECUSTOMTRIMMING",   baseCustomTrimming);
    chain->Set("PTFRACCUSTOMTRIMMING", ptFracCustomTrimming);
    chain->Set("SMALLRCUSTOMTRIMMING", smallRCustomTrimming);
    chain->Set("JETTYPES"       , jetTypes         );
    chain->Set("SUBJETTYPES"    , subjetTypes      );
    chain->Set("BTAGTYPES"      , btagTypes        );
    chain->Set("BADJETTYPE"     , badJetType       );
    chain->Set("BADJETDEF"      , badJetDef        );
    chain->Set("MINJETPT"       , minJetPt         );
    chain->Set("MAXJETETA"      , maxJetEta        );
    chain->Set("MINFATJETPT"    , minFatJetPt      );
    chain->Set("MAXFATJETETA"   , maxJetEta        );
    chain->Set("MINJETJVF"      , minJetJVF        );
    chain->Set("MAXJETTRKJETDR" , maxJetTrkDR      );
    chain->Set("MAXTRUTHJETDR"  , maxJetTruthDR    );
    
    chain->Set("NStdJetCut"     , 4                );
    chain->Set("LowMassCRcut"   , 100.             );
    chain->Set("ThreeBodyCRcut" , 0.7              );
    chain->Set("y12CRcut"       , 0.4              );
    
    ///----------------------------------------------------------------
    /// Trigger Information
    ///----------------------------------------------------------------
    TString trigTypes  = "EF_j360_a10tcem";
    TString trigParams = "jet_AntiKt10LCTopo_pt";
    TString trigCuts   = "450000.";               /// NEEDS TO BE IN MEV
    TString trigLumis  = "5725.04";               /// UPDATE ME!
    
    chain->Set("TRIGTYPES"      , trigTypes      );
    chain->Set("TRIGPARAM"      , trigParams     );
    chain->Set("TRIGCUT"        , trigCuts       );
    chain->Set("TRIGLUMI"       , trigLumis      );
    
    ///----------------------------------------------------------------
    /// Luminosity for trigger weighting
    ///----------------------------------------------------------------
    Float_t lumiVal = 5725.04;
    
    chain->Set("LUMI"           , lumiVal        );
    
    chain->Write();

    if (chain->Exists("GRL")) WriteGRLObject(chain->String("GRL"));  
  
		
	

    ///----------------------------------------------------------------
    /// ProofAna global Config object
    ///----------------------------------------------------------------
    Config* confProofAna = new Config("ProofAna");
    
    confProofAna->Set("DEBUG"          , false        );  // "false", 0, "0" etc. also works
    confProofAna->Set("SAVETIMERS"     , false        );  // ProofAna timer histos in output file 
    confProofAna->Set("IDENTIFIER"     , identifier   );
    confProofAna->Set("DATASET"        , dataset      );
    confProofAna->Set("OUTPUTPATH"     , path         );
    confProofAna->Set("EVENTBUILDER"   , eventbuilder );
    if (!doHists) 
      confProofAna->Set("MERGE"        , false        );     // enable dataset mode
    
    ///----------------------------------------------------------------
    /// Read information used in MC weighting, multi-dataset jobs
    ///----------------------------------------------------------------
    ReadDatasetInfo(dataset  , confProofAna  ); 
    WriteGroomedPRWO(options , "EF_j360_a10tcem_PeriodB" );
    confProofAna->Write();  
    options->Close();
    delete options;


    cout << "All setup, ready to go " << endl;    
    // Decide to run local or on the cluster
    if (mode.CompareTo("local") == 0) runLocal(dataset, treename);
    else if(mode.CompareTo("lite")==0||mode.CompareTo("cluster")==0) 
      runProof(url,dataset,-1,treename);
    else if(mode.CompareTo("grid")==0){
      TString gridname = "user."+gridusername+"."+identifier;
      cout << "submitting with gridname " << gridname << endl;
      runGrid(gridname);
    }   
    gSystem->Unlink("options.root");
}
Esempio n. 3
0
void runSusyOpt(TString mode = "cluster", TString identifier = "myTest", TString dataset = "su4.susy1004", TString username = "******", bool mcweights = true, bool sys = true) 
{
	//options for mode are local, lite, or cluster

	LoadLibraries();
    
	//General user run options (now set in run command)
	//TString identifier("myTest"); //unique identifier for this job
	//TString dataset("test.example"); //dataset name
	//TString username("bcbutler"); //username for cluster, not important otherwise

	//SetConfig
	TString configfile("../config/periodsB-K.config");

	// Change if defaulting to wrong TTree, otherwise leave
	TString treename("");
	
	// Best to leave alone	
	TString pathLite("");
	
	//TString pathCluster("root://atlprf01.slac.stanford.edu:11094//atlas/local/");
	TString pathCluster("root://atlprf01.slac.stanford.edu:2094//atlas/output/");
	pathCluster.Append(username);
	pathCluster.Append("/");

	//Determine eventbuilder from dataset name
	TString eventbuilder(dataset);
	eventbuilder.Remove(0,eventbuilder.Last('.')+1);
	
	//Filename paths, URLs for PROOF running
	TString url(mode);
	TString path("");
	if(mode.CompareTo("lite")==0) {
		url = "lite://";
		path = pathLite;
	}
	else if(mode.CompareTo("cluster")==0) {
		url = TString(username+"@atlprf01.slac.stanford.edu");
		path = pathCluster;
	}
	
	//Make an options file, edit as needed
	TFile* options = new TFile("options.root","RECREATE");
	
	//Analyses Configs, change as needed
	bool do0Lepton = true;
	bool do1Electron = true;
	bool do1Muon = true;
	bool doFakeNu = false; //convert Zmumubb to Znunubb
	bool doDetail = true;
	bool doLocHad = false;
	bool doPRW = true;
	bool doTMN = true;
	bool doWriteTrees = eventbuilder.CompareTo("event") ? true : false;
	
	if(dataset.Contains("Egamma_")) {
		do0Lepton = false;
		do1Muon = false;
	}
	else if(dataset.Contains("Muons_")) {
		do0Lepton = false;
		do1Electron = false;
	}
	else if(dataset.Contains("JetTauEtmiss_")) {
		do1Electron = false;
		do1Muon = false;
	}	

	Config* nom = new Config("nom",configfile);
	nom->Set("ANALYSIS","susyopt");
	nom->Set("MCWEIGHTS",mcweights);
	nom->Set("PILE",doPRW);
	nom->Set("TMN",doTMN);
	nom->Set("0LEPTON",do0Lepton);
	nom->Set("1ELECTRON",do1Electron);
	nom->Set("1MUON",do1Muon);
	nom->Set("FAKENU",doFakeNu);
	nom->Set("DETAIL",doDetail);
	nom->Set("LOCHAD",doLocHad);
	nom->Set("WRITETREES",doWriteTrees);
	//nom->Set("DEBUG",true);
	nom->Write();
	if(nom->Exists("GRL")) WriteGRLObject(nom->String("GRL"),nom->GetName());	

	if(((!dataset.Contains("JetTauEtmiss_"))&&(!dataset.Contains("Egamma_"))&&(!dataset.Contains("Muons_")))&&(!dataset.Contains("ttslLAr"))&&sys) {	

		Config* jesup = new Config("jesup",configfile);
		jesup->Set("ANALYSIS","susyopt");
		jesup->Set("MCWEIGHTS",mcweights);
		jesup->Set("JETSYS",1);
		jesup->Set("PILE",doPRW);
		jesup->Set("TMN",doTMN);
		jesup->Set("0LEPTON",do0Lepton);
		jesup->Set("1ELECTRON",do1Electron);
		jesup->Set("1MUON",do1Muon);
		jesup->Set("FAKENU",doFakeNu);
		jesup->Set("WRITETREES",doWriteTrees);
		//jesup->Set("DEBUG",true);
		jesup->Write();
		if(jesup->Exists("GRL")) WriteGRLObject(jesup->String("GRL"),jesup->GetName());	
	
		Config* jesdown = new Config("jesdown",configfile);
		jesdown->Set("ANALYSIS","susyopt");
		jesdown->Set("MCWEIGHTS",mcweights);
		jesdown->Set("JETSYS",2);
		jesdown->Set("PILE",doPRW);
		jesdown->Set("TMN",doTMN);
		jesdown->Set("0LEPTON",do0Lepton);
		jesdown->Set("1ELECTRON",do1Electron);
		jesdown->Set("1MUON",do1Muon);
		jesdown->Set("FAKENU",doFakeNu);
		jesdown->Set("WRITETREES",doWriteTrees);
		//jesdown->Set("DEBUG",true);
		jesdown->Write();
		if(jesdown->Exists("GRL")) WriteGRLObject(jesdown->String("GRL"),jesdown->GetName());	
	}

	//ProofAna global Config object
	Config* confProofAna = new Config("ProofAna");
	//confProofAna->Set("DEBUG",true); 	// "false", 0, "0" etc. also works
	confProofAna->Set("SAVETIMERS",false); //ProofAna timer histograms in output file
	confProofAna->Set("IDENTIFIER",identifier);
	confProofAna->Set("DATASET",dataset);
	confProofAna->Set("OUTPUTPATH",path);
	confProofAna->Set("EVENTBUILDER",eventbuilder);
	ReadDatasetInfo(dataset,confProofAna); //Reads information used in MC weighting, multi-dataset jobs
	confProofAna->Write();	

	WriteSUSYObjDefObject(options);
	WriteMuonTrigReweightObject(options);
	WriteMuonTriggerSFToolObject(options);
	WriteMultijetJESUncertaintyObject(options);
	
	WriteBTagCalibObject(options,"JetFitterCOMBNN","2_00");
	WriteBTagCalibObject(options,"JetFitterCOMBNN","0_35");
	WriteBTagCalibObject(options,"JetFitterCOMBNN","-1_25");
	WriteBTagCalibObject(options,"SV0","5_85");
	WriteBTagCalibObject(options,"JetProb","3_25");
	WriteBTagCalibObject(options,"JetProb","2_05");
	WriteBTagCalibObject(options,"JetProb","1_40");
	WriteBTagCalibObject(options,"JetProb","0_60");
	
	WriteJERObject(options);
	Write0LeptonPileupReweightingObject(options);
	Write1ElectronPileupReweightingObject(options);
	Write1MuonPileupReweightingObject(options);

	options->Close();
	delete options;
	
	if(mode.CompareTo("local")==0) runLocal(dataset,treename);
	else runProof(url,dataset,-1,treename);
	
	gSystem->Unlink("options.root");
}