DWORD WINAPI MonitorThread(LPVOID lpParam) { Config *cfg = (Config *)lpParam; size_t pollint = atoi(cfg->Get("anchor.poll.interval").c_str()) * 1000; const char *anchor = cfg->Get("anchor.file").c_str(); while (true) { WIN32_FIND_DATA FindFileData; HANDLE hFind; if ((hFind = FindFirstFile(anchor, &FindFileData)) == INVALID_HANDLE_VALUE) { PostMessage(hCurrWnd, WM_CLOSE, 0, NULL); break; } else { FindClose(hFind); } Sleep(pollint); } return 0; }
bool Engine::Initialize(Config& config, void* window) { HWND hWnd = (HWND)window; int width = config.Get("width", 1024); int height = config.Get("height", 640); try { m_render_system = new RenderSystem(hWnd, width, height); } catch(std::exception e) { Debug::Msg(e.what()); return false; }; m_audio_system = new AudioSystem(); m_input_system = new InputSystem; m_camera = new Camera(45.0f * 3.141592f / 180.0f, (float)width / (float)height, 0.5f, 1000.0f); m_camera_keyboard = new CameraKeyboard(m_camera); m_input_system->RegisterKeyboardListener(m_camera_keyboard); m_camera_mouse = new CameraMouse(m_camera); m_input_system->RegisterMouseListener(m_camera_mouse); m_box = new Box(); if (!m_box->Intialize(m_render_system, m_camera)){ return false; } m_plane = new Plane(); if (!m_plane->Intialize(m_render_system, m_camera)){ return false; } m_audio_system->Initialize(m_camera); m_audio_system->PlayMusic(m_audio_system->Attack1, 1.0f); return true; };
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"); }
// not thread safe!! // invoked by s3_import(), need to be exception safe bool InitConfig(string conf_path, string section /*not used currently*/) { try { if (conf_path == "") { #ifndef DEBUG_S3 write_log("Config file is not specified\n"); #endif return false; } if (s3cfg) delete s3cfg; s3cfg = new Config(conf_path); if (!s3cfg || !s3cfg->Handle()) { #ifndef DEBUG_S3 write_log("Failed to parse config file\n"); #endif if (s3cfg) { delete s3cfg; s3cfg = NULL; } return false; } Config* cfg = s3cfg; bool ret = false; string content; content = cfg->Get("default", "loglevel", "INFO"); s3ext_loglevel = getLogLevel(content.c_str()); content = cfg->Get("default", "logtype", "INTERNAL"); s3ext_logtype = getLogType(content.c_str()); s3ext_accessid = cfg->Get("default", "accessid", ""); s3ext_secret = cfg->Get("default", "secret", ""); s3ext_token = cfg->Get("default", "token", ""); #ifdef DEBUG_S3 // s3ext_loglevel = EXT_DEBUG; // s3ext_logtype = LOCAL_LOG; #endif s3ext_logpath = cfg->Get("default", "logpath", "/tmp/.s3log.sock"); s3ext_logserverhost = cfg->Get("default", "logserverhost", "127.0.0.1"); ret = cfg->Scan("default", "logserverport", "%d", &s3ext_logserverport); if (!ret) { s3ext_logserverport = 1111; } ret = cfg->Scan("default", "threadnum", "%d", &s3ext_threadnum); if (!ret) { S3INFO("Failed to get thread number, use default value 4"); s3ext_threadnum = 4; } if (s3ext_threadnum > 8) { S3INFO("The given thread number is too big, use max value 8"); s3ext_threadnum = 8; } if (s3ext_threadnum < 1) { S3INFO("The given thread number is too small, use min value 1"); s3ext_threadnum = 1; } ret = cfg->Scan("default", "chunksize", "%d", &s3ext_chunksize); if (!ret) { S3INFO("Failed to get chunksize, use default value 64MB"); s3ext_chunksize = 64 * 1024 * 1024; } if (s3ext_chunksize > 128 * 1024 * 1024) { S3INFO("The given chunksize is too large, use max value 128MB"); s3ext_chunksize = 128 * 1024 * 1024; } if (s3ext_chunksize < 2 * 1024 * 1024) { S3INFO("The given chunksize is too small, use min value 2MB"); s3ext_chunksize = 2 * 1024 * 1024; } ret = cfg->Scan("default", "low_speed_limit", "%d", &s3ext_low_speed_limit); if (!ret) { S3INFO( "Failed to get low_speed_limit, use default value %d bytes/s", 10240); s3ext_low_speed_limit = 10240; } ret = cfg->Scan("default", "low_speed_time", "%d", &s3ext_low_speed_time); if (!ret) { S3INFO("Failed to get low_speed_time, use default value %d seconds", 60); s3ext_low_speed_time = 60; } content = cfg->Get("default", "encryption", "true"); s3ext_encryption = to_bool(content); #ifdef DEBUG_S3 s3ext_segid = 0; s3ext_segnum = 1; #else s3ext_segid = GpIdentity.segindex; s3ext_segnum = GpIdentity.numsegments; #endif } catch (...) { return false; } return true; }
// not thread safe!! // Called only once. bool InitConfig(const char* conf_path, const char* section /*unused currently*/) { if (!conf_path) { // empty path, log error return false; } if (!s3cfg) { s3cfg = new Config(conf_path); if (!s3cfg) { // create s3cfg fail // log error #ifndef DEBUGS3 write_log("failed to parse config file\n"); #endif return false; } } Config* cfg = s3cfg; bool ret = false; string content; content = cfg->Get("default", "loglevel", "INFO"); s3ext_loglevel = getLogLevel(content.c_str()); content = cfg->Get("default", "logtype", "INTERNAL"); s3ext_logtype = getLogType(content.c_str()); s3ext_accessid = cfg->Get("default", "accessid", ""); s3ext_secret = cfg->Get("default", "secret", ""); s3ext_token = cfg->Get("default", "token", ""); #ifdef DEBUGS3 // s3ext_loglevel = EXT_DEBUG; // s3ext_logtype = LOCAL_LOG; #endif s3ext_logpath = cfg->Get("default", "logpath", "/tmp/.s3log.sock"); s3ext_logserverhost = cfg->Get("default", "logserverhost", "127.0.0.1"); ret = cfg->Scan("default", "logserverport", "%d", &s3ext_logserverport); if (!ret) { s3ext_logserverport = 1111; } ret = cfg->Scan("default", "threadnum", "%d", &s3ext_threadnum); if (!ret) { S3INFO("failed to get thread number, use default value 4"); s3ext_threadnum = 4; } ret = cfg->Scan("default", "chunksize", "%d", &s3ext_chunksize); if (!ret) { S3INFO("failed to get chunksize, use default value %d", 64 * 1024 * 1024); s3ext_chunksize = 64 * 1024 * 1024; } ret = cfg->Scan("default", "low_speed_limit", "%d", &s3ext_low_speed_limit); if (!ret) { s3ext_low_speed_limit = 1024; } ret = cfg->Scan("default", "low_speed_time", "%d", &s3ext_low_speed_time); if (!ret) { s3ext_low_speed_time = 60; } content = cfg->Get("default", "encryption", "true"); s3ext_encryption = to_bool(content); #ifdef DEBUGS3 s3ext_segid = 0; s3ext_segnum = 1; #else s3ext_segid = GpIdentity.segindex; s3ext_segnum = GpIdentity.numsegments; #endif return true; }
//RunEditProfile bool Menu::RunEditProfile (wstring sName, bool *pbModified) { Err fErr (m_Err, L"RunEditProfile"); if (sName.empty () || pbModified == NULL) { return fErr.Set (sERR_ARGUMENTS); } *pbModified = false; Config *pProfile; bool bCreated; if (!m_pProfiles->GetByName (sName, &pProfile, &bCreated)) { return false; } wstring sMenuEdit, sLeft, sRight, sSpecial, sSet, sOk, sUndefined; if (!m_pLanguage->Get (L"ProfileEditTitle", &sMenuEdit) || !m_pLanguage->Get (L"ProfileEditLeft", &sLeft) || !m_pLanguage->Get (L"ProfileEditRight", &sRight) || !m_pLanguage->Get (L"ProfileEditSpecial", &sSpecial) || !m_pLanguage->Get (L"ProfileEditSet", &sSet) || !m_pLanguage->Get (L"ProfileEditOk", &sOk) || !m_pLanguage->Get (L"ProfileEditUndefined", &sUndefined)) { return false; } sLeft += L": "; sRight += L": "; sSpecial += L": "; wstring sLeftVal, sRightVal, sSpecialVal; if (!pProfile->Get (sKEY_LEFT, &sLeftVal) || !pProfile->Get (sKEY_RIGHT, &sRightVal) || !pProfile->Get (sKEY_SPECIAL, &sSpecialVal)) { return false; } unsigned int nAction; do { if (sLeftVal.empty ()) { sLeftVal = sUndefined; } if (sRightVal.empty ()) { sRightVal = sUndefined; } if (sSpecialVal.empty ()) { sSpecialVal = sUndefined; } Screen EditScreen; if (!EditScreen.Init (&m_Err, m_pProfiles, m_pWindow, sMenuEdit + sName) || !EditScreen.AddLabel (sLeft + sLeftVal, Vector2f (300, 150)) || !EditScreen.AddButton (sSet, Vector2f (50, 140), eProfileEditButtonLeft) || !EditScreen.AddLabel (sRight + sRightVal, Vector2f (300, 250)) || !EditScreen.AddButton (sSet, Vector2f (50, 240), eProfileEditButtonRight) || !EditScreen.AddLabel (sSpecial + sSpecialVal, Vector2f (300, 350)) || !EditScreen.AddButton (sSet, Vector2f (50, 340), eProfileEditButtonSpecial) || !EditScreen.AddButton (m_sAbort, Vector2f (700, 540), eProfileEditButtonAbort) || !EditScreen.AddButton (sOk, Vector2f (700, 600), eProfileEditButtonOk)) { return false; } if (!EditScreen.Run ()) { return false; } if (EditScreen.IsQuit ()) { m_bClose = true; break; } if (!EditScreen.GetSelectId (&nAction)) { return false; } wstring *psCurKey = NULL; switch (nAction) { case (eProfileEditButtonLeft): psCurKey = &sLeftVal; break; case (eProfileEditButtonRight): psCurKey = &sRightVal; break; case (eProfileEditButtonSpecial): psCurKey = &sSpecialVal; break; case (eProfileEditButtonOk): pProfile->Set (sKEY_LEFT, sLeftVal); pProfile->Set (sKEY_RIGHT, sRightVal); pProfile->Set (sKEY_SPECIAL, sSpecialVal); if (!pProfile->Save ()) { return false; } *pbModified = true; nAction = eProfileEditButtonAbort; break; } if (psCurKey != NULL) { wstring sCode; if (!AwaitInput (&sCode)) { return false; } if (!sCode.empty ()) { *psCurKey = sCode; } } } while (!m_bClose && nAction != eProfileEditButtonAbort); return true; }//RunEditProfile
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); Config cfg; string cmdline(lpCmdLine); size_t len = cmdline.length(); if (len > 2 && cmdline[0] == '"' && cmdline[len - 1] == '"') cmdline = cmdline.substr(1, len - 2); if (!cfg.Load(cmdline)) { string err = "Unable to load config file: " + cmdline; MessageBox(NULL, err.c_str(), "Zimbra Desktop Service", MB_ICONERROR | MB_OK); return FALSE; } string mutexname = cfg.Get("mutex.name"); if (!mutexname.empty()) { HANDLE mutex = CreateMutex(NULL, TRUE, mutexname.c_str()); if (mutex != NULL && WaitForSingleObject(mutex, 0) != WAIT_OBJECT_0) { MessageBox(NULL, "Service is already running.", "Zimbra Desktop Service", MB_ICONERROR | MB_OK); return FALSE; } } string workdir = cfg.Get("working.directory"); if (!workdir.empty()) SetCurrentDirectory(workdir.c_str()); ofstream anchor(cfg.Get("anchor.file").c_str(), fstream::out | fstream::trunc); if (!anchor.is_open()) { MessageBox(NULL, "Unable to create anchor file", "Zimbra Desktop Service", MB_ICONERROR | MB_OK); return FALSE; } anchor << GetCurrentProcessId(); anchor.close(); RegisterClass(hInstance); nCmdShow = SW_HIDE; // hide the window if (!InitInstance(hInstance, nCmdShow)) { return FALSE; } java = new VirtualMachine(cfg); if (!java->Run()) { string err = "Failed to start Java VM: " + java->LastError(); MessageBox(NULL, err.c_str(), "Zimbra Desktop Service", MB_ICONERROR | MB_OK); return FALSE; } DWORD monthrd_id; HANDLE monthrd_handle = CreateThread(NULL, 0, MonitorThread, (void *)&cfg, 0, &monthrd_id); if (monthrd_handle == NULL) { MessageBox(NULL, "Unable to start monitor thread", "Zimbra Desktop Service", MB_ICONERROR | MB_OK); return FALSE; } // main message loop: MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } delete java; TerminateThread(monthrd_handle, 0); return (int)msg.wParam; }