Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62319
b: refs/heads/l1tmuon-upgrade-dev
c: 74a27c0
h: refs/heads/l1tmuon-upgrade-dev
i:
  62317: 7b1b582
  62315: 49f9bf6
  62311: 70fe0c7
  62303: 67c2332
  • Loading branch information
William Tanenbaum committed Mar 19, 2009
1 parent 594bd5d commit 0558075
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 202 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/l1tmuon-upgrade-dev: 14e366259d40fb08ec862c3af00872d906b77759
refs/heads/l1tmuon-upgrade-dev: 74a27c0adf5f6b06f2da1e8d6282a63666958297
41 changes: 27 additions & 14 deletions trunk/IOPool/Input/src/BranchMapperWithReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,48 @@
----------------------------------------------------------------------*/
#include "BranchMapperWithReader.h"
#include "DataFormats/Common/interface/RefCoreStreamer.h"
#include "DataFormats/Provenance/interface/EventEntryDescription.h"
#include "DataFormats/Provenance/interface/EntryDescriptionRegistry.h"
#include "DataFormats/Provenance/interface/Parentage.h"

namespace edm {
BranchMapperWithReader::BranchMapperWithReader() :
BranchMapper(true),
branchPtr_(0),
entryNumber_(0),
infoVector_(),
pInfoVector_(&infoVector_),
oldProductIDToBranchIDMap_()
{ }

BranchMapperWithReader::BranchMapperWithReader(
TBranch * branch,
input::EntryNumber entryNumber) :
BranchMapper(true),
branchPtr_(branch),
entryNumber_(entryNumber),
infoVector_(),
pInfoVector_(&infoVector_),
oldProductIDToBranchIDMap_()
{ }

void
BranchMapperWithReader<EventEntryInfo>::readProvenance_() const {
setRefCoreStreamer(0, fileFormatVersion_.value_ < 11, fileFormatVersion_.value_ < 2);
BranchMapperWithReader::readProvenance_() const {
setRefCoreStreamer(0, false, false);
branchPtr_->SetAddress(&pInfoVector_);
input::getEntry(branchPtr_, entryNumber_);
setRefCoreStreamer(true);
BranchMapperWithReader<EventEntryInfo> * me = const_cast<BranchMapperWithReader<EventEntryInfo> *>(this);
for (std::vector<EventEntryInfo>::const_iterator it = infoVector_.begin(), itEnd = infoVector_.end();
BranchMapperWithReader * me = const_cast<BranchMapperWithReader*>(this);
for (std::vector<ProductProvenance>::const_iterator it = infoVector_.begin(), itEnd = infoVector_.end();
it != itEnd; ++it) {
EventEntryDescription eed;
EntryDescriptionRegistry::instance()->getMapped(it->entryDescriptionID(), eed);
Parentage parentage(eed.parents());
me->insert(it->makeProductProvenance(parentage.id()));
me->insertIntoMap(it->productID(), it->branchID());
me->insert(*it);
}
}

void
BranchMapperWithReader<EventEntryInfo>::insertIntoMap(ProductID const& oldProductID, BranchID const& branchID) {
BranchMapperWithReader::insertIntoMap(ProductID const& oldProductID, BranchID const& branchID) {
oldProductIDToBranchIDMap_.insert(std::make_pair(oldProductID.oldID(), branchID));
}

BranchID
BranchMapperWithReader<EventEntryInfo>::oldProductIDToBranchID_(ProductID const& oldProductID) const {
BranchMapperWithReader::oldProductIDToBranchID_(ProductID const& oldProductID) const {
std::map<unsigned int, BranchID>::const_iterator it = oldProductIDToBranchIDMap_.find(oldProductID.oldID());
if (it == oldProductIDToBranchIDMap_.end()) {
return BranchID();
Expand Down
63 changes: 4 additions & 59 deletions trunk/IOPool/Input/src/BranchMapperWithReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,67 +18,13 @@

class TBranch;
namespace edm {
template <typename T>
class BranchMapperWithReader : public BranchMapper {
public:
BranchMapperWithReader();
BranchMapperWithReader(TBranch * branch,
input::EntryNumber entryNumber,
FileFormatVersion const& fileFormatVersion);
input::EntryNumber entryNumber);

virtual ~BranchMapperWithReader() {}

private:
virtual void readProvenance_() const;

TBranch * branchPtr_;
input::EntryNumber entryNumber_;
FileFormatVersion fileFormatVersion_;
std::vector<T> infoVector_;
mutable std::vector<T> * pInfoVector_;
};

template <typename T>
BranchMapperWithReader<T>::BranchMapperWithReader(
TBranch * branch,
input::EntryNumber entryNumber,
FileFormatVersion const& fileFormatVersion) :
BranchMapper(true),
branchPtr_(branch),
entryNumber_(entryNumber),
fileFormatVersion_(fileFormatVersion),
infoVector_(),
pInfoVector_(&infoVector_)
{ }

template <typename T>
void
BranchMapperWithReader<T>::readProvenance_() const {
branchPtr_->SetAddress(&pInfoVector_);
input::getEntry(branchPtr_, entryNumber_);
BranchMapperWithReader<T> * me = const_cast<BranchMapperWithReader<T> *>(this);
for (typename std::vector<T>::const_iterator it = infoVector_.begin(), itEnd = infoVector_.end();
it != itEnd; ++it) {
me->insert(it->makeProductProvenance());
}
}

// Backward compatibility
template <>
class BranchMapperWithReader<EventEntryInfo> : public BranchMapper {
public:
BranchMapperWithReader(
TBranch * branch,
input::EntryNumber entryNumber,
FileFormatVersion const& fileFormatVersion) :
BranchMapper(true),
branchPtr_(branch),
entryNumber_(entryNumber),
fileFormatVersion_(fileFormatVersion),
infoVector_(), pInfoVector_(&infoVector_), oldProductIDToBranchIDMap_()
{ }

virtual ~BranchMapperWithReader() {}

void insertIntoMap(ProductID const& oldProductID, BranchID const& branchID);

private:
Expand All @@ -87,9 +33,8 @@ namespace edm {

TBranch * branchPtr_;
input::EntryNumber entryNumber_;
FileFormatVersion fileFormatVersion_;
std::vector<EventEntryInfo> infoVector_;
mutable std::vector<EventEntryInfo> * pInfoVector_;
std::vector<ProductProvenance> infoVector_;
mutable std::vector<ProductProvenance> * pInfoVector_;
std::map<unsigned int, BranchID> oldProductIDToBranchIDMap_;
};
}
Expand Down
4 changes: 2 additions & 2 deletions trunk/IOPool/Input/src/ProvenanceAdaptor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ ProvenanceAdaptor.cc
----------------------------------------------------------------------*/
//------------------------------------------------------------
// Class ProvenanceAdaptor: adapts old provenance (fileFormatVersion_.value_ < 11) to new provenance.
// Also adapts old parameter sets (fileFormatVersion_.value_ < 12) to new provenance.
// Class ProvenanceAdaptor: adapts old provenance (fileFormatVersion_.value() < 11) to new provenance.
// Also adapts old parameter sets (fileFormatVersion_.value() < 12) to new provenance.
#include <algorithm>
#include <cassert>
#include "IOPool/Input/src/ProvenanceAdaptor.h"
Expand Down
4 changes: 2 additions & 2 deletions trunk/IOPool/Input/src/RootDelayedReader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ namespace edm {
assert(nextReader_);
return nextReader_->getProduct(k, ep);
}
setRefCoreStreamer(ep, fileFormatVersion_.value_ < 11, fileFormatVersion_.value_ < 2);
setRefCoreStreamer(ep, !fileFormatVersion_.splitProductIDs(), !fileFormatVersion_.productIDIsInt());
TClass *cp = gROOT->GetClass(branchInfo.branchDescription_.wrappedName().c_str());
std::auto_ptr<EDProduct> p(static_cast<EDProduct *>(cp->New()));
EDProduct *pp = p.get();
br->SetAddress(&pp);
input::getEntry(br, entryNumber_);
setRefCoreStreamer(fileFormatVersion_.value_ < 11);
setRefCoreStreamer(!fileFormatVersion_.splitProductIDs());
return p;
}
}
Loading

0 comments on commit 0558075

Please sign in to comment.