18 #include "TObjString.h" 19 #include "Compression.h" 75 tree.Branch(
"run", &
m_run,
"run/i");
77 tree.Branch(
"event", &
m_event,
"event/l");
89 tree.Branch(
"run", &
m_run,
"run/i");
103 tree.Branch(
"run", &
m_run,
"run/i");
143 m_autoFlush(pset.getUntrackedParameter<
int>(
"autoFlush", -10000000)),
160 for (
unsigned int extensions = 0; extensions <= 1; ++extensions) {
193 TObjString *tos =
dynamic_cast<TObjString *
>(
m_file->Get(
p.first.c_str()));
195 if (hstring->
str() != tos->GetString())
throw cms::Exception(
"LogicError",
"Inconsistent nanoMetadata " +
p.first +
" (" + hstring->
str() +
")");
197 auto ostr = std::make_unique<TObjString>(hstring->
str().c_str());
198 m_file->WriteTObject(ostr.release(),
p.first.c_str());
209 return nullptr !=
m_file.get();
220 m_fakeName?
"PoolOutputModule":
"NanoAODOutputModule",
225 std::vector<std::string>()
229 m_file->SetCompressionAlgorithm(ROOT::kZLIB);
231 m_file->SetCompressionAlgorithm(ROOT::kLZMA);
234 <<
"Allowed compression algorithms are ZLIB and LZMA\n";
242 if(
keep.first->className() ==
"nanoaod::FlatTable" )
244 else if(
keep.first->className() ==
"edm::TriggerResults" )
248 else throw cms::Exception(
"Configuration",
"NanoAODOutputModule cannot handle class " +
keep.first->className());
252 if(
keep.first->className() ==
"nanoaod::MergeableCounterTable" )
254 else if(
keep.first->className() ==
"nanoaod::UniqueString" &&
keep.first->moduleLabel() ==
"nanoMetadata")
256 else throw cms::Exception(
"Configuration",
"NanoAODOutputModule cannot handle class " +
keep.first->className() +
" in Run branch");
261 m_tree.reset(
new TTree(
"Events",
"Events"));
266 m_lumiTree.reset(
new TTree(
"LuminosityBlocks",
"LuminosityBlocks"));
270 m_runTree.reset(
new TTree(
"Runs",
"Runs"));
284 int basketSize = 16384;
314 ->setComment(
"ROOT compression level of output file.");
316 ->setComment(
"Algorithm used to compress data in the ROOT output file, allowed values are ZLIB and LZMA");
318 ->setComment(
"Save process provenance information, e.g. for edmProvDump");
320 ->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");
323 const std::vector<std::string>
keep = {
"drop *",
"keep nanoaodFlatTable_*Table_*_*",
"keep edmTriggerResults_*_*_*",
"keep nanoaodMergeableCounterTable_*Table_*_*",
"keep nanoaodUniqueString_nanoMetadata_*_*"};
330 ->setComment(
"PSet is only used by Data Operations and not by this module.");
std::unique_ptr< TTree > m_runTree
EventNumber_t event() const
virtual ProcessHistory const & processHistory() const
std::unique_ptr< TTree > m_lumiTree
EventID const & id() const
boost::uint64_t value() const
ModuleDescription const & description() const
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
bool isFileOpen() const override
std::unique_ptr< TTree > m_tree
void setAllowAnything()
allow any parameter label/value pairs
#define DEFINE_FWK_MODULE(type)
void fillParameterSetBranch(TTree *parameterSetsTree, int basketSize)
bool registerProcessHistory(ProcessHistory const &processHistory)
void fillProcessHistoryBranch(TTree *metaDataTree, int basketSize, ProcessHistoryRegistry const &processHistoryRegistry)
NanoAODOutputModule(edm::ParameterSet const &pset)
void fill(const edm::LuminosityBlockID &id)
void reportRunNumber(JobReport::Token token, unsigned int run)
std::vector< std::pair< std::string, edm::EDGetToken > > m_nanoMetadata
std::string const & parameterSetsTreeName()
std::unique_ptr< TTree > m_parameterSetsTree
void writeRun(edm::RunForOutput const &) override
class NanoAODOutputModule::CommonLumiBranches m_commonLumiBranches
std::unique_ptr< TTree > m_metaDataTree
std::unique_ptr< TFile > m_file
bool getByToken(EDGetToken token, TypeID const &typeID, BasicHandle &result) const
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void fill(const edm::RunID &id)
static void fillDescription(ParameterSetDescription &desc, std::vector< std::string > const &iDefaultOutputCommands=ProductSelectorRules::defaultSelectionStrings())
std::vector< SummaryTableOutputBranches > m_runTables
std::vector< TableOutputBranches > m_tables
std::vector< TriggerOutputBranches > m_triggers
SelectedProductsForBranchType const & keptProducts() const
std::string const & metaDataTreeName()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void openFile(edm::FileBlock const &) override
void reallyCloseFile() override
void fill(const edm::EventID &id)
std::string m_logicalFileName
void eventWrittenToFile(Token fileToken, RunNumber_t run, EventNumber_t event)
std::string toString() const
void outputFileClosed(Token fileToken)
void write(edm::EventForOutput const &e) override
class NanoAODOutputModule::CommonRunBranches m_commonRunBranches
~NanoAODOutputModule() override
edm::JobReport::Token m_jrToken
class NanoAODOutputModule::CommonEventBranches m_commonBranches
const std::string & str() const
edm::ProcessHistoryRegistry m_processHistoryRegistry
LuminosityBlockID const & id() const
OutputModule(edm::ParameterSet const &iPSet)
std::string m_compressionAlgorithm
std::string createGlobalIdentifier()
void reportLumiSection(JobReport::Token token, unsigned int run, unsigned int lumiSectId, unsigned long nEvents=0)
void writeLuminosityBlock(edm::LuminosityBlockForOutput const &) override