ATLAS Offline Software
Loading...
Searching...
No Matches
egPID Class Reference

Class to hold PID vars egamma information. More...

#include <egPID.h>

Collaboration diagram for egPID:

Public Member Functions

 egPID ()=default
 Default constructor.
 ~egPID ()=default
 Destructor.
 egPID (const egPID &original)=default
 constructor
egPIDoperator= (const egPID &original)
 Assignment.
unsigned int isEM (const unsigned int mask=egammaPIDObs::ALL, egammaPIDObs::PID=egammaPIDObs::IsEM, bool *found=nullptr) const
 Metod to define isEM variable.
unsigned int isEMsofte (const unsigned int mask=egammaPIDObs::ALL, bool *found=nullptr) const
 Method to define isEMse variable.
unsigned int IsGoodOQ (const unsigned int mask=egammaPIDObs::ALLOQ, bool *found=nullptr) const
 Method to define Object quality variable.
double egammaID (egammaPIDObs::PID, bool *found=nullptr) const
 retrieve egamma ID, as double to work for IsEM and all possible weights as likelihood; found, if not NULL, is set to true if found
bool set_egammaID (egammaPIDObs::PID, double)
 set egamma ID, as double to work double values and all possible weights as likelihood
bool set_egammaIDint (egammaPIDObs::PID, unsigned int)
 set egamma ID, for unsigned int values

Private Member Functions

unsigned int egammaIDint (egammaPIDObs::PID, bool *found) const
 retrieve unsinged int value

Private Attributes

std::vector< std::pair< egammaPIDObs::PID, unsigned int > > m_egammaIDint
std::vector< std::pair< egammaPIDObs::PID, double > > m_egammaID

Detailed Description

Class to hold PID vars egamma information.

Author
K. Cranmer, S. Rajagopalan, D. Rousseau, D. Zerwas

Definition at line 30 of file egPID.h.

Constructor & Destructor Documentation

◆ egPID() [1/2]

egPID::egPID ( )
default

Default constructor.

◆ ~egPID()

egPID::~egPID ( )
default

Destructor.

◆ egPID() [2/2]

egPID::egPID ( const egPID & original)
default

constructor

Member Function Documentation

◆ egammaID()

double egPID::egammaID ( egammaPIDObs::PID key,
bool * found = nullptr ) const

retrieve egamma ID, as double to work for IsEM and all possible weights as likelihood; found, if not NULL, is set to true if found

Definition at line 39 of file egPID.cxx.

40{
41 //
42 // interface method to retrieve value of pid IsEM or weight
43 //
44
45 // retrieve key for cut-based identification for non-isolated objects
46 switch(key) {
47
54 return (double)egammaIDint(key, found);
55 default:
56 using elParams = std::pair<egammaPIDObs::PID, double>;
57
58 std::vector<elParams>::const_iterator p = m_egammaID.begin();
59
60 for (;p !=m_egammaID.end(); ++p) {
61 if ( (*p).first == key ){
62 if (found != nullptr) {
63 *found = true;
64 }
65 return (*p).second;
66 break;
67 }
68 }
69
70 if (found != nullptr) {
71 *found = false;
72 }
74 }
75}
unsigned int egammaIDint(egammaPIDObs::PID, bool *found) const
retrieve unsinged int value
Definition egPID.cxx:172
std::vector< std::pair< egammaPIDObs::PID, double > > m_egammaID
Definition egPID.h:67
const unsigned int EgPidUndefined
@ IsEMLoose
cut-based identification for egamma objects (Loose)
@ IsEMTight
cut-based identification for egamma objects (Tight)
@ IsEMMedium
cut-based identification for egamma objects (Medium)
@ IsGoodOQ
Object Quality variable.
@ SofteIsEM
cut-based identification for softe electrons in jets (for btag)
@ IsEM
cut-based identification for egamma objects (cluster and track-based)

◆ egammaIDint()

unsigned int egPID::egammaIDint ( egammaPIDObs::PID key,
bool * found ) const
private

retrieve unsinged int value

Definition at line 172 of file egPID.cxx.

