ATLAS Offline Software
Classes | Public Types | Public Member Functions | Private Attributes | List of all members
CaloLocalHadCoeff Struct Reference

Hold binned correction data for local hadronic calibration procedure. More...

#include <CaloLocalHadCoeff.h>

Collaboration diagram for CaloLocalHadCoeff:

Classes

class  LocalHadArea
 Definition of correction area. More...
 
class  LocalHadDimension
 Class defines binning for user dimension. More...
 

Public Types

typedef std::vector< float > LocalHadCoeff
 Correction parameters for one general bin. More...
 

Public Member Functions

 CaloLocalHadCoeff ()
 Default constructor. More...
 
 CaloLocalHadCoeff (const CaloLocalHadCoeff &other)=default
 Copy constructor. More...
 
CaloLocalHadCoeffoperator= (const CaloLocalHadCoeff &other)=default
 
 CaloLocalHadCoeff (CaloLocalHadCoeff &&) noexcept=default
 
CaloLocalHadCoeffoperator= (CaloLocalHadCoeff &&) noexcept=default
 
const std::string & getTitle () const
 return name More...
 
void setTitle (const std::string &title)
 set name More...
 
int getSizeAreaSet () const
 return number of areas defined for this data set More...
 
void addArea (LocalHadArea &theArea)
 add new area More...
 
void setArea (const int n_area, const LocalHadArea &theArea)
 replace existing area with another one More...
 
const LocalHadAreagetArea (int n_area) const
 return area More...
 
const LocalHadAreagetAreaFromBin (int iBin) const
 return area defined for given general iBin More...
 
const LocalHadAreagetAreaFromBin (int iBin, int &i_area) const
 return area (and area index) defined for given general iBin More...
 
int getSizeCoeffSet () const
 return total number of coefficient sets More...
 
void setCoeff (const int iBin, const LocalHadCoeff &theCoeff)
 set new data More...
 
const LocalHadCoeffgetCoeff (const int &iBin) const
 get data for given general bin number More...
 
const LocalHadCoeffgetCoeff (const int &n_area, std::vector< float > &vars) const
 get data for given area and list of cluster variables More...
 
int getBin (const int n_area, std::vector< float > &vars) const
 calculate general bin from vector of input cluster variables More...
 
int getBin (const int n_area, std::vector< int > &v_indexes) const
 calculate general bin from known bins in dimensions More...
 
int bin2indexes (const int iBin, std::vector< int > &v_dim_indx) const
 expand general bin into vector of bins for defined dimensions More...
 
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 ?) More...
 
bool isFilled (const int iBin) const
 check if general bin is filled More...
 
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_area and list of dimensions (all in case dim is empty) More...
 

Private Attributes

std::string m_title
 title of data set More...
 
std::vector< LocalHadCoeffm_CoeffSet
 vector of correction coefficients More...
 
std::vector< LocalHadAream_AreaSet
 vector of correction areas More...
 

Detailed Description

Hold binned correction data for local hadronic calibration procedure.

defines enums and data types of CaloLocalHadCoeff

Author
Gennady Pospelov guenn.nosp@m.adi..nosp@m.pospe.nosp@m.lov@.nosp@m.cern..nosp@m.ch, Pavol Strizenec pavol.nosp@m.@mai.nosp@m.l.cer.nosp@m.n.ch
Date
20-July-2009 This class holds binned correction data in multi-dimensional space for classification, weighting, out-of-cluster or dead material correction tools. Data are holded as vector of floats for each bin defined, thereby that at the end they appear to be vector of vector of float. One data set (one CaloLocalHadCoeff) serve for one correction tool.

Binning definition is done via conception of 'correction areas'. One area has fixed number of dimenensions, fixed way how these dimensions have been binned and fixed number of correction parameters for each bin.

For example, em/had classification tool requires following setup: 3 correction coefficients (em fraction of bin, number of entries in bin, some error in bin) are binned in 4 dimensions: cluster eta, log10(cluster energy), log10(cluster energy density), log10(cluter depth).

