Skip to content

Commit

Permalink
Merge branch 'revert-secondary-input-changes' of github.com:ktf/cmssw…
Browse files Browse the repository at this point in the history
… into CMSSW_7_0_X
  • Loading branch information
ktf committed Aug 23, 2013
2 parents 7dd05d1 + c4e29c1 commit 1bd9d74
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 26 deletions.
34 changes: 11 additions & 23 deletions IOPool/Input/src/RootFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,7 @@ namespace edm {
for(auto const& psetEntry : psetMap) {
ParameterSet pset(psetEntry.second.pset());
pset.setID(psetEntry.first);
// For thread safety, don't update registries when a secondary source opens a file.
if(inputType != InputType::SecondarySource) {
psetRegistry.insertMapped(pset);
}
psetRegistry.insertMapped(pset);
}
}
if(!fileFormatVersion().splitProductIDs()) {
Expand Down Expand Up @@ -397,18 +394,15 @@ namespace edm {
}
}

// For thread safety, don't update registries when a secondary source opens a file.
if(inputType != InputType::SecondarySource) {
ProcessHistoryRegistry::instance()->insertCollection(pHistVector);
}
ProcessHistoryRegistry::instance()->insertCollection(pHistVector);

eventTree_.trainCache(BranchTypeToAuxiliaryBranchName(InEvent).c_str());

validateFile(inputType, usingGoToEvent);

// Here, we make the class that will make the ProvenanceReader
// It reads whatever trees it needs.
provenanceReaderMaker_.reset(makeProvenanceReaderMaker(inputType).release());
provenanceReaderMaker_.reset(makeProvenanceReaderMaker().release());

// Merge into the hashed registries.
if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
Expand Down Expand Up @@ -490,7 +484,7 @@ namespace edm {
}

void
RootFile::readEntryDescriptionTree(EntryDescriptionMap& entryDescriptionMap, InputType::InputType inputType) {
RootFile::readEntryDescriptionTree(EntryDescriptionMap& entryDescriptionMap) {
// Called only for old format files.
// We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
std::unique_ptr<TTree> entryDescriptionTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::entryDescriptionTreeName().c_str())));
Expand Down Expand Up @@ -526,17 +520,14 @@ namespace edm {
daqProvenanceHelper_->parentageIDMap_.insert(std::make_pair(oldID, newID));
}
}
// For thread safety, don't update registries when a secondary source opens a file.
if(inputType != InputType::SecondarySource) {
registry.insertMapped(parents);
}
registry.insertMapped(parents);
}
entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), nullptr);
entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), nullptr);
}

void
RootFile::readParentageTree(InputType::InputType inputType) {
RootFile::readParentageTree() {
// New format file
// We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
std::unique_ptr<TTree> parentageTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::parentageTreeName().c_str())));
Expand All @@ -562,10 +553,7 @@ namespace edm {
daqProvenanceHelper_->parentageIDMap_.insert(std::make_pair(oldID, newID));
}
}
// For thread safety, don't update registries when a secondary source opens a file.
if(inputType != InputType::SecondarySource) {
registry.insertMapped(parents);
}
registry.insertMapped(parents);
parentageIDLookup_.push_back(parents.id());
}
parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), nullptr);
Expand Down Expand Up @@ -1724,16 +1712,16 @@ namespace edm {
}

std::unique_ptr<MakeProvenanceReader>
RootFile::makeProvenanceReaderMaker(InputType::InputType inputType) {
RootFile::makeProvenanceReaderMaker() {
if(fileFormatVersion_.storedProductProvenanceUsed()) {
readParentageTree(inputType);
readParentageTree();
return std::unique_ptr<MakeProvenanceReader>(new MakeReducedProvenanceReader(parentageIDLookup_));
} else if(fileFormatVersion_.splitProductIDs()) {
readParentageTree(inputType);
readParentageTree();
return std::unique_ptr<MakeProvenanceReader>(new MakeFullProvenanceReader);
} else if(fileFormatVersion_.perEventProductIDs()) {
std::unique_ptr<EntryDescriptionMap> entryDescriptionMap(new EntryDescriptionMap);
readEntryDescriptionTree(*entryDescriptionMap, inputType);
readEntryDescriptionTree(*entryDescriptionMap);
return std::unique_ptr<MakeProvenanceReader>(new MakeOldProvenanceReader(std::move(entryDescriptionMap)));
} else {
return std::unique_ptr<MakeProvenanceReader>(new MakeDummyProvenanceReader);
Expand Down
6 changes: 3 additions & 3 deletions IOPool/Input/src/RootFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ namespace edm {
void overrideRunNumber(EventID& id, bool isRealData);
std::string const& newBranchToOldBranch(std::string const& newBranch) const;
void dropOnInput(ProductRegistry& reg, ProductSelectorRules const& rules, bool dropDescendants, InputType::InputType inputType);
void readParentageTree(InputType::InputType inputType);
void readEntryDescriptionTree(EntryDescriptionMap&, InputType::InputType inputType); // backward compatibility
void readParentageTree();
void readEntryDescriptionTree(EntryDescriptionMap&); // backward compatibility
void readEventHistoryTree();
bool isDuplicateEvent();

void initializeDuplicateChecker(std::vector<boost::shared_ptr<IndexIntoFile> > const& indexesIntoFiles,
std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile);

std::unique_ptr<MakeProvenanceReader> makeProvenanceReaderMaker(InputType::InputType inputType);
std::unique_ptr<MakeProvenanceReader> makeProvenanceReaderMaker();
boost::shared_ptr<BranchMapper> makeBranchMapper();

std::string const file_;
Expand Down

0 comments on commit 1bd9d74

Please sign in to comment.