Skip to content

Commit

Permalink
Merge pull request #607 from Dr15Jones/renameSelections
Browse files Browse the repository at this point in the history
Renamed edm::Selections to edm::SelectedProducts
  • Loading branch information
ktf committed Aug 27, 2013
2 parents de57045 + bbdcd78 commit 1f25c4b
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 57 deletions.
12 changes: 6 additions & 6 deletions CalibTracker/SiStripCommon/plugins/ShallowTree.cc
Expand Up @@ -3,16 +3,15 @@
#include "FWCore/Framework/interface/ConstProductRegistry.h"
#include "FWCore/Framework/interface/ProductSelector.h"
#include "FWCore/Framework/interface/ProductSelectorRules.h"
#include "DataFormats/Provenance/interface/Selections.h"

#include <map>
#include "boost/foreach.hpp"
#include <TBranch.h>

void ShallowTree::
analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
BOOST_FOREACH( BranchConnector* connector, connectors)
for( BranchConnector* connector: connectors) {
connector->connect(iEvent);
}
tree->Fill();
}

Expand Down Expand Up @@ -57,14 +56,14 @@ beginJob() {


edm::Service<edm::ConstProductRegistry> reg;
edm::Selections allBranches = reg->allBranchDescriptions();
auto allBranches = reg->allBranchDescriptions();
edm::ProductSelectorRules productSelectorRules_(pset, "outputCommands", "ShallowTree");
edm::ProductSelector productSelector_;
productSelector_.initialize(productSelectorRules_, allBranches);

std::set<std::string> branchnames;

BOOST_FOREACH( const edm::Selections::value_type& selection, allBranches) {
for( auto const& selection : allBranches) {
if(productSelector_.selected(*selection)) {

//Check for duplicate branch names
Expand Down Expand Up @@ -106,8 +105,9 @@ beginJob() {
{
std::string leafstring = "";
typedef std::pair<std::string, LEAFTYPE> pair_t;
BOOST_FOREACH( const pair_t& leaf, leafmap)
for( const pair_t& leaf: leafmap) {
leafstring+= "\t" + leaf.first + "\n";
}

throw edm::Exception(edm::errors::Configuration)
<< "class ShallowTree does not handle leaves of type " << selection->className() << " like\n"
Expand Down
15 changes: 15 additions & 0 deletions DataFormats/Provenance/interface/SelectedProducts.h
@@ -0,0 +1,15 @@
#ifndef DataFormats_Provenance_SelectedProducts_h
#define DataFormats_Provenance_SelectedProducts_h

#include "boost/array.hpp"
#include <vector>

#include "DataFormats/Provenance/interface/BranchType.h"

namespace edm {
class BranchDescription;
typedef std::vector<BranchDescription const *> SelectedProducts;
typedef boost::array<SelectedProducts, NumBranchTypes> SelectedProductsForBranchType;
}

#endif
15 changes: 0 additions & 15 deletions DataFormats/Provenance/interface/Selections.h

This file was deleted.

6 changes: 3 additions & 3 deletions FWCore/Framework/interface/OutputModule.h
Expand Up @@ -13,7 +13,7 @@ output stream.
#include "DataFormats/Provenance/interface/BranchIDList.h"
#include "DataFormats/Provenance/interface/ParentageID.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"

#include "FWCore/Framework/interface/TriggerResultsBasedEventSelector.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
Expand Down Expand Up @@ -64,7 +64,7 @@ namespace edm {

void selectProducts(ProductRegistry const& preg);
std::string const& processName() const {return process_name_;}
SelectionsArray const& keptProducts() const {return keptProducts_;}
SelectedProductsForBranchType const& keptProducts() const {return keptProducts_;}
std::array<bool, NumBranchTypes> const& hasNewlyDroppedBranch() const {return hasNewlyDroppedBranch_;}

static void fillDescription(ParameterSetDescription & desc);
Expand Down Expand Up @@ -138,7 +138,7 @@ namespace edm {
// the branches we are to write.
//
// We do not own the BranchDescriptions to which we point.
SelectionsArray keptProducts_;
SelectedProductsForBranchType keptProducts_;
std::array<bool, NumBranchTypes> hasNewlyDroppedBranch_;

std::string process_name_;
Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/interface/SubProcess.h
Expand Up @@ -13,7 +13,7 @@
#include "FWCore/ServiceRegistry/interface/ServiceToken.h"
#include "FWCore/Utilities/interface/BranchType.h"

#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"

#include "boost/shared_ptr.hpp"

Expand Down Expand Up @@ -49,7 +49,7 @@ namespace edm {

//From OutputModule
void selectProducts(ProductRegistry const& preg);
SelectionsArray const& keptProducts() const {return keptProducts_;}
SelectedProductsForBranchType const& keptProducts() const {return keptProducts_;}

void doBeginJob();
void doEndJob();
Expand Down Expand Up @@ -233,7 +233,7 @@ namespace edm {
// the branches we are to write.
//
// We do not own the BranchDescriptions to which we point.
SelectionsArray keptProducts_;
SelectedProductsForBranchType keptProducts_;
ProductSelectorRules productSelectorRules_;
ProductSelector productSelector_;

Expand Down
6 changes: 3 additions & 3 deletions FWCore/Framework/interface/one/OutputModuleBase.h
Expand Up @@ -31,7 +31,7 @@
#include "DataFormats/Provenance/interface/BranchIDList.h"
#include "DataFormats/Provenance/interface/ParentageID.h"
#include "DataFormats/Provenance/interface/ModuleDescription.h"
#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"

#include "FWCore/Framework/interface/TriggerResultsBasedEventSelector.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
Expand Down Expand Up @@ -81,7 +81,7 @@ namespace edm {

void selectProducts(ProductRegistry const& preg);
std::string const& processName() const {return process_name_;}
SelectionsArray const& keptProducts() const {return keptProducts_;}
SelectedProductsForBranchType const& keptProducts() const {return keptProducts_;}
std::array<bool, NumBranchTypes> const& hasNewlyDroppedBranch() const {return hasNewlyDroppedBranch_;}

static void fillDescription(ParameterSetDescription & desc);
Expand Down Expand Up @@ -149,7 +149,7 @@ namespace edm {
// the branches we are to write.
//
// We do not own the BranchDescriptions to which we point.
SelectionsArray keptProducts_;
SelectedProductsForBranchType keptProducts_;
std::array<bool, NumBranchTypes> hasNewlyDroppedBranch_;

std::string process_name_;
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/OutputModuleCommunicator.h
Expand Up @@ -24,7 +24,7 @@
#include <vector>

// user include files
#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"

// forward declarations
Expand Down Expand Up @@ -60,7 +60,7 @@ namespace edm {

virtual void configure(OutputModuleDescription const& desc) = 0;

virtual SelectionsArray const& keptProducts() const = 0;
virtual SelectedProductsForBranchType const& keptProducts() const = 0;

virtual void selectProducts(ProductRegistry const& preg) = 0;

Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/src/OutputModuleCommunicatorT.cc
Expand Up @@ -76,7 +76,7 @@ namespace edm {
void OutputModuleCommunicatorT<T>::configure(OutputModuleDescription const& desc) {module().configure(desc);}

template<typename T>
edm::SelectionsArray const& OutputModuleCommunicatorT<T>::keptProducts() const {
edm::SelectedProductsForBranchType const& OutputModuleCommunicatorT<T>::keptProducts() const {
return module().keptProducts();
}

Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/src/OutputModuleCommunicatorT.h
Expand Up @@ -45,7 +45,7 @@ namespace edm {

virtual void configure(edm::OutputModuleDescription const& desc) override;

virtual edm::SelectionsArray const& keptProducts() const override;
virtual edm::SelectedProductsForBranchType const& keptProducts() const override;

virtual void selectProducts(edm::ProductRegistry const& preg) override;

Expand Down
8 changes: 4 additions & 4 deletions FWCore/Framework/src/ScheduleItems.cc
Expand Up @@ -3,7 +3,7 @@
#include "DataFormats/Provenance/interface/BranchDescription.h"
#include "DataFormats/Provenance/interface/BranchID.h"
#include "DataFormats/Provenance/interface/BranchIDListHelper.h"
#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"
#include "FWCore/Framework/interface/ExceptionActions.h"
#include "FWCore/Framework/interface/CommonParams.h"
#include "FWCore/Framework/interface/ConstProductRegistry.h"
Expand Down Expand Up @@ -44,15 +44,15 @@ namespace edm {

// Mark dropped branches as dropped in the product registry.
std::set<BranchID> keptBranches;
Selections const& keptVectorR = om.keptProducts()[InRun];
SelectedProducts const& keptVectorR = om.keptProducts()[InRun];
for(auto const& item : keptVectorR) {
keptBranches.insert(item->branchID());
}
Selections const& keptVectorL = om.keptProducts()[InLumi];
SelectedProducts const& keptVectorL = om.keptProducts()[InLumi];
for(auto const& item : keptVectorL) {
keptBranches.insert(item->branchID());
}
Selections const& keptVectorE = om.keptProducts()[InEvent];
SelectedProducts const& keptVectorE = om.keptProducts()[InEvent];
for(auto const& item : keptVectorE) {
keptBranches.insert(item->branchID());
}
Expand Down
2 changes: 1 addition & 1 deletion FWCore/Framework/src/StreamSchedule.cc
Expand Up @@ -281,7 +281,7 @@ namespace edm {
if(branchToReadingWorker.size()>0) {
//If an OutputModule needs a product, we can't delete it early
// so we should remove it from our list
SelectionsArray const&kept = comm->keptProducts();
SelectedProductsForBranchType const&kept = comm->keptProducts();
for( auto const& item: kept[InEvent]) {
auto found = branchToReadingWorker.equal_range(item->branchName());
if(found.first !=found.second) {
Expand Down
4 changes: 2 additions & 2 deletions FWCore/Framework/src/SubProcess.cc
Expand Up @@ -469,8 +469,8 @@ namespace edm {

void
SubProcess::propagateProducts(BranchType type, Principal const& parentPrincipal, Principal& principal) const {
Selections const& keptVector = keptProducts()[type];
for(Selections::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
SelectedProducts const& keptVector = keptProducts()[type];
for(SelectedProducts::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
ProductHolderBase const* parentProductHolder = parentPrincipal.getProductHolder((*it)->branchID(), false, false, nullptr);
if(parentProductHolder != 0) {
ProductData const& parentData = parentProductHolder->productData();
Expand Down
8 changes: 4 additions & 4 deletions IOPool/Output/src/PoolOutputModule.cc
Expand Up @@ -91,8 +91,8 @@ namespace edm {
void PoolOutputModule::beginJob() {
for(int i = InEvent; i < NumBranchTypes; ++i) {
BranchType branchType = static_cast<BranchType>(i);
Selections const& keptVector = keptProducts()[branchType];
for(Selections::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
SelectedProducts const& keptVector = keptProducts()[branchType];
for(SelectedProducts::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
BranchDescription const& prod = **it;
checkDictionaries(prod.fullClassName(), true);
checkDictionaries(wrappedClassName(prod.fullClassName()), true);
Expand Down Expand Up @@ -154,7 +154,7 @@ namespace edm {

void PoolOutputModule::fillSelectedItemList(BranchType branchType, TTree* theInputTree) {

Selections const& keptVector = keptProducts()[branchType];
SelectedProducts const& keptVector = keptProducts()[branchType];
OutputItemList& outputItemList = selectedOutputItemList_[branchType];
AuxItem& auxItem = auxItems_[branchType];

Expand All @@ -171,7 +171,7 @@ namespace edm {
}

// Fill outputItemList with an entry for each branch.
for(Selections::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
for(SelectedProducts::const_iterator it = keptVector.begin(), itEnd = keptVector.end(); it != itEnd; ++it) {
int splitLevel = BranchDescription::invalidSplitLevel;
int basketSize = BranchDescription::invalidBasketSize;

Expand Down
2 changes: 1 addition & 1 deletion IOPool/Output/src/RootOutputFile.cc
Expand Up @@ -610,7 +610,7 @@ namespace edm {
}

void
RootOutputFile::setBranchAliases(TTree* tree, Selections const& branches) const {
RootOutputFile::setBranchAliases(TTree* tree, SelectedProducts const& branches) const {
if(tree && tree->GetNbranches() != 0) {
for(auto const& selection : branches) {
BranchDescription const& pd = *selection;
Expand Down
4 changes: 2 additions & 2 deletions IOPool/Output/src/RootOutputFile.h
Expand Up @@ -27,7 +27,7 @@
#include "DataFormats/Provenance/interface/ProductProvenance.h"
#include "DataFormats/Provenance/interface/StoredProductProvenance.h"
#include "DataFormats/Provenance/interface/RunAuxiliary.h"
#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"
#include "IOPool/Output/interface/PoolOutputModule.h"
#include "IOPool/Output/src/RootOutputTree.h"

Expand Down Expand Up @@ -77,7 +77,7 @@ namespace edm {
//-------------------------------
// Private functions

void setBranchAliases(TTree* tree, Selections const& branches) const;
void setBranchAliases(TTree* tree, SelectedProducts const& branches) const;

void fillBranches(BranchType const& branchType,
Principal const& principal,
Expand Down
6 changes: 3 additions & 3 deletions IOPool/Streamer/interface/StreamSerializer.h
Expand Up @@ -15,7 +15,7 @@

#include "DataFormats/Provenance/interface/BranchIDList.h"
#include "DataFormats/Provenance/interface/ParameterSetID.h"
#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"

const int init_size = 1024*1024;

Expand Down Expand Up @@ -66,7 +66,7 @@ namespace edm

public:

StreamSerializer(Selections const* selections);
StreamSerializer(SelectedProducts const* selections);

int serializeRegistry(SerializeDataBuffer &data_buffer, const BranchIDLists &branchIDLists);
int serializeEvent(EventPrincipal const& eventPrincipal,
Expand All @@ -87,7 +87,7 @@ namespace edm

private:

Selections const* selections_;
SelectedProducts const* selections_;
TClass* tc_;
};

Expand Down
2 changes: 1 addition & 1 deletion IOPool/Streamer/interface/StreamerOutputModuleBase.h
Expand Up @@ -39,7 +39,7 @@ namespace edm {
void setLumiSection();

private:
Selections const* selections_;
SelectedProducts const* selections_;

int maxEventSize_;
bool useCompression_;
Expand Down
10 changes: 5 additions & 5 deletions IOPool/Streamer/src/StreamSerializer.cc
Expand Up @@ -9,7 +9,7 @@
#include "DataFormats/Provenance/interface/ParentageRegistry.h"
#include "DataFormats/Provenance/interface/Parentage.h"
#include "DataFormats/Provenance/interface/ProductProvenance.h"
#include "DataFormats/Provenance/interface/Selections.h"
#include "DataFormats/Provenance/interface/SelectedProducts.h"
#include "DataFormats/Provenance/interface/EventSelectionID.h"
#include "DataFormats/Provenance/interface/BranchListIndex.h"
#include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
Expand All @@ -33,7 +33,7 @@ namespace edm {
/**
* Creates a translator instance for the specified product registry.
*/
StreamSerializer::StreamSerializer(Selections const* selections):
StreamSerializer::StreamSerializer(SelectedProducts const* selections):
selections_(selections),
tc_(getTClass(typeid(SendEvent))) {
}
Expand All @@ -47,7 +47,7 @@ namespace edm {
FDEBUG(6) << "StreamSerializer::serializeRegistry" << std::endl;
SendJobHeader sd;

Selections::const_iterator i(selections_->begin()), e(selections_->end());
SelectedProducts::const_iterator i(selections_->begin()), e(selections_->end());

FDEBUG(9) << "Product List: " << std::endl;

Expand Down Expand Up @@ -136,10 +136,10 @@ namespace edm {
selectionIDs.push_back(selectorConfig);
SendEvent se(eventPrincipal.aux(), eventPrincipal.processHistory(), selectionIDs, eventPrincipal.branchListIndexes());

Selections::const_iterator i(selections_->begin()),ie(selections_->end());
SelectedProducts::const_iterator i(selections_->begin()),ie(selections_->end());
// Loop over EDProducts, fill the provenance, and write.

for(Selections::const_iterator i = selections_->begin(), iEnd = selections_->end(); i != iEnd; ++i) {
for(SelectedProducts::const_iterator i = selections_->begin(), iEnd = selections_->end(); i != iEnd; ++i) {
BranchDescription const& desc = **i;
BranchID const& id = desc.branchID();

Expand Down

0 comments on commit 1f25c4b

Please sign in to comment.