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

#include <CaloHadDMCoeff.h>

Collaboration diagram for CaloHadDMCoeff:

Classes

struct  HadDMArea
 

Public Types

typedef std::vector< float > HadDMCoeff
 

Public Member Functions

 CaloHadDMCoeff ()
 Default Constructor. More...
 
 CaloHadDMCoeff (const CaloHadDMCoeff &other)
 
CaloHadDMCoeffoperator= (const CaloHadDMCoeff &other)
 
const HadDMCoeffgetHadDMCoeff (const int &dm_area, const float &cls_emfrac, const float &cls_ener, const float &cls_eta) const
 
const HadDMCoeffgetHadDMCoeff (const int &iBin) const
 
const HadDMAreagetHadDMArea (int n_area) const
 
void addHadDMCoeff (const HadDMCoeff &theData)
 
void setHadDMCoeff (const int iBin, const HadDMCoeff &theData)
 
void addHadDMArea (const HadDMArea &theArea)
 
void setHadDMArea (const int n_area, const HadDMArea &theArea)
 
void PrintData (FILE *fout=stdout) const
 
int getSizeDMAreaSet () const
 
int getSizeDMCoeffSet () const
 
int getBinFrac (const int dm_area, const float &cls_frac) const
 
int getBinEner (const int dm_area, const float &cls_ener) const
 
int getBinEta (const int dm_area, const float &cls_eta) const
 
int getBin (const int &n_dm_area, const float &cls_frac, const float &cls_ener, const float &cls_eta) const
 
int getBin (const int &n_dm_area, const int &ifrac, const int &iener, const int &ieta) const
 

Private Attributes

std::vector< HadDMCoeffm_DMCoeffSet
 
std::vector< HadDMAream_DMAreaSet
 

Detailed Description

Definition at line 23 of file CaloHadDMCoeff.h.

Member Typedef Documentation

◆ HadDMCoeff

typedef std::vector<float> CaloHadDMCoeff::HadDMCoeff

Definition at line 44 of file CaloHadDMCoeff.h.

Constructor & Destructor Documentation

◆ CaloHadDMCoeff() [1/2]

CaloHadDMCoeff::CaloHadDMCoeff ( )
default

Default Constructor.

◆ CaloHadDMCoeff() [2/2]

CaloHadDMCoeff::CaloHadDMCoeff ( const CaloHadDMCoeff other)
default

Member Function Documentation

◆ addHadDMArea()

void CaloHadDMCoeff::addHadDMArea ( const HadDMArea theArea)

Definition at line 58 of file CaloHadDMCoeff.cxx.

59 {
60  m_DMAreaSet.push_back(theArea);
61 }

◆ addHadDMCoeff()

void CaloHadDMCoeff::addHadDMCoeff ( const HadDMCoeff theData)

Definition at line 46 of file CaloHadDMCoeff.cxx.

47 {
48  m_DMCoeffSet.push_back(theData);
49 }

◆ getBin() [1/2]

int CaloHadDMCoeff::getBin ( const int &  n_dm_area,
const float &  cls_frac,
const float &  cls_ener,
const float &  cls_eta 
) const

Definition at line 120 of file CaloHadDMCoeff.cxx.

121 {
122  if(n_dm_area < 0 || n_dm_area >= (int)m_DMAreaSet.size()) {
123  std::cout << " WARNING CaloHadDMCoeff::getBin -> wrong n_area: " << n_dm_area << std::endl;
124  return (-1);
125  }
126  int ifrac = getBinFrac(n_dm_area, cls_emfrac);
127  int iener = getBinEner(n_dm_area, cls_ener);
128  int ieta = getBinEta(n_dm_area, cls_eta);
129  int iBin = getBin(n_dm_area, ifrac, iener, ieta);
130  return iBin;
131 }

◆ getBin() [2/2]

int CaloHadDMCoeff::getBin ( const int &  n_dm_area,
const int &  ifrac,
const int &  iener,
const int &  ieta 
) const

Definition at line 134 of file CaloHadDMCoeff.cxx.

135 {
136  const HadDMArea *dmArea = &m_DMAreaSet[n_dm_area];
137  int iBin = -1;
138  if(ifrac!=-1 && iener !=-1 && ieta!=-1) {
139  iBin = ieta + iener*(int)dmArea->m_EtaBins.size() + ifrac*(int)dmArea->m_EnerBins.size()*(int)dmArea->m_EtaBins.size() + dmArea->m_offset;
140  }
141  return iBin;
142 }

◆ getBinEner()

int CaloHadDMCoeff::getBinEner ( const int  dm_area,
const float &  cls_ener 
) const

Definition at line 90 of file CaloHadDMCoeff.cxx.

91 {
92  const HadDMArea *dmArea = &m_DMAreaSet[n_area];
93  if(cls_ener < dmArea->m_MinEner || cls_ener >= dmArea->m_MaxEner) return (-1);
94  int iener;
95  int nener = (int)dmArea->m_EnerBins.size();
96  for (iener=0; iener<nener; iener++) {
97  if( cls_ener < dmArea->m_EnerBins[iener] ) break;
98  if( cls_ener >= dmArea->m_EnerBins[iener] && (iener == nener-1 || cls_ener < dmArea->m_EnerBins[iener+1]) ) break;
99  }
100  return iener;
101 }

