CMS 3D CMS Logo

HSCParticleSelector.cc
Go to the documentation of this file.
1 #include <memory>
5 
9 
12 
13 //
14 // class declaration
15 //
17 public:
18  explicit HSCParticleSelector(const edm::ParameterSet&);
19  ~HSCParticleSelector() override;
20 
21 private:
22  void beginJob() override;
23  bool filter(edm::Event&, const edm::EventSetup&) override;
24  void endJob() override;
25 
27 
28  bool Filter_;
29  std::vector<CandidateSelector*> Selectors;
30 };
31 
34  // What is being produced
35  produces<susybsm::HSCParticleCollection>();
36 
37  // Input products
38  sourceToken_ = consumes<susybsm::HSCParticleCollection>(iConfig.getParameter<edm::InputTag>("source"));
39  Filter_ = iConfig.getParameter<bool>("filter");
40 
41  // Load all the selections
42  std::vector<edm::ParameterSet> SelectionParameters =
43  iConfig.getParameter<std::vector<edm::ParameterSet> >("SelectionParameters");
44  for (unsigned int i = 0; i < SelectionParameters.size(); i++) {
46  }
47 }
48 
51 
54 
57 
60  // Source Collection
62  if (!iEvent.getByToken(sourceToken_, SourceHandle)) {
63  edm::LogError("") << ">>> HSCParticleCollection does not exist !!!";
64  return false;
65  }
67 
68  // Output Collection
70  std::unique_ptr<susybsm::HSCParticleCollection> result(output);
71 
72  // cleanup the collection based on the input selection
73  for (susybsm::HSCParticleCollection::iterator hscpcandidate = Source.begin(); hscpcandidate < Source.end();
74  ++hscpcandidate) {
75  bool decision = false;
76  for (unsigned int i = 0; i < Selectors.size(); i++) {
77  decision |= Selectors[i]->isSelected(*hscpcandidate);
78  }
79  if (decision) {
80  susybsm::HSCParticle* newhscp = new susybsm::HSCParticle(*hscpcandidate);
81  output->push_back(*newhscp);
82  }
83  }
84 
85  bool filterResult = !Filter_ || (Filter_ && !output->empty());
86 
87  iEvent.put(std::move(result));
88 
89  return filterResult;
90 }
91 
susybsm::HSCParticle
Definition: HSCParticle.h:42
Handle.h
mps_fire.i
i
Definition: mps_fire.py:428
MessageLogger.h
edm::Handle::product
T const * product() const
Definition: Handle.h:70
HSCParticleSelector::endJob
void endJob() override
Definition: HSCParticleSelector.cc:56
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
edm::EDGetTokenT< susybsm::HSCParticleCollection >
EDFilter.h
susybsm::HSCParticleCollection
std::vector< HSCParticle > HSCParticleCollection
Definition: HSCParticle.h:86
edm::Handle
Definition: AssociativeIterator.h:50
HSCParticleSelector::~HSCParticleSelector
~HSCParticleSelector() override
Definition: HSCParticleSelector.cc:50
HSCParticleSelector::sourceToken_
edm::EDGetTokenT< susybsm::HSCParticleCollection > sourceToken_
Definition: HSCParticleSelector.cc:26
HSCParticleSelector
Definition: HSCParticleSelector.cc:16
MakerMacros.h
HSCParticleSelector::filter
bool filter(edm::Event &, const edm::EventSetup &) override
Definition: HSCParticleSelector.cc:59
HSCParticleSelector::HSCParticleSelector
HSCParticleSelector(const edm::ParameterSet &)
Definition: HSCParticleSelector.cc:33
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HSCParticle.h
CandidateSelector.h
HSCParticleProducer_cff.SelectionParameters
SelectionParameters
Definition: HSCParticleProducer_cff.py:89
edm::ParameterSet
Definition: ParameterSet.h:47
iEvent
int iEvent
Definition: GenABIO.cc:224
HSCParticleSelector::beginJob
void beginJob() override
Definition: HSCParticleSelector.cc:53
edm::EDFilter
Definition: EDFilter.h:38
HSCParticleSelector::Selectors
std::vector< CandidateSelector * > Selectors
Definition: HSCParticleSelector.cc:29
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
CandidateSelector
Definition: CandidateSelector.h:18
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
mps_fire.result
result
Definition: mps_fire.py:311
View.h
HSCParticleSelector::Filter_
bool Filter_
Definition: HSCParticleSelector.cc:28
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
CollectionTags_cfi.Source
Source
Definition: CollectionTags_cfi.py:11