72 TFile* currentFile = dynamic_cast<TFile*>(gROOT->GetListOfFiles()->Last());
73 if (
nullptr == currentFile) {
74 throw cms::Exception(
"FileNotFound") <<
"unable to find the TFile '" << gROOT->GetListOfFiles()->Last() <<
"'\n"
75 <<
"retrieved by calling 'gROOT->GetListOfFiles()->Last()'\n"
76 <<
"Please check the list of files.";
83 if (
nullptr == eventTree) {
87 <<
"'\n Please check that the file is a standard CMS ROOT format.\n"
88 <<
"If the above is not the file you expect then please open your data file after all other files.";
90 Long_t eventEntry = eventTree->GetReadEntry();
95 <<
"please call GetEntry for the 'Events' TTree for each event in order to make edm::Ref's work."
96 <<
"\n Also be sure to call 'SetAddress' for all Branches after calling the GetEntry.";
101 return getIt(branchID, eventEntry);
106 IdToBuffers::iterator itBuffer =
idToBuffers_.find(branchID);
116 buffer = &(itBuffer->second);
119 throw cms::Exception(
"NullBuffer") <<
"Found a null buffer which is supposed to hold the data item."
120 <<
"\n Please contact developers since this message should not happen.";
122 if (
nullptr ==
buffer->branch_) {
123 throw cms::Exception(
"NullBranch") <<
"The TBranch which should hold the data item is null."
124 <<
"\n Please contact the developers since this message should not happen.";
126 if (
buffer->eventEntry_ != eventEntry) {
131 void* address =
buffer->class_->New();
133 static TClass
const* edproductTClass = TClass::GetClass(
typeid(
edm::WrapperBase));
135 static_cast<edm::WrapperBase const*>(
buffer->class_->DynamicCast(edproductTClass, address,
true));
137 if (
nullptr ==
prod) {
139 <<
"' to a edm::WrapperBase."
140 <<
"Please contact developers since something is very wrong.";
142 buffer->address_ = address;
143 buffer->product_ = std::shared_ptr<edm::WrapperBase const>(
prod);
146 address = &(
buffer->address_);
147 buffer->branch_->SetAddress(address);
149 buffer->branch_->GetEntry(eventEntry);
150 buffer->eventEntry_ = eventEntry;
154 <<
"Calling GetEntry with index " << eventEntry <<
"for branch " <<
buffer->branch_->GetName() <<
" failed.";
157 return buffer->product_.get();
170 associatedBranches != iEnd;
171 ++associatedBranches) {
174 if (thinnedAssociation ==
nullptr)
181 unsigned int thinnedIndex = 0;
190 if (thinnedCollection ==
nullptr) {
194 if (thinnedFromRecursiveCall !=
nullptr) {
196 return thinnedFromRecursiveCall;
202 return thinnedCollection;
208 std::vector<edm::WrapperBase const*>& foundContainers,
209 std::vector<unsigned int>&
keys)
const {
219 associatedBranches != iEnd;
220 ++associatedBranches) {
223 if (thinnedAssociation ==
nullptr)
230 unsigned int nKeys =
keys.size();
232 std::vector<unsigned int> thinnedIndexes(nKeys, doNotLookForThisIndex);
234 for (
unsigned k = 0;
k < nKeys; ++
k) {
236 if (foundContainers[
k] !=
nullptr)
239 if (
keys[
k] == doNotLookForThisIndex)
256 if (thinnedCollection ==
nullptr) {
260 for (
unsigned k = 0;
k < nKeys; ++
k) {
261 if (foundContainers[
k] ==
nullptr)
263 if (thinnedIndexes[
k] == doNotLookForThisIndex)
265 keys[
k] = thinnedIndexes[
k];
268 for (
unsigned k = 0;
k < nKeys; ++
k) {
269 if (thinnedIndexes[
k] == doNotLookForThisIndex)
271 keys[
k] = thinnedIndexes[
k];
272 foundContainers[
k] = thinnedCollection;
290 if (!
bool(classType)) {
292 <<
"\n Please make sure all the necessary libraries are available.";
296 TClass* rootClassType = TClass::GetClass(classType.typeInfo());
297 if (
nullptr == rootClassType) {
298 throw cms::Exception(
"MissingRootDictionary") <<
"could not find a ROOT dictionary for type '" <<
fullName <<
"'"
299 <<
"\n Please make sure all the necessary libraries are available.";
302 void* address = rootClassType->New();
304 static TClass
const* edproductTClass = TClass::GetClass(
typeid(
edm::WrapperBase));
306 static_cast<edm::WrapperBase const*>(rootClassType->DynamicCast(edproductTClass, address,
true));
307 if (
nullptr ==
prod) {
308 throw cms::Exception(
"FailedConversion") <<
"failed to convert a '" <<
fullName <<
"' to a edm::WrapperBase."
309 <<
"Please contact developers since something is very wrong.";
320 branch->SetAddress(address);
326 Long_t eventEntry)
const {
328 if (wrapperBase ==
nullptr) {
330 <<
"BareRootProductGetter::getThinnedAssociation, product ThinnedAssociation not found.\n";
334 <<
"BareRootProductGetter::getThinnedAssociation, product has wrong type, not a ThinnedAssociation.\n";
340 return thinnedAssociation;