wxString SEARCH_STACK::FilenameWithRelativePathInSearchList( const wxString& aFullFilename, const wxString& aBaseDir ) { wxFileName fn = aFullFilename; wxString filename = aFullFilename; unsigned pathlen = fn.GetPath().Len(); // path len, used to find the better (shortest) // subpath within defaults paths for( unsigned kk = 0; kk < GetCount(); kk++ ) { fn = aFullFilename; // Search for the shortest subpath within 'this': if( fn.MakeRelativeTo( base_dir( (*this)[kk], aBaseDir ) ) ) { if( fn.GetPathWithSep().StartsWith( wxT("..") ) ) // Path outside kicad libs paths continue; if( pathlen > fn.GetPath().Len() ) // A better (shortest) subpath is found { filename = fn.GetPathWithSep() + fn.GetFullName(); pathlen = fn.GetPath().Len(); } } } return filename; }
bool ParserPls::writePLSFile(const QString &file_str, QList<QString> &items, bool useRelativePath) { QFile file(file_str); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)){ QMessageBox::warning(NULL,tr("Playlist Export Failed"), tr("Could not create file")+" "+file_str); return false; } //Base folder of file QString base = file_str.section('/', 0, -2); QDir base_dir(base); QTextStream out(&file); out << "[playlist]\n"; out << "NumberOfEntries=" << items.size() << "\n"; for(int i =0; i < items.size(); ++i){ //Write relative path if possible if(useRelativePath){ //QDir::relativePath() will return the absolutePath if it cannot compute the //relative Path out << "File" << i << "=" << base_dir.relativeFilePath(items.at(i)) << "\n"; } else out << "File" << i << "=" << items.at(i) << "\n"; } return true; }
bool ParserM3u::writeM3UFile(const QString &file_str, QList<QString> &items, bool useRelativePath, bool useUtf8) { // Important note: // On Windows \n will produce a <CR><CL> (=\r\n) // On Linux and OS X \n is <CR> (which remains \n) QTextCodec* codec; if (useUtf8) { codec = QTextCodec::codecForName("UTF-8"); } else { // according to http://en.wikipedia.org/wiki/M3U the default encoding of m3u is Windows-1252 // see also http://tools.ietf.org/html/draft-pantos-http-live-streaming-07 // check if the all items can be properly encoded to Latin1. codec = QTextCodec::codecForName("windows-1252"); for (int i = 0; i < items.size(); ++i) { if (!codec->canEncode(items.at(i))) { // filepath contains incompatible character QMessageBox::warning(NULL,tr("Playlist Export Failed"), tr("File path contains characters, not allowed in m3u playlists.\n") + tr("Export a m3u8 playlist instead!\n") + items.at(i)); return false; } } } QFile file(file_str); if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) { QMessageBox::warning(NULL,tr("Playlist Export Failed"), tr("Could not create file") + " " + file_str); return false; } // Base folder of file QString base = file_str.section('/', 0, -2); QDir base_dir(base); qDebug() << "Basepath: " << base; QTextStream out(&file); out.setCodec(codec); out << "#EXTM3U\n"; for (int i = 0; i < items.size(); ++i) { out << "#EXTINF\n"; // Write relative path if possible if (useRelativePath) { //QDir::relativePath() will return the absolutePath if it cannot compute the //relative Path out << base_dir.relativeFilePath(items.at(i)) << "\n"; } else { out << items.at(i) << "\n"; } } return true; }
bool file_control::rename(QString base_name, QString old_name, QString new_name) { //lock mutex QMutexLocker locker(&mutex); QDir base_dir(base_name); QDir old_dir(base_name + "/" + old_name); QDir new_dir(base_name + "/" + new_name); QLOG_DEBUG() << "old name" << base_name + "/" + old_name; QLOG_DEBUG() << "new name" << base_name + "/" + new_name; if(old_dir.exists() && (!new_dir.exists())); else { return false; } //rename base_dir.rename(old_name, new_name); return true; }
QIcon* IconLoader::loadIcon_(const String& name) { const QString filename = QString(name.c_str()) + ".png"; for (QStringList::iterator it = icon_dirs_.begin(); it != icon_dirs_.end(); ++it) { QDir base_dir(*it); if (!base_dir.exists()) { Log.error() << "Could not locate the icon directory: " << it->toStdString() << std::endl; return 0; } QString category_name; QIcon* result = 0; for(std::list<int>::iterator sit = sizes_.begin(); sit != sizes_.end(); ++sit) { QDir size_dir = *it + FileSystem::PATH_SEPARATOR + QString::number(*sit) + "x" + QString::number(*sit); if (!size_dir.exists()) { continue; } if (size_dir.exists(filename)) { if (!result) { result = new QIcon(); } result->addFile(size_dir.path() + FileSystem::PATH_SEPARATOR + filename); } } if (result) { icon_map_[name] = result; return result; } } return 0; }
void NewProjectWizard::OnFinish(wxWizardEvent& event) { wxFileName fn(m_stxtFullFileName->GetLabel()); // Ensure that the target folder exists fn.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL); // make sure that there is no conflict in files between the template project and the selected path if(m_projectData.m_srcProject) { ProjectPtr p = m_projectData.m_srcProject; wxString base_dir(fn.GetPath()); std::vector<wxFileName> files; p->GetFiles(files); for(size_t i = 0; i < files.size(); ++i) { wxFileName f = files.at(i); wxString new_file = base_dir + wxT("/") + f.GetFullName(); if(wxFileName::FileExists(new_file)) { // this file already - notify the user wxString msg; msg << _("The File '") << f.GetFullName() << _("' already exists at the target directory '") << base_dir << wxT("'\n"); msg << _("Please select a different project path\n"); msg << _("The file '") << f.GetFullName() << _("' is part of the template project [") << p->GetName() << wxT("]"); wxMessageBox(msg, _("CodeLite"), wxOK | wxICON_HAND); event.Veto(); return; } } } m_projectData.m_name = m_txtProjName->GetValue(); m_projectData.m_path = fn.GetPath(); m_projectData.m_cmpType = m_choiceCompiler->GetStringSelection(); m_projectData.m_debuggerType = m_choiceDebugger->GetStringSelection(); m_projectData.m_builderName = m_choiceBuildSystem->GetStringSelection(); event.Skip(); }
/** * Called when Flag is flying to the pole */ void CFlag::processFlipping() { if(m_Pos != m_destination) { Vector2D<int> dir = m_destination - m_Pos; const float length = dir.GetLength(); Vector2D<float> base_dir( dir.x/length, dir.y/length ); if( fabs(length) < SPEED ) { moveTo(m_destination); } else { moveDir(base_dir*SPEED); } } else { setAction(A_FLAG_WAVE); setActionSprite(); g_pSound->playSound( SOUND_FLAG_LAND ); const auto episode = gpBehaviorEngine->getEpisode(); if(episode == 6) { Vector2D<int> tilePos = m_Pos; tilePos.y = getYDownPos(); Uint32 new_tile_no = mp_Map->getPlaneDataAt(1, tilePos)+1; tilePos = tilePos>>CSF; mp_Map->setTile(tilePos.x, tilePos.y, new_tile_no, true); } mp_Map->unlock(); }
void cafMCPhoFlatNtupleMaker(int ind) { gROOT->ProcessLine(".!date"); gBenchmark->Start("metphoana_time"); std::ostringstream ostr; ostr << ind; std::string base_dir("/mnt/autofs/misc/nbay03.a/samantha/RESULTS/GoodStuples/MC/PHO_JES_DOWN/"); std::string str_ind = ostr.str(); TStnDataset *dspi = new TStnDataset; //dspi= new TStnDataset("cdfpstn","pypho22_dfc"); //p1-4 TStnAna* ap = new TStnAna(); ap->GetInputModule()->SetPrintLevel(1); // print file name as they are opened TStnCatalog* c = new TStnCatalog(); //c->InitDataset(dspi); c->InitDataset(dspi,"stntuple/dev_242","pypho22_dfc","",""); ap->AddDataset(dspi); std::cout << "mc flag=" << dspi->GetMcFlag() <<std::endl; return; std::cout << "IND=" << ind <<std::endl; ap->SetSplit(ind,200); TH1::AddDirectory(kFALSE); //do not add these histos to memory //******************************************// //for stripping evts //---- need this part for event preselection only /* std::string skimfile = base_dir + "GoodMCPho.root_"+ str_ind; TStnOutputModule* out= new TStnOutputModule(skimfile.c_str()); out->SetMaxFileSize(300); ap->SetOutputModule(out); */ //******************************************// /******************************************************/ // define all module here /******************************************************/ //PassFailTree *passFailFile = new PassFailTree; //BadPointerChecker *ptChecker = new BadPointerChecker; TriggerModule* trigMod; trigMod = new TriggerModule; trigMod->SetGoodRunListFile("goodrun_v19_pho_00.txt"); // to p13 trigMod->SetGoodRunBit(1); //1= use good run, 0=do not use it trigMod->SetTriggerBit(0); // 1= require tigger, 0=NO trigMod->SetMinVtx(0); trigMod->SetMaxVtx(1000); trigMod->SetUseVtxZcut(0); //1= require z<60 0=not cut on z InitSuperPhotons* myinit = new InitSuperPhotons; TagTightPhotons* tagTight = new TagTightPhotons; TagLoosePhotons* tagLoose = new TagLoosePhotons; TagElectrons* tagTightEle = new TagElectrons; TagLooseElectrons* tagLooseEle = new TagLooseElectrons; PhoEleFilter* pef = new PhoEleFilter; TMyJetFilterModule *m5 = new TMyJetFilterModule(); //---------- My Vertex Filter Initialization m5->SetMinNjet15(0); //Jets required to pass (Et>15GeV) m5->SetJTC_imode(0); // 0==MC; 1==data m5->SetJTC_systcode(6); // if >0 +sigma deviation, <0 -sigma deviation, all corrections are added in quadratures up to the given correction level m5->SetUnclParamSwitch(0); // 0==photon parametrization; 1==Zee parametrization m5->SetMaxDeltaPhiJMet(0.3); // controls dPhi in MyMetCleanUpCut m5->SetNpointsToGenerate(1); // number of pseudo-experiments per each event m5->SetSelectMetEvent(0); // 0==do nothing; 1==select event with large MET m5->SetRemoveDuplicate(0); // 0==do nothing; 1==remove "duplicate" events; -1==select "duplicate" events; "duplicate"==bad match with jets m5->SetRemoveBadMet(0); // -1=select events with bad met; 1=remove events with bad met; 0==do nothing ///m5->SetUseMetPDFscenario(1); // this over writes the Npoints generates. scenarios 1=370 // 2=1000, 3=100000,4=15873,5=100 default=100 //m5->SetDumpEvent(0); // 0==do nothing; 1==dump event //m5->SetDumpEventFileName("DATA_dumpEvent1.dat"); //m5->SetLargeMetEventFileName("DATA_largeMetEvent1.dat"); //m5->SetDatFileName("DATA_jet1.dat"); TagPMTSpikes* tagPMT = new TagPMTSpikes; tagPMT->SetMode(1); //1= pass only if no spikes found TagBeamHalo* tagBH = new TagBeamHalo(); TEmTimingModule* EmT = new TEmTimingModule(); SetEmTimes* setEmTime = new SetEmTimes; // set EM time of super photons setEmTime->SetEmTimeCorrectionFile("EmTCEMtable_p13.txt"); TagPhoenixPhotons* tagPhoenix = new TagPhoenixPhotons; TagConvElectrons* tagConvEle = new TagConvElectrons; FlatStupleMaker_MC *flatS = new FlatStupleMaker_MC; std::string stuplefile = base_dir + "Stuple__MCPho.root_"+ str_ind; flatS->SetStupleName(stuplefile.c_str()); //ap->AddModule(passFailFile,1); //ap->AddModule(ptChecker,1); ap->AddModule(trigMod,1); ap->AddModule(myinit,1); ap->AddModule(tagTight,1); ap->AddModule(tagLoose,1); ap->AddModule(tagTightEle,1); ap->AddModule(tagLooseEle,1); ap->AddModule(pef,1); ap->AddModule(m5,1); ap->AddModule(tagPMT,1); ap->AddModule(tagBH,1); ap->AddModule(EmT,1); ap->AddModule(setEmTime,1); ap->AddModule(tagPhoenix,1); ap->AddModule(tagConvEle,1); ap->AddModule(flatS,1); ap->GetInputModule()->SetPrintLevel(1); // print file name as they are opened ap->Run(); std::string filename = base_dir + "FlatStuple_MCPho.root_" + str_ind; ap->SaveHist(filename.c_str(),2); std::cout << "/************* JOB SUMMARY ******************************/" <<std::endl; std::cout << "::::::::: Created ROOT file => "<< filename << std::endl; //std::cout << "::::::::: Created Pass/Fail file => "<< passFailFile->GetFileName() << std::endl; gBenchmark->Show("metphoana_time"); gROOT->ProcessLine(".!date"); std::cout << "/********************************************************/" <<std::endl; // gROOT->ProcessLine(".q"); }
void NewProjectWizard::OnPageChanging(wxWizardEvent& event) { if(event.GetDirection()) { wxDataViewItem sel = m_dataviewTemplates->GetSelection(); NewProjectClientData* cd = dynamic_cast<NewProjectClientData*>(m_dataviewTemplatesModel->GetClientObject(sel)); if(event.GetPage() == m_wizardPageTemplate) { // ------------------------------------------------------- // Switching from the Templates page // ------------------------------------------------------- if(!CheckProjectTemplate()) { event.Veto(); return; } // Test to see if the selected project allows enabling the 'Create under separate folder' if(cd && !cd->IsCanUseSeparateFolder()) { m_cbSeparateDir->SetValue(false); m_cbSeparateDir->Enable(false); } else { m_cbSeparateDir->Enable(true); } m_txtProjName->SetFocus(); // This should have happened in the base-class ctor, but in practice it doesn't } else if(event.GetPage() == m_wizardPageDetails) { // ------------------------------------------------------- // Switching from the Name/Path page // ------------------------------------------------------- if(!CheckProjectName() || !CheckProjectPath()) { event.Veto(); return; } } else if(event.GetPage() == m_wizardPageToolchain) { wxFileName fn(m_stxtFullFileName->GetLabel()); // make sure that there is no conflict in files between the template project and the selected path if(m_projectData.m_srcProject) { ProjectPtr p = m_projectData.m_srcProject; wxString base_dir(fn.GetPath()); std::vector<wxFileName> files; p->GetFiles(files); for(size_t i = 0; i < files.size(); ++i) { wxFileName f = files.at(i); wxString new_file = base_dir + wxT("/") + f.GetFullName(); if(wxFileName::FileExists(new_file)) { // this file already - notify the user wxString msg; msg << _("The File '") << f.GetFullName() << _("' already exists at the target directory '") << base_dir << wxT("'\n"); msg << _("Please select a different project path\n"); msg << _("The file '") << f.GetFullName() << _("' is part of the template project [") << p->GetName() << wxT("]"); wxMessageBox(msg, _("CodeLite"), wxOK | wxICON_HAND); event.Veto(); return; } } } } } event.Skip(); }
int main(int argc, const char * argv[]) { namespace prog_opt = boost::program_options; namespace file_sys = boost::filesystem; /////////////////////////////////////////////////////////////////////////// /// /// /// PROGRAM OPTIONS /// /// /// /////////////////////////////////////////////////////////////////////////// std::string base_dir_str; std::string output_path_str; bool use_int_signals; std::string climate_signal; std::vector<std::string> portfolio_signal; int ari_signal; int year; prog_opt::options_description desc("Allowed options"); desc.add_options() ("help,h", "produce help message") ("base-directory,d", prog_opt::value<std::string>(&base_dir_str), "The base directory for the map database") ("climate-signal,c", prog_opt::value<std::string>(&climate_signal)->default_value("1"), "The climate change projection that should be used") ("portfolio-signal,p", prog_opt::value<std::vector<std::string> >(&portfolio_signal), "The mitigation portfolios that should be used. Need to specify exactly the number of portfolios as there are catchments") ("ARI,r", prog_opt::value<int>(&ari_signal)->default_value(20), "The 1:ari value indicating expected frequency of flood hazard") ("year,y", prog_opt::value<int>(&year)->default_value(2015), "specify year in which to calculate flood hazard for") ("output,o", prog_opt::value<std::string>(&output_path_str)->default_value("output.tif"), "The path to print output interpolated map to") ("int-signam,i", prog_opt::value<bool>(&use_int_signals)->default_value(true), "Whether to use string or int representation of mitigation and climate scanario signals"); prog_opt::positional_options_description p; p.add("portfolio-signal", -1); prog_opt::variables_map vm; prog_opt::store(prog_opt::command_line_parser(argc, argv).options(desc).positional(p).run(), vm); prog_opt::notify(vm); if (vm.count("help")) { std::cout << desc << "\n"; return 1; } if (vm.count("portfolio-signal")) { std::cout << "Mitigation portfolios are: " << vm["portfolio-signal"].as< std::vector<std::string> >() << "\n"; } file_sys::path base_dir(base_dir_str); //Check if base directory exists if (!file_sys::exists(base_dir)) { std::cerr << "Base directory of database does not exist" << std::endl; //Could throw an error here instead } Database my_data; processDatabase(my_data, base_dir); //Read in template map. fs::path template_map = base_dir / "template.tif"; std::tuple<Map_Double_SPtr, std::string, GeoTransform> gdal_map = read_in_map<double>(template_map, GDT_Float64, NO_CATEGORISATION); Map_Double_SPtr map(std::get<0>(gdal_map)); std::string & map_WKT_projection = (std::get<1>(gdal_map)); GeoTransform & map_transform = (std::get<2>(gdal_map)); int nrows = map->NRows(); int ncols = map->NCols(); double no_data_val = map->NoDataValue(); //Set number of mitigaiton portfolios and scenarios int num_of_scenarios = my_data.get_catchment(1)->clim_scnrios_ik.size(); int num_of_portfolios = my_data.get_catchment(1)->get_scenario(1)->mit_prtflios_ik.size(); StitchedMapSet maps; if (use_int_signals == true) { std::vector<int> portfolios; for (int i = 0; i < num_of_portfolios; ++i) { portfolios[i] = std::stoi(portfolio_signal[i]); } int scenario = std::stoi(climate_signal); getMapSet(climate_signal, portfolio_signal, my_data, maps, ncols, nrows, no_data_val); } else { getMapSet(climate_signal, portfolio_signal, my_data, maps, ncols, nrows, no_data_val); } Map_Float_SPtr interped_map = interpolatedmap(ari_signal, year, maps); /********************************************/ /* Print resultent map */ /********************************************/ //Open template map to get projection and transformation information. file_sys::path template_path = base_dir / "template.tif"; std::string wKTprojection; GeoTransform transform; Map_Float_SPtr template_map; std::tie(template_map, wKTprojection, transform) = read_in_map<float>(template_path, GDT_Float32, NO_CATEGORISATION); file_sys::path output_path(output_path_str); std::cout << "\n\n*************************************\n"; std::cout << "* Saving output file *\n"; std::cout << "*************************************" << std::endl; std::string driverName = "GTiff"; write_map(output_path, GDT_Float32, interped_map, wKTprojection, transform, driverName); std::cout << "finished processing database" << std::endl; std::cout << "Another breakpoint" << std::endl; }
void NewProjectWizard::OnPageChanging(wxWizardEvent& event) { if(event.GetDirection()) { wxDataViewItem sel = m_dataviewTemplates->GetSelection(); NewProjectClientData* cd = dynamic_cast<NewProjectClientData*>(m_dataviewTemplatesModel->GetClientObject(sel)); if(event.GetPage() == m_wizardPageTemplate) { // ------------------------------------------------------- // Switching from the Templates page // ------------------------------------------------------- if(!CheckProjectTemplate()) { event.Veto(); return; } // Test to see if the selected project allows enabling the 'Create under separate folder' if(cd && !cd->IsCanUseSeparateFolder()) { m_cbSeparateDir->SetValue(false); m_cbSeparateDir->Enable(false); } else { m_cbSeparateDir->Enable(true); } m_txtProjName->SetFocus(); // This should have happened in the base-class ctor, but in practice it doesn't } else if(event.GetPage() == m_wizardPageDetails) { // ------------------------------------------------------- // Switching from the Name/Path page // ------------------------------------------------------- if(!CheckProjectName() || !CheckProjectPath()) { event.Veto(); return; } } else if(event.GetPage() == m_wizardPageToolchain) { wxFileName fn(m_stxtFullFileName->GetLabel()); // make sure that there is no conflict in files between the template project and the selected path if(m_projectData.m_srcProject) { ProjectPtr p = m_projectData.m_srcProject; wxString base_dir(fn.GetPath()); std::vector<wxFileName> files; p->GetFiles(files); for(size_t i = 0; i < files.size(); ++i) { wxFileName f = files.at(i); wxString new_file = base_dir + wxT("/") + f.GetFullName(); if(wxFileName::FileExists(new_file)) { // this file already - notify the user wxString msg; msg << _("The File '") << f.GetFullName() << _("' already exists at the target directory '") << base_dir << wxT("'\n"); msg << _("Please select a different project path\n"); msg << _("The file '") << f.GetFullName() << _("' is part of the template project [") << p->GetName() << wxT("]"); wxMessageBox(msg, _("CodeLite"), wxOK | wxICON_HAND); event.Veto(); return; } } } } // Try to offer a sensible toolchain/debugger combination as default if(!m_selectionMade) { wxString defaultDebugger; if(cd && cd->GetTemplate().Lower().Contains("php")) { for(size_t n = 0; n < m_choiceCompiler->GetCount(); ++n) { if(m_choiceCompiler->GetString(n).Lower().Contains("php")) { m_choiceCompiler->SetSelection(n); break; } } defaultDebugger = "XDebug"; } else { // If it's not a PHP project we can't be sure of anything except we don't want php tools; so select the // first that isn't for(size_t n = 0; n < m_choiceCompiler->GetCount(); ++n) { if(!m_choiceCompiler->GetString(n).Lower().Contains("php")) { m_choiceCompiler->SetSelection(n); break; } } #if defined(__WXMAC__) defaultDebugger = "LLDB Debugger"; #else defaultDebugger = "GNU gdb debugger"; #endif } int index = m_choiceDebugger->FindString(defaultDebugger); if(index != wxNOT_FOUND) { m_choiceDebugger->SetSelection(index); } } } event.Skip(); }
void cafZFlatNtupleMaker(int ind, int partype, int syscode) { gROOT->ProcessLine(".!date"); gBenchmark->Start("metphoana_time"); std::ostringstream ostr; ostr << ind; std::string base_dir("./"); std::string str_ind = ostr.str(); int datasets = 0; if (partype == 0) { //zee datasets = 8; } else if (partype == 1) { //zmumu datasets = 8; } else if (partype == 2) { //ztautau datasets = 2; } TStnAna* ap = new TStnAna(); ap->GetInputModule()->SetPrintLevel(1); // print file name as they are opened TStnCatalog* c = new TStnCatalog(); TStnDataset *dsp[datasets]; if (partype == 0) { dsp[0] = new TStnDataset("cdfpstn","ze1s6d"); dsp[1] = new TStnDataset("cdfpstn","ze1sad"); dsp[2] = new TStnDataset("cdfpstn","ze0scd"); dsp[3] = new TStnDataset("cdfpstn","ze0sdd"); dsp[4] = new TStnDataset("cdfpstn","ze0sed"); dsp[5] = new TStnDataset("cdfpstn","ze0see"); dsp[6] = new TStnDataset("cdfpstn","ze0seh"); dsp[7] = new TStnDataset("cdfpstn","ze0sej"); c->InitDataset(dsp[0]); c->InitDataset(dsp[1]); c->InitDataset(dsp[2]); c->InitDataset(dsp[3]); c->InitDataset(dsp[4]); c->InitDataset(dsp[5]); c->InitDataset(dsp[6]); c->InitDataset(dsp[7]); ap->AddDataset(dsp[0]); ap->AddDataset(dsp[1]); ap->AddDataset(dsp[2]); ap->AddDataset(dsp[3]); ap->AddDataset(dsp[4]); ap->AddDataset(dsp[5]); ap->AddDataset(dsp[6]); ap->AddDataset(dsp[7]); } if (partype == 1) { dsp[0] = new TStnDataset("cdfpstn","ze1s6m"); dsp[1] = new TStnDataset("cdfpstn","ze1s9m"); dsp[2] = new TStnDataset("cdfpstn","ze0sbm"); dsp[3] = new TStnDataset("cdfpstn","ze0scm"); dsp[4] = new TStnDataset("cdfpstn","ze0sdm"); dsp[5] = new TStnDataset("cdfpstn","ze0sem"); dsp[6] = new TStnDataset("cdfpstn","ze0sfm"); dsp[7] = new TStnDataset("cdfpstn","ze0sgm"); c->InitDataset(dsp[0]); c->InitDataset(dsp[1]); c->InitDataset(dsp[2]); c->InitDataset(dsp[3]); c->InitDataset(dsp[4]); c->InitDataset(dsp[5]); c->InitDataset(dsp[6]); c->InitDataset(dsp[7]); ap->AddDataset(dsp[0]); ap->AddDataset(dsp[1]); ap->AddDataset(dsp[2]); ap->AddDataset(dsp[3]); ap->AddDataset(dsp[4]); ap->AddDataset(dsp[5]); ap->AddDataset(dsp[6]); ap->AddDataset(dsp[7]); } if (partype == 2) { dsp[0] = new TStnDataset("cdfpstn","ze0s8t"); dsp[1] = new TStnDataset("cdfpstn","ze0sat"); c->InitDataset(dsp[0]); c->InitDataset(dsp[1]); ap->AddDataset(dsp[0]); ap->AddDataset(dsp[1]); } double sum=0; for (int i=0; i < datasets; i++) { std::cout << "Nfile="<< dsp[i]->GetNFiles() << std::endl; std::cout << "NEvts="<< dsp[i]->GetNEvents() << std::endl; sum+= dsp[i]->GetNEvents(); TObjArray* myarr = dsp[i]->GetListOfFiles(); TIterator *it = myarr->MakeIterator(); TObject *obj; while (obj = (TObject*) it->Next()) { obj->Print(); } } std::cout << "Total Evts="<< sum << std::endl; int split = 0; if (partype == 0 || partype == 1) split = 200; if (partype == 2) split = 10; std::cout << "split, IND=" << ind << ", " << split <<std::endl; ap->SetSplit(ind, split); std::cout << "syscode, MomPdg, parType=" << syscode << ", " << 23 << ", " << partype <<std::endl; TH1::AddDirectory(kFALSE); //do not add these histos to memory /******************************************************/ // define all module here /******************************************************/ //PassFailTree *passFailFile = new PassFailTree; //BadPointerChecker *ptChecker = new BadPointerChecker; TriggerModule* trigMod; trigMod = new TriggerModule; trigMod->SetGoodRunListFile("goodrun_v19_pho_00.txt"); // to p13 trigMod->SetGoodRunBit(1); //1= use good run, 0=do not use it trigMod->SetTriggerBit(0); // 1= require tigger, 0=NO trigMod->SetMinVtx(0); trigMod->SetMaxVtx(1000); trigMod->SetUseVtxZcut(0); //1= require z<60 0=not cut on z InitSuperPhotons* myinit = new InitSuperPhotons; TagTightPhotons* tagTight = new TagTightPhotons; TagLoosePhotons* tagLoose = new TagLoosePhotons; TagElectrons* tagTightEle = new TagElectrons; TagLooseElectrons* tagLooseEle = new TagLooseElectrons; PhoEleFilter* pef = new PhoEleFilter; TMyJetFilterModule *m5 = new TMyJetFilterModule(); //---------- My Vertex Filter Initialization m5->SetMinNjet15(1); //Jets required to pass (Et>15GeV) m5->SetJTC_imode(0); // 0==MC; 1==data m5->SetJTC_systcode(syscode); // if >0 +sigma deviation, <0 -sigma deviation, all corrections are added in quadratures up to the given correction level m5->SetUnclParamSwitch(0); // 0==photon parametrization; 1==Zee parametrization m5->SetMaxDeltaPhiJMet(0.3); // controls dPhi in MyMetCleanUpCut m5->SetNpointsToGenerate(0); // number of pseudo-experiments per each event m5->SetSelectMetEvent(0); // 0==do nothing; 1==select event with large MET m5->SetRemoveDuplicate(0); // 0==do nothing; 1==remove "duplicate" events; -1==select "duplicate" events; "duplicate"==bad match with jets m5->SetRemoveBadMet(0); // -1=select events with bad met; 1=remove events with bad met; 0==do nothing ///m5->SetUseMetPDFscenario(1); // this over writes the Npoints generates. scenarios 1=370 // 2=1000, 3=100000,4=15873,5=100 default=100 m5->SetDumpEvent(0); // 0==do nothing; 1==dump event m5->SetDumpEventFileName("DATA_dumpEvent.dat"); m5->SetLargeMetEventFileName("DATA_largeMetEvent.dat"); m5->SetDatFileName("DATA_jet.dat"); //TagPMTSpikes* tagPMT = new TagPMTSpikes; //tagPMT->SetMode(1); //1= pass only if no spikes found TagBeamHalo* tagBH = new TagBeamHalo(); //TEmTimingModule* EmT = new TEmTimingModule(); //SetEmTimes* setEmTime = new SetEmTimes; // set EM time of super photons //setEmTime->SetEmTimeCorrectionFile("EmTCEMtable_p13.txt"); TagPhoenixPhotons* tagPhoenix = new TagPhoenixPhotons; TagConvElectrons* tagConvEle = new TagConvElectrons; FlatStupleMaker_MC_EWK *flatS = new FlatStupleMaker_MC_EWK; flatS->SetMomPDG(23); flatS->SetDecayType(partype); //0=z->ee,1=z->nunu,2=z->tautau std::string Stuple; if (partype == 0) Stuple="Stuple_Zee.root"; if (partype == 1) Stuple="Stuple_Zmm.root"; if (partype == 2) Stuple="Stuple_Ztt.root"; std::string stuplefile = base_dir + Stuple + str_ind; flatS->SetStupleName(stuplefile.c_str()); //ap->AddModule(passFailFile,1); //ap->AddModule(ptChecker,1); ap->AddModule(trigMod,1); ap->AddModule(myinit,1); ap->AddModule(tagTight,1); ap->AddModule(tagLoose,1); ap->AddModule(tagTightEle,1); ap->AddModule(tagLooseEle,1); ap->AddModule(pef,1); ap->AddModule(m5,1); //ap->AddModule(tagPMT,1); ap->AddModule(tagBH,1); //ap->AddModule(EmT,1); //ap->AddModule(setEmTime,1); ap->AddModule(tagPhoenix,1); ap->AddModule(tagConvEle,1); ap->AddModule(flatS,1); ap->GetInputModule()->SetPrintLevel(1); // print file name as they are opened ap->Run(); std::string filename = "FlatStuple.root"+str_ind; ap->SaveHist(filename.c_str(),2); std::cout << "/************* JOB SUMMARY ******************************/" <<std::endl; std::cout << "::::::::: Created ROOT file => "<< filename << std::endl; //std::cout << "::::::::: Created Pass/Fail file => "<< passFailFile->GetFileName() << std::endl; gBenchmark->Show("metphoana_time"); gROOT->ProcessLine(".!date"); std::cout << "/********************************************************/" <<std::endl; //gROOT->ProcessLine(".q"); }