CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
NanoAODOutputModule Class Reference
Inheritance diagram for NanoAODOutputModule:
edm::one::OutputModule<> edm::one::OutputModuleBase edm::EDConsumerBase

Classes

class  CommonEventBranches
 
class  CommonLumiBranches
 
class  CommonRunBranches
 

Public Member Functions

 NanoAODOutputModule (edm::ParameterSet const &pset)
 
 ~NanoAODOutputModule () override
 
- Public Member Functions inherited from edm::one::OutputModule<>
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
 OutputModule (edm::ParameterSet const &iPSet)
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::OutputModuleBase
BranchIDLists const * branchIDLists ()
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &)
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~OutputModuleBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::OutputModuleBase
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Private Member Functions

bool isFileOpen () const override
 
void openFile (edm::FileBlock const &) override
 
void reallyCloseFile () override
 
void write (edm::EventForOutput const &e) override
 
void writeLuminosityBlock (edm::LuminosityBlockForOutput const &) override
 
void writeRun (edm::RunForOutput const &) override
 

Private Attributes

int m_autoFlush
 
class NanoAODOutputModule::CommonEventBranches m_commonBranches
 
class NanoAODOutputModule::CommonLumiBranches m_commonLumiBranches
 
class NanoAODOutputModule::CommonRunBranches m_commonRunBranches
 
std::string m_compressionAlgorithm
 
int m_compressionLevel
 
int m_eventsSinceFlush {0}
 
std::vector< EventStringOutputBranchesm_evstrings
 
bool m_fakeName
 
std::unique_ptr< TFile > m_file
 
std::string m_fileName
 
edm::JobReport::Token m_jrToken
 
std::string m_logicalFileName
 
std::vector< SummaryTableOutputBranchesm_lumiTables
 
std::unique_ptr< TTree > m_lumiTree
 
std::unique_ptr< TTree > m_metaDataTree
 
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
 
std::unique_ptr< TTree > m_parameterSetsTree
 
edm::ProcessHistoryRegistry m_processHistoryRegistry
 
std::vector< SummaryTableOutputBranchesm_runTables
 
std::unique_ptr< TTree > m_runTree
 
std::vector< TableOutputBranchesm_tables
 
std::unique_ptr< TTree > m_tree
 
std::vector< TriggerOutputBranchesm_triggers
 
bool m_triggers_areSorted = false
 
bool m_writeProvenance
 

Static Private Attributes

static constexpr int m_firstFlush {1000}
 

Additional Inherited Members

- Public Types inherited from edm::one::OutputModuleBase
typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
ModuleDescription const & description () const
 
void doAccessInputProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
void doBeginJob ()
 
bool doBeginLuminosityBlock (LumiTransitionInfo const &, ModuleCallingContext const *)
 
void doBeginProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
bool doBeginRun (RunTransitionInfo const &, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LumiTransitionInfo const &, ModuleCallingContext const *)
 
void doEndProcessBlock (ProcessBlockPrincipal const &, ModuleCallingContext const *)
 
bool doEndRun (RunTransitionInfo const &, ModuleCallingContext const *)
 
