ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
StorePIDinfo Class Reference

#include <StorePIDinfo.h>

Collaboration diagram for StorePIDinfo:

Public Member Functions

 StorePIDinfo ()=default
 
 StorePIDinfo (const StorePIDinfo &)=default
 
 StorePIDinfo (StorePIDinfo &&)=default
 
StorePIDinfooperator= (const StorePIDinfo &)=default
 
StorePIDinfooperator= (StorePIDinfo &&)=default
 
 ~StorePIDinfo ()=default
 
 StorePIDinfo (int nbins, float min, float max, const std::vector< float > &values)
 
void update (int nbins, float min, float max, const std::vector< float > &values)
 
void push_back (float value)
 
StatusCode check (int gas, int detpart) const
 
float GetValue (float input) const
 
float GetBinValue (int bin) const
 
int GetBin (float input) const
 

Private Attributes

unsigned int m_nbins = 0
 
float m_min = -9999.9
 
float m_max = 10000000 * 2
 
std::vector< float > m_values
 

Detailed Description

Definition at line 13 of file StorePIDinfo.h.

Constructor & Destructor Documentation

◆ StorePIDinfo() [1/4]

StorePIDinfo::StorePIDinfo ( )
default

◆ StorePIDinfo() [2/4]

StorePIDinfo::StorePIDinfo ( const StorePIDinfo )
default

◆ StorePIDinfo() [3/4]

StorePIDinfo::StorePIDinfo ( StorePIDinfo &&  )
default

◆ ~StorePIDinfo()

StorePIDinfo::~StorePIDinfo ( )
default

◆ StorePIDinfo() [4/4]

StorePIDinfo::StorePIDinfo ( int  nbins,
float  min,
float  max,
const std::vector< float > &  values 
)

Definition at line 11 of file StorePIDinfo.cxx.

11  {
12  update (nbins, min, max, values);
13 }

Member Function Documentation

◆ check()

StatusCode StorePIDinfo::check ( int  gas,
int  detpart 
) const

Definition at line 44 of file StorePIDinfo.cxx.

44  {
45  MsgStream log(Athena::getMessageSvc(),"StorePIDinfo");
46  if ( m_nbins == 0)
47  {
48 
49  log << MSG::ERROR << " StorePIDinfo: No bins in the DB!! Gas: " << gas << " detpart " << detpart << endmsg;
50  return StatusCode::FAILURE;
51  }
52  else if ( m_nbins != m_values.size() )
53  {
54  log << MSG::ERROR << " Different number of PID numbers!!!!! " << endmsg;
55  return StatusCode::FAILURE;
56  }
57  else if ( (m_max < m_min) || (m_max == m_min) )
58  {
59  log << MSG::ERROR << " Max is smaller or equal than min!!!" << endmsg;
60  return StatusCode::FAILURE;
61  }
62  return StatusCode::SUCCESS;
63 }

◆ GetBin()

int StorePIDinfo::GetBin ( float  input) const

Definition at line 65 of file StorePIDinfo.cxx.

66 {
67  if (input < m_min){
68  return 0;
69  }
70  else if (input >= m_max){
71  return m_nbins - 1;
72  }
73  float dr = (m_max - m_min) / m_nbins;
74  unsigned int bin = int((input - m_min) / dr);
75  return bin;
76 }

◆ GetBinValue()

float StorePIDinfo::GetBinValue ( int  bin) const
inline

Definition at line 28 of file StorePIDinfo.h.

28 { return m_values.at(bin); }

◆ GetValue()

float StorePIDinfo::GetValue ( float  input) const
inline

Definition at line 27 of file StorePIDinfo.h.

27 { return m_values.at(GetBin(input)); }

◆ operator=() [1/2]

StorePIDinfo& StorePIDinfo::operator= ( const StorePIDinfo )
default

◆ operator=() [2/2]

StorePIDinfo& StorePIDinfo::operator= ( StorePIDinfo &&  )
default

◆ push_back()

void StorePIDinfo::push_back ( float  value)

Definition at line 31 of file StorePIDinfo.cxx.

31  {
32  // Just to read the DB
33  if (m_nbins==0) {
34  m_nbins = int(value) ;
35  m_min = -9999.9 ;
36  m_max = 10000000*2 ;
37  m_values.clear() ;
38  }
39  else if (m_min < -9999) m_min = value ;
40  else if (m_max > 10000000) m_max = value ;
41  else m_values.push_back(value);
42 }

◆ update()

void StorePIDinfo::update ( int  nbins,
float  min,
float  max,
const std::vector< float > &  values 
)

Definition at line 16 of file StorePIDinfo.cxx.

16  {
17  m_nbins = nbins ;
18  m_min = min ;
19  m_max = max ;
20  if (values.size()!=m_nbins){
21  MsgStream log(Athena::getMessageSvc(),"StorePIDinfo");
22  log << MSG::ERROR << " Different Values of n_bins and vector size!!!" << endmsg;
23  }
24  m_values.clear();
25  for (float value : values){
26  m_values.push_back( value);
27  }
28 }

Member Data Documentation

◆ m_max

float StorePIDinfo::m_max = 10000000 * 2
private

Definition at line 34 of file StorePIDinfo.h.

◆ m_min

float StorePIDinfo::m_min = -9999.9
private

Definition at line 33 of file StorePIDinfo.h.

◆ m_nbins

unsigned int StorePIDinfo::m_nbins = 0
private

Definition at line 32 of file StorePIDinfo.h.

◆ m_values

std::vector<float> StorePIDinfo::m_values
private

Definition at line 35 of file StorePIDinfo.h.


The documentation for this class was generated from the following files:
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
bin
Definition: BinsDiffFromStripMedian.h:43
athena.value
value
Definition: athena.py:124
python.TurnDataReader.dr
dr
Definition: TurnDataReader.py:112
StorePIDinfo::GetBin
int GetBin(float input) const
Definition: StorePIDinfo.cxx:65
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition: getMessageSvc.cxx:20
python.Bindings.values
values
Definition: Control/AthenaPython/python/Bindings.py:805
StorePIDinfo::m_min
float m_min
Definition: StorePIDinfo.h:33
StorePIDinfo::m_nbins
unsigned int m_nbins
Definition: StorePIDinfo.h:32
StorePIDinfo::update
void update(int nbins, float min, float max, const std::vector< float > &values)
Definition: StorePIDinfo.cxx:16
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
StorePIDinfo::m_max
float m_max
Definition: StorePIDinfo.h:34
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
StorePIDinfo::m_values
std::vector< float > m_values
Definition: StorePIDinfo.h:35