CMS 3D CMS Logo

GsfEleConversionVetoCut.cc
Go to the documentation of this file.
6 
8 public:
10 
11  result_type operator()(const reco::GsfElectronPtr&) const final;
12 
14  void getEventContent(const edm::EventBase&) final;
15 
16  double value(const reco::CandidatePtr& cand) const final;
17 
19 
20 private:
23 };
24 
26 
28  edm::InputTag conversiontag = c.getParameter<edm::InputTag>("conversionSrc");
29  contentTags_.emplace("conversions", conversiontag);
30 
31  edm::InputTag conversiontagMiniAOD = c.getParameter<edm::InputTag>("conversionSrcMiniAOD");
32  contentTags_.emplace("conversionsMiniAOD", conversiontagMiniAOD);
33 
34  edm::InputTag beamspottag = c.getParameter<edm::InputTag>("beamspotSrc");
35  contentTags_.emplace("beamspot", beamspottag);
36 }
37 
39  auto convs = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversions"]);
40  auto convsMiniAOD = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversionsMiniAOD"]);
41  auto thebs = cc.consumes<reco::BeamSpot>(contentTags_["beamspot"]);
42  contentTokens_.emplace("conversions", convs);
43  contentTokens_.emplace("conversionsMiniAOD", convsMiniAOD);
44  contentTokens_.emplace("beamspot", thebs);
45 }
46 
48  // First try AOD, then go to miniAOD. Use the same Handle since collection class is the same.
49  ev.getByLabel(contentTags_["conversions"], _convs);
50  if (!_convs.isValid())
51  ev.getByLabel(contentTags_["conversionsMiniAOD"], _convs);
52 
53  ev.getByLabel(contentTags_["beamspot"], _thebs);
54 }
55 
57  if (_thebs.isValid() && _convs.isValid()) {
59  } else {
60  edm::LogWarning("GsfEleConversionVetoCut") << "Couldn't find a necessary collection, returning true!";
61  }
62  return true;
63 }
64 
66  reco::GsfElectronPtr ele(cand);
67  if (_thebs.isValid() && _convs.isValid()) {
69  } else {
70  edm::LogWarning("GsfEleConversionVetoCut") << "Couldn't find a necessary collection, returning true!";
71  return true;
72  }
73 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::unordered_map< std::string, edm::InputTag > contentTags_
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
CandidateType candidateType() const final
bool ev
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:70
result_type operator()(const reco::GsfElectronPtr &) const final
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
const Point & position() const
position
Definition: BeamSpot.h:59
#define DEFINE_EDM_PLUGIN(factory, type, name)