62 #include <unordered_map> 71 void set(std::shared_ptr<std::unordered_map<unsigned int, BranchDescription const*>> iMap) {
79 return std::unique_ptr<EventEntryDescription>();
95 std::shared_ptr<std::unordered_map<unsigned int, BranchDescription const*>>
bidToDesc_;
112 <<
"\n Perhaps the data being requested was not saved in this file?";
117 if (!
bool(classType)) {
119 <<
"\n Please make sure all the necessary libraries are available.";
124 if (
nullptr == wrapperObj.
address()) {
127 void* address = wrapperObj.
address();
128 branch->SetAddress(&address);
133 if (
nullptr ==
prod) {
134 throw cms::Exception(
"FailedConversion") <<
"failed to convert a '" <<
fullName <<
"' to a edm::WrapperBase." 135 <<
"Please contact developers since something is very wrong.";
138 return std::unique_ptr<WrapperBase>(
prod);
190 std::vector<EventEntryDescription>
prov_;
248 if (iTree ==
nullptr)
257 if (
nullptr ==
m_->tree_) {
261 TFile*
file =
m_->tree_->GetCurrentFile();
262 if (
nullptr ==
file) {
264 TChain* chain =
dynamic_cast<TChain*
>(
m_->tree());
265 if (
nullptr == chain) {
269 file = chain->GetFile();
270 if (
nullptr ==
file) {
293 std::unique_ptr<edm::EventAuxiliary> eaux = std::make_unique<edm::EventAuxiliary>();
298 branch->SetAddress(&pAux);
311 if (!eventSelectionsBranch) {
314 eventSelectionsBranch->SetAddress(&pEventSelectionIDVector);
315 eventSelectionsBranch->GetEntry(iEntry);
320 if (!branchListIndexBranch) {
323 branchListIndexBranch->SetAddress(&pBranchListIndexes);
324 branchListIndexBranch->GetEntry(iEntry);
325 m_->branchIDListHelper_->fixBranchListIndexes(branchListIndexes);
329 m_->reader_->setEntry(iEntry);
330 auto rp = std::make_shared<edm::RunPrincipal>(
m_->reg(),
m_->pc_,
nullptr, 0);
332 auto lbp = std::make_shared<edm::LuminosityBlockPrincipal>(
m_->reg(),
m_->pc_,
nullptr, 0);
334 auto history =
m_->phreg_->getMapped(eaux->processHistoryID());
335 m_->ep_->fillEventPrincipal(*eaux,
339 dummyEventToProcessBlockIndexes,
340 *(
m_->provRetriever_),
342 lbp->setRunPrincipal(rp);
343 m_->ep_->setLuminosityBlockPrincipal(lbp.get());
344 m_->processNames_ =
m_->ep_->processHistory();
349 Operate sentry(
m_->ep_->prodGetter());
352 std::cout <<
"While processing entry " << iEntry <<
" the following exception was caught \n" 353 << iEx.what() << std::endl;
355 std::cout <<
"While processing entry " << iEntry <<
" an unknown exception was caught" << std::endl;
384 typedef std::map<edm::ParameterSetID, edm::ParameterSetBlob> PsetMap;
386 PsetMap* psetMapPtr = &psetMap;
391 if (
nullptr == psetTree) {
395 typedef std::pair<edm::ParameterSetID, edm::ParameterSetBlob> IdToBlobs;
397 IdToBlobs* pIdToBlob = &idToBlob;
399 for (
long long i = 0;
i != psetTree->GetEntries(); ++
i) {
400 psetTree->GetEntry(
i);
401 psetMap.insert(idToBlob);
417 auto branchIDListsHelper = std::make_shared<edm::BranchIDListHelper>();
423 metaDataTree->GetEntry(0);
425 for (
auto&
prod :
m_->reg_->productListUpdator()) {
432 for (
auto const&
entry : psetMap) {
438 for (
auto const&
ph : pHistVector) {
439 m_->phreg_->registerProcessHistory(
ph);
442 m_->pointerToBranchBuffer_.erase(
m_->pointerToBranchBuffer_.begin(),
m_->pointerToBranchBuffer_.end());
444 std::unique_ptr<edm::ProductRegistry> newReg = std::make_unique<edm::ProductRegistry>();
448 for (
auto&
item : prodList) {
452 if (newFriendlyName ==
prod.friendlyClassName()) {
453 newReg->copyProduct(
prod);
455 if (
m_->fileFormatVersion_.splitProductIDs()) {
457 <<
"Cannot change friendly class name algorithm without more development work\n" 458 <<
"to update BranchIDLists. Contact the framework group.\n";
462 newReg->copyProduct(newBD);
467 m_->reg().reset(newReg.release());
473 m_->pointerToBranchBuffer_.reserve(prodList2.size());
475 for (
auto&
item : prodList2) {
480 if (
m_->tree_->GetBranch(
prod.branchName().c_str()) ==
nullptr) {
481 prod.setDropped(
true);
483 prod.setOnDemand(
true);
493 m_->branchIDListHelper_->updateFromInput(*branchIDListsPtr);
494 m_->reg_->setFrozen();
495 m_->bidToDesc_->clear();
496 for (
auto const&
p :
m_->reg_->productList()) {
497 m_->bidToDesc_->emplace(
p.second.branchID().id(), &
p.second);
499 m_->ep_ = std::make_shared<edm::EventPrincipal>(
500 m_->reg(),
m_->branchIDListHelper(),
m_->thinnedAssociationsHelper(),
m_->pc_,
nullptr);
std::vector< EventEntryDescription const * > pointerToBranchBuffer_
virtual void terminate(TList &out)=0
std::vector< ProcessConfiguration > ProcessConfigurationVector
std::string const & metaDataTreeName()
std::shared_ptr< std::unordered_map< unsigned int, BranchDescription const * > > bidToDesc_
std::vector< BranchIDList > BranchIDLists
void setTree(TTree *iTree)
virtual void preProcessing(const TList *in, TList &out)=0
std::vector< EventEntryDescription > prov_
edm::propagate_const< TTree * > tree_
edm::propagate_const< std::shared_ptr< edm::root::TFWLiteSelectorMembers > > m_
std::map< BranchKey, BranchDescription > ProductList
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
void mergeReaders_(DelayedReader *) override
void setRefCoreStreamer(bool resetAll=false)
std::string const & processHistoryBranchName()
virtual void postProcessing(TList &out)=0
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
ObjectWithDict castObject(TypeWithDict const &) const
edm::ModuleDescription md_
edm::propagate_const< std::shared_ptr< edm::ProductProvenanceRetriever > > provRetriever_
std::shared_ptr< BranchIDListHelper > & branchIDListHelper()
std::string const & parameterSetMapBranchName()
virtual void process(const edm::Event &event)=0
std::string const & fileFormatVersionBranchName()
void Terminate() override
std::vector< EventSelectionID > EventSelectionIDVector
std::string const & productDescriptionBranchName()
static TypeWithDict byName(std::string const &name)
std::string const & branchIDListBranchName()
constexpr element_type const * get() const
FileFormatVersion fileFormatVersion_
std::vector< BranchListIndex > BranchListIndexes
virtual std::unique_ptr< EventEntryDescription > getProvenance_(BranchKey const &) const
std::shared_ptr< WrapperBase > getProduct_(BranchID const &k, EDProductGetter const *ep) override
std::string friendlyName(std::string const &iFullName)
std::string const & className() const
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal() const override
std::string const & branchName() const
std::shared_ptr< ProductRegistry const > reg() const
~TFWLiteSelectorBasic() override
edm::propagate_const< std::shared_ptr< ProductRegistry > > reg_
std::string const & parameterSetsTreeName()
edm::propagate_const< std::shared_ptr< FWLiteDelayedReader > > reader_
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
bool insertMapped(value_type const &v, bool forceUpdate=false)
void updateFriendlyClassName()
edm::ProcessConfiguration pc_
std::shared_ptr< ProductRegistry > & reg()
std::string const & idToParameterSetBlobsBranchName()
TTree const * tree() const
ProcessHistoryVector vector_type
edm::propagate_const< std::shared_ptr< edm::EventPrincipal > > ep_
ProcessHistory processNames_
void setupNewFile(TFile &)
std::string const & eventSelectionsBranchName()
void SlaveTerminate() override
void setTree(TTree *iTree)
std::unique_ptr< WrapperBase > getTheProduct(BranchID const &k) const
void SlaveBegin(TTree *) override
std::string const & processConfigurationBranchName()
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
std::string wrappedClassName(std::string const &iFullName)
void Begin(TTree *) override
std::shared_ptr< ThinnedAssociationsHelper > & thinnedAssociationsHelper()
Bool_t Process(Long64_t) override
edm::propagate_const< std::shared_ptr< std::unordered_map< unsigned int, BranchDescription const * > > > bidToDesc_
edm::propagate_const< std::shared_ptr< ProcessHistoryRegistry > > phreg_
std::string const & branchListIndexesBranchName()
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
void setEntry(Long64_t iEntry)
signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal() const override
void setIsMergeable(BranchDescription &)
static Registry * instance()
void Init(TTree *) override
virtual void begin(TList *&in)=0