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
 
- 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 (ParameterSet const &pset)
 
 OutputModuleBase (OutputModuleBase const &)=delete
 
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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
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)
 
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::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 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 doBeginJob ()
 
bool doBeginLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doBeginRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
 
void doEndJob ()
 
bool doEndLuminosityBlock (LuminosityBlockPrincipal const &lbp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doEndRun (RunPrincipal const &rp, EventSetupImpl const &c, ModuleCallingContext const *)
 
bool doEvent (EventPrincipal const &ep, EventSetupImpl const &c, 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)
 
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 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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 

Detailed Description

Definition at line 47 of file NanoAODOutputModule.cc.

Constructor & Destructor Documentation

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

Definition at line 141 of file NanoAODOutputModule.cc.

141  :
144  m_fileName(pset.getUntrackedParameter<std::string>("fileName")),
145  m_logicalFileName(pset.getUntrackedParameter<std::string>("logicalFileName")),
146  m_compressionLevel(pset.getUntrackedParameter<int>("compressionLevel")),
147  m_compressionAlgorithm(pset.getUntrackedParameter<std::string>("compressionAlgorithm")),
148  m_writeProvenance(pset.getUntrackedParameter<bool>("saveProvenance", true)),
149  m_fakeName(pset.getUntrackedParameter<bool>("fakeNameForCrab", false)),
150  m_autoFlush(pset.getUntrackedParameter<int>("autoFlush", -10000000)),
152 {
153 }
OutputModuleBase(ParameterSet const &pset)
edm::ProcessHistoryRegistry m_processHistoryRegistry
std::string m_compressionAlgorithm
NanoAODOutputModule::~NanoAODOutputModule ( )
override

Definition at line 155 of file NanoAODOutputModule.cc.

156 {
157 }

Member Function Documentation

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

Definition at line 364 of file NanoAODOutputModule.cc.

References edm::ParameterSetDescription::add(), edm::ConfigurationDescriptions::addDefault(), edm::ParameterSetDescription::addUntracked(), DEFINE_FWK_MODULE, edm::OutputModule::fillDescription(), keep, edm::ParameterSetDescription::setAllowAnything(), and AlCaHLTBitMon_QueryRunRegistry::string.

364  {
366 
367  desc.addUntracked<std::string>("fileName");
368  desc.addUntracked<std::string>("logicalFileName","");
369 
370  desc.addUntracked<int>("compressionLevel", 9)
371  ->setComment("ROOT compression level of output file.");
372  desc.addUntracked<std::string>("compressionAlgorithm", "ZLIB")
373  ->setComment("Algorithm used to compress data in the ROOT output file, allowed values are ZLIB and LZMA");
374  desc.addUntracked<bool>("saveProvenance", true)
375  ->setComment("Save process provenance information, e.g. for edmProvDump");
376  desc.addUntracked<bool>("fakeNameForCrab", false)
377  ->setComment("Change the OutputModule name in the fwk job report to fake PoolOutputModule. This is needed to run on cran (and publish) till crab is fixed");
378  desc.addUntracked<int>("autoFlush", -10000000)
379  ->setComment("Autoflush parameter for ROOT file");
380 
381  //replace with whatever you want to get from the EDM by default
382  const std::vector<std::string> keep = {"drop *", "keep nanoaodFlatTable_*Table_*_*", "keep edmTriggerResults_*_*_*", "keep String_*_genModel_*", "keep nanoaodMergeableCounterTable_*Table_*_*", "keep nanoaodUniqueString_nanoMetadata_*_*"};
384 
385  //Used by Workflow management for their own meta data
387  dataSet.setAllowAnything();
388  desc.addUntracked<edm::ParameterSetDescription>("dataset", dataSet)
389  ->setComment("PSet is only used by Data Operations and not by this module.");
390 
392  branchSet.setAllowAnything();
393  desc.add<edm::ParameterSetDescription>("branches", branchSet);
394 
395 
396 
397  descriptions.addDefault(desc);
398 
399 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void setAllowAnything()
allow any parameter label/value pairs
const int keep
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool NanoAODOutputModule::isFileOpen ( ) const
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 260 of file NanoAODOutputModule.cc.

References m_file.

260  {
261  return nullptr != m_file.get();
262 }
std::unique_ptr< TFile > m_file
void NanoAODOutputModule::openFile ( edm::FileBlock const &  )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 265 of file NanoAODOutputModule.cc.

References NanoAODOutputModule::CommonEventBranches::branch(), NanoAODOutputModule::CommonLumiBranches::branch(), NanoAODOutputModule::CommonRunBranches::branch(), edm::createGlobalIdentifier(), edm::one::OutputModuleBase::description(), cms::Digest::digest(), Exception, edm::InEvent, 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_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(), edm::poolNames::parameterSetsTreeName(), AlCaHLTBitMon_QueryRunRegistry::string, and cms::MD5Result::toString().

265  {
266  m_file = std::make_unique<TFile>(m_fileName.c_str(),"RECREATE","",m_compressionLevel);
268  cms::Digest branchHash;
269  m_jrToken = jr->outputFileOpened(m_fileName,
271  std::string(),
272  m_fakeName?"PoolOutputModule":"NanoAODOutputModule",
273  description().moduleLabel(),
275  std::string(),
276  branchHash.digest().toString(),
277  std::vector<std::string>()
278  );
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") << "NanoAODOutputModule configured with unknown compression algorithm '" << m_compressionAlgorithm << "'\n"
286  << "Allowed compression algorithms are ZLIB and LZMA\n";
287  }
288  /* Setup file structure here */
289  m_tables.clear();
290  m_triggers.clear();
291  m_triggers_areSorted = false;
292  m_evstrings.clear();
293  m_runTables.clear();
294  const auto & keeps = keptProducts();
295  for (const auto & keep : keeps[edm::InEvent]) {
296  if(keep.first->className() == "nanoaod::FlatTable" )
297  m_tables.emplace_back(keep.first, keep.second);
298  else if(keep.first->className() == "edm::TriggerResults" )
299  {
300  m_triggers.emplace_back(keep.first, keep.second);
301  }
302  else if(keep.first->className() == "std::basic_string<char,std::char_traits<char> >" && keep.first->productInstanceName()=="genModel") { // friendlyClassName == "String"
303  m_evstrings.emplace_back(keep.first, keep.second, true); // update only at lumiBlock transitions
304  }
305  else throw cms::Exception("Configuration", "NanoAODOutputModule cannot handle class " + keep.first->className());
306  }
307 
308  for (const auto & keep : keeps[edm::InRun]) {
309  if(keep.first->className() == "nanoaod::MergeableCounterTable" )
310  m_runTables.push_back(SummaryTableOutputBranches(keep.first, keep.second));
311  else if(keep.first->className() == "nanoaod::UniqueString" && keep.first->moduleLabel() == "nanoMetadata")
312  m_nanoMetadata.emplace_back(keep.first->productInstanceName(), keep.second);
313  else throw cms::Exception("Configuration", "NanoAODOutputModule cannot handle class " + keep.first->className() + " in Run branch");
314  }
315 
316 
317  // create the trees
318  m_tree.reset(new TTree("Events","Events"));
319  m_tree->SetAutoSave(0);
320  m_tree->SetAutoFlush(0);
322 
323  m_lumiTree.reset(new TTree("LuminosityBlocks","LuminosityBlocks"));
324  m_lumiTree->SetAutoSave(0);
326 
327  m_runTree.reset(new TTree("Runs","Runs"));
328  m_runTree->SetAutoSave(0);
330 
331  if (m_writeProvenance) {
332  m_metaDataTree.reset(new TTree(edm::poolNames::metaDataTreeName().c_str(),"Job metadata"));
333  m_metaDataTree->SetAutoSave(0);
334  m_parameterSetsTree.reset(new TTree(edm::poolNames::parameterSetsTreeName().c_str(),"Parameter sets"));
335  m_parameterSetsTree->SetAutoSave(0);
336  }
337 }
std::unique_ptr< TTree > m_runTree
std::unique_ptr< TTree > m_lumiTree
ModuleDescription const & description() const
std::unique_ptr< TTree > m_tree
MD5Result digest() const
Definition: Digest.cc:171
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:257
std::unique_ptr< TTree > m_parameterSetsTree
class NanoAODOutputModule::CommonLumiBranches m_commonLumiBranches
std::unique_ptr< TTree > m_metaDataTree
const int keep
std::unique_ptr< TFile > m_file
std::vector< EventStringOutputBranches > m_evstrings
std::vector< SummaryTableOutputBranches > m_runTables
std::vector< TableOutputBranches > m_tables
std::vector< TriggerOutputBranches > m_triggers
SelectedProductsForBranchType const & keptProducts() const
std::string const & metaDataTreeName()
Definition: BranchType.cc:169
std::string toString() const
Definition: Digest.cc:95
class NanoAODOutputModule::CommonRunBranches m_commonRunBranches
edm::JobReport::Token m_jrToken
class NanoAODOutputModule::CommonEventBranches m_commonBranches
std::string m_compressionAlgorithm
std::string createGlobalIdentifier()
void NanoAODOutputModule::reallyCloseFile ( )
overrideprivatevirtual

Reimplemented from edm::one::OutputModuleBase.

Definition at line 339 of file NanoAODOutputModule.cc.

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().

339  {
340  if (m_writeProvenance) {
341  int basketSize = 16384; // fixme configurable?
344  if (m_metaDataTree->GetNbranches() != 0) {
345  m_metaDataTree->SetEntries(-1);
346  }
347  if (m_parameterSetsTree->GetNbranches() != 0) {
348  m_parameterSetsTree->SetEntries(-1);
349  }
350  }
351  m_file->Write();
352  m_file->Close();
353  m_file.reset();
354  m_tree.release(); // apparently root has ownership
355  m_lumiTree.release(); //
356  m_runTree.release(); //
357  m_metaDataTree.release(); //
358  m_parameterSetsTree.release(); //
361 }
std::unique_ptr< TTree > m_runTree
std::unique_ptr< TTree > m_lumiTree
std::unique_ptr< TTree > m_tree
void fillParameterSetBranch(TTree *parameterSetsTree, int basketSize)
void fillProcessHistoryBranch(TTree *metaDataTree, int basketSize, ProcessHistoryRegistry const &processHistoryRegistry)
std::unique_ptr< TTree > m_parameterSetsTree
std::unique_ptr< TTree > m_metaDataTree
std::unique_ptr< TFile > m_file
void outputFileClosed(Token fileToken)
Definition: JobReport.cc:433
edm::JobReport::Token m_jrToken
edm::ProcessHistoryRegistry m_processHistoryRegistry
void NanoAODOutputModule::write ( edm::EventForOutput const &  e)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 160 of file NanoAODOutputModule.cc.

References a, b, edm::EventID::event(), PatBasicFWLiteAnalyzer::events, edm::JobReport::eventWrittenToFile(), NanoAODOutputModule::CommonEventBranches::fill(), spr::find(), edm::EventForOutput::id(), 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::OccurrenceForOutput::processHistory(), TriggerOutputBranches::processName(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::EventID::run(), and lumiQTWidget::t.

160  {
161  //Get data from 'e' and write it to the file
163  jr->eventWrittenToFile(m_jrToken, iEvent.id().run(), iEvent.id().event());
164 
165  if (m_autoFlush) {
166  int64_t events = m_tree->GetEntriesFast();
167  if (events == m_firstFlush) {
168  m_tree->FlushBaskets();
169  float maxMemory;
170  if (m_autoFlush > 0) {
171  // Estimate the memory we'll be using at the first full flush by
172  // linearly scaling the number of events.
173  float percentClusterDone = m_firstFlush / static_cast<float>(m_autoFlush);
174  maxMemory = static_cast<float>(m_tree->GetTotBytes()) / percentClusterDone;
175  } else if (m_tree->GetZipBytes() == 0) {
176  maxMemory = 100*1024*1024; // Degenerate case of no information in the tree; arbitrary value
177  } else {
178  // Estimate the memory we'll be using by scaling the current compression ratio.
179  float cxnRatio = m_tree->GetTotBytes() / static_cast<float>(m_tree->GetZipBytes());
180  maxMemory = -m_autoFlush * cxnRatio;
181  float percentBytesDone = -m_tree->GetZipBytes() / static_cast<float>(m_autoFlush);
182  m_autoFlush = m_firstFlush / percentBytesDone;
183  }
184  //std::cout << "OptimizeBaskets: total bytes " << m_tree->GetTotBytes() << std::endl;
185  //std::cout << "OptimizeBaskets: zip bytes " << m_tree->GetZipBytes() << std::endl;
186  //std::cout << "OptimizeBaskets: autoFlush " << m_autoFlush << std::endl;
187  //std::cout << "OptimizeBaskets: maxMemory " << static_cast<uint32_t>(maxMemory) << std::endl;
188  //m_tree->OptimizeBaskets(static_cast<uint32_t>(maxMemory), 1, "d");
189  m_tree->OptimizeBaskets(static_cast<uint32_t>(maxMemory), 1, "");
190  }
192  m_tree->FlushBaskets();
193  m_eventsSinceFlush = 0;
194  }
196  }
197 
199  // fill all tables, starting from main tables and then doing extension tables
200  for (unsigned int extensions = 0; extensions <= 1; ++extensions) {
201  for (auto & t : m_tables) t.fill(iEvent,*m_tree,extensions);
202  }
203  if (!m_triggers_areSorted) { // sort triggers/flags in inverse processHistory order, to save without any special label the most recent ones
204  std::vector<std::string> pnames;
205  for (auto& p : iEvent.processHistory())
206  pnames.push_back(p.processName());
207  std::sort(m_triggers.begin(), m_triggers.end(), [pnames](TriggerOutputBranches& a, TriggerOutputBranches& b) {
208  return ((std::find(pnames.begin(), pnames.end(), a.processName()) - pnames.begin()) >
209  (std::find(pnames.begin(), pnames.end(), b.processName()) - pnames.begin()));
210  });
211  m_triggers_areSorted = true;
212  }
213  // fill triggers
214  for (auto & t : m_triggers) t.fill(iEvent,*m_tree);
215  // fill event branches
216  for (auto & t : m_evstrings) t.fill(iEvent,*m_tree);
217  m_tree->Fill();
218 
220 }
std::unique_ptr< TTree > m_tree
bool registerProcessHistory(ProcessHistory const &processHistory)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
int iEvent
Definition: GenABIO.cc:224
std::vector< EventStringOutputBranches > m_evstrings
std::vector< TableOutputBranches > m_tables
std::vector< TriggerOutputBranches > m_triggers
void eventWrittenToFile(Token fileToken, RunNumber_t run, EventNumber_t event)
Definition: JobReport.cc:428
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
edm::JobReport::Token m_jrToken
class NanoAODOutputModule::CommonEventBranches m_commonBranches
edm::ProcessHistoryRegistry m_processHistoryRegistry
void NanoAODOutputModule::writeLuminosityBlock ( edm::LuminosityBlockForOutput const &  iLumi)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 223 of file NanoAODOutputModule.cc.

References NanoAODOutputModule::CommonLumiBranches::fill(), edm::LuminosityBlockForOutput::id(), m_commonLumiBranches, m_jrToken, m_lumiTree, m_processHistoryRegistry, edm::OccurrenceForOutput::processHistory(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::JobReport::reportLumiSection(), edm::LuminosityBlockID::run(), and edm::LuminosityBlockID::value().

223  {
225  jr->reportLumiSection(m_jrToken, iLumi.id().run(), iLumi.id().value());
226 
227  m_commonLumiBranches.fill(iLumi.id());
228  m_lumiTree->Fill();
229 
230  m_processHistoryRegistry.registerProcessHistory(iLumi.processHistory());
231 }
std::unique_ptr< TTree > m_lumiTree
bool registerProcessHistory(ProcessHistory const &processHistory)
void fill(const edm::LuminosityBlockID &id)
class NanoAODOutputModule::CommonLumiBranches m_commonLumiBranches
edm::JobReport::Token m_jrToken
edm::ProcessHistoryRegistry m_processHistoryRegistry
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)
Definition: JobReport.cc:458
void NanoAODOutputModule::writeRun ( edm::RunForOutput const &  iRun)
overrideprivatevirtual

Implements edm::one::OutputModuleBase.

Definition at line 234 of file NanoAODOutputModule.cc.

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 lumiQTWidget::t.

234  {
236  jr->reportRunNumber(m_jrToken, iRun.id().run());
237 
238  m_commonRunBranches.fill(iRun.id());
239 
240  for (auto & t : m_runTables) t.fill(iRun,*m_runTree);
241 
243  for (const auto & p : m_nanoMetadata) {
244  iRun.getByToken(p.second, hstring);
245  TObjString *tos = dynamic_cast<TObjString *>(m_file->Get(p.first.c_str()));
246  if (tos) {
247  if (hstring->str() != tos->GetString()) throw cms::Exception("LogicError", "Inconsistent nanoMetadata " + p.first + " (" + hstring->str() +")");
248  } else {
249  auto ostr = std::make_unique<TObjString>(hstring->str().c_str());
250  m_file->WriteTObject(ostr.release(), p.first.c_str());
251  }
252  }
253 
254  m_runTree->Fill();
255 
256  m_processHistoryRegistry.registerProcessHistory(iRun.processHistory());
257 }
std::unique_ptr< TTree > m_runTree
bool registerProcessHistory(ProcessHistory const &processHistory)
void reportRunNumber(JobReport::Token token, unsigned int run)
Definition: JobReport.cc:469
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
std::unique_ptr< TFile > m_file
std::vector< SummaryTableOutputBranches > m_runTables
class NanoAODOutputModule::CommonRunBranches m_commonRunBranches
edm::JobReport::Token m_jrToken
const std::string & str() const
Definition: UniqueString.h:12
edm::ProcessHistoryRegistry m_processHistoryRegistry

Member Data Documentation

int NanoAODOutputModule::m_autoFlush
private

Definition at line 69 of file NanoAODOutputModule.cc.

Referenced by write().

class NanoAODOutputModule::CommonEventBranches NanoAODOutputModule::m_commonBranches
private

Referenced by openFile(), and write().

class NanoAODOutputModule::CommonLumiBranches NanoAODOutputModule::m_commonLumiBranches
private

Referenced by openFile(), and writeLuminosityBlock().

class NanoAODOutputModule::CommonRunBranches NanoAODOutputModule::m_commonRunBranches
private

Referenced by openFile(), and writeRun().

std::string NanoAODOutputModule::m_compressionAlgorithm
private

Definition at line 66 of file NanoAODOutputModule.cc.

Referenced by openFile().

int NanoAODOutputModule::m_compressionLevel
private

Definition at line 64 of file NanoAODOutputModule.cc.

Referenced by openFile().

int NanoAODOutputModule::m_eventsSinceFlush {0}
private

Definition at line 65 of file NanoAODOutputModule.cc.

Referenced by write().

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

Definition at line 121 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

bool NanoAODOutputModule::m_fakeName
private

Definition at line 68 of file NanoAODOutputModule.cc.

Referenced by openFile().

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

Definition at line 72 of file NanoAODOutputModule.cc.

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

std::string NanoAODOutputModule::m_fileName
private

Definition at line 62 of file NanoAODOutputModule.cc.

Referenced by openFile().

int NanoAODOutputModule::m_firstFlush {1000}
staticprivate

Definition at line 75 of file NanoAODOutputModule.cc.

Referenced by write().

edm::JobReport::Token NanoAODOutputModule::m_jrToken
private
std::string NanoAODOutputModule::m_logicalFileName
private

Definition at line 63 of file NanoAODOutputModule.cc.

Referenced by openFile().

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

Definition at line 73 of file NanoAODOutputModule.cc.

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

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

Definition at line 73 of file NanoAODOutputModule.cc.

Referenced by openFile(), and reallyCloseFile().

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

Definition at line 125 of file NanoAODOutputModule.cc.

Referenced by openFile(), and writeRun().

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

Definition at line 73 of file NanoAODOutputModule.cc.

Referenced by openFile(), and reallyCloseFile().

edm::ProcessHistoryRegistry NanoAODOutputModule::m_processHistoryRegistry
private

Definition at line 70 of file NanoAODOutputModule.cc.

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

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

Definition at line 123 of file NanoAODOutputModule.cc.

Referenced by openFile(), and writeRun().

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

Definition at line 73 of file NanoAODOutputModule.cc.

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

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

Definition at line 118 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

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

Definition at line 73 of file NanoAODOutputModule.cc.

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

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

Definition at line 119 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

bool NanoAODOutputModule::m_triggers_areSorted = false
private

Definition at line 120 of file NanoAODOutputModule.cc.

Referenced by openFile(), and write().

bool NanoAODOutputModule::m_writeProvenance
private

Definition at line 67 of file NanoAODOutputModule.cc.

Referenced by openFile(), and reallyCloseFile().