There could be more, than one, correction area defined for one correction tool. For example, dead material correction have 8 different areas defined for different kind of dead material energy depositions (before presamplers, between emec and hec, before FCAL, etc)

Author
Gennady Pospelov guenn.nosp@m.adi..nosp@m.pospe.nosp@m.lov@.nosp@m.cern..nosp@m.ch
Date
18-August-2009

Definition at line 41 of file CaloLocalHadCoeff.h.

Member Typedef Documentation

◆ LocalHadCoeff

typedef std::vector<float> CaloLocalHadCoeff::LocalHadCoeff

Correction parameters for one general bin.

Definition at line 220 of file CaloLocalHadCoeff.h.

Constructor & Destructor Documentation

◆ CaloLocalHadCoeff() [1/3]

CaloLocalHadCoeff::CaloLocalHadCoeff ( )

◆ CaloLocalHadCoeff() [2/3]

CaloLocalHadCoeff::CaloLocalHadCoeff ( const CaloLocalHadCoeff other)
default

Copy constructor.

◆ CaloLocalHadCoeff() [3/3]

CaloLocalHadCoeff::CaloLocalHadCoeff ( CaloLocalHadCoeff &&  )
defaultnoexcept

Member Function Documentation

◆ addArea()

void CaloLocalHadCoeff::addArea ( LocalHadArea theArea)

add new area

Definition at line 176 of file CaloLocalHadCoeff.cxx.

177 {
178  // calculating offset for coefficients of this area using previous areas defined
179  int offset = 0;
180  for(unsigned int i_area=0; i_area<m_AreaSet.size(); i_area++){
181  offset += m_AreaSet[i_area].getLength();
182  }
183  theArea.setOffset(offset);
184  // adding zero coefficients
186  pars.resize(theArea.getNpars(), 0.0);
187  for(int i_size=0; i_size<theArea.getLength(); i_size++){
188  m_CoeffSet.push_back(pars);
189  }
190  // adding area
191  m_AreaSet.push_back(theArea);
192 }

◆ bin2indexes()

int CaloLocalHadCoeff::bin2indexes ( const int  iBin,
std::vector< int > &  v_dim_indx 
) const

expand general bin into vector of bins for defined dimensions

Definition at line 301 of file CaloLocalHadCoeff.cxx.

302 {
303  const LocalHadArea *theArea = getAreaFromBin(iBin);
304  v_dim_indx.resize(theArea->getNdim(),0);
305  for(int i_dim=0; i_dim<theArea->getNdim(); i_dim++){
306  int x0 = 0;
307  for(int j=0; j<i_dim; j++){
308  x0 += v_dim_indx[j]*theArea->getDimLoc(j);
309  }
310  v_dim_indx[i_dim] = (iBin-theArea->getOffset()-x0)/theArea->getDimLoc(i_dim);
311  }
312  return 0;
313 }

◆ getArea()

const CaloLocalHadCoeff::LocalHadArea * CaloLocalHadCoeff::getArea ( int  n_area) const

return area

Definition at line 201 of file CaloLocalHadCoeff.cxx.

202 {
203  if(n_area >= 0 && n_area<(int)m_AreaSet.size() ) {
204  return &(m_AreaSet[n_area]);
205  } else {
206  return nullptr;
207  }
208 }

◆ getAreaFromBin() [1/2]

const CaloLocalHadCoeff::LocalHadArea * CaloLocalHadCoeff::getAreaFromBin ( int  iBin) const

return area defined for given general iBin

Definition at line 211 of file CaloLocalHadCoeff.cxx.

212 {
213  int i_area = 0;
214  int narea = m_AreaSet.size();
215  for(i_area=0; i_area<narea; i_area++) {
216  if( iBin < m_AreaSet[i_area].getOffset() ) break;
217  if( iBin >= m_AreaSet[i_area].getOffset()
218  && (i_area == narea-1 || iBin < m_AreaSet[i_area+1].getOffset()) ) break;
219  }
220  return &(m_AreaSet[i_area]);
221 }

◆ getAreaFromBin() [2/2]

const CaloLocalHadCoeff::LocalHadArea * CaloLocalHadCoeff::getAreaFromBin ( int  iBin,
int &  i_area 
) const

return area (and area index) defined for given general iBin

Definition at line 224 of file CaloLocalHadCoeff.cxx.

225 {
226  i_area = 0;
227  int narea = m_AreaSet.size();
228  for(i_area=0; i_area<narea; i_area++) {
229  if( iBin < m_AreaSet[i_area].getOffset() ) break;
230  if( iBin >= m_AreaSet[i_area].getOffset()
231  && (i_area == narea-1 || iBin < m_AreaSet[i_area+1].getOffset()) ) break;
232  }
233  return &(m_AreaSet[i_area]);
234 }

◆ getBin() [1/2]

int CaloLocalHadCoeff::getBin ( const int  n_area,
std::vector< float > &  vars 
) const

calculate general bin from vector of input cluster variables

Definition at line 273 of file CaloLocalHadCoeff.cxx.

274 {
275  const LocalHadArea *area = &m_AreaSet[n_area];
276  // loop over dimensions
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);
282  }
283  return iBin;
284 }

◆ getBin() [2/2]

int CaloLocalHadCoeff::getBin ( const int  n_area,
std::vector< int > &  v_indexes 
) const

calculate general bin from known bins in dimensions

Definition at line 288 of file CaloLocalHadCoeff.cxx.

289 {
290  const LocalHadArea *area = &m_AreaSet[n_area];
291  // loop over dimensions
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);
296  }
297  return iBin;
298 }

◆ getCoeff() [1/2]

const CaloLocalHadCoeff::LocalHadCoeff * CaloLocalHadCoeff::getCoeff ( const int &  iBin) const

get data for given general bin number

Definition at line 249 of file CaloLocalHadCoeff.cxx.

250 {
251  if ( iBin >= 0 && iBin < (int)m_CoeffSet.size() ) {
252  return (& m_CoeffSet[iBin]);
253  }else{
254  return nullptr;
255  }
256 }

◆ getCoeff() [2/2]

const CaloLocalHadCoeff::LocalHadCoeff * CaloLocalHadCoeff::getCoeff ( const int &  n_area,
std::vector< float > &  vars 
) const

get data for given area and list of cluster variables

Definition at line 259 of file CaloLocalHadCoeff.cxx.

260 {
261  int iBin = getBin(n_area, vars);
262  return getCoeff(iBin);
263 }

◆ getInterpArrays()

bool CaloLocalHadCoeff::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_area and list of dimensions (all in case dim is empty)

Definition at line 317 of file CaloLocalHadCoeff.cxx.

318  {
319  // sanity check
320  if(n_area<0 || n_area >= (int)m_AreaSet.size()) return false;
321  const LocalHadArea *area=&(m_AreaSet[n_area]);
322  if(dim.empty()) {
323  std::cout << "CaloLocalHadCoeff::getInterpArrays() -> Error! Empty dimension list" << std::endl;
324  return false;
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;
327  return false;
328  }
329  int ndim = dim.size();
330 
331  if((int)x.size()!= area->getNdim()) {
332  std::cout<<"CaloLocalHadCoeff::getInterpArrays() -> Error! Wrong size of phase space point !!!"<<std::endl;
333  return false;
334  }
335 
336  xadj.resize(ndim);
337  unsigned int ncorners = (1<<ndim);
338  gbin.resize(ncorners);
339 
340  float xa;
341  int ibin, i;
342  unsigned int i_len;
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++){
347  ibin = (area->getDimension(dim[i]))->getBinAdjusted(x[dim[i]],xa);
348  //if(xadj<0) printf("%d x:%6.3f xadj:%6.3f ibin:%d ibin+1:%d \n",i, x[i], xadj, ibin, ibin+1);
349  xadj[i] = xa;
350  vTmp.clear();
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);
354  vpW.push_back(vTmp);
355  }
356  // fill the vIdx for dimensions we are not interpolating over
357  for(i=0; i<area->getNdim(); ++i){
358  if(std::find(dim.begin(),dim.end(),i) != dim.end()) continue;
359  vIdx[i] = area->getDimension(i)->getBin(x[i]);
360  }
361 
362  // now find the global bin for all corners
363  //vTmp.clear();
364  //vTmp.resize(ndim);
365  for(i_len=0; i_len<ncorners; ++i_len){
366  for( i=0; i<ndim; i++){
367  //std::cout<<"Sec. idx: "<<int(i_len/int(pow(2,i)))%int(pow(2,i))<<std::endl;
368  if(i==0) vIdx[dim[i]] = vpW[i][i_len%2];
369  else vIdx[dim[i]] = vpW[i][int(i_len/int(pow(2,i)))%int(pow(2,i))];
370  //if(i==2) std::cout<< vTmp[i] <<" ";
371  //std::cout<< vTmp[i] <<" ";
372  }
373  // std::cout<<std::endl;
374  ibin = getBin(n_area,vIdx);
375  gbin[i_len] = ibin;
376  }
377  return true;
378 }

◆ getSizeAreaSet()

int CaloLocalHadCoeff::getSizeAreaSet ( ) const
inline

return number of areas defined for this data set

Definition at line 248 of file CaloLocalHadCoeff.h.

248 { return (int)m_AreaSet.size(); }

◆ getSizeCoeffSet()

int CaloLocalHadCoeff::getSizeCoeffSet ( ) const
inline

return total number of coefficient sets

Definition at line 269 of file CaloLocalHadCoeff.h.

269 { return (int)m_CoeffSet.size(); }

◆ getTitle()

const std::string& CaloLocalHadCoeff::getTitle ( ) const
inline

return name

Definition at line 239 of file CaloLocalHadCoeff.h.

239 {return m_title;}

◆ isFilled()

bool CaloLocalHadCoeff::isFilled ( const int  iBin) const

check if general bin is filled

Definition at line 97 of file CaloLocalHadCoeff.cxx.

98 {
99  if( bin<0 || bin >= (int)m_CoeffSet.size() ) {
100  return false;
101  }
102  switch(getAreaFromBin(bin)->getType()) {
105  return m_CoeffSet[bin][ient] != 0;
106  }
108  return m_CoeffSet[bin][CaloLocalHadDefs::BIN_P0] != 0 ||
109 
111 
113  }
115  bool bf=false;
116  for(unsigned int i=0; i<m_CoeffSet[bin].size(); ++i) if(m_CoeffSet[bin][i] != 0) bf=true;
117  return bf;
118  }
119  default:{
120  std::cout<<"CaloLocalHadCoeff::isFilled() -> Error! Unknown area typ: "<<getAreaFromBin(bin)->getType()<<" in isFilled !!"<<std::endl;
121  return false;
122  }
123  }
124  // should not come here, but syntax need it:
125  return false;
126 }

◆ isNeighbour()

bool CaloLocalHadCoeff::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 at line 80 of file CaloLocalHadCoeff.cxx.

80  {
81  // Sanity check
82  if(iBinx < 0 || iBinx >= (int) m_CoeffSet.size()) return false;
83  if((int)v_indx.size() != getAreaFromBin(iBinx)->getNdim()) {
84  std::cout<<"CaloLocalHadCoeff::LocalHadDimension::getBinAdjusted() -> Error! Wrong indexes vector size in isNeighbour: "<< v_indx.size()<<std::endl;
85  return false;
86  }
87  std::vector<int> xidx;
88  bin2indexes(iBinx, xidx);
89  for(unsigned int i=0; i<xidx.size(); ++i) {
90  if(abs(v_indx[i]-xidx[i]) == 1) return true;
91  }
92  return false;
93 }

◆ operator=() [1/2]

CaloLocalHadCoeff& CaloLocalHadCoeff::operator= ( CaloLocalHadCoeff &&  )
defaultnoexcept

◆ operator=() [2/2]

CaloLocalHadCoeff& CaloLocalHadCoeff::operator= ( const CaloLocalHadCoeff other)
default

◆ setArea()

void CaloLocalHadCoeff::setArea ( const int  n_area,
const LocalHadArea theArea 
)

replace existing area with another one

Definition at line 195 of file CaloLocalHadCoeff.cxx.

