72 TFile* currentFile =
dynamic_cast<TFile*
>(gROOT->GetListOfFiles()->Last());
73 if(0 == currentFile) {
75 <<
"unable to find the TFile '" << gROOT->GetListOfFiles()->Last() <<
"'\n"
76 <<
"retrieved by calling 'gROOT->GetListOfFiles()->Last()'\n"
77 <<
"Please check the list of files.";
88 <<
"'\n Please check that the file is a standard CMS ROOT format.\n"
89 <<
"If the above is not the file you expect then please open your data file after all other files.";
91 Long_t eventEntry = eventTree->GetReadEntry();
96 <<
"please call GetEntry for the 'Events' TTree for each event in order to make edm::Ref's work."
97 <<
"\n Also be sure to call 'SetAddress' for all Branches after calling the GetEntry."
101 Buffer* buffer =
nullptr;
102 IdToBuffers::iterator itBuffer =
idToBuffers_.find(iID);
107 if(
nullptr == buffer) {
111 buffer = &(itBuffer->second);
113 if(
nullptr == buffer) {
115 <<
"Found a null buffer which is supposed to hold the data item."
116 <<
"\n Please contact developers since this message should not happen.";
118 if(
nullptr == buffer->branch_) {
120 <<
"The TBranch which should hold the data item is null."
121 <<
"\n Please contact the developers since this message should not happen.";
123 if(buffer->eventEntry_ != eventEntry) {
128 void* address = buffer->class_->New();
130 static TClass
const* edproductTClass = TClass::GetClass(
typeid(
edm::WrapperBase));
133 if(
nullptr == prod) {
135 <<
"failed to convert a '" << buffer->class_->GetName()
136 <<
"' to a edm::WrapperBase."
137 <<
"Please contact developers since something is very wrong.";
139 buffer->address_ = address;
140 buffer->product_ = std::shared_ptr<edm::WrapperBase const>(
prod);
143 address = &(buffer->address_);
144 buffer->branch_->SetAddress(address);
146 buffer->branch_->GetEntry(eventEntry);
147 buffer->eventEntry_ = eventEntry;
149 if(!buffer->product_) {
151 <<
"Calling GetEntry with index " << eventEntry
152 <<
"for branch " << buffer->branch_->GetName() <<
" failed.";
155 return buffer->product_.get();
bool updateEvent(Long_t eventEntry)
bool updateFile(TFile *file)
TTree * getEventTree() const
Buffer * createNewBuffer(edm::ProductID const &) const
std::string const & eventTreeName()
fwlite::BranchMapReader branchMap_