bool doEvent (EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
std::map< BranchID::value_type, BranchID::value_type > const & droppedBranchIDToKeptBranchID ()
 
virtual void preallocLumis (unsigned int)
 
ParameterSetID selectorConfig () const
 
void setEventSelectionInfo (std::map< std::string, std::vector< std::pair< std::string, int >>> const &outputModulePathPositions, bool anyProductProduced)
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 48 of file NanoAODOutputModule.cc.

Constructor & Destructor Documentation

◆ NanoAODOutputModule()

NanoAODOutputModule::NanoAODOutputModule ( edm::ParameterSet const &  pset)

Definition at line 144 of file NanoAODOutputModule.cc.

147  m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
148  m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName")),
149  m_compressionLevel(pset.getUntrackedParameter<int>("compressionLevel")),
150  m_compressionAlgorithm(pset.getUntrackedParameter<std::string>("compressionAlgorithm")),
151  m_writeProvenance(pset.getUntrackedParameter<bool>("saveProvenance", true)),
152  m_fakeName(pset.getUntrackedParameter<bool>("fakeNameForCrab", false)),
153  m_autoFlush(pset.getUntrackedParameter<int>("autoFlush", -10000000)),

◆ ~NanoAODOutputModule()

NanoAODOutputModule::~NanoAODOutputModule ( )
override

Definition at line 156 of file NanoAODOutputModule.cc.

156 {}

Member Function Documentation

◆ fillDescriptions()

void NanoAODOutputModule::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 375 of file NanoAODOutputModule.cc.

375  {
377 
378  desc.addUntracked<std::string>("fileName");
379  desc.addUntracked<std::string>("logicalFileName", "");
380 
381  desc.addUntracked<int>("compressionLevel", 9)->setComment("ROOT compression level of output file.");
382  desc.addUntracked<std::string>("compressionAlgorithm", "ZLIB")
383  ->setComment("Algorithm used to compress data in the ROOT output file, allowed values are ZLIB and LZMA");
384  desc.addUntracked<bool>("saveProvenance", true)
385  ->setComment("Save process provenance information, e.g. for edmProvDump");
386  desc.addUntracked<bool>("fakeNameForCrab", false)
387  ->setComment(
388  "Change the OutputModule name in the fwk job report to fake PoolOutputModule. This is needed to run on cran "
389  "(and publish) till crab is fixed");
390  desc.addUntracked<int>("autoFlush", -10000000)->setComment("Autoflush parameter for ROOT file");
391 
392  //replace with whatever you want to get from the EDM by default
393  const std::vector<std::string> keep = {"drop *",
394  "keep nanoaodFlatTable_*Table_*_*",
395  "keep edmTriggerResults_*_*_*",
396  "keep String_*_genModel_*",
397  "keep nanoaodMergeableCounterTable_*Table_*_*",
398  "keep nanoaodUniqueString_nanoMetadata_*_*"};
400 
401  //Used by Workflow management for their own meta data
403  dataSet.setAllowAnything();
404  desc.addUntracked<edm::ParameterSetDescription>("dataset", dataSet)
405  ->setComment("PSet is only used by Data Operations and not by this module.");
406 
408  branchSet.setAllowAnything();
409  desc.add<edm::ParameterSetDescription>("branches", branchSet);
410 
411  descriptions.addDefault(desc);
412 }

References edm::ConfigurationDescriptions::addDefault(), EgammaPostProcessor_cfi::dataSet, submitPVResolutionJobs::desc, edm::one::OutputModuleBase::fillDescription(), keep, edm::ParameterSetDescription::setAllowAnything(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ isFileOpen()

bool NanoAODOutputModule::isFileOpen ( ) const
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 264 of file NanoAODOutputModule.cc.

264 { return nullptr != m_file.get(); }

References m_file.

◆ openFile()

void NanoAODOutputModule::openFile ( edm::FileBlock const &  )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 266 of file NanoAODOutputModule.cc.

266  {
267  m_file = std::make_unique<TFile>(m_fileName.c_str(), "RECREATE", "", m_compressionLevel);
269  cms::Digest branchHash;
270  m_jrToken = jr->outputFileOpened(m_fileName,
272  std::string(),
273  m_fakeName ? "PoolOutputModule" : "NanoAODOutputModule",
276  std::string(),
277  branchHash.digest().toString(),
278  std::vector<std::string>());
279 
280  if (m_compressionAlgorithm == std::string("ZLIB")) {
281  m_file->SetCompressionAlgorithm(ROOT::kZLIB);
282  } else if (m_compressionAlgorithm == std::string("LZMA")) {
283  m_file->SetCompressionAlgorithm(ROOT::kLZMA);
284  } else {
285  throw cms::Exception("Configuration")
286  << "NanoAODOutputModule configured with unknown compression algorithm '" << m_compressionAlgorithm << "'\n"
287  << "Allowed compression algorithms are ZLIB and LZMA\n";
288  }
289  /* Setup file structure here */
290  m_tables.clear();
291  m_triggers.clear();
292  m_triggers_areSorted = false;
293  m_evstrings.clear();
294  m_runTables.clear();
295  m_lumiTables.clear();
296  const auto& keeps = keptProducts();
297  for (const auto& keep : keeps[edm::InEvent]) {
298  if (keep.first->className() == "nanoaod::FlatTable")
299  m_tables.emplace_back(keep.first, keep.second);
300  else if (keep.first->className() == "edm::TriggerResults") {
301  m_triggers.emplace_back(keep.first, keep.second);
302  } else if (keep.first->className() == "std::basic_string<char,std::char_traits<char> >" &&
303  keep.first->productInstanceName() == "genModel") { // friendlyClassName == "String"
304  m_evstrings.emplace_back(keep.first, keep.second, true); // update only at lumiBlock transitions
305  } else
306  throw cms::Exception("Configuration", "NanoAODOutputModule cannot handle class " + keep.first->className());
307  }
308 
309  for (const auto& keep : keeps[edm::InLumi]) {
310  if (keep.first->className() == "nanoaod::MergeableCounterTable")
311  m_lumiTables.push_back(SummaryTableOutputBranches(keep.first, keep.second));
312  else if (keep.first->className() == "nanoaod::UniqueString" && keep.first->moduleLabel() == "nanoMetadata")
313  m_nanoMetadata.emplace_back(keep.first->productInstanceName(), keep.second);
314  else
315  throw cms::Exception(
316  "Configuration",
317  "NanoAODOutputModule cannot handle class " + keep.first->className() + " in LuminosityBlock branch");
318  }
319 
320  for (const auto& keep : keeps[edm::InRun]) {
321  if (keep.first->className() == "nanoaod::MergeableCounterTable")
322  m_runTables.push_back(SummaryTableOutputBranches(keep.first, keep.second));
323  else if (keep.first->className() == "nanoaod::UniqueString" && keep.first->moduleLabel() == "nanoMetadata")
324  m_nanoMetadata.emplace_back(keep.first->productInstanceName(), keep.second);
325  else
326  throw cms::Exception("Configuration",
327  "NanoAODOutputModule cannot handle class " + keep.first->className() + " in Run branch");
328  }
329 
330  // create the trees
331  m_tree = std::make_unique<TTree>("Events", "Events");
332  m_tree->SetAutoSave(0);
333  m_tree->SetAutoFlush(0);
335 
336  m_lumiTree = std::make_unique<TTree>("LuminosityBlocks", "LuminosityBlocks");
337  m_lumiTree->SetAutoSave(0);
339 
340  m_runTree = std::make_unique<TTree>("Runs", "Runs");
341  m_runTree->SetAutoSave(0);
343 
344  if (m_writeProvenance) {
345  m_metaDataTree = std::make_unique<TTree>(edm::poolNames::metaDataTreeName().c_str(), "Job metadata");
346  m_metaDataTree->SetAutoSave(0);
347  m_parameterSetsTree = std::make_unique<TTree>(edm::poolNames::parameterSetsTreeName().c_str(), "Parameter sets");
348  m_parameterSetsTree->SetAutoSave(0);
349  }
350 }

References NanoAODOutputModule::CommonEventBranches::branch(), NanoAODOutputModule::CommonLumiBranches::branch(), NanoAODOutputModule::CommonRunBranches::branch(), edm::createGlobalIdentifier(), edm::one::OutputModuleBase::description(), cms::Digest::digest(), Exception, edm::InEvent, edm::InLumi, edm::InRun, keep, edm::one::OutputModuleBase::keptProducts(), m_commonBranches, m_commonLumiBranches, m_commonRunBranches, m_compressionAlgorithm, m_compressionLevel, m_evstrings, m_fakeName, m_file, m_fileName, m_jrToken, m_logicalFileName, m_lumiTables, m_lumiTree, m_metaDataTree, m_nanoMetadata, m_parameterSetsTree, m_runTables, m_runTree, m_tables, m_tree, m_triggers, m_triggers_areSorted, m_writeProvenance, edm::poolNames::metaDataTreeName(), HerwigMaxPtPartonFilter_cfi::moduleLabel, edm::poolNames::parameterSetsTreeName(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::MD5Result::toString().

◆ reallyCloseFile()

void NanoAODOutputModule::reallyCloseFile ( )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 351 of file NanoAODOutputModule.cc.

351  {
352  if (m_writeProvenance) {
353  int basketSize = 16384; // fixme configurable?
356  if (m_metaDataTree->GetNbranches() != 0) {
357  m_metaDataTree->SetEntries(-1);
358  }
359  if (m_parameterSetsTree->GetNbranches() != 0) {
360  m_parameterSetsTree->SetEntries(-1);
361  }
362  }
363  m_file->Write();
364  m_file->Close();
365  m_file.reset();
366  m_tree.release(); // apparently root has ownership
367  m_lumiTree.release(); //
368  m_runTree.release(); //
369  m_metaDataTree.release(); //
370  m_parameterSetsTree.release(); //
373 }

References edm::fillParameterSetBranch(), edm::fillProcessHistoryBranch(), m_file, m_jrToken, m_lumiTree, m_metaDataTree, m_parameterSetsTree, m_processHistoryRegistry, m_runTree, m_tree, m_writeProvenance, and edm::JobReport::outputFileClosed().

◆ write()

void NanoAODOutputModule::write ( edm::EventForOutput const &  e)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 158 of file NanoAODOutputModule.cc.

158  {
159  //Get data from 'e' and write it to the file
161  jr->eventWrittenToFile(m_jrToken, iEvent.id().run(), iEvent.id().event());
162 
163  if (m_autoFlush) {
164  int64_t events = m_tree->GetEntriesFast();
165  if (events == m_firstFlush) {
166  m_tree->FlushBaskets();
167  float maxMemory;
168  if (m_autoFlush > 0) {
169  // Estimate the memory we'll be using at the first full flush by
170  // linearly scaling the number of events.
171  float percentClusterDone = m_firstFlush / static_cast<float>(m_autoFlush);
172  maxMemory = static_cast<float>(m_tree->GetTotBytes()) / percentClusterDone;
173  } else if (m_tree->GetZipBytes() == 0) {
174  maxMemory = 100 * 1024 * 1024; // Degenerate case of no information in the tree; arbitrary value
175  } else {
176  // Estimate the memory we'll be using by scaling the current compression ratio.
177  float cxnRatio = m_tree->GetTotBytes() / static_cast<float>(m_tree->GetZipBytes());
178  maxMemory = -m_autoFlush * cxnRatio;
179  float percentBytesDone = -m_tree->GetZipBytes() / static_cast<float>(m_autoFlush);
180  m_autoFlush = m_firstFlush / percentBytesDone;
181  }
182  //std::cout << "OptimizeBaskets: total bytes " << m_tree->GetTotBytes() << std::endl;
183  //std::cout << "OptimizeBaskets: zip bytes " << m_tree->GetZipBytes() << std::endl;
184  //std::cout << "OptimizeBaskets: autoFlush " << m_autoFlush << std::endl;
185  //std::cout << "OptimizeBaskets: maxMemory " << static_cast<uint32_t>(maxMemory) << std::endl;
186  //m_tree->OptimizeBaskets(static_cast<uint32_t>(maxMemory), 1, "d");
187  m_tree->OptimizeBaskets(static_cast<uint32_t>(maxMemory), 1, "");
188  }
190  m_tree->FlushBaskets();
191  m_eventsSinceFlush = 0;
192  }
194  }
195 
197  // fill all tables, starting from main tables and then doing extension tables
198  for (unsigned int extensions = 0; extensions <= 1; ++extensions) {
199  for (auto& t : m_tables)
200  t.fill(iEvent, *m_tree, extensions);
201  }
202  if (!m_triggers_areSorted) { // sort triggers/flags in inverse processHistory order, to save without any special label the most recent ones
203  std::vector<std::string> pnames;
204  for (auto& p : iEvent.processHistory())
205  pnames.push_back(p.processName());
207  return ((std::find(pnames.begin(), pnames.end(), a.processName()) - pnames.begin()) >
208  (std::find(pnames.begin(), pnames.end(), b.processName()) - pnames.begin()));
209  });
210  m_triggers_areSorted = true;
211  }
212  // fill triggers
213  for (auto& t : m_triggers)
214  t.fill(iEvent, *m_tree);
215  // fill event branches
216  for (auto& t : m_evstrings)
217  t.fill(iEvent, *m_tree);
218  m_tree->Fill();
219 
221 }

