CMS 3D CMS Logo

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/pointee.hpp>
9 #include <boost/type_traits/is_convertible.hpp>
10 
11 #include <Math/Functions.h>
12 
14 
17 
18 namespace reco {
19 
20  namespace btau {
21 
22  inline double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
23  {
24  double momPar = dir.Dot(track);
25  double energy = std::sqrt(track.Mag2() +
27 
28  return 0.5 * std::log((energy + momPar) / (energy - momPar));
29  }
30 
31  // define the enum in a namespace to avoid polluting reco with all the enum values
33  jetEnergy = 0, // jet energy
34  jetPt, // jet transverse momentum
35  trackJetPt, // track-based jet transverse momentum
36  jetEta, // jet pseudorapidity
37  jetAbsEta, // jet pseudorapidity
38  jetPhi, // jet polar angle
39  jetNTracks, // tracks associated to jet
40  jetNSelectedTracks, // tracks associated to jet
41  jetNTracksEtaRel, // number of tracks for which etaRel is computed
42 
43  trackMomentum, // track momentum
44  trackEta, // track pseudorapidity
45  trackPhi, // track polar angle
46 
47  trackCharge, // track charge
48 
49  trackPtRel, // track transverse momentum, relative to the jet axis
50  trackPPar, // track parallel momentum, along the jet axis
51  trackEtaRel, // track pseudorapidity, relative to the jet axis
52  trackDeltaR, // track pseudoangular distance from the jet axis
53  trackPtRatio, // track transverse momentum, relative to the jet axis, normalized to its energy
54  trackPParRatio, // track parallel momentum, along the jet axis, normalized to its energy
55 
56  trackSip2dVal, // track 2D signed impact parameter
57  trackSip2dSig, // track 2D signed impact parameter significance
58  trackSip3dVal, // track 3D signed impact parameter
59  trackSip3dSig, // track 3D signed impact parameter significance
60  trackDecayLenVal, // track decay length
61  trackDecayLenSig, // track decay length significance
62  trackJetDistVal, // minimum track approach distance to jet axis
63  trackJetDistSig, // minimum track approach distance to jet axis significance
64  trackGhostTrackDistVal, // minimum approach distance to ghost track
65  trackGhostTrackDistSig, // minimum approach distance to ghost track significance
66  trackGhostTrackWeight, // weight of track participation in ghost track fit
67 
68  trackSumJetEtRatio, // ratio of track sum transverse energy over jet energy
69  trackSumJetDeltaR, // pseudoangular distance between jet axis and track fourvector sum
70 
71  vertexCategory, // category of secondary vertex (Reco, Pseudo, No)
72  vertexLeptonCategory, // category of secondary vertex & soft lepton (RecoNo, PseudoNo, NoNo, RecoMu, PseudoMu, NoMu, RecoEl, PseudoEl, NoEl)
73 
74  jetNSecondaryVertices, // number of reconstructed possible secondary vertices in jet
75  jetNSingleTrackVertices, // number of single-track ghost-track vertices
76 
77  vertexMass, // mass of track sum at secondary vertex
78  vertexNTracks, // number of tracks at secondary vertex
79  vertexFitProb, // vertex fit probability
80 
81  vertexEnergyRatio, // ratio of energy at secondary vertex over total energy
82  vertexJetDeltaR, // pseudoangular distance between jet axis and secondary vertex direction
83 
84  flightDistance1dVal, // Longitudinal distance along the z-axis between primary and secondary vertex
85  flightDistance1dSig, // Longitudinal distance significance along the z-axis between primary and secondary vertex
86  flightDistance2dVal, // transverse distance between primary and secondary vertex
87  flightDistance2dSig, // transverse distance significance between primary and secondary vertex
88  flightDistance3dVal, // distance between primary and secondary vertex
89  flightDistance3dSig, // distance significance between primary and secondary vertex
90 
91  trackSip2dValAboveCharm, // track 2D signed impact parameter of first track lifting mass above charm
92  trackSip2dSigAboveCharm, // track 2D signed impact parameter significance of first track lifting mass above charm
93  trackSip3dValAboveCharm, // track 3D signed impact parameter of first track lifting mass above charm
94  trackSip3dSigAboveCharm, // track 3D signed impact parameter significance of first track lifting mass above charm
95 
96  leptonQuality, // lepton identification quality
97  leptonQuality2, // lepton identification quality 2
98 
99  trackP0Par, // track momentum along the jet axis, in the jet rest frame
100  trackP0ParRatio, // track momentum along the jet axis, in the jet rest frame, normalized to its energy"
101  trackChi2, // track fit chi2
102  trackNTotalHits, // number of valid total hits
103  trackNPixelHits, // number of valid pixel hits
104 
105  chargedHadronEnergyFraction, // fraction of the jet energy coming from charged hadrons
106  neutralHadronEnergyFraction, // fraction of the jet energy coming from neutral hadrons
107  photonEnergyFraction, // fraction of the jet energy coming from photons
108  electronEnergyFraction, // fraction of the jet energy coming from electrons
109  muonEnergyFraction, // fraction of the jet energy coming from muons
110  chargedHadronMultiplicity, // number of charged hadrons in the jet
111  neutralHadronMultiplicity, // number of neutral hadrons in the jet
112  photonMultiplicity, // number of photons in the jet
113  electronMultiplicity, // number of electrons in the jet
114  muonMultiplicity, // number of muons in the jet
115  hadronMultiplicity, // sum of number of charged and neutral hadrons in the jet
116  hadronPhotonMultiplicity, // sum of number of charged and neutral hadrons and photons in the jet
117  totalMultiplicity, // sum of number of charged and neutral hadrons, photons, electrons and muons in the jet
118 
119  massVertexEnergyFraction, // vertexmass times fraction of the vertex energy w.r.t. the jet energy
120  vertexBoostOverSqrtJetPt, // variable related to the boost of the vertex system in flight direction
121 
122  leptonSip2d, // 2D signed impact parameter of the soft lepton
123  leptonSip3d, // 3D signed impact parameter of the soft lepton
124  leptonPtRel, // transverse momentum of the soft lepton wrt. the jet axis
125  leptonP0Par, // momentum of the soft lepton along the jet direction, in the jet rest frame
126  leptonEtaRel, // pseudo)rapidity of the soft lepton along jet axis
127  leptonDeltaR, // pseudo)angular distance of the soft lepton to jet axis
128  leptonRatio, // momentum of the soft lepton over jet energy
129  leptonRatioRel, // momentum of the soft lepton parallel to jet axis over jet energy
130  electronMVA, // mva output from electron ID
131 
132  // ### specific to boosted double-b tagger (see BTV-15-002 PAS for more details) ###
133  trackSip3dSig_0, // 1st largest track 3D signed impact parameter significance
134  trackSip3dSig_1, // 2nd largest track 3D signed impact parameter significance
135  trackSip3dSig_2, // 3rd largest track 3D signed impact parameter significance
136  trackSip3dSig_3, // 4th largest track 3D signed impact parameter significance
137  tau1_trackSip3dSig_0, // 1st largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis
138  tau1_trackSip3dSig_1, // 2nd largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis
139  tau2_trackSip3dSig_0, // 1st largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis
140  tau2_trackSip3dSig_1, // 2nd largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis
141  trackSip2dSigAboveBottom_0, // track 2D signed impact parameter significance of 1st track lifting mass above bottom
142  trackSip2dSigAboveBottom_1, // track 2D signed impact parameter significance of 2nd track lifting mass above bottom
143  tau1_trackEtaRel_0, // 1st smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis
144  tau1_trackEtaRel_1, // 2nd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis
145  tau1_trackEtaRel_2, // 3rd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis
146  tau2_trackEtaRel_0, // 1st smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis
147  tau2_trackEtaRel_1, // 2nd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis
148  tau2_trackEtaRel_2, // 3rd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis
149  tau1_vertexMass, // mass of track sum at secondary vertex associated to the 1st N-subjettiness axis
150  tau1_vertexEnergyRatio, // ratio of energy at secondary vertex over total energy associated to the 1st N-subjettiness axis
151  tau1_flightDistance2dSig, // transverse distance significance between primary and secondary vertex associated to the 1st N-subjettiness axis
152  tau1_vertexDeltaR, // pseudoangular distance between the 1st N-subjettiness axis and secondary vertex direction
153  tau2_vertexMass, // mass of track sum at secondary vertex associated to the 2nd N-subjettiness axis
154  tau2_vertexEnergyRatio, // ratio of energy at secondary vertex over total energy associated to the 2nd N-subjettiness axis
155  tau2_flightDistance2dSig, // transverse distance significance between primary and secondary vertex associated to the 2nd N-subjettiness axis
156  tau2_vertexDeltaR, // pseudoangular distance between the 2nd N-subjettiness axis and secondary vertex direction
157  z_ratio, // z ratio
158 
159  Jet_SoftMu, // discriminator output of SoftMuon Tagger, used as input to (Deep)CMVA
160  Jet_SoftEl, // discriminator output of SoftElectron Tagger, used as input to (Deep)CMVA
161  Jet_JBP, // discriminator output of JPB Tagger, used as input to (Deep)CMVA
162  Jet_JP, // discriminator output of JP Tagger, used as input to (Deep)CMVA
163  // #################################################################################
164 
165  algoDiscriminator, // discriminator output of an algorithm
166 
168  };
169  }
170 
171  // import only TaggingVariableName type into reco namespace
173 
174  extern const char* const TaggingVariableDescription[];
175  extern const char* const TaggingVariableTokens[];
176 
178 
179  typedef float TaggingValue;
180 
181  // cannot use a const member since the STL containers relie on the default assignment operator
182  // typedef std::pair< const TaggingVariableName, TaggingValue > TaggingVariable;
183  typedef std::pair< TaggingVariableName, TaggingValue > TaggingVariable;
184 
186  bool operator() (const TaggingVariable& i, const TaggingVariable& j) {
187  return i.first < j.first;
188  }
189 
190  bool operator() (const TaggingVariable& i, TaggingVariableName tag) {
191  return i.first < tag;
192  }
193 
194  bool operator() (TaggingVariableName tag, const TaggingVariable& i) {
195  return tag < i.first;
196  }
197 
198  };
199 
200  // implementation via std::vector where
201  // - m_list is kept sorted via stable_sort after each insertion
202  // - extraction is done via binary search
204  public:
205  TaggingVariableList() : m_list() { }
206  TaggingVariableList( const TaggingVariableList& list ) : m_list( list.m_list ) { }
207 
208  // [begin, end) must identify a valid range of iterators to TaggingVariableList
209  template <typename InputIterator>
210  TaggingVariableList( const InputIterator begin, const InputIterator end ) : m_list() {
211  static_assert(( boost::is_convertible< const TaggingVariableList, typename boost::pointee<InputIterator>::type >::value ));
212  for (const InputIterator i = begin; i != end; i++)
213  insert(*i);
214  }
215 
219  typedef std::vector < TaggingVariable >::const_iterator const_iterator;
220  typedef std::pair < const_iterator, const_iterator > range;
221  size_t size() const { return m_list.size(); }
222  const_iterator begin() const { return m_list.begin(); }
223  const_iterator end() const { return m_list.end(); }
224  void push_back ( const TaggingVariable & t ) { m_list.push_back ( t ); }
225 
227 
228 
229  private:
230  std::vector< TaggingVariable > m_list;
231 
232  public:
233  bool checkTag( TaggingVariableName tag ) const;
234 
235  void insert( const TaggingVariable & variable, bool delayed = false );
236  void insert( const TaggingVariableList & list );
237  void insert( TaggingVariableName tag, TaggingValue value, bool delayed = false );
238  void insert( TaggingVariableName tag, const std::vector<TaggingValue> & values, bool delayed = false );
239 
240  void finalize( void );
241 
242  TaggingValue get( TaggingVariableName tag ) const;
243  TaggingValue get( TaggingVariableName tag, TaggingValue defaultValue ) const;
244  std::vector<TaggingValue> getList( TaggingVariableName tag, bool throwOnEmptyList = true ) const;
245 
246  range getRange( TaggingVariableName tag ) const;
247 
248  TaggingValue operator[]( TaggingVariableName tag ) const {
249  return get( tag );
250  }
251  };
252 
254 
255 }
256 
257 #endif // DataFormats_BTauReco_TaggingVariable_h
type
Definition: HCALResponse.h:21
const double piPlus
Definition: ParticleMasses.h:9
void push_back(const TaggingVariable &t)
const char *const TaggingVariableTokens[]
double etaRel(const math::XYZVector &dir, const math::XYZVector &track)
const_iterator begin() const
TaggingVariableList(const TaggingVariableList &list)
T sqrt(T t)
Definition: SSEVec.h:18
float TaggingValue
std::vector< TaggingVariable >::const_iterator const_iterator
const_iterator end() const
#define end
Definition: vmac.h:39
Definition: value.py:1
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
std::pair< TaggingVariableName, TaggingValue > TaggingVariable
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)
fixed size matrix
#define begin
Definition: vmac.h:32
#define DECLARE_EDM_REFS(class_name)
Definition: RefMacros.h:10
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