CMS 3D CMS Logo

CaloRecoTauDiscriminationByNProngs.cc
Go to the documentation of this file.
3 
6 
7 /* class CaloRecoTauDiscriminationByNProngs
8  * created : September 23 2010,
9  * contributors : Sami Lehti (sami.lehti@cern.ch ; HIP, Helsinki)
10  * based on H+ tau ID by Lauri Wendland
11  */
12 
13 namespace {
14 
15 using namespace reco;
16 using namespace std;
17 
18 class CaloRecoTauDiscriminationByNProngs final
20  public:
21  explicit CaloRecoTauDiscriminationByNProngs(const edm::ParameterSet& iConfig)
23  nprongs = iConfig.getParameter<uint32_t>("nProngs");
24  booleanOutput = iConfig.getParameter<bool>("BooleanOutput");
25  }
26  ~CaloRecoTauDiscriminationByNProngs() override{}
27  double discriminate(const reco::CaloTauRef&) const override;
28 
29  static void fillDescriptions(edm::ConfigurationDescriptions & descriptions);
30  private:
31  uint32_t nprongs;
32  bool booleanOutput;
33 };
34 
35 
36 double CaloRecoTauDiscriminationByNProngs::discriminate(const CaloTauRef& tau) const {
37  bool accepted = false;
38  int np = tau->signalTracks().size();
39  if((np == 1 && (nprongs == 1 || nprongs == 0)) ||
40  (np == 3 && (nprongs == 3 || nprongs == 0)) ) accepted = true;
41  if(!accepted) np = 0;
42  if(booleanOutput) return accepted;
43  return np;
44 }
45 
46 }
47 
48 void
50  // caloRecoTauDiscriminationByNProngs
52  desc.add<unsigned int>("nProngs", 0);
53  {
55  psd0.add<std::string>("BooleanOperator", "and");
56  {
58  psd1.add<double>("cut");
59  psd1.add<edm::InputTag>("Producer");
60  psd0.addOptional<edm::ParameterSetDescription>("leadTrack", psd1);
61  }
62  desc.add<edm::ParameterSetDescription>("Prediscriminants", psd0);
63  }
64  desc.add<edm::InputTag>("CaloTauProducer", edm::InputTag("caloRecoTauProducer"));
65  desc.add<bool>("BooleanOutput", true);
66  descriptions.add("caloRecoTauDiscriminationByNProngs", desc);
67 }
68 DEFINE_FWK_MODULE(CaloRecoTauDiscriminationByNProngs);
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
int np
Definition: AMPTWrapper.h:33
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool accepted(std::vector< std::string_view > const &, std::string_view)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
fixed size matrix