CMS 3D CMS Logo

GsfEleConversionVetoCut.cc
Go to the documentation of this file.
6 
7 
9 public:
11 
12  result_type operator()(const reco::GsfElectronPtr&) const final;
13 
15  void getEventContent(const edm::EventBase&) final;
16 
17  double value(const reco::CandidatePtr& cand) const final;
18 
19  CandidateType candidateType() const final {
20  return ELECTRON;
21  }
22 
23 private:
26 };
27 
30  "GsfEleConversionVetoCut");
31 
34 
35  edm::InputTag conversiontag = c.getParameter<edm::InputTag>("conversionSrc");
36  contentTags_.emplace("conversions",conversiontag);
37 
38  edm::InputTag conversiontagMiniAOD = c.getParameter<edm::InputTag>("conversionSrcMiniAOD");
39  contentTags_.emplace("conversionsMiniAOD",conversiontagMiniAOD);
40 
41  edm::InputTag beamspottag = c.getParameter<edm::InputTag>("beamspotSrc");
42  contentTags_.emplace("beamspot",beamspottag);
43 }
44 
46  auto convs = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversions"]);
47  auto convsMiniAOD = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversionsMiniAOD"]);
48  auto thebs = cc.consumes<reco::BeamSpot>(contentTags_["beamspot"]);
49  contentTokens_.emplace("conversions",convs);
50  contentTokens_.emplace("conversionsMiniAOD",convsMiniAOD);
51  contentTokens_.emplace("beamspot",thebs);
52 }
53 
55 
56  // First try AOD, then go to miniAOD. Use the same Handle since collection class is the same.
57  ev.getByLabel(contentTags_["conversions"],_convs);
58  if (!_convs.isValid())
59  ev.getByLabel(contentTags_["conversionsMiniAOD"],_convs);
60 
61  ev.getByLabel(contentTags_["beamspot"],_thebs);
62 }
63 
67  if( _thebs.isValid() && _convs.isValid() ) {
69  } else {
70  edm::LogWarning("GsfEleConversionVetoCut")
71  << "Couldn't find a necessary collection, returning true!";
72  }
73  return true;
74 }
75 
77  reco::GsfElectronPtr ele(cand);
78  if( _thebs.isValid() && _convs.isValid() ) {
80  } else {
81  edm::LogWarning("GsfEleConversionVetoCut")
82  << "Couldn't find a necessary collection, returning true!";
83  return true;
84  }
85 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
double value(const reco::CandidatePtr &cand) const final
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
edm::Handle< reco::BeamSpot > _thebs
void getEventContent(const edm::EventBase &) final
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
CandidateType candidateType() const final
bool ev
std::unordered_map< std::string, edm::InputTag > contentTags_
std::vector< Conversion > ConversionCollection
collectin of Conversion objects
Definition: ConversionFwd.h:9
void setConsumes(edm::ConsumesCollector &) final
edm::Handle< reco::ConversionCollection > _convs
static bool hasMatchedConversion(const reco::GsfElectron &ele, const reco::ConversionCollection &convCol, const math::XYZPoint &beamspot, bool allowCkfMatch=true, float lxyMin=2.0, float probMin=1e-6, unsigned int nHitsBeforeVtxMax=0)
GsfEleConversionVetoCut(const edm::ParameterSet &c)
bool isValid() const
Definition: HandleBase.h:74
result_type operator()(const reco::GsfElectronPtr &) const final
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
const Point & position() const
position
Definition: BeamSpot.h:62
#define DEFINE_EDM_PLUGIN(factory, type, name)