CMS 3D CMS Logo

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

Classes

class  CommonEventFields
 

Public Member Functions

 NanoAODRNTupleOutputModule (edm::ParameterSet const &pset)
 
 ~NanoAODRNTupleOutputModule () override
 
- Public Member Functions inherited from edm::one::OutputModule<>
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const OutputModuleoperator= (const OutputModule &)=delete
 
 OutputModule (edm::ParameterSet const &iPSet)
 
 OutputModule (const OutputModule &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::OutputModuleBase
OutputModuleBaseoperator= (OutputModuleBase const &)=delete
 
 OutputModuleBase (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
SharedResourcesAcquirersharedResourcesAcquirer ()
 
SubProcessParentageHelper const * subProcessParentageHelper () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
- Public Member Functions inherited from edm::core::OutputModuleCore
BranchIDLists const * branchIDLists () const
 
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch () const
 
SelectedProductsForBranchType const & keptProducts () const
 
int maxEvents () const
 
const ModuleDescriptionmoduleDescription () const
 
OutputModuleCoreoperator= (OutputModuleCore const &)=delete
 
 OutputModuleCore (ParameterSet const &pset)
 
 OutputModuleCore (OutputModuleCore const &)=delete
 
OutputProcessBlockHelper const & outputProcessBlockHelper () const
 
std::string const & processName () const
 
int remainingEvents () const
 
bool selected (BranchDescription const &desc) const
 
void selectProducts (ProductRegistry const &preg, ThinnedAssociationsHelper const &, ProcessBlockHelperBase const &)
 
ThinnedAssociationsHelper const * thinnedAssociationsHelper () const
 
bool wantAllEvents () const
 
 ~OutputModuleCore () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::core::OutputModuleCore
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

void initializeNTuple (edm::EventForOutput const &e)
 
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 writeProvenance ()
 
void writeRun (edm::RunForOutput const &) override
 

Private Attributes

class NanoAODRNTupleOutputModule::CommonEventFields m_commonFields
 
std::string m_compressionAlgorithm
 
int m_compressionLevel
 
EventStringOutputFields m_evstrings
 
std::unique_ptr< TFile > m_file
 
std::string m_fileName
 
edm::JobReport::Token m_jrToken
 
std::string m_logicalFileName
 
LumiNTuple m_lumi
 
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
 
std::unique_ptr< RNTupleWriter > m_ntuple
 
edm::ProcessHistoryRegistry m_processHistoryRegistry
 
RunNTuple m_run
 
TableCollectionSet m_tables
 
std::vector< TriggerOutputFieldsm_triggers
 
bool m_writeProvenance
 

Additional Inherited Members

- Public Types inherited from edm::one::OutputModuleBase
typedef OutputModuleBase ModuleType
 
- Public Types inherited from edm::core::OutputModuleCore
typedef OutputModuleCore ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::one::OutputModuleBase
void configure (OutputModuleDescription const &desc)
 
void doBeginJob ()
 
bool doEvent (EventTransitionInfo const &, ActivityRegistry *, ModuleCallingContext const *)
 
void doPreallocate (PreallocationConfiguration const &)
 
- Protected Member Functions inherited from edm::core::OutputModuleCore
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
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 
- Protected Attributes inherited from edm::core::OutputModuleCore
std::atomic< int > remainingEvents_
 

Detailed Description

Definition at line 42 of file NanoAODRNTupleOutputModule.cc.

Constructor & Destructor Documentation

◆ NanoAODRNTupleOutputModule()

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

Definition at line 99 of file NanoAODRNTupleOutputModule.cc.

102  m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
103  m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName")),
104  m_compressionAlgorithm(pset.getUntrackedParameter<std::string>("compressionAlgorithm")),
105  m_compressionLevel(pset.getUntrackedParameter<int>("compressionLevel")),
106  m_writeProvenance(pset.getUntrackedParameter<bool>("saveProvenance", true)),
OutputModuleBase(ParameterSet const &pset)
edm::ProcessHistoryRegistry m_processHistoryRegistry

◆ ~NanoAODRNTupleOutputModule()

NanoAODRNTupleOutputModule::~NanoAODRNTupleOutputModule ( )
override

Definition at line 109 of file NanoAODRNTupleOutputModule.cc.

109 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 256 of file NanoAODRNTupleOutputModule.cc.

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

256  {
258 
259  desc.addUntracked<std::string>("fileName");
260  desc.addUntracked<std::string>("logicalFileName", "");
261  desc.addUntracked<int>("compressionLevel", 9)->setComment("ROOT compression level of output file.");
262  desc.addUntracked<std::string>("compressionAlgorithm", "ZLIB")
263  ->setComment(
264  "Algorithm used to "
265  "compress data in the ROOT output file, allowed values are ZLIB and LZMA");
266  desc.addUntracked<bool>("saveProvenance", true)
267  ->setComment("Save process provenance information, e.g. for edmProvDump");
268  const std::vector<std::string> keep = {"drop *",
269  "keep nanoaodFlatTable_*Table_*_*",
270  "keep edmTriggerResults_*_*_*",
271  "keep String_*_genModel_*",
272  "keep nanoaodMergeableCounterTable_*Table_*_*",
273  "keep nanoaodUniqueString_nanoMetadata_*_*"};
275 
276  //Used by Workflow management for their own meta data
278  dataSet.setAllowAnything();
279  desc.addUntracked<edm::ParameterSetDescription>("dataset", dataSet)
280  ->setComment("PSet is only used by Data Operations and not by this module.");
281 
283  branchSet.setAllowAnything();
284  desc.add<edm::ParameterSetDescription>("branches", branchSet);
285 
286  descriptions.addDefault(desc);
287 }
void setAllowAnything()
allow any parameter label/value pairs
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())

◆ initializeNTuple()

void NanoAODRNTupleOutputModule::initializeNTuple ( edm::EventForOutput const &  e)
private

Definition at line 180 of file NanoAODRNTupleOutputModule.cc.

References TableCollectionSet::add(), EventStringOutputFields::createFields(), NanoAODRNTupleOutputModule::CommonEventFields::createFields(), TableCollectionSet::createFields(), Exception, patZpeak::handle, iEvent, edm::InEvent, runTheMatrix::keep, edm::core::OutputModuleCore::keptProducts(), m_commonFields, m_evstrings, m_file, m_ntuple, m_tables, m_triggers, ReggeGribovPartonMC_EposLHC_2760GeV_PbPb_cfi::model, eostools::move(), AlcaSiPixelAliHarvester0T_cff::options, EventStringOutputFields::registerToken(), and unpackBuffers-CaloStage2::token.

Referenced by write().

180  {
181  // set up RNTuple schema
182  auto model = RNTupleModel::Create();
184 
185  const auto& keeps = keptProducts();
186  for (const auto& keep : keeps[edm::InEvent]) {
187  if (keep.first->className() == "nanoaod::FlatTable") {
189  const auto& token = keep.second;
190  iEvent.getByToken(token, handle);
192  } else if (keep.first->className() == "edm::TriggerResults") {
193  m_triggers.emplace_back(TriggerOutputFields(keep.first->processName(), keep.second));
194  } else if (keep.first->className() == "std::basic_string<char,std::char_traits<char> >" &&
195  keep.first->productInstanceName() == "genModel") {
197  } else {
198  throw cms::Exception("Configuration", "NanoAODOutputModule cannot handle class " + keep.first->className());
199  }
200  }
202  for (auto& trigger : m_triggers) {
203  trigger.createFields(iEvent, *model);
204  }
206  // TODO use Append
207  RNTupleWriteOptions options;
208  options.SetCompression(m_file->GetCompressionSettings());
209  m_ntuple =
210  std::make_unique<RNTupleWriter>(std::move(model), std::make_unique<RPageSinkFile>("Events", *m_file, options));
211 }
int iEvent
Definition: GenABIO.cc:224
class NanoAODRNTupleOutputModule::CommonEventFields m_commonFields
SelectedProductsForBranchType const & keptProducts() const
std::unique_ptr< RNTupleWriter > m_ntuple
std::vector< TriggerOutputFields > m_triggers
void createFields(RNTupleModel &model)
void add(const edm::EDGetToken &table_token, const nanoaod::FlatTable &table)
void registerToken(const edm::EDGetToken &token)
void createFields(const edm::EventForOutput &event, RNTupleModel &eventModel)
def move(src, dest)
Definition: eostools.py:511

◆ isFileOpen()

bool NanoAODRNTupleOutputModule::isFileOpen ( ) const
overrideprivatevirtual

Reimplemented from edm::core::OutputModuleCore.

Definition at line 138 of file NanoAODRNTupleOutputModule.cc.

References m_ntuple.

138 { return nullptr != m_ntuple.get(); }
std::unique_ptr< RNTupleWriter > m_ntuple

◆ openFile()

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

Reimplemented from edm::core::OutputModuleCore.

Definition at line 140 of file NanoAODRNTupleOutputModule.cc.

References edm::createGlobalIdentifier(), edm::core::OutputModuleCore::description(), cms::Digest::digest(), Exception, edm::InRun, runTheMatrix::keep, edm::core::OutputModuleCore::keptProducts(), m_compressionAlgorithm, m_compressionLevel, m_file, m_fileName, m_jrToken, m_logicalFileName, m_nanoMetadata, m_run, HerwigMaxPtPartonFilter_cfi::moduleLabel, RunNTuple::registerToken(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::MD5Result::toString().

140  {
141  m_file = std::make_unique<TFile>(m_fileName.c_str(), "RECREATE", "", m_compressionLevel);
143  cms::Digest branchHash;
144  m_jrToken = jr->outputFileOpened(m_fileName,
146  std::string(),
147  // TODO check if needed
148  //m_fakeName ? "PoolOutputModule" : "NanoAODOutputModule",
149  "NanoAODRNTupleOutputModule",
152  std::string(),
153  branchHash.digest().toString(),
154  std::vector<std::string>());
155 
156  if (m_compressionAlgorithm == "ZLIB") {
157  m_file->SetCompressionAlgorithm(ROOT::kZLIB);
158  } else if (m_compressionAlgorithm == "LZMA") {
159  m_file->SetCompressionAlgorithm(ROOT::kLZMA);
160  } else {
161  throw cms::Exception("Configuration")
162  << "NanoAODOutputModule configured with unknown compression algorithm '" << m_compressionAlgorithm << "'\n"
163  << "Allowed compression algorithms are ZLIB and LZMA\n";
164  }
165 
166  const auto& keeps = keptProducts();
167  for (const auto& keep : keeps[edm::InRun]) {
168  if (keep.first->className() == "nanoaod::MergeableCounterTable") {
169  m_run.registerToken(keep.second);
170  } else if (keep.first->className() == "nanoaod::UniqueString" && keep.first->moduleLabel() == "nanoMetadata") {
171  m_nanoMetadata.emplace_back(keep.first->productInstanceName(), keep.second);
172  } else {
173  throw cms::Exception(
174  "Configuration",
175  "NanoAODRNTupleOutputModule cannot handle class " + keep.first->className() + " in Run branch");
176  }
177  }
178 }
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
void registerToken(const edm::EDGetToken &token)
ModuleDescription const & description() const
MD5Result digest()
Definition: Digest.cc:171
std::string createGlobalIdentifier(bool binary=false)
SelectedProductsForBranchType const & keptProducts() const
std::string toString() const
Definition: Digest.cc:95

◆ reallyCloseFile()

void NanoAODRNTupleOutputModule::reallyCloseFile ( )
overrideprivatevirtual

Reimplemented from edm::core::OutputModuleCore.

Definition at line 231 of file NanoAODRNTupleOutputModule.cc.

References LumiNTuple::finalizeWrite(), RunNTuple::finalizeWrite(), m_file, m_jrToken, m_lumi, m_ntuple, m_run, m_writeProvenance, edm::JobReport::outputFileClosed(), and writeProvenance().

231  {
232  if (m_writeProvenance) {
233  writeProvenance();
234  }
235  // write ntuple to disk by calling the RNTupleWriter destructor
236  m_ntuple.reset();
239  m_file->Write();
240  m_file->Close();
241 
244 }
void finalizeWrite()
std::unique_ptr< RNTupleWriter > m_ntuple
void finalizeWrite()
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:467

◆ write()

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

Implements edm::core::OutputModuleCore.

Definition at line 213 of file NanoAODRNTupleOutputModule.cc.

References edm::JobReport::eventWrittenToFile(), EventStringOutputFields::fill(), NanoAODRNTupleOutputModule::CommonEventFields::fill(), TableCollectionSet::fill(), iEvent, initializeNTuple(), m_commonFields, m_evstrings, m_jrToken, m_ntuple, m_processHistoryRegistry, m_tables, m_triggers, and edm::ProcessHistoryRegistry::registerProcessHistory().

213  {
214  if (!m_ntuple) {
216  }
217 
219  jr->eventWrittenToFile(m_jrToken, iEvent.id().run(), iEvent.id().event());
220 
221  m_commonFields.fill(iEvent.id());
223  for (auto& trigger : m_triggers) {
224  trigger.fill(iEvent);
225  }
227  m_ntuple->Fill();
229 }
bool registerProcessHistory(ProcessHistory const &processHistory)
void initializeNTuple(edm::EventForOutput const &e)
int iEvent
Definition: GenABIO.cc:224
class NanoAODRNTupleOutputModule::CommonEventFields m_commonFields
void fill(const edm::EventForOutput &event)
std::unique_ptr< RNTupleWriter > m_ntuple
void eventWrittenToFile(Token fileToken, RunNumber_t run, EventNumber_t event)
Definition: JobReport.cc:462
std::vector< TriggerOutputFields > m_triggers
edm::ProcessHistoryRegistry m_processHistoryRegistry
void fill(const edm::EventForOutput &iEvent)

◆ writeLuminosityBlock()

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

Implements edm::core::OutputModuleCore.

Definition at line 111 of file NanoAODRNTupleOutputModule.cc.

References LumiNTuple::fill(), edm::LuminosityBlockForOutput::id(), m_file, m_jrToken, m_lumi, m_processHistoryRegistry, edm::OccurrenceForOutput::processHistory(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportLumiSection(), edm::LuminosityBlockID::run(), and edm::LuminosityBlockID::value().

111  {
113  jr->reportLumiSection(m_jrToken, iLumi.id().run(), iLumi.id().value());
114  m_lumi.fill(iLumi.id(), *m_file);
115  m_processHistoryRegistry.registerProcessHistory(iLumi.processHistory());
116 }
void fill(const edm::LuminosityBlockID &id, TFile &file)
bool registerProcessHistory(ProcessHistory const &processHistory)
edm::ProcessHistoryRegistry m_processHistoryRegistry
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)
Definition: JobReport.cc:494

◆ writeProvenance()

void NanoAODRNTupleOutputModule::writeProvenance ( )
private

Definition at line 246 of file NanoAODRNTupleOutputModule.cc.

References PSetNTuple::fill(), MetadataNTuple::fill(), PSetNTuple::finalizeWrite(), MetadataNTuple::finalizeWrite(), edm::pset::Registry::instance(), m_file, and m_processHistoryRegistry.

Referenced by reallyCloseFile().

246  {
247  PSetNTuple pntuple;
249  pntuple.finalizeWrite();
250 
251  MetadataNTuple mdntuple;
253  mdntuple.finalizeWrite();
254 }
void finalizeWrite()
void fill(const edm::ProcessHistoryRegistry &procHist, TFile &file)
void fill(edm::pset::Registry *pset, TFile &file)
edm::ProcessHistoryRegistry m_processHistoryRegistry
static Registry * instance()
Definition: Registry.cc:12

◆ writeRun()

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

Implements edm::core::OutputModuleCore.

Definition at line 118 of file NanoAODRNTupleOutputModule.cc.

References Exception, RunNTuple::fill(), edm::OccurrenceForOutput::getByToken(), edm::RunForOutput::id(), m_file, m_jrToken, m_nanoMetadata, m_processHistoryRegistry, m_run, AlCaHLTBitMon_ParallelJobs::p, edm::OccurrenceForOutput::processHistory(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportRunNumber(), edm::RunID::run(), and nanoaod::UniqueString::str().

118  {
120  jr->reportRunNumber(m_jrToken, iRun.id().run());
121 
122  m_run.fill(iRun, *m_file);
123 
125  for (const auto& p : m_nanoMetadata) {
126  iRun.getByToken(p.second, hstring);
127  TObjString* tos = dynamic_cast<TObjString*>(m_file->Get(p.first.c_str()));
128  if (tos && hstring->str() != tos->GetString()) {
129  throw cms::Exception("LogicError", "Inconsistent nanoMetadata " + p.first + " (" + hstring->str() + ")");
130  } else {
131  auto ostr = std::make_unique<TObjString>(hstring->str().c_str());
132  m_file->WriteTObject(ostr.release(), p.first.c_str());
133  }
134  }
135  m_processHistoryRegistry.registerProcessHistory(iRun.processHistory());
136 }
bool registerProcessHistory(ProcessHistory const &processHistory)
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
void reportRunNumber(JobReport::Token token, unsigned int run)
Definition: JobReport.cc:505
const std::string & str() const
Definition: UniqueString.h:12
edm::ProcessHistoryRegistry m_processHistoryRegistry
void fill(const edm::RunForOutput &iRun, TFile &file)

Member Data Documentation

◆ m_commonFields

class NanoAODRNTupleOutputModule::CommonEventFields NanoAODRNTupleOutputModule::m_commonFields
private

Referenced by initializeNTuple(), and write().

◆ m_compressionAlgorithm

std::string NanoAODRNTupleOutputModule::m_compressionAlgorithm
private

Definition at line 62 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile().

◆ m_compressionLevel

int NanoAODRNTupleOutputModule::m_compressionLevel
private

Definition at line 63 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile().

◆ m_evstrings

EventStringOutputFields NanoAODRNTupleOutputModule::m_evstrings
private

Definition at line 72 of file NanoAODRNTupleOutputModule.cc.

Referenced by initializeNTuple(), and write().

◆ m_file

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

◆ m_fileName

std::string NanoAODRNTupleOutputModule::m_fileName
private

Definition at line 60 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile().

◆ m_jrToken

edm::JobReport::Token NanoAODRNTupleOutputModule::m_jrToken
private

◆ m_logicalFileName

std::string NanoAODRNTupleOutputModule::m_logicalFileName
private

Definition at line 61 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile().

◆ m_lumi

LumiNTuple NanoAODRNTupleOutputModule::m_lumi
private

Definition at line 93 of file NanoAODRNTupleOutputModule.cc.

Referenced by reallyCloseFile(), and writeLuminosityBlock().

◆ m_nanoMetadata

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

Definition at line 96 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile(), and writeRun().

◆ m_ntuple

std::unique_ptr<RNTupleWriter> NanoAODRNTupleOutputModule::m_ntuple
private

Definition at line 69 of file NanoAODRNTupleOutputModule.cc.

Referenced by initializeNTuple(), isFileOpen(), reallyCloseFile(), and write().

◆ m_processHistoryRegistry

edm::ProcessHistoryRegistry NanoAODRNTupleOutputModule::m_processHistoryRegistry
private

◆ m_run

RunNTuple NanoAODRNTupleOutputModule::m_run
private

Definition at line 94 of file NanoAODRNTupleOutputModule.cc.

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

◆ m_tables

TableCollectionSet NanoAODRNTupleOutputModule::m_tables
private

Definition at line 70 of file NanoAODRNTupleOutputModule.cc.

Referenced by initializeNTuple(), and write().

◆ m_triggers

std::vector<TriggerOutputFields> NanoAODRNTupleOutputModule::m_triggers
private

Definition at line 71 of file NanoAODRNTupleOutputModule.cc.

Referenced by initializeNTuple(), and write().

◆ m_writeProvenance

bool NanoAODRNTupleOutputModule::m_writeProvenance
private

Definition at line 64 of file NanoAODRNTupleOutputModule.cc.

Referenced by reallyCloseFile().