ATLAS Offline Software
Loading...
Searching...
No Matches
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
34
35
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) :
62 m_title(title), m_type(typ), m_nbins(nbins), m_xmin(xmin), m_xmax(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 }
83
86 LocalHadDimension(const LocalHadDimension &other) = default;
91 LocalHadDimension( LocalHadDimension &&) noexcept = default;
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
127
129 float m_xmin;
130
132 float m_xmax;
133
135 float m_dx;
136
138 std::vector<float > m_xbins;
139 };
140
146 public:
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 };
162
165 LocalHadArea(const LocalHadArea &other) = default;
166 LocalHadArea& operator= (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; }
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
203
206
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
230 CaloLocalHadCoeff(const CaloLocalHadCoeff &other) = default;
232 //Move operators
233 CaloLocalHadCoeff(CaloLocalHadCoeff &&) noexcept = default;
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'
315CLASS_DEF(CaloLocalHadCoeff, 29079131, 1)
316
317#include "AthenaKernel/CondCont.h"
319
320#endif
#define CONDCONT_DEF(...)
Definition CondCont.h:1413
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
double length(const pvec &v)
#define x
int getDimLoc(int i_dim) const
get dimension locator coefficient
const CaloLocalHadCoeff::LocalHadDimension * getDimension(int n_dim) const
to get dimension
LocalHadArea & operator=(const LocalHadArea &other)=default
std::vector< LocalHadDimension > m_dims
vector of defined dimensions
int getLength() const
return area length
const std::string & getTitle() const
return name
int m_offset
offset for the data in global vector (if more than one area is defined)
int m_length
length of area data block (product of m_nbins over all dimensions defined)
LocalHadArea(const char *title, int typ, int npars)
Constructor.
void setLength(int length)
set area length
int getNdim() const
get number of dimensions
int getNpars() const
return number of parameters
int m_npars
number of correction parameters
std::vector< int > m_dims_loc
locator index for dimensions
LocalHadArea(const LocalHadArea &other)=default
Copy constructor.
int getOffset() const
return area offset
void addDimension(LocalHadDimension &dim)
to add new dimension
unsigned int getType() const
return area type
void setOffset(int offset)
set area offset
LocalHadArea(LocalHadArea &&other) noexcept=default
Class defines binning for user dimension.
float m_xmin
minimum value for the first bin
float m_dx
bin size (in the case of equidistant binning)
std::vector< float > m_xbins
bins borders (if dimension has non-equidistant binning), vector of size m_nbins+1
LocalHadDimension(const char *title, unsigned int typ, int nbins, float xmin, float xmax)
Constructor to define equidistant binning.
std::string m_title
dimensions title (e.g. "eta", "energy", "lambda", "blabla", etc)
float getDx() const
return size of bin
const std::string & getTitle() const
return dimension name
int getNbins() const
return number of bins
float getXmax() const
return maximum value for the last bin
LocalHadDimension(const LocalHadDimension &other)=default
Copy constructor.
LocalHadDimension(const char *title, unsigned int typ, std::vector< float > &xbins)
Constructor to define arbitrary binning.
float getXmin() const
return minimum value for the first bin
float m_xmax
maximum value for the last bin
int getBin(float &x) const
return bin number
LocalHadDimension(LocalHadDimension &&) noexcept=default
Move constructor.
LocalHadDimension & operator=(const LocalHadDimension &other)=default
int getBinAdjusted(float &x, float &xadj) const
unsigned int getType() const
return dimension type
Hold binned correction data for local hadronic calibration procedure.
CaloLocalHadCoeff()
Default constructor.
const LocalHadCoeff * getCoeff(const int &iBin) const
get data for given general bin number
bool isFilled(const int iBin) const
check if general bin is filled
const LocalHadArea * getArea(int n_area) const
return area
void addArea(LocalHadArea &theArea)
add new area
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 ?...
void setCoeff(const int iBin, const LocalHadCoeff &theCoeff)
set new data
void setTitle(const std::string &title)
set name
CaloLocalHadCoeff(const CaloLocalHadCoeff &other)=default
Copy constructor.
int bin2indexes(const int iBin, std::vector< int > &v_dim_indx) const
expand general bin into vector of bins for defined dimensions
int getSizeCoeffSet() const
return total number of coefficient sets
const LocalHadArea * getAreaFromBin(int iBin) const
return area defined for given general iBin
void setArea(const int n_area, const LocalHadArea &theArea)
replace existing area with another one
CaloLocalHadCoeff & operator=(const CaloLocalHadCoeff &other)=default
int getBin(const int n_area, std::vector< float > &vars) const
calculate general bin from vector of input cluster variables
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_...
const std::string & getTitle() const
return name
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
std::vector< LocalHadArea > m_AreaSet
vector of correction areas
CaloLocalHadCoeff(CaloLocalHadCoeff &&) noexcept=default
std::vector< LocalHadCoeff > m_CoeffSet
vector of correction coefficients
std::string m_title
title of data set
int getSizeAreaSet() const
return number of areas defined for this data set
double xmax
Definition listroot.cxx:61
double xmin
Definition listroot.cxx:60
STL namespace.