ATLAS Offline Software
Loading...
Searching...
No Matches
BTagging_v1.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: BTagging_v1.cxx 797330 2017-02-15 14:25:13Z guirriec $
6
7// EDM include(s):
9
10// Local include(s):
14
15namespace xAOD {
16
21
23 //
24 // Implementation of the SV0 accessor functions
25 //
26
28 SV0_significance3D,
29 setSV0_significance3D )
30
31 // The accessor object(s):
33 sv0TPAcc1( "SV0_TrackParticles" );
35 sv0TPAcc2( "SV0_TrackParticleLinks" );
36
38
39 if( sv0TPAcc1.isAvailable( *this ) ) {
40 return sv0TPAcc1( *this );
41 }
42 return sv0TPAcc2( *this );
43 }
44
46
47 sv0TPAcc2( *this ) = value;
48 return;
49 }
50
52
53 if( ( ! sv0TPAcc1.isAvailable( *this ) ) &&
54 ( ! sv0TPAcc2.isAvailable( *this ) ) ) {
55 return nullptr;
56 }
57 const TPELVec_t& tpl = SV0_TrackParticleLinks();
58 if( tpl.size() <= i ) {
59 return nullptr;
60 }
61 if( ! tpl[ i ].isValid() ) {
62 return nullptr;
63 }
64 return *( tpl[ i ] );
65 }
66
68
69 if( ( ! sv0TPAcc1.isAvailable( *this ) ) &&
70 ( ! sv0TPAcc2.isAvailable( *this ) ) ) {
71 return 0;
72 }
73 return SV0_TrackParticleLinks().size();
74 }
75
78
79 sv0TPAcc2( *this ).push_back( link );
80 return;
81 }
82
84
85 sv0TPAcc2( *this ).clear();
86 return;
87 }
88
89 //
91
93 //
94 // Implementation of the SV1 accessor functions
95 //
96 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, SV1_pb, setSV1_pb)
97 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, SV1_pu, setSV1_pu)
98 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, SV1_pc, setSV1_pc)
99
100 // The accessor object(s):
102 sv1TPAcc1( "SV1_TrackParticles" );
104 sv1TPAcc2( "SV1_TrackParticleLinks" );
105
107
108 if( sv1TPAcc1.isAvailable( *this ) ) {
109 return sv1TPAcc1( *this );
110 }
111 return sv1TPAcc2( *this );
112 }
113
115
116 sv1TPAcc2( *this ) = value;
117 return;
118 }
119
121
122 if( ( ! sv1TPAcc1.isAvailable( *this ) ) &&
123 ( ! sv1TPAcc2.isAvailable( *this ) ) ) {
124 return nullptr;
125 }
126 const TPELVec_t& tpl = SV1_TrackParticleLinks();
127 if( tpl.size() <= i ) {
128 return nullptr;
129 }
130 if( ! tpl[ i ].isValid() ) {
131 return nullptr;
132 }
133 return *( tpl[ i ] );
134 }
135
137
138 if( ( ! sv1TPAcc1.isAvailable( *this ) ) &&
139 ( ! sv1TPAcc2.isAvailable( *this ) ) ) {
140 return 0;
141 }
142 return SV1_TrackParticleLinks().size();
143 }
144
147
148 sv1TPAcc2( *this ).push_back( link );
149 return;
150 }
151
153
154 sv1TPAcc2( *this ).clear();
155 return;
156 }
157
158 //
160
162 //
163 // Implementation of the IP2D accessor functions
164 //
165
167 setIP2D_pb )
169 setIP2D_pu )
171 setIP2D_pc )
172
173 // The accessor object(s):
174 static const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t >
175 ip2dTPAcc1( "IP2D_TrackParticles" );
176 static const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t >
177 ip2dTPAcc2( "IP2D_TrackParticleLinks" );
178
180
181 if( ip2dTPAcc1.isAvailable( *this ) ) {
182 return ip2dTPAcc1( *this );
183 }
184 return ip2dTPAcc2( *this );
185 }
186
188
189 ip2dTPAcc2( *this ) = value;
190 return;
191 }
192
195
196 if( ( ! ip2dTPAcc1.isAvailable( *this ) ) &&
197 ( ! ip2dTPAcc2.isAvailable( *this ) ) ) {
198 return nullptr;
199 }
200 const TPELVec_t& tpl = IP2D_TrackParticleLinks();
201 if( tpl.size() <= i ) {
202 return nullptr;
203 }
204 if( ! tpl[ i ].isValid() ) {
205 return nullptr;
206 }
207 return *( tpl[ i ] );
208 }
209
211
212 if( ( ! ip2dTPAcc1.isAvailable( *this ) ) &&
213 ( ! ip2dTPAcc2.isAvailable( *this ) ) ) {
214 return 0;
215 }
216 return IP2D_TrackParticleLinks().size();
217 }
218
221
222 ip2dTPAcc2( *this ).push_back( link );
223 return;
224 }
225
227
228 ip2dTPAcc2( *this ).clear();
229 return;
230 }
231
232 //
234
236 //
237 // Implementation of the IP3D accessor functions
238 //
239
240 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP3D_pb, setIP3D_pb)
241 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP3D_pu, setIP3D_pu)
242 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP3D_pc, setIP3D_pc)
243
244 // The accessor object(s):
246 ip3dTPAcc1( "IP3D_TrackParticles" );
248 ip3dTPAcc2( "IP3D_TrackParticleLinks" );
249
251
252 if( ip3dTPAcc1.isAvailable( *this ) ) {
253 return ip3dTPAcc1( *this );
254 }
255 return ip3dTPAcc2( *this );
256 }
257
259
260 ip3dTPAcc2( *this ) = value;
261 return;
262 }
263
266
267 if( ( ! ip3dTPAcc1.isAvailable( *this ) ) &&
268 ( ! ip3dTPAcc2.isAvailable( *this ) ) ) {
269 return nullptr;
270 }
271 const TPELVec_t& tpl = IP3D_TrackParticleLinks();
272 if( tpl.size() <= i ) {
273 return nullptr;
274 }
275 if( ! tpl[ i ].isValid() ) {
276 return nullptr;
277 }
278 return *( tpl[ i ] );
279 }
280
282
283 if( ( ! ip3dTPAcc1.isAvailable( *this ) ) &&
284 ( ! ip3dTPAcc2.isAvailable( *this ) ) ) {
285 return 0;
286 }
287 return IP3D_TrackParticleLinks().size();
288 }
289
292
293 ip3dTPAcc2( *this ).push_back( link );
294 return;
295 }
296
298
299 ip3dTPAcc2( *this ).clear();
300 return;
301 }
302
303 //
305
307 //
308 // Implementation of the JetFitter accessor functions
309 //
310
311 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, JetFitter_pb, setJetFitter_pb)
312 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, JetFitter_pu, setJetFitter_pu)
313 AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, JetFitter_pc, setJetFitter_pc)
314
315
316 //
317 // Implementation of generic tagger weight accessor functions
318 // - returned value is the second argument
319 // - optional 3rd and 4th arguments for defining signal
320 // and background hypotheses (default: b and light)
321
323 double &value, // return value
324 const std::string& signal,
325 const std::string& bckgd ) const {
326 value = -1.; // default value if tagger is undefined
327 float pu = 1.;
328 float pb = 1.;
329 bool puvalid = variable<float>(taggername, bckgd , pu);
330 bool pbvalid = variable<float>(taggername, signal, pb);
331 if( !pbvalid || !puvalid ) return false;
332 if("IP3D"==taggername&&pb==1.&&pu==1.e9) {
333 value = 0.;
334 } else {
335 value = this->calcLLR(pb,pu);
336 }
337 return true;
338 }
339
340
341 float BTagging_v1::calcLLR(double numerator, double denominator) const {
342 float val = 0.;
343 if(numerator<=0.) {
344 val = -30.;
345 } else if(denominator<=0.) {
346 val = +100.;
347 } else {
348 val = log(numerator/denominator);
349 }
350 return val;
351 }
352
353 bool BTagging_v1::pu(const std::string& taggername, double &value) const {
354 float tmp = 0.;
355 bool output = variable<float>(taggername, "pu", tmp);
356 if ( output ) value = tmp;
357 return output;
358 }
359
360 bool BTagging_v1::pb(const std::string& taggername, double &value) const {
361 float tmp = 0.;
362 bool output = variable<float>(taggername, "pb", tmp);
363 if ( output ) value = tmp;
364 return output;
365 }
366
367 bool BTagging_v1::pc(const std::string& taggername, double &value) const {
368 float tmp = 0.;
369 bool output = variable<float>(taggername, "pc", tmp);
370 if ( output ) value = tmp;
371 return output;
372 }
373
374 bool BTagging_v1::ptau(const std::string& taggername, double &value) const {
375 float tmp = 0.;
376 bool output = variable<float>(taggername, "ptau", tmp);
377 if ( output ) value = tmp;
378 return output;
379 }
380
381 bool BTagging_v1::MVx_discriminant(const std::string& taggername, double &value) const {
382 float tmp = 0.;
383 bool output = variable<float>(taggername, "discriminant", tmp);
384 if ( output ) value = tmp;
385 return output;
386 }
387
388 //
390
391
393 setMV1_discriminant )
394
395
396
397 //
398 // Implementation of the generic tagger info accessor functions
399 //
400
401 bool BTagging_v1::taggerInfo( int& value, const BTagInfo info ) const {
402
403 const Accessor< int >* acc = taggerInfoAccessorV1int( info );
404 if( ! acc ) return false;
405 if( ! acc->isAvailable( *this ) ) return false;
406 value = ( *acc )( *this );
407 return true;
408 }
409
410 bool BTagging_v1::taggerInfo( float& value, const BTagInfo info) const {
411
412 const Accessor< float >* acc = taggerInfoAccessorV1float( info );
413 if( ! acc ) return false;
414 if( ! acc->isAvailable( *this ) ) return false;
415 value = ( *acc )( *this );
416 return true;
417 }
418
419 bool BTagging_v1::taggerInfo( bool& value, const BTagInfo info ) const {
420
422 if( ! acc ) return false;
423 if( ! acc->isAvailable( *this ) ) return false;
424 value = ( *acc )( *this );
425 return true;
426 }
427
428 bool BTagging_v1::taggerInfo( std::string& value,
429 const BTagInfo info ) const {
430
432 if( ! acc ) return false;
433 if( ! acc->isAvailable( *this ) ) return false;
434 value = ( *acc )( *this );
435 return true;
436 }
437
438 bool BTagging_v1::taggerInfo( std::vector<int>& value,
439 const BTagInfo info ) const {
440
442 if( ! acc ) return false;
443 if( ! acc->isAvailable( *this ) ) return false;
444 value = ( *acc )( *this );
445 return true;
446 }
447
448 bool BTagging_v1::taggerInfo( std::vector<float>& value,
449 const BTagInfo info ) const {
450
452 if( ! acc ) return false;
453 if( ! acc->isAvailable( *this ) ) return false;
454 value = ( *acc )( *this );
455 return true;
456 }
457
458 bool BTagging_v1::taggerInfo( std::vector<bool>& value,
459 const BTagInfo info ) const {
460
462 if( ! acc ) return false;
463 if( ! acc->isAvailable( *this ) ) return false;
464 value = ( *acc )( *this );
465 return true;
466 }
467
468 void BTagging_v1::setTaggerInfo( int value, const BTagInfo info ) {
469
471 if( ! acc ) return;
472 ( *acc )( *this ) = value;
473 return;
474 }
475
476 void BTagging_v1::setTaggerInfo( float value, const BTagInfo info ) {
477
479 if( ! acc ) return;
480 ( *acc )( *this ) = value;
481 return;
482 }
483
484 void BTagging_v1::setTaggerInfo( bool value, const BTagInfo info ) {
485
487 if( ! acc ) return;
488 ( *acc )( *this ) = uint8_t(value);
489 return;
490 }
491
492 void BTagging_v1::setTaggerInfo( const std::string& value,
493 const BTagInfo info ) {
494
496 if( ! acc ) return;
497 ( *acc )( *this ) = value;
498 return;
499 }
500
501 void BTagging_v1::setTaggerInfo( const std::vector<int>& value,
502 const BTagInfo info ) {
503
505 if( ! acc ) return;
506 ( *acc )( *this ) = value;
507 return;
508 }
509
510 void BTagging_v1::setTaggerInfo( const std::vector<float>& value,
511 const BTagInfo info ) {
512
514 if( ! acc ) return;
515 ( *acc )( *this ) = value;
516 return;
517 }
518
519 void BTagging_v1::setTaggerInfo( const std::vector<bool>& value,
520 const BTagInfo info ) {
521
523 if( ! acc ) return;
524 ( *acc )( *this ) = value;
525 return;
526 }
527
528 //
530
531
533 {
534 }
535
536
537 void BTagging_v1::setDynTPELName ( const std::string &/*taggername*/,
538 const std::string &/*variablename*/)
539 {
540 }
541
542 void BTagging_v1::setDynVxELName ( const std::string &/*taggername*/,
543 const std::string &/*variablename*/)
544 {
545 }
546
547
548 void BTagging_v1::setDynBTagVxELName ( const std::string &/*taggername*/,
549 const std::string &/*variablename*/)
550 {
551 }
552
553
554} // namespace xAOD
bool isValid(const T &p)
Av: we implement here an ATLAS-sepcific convention: all particles which are 99xxxxx are fine.
Definition AtlasPID.h:878
#define AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(CL, TYPE, NAME, SETTER)
Macro creating the accessors of primitive auxiliary properties.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573
void clearIP3D_TrackParticleLinks()
clear vector of IP3D TrackParticle ElementLinks
bool loglikelihoodratio(const std::string &taggername, double &value, const std::string &signal="pb", const std::string &bckgd="pu") const
bool pc(const std::string &taggername, double &value) const
bool pu(const std::string &taggername, double &value) const
bool pb(const std::string &taggername, double &value) const
const TPELVec_t & IP3D_TrackParticleLinks() const
get vector of IP3D TrackParticle ElementLinks
const xAOD::TrackParticle * SV0_TrackParticle(size_t i) const
Get one particular SV0 TrackParticle as a bare pointer.
void setDynBTagVxELName(const std::string &taggername, const std::string &variablename)
void setTaggerInfo(int value, BTagInfo info)
set taggers information (int)
const TPELVec_t & SV0_TrackParticleLinks() const
get vector of SV0 TrackParticle ElementLinks
void clearSV1_TrackParticleLinks()
clear vector of SV1 TrackParticle ElementLinks
void setDynVxELName(const std::string &taggername, const std::string &variablename)
size_t nSV0_TrackParticles() const
Get the number of SV0 TrackParticles associated with the object.
void setSV0_TrackParticleLinks(const TPELVec_t &value)
set vector of SV0 TrackParticle ElementLinks
size_t nIP2D_TrackParticles() const
Get the number of IP2D TrackParticles associated with the object.
const xAOD::TrackParticle * SV1_TrackParticle(size_t i) const
Get one particular SV1 TrackParticle as a bare pointer.
size_t nSV1_TrackParticles() const
Get the number of SV1 TrackParticles associated with the object.
void addIP3D_TrackParticle(const ElementLink< xAOD::TrackParticleContainer > &link)
add a TrackParticle ElementLink for IP3D
bool ptau(const std::string &taggername, double &value) const
float calcLLR(double num, double den) const
void addIP2D_TrackParticle(const ElementLink< xAOD::TrackParticleContainer > &link)
add a TrackParticle ElementLink for IP2D
const xAOD::TrackParticle * IP3D_TrackParticle(size_t i) const
Get one particular IP3D TrackParticle as a bare pointer.
void setSV1_TrackParticleLinks(const TPELVec_t &value)
set vector of SV1 TrackParticle ElementLinks
void clearIP2D_TrackParticleLinks()
clear vector of IP2D TrackParticle ElementLinks
void setDynTPELName(const std::string &taggername, const std::string &variablename)
const TPELVec_t & SV1_TrackParticleLinks() const
get vector of SV1 TrackParticle ElementLinks
const TPELVec_t & IP2D_TrackParticleLinks() const
get vector of IP2D TrackParticle ElementLinks
const xAOD::TrackParticle * IP2D_TrackParticle(size_t i) const
Get one particular IP2D TrackParticle as a bare pointer.
bool taggerInfo(int &value, BTagInfo info) const
get taggers information (int)
void setIP3D_TrackParticleLinks(const TPELVec_t &value)
set vector of IP3D TrackParticle ElementLinks
bool variable(const std::string &taggername, const std::string &variablename, T &value) const
get variables by string
void setIP2D_TrackParticleLinks(const TPELVec_t &value)
set vector of IP2D TrackParticle ElementLinks
BTagging_v1()
Default constructor.
std::vector< ElementLink< xAOD::TrackParticleContainer > > TPELVec_t
A helper typedef.
Definition BTagging_v1.h:45
void addSV0_TrackParticle(const ElementLink< xAOD::TrackParticleContainer > &link)
add a TrackParticle ElementLink for SV0
size_t nIP3D_TrackParticles() const
Get the number of IP3D TrackParticles associated with the object.
void addSV1_TrackParticle(const ElementLink< xAOD::TrackParticleContainer > &link)
add a TrackParticle ElementLink for SV1
bool MVx_discriminant(const std::string &taggername, double &value) const
void clearSV0_TrackParticleLinks()
clear vector of SV0 TrackParticle ElementLinks
Forward declaration.
STL namespace.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
const SG::AuxElement::Accessor< int > * taggerInfoAccessorV1int(BTagInfo info)
Helper function for managing BTagging Accessor objects.
const SG::AuxElement::Accessor< uint8_t > * taggerInfoAccessorV1uint8_t(BTagInfo info)
const SG::AuxElement::Accessor< float > * taggerInfoAccessorV1float(BTagInfo info)
static const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t > ip3dTPAcc2("IP3D_TrackParticleLinks")
static const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t > sv1TPAcc1("SV1_TrackParticles")
const SG::AuxElement::Accessor< std::vector< float > > * taggerInfoAccessorV1vectorOfFloats(BTagInfo info)
static const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t > ip3dTPAcc1("IP3D_TrackParticles")
TrackParticle_v1 TrackParticle
Reference the current persistent version:
static const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t > sv1TPAcc2("SV1_TrackParticleLinks")
AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pb, setIP2D_pb) AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1
static AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, SV0_significance3D, setSV0_significance3D) static const SG const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t > sv0TPAcc2("SV0_TrackParticleLinks")
setBGCode setTAP setLVL2ErrorBits bool
static const SG::AuxElement::Accessor< ElementLink< IParticleContainer > > acc("originalObjectLink")
Object used for setting/getting the dynamic decoration in question.
setIP2D_pu static AUXSTORE_PRIMITIVE_SETTER_AND_GETTER(BTagging_v1, float, IP2D_pc, setIP2D_pc) static const SG const SG::AuxElement::Accessor< BTagging_v1::TPELVec_t > ip2dTPAcc2("IP2D_TrackParticleLinks")
const SG::AuxElement::Accessor< std::vector< int > > * taggerInfoAccessorV1vectorOfInts(BTagInfo info)
const SG::AuxElement::Accessor< std::vector< bool > > * taggerInfoAccessorV1vectorOfBools(BTagInfo info)
const SG::AuxElement::Accessor< std::string > * taggerInfoAccessorV1string(BTagInfo info)