CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HSCParticleSelector Class Reference
Inheritance diagram for HSCParticleSelector:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HSCParticleSelector (const edm::ParameterSet &)
 
 ~HSCParticleSelector () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void beginJob () override
 
void endJob () override
 
bool filter (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

bool Filter_
 
std::vector< CandidateSelector * > Selectors
 
edm::EDGetTokenT< susybsm::HSCParticleCollectionsourceToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 16 of file HSCParticleSelector.cc.

Constructor & Destructor Documentation

HSCParticleSelector::HSCParticleSelector ( const edm::ParameterSet iConfig)
explicit

Definition at line 34 of file HSCParticleSelector.cc.

References Filter_, edm::ParameterSet::getParameter(), mps_fire::i, HSCParticleProducer_cff::SelectionParameters, Selectors, and sourceToken_.

35 {
36  // What is being produced
37  produces<susybsm::HSCParticleCollection >();
38 
39  // Input products
40  sourceToken_ = consumes<susybsm::HSCParticleCollection>(iConfig.getParameter<edm::InputTag> ("source"));
41  Filter_ = iConfig.getParameter<bool> ("filter");
42 
43  // Load all the selections
44  std::vector<edm::ParameterSet> SelectionParameters = iConfig.getParameter<std::vector<edm::ParameterSet> >("SelectionParameters");
45  for(unsigned int i=0;i<SelectionParameters.size();i++){
47  }
48 }
T getParameter(std::string const &) const
edm::EDGetTokenT< susybsm::HSCParticleCollection > sourceToken_
std::vector< CandidateSelector * > Selectors
HSCParticleSelector::~HSCParticleSelector ( )
override

Definition at line 51 of file HSCParticleSelector.cc.

51  {
52 }

Member Function Documentation

void HSCParticleSelector::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 55 of file HSCParticleSelector.cc.

55  {
56 }
void HSCParticleSelector::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDFilter.

Definition at line 59 of file HSCParticleSelector.cc.

59  {
60 }
bool HSCParticleSelector::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 63 of file HSCParticleSelector.cc.

References DEFINE_FWK_MODULE, Filter_, edm::Event::getByToken(), mps_fire::i, eostools::move(), convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), mps_fire::result, Selectors, PFJetToCaloProducer_cfi::Source, and sourceToken_.

64 {
65  // Source Collection
67  if (!iEvent.getByToken(sourceToken_, SourceHandle)) {
68  edm::LogError("") << ">>> HSCParticleCollection does not exist !!!";
69  return false;
70  }
72 
73 
74  // Output Collection
76  std::unique_ptr<susybsm::HSCParticleCollection> result(output);
77 
78  // cleanup the collection based on the input selection
79  for(susybsm::HSCParticleCollection::iterator hscpcandidate = Source.begin(); hscpcandidate < Source.end(); ++hscpcandidate){
80  bool decision = false;
81  for(unsigned int i=0;i<Selectors.size();i++){decision |= Selectors[i]->isSelected(*hscpcandidate);}
82  if(decision){
83  susybsm::HSCParticle* newhscp = new susybsm::HSCParticle(*hscpcandidate);
84  output->push_back(*newhscp);
85  }
86  }
87 
88  bool filterResult = !Filter_ || (Filter_ && !output->empty());
89 
90  iEvent.put(std::move(result));
91 
92  return filterResult;
93 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::vector< HSCParticle > HSCParticleCollection
Definition: HSCParticle.h:94
edm::EDGetTokenT< susybsm::HSCParticleCollection > sourceToken_
T const * product() const
Definition: Handle.h:81
std::vector< CandidateSelector * > Selectors
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

bool HSCParticleSelector::Filter_
private

Definition at line 28 of file HSCParticleSelector.cc.

Referenced by filter(), and HSCParticleSelector().

std::vector<CandidateSelector*> HSCParticleSelector::Selectors
private

Definition at line 29 of file HSCParticleSelector.cc.

Referenced by filter(), and HSCParticleSelector().

edm::EDGetTokenT<susybsm::HSCParticleCollection> HSCParticleSelector::sourceToken_
private

Definition at line 26 of file HSCParticleSelector.cc.

Referenced by filter(), and HSCParticleSelector().