◆ getBinEta()

int CaloHadDMCoeff::getBinEta ( const int  dm_area,
const float &  cls_eta 
) const

Definition at line 107 of file CaloHadDMCoeff.cxx.

108 {
109  const HadDMArea *dmArea = &m_DMAreaSet[n_area];
110  if(cls_eta < dmArea->m_MinEta || cls_eta >= dmArea->m_MaxEta) return (-1);
111  int neta = (int)dmArea->m_EtaBins.size();
112  int ieta = (int)((cls_eta - dmArea->m_MinEta)/(dmArea->m_MaxEta - dmArea->m_MinEta)*neta);
113  return ieta;
114 }

◆ getBinFrac()

int CaloHadDMCoeff::getBinFrac ( const int  dm_area,
const float &  cls_frac 
) const

Definition at line 73 of file CaloHadDMCoeff.cxx.

74 {
75  const HadDMArea *dmArea = &m_DMAreaSet[n_area];
76  if(cls_emfrac < dmArea->m_MinFrac || cls_emfrac >= dmArea->m_MaxFrac) return -1;
77  int ifrac;
78  int nfrac = dmArea->m_FracBins.size();
79  for (ifrac=0; ifrac<nfrac; ifrac++) {
80  if( cls_emfrac < dmArea->m_FracBins[ifrac] ) break;
81  if( cls_emfrac >= dmArea->m_FracBins[ifrac] && (ifrac == nfrac-1 || cls_emfrac < dmArea->m_FracBins[ifrac+1]) ) break;
82  }
83  return ifrac;
84 }

◆ getHadDMArea()

const CaloHadDMCoeff::HadDMArea * CaloHadDMCoeff::getHadDMArea ( int  n_area) const

Definition at line 36 of file CaloHadDMCoeff.cxx.

37 {
38  if(n_area >= 0 && n_area<(int)m_DMAreaSet.size() ) {
39  return &(m_DMAreaSet[n_area]);
40  } else {
41  return nullptr;
42  }
43 }

◆ getHadDMCoeff() [1/2]

const CaloHadDMCoeff::HadDMCoeff * CaloHadDMCoeff::getHadDMCoeff ( const int &  dm_area,
const float &  cls_emfrac,
const float &  cls_ener,
const float &  cls_eta 
) const

Definition at line 29 of file CaloHadDMCoeff.cxx.

30 {
31  int iBin = getBin(n_area, cls_emfrac, cls_ener, cls_eta);
32  return getHadDMCoeff(iBin);
33 }

◆ getHadDMCoeff() [2/2]

const HadDMCoeff* CaloHadDMCoeff::getHadDMCoeff ( const int &  iBin) const
inline

Definition at line 52 of file CaloHadDMCoeff.h.

53  {
54  if ( iBin > -1 && iBin < (int)m_DMCoeffSet.size() ) {
55  return (& m_DMCoeffSet[iBin]);
56  }else{
57  return 0;
58  }
59  }

◆ getSizeDMAreaSet()

int CaloHadDMCoeff::getSizeDMAreaSet ( ) const
inline

Definition at line 68 of file CaloHadDMCoeff.h.

68 {return (int)m_DMAreaSet.size();}

◆ getSizeDMCoeffSet()

int CaloHadDMCoeff::getSizeDMCoeffSet ( ) const
inline

Definition at line 69 of file CaloHadDMCoeff.h.

69 {return (int)m_DMCoeffSet.size();}

◆ operator=()

CaloHadDMCoeff & CaloHadDMCoeff::operator= ( const CaloHadDMCoeff other)

Definition at line 19 of file CaloHadDMCoeff.cxx.

20 {
21  if (this != &other) {
22  m_DMCoeffSet = other.m_DMCoeffSet;
23  m_DMAreaSet = other.m_DMAreaSet;
24  }
25  return *this;
26 }

◆ PrintData()

void CaloHadDMCoeff::PrintData ( FILE *  fout = stdout) const

Definition at line 145 of file CaloHadDMCoeff.cxx.

