void init() { helper = (IHThorKeyDiffArg *)queryHelper(); OwnedRoxieString origName(helper->getOriginalName()); OwnedRoxieString updatedName(helper->getUpdatedName()); originalIndexFile.setown(queryThorFileManager().lookup(container.queryJob(), origName)); newIndexFile.setown(queryThorFileManager().lookup(container.queryJob(), updatedName)); if (originalIndexFile->numParts() != newIndexFile->numParts()) throw MakeActivityException(this, TE_KeyDiffIndexSizeMismatch, "Index %s and %s differ in width", origName.get(), updatedName.get()); if (originalIndexFile->querySuperFile() || newIndexFile->querySuperFile()) throw MakeActivityException(this, 0, "Diffing super files not supported"); width = originalIndexFile->numParts(); originalDesc.setown(originalIndexFile->getFileDescriptor()); newIndexDesc.setown(newIndexFile->getFileDescriptor()); Owned<IPartDescriptor> tlkDesc = originalDesc->getPart(originalDesc->numParts()-1); const char *kind = tlkDesc->queryProperties().queryProp("@kind"); local = NULL == kind || 0 != stricmp("topLevelKey", kind); if (!local) width--; // 1 part == No n distributed / Monolithic key if (width > container.queryJob().querySlaves()) throw MakeActivityException(this, 0, "Unsupported: keydiff(%s, %s) - Cannot diff a key that's wider(%d) than the target cluster size(%d)", originalIndexFile->queryLogicalName(), newIndexFile->queryLogicalName(), width, container.queryJob().querySlaves()); queryThorFileManager().noteFileRead(container.queryJob(), originalIndexFile); queryThorFileManager().noteFileRead(container.queryJob(), newIndexFile); IArrayOf<IGroup> groups; OwnedRoxieString outputName(helper->getOutputName()); fillClusterArray(container.queryJob(), outputName, clusters, groups); patchDesc.setown(queryThorFileManager().create(container.queryJob(), outputName, clusters, groups, 0 != (KDPoverwrite & helper->getFlags()), 0, !local, width)); }
//_____________________________________________________________________________ void ProofSimpleFile::Terminate() { // The Terminate() function is the last function to be called during // a query. It always runs on the client, it can be used to present // the results graphically or save the results to file. // Get the histos from the file if ((fProofFile = dynamic_cast<TProofOutputFile*>(fOutput->FindObject("SimpleFile.root")))) { TString outputFile(fProofFile->GetOutputFileName()); TString outputName(fProofFile->GetName()); outputName += ".root"; Printf("outputFile: %s", outputFile.Data()); // Read the ntuple from the file if (!(fFile = TFile::Open(outputFile))) { Error("Terminate", "could not open file: %s", outputFile.Data()); return; } } else { Error("Terminate", "TProofOutputFile not found"); return; } // Top histos PlotHistos(0); // Dir histos PlotHistos(1); }
void fault_hdf_init(const int* cells, const double* vertices, int nCells, int nVertices, int* outputMask, const char* outputPrefix) { if (nCells > 0) { int rank = 0; #ifdef USE_MPI MPI_Comm_rank(comm, &rank); #endif // USE_MPI logInfo(rank) << "Initializing fault output."; std::string outputName(outputPrefix); outputName += "-fault"; std::vector<const char*> variables; if (outputMask[0]) { variables.push_back(labels[0]); variables.push_back(labels[1]); } if (outputMask[1]) { variables.push_back(labels[2]); variables.push_back(labels[3]); variables.push_back(labels[4]); } if (outputMask[2]) variables.push_back(labels[5]); if (outputMask[3]) { variables.push_back(labels[6]); variables.push_back(labels[7]); } if (outputMask[4]) { variables.push_back(labels[8]); variables.push_back(labels[9]); variables.push_back(labels[10]); } if (outputMask[5]) { variables.push_back(labels[11]); variables.push_back(labels[12]); } if (outputMask[6]) variables.push_back(labels[13]); if (outputMask[7]) variables.push_back(labels[14]); if (outputMask[8]) variables.push_back(labels[15]); if (outputMask[9]) variables.push_back(labels[16]); if (outputMask[10]) variables.push_back(labels[17]); // TODO get the timestep from the checkpoint xdmfWriter = new xdmfwriter::XdmfWriter<xdmfwriter::TRIANGLE>(rank, outputName.c_str(), variables, 0); #ifdef USE_MPI xdmfWriter->setComm(comm); #endif // USE_MPI xdmfWriter->init(nCells, reinterpret_cast<const unsigned int*>(cells), nVertices, vertices, true); } }
virtual void done() { StringBuffer scopedName; OwnedRoxieString outputName(helper->getOutputName()); queryThorFileManager().addScope(container.queryJob(), outputName, scopedName); Owned<IWorkUnit> wu = &container.queryJob().queryWorkUnit().lock(); Owned<IWUResult> r = wu->updateResultBySequence(helper->getSequence()); r->setResultStatus(ResultStatusCalculated); r->setResultLogicalName(scopedName.str()); r.clear(); wu.clear(); IPropertyTree &patchProps = patchDesc->queryProperties(); if (0 != (helper->getFlags() & KDPexpires)) setExpiryTime(patchProps, helper->getExpiryDays()); IPropertyTree &originalProps = originalDesc->queryProperties();; if (originalProps.queryProp("ECL")) patchProps.setProp("ECL", originalProps.queryProp("ECL")); if (originalProps.getPropBool("@local")) patchProps.setPropBool("@local", true); container.queryTempHandler()->registerFile(outputName, container.queryOwner().queryGraphId(), 0, false, WUFileStandard, &clusters); Owned<IDistributedFile> patchFile; // set part sizes etc queryThorFileManager().publish(container.queryJob(), outputName, false, *patchDesc, &patchFile, 0, false); try { // set file size if (patchFile) { __int64 fs = patchFile->getFileSize(true,false); if (fs!=-1) patchFile->queryAttributes().setPropInt64("@size",fs); } } catch (IException *e) { EXCLOG(e,"keydiff setting file size"); e->Release(); } // Add a new 'Patch' description to the secondary key. DistributedFilePropertyLock lock(newIndexFile); IPropertyTree &fileProps = lock.queryAttributes(); StringBuffer path("Patch[@name=\""); path.append(scopedName.str()).append("\"]"); IPropertyTree *patch = fileProps.queryPropTree(path.str()); if (!patch) patch = fileProps.addPropTree("Patch", createPTree()); patch->setProp("@name", scopedName.str()); unsigned checkSum; if (patchFile->getFileCheckSum(checkSum)) patch->setPropInt64("@checkSum", checkSum); IPropertyTree *index = patch->setPropTree("Index", createPTree()); index->setProp("@name", originalIndexFile->queryLogicalName()); if (originalIndexFile->getFileCheckSum(checkSum)) index->setPropInt64("@checkSum", checkSum); originalIndexFile->setAccessed(); newIndexFile->setAccessed(); }
/** * Extract Attribute data from the shader */ void Program::ExtractAttributeData() { Log("\tInput :"); char tempNameAR[1024]; { GLint numInput = 0; glGetProgramInterfaceiv(_program, GL_PROGRAM_INPUT, GL_ACTIVE_RESOURCES, &numInput); const GLenum propertiesAR[2] = { GL_TYPE, GL_LOCATION }; for (int input = 0; input < numInput; input++) { GLint valuesAR[2]; glGetProgramResourceiv(_program, GL_PROGRAM_INPUT, input, 2, propertiesAR, 2, NULL, valuesAR); glGetProgramResourceName(_program, GL_PROGRAM_INPUT, input, 1024, NULL, tempNameAR); std::string inputName(tempNameAR); if (inputName.size() >= 3 && inputName.substr(0, 3) == "gl_") continue; else { _inputs.insert(std::make_pair(inputName, AttributeInfo(inputName, GLenum(valuesAR[0]), valuesAR[1], GLUtil::SizeofGLSLType(GLenum(valuesAR[0]))))); Log("\t\t" + inputName + " " + ToString(valuesAR[1]) + " " + GLUtil::GLSLTypeToStr(GLenum(valuesAR[0]))); } } } Log("\tOutput :"); { GLint numOutput = 0; glGetProgramInterfaceiv(_program, GL_PROGRAM_OUTPUT, GL_ACTIVE_RESOURCES, &numOutput); const GLenum propertiesAR[2] = { GL_TYPE, GL_LOCATION }; for (int outpout = 0; outpout < numOutput; outpout++) { GLint valuesAR[2]; glGetProgramResourceiv(_program, GL_PROGRAM_OUTPUT, outpout, 2, propertiesAR, 2, NULL, valuesAR); glGetProgramResourceName(_program, GL_PROGRAM_OUTPUT, outpout, 1024, NULL, tempNameAR); std::string outputName(tempNameAR); if (outputName.size() >= 3 && outputName.substr(0, 3) != "gl_") { _outputs.insert(std::make_pair(outputName, AttributeInfo(outputName, GLenum(valuesAR[0]), valuesAR[1], GLUtil::SizeofGLSLType(GLenum(valuesAR[0]))))); Log("\t\t" + outputName + " " + ToString(valuesAR[1]) + " " + GLUtil::GLSLTypeToStr(GLenum(valuesAR[0]))); } } } }
void preStart(size32_t parentExtractSz, const byte *parentExtract) { CMasterActivity::preStart(parentExtractSz, parentExtract); IHThorKeyDiffArg *helper = (IHThorKeyDiffArg *) queryHelper(); if (0==(KDPoverwrite & helper->getFlags())) { if (KDPvaroutputname & helper->getFlags()) return; OwnedRoxieString outputName(helper->getOutputName()); Owned<IDistributedFile> file = queryThorFileManager().lookup(container.queryJob(), outputName, false, true); if (file) throw MakeActivityException(this, TE_OverwriteNotSpecified, "Cannot write %s, file already exists (missing OVERWRITE attribute?)", file->queryLogicalName()); } }
bool GBuildMakefileGenerator::openOutput(QFile &file, const QString &build) const { Q_UNUSED(build) debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); QFileInfo fi(file); if (fi.filePath().isEmpty()) file.setFileName(qmake_getpwd() + QDir::separator() + file.fileName()); if (!file.fileName().endsWith(projectSuffix())) { QString outputName(file.fileName()); outputName += QDir::separator(); outputName += fileInfo(project->projectFile()).baseName(); outputName += projectSuffix(); file.setFileName(outputName); } debug_msg(1, "file is %s", file.fileName().toLatin1().constData()); bool ret = MakefileGenerator::openOutput(file, QString()); return ret; }
void ProofNtuple::Terminate() { // The Terminate() function is the last function to be called during // a query. It always runs on the client, it can be used to present // the results graphically or save the results to file. // Do nothing is not requested (dataset creation run) if (!fPlotNtuple) return; // Get the ntuple form the file if ((fProofFile = dynamic_cast<TProofOutputFile*>(fOutput->FindObject("SimpleNtuple.root")))) { TString outputFile(fProofFile->GetOutputFileName()); TString outputName(fProofFile->GetName()); outputName += ".root"; Printf("outputFile: %s", outputFile.Data()); // Read the ntuple from the file fFile = TFile::Open(outputFile); if (fFile) { Printf("Managed to open file: %s", outputFile.Data()); fNtp = (TNtuple *) fFile->Get("ntuple"); } else { Error("Terminate", "could not open file: %s", outputFile.Data()); } if (!fFile) return; } else { Error("Terminate", "TProofOutputFile not found"); return; } // Plot ntuples if (fNtp) PlotNtuple(fNtp, "proof ntuple"); }
bool GBuildMakefileGenerator::write() { QStringList tmp; QString filename(Option::output.fileName()); QString pathtoremove(qmake_getpwd()); QString relpath(pathtoremove); QString strtarget(project->first("TARGET").toQString()); bool isnativebin = nativebins.contains(strtarget); relpath.replace(Option::output_dir, ""); /* correct output for non-prl, non-recursive case */ QString outname(qmake_getpwd()); outname += QDir::separator(); outname += fileInfo(Option::output.fileName()).baseName(); outname += projectSuffix(); Option::output.close(); Option::output.setFileName(outname); MakefileGenerator::openOutput(Option::output, QString()); if (strtarget != fileInfo(project->projectFile()).baseName()) { QString gpjname(strtarget); QString outputName(qmake_getpwd()); outputName += QDir::separator(); outputName += fileInfo(project->projectFile()).baseName(); outputName += projectSuffix(); QFile f(outputName); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); QTextStream t(&f); t << "#!gbuild\n"; t << "[Project]\n"; t << gpjname << projectSuffix() << "\n"; if ((project->first("TEMPLATE") == "lib") && project->isActiveConfig("shared")) t << gpjname << "_shared" << projectSuffix() << "\n"; t.flush(); gpjname += projectSuffix(); Option::output.close(); Option::output.setFileName(gpjname); MakefileGenerator::openOutput(Option::output, QString()); } if ((project->first("TEMPLATE") == "app") && (!isnativebin)) { QTextStream t(&Option::output); QString intname(strtarget); intname += ".int"; /* this is for bulding an INTEGRITY application. * generate the .int integrate file and the .gpj INTEGRITY Application * project file, then go on with regular files */ t << "#!gbuild\n"; t << "[INTEGRITY Application]\n"; t << "\t:binDirRelative=.\n"; t << "\t-o " << strtarget << "\n"; t << intname << "\n"; t << strtarget << "_app" << projectSuffix() << "\n"; t.flush(); /* generate integrate file */ QFile f(intname); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); QTextStream ti(&f); ti << "# This is a file automatically generated by qmake\n"; ti << "# Modifications will be lost next time you run qmake\n"; ti << "Kernel\n"; ti << "\tFilename\tDynamicDownload\n"; ti << "EndKernel\n\n"; ti << "AddressSpace\n"; ti << "\tName\t" << strtarget << "\n"; ti << "\tFilename\t" << strtarget << "_app\n"; ti << "\tMemoryPoolSize\t0x100000\n"; ti << "\tLanguage\tC++\n"; /* FIXME : heap size is huge to be big enough for every example * it should probably be tailored for each example, btu there is no * good way to guess that */ ti << "\tHeapSize\t0x00D00000\n"; ti << "\tTask\tInitial\n"; ti << "\t\tStackSize\t0x30000\n"; ti << "\tEndTask\n"; ti << "EndAddressSpace\n"; ti.flush(); /* change current project file to <projectname>_app.gpj and continue * generation */ filename.insert(filename.lastIndexOf("."), "_app"); Option::output.close(); Option::output.setFileName(filename); MakefileGenerator::openOutput(Option::output, QString()); } else if ((project->first("TEMPLATE") == "lib") && project->isActiveConfig("shared")) { QString gpjname(strtarget); gpjname += "_shared"; gpjname += projectSuffix(); QFile f(gpjname); f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); QTextStream t(&f); t << "#!gbuild\n" "[Program]\n" "\t-A libINTEGRITY.so\n" "\t-A libc.so\n" "\t-A libscxx.so\n" "\t-A libQtCore.so\n" "\t-e __ghsbegin_text\n" "\t-startfile=-\n" "\t:syslibraries=-\n" "\t-Onolink\n"; t << "\t-o lib" << strtarget << ".so\n"; t << "\t-l" << strtarget << "\n"; t << "\t-extractall=-l" << strtarget << "\n"; t << "\t:outputDir=work/" << filename.section(QDir::separator(), 0, -1).remove(".gpj") << "\n"; t << strtarget << "_shared.ld\n"; t << "$(__OS_DIR)/intlib/sharedobjbssinit.c\n"; t.flush(); QFile fl(strtarget + "_shared.ld"); fl.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate); QTextStream tl(&fl); tl << "CONSTANTS {\n" " __INTEGRITY_MinPageAlign = 16K\n" " __INTEGRITY_MaxPageAlign = 16K\n" " __INTEGRITY_LibCBaseAddress = \n"; tl << dllbase << "\n"; tl << "}\n" "-sec\n" "{\n" " .picbase __INTEGRITY_LibCBaseAddress :\n" " .text :\n" " .syscall :\n" " .intercall :\n" " .interfunc :\n" " .secinfo :\n" " .rodata align(16) :\n" " .fixaddr :\n" " .fixtype :\n" " .rombeg :\n" " .textchecksum :\n" " // The above sections may be large. Leave a bigger gap for large pages.\n" " .pidbase align(__INTEGRITY_MaxPageAlign) :\n" " .sdabase :\n" " .data :\n" " .toc :\n" " .opd :\n" " .datachecksum :\n" " .bss align(__INTEGRITY_MinPageAlign) :\n" " .heap :\n" "}\n"; tl.flush(); dllbase += DLLOFFSET; } QTextStream t(&Option::output); QString primaryTarget(project->values("QMAKE_CXX").at(0).toQString()); pathtoremove += QDir::separator(); filename.remove(qmake_getpwd()); //HEADER t << "#!gbuild\n"; /* find the architecture out of the compiler name */ if (filename.endsWith("projects.gpj")) { primaryTarget.remove(0, 5); t << "macro QT_BUILD_DIR=%expand_path(.)\n"; t << "macro __OS_DIR=" << project->values("INTEGRITY_DIR").first() << "\n"; t << "primaryTarget=" << primaryTarget << "_integrity.tgt\n"; t << "customization=util/integrity/qt.bod\n"; } /* project type */ if (project->first("TEMPLATE") == "app") { t << "[Program]\n"; if (isnativebin) { t << "\t:binDir=bin\n"; t << "\t-o " << strtarget << "\n"; } else { t << "\t:binDirRelative=.\n"; t << "\t-o " << strtarget << "_app\n"; } } else if (project->first("TEMPLATE") == "lib") { t << "[Library]\n"; t << "\t:binDir=lib\n"; t << "\t-o lib" << strtarget << ".a\n"; } else if (project->first("TEMPLATE") == "subdirs") t << "[Project]\n"; else t << project->first("TEMPLATE") << "\n"; /* compilations options */ t << "\t:sourceDir=.\n"; t << "\t:outputDir=work" << relpath << "\n"; if (filename.endsWith("projects.gpj")) { t << "\t:sourceDir=work\n"; t << "\t-Iwork\n"; t << "\t-Llib\n"; t << "\t"; const ProStringList &l = project->values("QMAKE_CXXFLAGS"); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if ((*it).startsWith("-")) t << "\n\t" << (*it); else t << " " << (*it); } t << "\n"; } t << "\n"; t << varGlue("DEFINES", "\t-D", "\n\t-D", "\n"); t << "\t-I.\n\t-I" << specdir() << "\n"; t << varGlue("INCLUDEPATH", "\t-I", "\n\t-I", "\n"); t << "\t--cxx_include_directory .\n\t--cxx_include_directory " << specdir() << "\n"; t << varGlue("INCLUDEPATH", "\t--cxx_include_directory ", "\n\t--cxx_include_directory ", "\n"); if (project->first("TEMPLATE") == "app") { /* include linker flags if it's an application */ static const char * const src[] = { "QMAKE_LFLAGS", "QMAKE_LIBS", "LIBS", 0 }; for (int i = 0; src[i]; i++) { /* skip target libraries for native tools */ if (isnativebin && (i == 0)) continue; t << "\t"; const ProStringList &l = project->values(src[i]); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if ((*it).startsWith("-")) t << "\n\t" << (*it); else t << " " << (*it); } t << "\n"; } } /* first subdirectories/subprojects */ { const ProStringList &l = project->values("SUBDIRS"); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { QString gpjname((*it).toQString()); /* avoid native tools */ if (nativebins.contains(gpjname.section("_", -1))) continue; const ProKey skey(*it + ".subdir"); if (!project->first(skey).isEmpty()) gpjname = project->first(skey).toQString(); else gpjname.replace("_", QDir::separator()); gpjname += QDir::separator() + gpjname.section(QDir::separator(), -1); gpjname += projectSuffix(); /* make relative */ if (!project->values("QT_SOURCE_TREE").isEmpty()) { gpjname.replace(project->values("QT_SOURCE_TREE").first() + QDir::separator(), ""); } t << gpjname << "\n"; } } { const ProStringList &l = project->values("RESOURCES"); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { QString tmpstr((*it).toQString()); tmpstr.remove(pathtoremove); t << tmpstr << "\t[Qt Resource]\n"; tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1); tmpstr.remove(".qrc"); t << "\t-name " << tmpstr << "\n"; tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "qrc_"); tmpstr.append(".cpp"); t << "\t-o work/" << tmpstr << "\n"; } } { const ProStringList &l = project->values("FORMS"); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { QString tmpstr((*it).toQString()); tmpstr.remove(pathtoremove); t << tmpstr << "\t[Qt Dialog]\n"; tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1); tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_"); tmpstr.remove(".ui"); tmpstr.append(".h"); t << "\t-o work/" << tmpstr << "\n"; } } /* source files for this project */ static const char * const src[] = { "HEADERS", "SOURCES", 0 }; for (int i = 0; src[i]; i++) { const ProStringList &l = project->values(src[i]); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { if ((*it).isEmpty()) continue; /* native tools aren't preprocessed */ if (!isnativebin) t << writeOne((*it).toQString(), pathtoremove); else t << (*it).toQString().remove(pathtoremove) << "\n"; } } t << "\n"; { const ProStringList &l = project->values("GENERATED_SOURCES"); for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) { t << "work/" << (*it).toQString().section(QDir::separator(), -1) << "\n"; } } return true; }
plotDelphes3(TString inputName){ gSystem->Load("libDelphes"); // Create chain of root trees TChain chain("Delphes"); chain.Add(inputName.Data()); // Create object of class ExRootTreeReader ExRootTreeReader *treeReader = new ExRootTreeReader(&chain); Long64_t numberOfEntries = treeReader->GetEntries(); // Get pointers to branches used in this analysis TClonesArray *b_Jet = treeReader->UseBranch("Jet"); TClonesArray *b_Electron = treeReader->UseBranch("Electron"); TClonesArray *b_Muon = treeReader->UseBranch("Muon"); TClonesArray *b_MET = treeReader->UseBranch("MissingET"); TClonesArray *b_Truth = treeReader->UseBranch("Particle"); TString outputName(inputName); outputName="test.root"; TFile* output=new TFile(outputName,"RECREATE"); // Loop over all events for(Int_t entry = 0; entry < numberOfEntries; ++entry) { if(entry==maxEvents) break; if(entry%10000==0)cout<<entry<<endl; // Load selected branches with data from specified event treeReader->ReadEntry(entry); if(b_MET->GetEntries() > 0){ MissingET* met = (MissingET*) b_MET->At(0); h_MET->Fill(met->MET); } int nJets=0, nBJets=0; for(int jetNo=0; jetNo<b_Jet->GetEntries(); jetNo++){ Jet *jet=(Jet*) b_Jet->At(jetNo); if(jet->PT>jet_pT_min && fabs(jet->Eta)<jet_eta_max){ nJets++; h_jet_pT->Fill(jet->PT); h_jet_eta->Fill(jet->Eta); if(jet->BTag){ nBJets++; h_bJet_pT->Fill(jet->PT); h_bJet_eta->Fill(jet->Eta); } } } h_jet_mult->Fill(nJets); h_bJet_mult->Fill(nBJets); int nElectrons=0; for(int electronNo=0; electronNo<b_Electron->GetEntries(); electronNo++){ Electron *electron=(Electron*) b_Electron->At(electronNo); if(electron->PT>electron_pT_min && fabs(electron->Eta)<electron_eta_max){ nElectrons++; h_electron_pT->Fill(electron->PT); h_electron_eta->Fill(electron->Eta); } } h_electron_mult->Fill(nElectrons); int nMuons=0; for(int muonNo=0; muonNo<b_Muon->GetEntries(); muonNo++){ Muon *muon=(Muon*) b_Muon->At(muonNo); if(muon->PT>muon_pT_min && fabs(muon->Eta)<muon_eta_max){ nMuons++; h_muon_pT->Fill(muon->PT); h_muon_eta->Fill(muon->Eta); } } h_muon_mult->Fill(nMuons); int nGenMuons=0, nTMRMuonsIDIso=0; for(int genParticleNo=0; genParticleNo<b_Truth->GetEntries(); genParticleNo++){ GenParticle *particle=(GenParticle*) b_Truth->At(genParticleNo); if (particle->Status==3){ if (abs(particle->PID)==13){ nGenMuons++; h_genMuon_pT->Fill(particle->PT); h_genMuon_eta->Fill(fabs(particle->Eta)); h_genMuon_eta_pT->Fill(fabs(particle->Eta),particle->PT); for(int muonNo=0; muonNo<b_Muon->GetEntries(); muonNo++){ Muon *muon=(Muon*) b_Muon->At(muonNo); if(truthMatch(1,muon->Eta,muon->Phi,1,particle->Eta,particle->Phi)){ nTMRMuonsIDIso++; h_TMRMuon_ID_Iso_pT->Fill(muon->PT); h_TMRMuon_ID_Iso_eta->Fill(fabs(muon->Eta)); h_TMRMuon_ID_Iso_eta_pT->Fill(fabs(muon->Eta),muon->PT); break; //To prevent 2 reco mu per truth mu } } } } } h_genMuon_mult->Fill(nGenMuons); h_TMRMuon_ID_Iso_mult->Fill(nTMRMuonsIDIso); } writeOutput(); }
void QgsProcessingFeatureBasedAlgorithm::initAlgorithm( const QVariantMap &config ) { addParameter( new QgsProcessingParameterFeatureSource( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ), inputLayerTypes() ) ); initParameters( config ); addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), outputName(), outputLayerType() ) ); }
int main(int argc, char **argv) { std::string programName(argv[0]); if (argc < 4) { std::cout << "usage:\n"; std::cout << programName << "INPUT_FILE OUTPUT_C_ARRAY_NAME OUTPUT_FILE\n"; return -1; } std::string inputFile(argv[1]); std::string outputName(argv[2]); std::string outputFile(argv[3]); std::ifstream readFile(inputFile, std::ios::binary | std::ios::in); readFile.seekg(0, std::ios::end); std::streamoff fileSize = readFile.tellg(); readFile.seekg(0, std::ios::beg); const std::size_t minSize = sizeof(DDSURFACEDESC2) + sizeof(DWORD); if (fileSize < minSize) { std::cout << inputFile << " is only " << fileSize << " bytes, must be at greater than " << minSize << " bytes to be a correct DDS image file.\n"; return -2; } DWORD magicWord; readFile.read(reinterpret_cast<char*>(&magicWord), sizeof(DWORD)); if (magicWord != MAKEFOURCC('D','D','S',' ')) { std::cout << "Magic word must be " << MAKEFOURCC('D','D','S',' ') << ".\n"; return -3; } DDSURFACEDESC2 header; readFile.read(reinterpret_cast<char*>(&header), sizeof(DDSURFACEDESC2)); std::string formatName; std::size_t blockSize = 0; std::size_t blockWidth = 0; std::size_t blockHeight = 0; if (header.ddpfPixelFormat.dwFlags & DDPF_RGB) { blockSize = header.ddpfPixelFormat.dwRGBBitCount / 8; blockWidth = 1; blockHeight = 1; if (blockSize == 4) { if (header.ddpfPixelFormat.dwRBitMask == 0x000000FF && header.ddpfPixelFormat.dwGBitMask == 0x0000FF00 && header.ddpfPixelFormat.dwBBitMask == 0x00FF0000 && header.ddpfPixelFormat.dwRGBAlphaBitMask == 0xFF000000) { formatName = "RGBA8"; } else if (header.ddpfPixelFormat.dwRBitMask == 0x000000FF && header.ddpfPixelFormat.dwGBitMask == 0x0000FF00 && header.ddpfPixelFormat.dwBBitMask == 0x00FF0000 && header.ddpfPixelFormat.dwRGBAlphaBitMask == 0x00000000) { formatName = "RGBX8"; } else if (header.ddpfPixelFormat.dwRBitMask == 0x000003FF && header.ddpfPixelFormat.dwGBitMask == 0x000FFC00 && header.ddpfPixelFormat.dwBBitMask == 0x3FF00000 && header.ddpfPixelFormat.dwRGBAlphaBitMask == 0xC0000000) { formatName = "RGB10A2"; } else if (header.ddpfPixelFormat.dwRBitMask == 0x0000FFFF && header.ddpfPixelFormat.dwGBitMask == 0xFFFF0000 && header.ddpfPixelFormat.dwBBitMask == 0x00000000 && header.ddpfPixelFormat.dwRGBAlphaBitMask == 0x00000000) { formatName = "RG16"; } else if (header.ddpfPixelFormat.dwRBitMask == 0xFFFFFFFF && header.ddpfPixelFormat.dwGBitMask == 0x00000000 && header.ddpfPixelFormat.dwBBitMask == 0x00000000 && header.ddpfPixelFormat.dwRGBAlphaBitMask == 0x00000000) { formatName = "R32"; } else { formatName = "UKNOWN"; } } } else if (header.ddpfPixelFormat.dwFlags & DDPF_FOURCC) { switch (header.ddpfPixelFormat.dwFourCC) { case MAKEFOURCC('D','X','T','1'): formatName = "DXT1"; blockSize = 8; blockWidth = 4; blockHeight = 4; break; case MAKEFOURCC('D','X','T','3'): formatName = "DXT3"; blockSize = 16; blockWidth = 4; blockHeight = 4; break; case MAKEFOURCC('D','X','T','5'): formatName = "DXT5"; blockSize = 16; blockWidth = 4; blockHeight = 4; break; case D3DFMT_R32F: formatName = "R32F"; blockSize = 4; blockWidth = 1; blockHeight = 1; case D3DFMT_G32R32F: formatName = "RG32F"; blockSize = 8; blockWidth = 1; blockHeight = 1; case D3DFMT_A32B32G32R32F: formatName = "RGBA32F"; blockSize = 16; blockWidth = 1; blockHeight = 1; case D3DFMT_R16F: formatName = "R16F"; blockSize = 2; blockWidth = 1; blockHeight = 1; case D3DFMT_G16R16F: formatName = "RG16F"; blockSize = 4; blockWidth = 1; blockHeight = 1; case D3DFMT_A16B16G16R16F: formatName = "RGBA16F"; blockSize = 8; blockWidth = 1; blockHeight = 1; default: std::cout << "Unsupported FourCC format.\n"; return -5; } } else { std::cout << "Unsupported DDS format.\n"; return -6; } std::size_t height = header.dwHeight; std::size_t width = header.dwWidth; std::size_t levels = std::max<size_t>(1, header.dwMipMapCount); std::ofstream oss(outputFile); oss << "// Automatically generated header from " << inputFile << ", a " << width << "x" << height; if (levels > 1) { oss << " (" << levels << " mip levels)"; } oss << "\n// " << formatName << " texture using " << programName << ".\n"; oss << "static const size_t " << outputName << "_width = " << width << ";\n"; oss << "static const size_t " << outputName << "_height = " << height << ";\n"; oss << "static const size_t " << outputName << "_levels = " << levels << ";\n"; oss << "\n"; for (std::size_t i = 0; i < levels; ++i) { std::size_t widthAtLevel = std::max<size_t>(width >> i, 1); std::size_t heightAtLevel = std::max<size_t>(height >> i, 1); std::size_t sizeAtLevel = static_cast<std::size_t>(std::ceil(widthAtLevel / static_cast<float>(blockWidth)) * std::ceil(heightAtLevel / static_cast<float>(blockHeight))) * blockSize; std::vector<unsigned char> data(sizeAtLevel); readFile.read(reinterpret_cast<char*>(data.data()), sizeAtLevel); oss << "static const size_t " << outputName << "_" << i << "_width = " << widthAtLevel << ";\n"; oss << "static const size_t " << outputName << "_" << i << "_height = " << heightAtLevel << ";\n"; oss << "static const size_t " << outputName << "_" << i << "_size = " << sizeAtLevel << ";\n"; oss << "static const unsigned char " << outputName << "_" << i << "_data[" << sizeAtLevel << "] =\n"; oss << "{"; for (std::size_t j = 0; j < sizeAtLevel; j++) { if (j % 16 == 0) { oss << "\n "; } char buffer[32]; sprintf_s(buffer, "0x%02X,", data[j]); oss << std::string(buffer); } oss << "\n"; oss << "};\n"; if (i + 1 < levels) { oss << "\n"; } } oss.close(); readFile.close(); return 0; }
int main( int argc, char **argv ) { // use an ArgumentParser object to manage the program arguments. osg::ArgumentParser arguments(&argc,argv); // set up the usage document, in case we need to print out how to use this program. arguments.getApplicationUsage()->setDescription(arguments.getApplicationName()+" is the example which demonstrates use of osg::AnimationPath and UpdateCallbacks for adding animation to your scenes."); arguments.getApplicationUsage()->setCommandLineUsage(arguments.getApplicationName()+" [options] filename ..."); arguments.getApplicationUsage()->addCommandLineOption("-h or --help","Display this information"); arguments.getApplicationUsage()->addCommandLineOption("-o <filename>","Object to be loaded"); if( arguments.read( "-h" ) || arguments.read( "--help" ) ) { std::cout << "Argumentlist:" << std::endl; std::cout << "\t-o <filename> sets object to be loaded and sliced" << std::endl; std::cout << "\t--slices <unsigned int> sets number of slices through the object" << std::endl; std::cout << "\t--near <double> sets start for near clipping plane" << std::endl; std::cout << "\t--far <double> sets start for far clipping plane" << std::endl; return 1; } std::string outputName("volume_tex.dds"); while( arguments.read( "-o", outputName ) ) { } unsigned int numberSlices = 128; while( arguments.read( "--slices", numberSlices) ) { } double nearClip=0.0f; double farClip=0.0f; while( arguments.read( "--near",nearClip ) ) { } while( arguments.read( "--far", farClip) ) { } // load the scene. osg::ref_ptr<osg::Node> loadedModel = osgDB::readRefNodeFiles( arguments ); if (!loadedModel) { std::cout << "No data loaded." << std::endl; return 1; } const osg::BoundingSphere& bs = loadedModel->getBound(); SliceProcessor* sp = new SliceProcessor( (double)bs.radius(), numberSlices ); if (nearClip!=0.0) sp->_nearPlane = nearClip; if (farClip!=0.0) sp->_farPlane = farClip; // any option left unread are converted into errors to write out later. arguments.reportRemainingOptionsAsUnrecognized(); // report any errors if they have occurred when parsing the program arguments. if (arguments.errors()) { arguments.writeErrorMessages(std::cout); return 1; } osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits; traits->x = 100; traits->y = 100; traits->width = numberSlices; traits->height = numberSlices; traits->alpha = 8; traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; traits->pbuffer = false; osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (!gc || !gc->valid()) { osg::notify(osg::NOTICE)<<"Error: unable to create graphics window"<<std::endl; return 1; } gc->realize(); gc->makeCurrent(); // create the view of the scene. osg::ref_ptr<osgUtil::SceneView> sceneView = new osgUtil::SceneView; sceneView->setDefaults(); sceneView->setSceneData(loadedModel.get()); // initialize the view to look at the center of the scene graph osg::Matrix viewMatrix; // distance from viewport to object's center is set to be 2x bs.radius() viewMatrix.makeLookAt(bs.center()-osg::Vec3(0.0,2.0f*bs.radius(),0.0),bs.center(),osg::Vec3(0.0f,0.0f,1.0f)); // turn off autocompution of near and far clipping planes sceneView->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR); // set the clear color of the background to make sure that the alpha is 0.0. sceneView->setClearColor(osg::Vec4(0.0f,0.0f,0.0f,0.0f)); // record the timer tick at the start of rendering. osg::Timer_t start_tick = osg::Timer::instance()->tick(); std::cout << "radius: " << bs.radius() << std::endl; unsigned int frameNum = 0; double tmpNear, tmpFar; std::string baseImageName("shot_"); std::string tmpImageName; osg::Image* tmpImage = new osg::Image; // main loop (note, window toolkits which take control over the main loop will require a window redraw callback containing the code below.) for( unsigned int i = 0 ; i < sp->_sliceNumber && gc->isRealized() ; ++i ) { // set up the frame stamp for current frame to record the current time and frame number so that animtion code can advance correctly osg::ref_ptr<osg::FrameStamp> frameStamp = new osg::FrameStamp; frameStamp->setReferenceTime(osg::Timer::instance()->delta_s(start_tick,osg::Timer::instance()->tick())); frameStamp->setFrameNumber(frameNum++); // pass frame stamp to the SceneView so that the update, cull and draw traversals all use the same FrameStamp sceneView->setFrameStamp(frameStamp.get()); // update the viewport dimensions, incase the window has been resized. sceneView->setViewport(0,0,traits->width,traits->height); // set the view sceneView->setViewMatrix(viewMatrix); // set Projection Matrix tmpNear = sp->_nearPlane+i*sp->_sliceDelta; tmpFar = sp->_farPlane+(i*sp->_sliceDelta)+sp->_nearFarOffset; sceneView->setProjectionMatrixAsOrtho(-(bs.radius()+bs.radius()/2), bs.radius()+bs.radius()/2,-bs.radius(), bs.radius(), tmpNear, tmpFar); // do the update traversal the scene graph - such as updating animations sceneView->update(); // do the cull traversal, collect all objects in the view frustum into a sorted set of rendering bins sceneView->cull(); // draw the rendering bins. sceneView->draw(); // Swap Buffers gc->swapBuffers(); std::cout << "before readPixels: _r = " << sp->_image->r() << std::endl; tmpImage->readPixels(static_cast<int>(sceneView->getViewport()->x()), static_cast<int>(sceneView->getViewport()->y()), static_cast<int>(sceneView->getViewport()->width()), static_cast<int>(sceneView->getViewport()->height()), GL_RGBA,GL_UNSIGNED_BYTE); // std::cout << "vor copySubImage: _r = " << sp->_image->r() << std::endl; sp->_image->copySubImage( 0, 0, i, tmpImage ); /* std::ostringstream o; o << baseImageName << i << ".rgba"; tmpImageName = o.str(); osgDB::writeImageFile( *(sp->_image), tmpImageName ); std::cout << "Wrote image to file: " << tmpImageName << std::endl; */ } osgDB::writeImageFile( *(sp->_image), outputName); return 0; }
void Plot2hists1D(TString hist1Name, TString hist2Name, Double_t scaleFactor1=1.0, Double_t scaleFactor2=1.0, TString hist1Label = "", TString hist2Label = "") { Int_t LogY = 0; // Y-axis, No log = 0, Log = 1 int lineWidth = 2; // Line width for 1D histograms. TString outputFolder("Images"); TString outputName(outputFolder+"/"+hist1Name+"-"+hist2Name+".gif"); gSystem->MakeDirectory(outputFolder); // This is the cool part where we find the two histograms // based only on their names. This is stored as a TKey for // the moment. TKey *key1 = (TKey*)gDirectory->GetListOfKeys()->FindObject(hist1Name); TKey *key2 = (TKey*)gDirectory->GetListOfKeys()->FindObject(hist2Name); if ((key1)&&(key2)) { // Now turn the TKeys into histograms TH1 *hist1 = (TH1*)key1->ReadObj(); TH1 *hist2 = (TH1*)key2->ReadObj(); // Scale them hist1->Scale(scaleFactor1); hist2->Scale(scaleFactor2); // Set the color hist1->SetLineColor(kBlue); hist2->SetLineColor(kRed); // Set the line width hist1->SetLineWidth(lineWidth); hist2->SetLineWidth(lineWidth); // Get rid of Stats box hist1->SetStats(kFALSE); // **** // Find the max value // & rescale Y axis Double_t max1 = hist1->GetMaximum(); Double_t max2 = hist2->GetMaximum(); if (max1 > max2) { hist1->SetMaximum(1.05*max1); } else { hist1->SetMaximum(1.05*max2); } // **** // Draw them! hist1->Draw(); hist2->Draw("same"); /* // **************** // Draw Info Label TPaveText *infoBox = new TPaveText(0.85, 0.85, 0.98, 0.98, "NDC"); TText *t1; TText *t2; if ( (hist1Label=="") || (hist2Label=="") ) { *t1 = infoBox->AddText(hist1Name); *t2 = infoBox->AddText(hist2Name); } else { *t1 = infoBox->AddText(hist1Label); *t2 = infoBox->AddText(hist2Label); } infoBox->SetFillColor(kWhite); t1->SetTextColor(kBlue); t2->SetTextColor(kRed); infoBox->Draw(); // **************** */ // **************** // Draw Info Label TLegend *infoBox = new TLegend(0.74, 0.74, 0.98, 0.98, ""); if ( (hist1Label=="") || (hist2Label=="") ) { infoBox->AddEntry(hist1,hist1Name,"L"); infoBox->AddEntry(hist2,hist2Name,"L"); } else { infoBox->AddEntry(hist1,hist1Label,"L"); infoBox->AddEntry(hist2,hist2Label,"L"); } infoBox->Draw(); // **************** c1->SetLogy(LogY); // Set the axis to a log or not-log scale c1->Print(outputName); // Save the histogram to a file } else { cout << "ERROR: One of the histogram names is wrong." << endl; } }
//_____________________________________________________________________________ void ProofSimple::Terminate() { // The Terminate() function is the last function to be called during // a query. It always runs on the client, it can be used to present // the results graphically or save the results to file. // // Create a canvas, with 100 pads // TCanvas *c1 = (TCanvas *) gDirectory->FindObject("c1"); if (c1) { gDirectory->Remove(c1); delete c1; } c1 = new TCanvas("c1","Proof ProofSimple canvas",200,10,700,700); Int_t nside = (Int_t)TMath::Sqrt((Float_t)fNhist); nside = (nside*nside < fNhist) ? nside+1 : nside; c1->Divide(nside,nside,0,0); Bool_t tryfc = kFALSE; TH1F *h = 0; for (Int_t i=0; i < fNhist; i++) { if (!(h = dynamic_cast<TH1F *>(TProof::GetOutput(Form("h%d",i), fOutput)))) { // Not found: try TFileCollection tryfc = kTRUE; break; } c1->cd(i+1); h->DrawCopy(); } // If the histograms are not found they may be in files: is there a file collection? if (tryfc && GetHistosFromFC(c1) != 0) { Warning("Terminate", "histograms not found"); } else { // Final update c1->cd(); c1->Update(); } // Analyse hlab, if there if (fHLab && !gROOT->IsBatch()) { // Printout Int_t nb = fHLab->GetNbinsX(); if (nb > 0) { Double_t entb = fHLab->GetEntries() / nb; if (entb) { for (Int_t i = 0; i < nb; i++) { TString lab = TString::Format("hl%d", i); Int_t ib = fHLab->GetXaxis()->FindBin(lab); Info("Terminate"," %s [%d]:\t%f", lab.Data(), ib, fHLab->GetBinContent(ib)/entb); } } else Warning("Terminate", "no entries in the hlab histogram!"); } } // Process the ntuple, if required if (fHasNtuple != 1 || !fPlotNtuple) return; if (!(fNtp = dynamic_cast<TNtuple *>(TProof::GetOutput("ntuple", fOutput)))) { // Get the ntuple from the file if ((fProofFile = dynamic_cast<TProofOutputFile*>(fOutput->FindObject("SimpleNtuple.root")))) { TString outputFile(fProofFile->GetOutputFileName()); TString outputName(fProofFile->GetName()); outputName += ".root"; Printf("outputFile: %s", outputFile.Data()); // Read the ntuple from the file fFile = TFile::Open(outputFile); if (fFile) { Printf("Managed to open file: %s", outputFile.Data()); fNtp = (TNtuple *) fFile->Get("ntuple"); } else { Error("Terminate", "could not open file: %s", outputFile.Data()); } if (!fFile) return; } else { Error("Terminate", "TProofOutputFile not found"); return; } } // Plot ntuples if (fNtp) PlotNtuple(fNtp, "proof ntuple"); }
/*! * We want to create a SIDD NITF from something * else. For this simple example, I will use * sio.lite to read in the image data. * * SICD data is read in from the first argument. To test multi-image * SIDD, the <N times> argument uses the target <input-file> over and * over as different images in the NITF. * * The segmentation loophole can be exploitated by overriding the product * size (essentially bluffing the 10GB limit, and overriding ILOC_R=99999, * although you may not extend those limits -- they are NITF format maxes. */ int main(int argc, char** argv) { if (argc != 5 && argc != 7) { die_printf( "Usage: %s <sicd-xml> <input-file> <N times> <output-file> (Max product size) (N rows limit)\n", argv[0]); } // The input SIO file std::string inputName(argv[2]); // How many images to write (from the one source) unsigned int repeatN = str::toType<unsigned int>(argv[3]); // Output file name std::string outputName(argv[4]); // Get a NITF or GeoTIFF writer six::WriteControl* writer = getWriteControl(outputName); // Is the SIO in big-endian? bool needsByteSwap = false; try { try { sys::OS().getEnv(six::SCHEMA_PATH); } catch(const except::Exception& ) { throw except::Exception(Ctxt( "Must specify SIDD schema path via " + std::string(six::SCHEMA_PATH) + " environment variable")); } six::XMLControlFactory::getInstance(). addCreator( six::DataType::COMPLEX, new six::XMLControlCreatorT<six::sicd::ComplexXMLControl>() ); six::XMLControlFactory::getInstance(). addCreator( six::DataType::DERIVED, new six::XMLControlCreatorT<six::sidd::DerivedXMLControl>() ); // Get a Complex Data structure from an XML file six::Options options; // Set up the sicd io::FileInputStream fis(argv[1]); xml::lite::MinidomParser parser; parser.parse(fis); std::auto_ptr<logging::Logger> log (new logging::NullLogger()); six::Data* complexData = six::XMLControlFactory::getInstance().newXMLControl( six::DataType::COMPLEX, log.get())->fromXML(parser.getDocument(), std::vector<std::string>()); // Create a file container mem::SharedPtr<six::Container> container(new six::Container( six::DataType::DERIVED)); // We have a source for each image std::vector<io::InputStream*> sources; // For each image for (unsigned int i = 0; i < repeatN; ++i) { // Make an sio.lite reader sio::lite::FileReader *sioReader = new sio::lite::FileReader( new io::FileInputStream(inputName)); // Get the header out sio::lite::FileHeader* fileHeader = sioReader->readHeader(); /* * Yeah, this is getting set over and over, but that way its * easy to make this test case into a program with multiple images */ needsByteSwap = sys::isBigEndianSystem() && fileHeader->isDifferentByteOrdering(); six::PixelType pixelType; // If we got past here, it must be one of our types six::LUT* lut = getPixelInfo(fileHeader, pixelType); // Make the object six::sidd::DerivedDataBuilder builder; six::sidd::DerivedData* data = builder.steal(); //steal it builder.addDisplay(pixelType); builder.addGeographicAndTarget(six::RegionType::GEOGRAPHIC_INFO); builder.addMeasurement(six::ProjectionType::PLANE); builder.addExploitationFeatures(1); data->setNumRows(fileHeader->getNumLines()); data->setNumCols(fileHeader->getNumElements()); data->productCreation->productName = "ProductName"; data->productCreation->productClass = "Classy"; data->productCreation->classification.classification = "U"; six::sidd::ProcessorInformation& processorInformation = *data->productCreation->processorInformation; processorInformation.application = "ProcessorName"; processorInformation.profile = "Profile"; processorInformation.site = "Ypsilanti, MI"; data->display->pixelType = pixelType; data->display->decimationMethod = six::DecimationMethod::BRIGHTEST_PIXEL; data->display->magnificationMethod = six::MagnificationMethod::NEAREST_NEIGHBOR; // Give'em our LUT if (lut) { if (pixelType == six::PixelType::RGB24I) { data->display->remapInformation.reset( new six::sidd::ColorDisplayRemap(lut)); } else { data->display->remapInformation.reset( new six::sidd::MonochromeDisplayRemap("PEDF", lut)); } } data->setImageCorners(makeUpCornersFromDMS()); six::sidd::PlaneProjection* planeProjection = (six::sidd::PlaneProjection*) data->measurement->projection.get(); planeProjection->timeCOAPoly = six::Poly2D(0, 0); planeProjection->timeCOAPoly[0][0] = 1; data->measurement->arpPoly = six::PolyXYZ(0); data->measurement->arpPoly[0] = 0.0; planeProjection->productPlane.rowUnitVector = 0.0; planeProjection->productPlane.colUnitVector = 0.0; six::sidd::Collection* parent = data->exploitationFeatures->collections[0].get(); parent->information->resolution.rg = 0; parent->information->resolution.az = 0; parent->information->collectionDuration = 0; parent->information->collectionDateTime = six::DateTime(); parent->information->radarMode = six::RadarModeType::SPOTLIGHT; parent->information->sensorName = "the sensor"; data->exploitationFeatures->product.resolution.row = 0; data->exploitationFeatures->product.resolution.col = 0; data->annotations.push_back(mem::ScopedCopyablePtr< six::sidd::Annotation>(new six::sidd::Annotation)); six::sidd::Annotation *ann = (*data->annotations.rbegin()).get(); std::cout << "Hey: " << ann->spatialReferenceSystem.get() << std::endl; ann->identifier = "1st Annotation"; ann->objects.push_back(mem::ScopedCloneablePtr< six::sidd::SFAGeometry>(new six::sidd::SFAPoint)); sources.push_back(sioReader); container->addData(data); } container->addData(complexData); /* * Under normal circumstances, the library uses the * segmentation algorithm in the SICD spec, and numRowsLimit * is set to Contants::ILOC_SZ. If the user sets this, they * want us to create an alternate numRowsLimit to force the * library to segmeht on smaller boundaries. * * This is handy especially for debugging, since it will force * the algorithm to segment early. * */ if (argc == 7) { std::cout << "Overriding NITF product size and max ILOC" << std::endl; writer->getOptions().setParameter( six::NITFWriteControl::OPT_MAX_PRODUCT_SIZE, str::toType< long>(argv[5])); writer->getOptions().setParameter( six::NITFWriteControl::OPT_MAX_ILOC_ROWS, str::toType<long>(argv[6])); } // Override auto-byte swap writer->getOptions().setParameter(six::WriteControl::OPT_BYTE_SWAP, six::Parameter((sys::Uint16_T) needsByteSwap)); // Init the container writer->initialize(container); // Save the file writer->save(sources, outputName); // Delete the sources (sio read streams) for (unsigned int i = 0; i < sources.size(); ++i) { delete sources[i]; } } catch (except::Exception& ex) { std::cout << ex.toString() << std::endl; } delete writer; return 0; }