References a, b, patZpeak::events, edm::JobReport::eventWrittenToFile(), NanoAODOutputModule::CommonEventBranches::fill(), spr::find(), iEvent, m_autoFlush, m_commonBranches, m_eventsSinceFlush, m_evstrings, m_firstFlush, m_jrToken, m_processHistoryRegistry, m_tables, m_tree, m_triggers, m_triggers_areSorted, AlCaHLTBitMon_ParallelJobs::p, edm::ProcessHistoryRegistry::registerProcessHistory(), jetUpdater_cfi::sort, and submitPVValidationJobs::t.

◆ writeLuminosityBlock()

void NanoAODOutputModule::writeLuminosityBlock ( edm::LuminosityBlockForOutput const &  iLumi)
overrideprivatevirtual

◆ writeRun()

void NanoAODOutputModule::writeRun ( edm::RunForOutput const &  iRun)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 237 of file NanoAODOutputModule.cc.

237  {
239  jr->reportRunNumber(m_jrToken, iRun.id().run());
240 
241  m_commonRunBranches.fill(iRun.id());
242 
243  for (auto& t : m_runTables)
244  t.fill(iRun, *m_runTree);
245 
247  for (const auto& p : m_nanoMetadata) {
248  iRun.getByToken(p.second, hstring);
249  TObjString* tos = dynamic_cast<TObjString*>(m_file->Get(p.first.c_str()));
250  if (tos) {
251  if (hstring->str() != tos->GetString())
252  throw cms::Exception("LogicError", "Inconsistent nanoMetadata " + p.first + " (" + hstring->str() + ")");
253  } else {
254  auto ostr = std::make_unique<TObjString>(hstring->str().c_str());
255  m_file->WriteTObject(ostr.release(), p.first.c_str());
256  }
257  }
258 
259  m_runTree->Fill();
260 
261  m_processHistoryRegistry.registerProcessHistory(iRun.processHistory());
262 }

