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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
- 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 49 of file NanoAODRNTupleOutputModule.cc.

Constructor & Destructor Documentation

◆ NanoAODRNTupleOutputModule()

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

Definition at line 106 of file NanoAODRNTupleOutputModule.cc.

109  m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
110  m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName")),
111  m_compressionAlgorithm(pset.getUntrackedParameter<std::string>("compressionAlgorithm")),
112  m_compressionLevel(pset.getUntrackedParameter<int>("compressionLevel")),
113  m_writeProvenance(pset.getUntrackedParameter<bool>("saveProvenance", true)),
OutputModuleBase(ParameterSet const &pset)
edm::ProcessHistoryRegistry m_processHistoryRegistry

◆ ~NanoAODRNTupleOutputModule()

NanoAODRNTupleOutputModule::~NanoAODRNTupleOutputModule ( )
override

Definition at line 116 of file NanoAODRNTupleOutputModule.cc.

116 {}

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 262 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.

262  {
264 
265  desc.addUntracked<std::string>("fileName");
266  desc.addUntracked<std::string>("logicalFileName", "");
267  desc.addUntracked<int>("compressionLevel", 9)->setComment("ROOT compression level of output file.");
268  desc.addUntracked<std::string>("compressionAlgorithm", "ZLIB")
269  ->setComment(
270  "Algorithm used to "
271  "compress data in the ROOT output file, allowed values are ZLIB and LZMA");
272  desc.addUntracked<bool>("saveProvenance", true)
273  ->setComment("Save process provenance information, e.g. for edmProvDump");
274  const std::vector<std::string> keep = {"drop *",
275  "keep nanoaodFlatTable_*Table_*_*",
276  "keep edmTriggerResults_*_*_*",
277  "keep String_*_genModel_*",
278  "keep nanoaodMergeableCounterTable_*Table_*_*",
279  "keep nanoaodUniqueString_nanoMetadata_*_*"};
281 
282  //Used by Workflow management for their own meta data
284  dataSet.setAllowAnything();
285  desc.addUntracked<edm::ParameterSetDescription>("dataset", dataSet)
286  ->setComment("PSet is only used by Data Operations and not by this module.");
287 
289  branchSet.setAllowAnything();
290  desc.add<edm::ParameterSetDescription>("branches", branchSet);
291 
292  descriptions.addDefault(desc);
293 }
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 187 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, MakeRNTupleWriter, ReggeGribovPartonMC_EposLHC_2760GeV_PbPb_cfi::model, eostools::move(), AlcaSiPixelAliHarvester0T_cff::options, EventStringOutputFields::registerToken(), and unpackBuffers-CaloStage2::token.

Referenced by write().

187  {
188  // set up RNTuple schema
189  auto model = RNTupleModel::Create();
191 
192  const auto& keeps = keptProducts();
193  for (const auto& keep : keeps[edm::InEvent]) {
194  if (keep.first->className() == "nanoaod::FlatTable") {
196  const auto& token = keep.second;
197  iEvent.getByToken(token, handle);
199  } else if (keep.first->className() == "edm::TriggerResults") {
200  m_triggers.emplace_back(TriggerOutputFields(keep.first->processName(), keep.second));
201  } else if (keep.first->className() == "std::basic_string<char,std::char_traits<char> >" &&
202  keep.first->productInstanceName() == "genModel") {
204  } else {
205  throw cms::Exception("Configuration", "NanoAODOutputModule cannot handle class " + keep.first->className());
206  }
207  }
209  for (auto& trigger : m_triggers) {
210  trigger.createFields(iEvent, *model);
211  }
213  // TODO use Append
214  RNTupleWriteOptions options;
215  options.SetCompression(m_file->GetCompressionSettings());
216  m_ntuple = MakeRNTupleWriter(std::move(model), std::make_unique<RPageSinkFile>("Events", *m_file, options));
217 }
#define MakeRNTupleWriter
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 145 of file NanoAODRNTupleOutputModule.cc.

References m_ntuple.

