ATLAS Offline Software
EMClusterErrorsMatrix.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 
7 #include <iostream>
8 #include <utility>
9 
12 {
13 }
14 
15 
16 EMClusterErrorsMatrix::EMClusterErrorsMatrix(const std::vector<EMAPMatrixAxis> &axes,
17  const std::string& textDescription)
18  : EMAPMatrix<EMClusterErrorsEntry>(axes, textDescription)
19 {
20 }
21 
22 
23  // Acces Operators
24 StatusCode EMClusterErrorsMatrix::setError(const std::vector<double> &x, const EMClusterErrorsEntry& apEntry)
25 {
26  return setBinContent(x, apEntry);
27 }
28 
30 {
31  std::cout << "***** Printing EMClusterErrorsMatrix: " << getTextDescription() << " *******"<< std::endl;
32  std::cout << " Matrix has " << m_dimensions << " dimensions" << std::endl;
33  for(unsigned i = 0; i < m_dimensions; i++) {
34  std::cout << " Dim " << i << " is binning in " << m_axis.at(i).getName() << " with bin boundaries \n ";
35  std::vector<double> axisBinning = m_axis.at(i).getBinningInformation();
36  for (double j : axisBinning) {
37  std::cout << j << " ";
38  }
39  std::cout << std::endl;
40  }
41 
42  std::cout << " Mapping of extra dimensions in matrix (m_base): ";
43  for (unsigned int i : m_base) {
44  std::cout << i << " ";
45  }
46 
47  std::cout << "\n Matrix data:\n ";
48 
49  const unsigned int matrixSize = m_matrix.size();
50 
51  // push back the number of floats to store per matrix entry
52  const unsigned int vectSize = (matrixSize) ? m_matrix.at(0).size() : 0;
53 
54  //std::cerr << "matrixSize = " << matrixSize << ", vectSize = " << vectSize << std::endl;
55 
56  for (unsigned int i=0; i<matrixSize; i++) {
57  const EMClusterErrorsEntry vect = m_matrix.at(i);
58  if (vect.size() != vectSize) {
59  std::cerr << "The input EMClusterErrorsMatrix 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.
60  return;
61  }
62  for (unsigned int j=0; j<vectSize; j++) {
63  std::cout << vect.at(j) << " ";
64  }
65  std::cout << "\n ";
66  }
67  std::cout << std::endl;
68 }
69 
EMAPMatrix< EMClusterErrorsEntry >::setBinContent
StatusCode setBinContent(double x, EMClusterErrorsEntry value)
Set Bin-content to "T" in bin which corresponds to value "x".
EMAPMatrix< EMClusterErrorsEntry >::m_axis
std::vector< EMAPMatrixAxis > m_axis
Definition: EMAPMatrix.h:193
EMClusterErrorsMatrix::EMClusterErrorsMatrix
EMClusterErrorsMatrix()
Defaul constructor.
Definition: EMClusterErrorsMatrix.cxx:10
EMAPMatrix< EMClusterErrorsEntry >::getTextDescription
const std::string & getTextDescription() const
The user can add a Description of what this matrix contains and how it was produced,...
x
#define x
EMAPMatrix< EMClusterErrorsEntry >::m_dimensions
unsigned int m_dimensions
Definition: EMAPMatrix.h:191
EMAPMatrix< EMClusterErrorsEntry >::m_base
std::vector< unsigned int > m_base
representation of the content of matrix
Definition: EMAPMatrix.h:196
EMClusterErrorsMatrix::printMatrix
void printMatrix() const
Definition: EMClusterErrorsMatrix.cxx:29
EMAPMatrix
Definition: EMAPMatrix.h:72
EMClusterErrorsEntry
std::vector< float > EMClusterErrorsEntry
Definition: EMClusterErrorsMatrix.h:23
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
EMAPMatrix< EMClusterErrorsEntry >::m_matrix
std::vector< EMClusterErrorsEntry > m_matrix
Definition: EMAPMatrix.h:195
EMClusterErrorsMatrix.h
EMClusterErrorsMatrix::setError
StatusCode setError(const std::vector< double > &x, const EMClusterErrorsEntry &apEntry)
Sets bin-content to "apEntry" in bin which corresponds to value std::vector x.
Definition: EMClusterErrorsMatrix.cxx:24