ATLAS Offline Software
Public Member Functions | Protected Attributes | List of all members
EMInsituDatabaseEntry Class Reference

#include <EMInsituDatabaseEntry.h>

Collaboration diagram for EMInsituDatabaseEntry:

Public Member Functions

 EMInsituDatabaseEntry ()
 Default Constructor. More...
 
 EMInsituDatabaseEntry (const std::string &dbaseID)
 Constructor Defining DatabaseID. More...
 
 ~EMInsituDatabaseEntry ()=default
 Default Destructor. More...
 
 EMInsituDatabaseEntry (const EMInsituDatabaseEntry &ob)=default
 Copy Constructor. More...
 
EMInsituDatabaseEntryoperator= (const EMInsituDatabaseEntry &ob)=default
 = operator More...
 
bool setMatrix (const EMClusterErrorsMatrix &apClusterErrorsMatrix)
 Fill this APEMClusterErrorsEntry from given APEMClusterErrorsMatrix. More...
 
bool getMatrix (EMClusterErrorsMatrix &apClusterErrorsMatrix) const
 Fill APEfficiencyMatrix from this APEMClusterErrorsEntry object. More...
 
void setDatabaseID (std::string dbaseID)
 Setting DatabaseID. More...
 
const std::string & getDatabaseID () const
 Getting DatabaseID. More...
 
int whichTypeAmI ()
 
void getBasicInformation (std::string &dbaseID, unsigned int &nSize_Strings, unsigned int &nSize_FloatInfo, unsigned int &nSize_IntInfo)
 
void clear ()
 clear all information More...
 
EMInsituDatabaseEntryclone () const
 
void debugPrint () const
 

Protected Attributes

std::string m_DatabaseID
 
std::vector< std::string > m_vecString
 
std::vector< Float_t > m_vecFloat_Data
 
std::vector< Int_t > m_vecInt_Data
 
std::vector< Float_t > m_vecFloat_Info
 
std::vector< Int_t > m_vecInt_Info
 

Detailed Description

The EMInsituDatabaseEntry is a class which holds the information of EMClusterErrrorsMatrixes before writing them to the database or after reading them from the database.It is based on APInsituDatabas in InsituPerformance, by Matthias Schott.

Author
Jovan Mitrevski (this version), Matthias Schott (original)

Definition at line 33 of file EMInsituDatabaseEntry.h.

Constructor & Destructor Documentation

◆ EMInsituDatabaseEntry() [1/3]

EMInsituDatabaseEntry::EMInsituDatabaseEntry ( )

Default Constructor.

Definition at line 13 of file EMInsituDatabaseEntry.cxx.

14 {
15  clear();
16 }

◆ EMInsituDatabaseEntry() [2/3]

EMInsituDatabaseEntry::EMInsituDatabaseEntry ( const std::string &  dbaseID)

Constructor Defining DatabaseID.

Definition at line 20 of file EMInsituDatabaseEntry.cxx.

21 {
22  clear();
23  setDatabaseID(dbaseID);
24 }

◆ ~EMInsituDatabaseEntry()

EMInsituDatabaseEntry::~EMInsituDatabaseEntry ( )
default

Default Destructor.

◆ EMInsituDatabaseEntry() [3/3]

EMInsituDatabaseEntry::EMInsituDatabaseEntry ( const EMInsituDatabaseEntry ob)
default

Copy Constructor.

Member Function Documentation

◆ clear()

void EMInsituDatabaseEntry::clear ( )

clear all information

Definition at line 157 of file EMInsituDatabaseEntry.cxx.

158 {
159 // m_ID = -1;
160  m_DatabaseID = "EMDatabaseEntry";
161  m_vecString.clear();
162  m_vecFloat_Data.clear();
163  m_vecInt_Data.clear();
164  m_vecFloat_Info.clear();
165  m_vecInt_Info.clear();
166 }

◆ clone()

EMInsituDatabaseEntry * EMInsituDatabaseEntry::clone ( ) const

Definition at line 168 of file EMInsituDatabaseEntry.cxx.

169 {
170  return new EMInsituDatabaseEntry(*this);
171 }

◆ debugPrint()

void EMInsituDatabaseEntry::debugPrint ( ) const

Definition at line 181 of file EMInsituDatabaseEntry.cxx.

