CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TaggingVariable.cc
Go to the documentation of this file.
1 #include <algorithm>
2 #include <functional>
3 #include <ext/functional>
4 using namespace std;
5 
8 
9 namespace reco {
10 
11 const char* const TaggingVariableDescription[] = {
12  /* [jetEnergy] = */ "jet energy",
13  /* [jetPt] = */ "jet transverse momentum",
14  /* [trackJetPt] = */ "track-based jet transverse momentum",
15  /* [jetEta] = */ "jet pseudorapidity",
16  /* [jetPhi] = */ "jet polar angle",
17  /* [jetNTracks] = */ "tracks associated to jet",
18 
19  /* [trackMomentum] = */ "track momentum",
20  /* [trackEta] = */ "track pseudorapidity",
21  /* [trackPhi] = */ "track polar angle",
22 
23  /* [trackPtRel] = */ "track transverse momentum, relative to the jet axis",
24  /* [trackPPar] = */ "track parallel momentum, along the jet axis",
25  /* [trackEtaRel] = */ "track pseudorapidity, relative to the jet axis",
26  /* [trackDeltaR] = */ "track pseudoangular distance from the jet axis",
27  /* [trackPtRatio] = */ "track transverse momentum, relative to the jet axis, normalized to its energy",
28  /* [trackPParRatio] = */ "track parallel momentum, along the jet axis, normalized to its energy",
29 
30  /* [trackSip2dVal] = */ "track 2D signed impact parameter",
31  /* [trackSip2dSig] = */ "track 2D signed impact parameter significance",
32  /* [trackSip3dVal] = */ "track 3D signed impact parameter",
33  /* [trackSip3dSig] = */ "track 3D signed impact parameter significance",
34  /* [trackDecayLenVal] = */ "track decay length",
35  /* [trackDecayLenSig] = */ "track decay length significance",
36  /* [trackJetDistVal] = */ "minimum track approach distance to jet axis",
37  /* [trackJetDistSig] = */ "minimum track approach distance to jet axis signifiance",
38  /* [trackGhostTrackDistVal] = */ "minimum approach distance to ghost track",
39  /* [trackGhostTrackDistSig] = */ "minimum approach distance to ghost track significance",
40  /* [trackGhostTrackWeight] = */ "weight of track participation in ghost track fit",
41 
42  /* [trackSumJetEtRatio] = */ "ratio of track sum transverse energy over jet energy",
43  /* [trackSumJetDeltaR] = */ "pseudoangular distance between jet axis and track fourvector sum",
44 
45  /* [vertexCategory] = */ "category of secondary vertex (Reco, Pseudo, No)",
46  /* [vertexLeptonCategory] = */ "category of secondary vertex & soft lepton (RecoNo, PseudoNo, NoNo, RecoMu, PseudoMu, NoMu, RecoEl, PseudoEl, NoEl)",
47 
48  /* [jetNSecondaryVertices] = */ "number of reconstructed possible secondary vertices in jet",
49  /* [jetNSingleTrackVertices] = */ "number of single-track ghost-track vertices",
50 
51  /* [vertexMass] = */ "mass of track sum at secondary vertex",
52  /* [vertexNTracks] = */ "number of tracks at secondary vertex",
53  /* [vertexFitProb] = */ "vertex fit probability",
54 
55  /* [vertexEnergyRatio] = */ "ratio of energy at secondary vertex over total energy",
56  /* [vertexJetDeltaR] = */ "pseudoangular distance between jet axis and secondary vertex direction",
57 
58  /* [flightDistance2dVal] = */ "transverse distance between primary and secondary vertex",
59  /* [flightDistance2dSig] = */ "transverse distance significance between primary and secondary vertex",
60  /* [flightDistance3dVal] = */ "distance between primary and secondary vertex",
61  /* [flightDistance3dSig] = */ "distance significance between primary and secondary vertex",
62 
63  /* [trackSip2dValAboveCharm] = */ "track 2D signed impact parameter of first track lifting mass above charm",
64  /* [trackSip2dSigAboveCharm] = */ "track 2D signed impact parameter significance of first track lifting mass above charm",
65  /* [trackSip3dValAboveCharm] = */ "track 3D signed impact parameter of first track lifting mass above charm",
66  /* [trackSip3dSigAboveCharm] = */ "track 3D signed impact parameter significance of first track lifting mass above charm",
67 
68  /* [trackP0Par] = */ "track momentum along the jet axis, in the jet rest frame",
69  /* [trackP0ParRatio] = */ "track momentum along the jet axis, in the jet rest frame, normalized to its energy"
70  /* [trackChi2] = */ "chi2 of the track fit",
71  /* [trackNTotalHits] = */ "number of valid total hits",
72  /* [trackNPixelHits] = */ "number of valid pixel hits",
73 
74  /* [leptonQuality] = */ "lepton identification quality",
75  /* [leptonQuality2] = */ "lepton identification quality 2",
76 
77  /* [chargedHadronEnergyFraction] = */ "fraction of the jet energy coming from charged hadrons",
78  /* [neutralHadronEnergyFraction] = */ "fraction of the jet energy coming from neutral hadrons",
79  /* [photonEnergyFraction] = */ "fraction of the jet energy coming from photons",
80  /* [electronEnergyFraction] = */ "fraction of the jet energy coming from electrons",
81  /* [muonEnergyFraction] = */ "fraction of the jet energy coming from muons",
82  /* [chargedHadronMultiplicity] = */ "number of charged hadrons in the jet",
83  /* [neutralHadronMultiplicity] = */ "number of neutral hadrons in the jet",
84  /* [photonMultiplicity] = */ "number of photons in the jet",
85  /* [electronMultiplicity] = */ "number of electrons in the jet",
86  /* [muonMultiplicity] = */ "number of muons in the jet",
87  /* [hadronMultiplicity] = */ "total number of charged and neutral hadrons in the jet",
88  /* [hadronPhotonMultiplicity] = */ "total number of photons, charged and neutral hadrons in the jet",
89  /* [totalMultiplicity] = */ "total number of photons, electrons, muons, charged and neutral hadrons in the jet",
90 
91  /* [massVertexEnergyFraction] = */ "vertexmass times fraction of the vertex energy w.r.t. the jet energy",
92  /* [vertexBoostOverSqrtJetPt] = */ "variable related to the boost of the vertex system in flight direction",
93 
94  /* [leptonSip2d] = */ "2D signed impact parameter of the soft lepton",
95  /* [leptonSip3d] = */ "3D signed impact parameter of the soft lepton",
96  /* [leptonPtRel] = */ "transverse momentum of the soft lepton wrt. the jet axis",
97  /* [leptonP0Par] = */ "momentum of the soft lepton along the jet direction, in the jet rest frame",
98  /* [leptonEtaRel] = */ "pseudo)rapidity of the soft lepton along jet axis",
99  /* [leptonDeltaR] = */ "pseudo)angular distance of the soft lepton to jet axis",
100  /* [leptonRatio], = */ "momentum of the soft lepton over jet energy",
101  /* [leptonRatioRel] = */ "momentum of the soft lepton parallel to jet axis over jet energy",
102  /* [electronMVA] = */ "mva output of the electron ID",
103 
104 
105  /* [algoDiscriminator] = */ "discriminator output of an algorithm",
106 
107  /* [lastTaggingVariable] = */ ""
108 };
109 
110 const char* const TaggingVariableTokens[] = {
111  /* [jetEnergy] = */ "jetEnergy",
112  /* [jetPt] = */ "jetPt",
113  /* [trackJetPt] = */ "trackJetPt",
114  /* [jetEta] = */ "jetEta",
115  /* [jetPhi] = */ "jetPhi",
116  /* [jetNTracks] = */ "jetNTracks",
117 
118  /* [trackMomentum] = */ "trackMomentum",
119  /* [trackEta] = */ "trackEta",
120  /* [trackPhi] = */ "trackPhi",
121 
122  /* [trackPtRel] = */ "trackPtRel",
123  /* [trackPPar] = */ "trackPPar",
124  /* [trackEtaRel] = */ "trackEtaRel",
125  /* [trackDeltaR] = */ "trackDeltaR",
126  /* [trackPtRatio] = */ "trackPtRatio",
127  /* [trackPParRatio] = */ "trackPParRatio",
128 
129  /* [trackSip2dVal] = */ "trackSip2dVal",
130  /* [trackSip2dSig] = */ "trackSip2dSig",
131  /* [trackSip3dVal] = */ "trackSip3dVal",
132  /* [trackSip3dSig] = */ "trackSip3dSig",
133  /* [trackDecayLenVal] = */ "trackDecayLenVal",
134  /* [trackDecayLenSig] = */ "trackDecayLenSig",
135  /* [trackJetDistVal] = */ "trackJetDist", //FIXME
136  /* [trackJetDistSig] = */ "trackJetDistSig",
137  /* [trackGhostTrackDistVal] = */ "trackGhostTrackDistVal",
138  /* [trackGhostTrackDistSig] = */ "trackGhostTrackDistSig",
139  /* [trackGhostTrackWeight] = */ "trackGhostTrackWeight",
140 
141  /* [trackSumJetEtRatio] = */ "trackSumJetEtRatio",
142  /* [trackSumJetDeltaR] = */ "trackSumJetDeltaR",
143 
144  /* [vertexCategory] = */ "vertexCategory",
145  /* [vertexLeptonCategory] = */ "vertexLeptonCategory",
146 
147  /* [jetNSecondaryVertices] = */ "jetNSecondaryVertices",
148  /* [jetNSingleTrackVertices] = */ "jetNSingleTrackVertices",
149 
150  /* [vertexMass] = */ "vertexMass",
151  /* [vertexNTracks] = */ "vertexNTracks",
152  /* [vertexFitProb] = */ "vertexFitProb",
153 
154  /* [vertexEnergyRatio] = */ "vertexEnergyRatio",
155  /* [vertexJetDeltaR] = */ "vertexJetDeltaR",
156 
157  /* [flightDistance2dVal] = */ "flightDistance2dVal",
158  /* [flightDistance2dSig] = */ "flightDistance2dSig",
159  /* [flightDistance3dVal] = */ "flightDistance3dVal",
160  /* [flightDistance3dSig] = */ "flightDistance3dSig",
161 
162  /* [trackSip2dValAboveCharm] = */ "trackSip2dValAboveCharm",
163  /* [trackSip2dSigAboveCharm] = */ "trackSip2dSigAboveCharm",
164  /* [trackSip3dValAboveCharm] = */ "trackSip3dValAboveCharm",
165  /* [trackSip3dSigAboveCharm] = */ "trackSip3dSigAboveCharm",
166 
167  /* [leptonQuality] = */ "leptonQuality",
168  /* [leptonQuality2] = */ "leptonQuality2",
169 
170  /* [trackP0Par] = */ "trackP0Par",
171  /* [trackP0ParRatio] = */ "trackP0ParRatio",
172  /* [trackChi2] = */ "trackChi2",
173  /* [trackNTotalHits] = */ "trackNTotalHits",
174  /* [trackNPixelHits] = */ "trackNPixelHits",
175 
176 
177  /* [chargedHadronEnergyFraction] = */ "chargedHadronEnergyFraction",
178  /* [neutralHadronEnergyFraction] = */ "neutralHadronEnergyFraction",
179  /* [photonEnergyFraction] = */ "photonEnergyFraction",
180  /* [electronEnergyFraction] = */ "electronEnergyFraction",
181  /* [muonEnergyFraction], = */ "muonEnergyFraction",
182  /* [chargedHadronMultiplicity], = */ "chargedHadronMultiplicity",
183  /* [neutralHadronMultiplicity], = */ "neutralHadronMultiplicity",
184  /* [photonMultiplicity] = */ "photonMultiplicity",
185  /* [electronMultiplicity] = */ "electronMultiplicity",
186  /* [muonMultiplicity], = */ "muonMultiplicity",
187  /* [hadronMultiplicity], = */ "hadronMultiplicity",
188  /* [hadronPhotonMultiplicity], = */ "hadronPhotonMultiplicity",
189  /* [totalMultiplicity] = */ "totalMultiplicity",
190 
191  /* [massVertexEnergyFraction], = */ "massVertexEnergyFraction",
192  /* [vertexBoostOverSqrtJetPt], = */ "vertexBoostOverSqrtJetPt",
193 
194  /* [leptonSip2d] = */ "leptonSip2d",
195  /* [leptonSip3d] = */ "leptonSip3d",
196  /* [leptonPtRel] = */ "leptonPtRel",
197  /* [leptonP0Par] = */ "leptonP0Par",
198  /* [leptonEtaRel] = */ "leptonEtaRel",
199  /* [leptonDeltaR] = */ "leptonDeltaR",
200  /* [leptonRatio] = */ "leptonRatio",
201  /* [leptonRatioRel], = */ "leptonRatioRel",
202  /* [electronMVA] = */ "electronMVA",
203 
204  /* [algoDiscriminator] = */ "algoDiscriminator",
205 
206  /* [lastTaggingVariable] = */ "lastTaggingVariable"
207 };
208 
210 {
211  for (int i = 0; i <= reco::btau::lastTaggingVariable; i++)
212  if (name == TaggingVariableTokens[i])
215 }
216 
217 // check if a tag is present in the TaggingVariableList
218 bool TaggingVariableList::checkTag( TaggingVariableName tag ) const {
219  return binary_search( m_list.begin(), m_list.end(), tag, TaggingVariableCompare() );
220 }
221 
222 void TaggingVariableList::insert( const TaggingVariable & variable, bool delayed /* = false */ ) {
223  m_list.push_back( variable );
224  if (not delayed) finalize();
225 }
226 
228  m_list.push_back( TaggingVariable( tag, value ) );
229  if (not delayed) finalize();
230 }
231 
232 void TaggingVariableList::insert( TaggingVariableName tag, const std::vector<TaggingValue> & values, bool delayed /* = false */ ) {
233  for (std::vector<TaggingValue>::const_iterator i = values.begin(); i != values.end(); i++) {
234  m_list.push_back( TaggingVariable(tag, *i) );
235  }
236  if (not delayed) finalize();
237 }
238 
241  m_list.insert( m_list.end(), list.m_list.begin(), list.m_list.end() );
242  inplace_merge( m_list.begin(), m_list.begin() + size, m_list.end(), TaggingVariableCompare() );
243 }
244 
245 void TaggingVariableList::finalize( void ) {
246  stable_sort( m_list.begin(), m_list.end(), TaggingVariableCompare() );
247 }
248 
250  range r = getRange(tag);
251  if (r.first == r.second)
253  << "TaggingVariable " << tag << " is not present in the collection";
254  return r.first->second;
255 }
256 
258  range r = getRange(tag);
259  if ( r.first == r.second )
260  return defaultValue;
261  return r.first->second;
262 }
263 
264 std::vector<TaggingValue> TaggingVariableList::getList( TaggingVariableName tag, bool throwOnEmptyList ) const {
265  using namespace __gnu_cxx;
266  range r = getRange( tag );
267  if ( throwOnEmptyList && r.first == r.second )
269  << "TaggingVariable " << tag << " is not present in the collection";
270  std::vector<TaggingValue> list( r.second - r.first );
271  transform( r.first, r.second, list.begin(), select2nd< TaggingVariable >() );
272  return list;
273 }
274 
275 TaggingVariableList::range TaggingVariableList::getRange( TaggingVariableName tag ) const {
276  return equal_range( m_list.begin(), m_list.end(), tag, TaggingVariableCompare() );
277 }
278 
279 } // namespace reco
int i
Definition: DBlmapReader.cc:9
const char *const TaggingVariableTokens[]
uint16_t size_type
float TaggingValue
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:49
std::pair< TaggingVariableName, TaggingValue > TaggingVariable
std::pair< const_iterator, const_iterator > range
TaggingVariableName getTaggingVariableName(const std::string &name)
tuple size
Write out results.
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