CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GsfEleConversionVetoCut.cc
Go to the documentation of this file.
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 
20 
21 private:
24 };
25 
27 
29  edm::InputTag conversiontag = c.getParameter<edm::InputTag>("conversionSrc");
30  contentTags_.emplace("conversions", conversiontag);
31 
32  edm::InputTag conversiontagMiniAOD = c.getParameter<edm::InputTag>("conversionSrcMiniAOD");
33  contentTags_.emplace("conversionsMiniAOD", conversiontagMiniAOD);
34 
35  edm::InputTag beamspottag = c.getParameter<edm::InputTag>("beamspotSrc");
36  contentTags_.emplace("beamspot", beamspottag);
37 }
38 
40  auto convs = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversions"]);
41  auto convsMiniAOD = cc.mayConsume<reco::ConversionCollection>(contentTags_["conversionsMiniAOD"]);
42  auto thebs = cc.consumes<reco::BeamSpot>(contentTags_["beamspot"]);
43  contentTokens_.emplace("conversions", convs);
44  contentTokens_.emplace("conversionsMiniAOD", convsMiniAOD);
45  contentTokens_.emplace("beamspot", thebs);
46 }
47 
49  // First try AOD, then go to miniAOD. Use the same Handle since collection class is the same.
50  ev.getByLabel(contentTags_["conversions"], _convs);
51  if (!_convs.isValid())
52  ev.getByLabel(contentTags_["conversionsMiniAOD"], _convs);
53 
54  ev.getByLabel(contentTags_["beamspot"], _thebs);
55 }
56 
58  if (_thebs.isValid() && _convs.isValid()) {
59  return !ConversionTools::hasMatchedConversion(*cand, *_convs, _thebs->position());
60  } else {
61  edm::LogWarning("GsfEleConversionVetoCut") << "Couldn't find a necessary collection, returning true!";
62  }
63  return true;
64 }
65 
67  reco::GsfElectronPtr ele(cand);
68  if (_thebs.isValid() && _convs.isValid()) {
69  return !ConversionTools::hasMatchedConversion(*ele, *_convs, _thebs->position());
70  } else {
71  edm::LogWarning("GsfEleConversionVetoCut") << "Couldn't find a necessary collection, returning true!";
72  return true;
73  }
74 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EventSetup & c
std::unordered_map< std::string, edm::InputTag > contentTags_
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
edm::Handle< reco::BeamSpot > _thebs
result_type operator()(const reco::GsfElectronPtr &) const final
void getEventContent(const edm::EventBase &) 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)
CandidateType candidateType() const final
bool isValid() const
Definition: HandleBase.h:70
double value(const reco::CandidatePtr &cand) const final
std::unordered_map< std::string, edm::EDGetToken > contentTokens_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
bool getByLabel(InputTag const &, Handle< T > &) const
Definition: EventBase.h:92
#define DEFINE_EDM_PLUGIN(factory, type, name)
Log< level::Warning, false > LogWarning