182 {
183  std::cout << "*********** Dumping contents of EMInsituDatabaseEntry **********" << std::endl;
184  std::cout << " Database ID: " << m_DatabaseID << std::endl;
185 
186  std::cout << " vecString of size " << m_vecString.size() << ":\n ";
187  for (unsigned int i = 0; i < m_vecString.size(); i++) {
188  if (i!= 0) std::cout << ", ";
189  std::cout << m_vecString.at(i);
190  }
191  std::cout << std::endl;
192 
193  std::cout << " vecFloat_Data of size " << m_vecFloat_Data.size() << ":\n ";
194  for (unsigned int i = 0; i < m_vecFloat_Data.size(); i++) {
195  if (i!= 0) std::cout << ", ";
196  std::cout << m_vecFloat_Data.at(i);
197  }
198  std::cout << std::endl;
199 
200  std::cout << " vecInt_Data of size " << m_vecInt_Data.size() << ":\n ";
201  for (unsigned int i = 0; i < m_vecInt_Data.size(); i++) {
202  if (i!= 0) std::cout << ", ";
203  std::cout << m_vecInt_Data.at(i);
204  }
205  std::cout << std::endl;
206 
207  std::cout << " vecFloat_Info of size " << m_vecFloat_Info.size() << ":\n ";
208  for (unsigned int i = 0; i < m_vecFloat_Info.size(); i++) {
209  if (i!= 0) std::cout << ", ";
210  std::cout << m_vecFloat_Info.at(i);
211  }
212  std::cout << std::endl;
213 
214  std::cout << " vecInt_Info of size " << m_vecInt_Info.size() << ":\n ";
215  for (unsigned int i = 0; i < m_vecInt_Info.size(); i++) {
216  if (i!= 0) std::cout << ", ";
217  std::cout << m_vecInt_Info.at(i);
218  }
219  std::cout << std::endl;
220 }

◆ getBasicInformation()

void EMInsituDatabaseEntry::getBasicInformation ( std::string &  dbaseID,
unsigned int &  nSize_Strings,
unsigned int &  nSize_FloatInfo,
unsigned int &  nSize_IntInfo 
)

Definition at line 173 of file EMInsituDatabaseEntry.cxx.

174 {
175  dbaseID = m_DatabaseID;
176  nSize_Strings = m_vecString.size();
177  nSize_FloatInfo = m_vecFloat_Info.size();
178  nSize_IntInfo = m_vecInt_Info.size();
179 }

◆ getDatabaseID()

const std::string & EMInsituDatabaseEntry::getDatabaseID ( ) const

Getting DatabaseID.

Definition at line 150 of file EMInsituDatabaseEntry.cxx.

151 {
152  return m_DatabaseID;
153 }

◆ getMatrix()

bool EMInsituDatabaseEntry::getMatrix ( EMClusterErrorsMatrix apClusterErrorsMatrix) const

Fill APEfficiencyMatrix from this APEMClusterErrorsEntry object.

Fill EMClusterErrors from this EMClusterErrorsDatabaseEntry object.

Definition at line 73 of file EMInsituDatabaseEntry.cxx.

74 {
75  apClusterErrorsMatrix.clear();
76 
77  if (m_vecInt_Info.size()<3) {
78  return false;
79  }
80  // Reading and testing ID of entry
82  return false;
83  }
84  // m_ID =m_vecInt_Info.at(0);
85  // Reading Tag of entry
86  int nTag=m_vecInt_Info.at(1);
87  if (nTag==-1) {
88  return false;
89  }
90 
91  apClusterErrorsMatrix.m_dimensions = m_vecInt_Info.at(2);
92 
93  // m_vecInt_info(3) is next, so store the index:
94  unsigned int m=3;
95 
96  // m_vecFloat_Info(0) is next, so store the index
97  unsigned int n=0;
98 
99  // m_vecString(0) is next, so store the index;
100  unsigned int s=0;
101 
102  // std::vector<APMatrixAxis> axes;
103  std::vector<double> axisBinning;
104  unsigned int ib=1;
105  for (unsigned int i=0; i<apClusterErrorsMatrix.m_dimensions; i++) {
106  axisBinning.clear();
107  for (int j=0; j<m_vecInt_Info.at(m); j++) {
108  axisBinning.push_back(m_vecFloat_Info.at(n++));
109  }
110  apClusterErrorsMatrix.m_axis.emplace_back(m_vecString.at(s++),axisBinning);
111  apClusterErrorsMatrix.m_base.push_back(ib);
112  ib+=m_vecInt_Info.at(m++);
113  }
114 
115  // for (unsigned int i=0; i<apClusterErrorsMatrix.m_dimensions; i++) {
116  // m_axis.push_back(axes.at(i));
117  // }
118 
119  const int matrixSize = m_vecInt_Info.at(m++);
120  const int vectSize = m_vecInt_Info.at(m);
121 
122  //std::cerr << "matrixSize = " << matrixSize << ", vectSize = " << vectSize << std::endl;
123 
124  // the data index;
125  unsigned int di=0;
126 
127  // std::cerr << "matrix size before is " << apClusterErrorsMatrix.m_matrix.size() << std::endl;
128  for (int i=0; i< matrixSize; i++) {
130  for (int j= 0; j < vectSize; j++) {
131  //std::cerr << "reading value: " << m_vecFloat_Data.at(di) << std::endl;
132  entry.push_back(m_vecFloat_Data.at(di++));
133  }
134  apClusterErrorsMatrix.m_matrix.push_back(entry);
135  }
136  // std::cerr << "matrix size is " << apClusterErrorsMatrix.m_matrix.size() << std::endl;
137  apClusterErrorsMatrix.setTextDescription(m_vecString.at(s));
138  return true;
139 }

