CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TaggingVariable.h
Go to the documentation of this file.
1 #ifndef DataFormats_BTauReco_TaggingVariable_h
2 #define DataFormats_BTauReco_TaggingVariable_h
3 
4 #include <utility>
5 #include <vector>
6 #include <string>
7 
8 #include <boost/static_assert.hpp>
9 #include <boost/pointee.hpp>
10 #include <boost/type_traits/is_convertible.hpp>
11 
12 #include <Math/Functions.h>
13 
15 
18 
19 namespace reco {
20 
21  namespace btau {
22 
23  inline double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
24  {
25  double momPar = dir.Dot(track);
26  double energy = std::sqrt(track.Mag2() +
27  ROOT::Math::Square(reco::ParticleMasses::piPlus));
28 
29  return 0.5 * std::log((energy + momPar) / (energy - momPar));
30  }
31 
32  // define the enum in a namespace to avoid polluting reco with all the enum values
34  jetEnergy = 0, // jet energy
35  jetPt, // jet transverse momentum
36  trackJetPt, // track-based jet transverse momentum
37  jetEta, // jet pseudorapidity
38  jetPhi, // jet polar angle
39  jetNTracks, // tracks associated to jet
40 
41  trackMomentum, // track momentum
42  trackEta, // track pseudorapidity
43  trackPhi, // track polar angle
44 
45  trackPtRel, // track transverse momentum, relative to the jet axis
46  trackPPar, // track parallel momentum, along the jet axis
47  trackEtaRel, // track pseudorapidity, relative to the jet axis
48  trackDeltaR, // track pseudoangular distance from the jet axis
49  trackPtRatio, // track transverse momentum, relative to the jet axis, normalized to its energy
50  trackPParRatio, // track parallel momentum, along the jet axis, normalized to its energy
51 
52  trackSip2dVal, // track 2D signed impact parameter
53  trackSip2dSig, // track 2D signed impact parameter significance
54  trackSip3dVal, // track 3D signed impact parameter
55  trackSip3dSig, // track 3D signed impact parameter significance
56  trackDecayLenVal, // track decay length
57  trackDecayLenSig, // track decay length significance
58  trackJetDistVal, // minimum track approach distance to jet axis
59  trackJetDistSig, // minimum track approach distance to jet axis significance
60  trackGhostTrackDistVal, // minimum approach distance to ghost track
61  trackGhostTrackDistSig, // minimum approach distance to ghost track significance
62  trackGhostTrackWeight, // weight of track participation in ghost track fit
63 
64  trackSumJetEtRatio, // ratio of track sum transverse energy over jet energy
65  trackSumJetDeltaR, // pseudoangular distance between jet axis and track fourvector sum
66 
67  vertexCategory, // category of secondary vertex (Reco, Pseudo, No)
68  vertexLeptonCategory, // category of secondary vertex & soft lepton (RecoNo, PseudoNo, NoNo, RecoMu, PseudoMu, NoMu, RecoEl, PseudoEl, NoEl)
69 
70  jetNSecondaryVertices, // number of reconstructed possible secondary vertices in jet
71  jetNSingleTrackVertices, // number of single-track ghost-track vertices
72 
73  vertexMass, // mass of track sum at secondary vertex
74  vertexNTracks, // number of tracks at secondary vertex
75  vertexFitProb, // vertex fit probability
76 
77  vertexEnergyRatio, // ratio of energy at secondary vertex over total energy
78  vertexJetDeltaR, // pseudoangular distance between jet axis and secondary vertex direction
79 
80  flightDistance2dVal, // transverse distance between primary and secondary vertex
81  flightDistance2dSig, // transverse distance significance between primary and secondary vertex
82  flightDistance3dVal, // distance between primary and secondary vertex
83  flightDistance3dSig, // distance significance between primary and secondary vertex
84 
85  trackSip2dValAboveCharm, // track 2D signed impact parameter of first track lifting mass above charm
86  trackSip2dSigAboveCharm, // track 2D signed impact parameter significance of first track lifting mass above charm
87  trackSip3dValAboveCharm, // track 3D signed impact parameter of first track lifting mass above charm
88  trackSip3dSigAboveCharm, // track 3D signed impact parameter significance of first track lifting mass above charm
89 
90  leptonQuality, // lepton identification quality
91  leptonQuality2, // lepton identification quality 2
92 
93  trackP0Par, // track momentum along the jet axis, in the jet rest frame
94  trackP0ParRatio, // track momentum along the jet axis, in the jet rest frame, normalized to its energy"
95  trackChi2, // track fit chi2
96  trackNTotalHits, // number of valid total hits
97  trackNPixelHits, // number of valid pixel hits
98 
99  chargedHadronEnergyFraction, // fraction of the jet energy coming from charged hadrons
100  neutralHadronEnergyFraction, // fraction of the jet energy coming from neutral hadrons
101  photonEnergyFraction, // fraction of the jet energy coming from photons
102  electronEnergyFraction, // fraction of the jet energy coming from electrons
103  muonEnergyFraction, // fraction of the jet energy coming from muons
104  chargedHadronMultiplicity, // number of charged hadrons in the jet
105  neutralHadronMultiplicity, // number of neutral hadrons in the jet
106  photonMultiplicity, // number of photons in the jet
107  electronMultiplicity, // number of electrons in the jet
108  muonMultiplicity, // number of muons in the jet
109  hadronMultiplicity, // sum of number of charged and neutral hadrons in the jet
110  hadronPhotonMultiplicity, // sum of number of charged and neutral hadrons and photons in the jet
111  totalMultiplicity, // sum of number of charged and neutral hadrons, photons, electrons and muons in the jet
112 
113  massVertexEnergyFraction, // vertexmass times fraction of the vertex energy w.r.t. the jet energy
114  vertexBoostOverSqrtJetPt, // variable related to the boost of the vertex system in flight direction
115 
116  leptonSip2d, // 2D signed impact parameter of the soft lepton
117  leptonSip3d, // 3D signed impact parameter of the soft lepton
118  leptonPtRel, // transverse momentum of the soft lepton wrt. the jet axis
119  leptonP0Par, // momentum of the soft lepton along the jet direction, in the jet rest frame
120  leptonEtaRel, // pseudo)rapidity of the soft lepton along jet axis
121  leptonDeltaR, // pseudo)angular distance of the soft lepton to jet axis
122  leptonRatio, // momentum of the soft lepton over jet energy
123  leptonRatioRel, // momentum of the soft lepton parallel to jet axis over jet energy
124  electronMVA, // mva output from electron ID
125 
126  algoDiscriminator, // discriminator output of an algorithm
127 
129  };
130  }
131 
132  // import only TaggingVariableName type into reco namespace
134 
135  extern const char* const TaggingVariableDescription[];
136  extern const char* const TaggingVariableTokens[];
137 
139 
140  typedef float TaggingValue;
141 
142  // cannot use a const member since the STL containers relie on the default assignment operator
143  // typedef std::pair< const TaggingVariableName, TaggingValue > TaggingVariable;
144  typedef std::pair< TaggingVariableName, TaggingValue > TaggingVariable;
145 
148  return i.first < j.first;
149  }
150 
152  return i.first < tag;
153  }
154 
156  return tag < i.first;
157  }
158 
159  };
160 
161  // implementation via std::vector where
162  // - m_list is kept sorted via stable_sort after each insertion
163  // - extraction is done via binary search
165  public:
168 
169  // [begin, end) must identify a valid range of iterators to TaggingVariableList
170  template <typename InputIterator>
171  TaggingVariableList( const InputIterator begin, const InputIterator end ) : m_list() {
172  BOOST_STATIC_ASSERT(( boost::is_convertible< const TaggingVariableList, typename boost::pointee<InputIterator>::type >::value ));
173  for (const InputIterator i = begin; i != end; i++)
174  insert(*i);
175  }
176 
180  typedef std::vector < TaggingVariable >::const_iterator const_iterator;
181  typedef std::pair < const_iterator, const_iterator > range;
182  size_t size() const { return m_list.size(); }
183  const_iterator begin() const { return m_list.begin(); }
184  const_iterator end() const { return m_list.end(); }
185  void push_back ( const TaggingVariable & t ) { m_list.push_back ( t ); }
186 
188 
189 
190  private:
191  std::vector< TaggingVariable > m_list;
192 
193  public:
194  bool checkTag( TaggingVariableName tag ) const;
195 
196  void insert( const TaggingVariable & variable, bool delayed = false );
197  void insert( const TaggingVariableList & list );
198  void insert( TaggingVariableName tag, TaggingValue value, bool delayed = false );
199  void insert( TaggingVariableName tag, const std::vector<TaggingValue> & values, bool delayed = false );
200 
201  void finalize( void );
202 
203  TaggingValue get( TaggingVariableName tag ) const;
204  TaggingValue get( TaggingVariableName tag, TaggingValue defaultValue ) const;
205  std::vector<TaggingValue> getList( TaggingVariableName tag, bool throwOnEmptyList = true ) const;
206 
208 
210  return get( tag );
211  }
212  };
213 
215 
216 }
217 
218 #endif // DataFormats_BTauReco_TaggingVariable_h
type
Definition: HCALResponse.h:21
const double piPlus
Definition: ParticleMasses.h:9
int i
Definition: DBlmapReader.cc:9
void push_back(const TaggingVariable &t)
const char *const TaggingVariableTokens[]
range getRange(TaggingVariableName tag) const
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
const_iterator begin() const
bool checkTag(TaggingVariableName tag) const
TaggingVariableList(const TaggingVariableList &list)
T sqrt(T t)
Definition: SSEVec.h:48
float TaggingValue
std::vector< TaggingVariable >::const_iterator const_iterator
const_iterator end() const
bool operator()(const TaggingVariable &i, const TaggingVariable &j)
int j
Definition: DBlmapReader.cc:9
std::vector< TaggingValue > getList(TaggingVariableName tag, bool throwOnEmptyList=true) const
std::pair< TaggingVariableName, TaggingValue > TaggingVariable
#define DECLARE_EDM_REFS(class_name)
Definition: RefMacros.h:10
std::pair< const_iterator, const_iterator > range
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
TaggingVariableName getTaggingVariableName(const std::string &name)
TaggingVariableList(const InputIterator begin, const InputIterator end)
dbl *** dir
Definition: mlp_gen.cc:35
const char *const TaggingVariableDescription[]
TaggingValue operator[](TaggingVariableName tag) const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
std::vector< TaggingVariable > m_list
void insert(const TaggingVariable &variable, bool delayed=false)
tuple log
Definition: cmsBatch.py:341