References NanoAODOutputModule::CommonRunBranches::fill(), edm::OccurrenceForOutput::getByToken(), edm::RunForOutput::id(), m_commonRunBranches, m_file, m_jrToken, m_nanoMetadata, m_processHistoryRegistry, m_runTables, m_runTree, AlCaHLTBitMon_ParallelJobs::p, edm::OccurrenceForOutput::processHistory(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportRunNumber(), edm::RunID::run(), nanoaod::UniqueString::str(), and submitPVValidationJobs::t.

Member Data Documentation

◆ m_autoFlush

int NanoAODOutputModule::m_autoFlush
private

Definition at line 70 of file NanoAODOutputModule.cc.

Referenced by write().

◆ m_commonBranches

class NanoAODOutputModule::CommonEventBranches NanoAODOutputModule::m_commonBranches
private

Referenced by openFile(), and write().

◆ m_commonLumiBranches

class NanoAODOutputModule::CommonLumiBranches NanoAODOutputModule::m_commonLumiBranches
private

Referenced by openFile(), and writeLuminosityBlock().

◆ m_commonRunBranches

class NanoAODOutputModule::CommonRunBranches NanoAODOutputModule::m_commonRunBranches
private

Referenced by openFile(), and writeRun().

◆ m_compressionAlgorithm

std::string NanoAODOutputModule::m_compressionAlgorithm
private

Definition at line 67 of file NanoAODOutputModule.cc.

Referenced by openFile().

◆ m_compressionLevel

int NanoAODOutputModule::m_compressionLevel
private

Definition at line 65 of file NanoAODOutputModule.cc.

Referenced by openFile().

◆ m_eventsSinceFlush

int NanoAODOutputModule::m_eventsSinceFlush {0}
private

Definition at line 66 of file NanoAODOutputModule.cc.

Referenced by write().

◆ m_evstrings

std::vector<EventStringOutputBranches> NanoAODOutputModule::m_evstrings
private

Definition at line 125 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

◆ m_fakeName

bool NanoAODOutputModule::m_fakeName
private

Definition at line 69 of file NanoAODOutputModule.cc.

Referenced by openFile().

◆ m_file

std::unique_ptr<TFile> NanoAODOutputModule::m_file
private

Definition at line 73 of file NanoAODOutputModule.cc.

Referenced by isFileOpen(), openFile(), reallyCloseFile(), and writeRun().

◆ m_fileName

std::string NanoAODOutputModule::m_fileName
private

Definition at line 63 of file NanoAODOutputModule.cc.

Referenced by openFile().

◆ m_firstFlush

constexpr int NanoAODOutputModule::m_firstFlush {1000}
staticconstexprprivate

Definition at line 76 of file NanoAODOutputModule.cc.

Referenced by write().

◆ m_jrToken

edm::JobReport::Token NanoAODOutputModule::m_jrToken
private

◆ m_logicalFileName

std::string NanoAODOutputModule::m_logicalFileName
private

Definition at line 64 of file NanoAODOutputModule.cc.

Referenced by openFile().

◆ m_lumiTables

std::vector<SummaryTableOutputBranches> NanoAODOutputModule::m_lumiTables
private

Definition at line 128 of file NanoAODOutputModule.cc.

Referenced by openFile(), and writeLuminosityBlock().

◆ m_lumiTree

std::unique_ptr<TTree> NanoAODOutputModule::m_lumiTree
private

Definition at line 74 of file NanoAODOutputModule.cc.

Referenced by openFile(), reallyCloseFile(), and writeLuminosityBlock().

◆ m_metaDataTree

std::unique_ptr<TTree> NanoAODOutputModule::m_metaDataTree
private

Definition at line 74 of file NanoAODOutputModule.cc.

Referenced by openFile(), and reallyCloseFile().

◆ m_nanoMetadata

std::vector<std::pair<std::string, edm::EDGetToken> > NanoAODOutputModule::m_nanoMetadata
private

Definition at line 130 of file NanoAODOutputModule.cc.

Referenced by openFile(), and writeRun().

◆ m_parameterSetsTree

std::unique_ptr<TTree> NanoAODOutputModule::m_parameterSetsTree
private

Definition at line 74 of file NanoAODOutputModule.cc.

Referenced by openFile(), and reallyCloseFile().

◆ m_processHistoryRegistry

edm::ProcessHistoryRegistry NanoAODOutputModule::m_processHistoryRegistry
private

Definition at line 71 of file NanoAODOutputModule.cc.

Referenced by reallyCloseFile(), write(), writeLuminosityBlock(), and writeRun().

◆ m_runTables

std::vector<SummaryTableOutputBranches> NanoAODOutputModule::m_runTables
private

Definition at line 127 of file NanoAODOutputModule.cc.

Referenced by openFile(), and writeRun().

◆ m_runTree

std::unique_ptr<TTree> NanoAODOutputModule::m_runTree
private

Definition at line 74 of file NanoAODOutputModule.cc.

Referenced by openFile(), reallyCloseFile(), and writeRun().

◆ m_tables

std::vector<TableOutputBranches> NanoAODOutputModule::m_tables
private

Definition at line 122 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

◆ m_tree

std::unique_ptr<TTree> NanoAODOutputModule::m_tree
private

Definition at line 74 of file NanoAODOutputModule.cc.

Referenced by openFile(), reallyCloseFile(), and write().

◆ m_triggers

std::vector<TriggerOutputBranches> NanoAODOutputModule::m_triggers
private

Definition at line 123 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

◆ m_triggers_areSorted

bool NanoAODOutputModule::m_triggers_areSorted = false
private

Definition at line 124 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

◆ m_writeProvenance

bool NanoAODOutputModule::m_writeProvenance
private

Definition at line 68 of file NanoAODOutputModule.cc.

Referenced by openFile(), and reallyCloseFile().

edm::one::OutputModule<>
NanoAODOutputModule::CommonEventBranches::fill
void fill(const edm::EventID &id)
Definition: NanoAODOutputModule.cc:85
NanoAODOutputModule::m_tree
std::unique_ptr< TTree > m_tree
Definition: NanoAODOutputModule.cc:74
edm::ProcessHistoryRegistry::registerProcessHistory
bool registerProcessHistory(ProcessHistory const &processHistory)
Definition: ProcessHistoryRegistry.cc:11
NanoAODOutputModule::m_jrToken
edm::JobReport::Token m_jrToken
Definition: NanoAODOutputModule.cc:72
cms::Digest::digest
MD5Result digest()
Definition: Digest.cc:171
NanoAODOutputModule::m_runTables
std::vector< SummaryTableOutputBranches > m_runTables
Definition: NanoAODOutputModule.cc:127
NanoAODOutputModule::m_commonRunBranches
class NanoAODOutputModule::CommonRunBranches m_commonRunBranches
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
NanoAODOutputModule::m_lumiTree
std::unique_ptr< TTree > m_lumiTree
Definition: NanoAODOutputModule.cc:74
NanoAODOutputModule::m_autoFlush
int m_autoFlush
Definition: NanoAODOutputModule.cc:70
NanoAODOutputModule::CommonEventBranches::branch
void branch(TTree &tree)
Definition: NanoAODOutputModule.cc:80
NanoAODOutputModule::m_commonLumiBranches
class NanoAODOutputModule::CommonLumiBranches m_commonLumiBranches
EgammaPostProcessor_cfi.dataSet
dataSet
Definition: EgammaPostProcessor_cfi.py:6
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::poolNames::parameterSetsTreeName
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:204
NanoAODOutputModule::m_logicalFileName
std::string m_logicalFileName
Definition: NanoAODOutputModule.cc:64
NanoAODOutputModule::m_compressionLevel
int m_compressionLevel
Definition: NanoAODOutputModule.cc:65
edm::JobReport::eventWrittenToFile
void eventWrittenToFile(Token fileToken, RunNumber_t run, EventNumber_t event)
Definition: JobReport.cc:428
TriggerOutputBranches
Definition: TriggerOutputBranches.h:13
patZpeak.events
events
Definition: patZpeak.py:20
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
NanoAODOutputModule::m_evstrings
std::vector< EventStringOutputBranches > m_evstrings
Definition: NanoAODOutputModule.cc:125
edm::Handle
Definition: AssociativeIterator.h:50
edm::InRun
Definition: BranchType.h:11
NanoAODOutputModule::m_tables
std::vector< TableOutputBranches > m_tables
Definition: NanoAODOutputModule.cc:122
edm::one::OutputModuleBase::OutputModuleBase
OutputModuleBase(ParameterSet const &pset)
Definition: OutputModuleBase.cc:45
NanoAODOutputModule::m_commonBranches
class NanoAODOutputModule::CommonEventBranches m_commonBranches
NanoAODOutputModule::CommonRunBranches::branch
void branch(TTree &tree)
Definition: NanoAODOutputModule.cc:115
NanoAODOutputModule::m_processHistoryRegistry
edm::ProcessHistoryRegistry m_processHistoryRegistry
Definition: NanoAODOutputModule.cc:71
cms::Digest
Definition: Digest.h:46
NanoAODOutputModule::CommonLumiBranches::fill
void fill(const edm::LuminosityBlockID &id)
Definition: NanoAODOutputModule.cc:103
edm::fillParameterSetBranch
void fillParameterSetBranch(TTree *parameterSetsTree, int basketSize)
Definition: CommonProvenanceFiller.cc:18
edm::JobReport::outputFileClosed
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:433
NanoAODOutputModule::m_runTree
std::unique_ptr< TTree > m_runTree
Definition: NanoAODOutputModule.cc:74
NanoAODOutputModule::m_firstFlush
static constexpr int m_firstFlush
Definition: NanoAODOutputModule.cc:76
edm::InEvent
Definition: BranchType.h:11
edm::one::OutputModuleBase::fillDescription
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
Definition: OutputModuleBase.cc:350
NanoAODOutputModule::m_eventsSinceFlush
int m_eventsSinceFlush
Definition: NanoAODOutputModule.cc:66
b
double b
Definition: hdecay.h:118
NanoAODOutputModule::m_compressionAlgorithm
std::string m_compressionAlgorithm
Definition: NanoAODOutputModule.cc:67
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
NanoAODOutputModule::CommonLumiBranches::branch
void branch(TTree &tree)
Definition: NanoAODOutputModule.cc:99
a
double a
Definition: hdecay.h:119
edm::JobReport::reportLumiSection
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)
Definition: JobReport.cc:458
edm::InLumi
Definition: BranchType.h:11
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
edm::one::OutputModuleBase::keptProducts
SelectedProductsForBranchType const & keptProducts() const
Definition: OutputModuleBase.h:95
NanoAODOutputModule::m_parameterSetsTree
std::unique_ptr< TTree > m_parameterSetsTree
Definition: NanoAODOutputModule.cc:74
edm::Service
Definition: Service.h:30
edm::createGlobalIdentifier
std::string createGlobalIdentifier(bool binary=false)
Definition: GlobalIdentifier.cc:5
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::JobReport::reportRunNumber
void reportRunNumber(JobReport::Token token, unsigned int run)
Definition: JobReport.cc:469
edm::ParameterSetDescription::setAllowAnything
void setAllowAnything()
allow any parameter label/value pairs
Definition: ParameterSetDescription.cc:37
NanoAODOutputModule::m_fakeName
bool m_fakeName
Definition: NanoAODOutputModule.cc:69
NanoAODOutputModule::m_nanoMetadata
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
Definition: NanoAODOutputModule.cc:130
NanoAODOutputModule::m_fileName
std::string m_fileName
Definition: NanoAODOutputModule.cc:63
NanoAODOutputModule::m_writeProvenance
bool m_writeProvenance
Definition: NanoAODOutputModule.cc:68
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::one::OutputModuleBase::description
ModuleDescription const & description() const
Definition: OutputModuleBase.cc:340
NanoAODOutputModule::m_lumiTables
std::vector< SummaryTableOutputBranches > m_lumiTables
Definition: NanoAODOutputModule.cc:128
NanoAODOutputModule::m_file
std::unique_ptr< TFile > m_file
Definition: NanoAODOutputModule.cc:73
NanoAODOutputModule::m_triggers
std::vector< TriggerOutputBranches > m_triggers
Definition: NanoAODOutputModule.cc:123
edm::poolNames::metaDataTreeName
std::string const & metaDataTreeName()
Definition: BranchType.cc:152
Exception
Definition: hltDiff.cc:245
edm::fillProcessHistoryBranch
void fillProcessHistoryBranch(TTree *metaDataTree, int basketSize, ProcessHistoryRegistry const &processHistoryRegistry)
Definition: CommonProvenanceFiller.cc:32
SummaryTableOutputBranches
Definition: SummaryTableOutputBranches.h:12
NanoAODOutputModule::m_metaDataTree
std::unique_ptr< TTree > m_metaDataTree
Definition: NanoAODOutputModule.cc:74
cms::Exception
Definition: Exception.h:70
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
cms::MD5Result::toString
std::string toString() const
Definition: Digest.cc:95
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
keep
const int keep
Definition: GenParticlePruner.cc:48
NanoAODOutputModule::m_triggers_areSorted
bool m_triggers_areSorted
Definition: NanoAODOutputModule.cc:124
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
NanoAODOutputModule::CommonRunBranches::fill
void fill(const edm::RunID &id)
Definition: NanoAODOutputModule.cc:116
nanoaod::UniqueString::str
const std::string & str() const
Definition: UniqueString.h:12