◆ operator=()

EMInsituDatabaseEntry& EMInsituDatabaseEntry::operator= ( const EMInsituDatabaseEntry ob)
default

= operator

◆ setDatabaseID()

void EMInsituDatabaseEntry::setDatabaseID ( std::string  dbaseID)

Setting DatabaseID.

Definition at line 143 of file EMInsituDatabaseEntry.cxx.

144 {
145  m_DatabaseID = std::move(dbaseID);
146 }

◆ setMatrix()

bool EMInsituDatabaseEntry::setMatrix ( const EMClusterErrorsMatrix apClusterErrorsMatrix)

Fill this APEMClusterErrorsEntry from given APEMClusterErrorsMatrix.

Fill this EMInsituDatabaseEntry from given APEfficiencyMatrix.

Definition at line 27 of file EMInsituDatabaseEntry.cxx.

28 {
29  //std::cerr << "setMatrix called"<< std::endl;
30  if (apClusterErrorsMatrix.m_matrix.empty()) {
31  return false;
32  }
33  clear();
34  // Writing ID of EfficiencyMatrix
36 // m_ID = EMInsituDatabase_EMClusterErrorsMatrixID;
37  // Writing Special Tag of EMClusterErrors
38  m_vecInt_Info.push_back(0); // is this like the version number or something?
39  // Writing Information of EMClusterErrors
40  m_vecInt_Info.push_back((int)apClusterErrorsMatrix.m_dimensions);
41  for(unsigned i=0; i<apClusterErrorsMatrix.m_dimensions; i++) {
42  std::vector<double> axisBinning = apClusterErrorsMatrix.m_axis.at(i).getBinningInformation();
43  m_vecInt_Info.push_back((int)axisBinning.size());
44  m_vecString.push_back(apClusterErrorsMatrix.m_axis.at(i).getName());
45  for (double j : axisBinning) {
46  m_vecFloat_Info.push_back(j);
47  }
48  }
49 
50  const int matrixSize = (int)apClusterErrorsMatrix.m_matrix.size();
51  m_vecInt_Info.push_back(matrixSize);
52 
53  // push back the number of floats to store per matrix entry
54  const int vectSize = (matrixSize) ? apClusterErrorsMatrix.m_matrix.at(0).size() : 0;
55  m_vecInt_Info.push_back(vectSize);
56 
57  for (int i=0; i<matrixSize; i++) {
58  const EMClusterErrorsEntry vect = apClusterErrorsMatrix.m_matrix.at(i);
59  if ((int)vect.size() != vectSize) {
60  std::cerr << "The input APEMClusterErrorsMatrix doesn't have entries with all having the same number of floats" << std::endl; // shoudl this go to a message stream instead? The macros didn't work.
61  clear();
62  return false;
63  }
64  for (int j=0; j<vectSize; j++) {
65  m_vecFloat_Data.push_back(vect.at(j));
66  }
67  }
68  m_vecString.push_back(apClusterErrorsMatrix.getTextDescription());
69  return true;
70 }

◆ whichTypeAmI()

