CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TemplatedSoftLeptonTagInfo.cc
Go to the documentation of this file.
1 #include <vector>
2 #include <cstring>
3 
5 
7 
8 namespace reco {
9 
10 using namespace btau;
11 
12 const float SoftLeptonProperties::Quality::undef = -999.0;
13 
15 {
16  if (std::strcmp(name, "") == 0)
17  return 0;
18 
19  if (std::strcmp(name, "leptonId") == 0)
20  return leptonId;
21  else if (std::strcmp(name, "btagLeptonCands") == 0)
22  return btagLeptonCands;
23 
24  if (std::strcmp(name, "pfElectronId") == 0)
25  return pfElectronId;
26  else if (std::strcmp(name, "btagElectronCands") == 0)
27  return btagElectronCands;
28 
29  if (std::strcmp(name, "muonId") == 0)
30  return muonId;
31  else if (std::strcmp(name, "btagMuonCands") == 0)
32  return btagMuonCands;
33 
35  << "Requested lepton quality \"" << name
36  << "\" not found in SoftLeptonProperties::Quality::byName"
37  << std::endl;
38 }
39 
40 float SoftLeptonProperties::quality(unsigned int index, bool throwIfUndefined) const
41 {
42  float qual = Quality::undef;
43  if (index < qualities_.size())
44  qual = qualities_[index];
45 
46  if (qual == Quality::undef && throwIfUndefined)
48  << "Requested lepton quality not found in SoftLeptonProperties::Quality"
49  << std::endl;
50 
51  return qual;
52 }
53 
54 void SoftLeptonProperties::setQuality(unsigned int index, float qual)
55 {
56  if (qualities_.size() <= index)
57  qualities_.resize(index + 1, Quality::undef);
58 
59  qualities_[index] = qual;
60 }
61 
62 }
63 
void setQuality(Quality::Generic qual, float value)
static unsigned int internalByName(const char *name)