145 { 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 147 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().

147  {
148  m_file = std::make_unique<TFile>(m_fileName.c_str(), "RECREATE", "", m_compressionLevel);
150  cms::Digest branchHash;
151  m_jrToken = jr->outputFileOpened(m_fileName,
153  std::string(),
154  // TODO check if needed
155  //m_fakeName ? "PoolOutputModule" : "NanoAODOutputModule",
156  "NanoAODRNTupleOutputModule",
159  std::string(),
160  branchHash.digest().toString(),
161  std::vector<std::string>());
162 
163  if (m_compressionAlgorithm == "ZLIB") {
164  m_file->SetCompressionAlgorithm(ROOT::kZLIB);
165  } else if (m_compressionAlgorithm == "LZMA") {
166  m_file->SetCompressionAlgorithm(ROOT::kLZMA);
167  } else {
168  throw cms::Exception("Configuration")
169  << "NanoAODOutputModule configured with unknown compression algorithm '" << m_compressionAlgorithm << "'\n"
170  << "Allowed compression algorithms are ZLIB and LZMA\n";
171  }
172 
173  const auto& keeps = keptProducts();
174  for (const auto& keep : keeps[edm::InRun]) {
175  if (keep.first->className() == "nanoaod::MergeableCounterTable") {
176  m_run.registerToken(keep.second);
177  } else if (keep.first->className() == "nanoaod::UniqueString" && keep.first->moduleLabel() == "nanoMetadata") {
178  m_nanoMetadata.emplace_back(keep.first->productInstanceName(), keep.second);
179  } else {
180  throw cms::Exception(
181  "Configuration",
182  "NanoAODRNTupleOutputModule cannot handle class " + keep.first->className() + " in Run branch");
183  }
184  }
185 }
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 237 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().

237  {
238  if (m_writeProvenance) {
239  writeProvenance();
240  }
241  // write ntuple to disk by calling the RNTupleWriter destructor
242  m_ntuple.reset();
245  m_file->Write();
246  m_file->Close();
247 
250 }
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 219 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().

219  {
220  if (!m_ntuple) {
222  }
223 
225  jr->eventWrittenToFile(m_jrToken, iEvent.id().run(), iEvent.id().event());
226 
227  m_commonFields.fill(iEvent.id());
229  for (auto& trigger : m_triggers) {
230  trigger.fill(iEvent);
231  }
233  m_ntuple->Fill();
235 }
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 118 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().

118  {
120  jr->reportLumiSection(m_jrToken, iLumi.id().run(), iLumi.id().value());
121  m_lumi.fill(iLumi.id(), *m_file);
122  m_processHistoryRegistry.registerProcessHistory(iLumi.processHistory());
123 }
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 252 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().

252  {
253  PSetNTuple pntuple;
255  pntuple.finalizeWrite();
256 
257  MetadataNTuple mdntuple;
259  mdntuple.finalizeWrite();
260 }
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 125 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().

125  {
127  jr->reportRunNumber(m_jrToken, iRun.id().run());
128 
129  m_run.fill(iRun, *m_file);
130 
132  for (const auto& p : m_nanoMetadata) {
133  iRun.getByToken(p.second, hstring);
134  TObjString* tos = dynamic_cast<TObjString*>(m_file->Get(p.first.c_str()));
135  if (tos && hstring->str() != tos->GetString()) {
136  throw cms::Exception("LogicError", "Inconsistent nanoMetadata " + p.first + " (" + hstring->str() + ")");
137  } else {
138  auto ostr = std::make_unique<TObjString>(hstring->str().c_str());
139  m_file->WriteTObject(ostr.release(), p.first.c_str());
140  }
141  }
142  m_processHistoryRegistry.registerProcessHistory(iRun.processHistory());
143 }
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 69 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile().

◆ m_compressionLevel

int NanoAODRNTupleOutputModule::m_compressionLevel
private

Definition at line 70 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile().

◆ m_evstrings

EventStringOutputFields NanoAODRNTupleOutputModule::m_evstrings
private

Definition at line 79 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 67 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 68 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile().

◆ m_lumi

LumiNTuple NanoAODRNTupleOutputModule::m_lumi
private

Definition at line 100 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 103 of file NanoAODRNTupleOutputModule.cc.

Referenced by openFile(), and writeRun().

◆ m_ntuple

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

Definition at line 76 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 101 of file NanoAODRNTupleOutputModule.cc.

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

◆ m_tables

TableCollectionSet NanoAODRNTupleOutputModule::m_tables
private

Definition at line 77 of file NanoAODRNTupleOutputModule.cc.

Referenced by initializeNTuple(), and write().

◆ m_triggers

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

Definition at line 78 of file NanoAODRNTupleOutputModule.cc.

Referenced by initializeNTuple(), and write().

◆ m_writeProvenance

bool NanoAODRNTupleOutputModule::m_writeProvenance
private

Definition at line 71 of file NanoAODRNTupleOutputModule.cc.

Referenced by reallyCloseFile().