CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init > Class Template Reference

#include <ObjectSelectorBase.h>

Inheritance diagram for ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >:

Public Member Functions

 ObjectSelectorBase (const edm::ParameterSet &cfg)
 constructor More...
 
 ~ObjectSelectorBase () override
 destructor More...
 

Private Member Functions

bool filter (edm::Event &evt, const edm::EventSetup &es) override
 process one event More...
 

Private Attributes

bool filter_
 filter event More...
 
PostProcessor postProcessor_
 post processor More...
 
Selector selector_
 
Init selectorInit_
 Object collection selector. More...
 
SizeSelector sizeSelector_
 selected object collection size selector More...
 
edm::EDGetTokenT< typename Selector::collection > srcToken_
 source collection label More...
 
bool throwOnMissing_
 trhow on missing More...
 

Detailed Description

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
class ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >

selects a subset of a collection.

Author
Luca Lista, INFN
Version
Revision
1.3
Id
ObjectSelectorBase.h,v 1.3 2010/02/20 20:55:27 wmtan Exp

Definition at line 32 of file ObjectSelectorBase.h.

Constructor & Destructor Documentation

◆ ObjectSelectorBase()

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::ObjectSelectorBase ( const edm::ParameterSet cfg)
inlineexplicit

constructor

Definition at line 36 of file ObjectSelectorBase.h.

37  : Base(cfg),
38  srcToken_(
39  this->template consumes<typename Selector::collection>(cfg.template getParameter<edm::InputTag>("src"))),
40  filter_(false),
41  throwOnMissing_(cfg.template getUntrackedParameter<bool>("throwOnMissing", true)),
42  selectorInit_(this->consumesCollector()),
43  selector_(cfg, this->consumesCollector()),
44  sizeSelector_(reco::modules::make<SizeSelector>(cfg)),
45  postProcessor_(cfg, this->consumesCollector()) {
46  const std::string filter("filter");
47  std::vector<std::string> bools = cfg.template getParameterNamesForType<bool>();
48  bool found = std::find(bools.begin(), bools.end(), filter) != bools.end();
49  if (found)
50  filter_ = cfg.template getParameter<bool>(filter);
51  postProcessor_.init(*this);
52  }
bool filter(edm::Event &evt, const edm::EventSetup &es) override
process one event
Init selectorInit_
Object collection selector.
def Base(process)
bool filter_
filter event
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
bool throwOnMissing_
trhow on missing
ROOT::VecOps::RVec< bool > bools
Definition: Resolutions.cc:5
edm::EDGetTokenT< typename Selector::collection > srcToken_
source collection label
PostProcessor postProcessor_
post processor
SizeSelector sizeSelector_
selected object collection size selector

◆ ~ObjectSelectorBase()

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::~ObjectSelectorBase ( )
inlineoverride

destructor

Definition at line 54 of file ObjectSelectorBase.h.

54 {}

Member Function Documentation

◆ filter()

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
bool ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::filter ( edm::Event evt,
const edm::EventSetup es 
)
inlineoverrideprivate

process one event

Definition at line 58 of file ObjectSelectorBase.h.

Referenced by ObjectSelectorBase< SingleElementCollectionSelector< InputCollection, Selector, OutputCollection, StoreContainer, RefAdder >, OutputCollection, NonNullNumberSelector, PostProcessor, StoreManager, Base, ::reco::modules::EventSetupInit< SingleElementCollectionSelector< InputCollection, Selector, OutputCollection, StoreContainer, RefAdder > >::type >::ObjectSelectorBase().

58  {
59  selectorInit_.init(selector_, evt, es);
61  if (!throwOnMissing_ && !source.isValid()) {
62  return !filter_;
63  }
65  StoreManager manager(source);
66  selector_.select(source, evt, es);
67  manager.cloneAndStore(selector_.begin(), selector_.end(), evt);
68  bool result = (!filter_ || sizeSelector_(manager.size()));
70  postProcessor_.process(filtered, evt);
71  return result;
72  }
Init selectorInit_
Object collection selector.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:526
bool filter_
filter event
bool throwOnMissing_
trhow on missing
static const TGPicture * filtered(bool iBackgroundIsBlack)
edm::EDGetTokenT< typename Selector::collection > srcToken_
source collection label
PostProcessor postProcessor_
post processor
SizeSelector sizeSelector_
selected object collection size selector
static std::string const source
Definition: EdmProvDump.cc:49

Member Data Documentation

◆ filter_

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
bool ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::filter_
private

◆ postProcessor_

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
PostProcessor ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::postProcessor_
private

◆ selector_

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
Selector ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::selector_
private

◆ selectorInit_

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
Init ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::selectorInit_
private

◆ sizeSelector_

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
SizeSelector ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::sizeSelector_
private

◆ srcToken_

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
edm::EDGetTokenT<typename Selector::collection> ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::srcToken_
private

◆ throwOnMissing_

template<typename Selector, typename OutputCollection, typename SizeSelector, typename PostProcessor, typename StoreManager, typename Base, typename Init>
bool ObjectSelectorBase< Selector, OutputCollection, SizeSelector, PostProcessor, StoreManager, Base, Init >::throwOnMissing_
private