CMS 3D CMS Logo

TaggingVariable.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <functional>
3 using namespace std;
4 
7 
8 namespace reco {
9 
10 const char* const TaggingVariableDescription[] = {
11  /* [jetEnergy] = */ "jet energy",
12  /* [jetPt] = */ "jet transverse momentum",
13  /* [trackJetPt] = */ "track-based jet transverse momentum",
14  /* [jetEta] = */ "jet pseudorapidity",
15  /* [jetAbsEta] = */ "jet absolute pseudorapidity",
16  /* [jetPhi] = */ "jet polar angle",
17  /* [jetNTracks] = */ "tracks associated to jet",
18  /* [jetNSelectedTracks] = */ "selected tracks in the jet",
19  /* [jetNTracksEtaRel] = */ "number of tracks for which etaRel is computed",
20 
21  /* [trackMomentum] = */ "track momentum",
22  /* [trackEta] = */ "track pseudorapidity",
23  /* [trackPhi] = */ "track polar angle",
24 
25  /* [trackCharge] = */ "track charge",
26 
27  /* [trackPtRel] = */ "track transverse momentum, relative to the jet axis",
28  /* [trackPPar] = */ "track parallel momentum, along the jet axis",
29  /* [trackEtaRel] = */ "track pseudorapidity, relative to the jet axis",
30  /* [trackDeltaR] = */ "track pseudoangular distance from the jet axis",
31  /* [trackPtRatio] = */ "track transverse momentum, relative to the jet axis, normalized to its energy",
32  /* [trackPParRatio] = */ "track parallel momentum, along the jet axis, normalized to its energy",
33 
34  /* [trackSip2dVal] = */ "track 2D signed impact parameter",
35  /* [trackSip2dSig] = */ "track 2D signed impact parameter significance",
36  /* [trackSip3dVal] = */ "track 3D signed impact parameter",
37  /* [trackSip3dSig] = */ "track 3D signed impact parameter significance",
38  /* [trackDecayLenVal] = */ "track decay length",
39  /* [trackDecayLenSig] = */ "track decay length significance",
40  /* [trackJetDistVal] = */ "minimum track approach distance to jet axis",
41  /* [trackJetDistSig] = */ "minimum track approach distance to jet axis signifiance",
42  /* [trackGhostTrackDistVal] = */ "minimum approach distance to ghost track",
43  /* [trackGhostTrackDistSig] = */ "minimum approach distance to ghost track significance",
44  /* [trackGhostTrackWeight] = */ "weight of track participation in ghost track fit",
45 
46  /* [trackSumJetEtRatio] = */ "ratio of track sum transverse energy over jet energy",
47  /* [trackSumJetDeltaR] = */ "pseudoangular distance between jet axis and track fourvector sum",
48 
49  /* [vertexCategory] = */ "category of secondary vertex (Reco, Pseudo, No)",
50  /* [vertexLeptonCategory] = */ "category of secondary vertex & soft lepton (RecoNo, PseudoNo, NoNo, RecoMu, PseudoMu, NoMu, RecoEl, PseudoEl, NoEl)",
51 
52  /* [jetNSecondaryVertices] = */ "number of reconstructed possible secondary vertices in jet",
53  /* [jetNSingleTrackVertices] = */ "number of single-track ghost-track vertices",
54 
55  /* [vertexMass] = */ "mass of track sum at secondary vertex",
56  /* [vertexNTracks] = */ "number of tracks at secondary vertex",
57  /* [vertexFitProb] = */ "vertex fit probability",
58 
59  /* [vertexEnergyRatio] = */ "ratio of energy at secondary vertex over total energy",
60  /* [vertexJetDeltaR] = */ "pseudoangular distance between jet axis and secondary vertex direction",
61 
62  /* [flightDistance1dVal] = */ "Longitudinal distance along the z-axis between primary and secondary vertex",
63  /* [flightDistance1dSig] = */ "Longitudinal distance significance along the z-axis between primary and secondary vertex",
64  /* [flightDistance2dVal] = */ "transverse distance between primary and secondary vertex",
65  /* [flightDistance2dSig] = */ "transverse distance significance between primary and secondary vertex",
66  /* [flightDistance3dVal] = */ "distance between primary and secondary vertex",
67  /* [flightDistance3dSig] = */ "distance significance between primary and secondary vertex",
68 
69  /* [trackSip2dValAboveCharm] = */ "track 2D signed impact parameter of first track lifting mass above charm",
70  /* [trackSip2dSigAboveCharm] = */ "track 2D signed impact parameter significance of first track lifting mass above charm",
71  /* [trackSip3dValAboveCharm] = */ "track 3D signed impact parameter of first track lifting mass above charm",
72  /* [trackSip3dSigAboveCharm] = */ "track 3D signed impact parameter significance of first track lifting mass above charm",
73 
74  /* [trackP0Par] = */ "track momentum along the jet axis, in the jet rest frame",
75  /* [trackP0ParRatio] = */ "track momentum along the jet axis, in the jet rest frame, normalized to its energy"
76  /* [trackChi2] = */ "chi2 of the track fit",
77  /* [trackNTotalHits] = */ "number of valid total hits",
78  /* [trackNPixelHits] = */ "number of valid pixel hits",
79 
80  /* [leptonQuality] = */ "lepton identification quality",
81  /* [leptonQuality2] = */ "lepton identification quality 2",
82 
83  /* [chargedHadronEnergyFraction] = */ "fraction of the jet energy coming from charged hadrons",
84  /* [neutralHadronEnergyFraction] = */ "fraction of the jet energy coming from neutral hadrons",
85  /* [photonEnergyFraction] = */ "fraction of the jet energy coming from photons",
86  /* [electronEnergyFraction] = */ "fraction of the jet energy coming from electrons",
87  /* [muonEnergyFraction] = */ "fraction of the jet energy coming from muons",
88  /* [chargedHadronMultiplicity] = */ "number of charged hadrons in the jet",
89  /* [neutralHadronMultiplicity] = */ "number of neutral hadrons in the jet",
90  /* [photonMultiplicity] = */ "number of photons in the jet",
91  /* [electronMultiplicity] = */ "number of electrons in the jet",
92  /* [muonMultiplicity] = */ "number of muons in the jet",
93  /* [hadronMultiplicity] = */ "total number of charged and neutral hadrons in the jet",
94  /* [hadronPhotonMultiplicity] = */ "total number of photons, charged and neutral hadrons in the jet",
95  /* [totalMultiplicity] = */ "total number of photons, electrons, muons, charged and neutral hadrons in the jet",
96 
97  /* [massVertexEnergyFraction] = */ "vertexmass times fraction of the vertex energy w.r.t. the jet energy",
98  /* [vertexBoostOverSqrtJetPt] = */ "variable related to the boost of the vertex system in flight direction",
99 
100  /* [leptonSip2d] = */ "2D signed impact parameter of the soft lepton",
101  /* [leptonSip3d] = */ "3D signed impact parameter of the soft lepton",
102  /* [leptonPtRel] = */ "transverse momentum of the soft lepton wrt. the jet axis",
103  /* [leptonP0Par] = */ "momentum of the soft lepton along the jet direction, in the jet rest frame",
104  /* [leptonEtaRel] = */ "pseudo)rapidity of the soft lepton along jet axis",
105  /* [leptonDeltaR] = */ "pseudo)angular distance of the soft lepton to jet axis",
106  /* [leptonRatio] = */ "momentum of the soft lepton over jet energy",
107  /* [leptonRatioRel] = */ "momentum of the soft lepton parallel to jet axis over jet energy",
108  /* [electronMVA] = */ "mva output of the electron ID",
109 
110  /* [trackSip3dSig_0] = */ "1st largest track 3D signed impact parameter significance",
111  /* [trackSip3dSig_1] = */ "2nd largest track 3D signed impact parameter significance",
112  /* [trackSip3dSig_2] = */ "3rd largest track 3D signed impact parameter significance",
113  /* [trackSip3dSig_3] = */ "4th largest track 3D signed impact parameter significance",
114  /* [tau1_trackSip3dSig_0] = */ "1st largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis",
115  /* [tau1_trackSip3dSig_1] = */ "2nd largest track 3D signed impact parameter significance associated to the 1st N-subjettiness axis",
116  /* [tau2_trackSip3dSig_0] = */ "1st largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis",
117  /* [tau2_trackSip3dSig_1] = */ "2nd largest track 3D signed impact parameter significance associated to the 2nd N-subjettiness axis",
118  /* [trackSip2dSigAboveBottom_0] = */ "track 2D signed impact parameter significance of 1st track lifting mass above bottom",
119  /* [trackSip2dSigAboveBottom_1] = */ "track 2D signed impact parameter significance of 2nd track lifting mass above bottom",
120  /* [tau1_trackEtaRel_0] = */ "1st smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis",
121  /* [tau1_trackEtaRel_1] = */ "2nd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis",
122  /* [tau1_trackEtaRel_2] = */ "3rd smallest track pseudorapidity, relative to the jet axis, associated to the 1st N-subjettiness axis",
123  /* [tau2_trackEtaRel_0] = */ "1st smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis",
124  /* [tau2_trackEtaRel_1] = */ "2nd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis",
125  /* [tau2_trackEtaRel_2] = */ "3rd smallest track pseudorapidity, relative to the jet axis, associated to the 2nd N-subjettiness axis",
126  /* [tau1_vertexMass] = */ "mass of track sum at secondary vertex associated to the 1st N-subjettiness axis",
127  /* [tau1_vertexEnergyRatio] = */ "ratio of energy at secondary vertex over total energy associated to the 1st N-subjettiness axis",
128  /* [tau1_flightDistance2dSig] = */ "transverse distance significance between primary and secondary vertex associated to the 1st N-subjettiness axis",
129  /* [tau1_vertexDeltaR] = */ "pseudoangular distance between the 1st N-subjettiness axis and secondary vertex direction",
130  /* [tau2_vertexMass] = */ "mass of track sum at secondary vertex associated to the 2nd N-subjettiness axis",
131  /* [tau2_vertexEnergyRatio] = */ "ratio of energy at secondary vertex over total energy associated to the 2nd N-subjettiness axis",
132  /* [tau2_flightDistance2dSig] = */ "transverse distance significance between primary and secondary vertex associated to the 2nd N-subjettiness axis",
133  /* [tau2_vertexDeltaR] = */ "pseudoangular distance between the 2nd N-subjettiness axis and secondary vertex direction",
134  /* [z_ratio] = */ "z ratio",
135  /* [Jet_SoftMu] = */ "SoftMu Tagger discriminator",
136  /* [Jet_SoftEl] = */ "SoftEl Tagger discriminator",
137  /* [Jet_JBP] = */ "JBP Tagger discriminator",
138  /* [Jet_JP] = */ "JP Tagger discriminator",
139 
140  /* [algoDiscriminator] = */ "discriminator output of an algorithm",
141 
142  /* [lastTaggingVariable] = */ ""
143 };
144 
145 const char* const TaggingVariableTokens[] = {
146  /* [jetEnergy] = */ "jetEnergy",
147  /* [jetPt] = */ "jetPt",
148  /* [trackJetPt] = */ "trackJetPt",
149  /* [jetEta] = */ "jetEta",
150  /* [jetAbsEta] = */ "jetAbsEta",
151  /* [jetPhi] = */ "jetPhi",
152  /* [jetNTracks] = */ "jetNTracks",
153  /* [jetNSelectedTracks] = */ "jetNSelectedTracks",
154  /* [jetNTracksEtaRel] = */ "jetNTracksEtaRel",
155 
156  /* [trackMomentum] = */ "trackMomentum",
157  /* [trackEta] = */ "trackEta",
158  /* [trackPhi] = */ "trackPhi",
159 
160  /* [trackCharge] = */ "trackCharge",
161 
162  /* [trackPtRel] = */ "trackPtRel",
163  /* [trackPPar] = */ "trackPPar",
164  /* [trackEtaRel] = */ "trackEtaRel",
165  /* [trackDeltaR] = */ "trackDeltaR",
166  /* [trackPtRatio] = */ "trackPtRatio",
167  /* [trackPParRatio] = */ "trackPParRatio",
168 
169  /* [trackSip2dVal] = */ "trackSip2dVal",
170  /* [trackSip2dSig] = */ "trackSip2dSig",
171  /* [trackSip3dVal] = */ "trackSip3dVal",
172  /* [trackSip3dSig] = */ "trackSip3dSig",
173  /* [trackDecayLenVal] = */ "trackDecayLenVal",
174  /* [trackDecayLenSig] = */ "trackDecayLenSig",
175  /* [trackJetDistVal] = */ "trackJetDist", //FIXME
176  /* [trackJetDistSig] = */ "trackJetDistSig",
177  /* [trackGhostTrackDistVal] = */ "trackGhostTrackDistVal",
178  /* [trackGhostTrackDistSig] = */ "trackGhostTrackDistSig",
179  /* [trackGhostTrackWeight] = */ "trackGhostTrackWeight",
180 
181  /* [trackSumJetEtRatio] = */ "trackSumJetEtRatio",
182  /* [trackSumJetDeltaR] = */ "trackSumJetDeltaR",
183 
184  /* [vertexCategory] = */ "vertexCategory",
185  /* [vertexLeptonCategory] = */ "vertexLeptonCategory",
186 
187  /* [jetNSecondaryVertices] = */ "jetNSecondaryVertices",
188  /* [jetNSingleTrackVertices] = */ "jetNSingleTrackVertices",
189 
190  /* [vertexMass] = */ "vertexMass",
191  /* [vertexNTracks] = */ "vertexNTracks",
192  /* [vertexFitProb] = */ "vertexFitProb",
193 
194  /* [vertexEnergyRatio] = */ "vertexEnergyRatio",
195  /* [vertexJetDeltaR] = */ "vertexJetDeltaR",
196 
197  /* [flightDistance1dVal] = */ "flightDistance1dVal",
198  /* [flightDistance1dSig] = */ "flightDistance1dSig",
199  /* [flightDistance2dVal] = */ "flightDistance2dVal",
200  /* [flightDistance2dSig] = */ "flightDistance2dSig",
201  /* [flightDistance3dVal] = */ "flightDistance3dVal",
202  /* [flightDistance3dSig] = */ "flightDistance3dSig",
203 
204  /* [trackSip2dValAboveCharm] = */ "trackSip2dValAboveCharm",
205  /* [trackSip2dSigAboveCharm] = */ "trackSip2dSigAboveCharm",
206  /* [trackSip3dValAboveCharm] = */ "trackSip3dValAboveCharm",
207  /* [trackSip3dSigAboveCharm] = */ "trackSip3dSigAboveCharm",
208 
209  /* [leptonQuality] = */ "leptonQuality",
210  /* [leptonQuality2] = */ "leptonQuality2",
211 
212  /* [trackP0Par] = */ "trackP0Par",
213  /* [trackP0ParRatio] = */ "trackP0ParRatio",
214  /* [trackChi2] = */ "trackChi2",
215  /* [trackNTotalHits] = */ "trackNTotalHits",
216  /* [trackNPixelHits] = */ "trackNPixelHits",
217 
218 
219  /* [chargedHadronEnergyFraction] = */ "chargedHadronEnergyFraction",
220  /* [neutralHadronEnergyFraction] = */ "neutralHadronEnergyFraction",
221  /* [photonEnergyFraction] = */ "photonEnergyFraction",
222  /* [electronEnergyFraction] = */ "electronEnergyFraction",
223  /* [muonEnergyFraction] = */ "muonEnergyFraction",
224  /* [chargedHadronMultiplicity] = */ "chargedHadronMultiplicity",
225  /* [neutralHadronMultiplicity] = */ "neutralHadronMultiplicity",
226  /* [photonMultiplicity] = */ "photonMultiplicity",
227  /* [electronMultiplicity] = */ "electronMultiplicity",
228  /* [muonMultiplicity] = */ "muonMultiplicity",
229  /* [hadronMultiplicity] = */ "hadronMultiplicity",
230  /* [hadronPhotonMultiplicity] = */ "hadronPhotonMultiplicity",
231  /* [totalMultiplicity] = */ "totalMultiplicity",
232 
233  /* [massVertexEnergyFraction] = */ "massVertexEnergyFraction",
234  /* [vertexBoostOverSqrtJetPt] = */ "vertexBoostOverSqrtJetPt",
235 
236  /* [leptonSip2d] = */ "leptonSip2d",
237  /* [leptonSip3d] = */ "leptonSip3d",
238  /* [leptonPtRel] = */ "leptonPtRel",
239  /* [leptonP0Par] = */ "leptonP0Par",
240  /* [leptonEtaRel] = */ "leptonEtaRel",
241  /* [leptonDeltaR] = */ "leptonDeltaR",
242  /* [leptonRatio] = */ "leptonRatio",
243  /* [leptonRatioRel] = */ "leptonRatioRel",
244  /* [electronMVA] = */ "electronMVA",
245 
246  /* [trackSip3dSig_0] = */ "trackSip3dSig_0",
247  /* [trackSip3dSig_1] = */ "trackSip3dSig_1",
248  /* [trackSip3dSig_2] = */ "trackSip3dSig_2",
249  /* [trackSip3dSig_3] = */ "trackSip3dSig_3",
250  /* [tau1_trackSip3dSig_0] = */ "tau1_trackSip3dSig_0",
251  /* [tau1_trackSip3dSig_1] = */ "tau1_trackSip3dSig_1",
252  /* [tau2_trackSip3dSig_0] = */ "tau2_trackSip3dSig_0",
253  /* [tau2_trackSip3dSig_1] = */ "tau2_trackSip3dSig_1",
254  /* [trackSip2dSigAboveBottom_0] = */ "trackSip2dSigAboveBottom_0",
255  /* [trackSip2dSigAboveBottom_1] = */ "trackSip2dSigAboveBottom_1",
256  /* [tau1_trackEtaRel_0] = */ "tau1_trackEtaRel_0",
257  /* [tau1_trackEtaRel_1] = */ "tau1_trackEtaRel_1",
258  /* [tau1_trackEtaRel_2] = */ "tau1_trackEtaRel_2",
259  /* [tau2_trackEtaRel_0] = */ "tau2_trackEtaRel_0",
260  /* [tau2_trackEtaRel_1] = */ "tau2_trackEtaRel_1",
261  /* [tau2_trackEtaRel_2] = */ "tau2_trackEtaRel_2",
262  /* [tau1_vertexMass] = */ "tau1_vertexMass",
263  /* [tau1_vertexEnergyRatio] = */ "tau1_vertexEnergyRatio",
264  /* [tau1_flightDistance2dSig] = */ "tau1_flightDistance2dSig",
265  /* [tau1_vertexDeltaR] = */ "tau1_vertexDeltaR",
266  /* [tau2_vertexMass] = */ "tau2_vertexMass",
267  /* [tau2_vertexEnergyRatio] = */ "tau2_vertexEnergyRatio",
268  /* [tau2_flightDistance2dSig] = */ "tau2_flightDistance2dSig",
269  /* [tau2_vertexDeltaR] = */ "tau2_vertexDeltaR",
270  /* [z_ratio] = */ "z_ratio",
271  /* [Jet_SoftMu] = */ "Jet_SoftMu",
272  /* [Jet_SoftEl] = */ "Jet_SoftEl",
273  /* [Jet_JBP] = */ "Jet_JBP",
274  /* [Jet_JP] = */ "Jet_JP",
275 
276  /* [algoDiscriminator] = */ "algoDiscriminator",
277 
278  /* [lastTaggingVariable] = */ "lastTaggingVariable"
279 };
280 
282 {
283  for (int i = 0; i <= reco::btau::lastTaggingVariable; i++)
284  if (name == TaggingVariableTokens[i])
287 }
288 
289 // check if a tag is present in the TaggingVariableList
290 bool TaggingVariableList::checkTag( TaggingVariableName tag ) const {
291  return binary_search( m_list.begin(), m_list.end(), tag, TaggingVariableCompare() );
292 }
293 
294 void TaggingVariableList::insert( const TaggingVariable & variable, bool delayed /* = false */ ) {
295  m_list.push_back( variable );
296  if (not delayed) finalize();
297 }
298 
300  m_list.push_back( TaggingVariable( tag, value ) );
301  if (not delayed) finalize();
302 }
303 
304 void TaggingVariableList::insert( TaggingVariableName tag, const std::vector<TaggingValue> & values, bool delayed /* = false */ ) {
305  for (std::vector<TaggingValue>::const_iterator i = values.begin(); i != values.end(); i++) {
306  m_list.push_back( TaggingVariable(tag, *i) );
307  }
308  if (not delayed) finalize();
309 }
310 
313  m_list.insert( m_list.end(), list.m_list.begin(), list.m_list.end() );
314  inplace_merge( m_list.begin(), m_list.begin() + size, m_list.end(), TaggingVariableCompare() );
315 }
316 
317 void TaggingVariableList::finalize( void ) {
318  stable_sort( m_list.begin(), m_list.end(), TaggingVariableCompare() );
319 }
320 
322  range r = getRange(tag);
323  if (r.first == r.second)
325  << "TaggingVariable " << tag << " is not present in the collection";
326  return r.first->second;
327 }
328 
330  range r = getRange(tag);
331  if ( r.first == r.second )
332  return defaultValue;
333  return r.first->second;
334 }
335 
336 std::vector<TaggingValue> TaggingVariableList::getList( TaggingVariableName tag, bool throwOnEmptyList ) const {
337  range r = getRange( tag );
338  if ( throwOnEmptyList && r.first == r.second )
340  << "TaggingVariable " << tag << " is not present in the collection";
341  std::vector<TaggingValue> list( r.second - r.first );
342  transform( r.first, r.second, list.begin(), [](TaggingVariable const& x) { return x.second;} );
343  return list;
344 }
345 
346 TaggingVariableList::range TaggingVariableList::getRange( TaggingVariableName tag ) const {
347  return equal_range( m_list.begin(), m_list.end(), tag, TaggingVariableCompare() );
348 }
349 
350 } // namespace reco
size
Write out results.
const char *const TaggingVariableTokens[]
uint16_t size_type
float TaggingValue
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
TaggingVariableName getTaggingVariableName(const std::string &name)
fixed size matrix
const char *const TaggingVariableDescription[]
T get(const Candidate &c)
Definition: component.h:55
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