CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
virtual ~EDFilter ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

bool Filter_
 
std::vector< CandidateSelector * > Selectors
 
edm::InputTag sourceTag_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
typedef WorkerT< EDFilterWorkerType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- 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::EDFilter
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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(), i, Selectors, and sourceTag_.

35 {
36  // What is being produced
37  produces<susybsm::HSCParticleCollection >();
38 
39  // Input products
40  sourceTag_ = 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++){
46  Selectors.push_back(new CandidateSelector(SelectionParameters[i]) );
47  }
48 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
std::vector< CandidateSelector * > Selectors
HSCParticleSelector::~HSCParticleSelector ( )

Definition at line 51 of file HSCParticleSelector.cc.

51  {
52 }

Member Function Documentation

void HSCParticleSelector::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDFilter.

Definition at line 55 of file HSCParticleSelector.cc.

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

Reimplemented from edm::EDFilter.

Definition at line 59 of file HSCParticleSelector.cc.

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

Implements edm::EDFilter.

Definition at line 63 of file HSCParticleSelector.cc.

References Filter_, edm::Event::getByLabel(), i, convertSQLitetoXML_cfg::output, edm::Handle< T >::product(), edm::Event::put(), query::result, Selectors, popcon_last_value_cfg::Source, and sourceTag_.

64 {
65  // Source Collection
67  if (!iEvent.getByLabel(sourceTag_, SourceHandle)) {
68  edm::LogError("") << ">>> HSCParticleCollection does not exist !!!";
69  return false;
70  }
72 
73 
74  // Output Collection
76  std::auto_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->size()>=1);
89 
90  iEvent.put(result);
91 
92  return filterResult;
93 }
int i
Definition: DBlmapReader.cc:9
std::vector< HSCParticle > HSCParticleCollection
Definition: HSCParticle.h:94
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
tuple result
Definition: query.py:137
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
T const * product() const
Definition: Handle.h:74
std::vector< CandidateSelector * > Selectors

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::InputTag HSCParticleSelector::sourceTag_
private

Definition at line 26 of file HSCParticleSelector.cc.

Referenced by filter(), and HSCParticleSelector().