CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GenericMVAJetTagComputerWrapper.h
Go to the documentation of this file.
1 #ifndef RecoBTau_JetTagComputer_GenericMVAJetTagComputerWrapper_h
2 #define RecoBTau_JetTagComputer_GenericMVAJetTagComputerWrapper_h
3 
4 #include <memory>
5 
10 
11 /*
12  * This header defines a bunch of templated convenience wrappers
13  *
14  * GenericMVAJetTagComputerWrapper<class Provider, ...>
15  *
16  * whereas ... dennotes argument pairs, with the
17  * first argument being a specific TagInfo class
18  * second argument being a constant string dennoting the cfg parameter
19  *
20  * If only one TagInfo is passed, the cfg parameter name can be ommited
21  * (will default to "tagInfo").
22  *
23  * The wrapper will derive from the template argument class Provider,
24  * pass the ParameterSet of the JetTagComputer to the (optional) constructor
25  * and call "TaggingVariableList operator () (...) const" for every jet to
26  * tag, with ... being the already casted and type-verified specific
27  * TagInfo references (number of arguments matching the template instance).
28  *
29  * The TaggingVariables will be fed into the MVAComputer, which will compute
30  * the final discriminator from an ES calibration object define in the cfg.
31  */
32 
33 namespace btau_dummy {
34  struct Null {};
35  extern const char none[];
36 }
37 
38 // 4 named TagInfos
39 
40 template<class Provider, class TI1, const char *ti1 = btau_dummy::none,
41  class TI2 = btau_dummy::Null, const char *ti2 = btau_dummy::none,
42  class TI3 = btau_dummy::Null, const char *ti3 = btau_dummy::none,
43  class TI4 = btau_dummy::Null, const char *ti4 = btau_dummy::none>
45  public GenericMVAJetTagComputer, private Provider {
46 
47  public:
49  GenericMVAJetTagComputer(params), Provider(params)
50  { uses(0, ti1); uses(1, ti2); uses(2, ti3); uses(3, ti4); }
51 
52  protected:
55  {
56  return (static_cast<const Provider&>(*this))(info.get<TI1>(0),
57  info.get<TI2>(1), info.get<TI3>(2), info.get<TI4>(3));
58  }
59 };
60 
61 // 3 named TagInfos
62 
63 template<class Provider, class TI1, const char *ti1,
64  class TI2, const char *ti2,
65  class TI3, const char *ti3>
66 class GenericMVAJetTagComputerWrapper<Provider, TI1, ti1, TI2, ti2, TI3, ti3,
67  btau_dummy::Null, btau_dummy::none> :
68  public GenericMVAJetTagComputer, private Provider {
69 
70  public:
72  GenericMVAJetTagComputer(params), Provider(params)
73  { uses(0, ti1); uses(1, ti2); uses(2, ti3); }
74 
75  protected:
78  {
79  return (static_cast<const Provider&>(*this))(info.get<TI1>(0),
80  info.get<TI2>(1), info.get<TI3>(2));
81  }
82 };
83 
84 // 2 named TagInfos
85 
86 template<class Provider, class TI1, const char *ti1,
87  class TI2, const char *ti2>
88 class GenericMVAJetTagComputerWrapper<Provider, TI1, ti1, TI2, ti2,
89  btau_dummy::Null, btau_dummy::none,
91  public GenericMVAJetTagComputer, private Provider {
92 
93  public:
95  GenericMVAJetTagComputer(params), Provider(params)
96  { uses(0, ti1); uses(1, ti2); }
97 
98  protected:
101  {
102  return (static_cast<const Provider&>(*this))(info.get<TI1>(0),
103  info.get<TI2>(1));
104  }
105 };
106 
107 // 1 named TagInfo
108 
109 template<class Provider, class TI1, const char *ti1>
110 class GenericMVAJetTagComputerWrapper<Provider, TI1, ti1,
111  btau_dummy::Null, btau_dummy::none,
114  public GenericMVAJetTagComputer, private Provider {
115 
116  public:
118  GenericMVAJetTagComputer(params), Provider(params)
119  { uses(0, ti1); }
120 
121  protected:
124  { return (static_cast<const Provider&>(*this))(info.get<TI1>(0)); }
125 };
126 
127 // default TagInfo
128 
129 template<class Provider, class TI1>
130 class GenericMVAJetTagComputerWrapper<Provider, TI1, btau_dummy::none,
134  public GenericMVAJetTagComputer, private Provider {
135 
136  public:
138  GenericMVAJetTagComputer(params), Provider(params)
139  {}
140 
141  protected:
144  { return (static_cast<const Provider&>(*this))(info.get<TI1>(0)); }
145 };
146 
147 #endif // RecoBTau_JetTagComputer_GenericMVAJetTagComputerWrapper_h
static const TGPicture * info(bool iBackgroundIsBlack)
const T & get(unsigned int index=0) const
GenericMVAJetTagComputerWrapper(const edm::ParameterSet &params)
virtual reco::TaggingVariableList taggingVariables(const TagInfoHelper &info) const
void uses(unsigned int id, const std::string &label)
const char none[]