ATLAS Offline Software
CaloLocalHadCoeff.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef CALOCONDITIONS_CALOLOCALHADCOEFF_H
6 #define CALOCONDITIONS_CALOLOCALHADCOEFF_H
7 
36 #include "AthenaKernel/CLASS_DEF.h"
37 #include <vector>
38 #include <string>
39 #include <fstream>
40 
42  public:
43 
48  public:
52  LocalHadDimension() : m_type(0), m_nbins(0), m_xmin(0.0), m_xmax(0.0), m_dx(0.0) {};
53 
61  LocalHadDimension(const char *title, unsigned int typ, int nbins, float xmin, float xmax) :
63  {
64  m_xbins.resize(0);
65  m_dx = (m_xmax-m_xmin)/float(m_nbins);
66  }
67 
74  LocalHadDimension(const char *title, unsigned int typ, std::vector<float > &xbins) :
75  m_title(title), m_type(typ),
76  m_nbins (xbins.size() - 1),
77  m_xmin (xbins.front()),
78  m_xmax (xbins.back()),
79  m_dx(0.0),
80  m_xbins (xbins)
81  {
82  }
92  LocalHadDimension& operator= ( LocalHadDimension &&) noexcept = default;
93  // access methods
94 
96  inline unsigned int getType() const {return m_type;}
97 
99  inline int getNbins() const {return m_nbins;}
100 
102  inline float getXmin() const {return m_xmin;}
103 
105  inline float getXmax() const {return m_xmax;}
106 
108  inline float getDx() const {return m_dx;}
109 
111  int getBin(float &x) const;
112 
113  int getBinAdjusted(float &x, float &xadj) const;
114 
116  const std::string& getTitle() const {return m_title;}
117 
118  private:
120  std::string m_title;
121 
123  unsigned int m_type;
124 
126  int m_nbins;
127 
129  float m_xmin;
130 
132  float m_xmax;
133 
135  float m_dx;
136 
138  std::vector<float > m_xbins;
139  };
140 
145  class LocalHadArea {
146  public:
150  LocalHadArea() : m_type(0), m_npars(0), m_offset(0), m_length(0) {};
157  LocalHadArea(const char *title, int typ, int npars) : m_title(title), m_type(typ), m_npars(npars), m_offset(0), m_length(0)
158  {
159  m_dims.resize(0);
160  m_dims_loc.resize(0);
161  };
165  LocalHadArea(const LocalHadArea &other) = default;
167  LocalHadArea( LocalHadArea &&other) noexcept = default;
168  LocalHadArea& operator= ( LocalHadArea &&other) noexcept = default;
169 
171  inline unsigned int getType() const { return m_type; }
173  inline int getNpars() const { return m_npars; }
175  inline int getOffset() const { return m_offset; }
177  inline int getLength() const { return m_length; }
179  inline int getNdim() const { return (int) m_dims.size(); }
181  inline int getDimLoc(int i_dim) const { return m_dims_loc[i_dim]; }
183  const std::string& getTitle() const {return m_title;}
184 
186  void setOffset(int offset) { m_offset = offset; }
188  void setLength(int length) { m_length = length; }
192  const CaloLocalHadCoeff::LocalHadDimension *getDimension(int n_dim) const { return &(m_dims[n_dim]); }
193 
194  private:
196  std::string m_title;
197 
199  unsigned int m_type;
200 
202  int m_npars;
203 
205  int m_offset;
206 
208  int m_length;
209 
211  std::vector<LocalHadDimension > m_dims;
212 
214  std::vector<int > m_dims_loc;
215  };
216 
220  typedef std::vector<float> LocalHadCoeff;
221 
226 
232  //Move operators
234  CaloLocalHadCoeff& operator= (CaloLocalHadCoeff &&) noexcept = default;
235 
236  //
237  // general access methods
239  const std::string& getTitle() const {return m_title;}
240 
242  void setTitle(const std::string &title) {m_title = title; }
243 
244  //
245  // access methods for areas
246 
248  inline int getSizeAreaSet() const { return (int)m_AreaSet.size(); }
249 
251  void addArea(LocalHadArea & theArea);
252 
254  void setArea(const int n_area, const LocalHadArea & theArea);
255 
257  const LocalHadArea *getArea(int n_area) const;
258 
260  const LocalHadArea *getAreaFromBin(int iBin) const;
261 
263  const LocalHadArea *getAreaFromBin(int iBin, int &i_area) const;
264 
265  //
266  // access methods for parameters
267 
269  inline int getSizeCoeffSet() const { return (int)m_CoeffSet.size(); }
270 
272  void setCoeff(const int iBin, const LocalHadCoeff & theCoeff);
273 
275  const LocalHadCoeff * getCoeff(const int & iBin) const;
276 
278  const LocalHadCoeff * getCoeff(const int & n_area, std::vector<float> &vars) const;
279 
280  //
281  // access method for bins
282 
284  int getBin(const int n_area, std::vector<float> &vars) const;
285 
287  int getBin(const int n_area, std::vector<int> &v_indexes) const;
288 
290  int bin2indexes(const int iBin, std::vector<int> &v_dim_indx) const;
291 
293  bool isNeighbour(const int iBinx, std::vector<int> &v_indx) const;
294 
296  bool isFilled(const int iBin) const;
297 
300  bool getInterpArrays(const int n_area, const std::vector<int> &dim, std::vector<float> &x,
301  std::vector<double> &xadj, std::vector<unsigned int> &gbin) const;
302 
303  private:
304 
306  std::string m_title;
307 
309  std::vector<LocalHadCoeff> m_CoeffSet;
310 
312  std::vector<LocalHadArea> m_AreaSet;
313 };
314 //Class Identifier obtained by 'clid CaloLocalHadCoeff'
315 CLASS_DEF(CaloLocalHadCoeff, 29079131, 1)
316 
317 #include "AthenaKernel/CondCont.h"
319 
320 #endif
CaloLocalHadCoeff::LocalHadArea::LocalHadArea
LocalHadArea(LocalHadArea &&other) noexcept=default
CaloLocalHadCoeff::LocalHadDimension
Class defines binning for user dimension.
Definition: CaloLocalHadCoeff.h:47
CONDCONT_DEF
CONDCONT_DEF(CaloLocalHadCoeff, 82862607)
CaloLocalHadCoeff::LocalHadDimension::getNbins
int getNbins() const
return number of bins
Definition: CaloLocalHadCoeff.h:99
CaloLocalHadCoeff::LocalHadDimension::m_type
unsigned int m_type
dimension type
Definition: CaloLocalHadCoeff.h:123
CaloLocalHadCoeff::LocalHadDimension::operator=
LocalHadDimension & operator=(const LocalHadDimension &other)=default
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
CaloLocalHadCoeff::LocalHadDimension::m_dx
float m_dx
bin size (in the case of equidistant binning)
Definition: CaloLocalHadCoeff.h:135
CaloLocalHadCoeff::LocalHadArea::m_dims
std::vector< LocalHadDimension > m_dims
vector of defined dimensions
Definition: CaloLocalHadCoeff.h:211
CaloLocalHadCoeff::CaloLocalHadCoeff
CaloLocalHadCoeff(CaloLocalHadCoeff &&) noexcept=default
CaloLocalHadCoeff::getTitle
const std::string & getTitle() const
return name
Definition: CaloLocalHadCoeff.h:239
CaloLocalHadCoeff::LocalHadDimension::getType
unsigned int getType() const
return dimension type
Definition: CaloLocalHadCoeff.h:96
CaloLocalHadCoeff::LocalHadArea::getOffset
int getOffset() const
return area offset
Definition: CaloLocalHadCoeff.h:175
CaloLocalHadCoeff::setTitle
void setTitle(const std::string &title)
set name
Definition: CaloLocalHadCoeff.h:242
CaloLocalHadCoeff::LocalHadArea::getLength
int getLength() const
return area length
Definition: CaloLocalHadCoeff.h:177
CaloLocalHadCoeff::getSizeAreaSet
int getSizeAreaSet() const
return number of areas defined for this data set
Definition: CaloLocalHadCoeff.h:248
CaloLocalHadCoeff::LocalHadDimension::getXmin
float getXmin() const
return minimum value for the first bin
Definition: CaloLocalHadCoeff.h:102
CaloLocalHadCoeff::getAreaFromBin
const LocalHadArea * getAreaFromBin(int iBin) const
return area defined for given general iBin
Definition: CaloLocalHadCoeff.cxx:211
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
CaloLocalHadCoeff::isNeighbour
bool isNeighbour(const int iBinx, std::vector< int > &v_indx) const
are this bins is neighbour to this indexes vector (any of their indexes differ per one ?...
Definition: CaloLocalHadCoeff.cxx:80
x
#define x
CaloLocalHadCoeff::isFilled
bool isFilled(const int iBin) const
check if general bin is filled
Definition: CaloLocalHadCoeff.cxx:97
SCT_CalibAlgs::nbins
@ nbins
Definition: SCT_CalibNumbers.h:10
CaloLocalHadCoeff::LocalHadArea::getDimension
const CaloLocalHadCoeff::LocalHadDimension * getDimension(int n_dim) const
to get dimension
Definition: CaloLocalHadCoeff.h:192
CaloLocalHadCoeff::CaloLocalHadCoeff
CaloLocalHadCoeff()
Default constructor.
Definition: CaloLocalHadCoeff.cxx:162
CaloLocalHadCoeff::LocalHadDimension::getTitle
const std::string & getTitle() const
return dimension name
Definition: CaloLocalHadCoeff.h:116
CaloLocalHadCoeff::LocalHadCoeff
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
Definition: CaloLocalHadCoeff.h:220
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CaloLocalHadCoeff::LocalHadArea::addDimension
void addDimension(LocalHadDimension &dim)
to add new dimension
Definition: CaloLocalHadCoeff.cxx:135
CaloLocalHadCoeff::LocalHadArea::LocalHadArea
LocalHadArea(const LocalHadArea &other)=default
Copy constructor.
CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension
LocalHadDimension(const char *title, unsigned int typ, int nbins, float xmin, float xmax)
Constructor to define equidistant binning.
Definition: CaloLocalHadCoeff.h:61
CaloLocalHadCoeff::LocalHadDimension::m_nbins
int m_nbins
number of bins
Definition: CaloLocalHadCoeff.h:126
CaloLocalHadCoeff::LocalHadArea::m_dims_loc
std::vector< int > m_dims_loc
locator index for dimensions
Definition: CaloLocalHadCoeff.h:214
xmin
double xmin
Definition: listroot.cxx:60
CaloLocalHadCoeff
Hold binned correction data for local hadronic calibration procedure.
Definition: CaloLocalHadCoeff.h:41
CaloLocalHadCoeff::LocalHadArea::LocalHadArea
LocalHadArea(const char *title, int typ, int npars)
Constructor.
Definition: CaloLocalHadCoeff.h:157
CaloLocalHadCoeff::LocalHadDimension::m_xbins
std::vector< float > m_xbins
bins borders (if dimension has non-equidistant binning), vector of size m_nbins+1
Definition: CaloLocalHadCoeff.h:138
covarianceTool.title
title
Definition: covarianceTool.py:542
CaloLocalHadCoeff::LocalHadArea::setOffset
void setOffset(int offset)
set area offset
Definition: CaloLocalHadCoeff.h:186
CaloLocalHadCoeff::m_CoeffSet
std::vector< LocalHadCoeff > m_CoeffSet
vector of correction coefficients
Definition: CaloLocalHadCoeff.h:309
CaloLocalHadCoeff::LocalHadDimension::getDx
float getDx() const
return size of bin
Definition: CaloLocalHadCoeff.h:108
CaloLocalHadCoeff::LocalHadArea::m_type
unsigned int m_type
area type
Definition: CaloLocalHadCoeff.h:199
CaloLocalHadCoeff::getCoeff
const LocalHadCoeff * getCoeff(const int &iBin) const
get data for given general bin number
Definition: CaloLocalHadCoeff.cxx:249
CaloLocalHadCoeff::LocalHadArea::m_offset
int m_offset
offset for the data in global vector (if more than one area is defined)
Definition: CaloLocalHadCoeff.h:205
CaloLocalHadCoeff::LocalHadArea::getDimLoc
int getDimLoc(int i_dim) const
get dimension locator coefficient
Definition: CaloLocalHadCoeff.h:181
CaloLocalHadCoeff::getSizeCoeffSet
int getSizeCoeffSet() const
return total number of coefficient sets
Definition: CaloLocalHadCoeff.h:269
CaloLocalHadCoeff::setArea
void setArea(const int n_area, const LocalHadArea &theArea)
replace existing area with another one
Definition: CaloLocalHadCoeff.cxx:195
CaloLocalHadCoeff::LocalHadArea::getNdim
int getNdim() const
get number of dimensions
Definition: CaloLocalHadCoeff.h:179
CaloLocalHadCoeff::LocalHadDimension::m_xmax
float m_xmax
maximum value for the last bin
Definition: CaloLocalHadCoeff.h:132
CaloLocalHadCoeff::LocalHadArea::getNpars
int getNpars() const
return number of parameters
Definition: CaloLocalHadCoeff.h:173
CaloLocalHadCoeff::m_AreaSet
std::vector< LocalHadArea > m_AreaSet
vector of correction areas
Definition: CaloLocalHadCoeff.h:312
CaloLocalHadCoeff::setCoeff
void setCoeff(const int iBin, const LocalHadCoeff &theCoeff)
set new data
Definition: CaloLocalHadCoeff.cxx:243
CaloLocalHadCoeff::LocalHadDimension::getXmax
float getXmax() const
return maximum value for the last bin
Definition: CaloLocalHadCoeff.h:105
CaloLocalHadCoeff::LocalHadArea::m_npars
int m_npars
number of correction parameters
Definition: CaloLocalHadCoeff.h:202
CaloLocalHadCoeff::bin2indexes
int bin2indexes(const int iBin, std::vector< int > &v_dim_indx) const
expand general bin into vector of bins for defined dimensions
Definition: CaloLocalHadCoeff.cxx:301
CaloLocalHadCoeff::LocalHadArea::m_length
int m_length
length of area data block (product of m_nbins over all dimensions defined)
Definition: CaloLocalHadCoeff.h:208
CaloLocalHadCoeff::LocalHadArea::setLength
void setLength(int length)
set area length
Definition: CaloLocalHadCoeff.h:188
LArCellBinning.xbins
int xbins
Definition: LArCellBinning.py:163
CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension
LocalHadDimension(const char *title, unsigned int typ, std::vector< float > &xbins)
Constructor to define arbitrary binning.
Definition: CaloLocalHadCoeff.h:74
CaloLocalHadCoeff::LocalHadDimension::getBin
int getBin(float &x) const
return bin number
Definition: CaloLocalHadCoeff.cxx:25
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
CaloLocalHadCoeff::LocalHadArea::getType
unsigned int getType() const
return area type
Definition: CaloLocalHadCoeff.h:171
CaloLocalHadCoeff::LocalHadDimension::m_xmin
float m_xmin
minimum value for the first bin
Definition: CaloLocalHadCoeff.h:129
CaloLocalHadCoeff::CaloLocalHadCoeff
CaloLocalHadCoeff(const CaloLocalHadCoeff &other)=default
Copy constructor.
CaloLocalHadCoeff::LocalHadArea::getTitle
const std::string & getTitle() const
return name
Definition: CaloLocalHadCoeff.h:183
CaloLocalHadCoeff::LocalHadArea::LocalHadArea
LocalHadArea()
Default Constructor.
Definition: CaloLocalHadCoeff.h:150
CLASS_DEF
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
Definition: Control/AthenaKernel/AthenaKernel/CLASS_DEF.h:64
xmax
double xmax
Definition: listroot.cxx:61
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
CaloLocalHadCoeff::LocalHadArea
Definition of correction area.
Definition: CaloLocalHadCoeff.h:145
CaloLocalHadCoeff::addArea
void addArea(LocalHadArea &theArea)
add new area
Definition: CaloLocalHadCoeff.cxx:176
CaloLocalHadCoeff::LocalHadDimension::getBinAdjusted
int getBinAdjusted(float &x, float &xadj) const
Definition: CaloLocalHadCoeff.cxx:45
CaloLocalHadCoeff::getArea
const LocalHadArea * getArea(int n_area) const
return area
Definition: CaloLocalHadCoeff.cxx:201
CaloLocalHadCoeff::m_title
std::string m_title
title of data set
Definition: CaloLocalHadCoeff.h:306
CaloLocalHadCoeff::getBin
int getBin(const int n_area, std::vector< float > &vars) const
calculate general bin from vector of input cluster variables
Definition: CaloLocalHadCoeff.cxx:273
python.CaloScaleNoiseConfig.default
default
Definition: CaloScaleNoiseConfig.py:79
CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension
LocalHadDimension()
Default Constructor.
Definition: CaloLocalHadCoeff.h:52
CaloLocalHadCoeff::operator=
CaloLocalHadCoeff & operator=(const CaloLocalHadCoeff &other)=default
CaloLocalHadCoeff::LocalHadArea::operator=
LocalHadArea & operator=(const LocalHadArea &other)=default
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26
CLASS_DEF.h
macros to associate a CLID to a type
CaloLocalHadCoeff::LocalHadDimension::m_title
std::string m_title
dimensions title (e.g. "eta", "energy", "lambda", "blabla", etc)
Definition: CaloLocalHadCoeff.h:120
CaloLocalHadCoeff::LocalHadArea::m_title
std::string m_title
area title
Definition: CaloLocalHadCoeff.h:196
CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension
LocalHadDimension(LocalHadDimension &&) noexcept=default
Move constructor.
CaloLocalHadCoeff::LocalHadDimension::LocalHadDimension
LocalHadDimension(const LocalHadDimension &other)=default
Copy constructor.
CaloLocalHadCoeff::getInterpArrays
bool getInterpArrays(const int n_area, const std::vector< int > &dim, std::vector< float > &x, std::vector< double > &xadj, std::vector< unsigned int > &gbin) const
for interpolation, build the vector of relative x, and global bins for interpolated array for area n_...
Definition: CaloLocalHadCoeff.cxx:317