75 TFile* currentFile =
dynamic_cast<TFile*
>(gROOT->GetListOfFiles()->Last());
76 if(
nullptr == currentFile) {
78 <<
"unable to find the TFile '" << gROOT->GetListOfFiles()->Last() <<
"'\n" 79 <<
"retrieved by calling 'gROOT->GetListOfFiles()->Last()'\n" 80 <<
"Please check the list of files.";
87 if(
nullptr == eventTree) {
91 <<
"'\n Please check that the file is a standard CMS ROOT format.\n" 92 <<
"If the above is not the file you expect then please open your data file after all other files.";
94 Long_t eventEntry = eventTree->GetReadEntry();
99 <<
"please call GetEntry for the 'Events' TTree for each event in order to make edm::Ref's work." 100 <<
"\n Also be sure to call 'SetAddress' for all Branches after calling the GetEntry." 106 return getIt(branchID, eventEntry);
113 IdToBuffers::iterator itBuffer =
idToBuffers_.find(branchID);
119 if(
nullptr == buffer) {
123 buffer = &(itBuffer->second);
125 if(
nullptr == buffer) {
127 <<
"Found a null buffer which is supposed to hold the data item." 128 <<
"\n Please contact developers since this message should not happen.";
130 if(
nullptr == buffer->
branch_) {
132 <<
"The TBranch which should hold the data item is null." 133 <<
"\n Please contact the developers since this message should not happen.";
140 void* address = buffer->
class_->New();
142 static TClass
const* edproductTClass = TClass::GetClass(
typeid(
edm::WrapperBase));
145 if(
nullptr == prod) {
147 <<
"failed to convert a '" << buffer->
class_->GetName()
148 <<
"' to a edm::WrapperBase." 149 <<
"Please contact developers since something is very wrong.";
152 buffer->
product_ = std::shared_ptr<edm::WrapperBase const>(
prod);
156 buffer->
branch_->SetAddress(address);
158 buffer->
branch_->GetEntry(eventEntry);
163 <<
"Calling GetEntry with index " << eventEntry
164 <<
"for branch " << buffer->
branch_->GetName() <<
" failed.";
175 if(!parent.
isValid())
return nullptr;
179 for(
auto associatedBranches = thinnedAssociationsHelper.
parentBegin(parent),
180 iEnd = thinnedAssociationsHelper.
parentEnd(parent);
181 associatedBranches != iEnd; ++associatedBranches) {
185 if(thinnedAssociation ==
nullptr)
continue;
191 unsigned int thinnedIndex = 0;
200 if(thinnedCollection ==
nullptr) {
204 if(thinnedFromRecursiveCall !=
nullptr) {
206 return thinnedFromRecursiveCall;
212 return thinnedCollection;
219 std::vector<edm::WrapperBase const*>& foundContainers,
220 std::vector<unsigned int>&
keys)
const {
228 for(
auto associatedBranches = thinnedAssociationsHelper.
parentBegin(parent),
229 iEnd = thinnedAssociationsHelper.
parentEnd(parent);
230 associatedBranches != iEnd; ++associatedBranches) {
234 if(thinnedAssociation ==
nullptr)
continue;
240 unsigned int nKeys = keys.size();
242 std::vector<unsigned int> thinnedIndexes(nKeys, doNotLookForThisIndex);
244 for(
unsigned k = 0;
k < nKeys; ++
k) {
246 if(foundContainers[
k] !=
nullptr)
continue;
248 if(keys[
k] == doNotLookForThisIndex)
continue;
264 if(thinnedCollection ==
nullptr) {
268 for(
unsigned k = 0;
k < nKeys; ++
k) {
269 if(foundContainers[
k] ==
nullptr)
continue;
270 if(thinnedIndexes[
k] == doNotLookForThisIndex)
continue;
271 keys[
k] = thinnedIndexes[
k];
274 for(
unsigned k = 0;
k < nKeys; ++
k) {
275 if(thinnedIndexes[
k] == doNotLookForThisIndex)
continue;
276 keys[
k] = thinnedIndexes[
k];
277 foundContainers[
k] = thinnedCollection;
289 if(
nullptr == branch) {
296 if(!
bool(classType)) {
298 <<
"could not find dictionary for type '" << fullName <<
"'" 299 <<
"\n Please make sure all the necessary libraries are available.";
303 TClass* rootClassType = TClass::GetClass(classType.typeInfo());
304 if(
nullptr == rootClassType) {
306 <<
"could not find a ROOT dictionary for type '" << fullName <<
"'" 307 <<
"\n Please make sure all the necessary libraries are available.";
310 void* address = rootClassType->New();
312 static TClass
const* edproductTClass = TClass::GetClass(
typeid(
edm::WrapperBase));
314 if(
nullptr == prod) {
316 <<
"failed to convert a '" << fullName
317 <<
"' to a edm::WrapperBase." 318 <<
"Please contact developers since something is very wrong.";
323 Buffer b(prod, branch, address, rootClassType);
329 branch->SetAddress(address);
338 if(wrapperBase ==
nullptr) {
340 <<
"BareRootProductGetter::getThinnedAssociation, product ThinnedAssociation not found.\n";
344 <<
"BareRootProductGetter::getThinnedAssociation, product has wrong type, not a ThinnedAssociation.\n";
350 return thinnedAssociation;
std::string const & branchName() const
std::type_info const & dynamicTypeInfo() const
edm::propagate_const< TClass * > class_
bool updateEvent(Long_t eventEntry)
TFile const * getFile() const
bool updateFile(TFile *file)
virtual edm::WrapperBase const * getIt(edm::ProductID const &) const override
const edm::BranchDescription & branchIDToBranch(const edm::BranchID &bid) const
static TypeWithDict byName(std::string const &name)
std::vector< ThinnedAssociationBranches >::const_iterator parentEnd(BranchID const &) const
std::string const & className() const
edm::ThinnedAssociation const * getThinnedAssociation(edm::BranchID const &branchID, Long_t eventEntry) const
virtual void getThinnedProducts(edm::ProductID const &, std::vector< edm::WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const override
TTree const * getEventTree() const
ProductID const & thinnedCollectionID() const
const edm::ThinnedAssociationsHelper & thinnedAssociationsHelper() const
std::string wrappedClassName(std::string const &iFullName)
edm::propagate_const< TBranch * > branch_
std::vector< ThinnedAssociationBranches >::const_iterator parentBegin(BranchID const &) const
Buffer * createNewBuffer(edm::BranchID const &) const
virtual edm::WrapperBase const * getThinnedProduct(edm::ProductID const &, unsigned int &key) const override
std::string const & eventTreeName()
fwlite::BranchMapReader branchMap_
ProductID const & parentCollectionID() const
bool hasParentIndex(unsigned int parentIndex, unsigned int &thinnedIndex) const
std::shared_ptr< edm::WrapperBase const > product_
edm::BranchID productToBranchID(const edm::ProductID &pid)
virtual ~BareRootProductGetter()
static HepMC::HEPEVT_Wrapper wrapper