146 {
147 
148  const char *comments={
149  "# Coeffs for Dead Material corrections in CaloClusterLocalCalib algorithm.\n"
150  "# Author: Guennadi Pospelov <pospelov@mppmu.mpg.de>\n"
151  "#\n"
152  "#\n"
153  "# dm_id is_ON dm_title\n"
154  "# nFrac FracMin FracMax\n"
155  "# nEner EnerMin EnerMax\n"
156  "# nEta EtaMin EtaMax\n"
157  "# Npars\n"
158  "# indx ifrac iener ieta frac ener eta pars[]\n"
159  "#\n\n"};
160  fprintf(fout,"%s",comments);
161  int indx = 0;
162  for(int i_zone=0; i_zone < (int)m_DMAreaSet.size(); i_zone++){
163  const HadDMArea *area = &m_DMAreaSet[i_zone];
164  fprintf(fout," %d %d %s\n",area->m_indx, area->m_is_on, area->m_title.data());
165  fprintf(fout,"%2d %6.3f %6.3f\n", (int)area->m_FracBins.size(), area->m_MinFrac, area->m_MaxFrac);
166  fprintf(fout,"%2d %6.3g %6.3g\n", (int)area->m_EnerBins.size(), area->m_MinEner, area->m_MaxEner);
167  fprintf(fout,"%2d %6.3f %6.3f\n", (int)area->m_EtaBins.size(), area->m_MinEta, area->m_MaxEta);
168  fprintf(fout,"%2d\n", area->m_nPars);
169  for(int i_frac=0; i_frac<(int)area->m_FracBins.size(); i_frac++){
170  for(int i_ener=0; i_ener<(int)area->m_EnerBins.size(); i_ener++){
171  for(int i_eta=0; i_eta<(int)area->m_EtaBins.size(); i_eta++){
172  float cls_emfrac = area->m_FracBins[i_frac];
173  float cls_ener = area->m_EnerBins[i_ener];
174  float cls_eta = area->m_EtaBins[i_eta]+0.01;
175  const HadDMCoeff *vv = getHadDMCoeff(i_zone, cls_emfrac, cls_ener, cls_eta);
176  fprintf(fout,"%4d %2d %2d %2d %6.3f %6.3g %6.3f ",
177  indx, i_frac,i_ener, i_eta, area->m_FracBins[i_frac], area->m_EnerBins[i_ener], area->m_EtaBins[i_eta]);
178  for(int i_par=0; i_par<area->m_nPars; i_par++){
179  if(area->m_indx!=10) {
180  fprintf(fout,"%10.4f ",(*vv)[i_par]);
181  } else{
182  fprintf(fout,"%10.7f ",(*vv)[i_par]);
183  }
184  } // i_par
185  indx++;
186  fprintf(fout,"\n");
187  } // i_eta
188  } // i_ener
189  } // i_frac
190  fprintf(fout,"\n");
191  }
192 }

◆ setHadDMArea()

void CaloHadDMCoeff::setHadDMArea ( const int  n_area,
const HadDMArea theArea 
)

Definition at line 64 of file CaloHadDMCoeff.cxx.

65 {
66  m_DMAreaSet[n_area] = theArea;
67 }

◆ setHadDMCoeff()

void CaloHadDMCoeff::setHadDMCoeff ( const int  iBin,
const HadDMCoeff theData 
)

Definition at line 52 of file CaloHadDMCoeff.cxx.

53 {
54  m_DMCoeffSet[iBin] = theData;
55 }

Member Data Documentation

◆ m_DMAreaSet

std::vector<HadDMArea> CaloHadDMCoeff::m_DMAreaSet
private

Definition at line 78 of file CaloHadDMCoeff.h.

◆ m_DMCoeffSet

std::vector<HadDMCoeff> CaloHadDMCoeff::m_DMCoeffSet
private

Definition at line 77 of file CaloHadDMCoeff.h.


The documentation for this class was generated from the following files:
CaloHadDMCoeff::m_DMAreaSet
std::vector< HadDMArea > m_DMAreaSet
Definition: CaloHadDMCoeff.h:78
WriteBchToCool.comments
comments
Definition: WriteBchToCool.py:297
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CaloHadDMCoeff::getBinFrac
int getBinFrac(const int dm_area, const float &cls_frac) const
Definition: CaloHadDMCoeff.cxx:73
CaloHadDMCoeff::HadDMCoeff
std::vector< float > HadDMCoeff
Definition: CaloHadDMCoeff.h:44
CaloHadDMCoeff::getBinEner
int getBinEner(const int dm_area, const float &cls_ener) const
Definition: CaloHadDMCoeff.cxx:90
CaloHadDMCoeff::m_DMCoeffSet
std::vector< HadDMCoeff > m_DMCoeffSet
Definition: CaloHadDMCoeff.h:77
CaloHadDMCoeff::getHadDMCoeff
const HadDMCoeff * getHadDMCoeff(const int &dm_area, const float &cls_emfrac, const float &cls_ener, const float &cls_eta) const
Definition: CaloHadDMCoeff.cxx:29
dqt_zlumi_alleff_HIST.fout
fout
Definition: dqt_zlumi_alleff_HIST.py:59
CaloHadDMCoeff::getBinEta
int getBinEta(const int dm_area, const float &cls_eta) const
Definition: CaloHadDMCoeff.cxx:107
CaloHadDMCoeff::getBin
int getBin(const int &n_dm_area, const float &cls_frac, const float &cls_ener, const float &cls_eta) const
Definition: CaloHadDMCoeff.cxx:120
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
area
double area(double R)
Definition: ConvertStaveServices.cxx:42
PlotCalibFromCool.vv
vv
Definition: PlotCalibFromCool.py:716