|
ATLAS Offline Software
|
Go to the documentation of this file.
37 for(i_bin=0; i_bin<(
int)
m_xbins.size(); i_bin++){
62 xadj = fmod( (
x-m_xmin)/m_dx, 1);
82 if(iBinx < 0 || iBinx >= (
int)
m_CoeffSet.size())
return false;
84 std::cout<<
"CaloLocalHadCoeff::LocalHadDimension::getBinAdjusted() -> Error! Wrong indexes vector size in isNeighbour: "<< v_indx.size()<<std::endl;
87 std::vector<int> xidx;
89 for(
unsigned int i=0;
i<xidx.size(); ++
i) {
90 if(abs(v_indx[
i]-xidx[
i]) == 1)
return true;
120 std::cout<<
"CaloLocalHadCoeff::isFilled() -> Error! Unknown area typ: "<<
getAreaFromBin(
bin)->
getType()<<
" in isFilled !!"<<std::endl;
137 m_dims.push_back(
dim);
140 int ndim = (
int)m_dims.size();
141 for(
int i=0;
i<ndim;
i++){
142 m_length = m_length*m_dims[
i].getNbins();
145 m_dims_loc.resize(ndim, 0);
146 for(
int i_dim=0; i_dim<ndim; i_dim++){
148 for(
int j=i_dim+1; j<ndim; j++){
149 xloc = xloc*m_dims[j].getNbins();
151 m_dims_loc[i_dim] = xloc;
180 for(
unsigned int i_area=0; i_area<
m_AreaSet.size(); i_area++){
187 for(
int i_size=0; i_size<theArea.
getLength(); i_size++){
203 if(n_area >= 0 && n_area<(
int)
m_AreaSet.size() ) {
215 for(i_area=0; i_area<narea; i_area++) {
228 for(i_area=0; i_area<narea; i_area++) {
251 if ( iBin >= 0 && iBin < (
int)
m_CoeffSet.size() ) {
261 int iBin =
getBin(n_area, vars);
277 int iBin =
area->getOffset();
278 for(
int i_dim=0; i_dim<
area->getNdim(); i_dim++){
279 int i_bin_dim =
area->getDimension(i_dim)->getBin( vars[i_dim] );
280 if(i_bin_dim < 0)
return -1;
281 iBin += i_bin_dim*
area->getDimLoc(i_dim);
292 int iBin =
area->getOffset();
293 for(
int i_dim=0; i_dim<
area->getNdim(); i_dim++){
294 if(v_indexes[i_dim] < 0)
return -1;
295 iBin += v_indexes[i_dim]*
area->getDimLoc(i_dim);
304 v_dim_indx.resize(theArea->
getNdim(),0);
305 for(
int i_dim=0; i_dim<theArea->
getNdim(); i_dim++){
307 for(
int j=0; j<i_dim; j++){
308 x0 += v_dim_indx[j]*theArea->
getDimLoc(j);
318 std::vector<double> &xadj, std::vector<unsigned int> &gbin)
const {
320 if(n_area<0 || n_area >= (
int)
m_AreaSet.size())
return false;
323 std::cout <<
"CaloLocalHadCoeff::getInterpArrays() -> Error! Empty dimension list" << std::endl;
325 }
else if( (
int)
dim.size() >
area->getNdim()) {
326 std::cout <<
"CaloLocalHadCoeff::getInterpArrays() -> Error! Vector of dimensions to interpolate exceed defined in area." << std::endl;
329 int ndim =
dim.size();
331 if((
int)
x.size()!=
area->getNdim()) {
332 std::cout<<
"CaloLocalHadCoeff::getInterpArrays() -> Error! Wrong size of phase space point !!!"<<std::endl;
337 unsigned int ncorners = (1<<ndim);
338 gbin.resize(ncorners);
343 std::vector<int> vTmp;
344 std::vector<int> vIdx(
area->getNdim());
345 std::vector<std::vector<int> > vpW;
346 for(
i=0;
i<ndim;
i++){
351 vTmp.push_back(ibin);
352 if(ibin< (
area->getDimension(
dim[
i]))->getNbins()-1) vTmp.push_back(ibin+1);
353 else vTmp.push_back(ibin);
357 for(
i=0;
i<
area->getNdim(); ++
i){
359 vIdx[
i] =
area->getDimension(
i)->getBin(
x[
i]);
365 for(i_len=0; i_len<ncorners; ++i_len){
366 for(
i=0;
i<ndim;
i++){
368 if(
i==0) vIdx[
dim[
i]] = vpW[
i][i_len%2];
374 ibin =
getBin(n_area,vIdx);
Class defines binning for user dimension.
float m_dx
bin size (in the case of equidistant binning)
std::string find(const std::string &s)
return a remapped string
int getOffset() const
return area offset
std::vector< DMTest::B > xa
int getLength() const
return area length
const LocalHadArea * getAreaFromBin(int iBin) const
return area defined for given general iBin
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 ?...
bool isFilled(const int iBin) const
check if general bin is filled
CaloLocalHadCoeff()
Default constructor.
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
void addDimension(LocalHadDimension &dim)
to add new dimension
std::vector< float > m_xbins
bins borders (if dimension has non-equidistant binning), vector of size m_nbins+1
void setOffset(int offset)
set area offset
std::vector< LocalHadCoeff > m_CoeffSet
vector of correction coefficients
const LocalHadCoeff * getCoeff(const int &iBin) const
get data for given general bin number
int getDimLoc(int i_dim) const
get dimension locator coefficient
void setArea(const int n_area, const LocalHadArea &theArea)
replace existing area with another one
int getNdim() const
get number of dimensions
float m_xmax
maximum value for the last bin
int getNpars() const
return number of parameters
std::vector< LocalHadArea > m_AreaSet
vector of correction areas
void setCoeff(const int iBin, const LocalHadCoeff &theCoeff)
set new data
int bin2indexes(const int iBin, std::vector< int > &v_dim_indx) const
expand general bin into vector of bins for defined dimensions
int getBin(float &x) const
return bin number
unsigned int getType() const
return area type
float m_xmin
minimum value for the first bin
Definition of correction area.
void addArea(LocalHadArea &theArea)
add new area
int getBinAdjusted(float &x, float &xadj) const
const LocalHadArea * getArea(int n_area) const
return area
int getBin(const int n_area, std::vector< float > &vars) const
calculate general bin from vector of input cluster variables
constexpr int pow(int base, int exp) noexcept
T getType(const char *cStr)
Return Ringer enumeration of type T identifying string type:
void getOffset(boost::tokenizer< boost::char_separator< char > >::iterator &token, uint32_t &offset)
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_...