173{
174 //
175 // method to retrieve value
176 //
177
178 using elParams = std::pair<egammaPIDObs::PID, unsigned int>;
179
180 std::vector<elParams>::const_iterator p = m_egammaIDint.begin();
181
182 for (;p !=m_egammaIDint.end(); ++p) {
183 if ( (*p).first == key ){
184 if (found != nullptr) {
185 *found = true;
186 }
187 return (*p).second;
188 }
189 }
190
191 if (found != nullptr) {
192 *found = false;
193 }
195}
std::vector< std::pair< egammaPIDObs::PID, unsigned int > > m_egammaIDint
Definition egPID.h:65

◆ isEM()

unsigned int egPID::isEM ( const unsigned int mask = egammaPIDObs::ALL,
egammaPIDObs::PID pid = egammaPIDObs::IsEM,
bool * found = nullptr ) const

Metod to define isEM variable.

Definition at line 139 of file egPID.cxx.

142{
143 //
144 // apply mask to the IsEM value
145 //
146
147 return (egammaIDint(pid, found) & mask);
148}

◆ isEMsofte()

unsigned int egPID::isEMsofte ( const unsigned int mask = egammaPIDObs::ALL,
bool * found = nullptr ) const

Method to define isEMse variable.

Definition at line 151 of file egPID.cxx.

152{
153 //
154 // apply mask to the SofteIsEM value
155 //
156
157 return (egammaIDint(egammaPIDObs::SofteIsEM, found) & mask);
158}

◆ IsGoodOQ()

unsigned int egPID::IsGoodOQ ( const unsigned int mask = egammaPIDObs::ALLOQ,
bool * found = nullptr ) const

Method to define Object quality variable.

Definition at line 161 of file egPID.cxx.

162{
163 //
164 // apply mask to the IsGoodOQ value
165 //
166
167 return (egammaIDint(egammaPIDObs::IsGoodOQ, found) & mask);
168}

◆ operator=()

egPID & egPID::operator= ( const egPID & original)

Assignment.

Definition at line 27 of file egPID.cxx.

28{
29 if (this != &original) {
30 // value as unsigned integer
32 // value as double
33 m_egammaID = original.m_egammaID;
34 }
35 return *this;
36}

◆ set_egammaID()

bool egPID::set_egammaID ( egammaPIDObs::PID key,
double value )

set egamma ID, as double to work double values and all possible weights as likelihood

Definition at line 78 of file egPID.cxx.

79{
80 //
81 // set value of PID for IsEM or weight
82 //
83 switch(key) {
90 // Need to convert to an int first, then to unsigned int.
91 // Converting directly from a negative float to an unsigned is undefined.
92 return set_egammaIDint( key, static_cast<long int>(value));
93 default:
94 using elParams = std::pair<egammaPIDObs::PID, double>;
95
96 std::vector<elParams>::iterator p = m_egammaID.begin();
97
98 for (;p !=m_egammaID.end(); ++p) {
99 if ( (*p).first == key ) break;
100 }
101
102 if ( p == m_egammaID.end() ) {
103 m_egammaID.emplace_back(key,value );
104 }
105 else {
106 (*p).second = value;
107 }
108
109 return true;
110 }
111}
bool set_egammaIDint(egammaPIDObs::PID, unsigned int)
set egamma ID, for unsigned int values
Definition egPID.cxx:114

◆ set_egammaIDint()

bool egPID::set_egammaIDint ( egammaPIDObs::PID key,
unsigned int value )

set egamma ID, for unsigned int values

Definition at line 114 of file egPID.cxx.

115{
116 //
117 // method to set value
118 //
119
120 using elParams = std::pair<egammaPIDObs::PID, unsigned int>;
121
122 std::vector<elParams>::iterator p = m_egammaIDint.begin();
123
124 for (;p !=m_egammaIDint.end(); ++p) {
125 if ( (*p).first == key ) break;
126 }
127
128 if ( p == m_egammaIDint.end() ) {
129 m_egammaIDint.emplace_back(key,value );
130 }
131 else {
132 (*p).second = value;
133 }
134 return true;
135}

Member Data Documentation

◆ m_egammaID

std::vector< std::pair<egammaPIDObs::PID,double> > egPID::m_egammaID
private

Definition at line 67 of file egPID.h.

◆ m_egammaIDint

std::vector< std::pair<egammaPIDObs::PID, unsigned int> > egPID::m_egammaIDint
private

Definition at line 65 of file egPID.h.


The documentation for this class was generated from the following files: