CMS 3D CMS Logo

CaloRecoTauDiscriminationByCharge.cc
Go to the documentation of this file.
2 
5 
6 /* class CaloRecoTauDiscriminationByCharge
7  *
8  * Discriminates taus by a |charge| == 1 requirement,
9  * and optionally nTracks == 1 || 3
10  *
11  * Authors : S.Lehti, copied from PFRecoTauDiscriminationByCharge
12  */
13 
14 namespace {
15 
16 class CaloRecoTauDiscriminationByCharge final : public CaloTauDiscriminationProducerBase {
17  public:
18  explicit CaloRecoTauDiscriminationByCharge(const edm::ParameterSet& iConfig)
20  chargeReq_ = iConfig.getParameter<uint32_t>("AbsChargeReq");
21  oneOrThreeProng_ =
22  iConfig.getParameter<bool>("ApplyOneOrThreeProngCut");
23  }
24  ~CaloRecoTauDiscriminationByCharge() override{}
25  double discriminate(const reco::CaloTauRef& pfTau) const override;
26  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
27  private:
28  uint32_t chargeReq_;
29  bool oneOrThreeProng_;
30 };
31 
32 double CaloRecoTauDiscriminationByCharge::discriminate(
33  const reco::CaloTauRef& theTauRef) const {
34  uint16_t nSigTk = theTauRef->signalTracks().size();
35  bool chargeok = (abs(theTauRef->charge()) == int(chargeReq_));
36  bool oneOrThreeProngOK = ( (nSigTk==1) || (nSigTk==3) || !oneOrThreeProng_ );
37 
38  return ( (chargeok && oneOrThreeProngOK) ? 1. : 0. );
39 }
40 
41 }
42 
43 void
45  // caloRecoTauDiscriminationByCharge
47  desc.add<unsigned int>("AbsChargeReq", 1);
48  desc.add<bool>("ApplyOneOrThreeProngCut", false);
49  {
51  psd0.add<std::string>("BooleanOperator", "and");
52  desc.add<edm::ParameterSetDescription>("Prediscriminants", psd0);
53  }
54  desc.add<edm::InputTag>("CaloTauProducer", edm::InputTag("caloRecoTauProducerHighEfficiency"));
55  descriptions.add("caloRecoTauDiscriminationByCharge", desc);
56 }
57 DEFINE_FWK_MODULE(CaloRecoTauDiscriminationByCharge);
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual double discriminate(const TauRef &tau) const =0
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)