int EMInsituDatabaseEntry::whichTypeAmI ( )
inline

Definition at line 60 of file EMInsituDatabaseEntry.h.

61  {
62  if (!m_vecInt_Info.empty()) return m_vecInt_Info[0];
63  return -1;
64  }

Member Data Documentation

◆ m_DatabaseID

std::string EMInsituDatabaseEntry::m_DatabaseID
protected

Definition at line 79 of file EMInsituDatabaseEntry.h.

◆ m_vecFloat_Data

std::vector<Float_t> EMInsituDatabaseEntry::m_vecFloat_Data
protected

Definition at line 81 of file EMInsituDatabaseEntry.h.

◆ m_vecFloat_Info

std::vector<Float_t> EMInsituDatabaseEntry::m_vecFloat_Info
protected

Definition at line 83 of file EMInsituDatabaseEntry.h.

◆ m_vecInt_Data

std::vector<Int_t> EMInsituDatabaseEntry::m_vecInt_Data
protected

Definition at line 82 of file EMInsituDatabaseEntry.h.

◆ m_vecInt_Info

std::vector<Int_t> EMInsituDatabaseEntry::m_vecInt_Info
protected

Definition at line 84 of file EMInsituDatabaseEntry.h.

◆ m_vecString

std::vector<std::string> EMInsituDatabaseEntry::m_vecString
protected

Definition at line 80 of file EMInsituDatabaseEntry.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
EMAPMatrix::m_axis
std::vector< EMAPMatrixAxis > m_axis
Definition: EMAPMatrix.h:193
EMInsituDatabaseEntry::m_vecInt_Info
std::vector< Int_t > m_vecInt_Info
Definition: EMInsituDatabaseEntry.h:84
EMInsituDatabaseEntry::EMInsituDatabaseEntry
EMInsituDatabaseEntry()
Default Constructor.
Definition: EMInsituDatabaseEntry.cxx:13
EMInsituDatabaseEntry::m_vecFloat_Data
std::vector< Float_t > m_vecFloat_Data
Definition: EMInsituDatabaseEntry.h:81
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
EMAPMatrix::getTextDescription
const std::string & getTextDescription() const
The user can add a Description of what this matrix contains and how it was produced,...
PlotCalibFromCool.ib
ib
Definition: PlotCalibFromCool.py:419
EMInsituDatabaseEntry::m_vecInt_Data
std::vector< Int_t > m_vecInt_Data
Definition: EMInsituDatabaseEntry.h:82
EMInsituDatabaseEntry::clear
void clear()
clear all information
Definition: EMInsituDatabaseEntry.cxx:157
EMAPMatrix::m_dimensions
unsigned int m_dimensions
Definition: EMAPMatrix.h:191
EMAPMatrix::m_base
std::vector< unsigned int > m_base
representation of the content of matrix
Definition: EMAPMatrix.h:196
EMClusterErrorsEntry
std::vector< float > EMClusterErrorsEntry
Definition: EMClusterErrorsMatrix.h:23
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
EMAPMatrix::setTextDescription
void setTextDescription(const std::string &text)
The user can add a Description of what this matrix contains and how it was produced,...
EMInsituDatabaseEntry::m_vecFloat_Info
std::vector< Float_t > m_vecFloat_Info
Definition: EMInsituDatabaseEntry.h:83
EMInsituDatabaseEntry::m_DatabaseID
std::string m_DatabaseID
Definition: EMInsituDatabaseEntry.h:79
GetAllXsec.entry
list entry
Definition: GetAllXsec.py:132
EMInsituDatabaseEntry::m_vecString
std::vector< std::string > m_vecString
Definition: EMInsituDatabaseEntry.h:80
EMAPMatrix::m_matrix
std::vector< T > m_matrix
Definition: EMAPMatrix.h:195
EMAPMatrix::clear
void clear()
Clear all Matrix information (Also binning,...)
EMInsituDatabase_EMClusterErrorsMatrixID
#define EMInsituDatabase_EMClusterErrorsMatrixID
Definition: EMInsituDatabaseEntry.h:27
multiIoVMCRecoTag.nTag
nTag
Definition: multiIoVMCRecoTag.py:70
EMInsituDatabaseEntry::setDatabaseID
void setDatabaseID(std::string dbaseID)
Setting DatabaseID.
Definition: EMInsituDatabaseEntry.cxx:143