196 {
197  m_AreaSet[n_area] = theArea;
198 }

◆ setCoeff()

void CaloLocalHadCoeff::setCoeff ( const int  iBin,
const LocalHadCoeff theCoeff 
)

set new data

Definition at line 243 of file CaloLocalHadCoeff.cxx.

244 {
245  m_CoeffSet[iBin] = theCoeff;
246 }

◆ setTitle()

void CaloLocalHadCoeff::setTitle ( const std::string &  title)
inline

set name

Definition at line 242 of file CaloLocalHadCoeff.h.

242 {m_title = title; }

Member Data Documentation

◆ m_AreaSet

std::vector<LocalHadArea> CaloLocalHadCoeff::m_AreaSet
private

vector of correction areas

Definition at line 312 of file CaloLocalHadCoeff.h.

◆ m_CoeffSet

std::vector<LocalHadCoeff> CaloLocalHadCoeff::m_CoeffSet
private

vector of correction coefficients

Definition at line 309 of file CaloLocalHadCoeff.h.

◆ m_title

std::string CaloLocalHadCoeff::m_title
private

title of data set

Definition at line 306 of file CaloLocalHadCoeff.h.


The documentation for this struct was generated from the following files:
CaloLocalHadDefs::BIN_P1
@ BIN_P1
Definition: CaloLocalHadDefs.h:32
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloLocalHadDefs::AREA_DMFIT
@ AREA_DMFIT
Definition: CaloLocalHadDefs.h:21
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
bin
Definition: BinsDiffFromStripMedian.h:43
CaloLocalHadDefs::AREA_DMSMPW
@ AREA_DMSMPW
Definition: CaloLocalHadDefs.h:23
athena.value
value
Definition: athena.py:124
DataModelTestDataCommonDict::xa
std::vector< DMTest::B > xa
Definition: DataModelTestDataCommonDict.h:54
CaloLocalHadCoeff::getAreaFromBin
const LocalHadArea * getAreaFromBin(int iBin) const
return area defined for given general iBin
Definition: CaloLocalHadCoeff.cxx:211
x
#define x
CaloLocalHadCoeff::LocalHadCoeff
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
Definition: CaloLocalHadCoeff.h:220
CaloLocalHadDefs::BIN_ENTRIES
@ BIN_ENTRIES
Definition: CaloLocalHadDefs.h:29
lumiFormat.i
int i
Definition: lumiFormat.py:85
covarianceTool.title
title
Definition: covarianceTool.py:542
CaloLocalHadCoeff::m_CoeffSet
std::vector< LocalHadCoeff > m_CoeffSet
vector of correction coefficients
Definition: CaloLocalHadCoeff.h:309
CaloLocalHadCoeff::getCoeff
const LocalHadCoeff * getCoeff(const int &iBin) const
get data for given general bin number
Definition: CaloLocalHadCoeff.cxx:249
MuonR4::SegmentFit::ParamDefs::x0
@ x0
CaloLocalHadDefs::BIN_P2
@ BIN_P2
Definition: CaloLocalHadDefs.h:33
CaloLocalHadCoeff::m_AreaSet
std::vector< LocalHadArea > m_AreaSet
vector of correction areas
Definition: CaloLocalHadCoeff.h:312
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:83
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::getType
unsigned int getType() const
return area type
Definition: CaloLocalHadCoeff.h:171
CaloLocalHadDefs::AREA_STD
@ AREA_STD
Definition: CaloLocalHadDefs.h:20
CaloLocalHadDefs::BIN_P0
@ BIN_P0
Definition: CaloLocalHadDefs.h:31
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
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
area
double area(double R)
Definition: ConvertStaveServices.cxx:42
Ringer::getType
T getType(const char *cStr)
Return Ringer enumeration of type T identifying string type:
getOffset
void getOffset(boost::tokenizer< boost::char_separator< char > >::iterator &token, uint32_t &offset)
Definition: interpretSeeds.cxx:21
CaloLocalHadDefs::AREA_DMLOOKUP
@ AREA_DMLOOKUP
Definition: CaloLocalHadDefs.h:22