ATLAS Offline Software
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes | List of all members
CaloSum Class Reference

Container for binned sums of calorimeter variables. More...

#include <CaloSum.h>

Collaboration diagram for CaloSum:

Public Types

enum  CaloRegion {
  Central = 0x01, EndCap = 0x02, Forward = 0x04, Em = 0x08,
  Had = 0x10, UnknownRegion = 0xff
}
 Region indicator implementation. More...
 
enum  CaloVarType {
  E = 0x01, EDensity = 0x02, EFraction = 0x04, Et = 0x08,
  EtFraction = 0x10, UnknownType = 0xff
}
 Binned variable type. More...
 
typedef std::pair< CaloRegion, CaloSampling::CaloSamplekey_t
 Key type for compressed storage. More...
 
typedef std::vector< double > data_t
 Data type for parallel running sums in a bin. More...
 
typedef data_t::iterator data_iter_t
 Data iterator type. More...
 
typedef data_t::const_iterator data_const_iter_t
 Data const iterator type. More...
 
typedef std::vector< data_tbin_t
 Bin type. More...
 
typedef bin_t::iterator bin_iter_t
 Bin iterator type. More...
 
typedef bin_t::const_iterator bin_const_iter_t
 Bin const iterator type. More...
 
typedef std::map< key_t, bin_tstore_t
 Store data type. More...
 
typedef store_t::iterator store_iter_t
 Store iterator type. More...
 
typedef store_t::const_iterator store_const_iter_t
 Store const iterator type. More...
 
typedef std::pair< double, double > range_t
 Range type. More...
 
typedef std::vector< range_trange_cont_t
 Range container type. More...
 
typedef std::map< CaloRegion, range_cont_trange_map_t
 Range map type. More...
 
typedef store_const_iter_t const_iterator
 Store iterator type. More...
 

Public Member Functions

 CaloSum ()
 Default constructor. More...
 
 CaloSum (CaloVarType varType, const CaloBinDescriptor< double > &theBins, size_t numberOfSums=1)
 Useful constructor. More...
 
virtual ~CaloSum ()
 Useful constructor. More...
 
virtual bool setRegion (const CaloSum::CaloRegion &theRegion, double etaLow, double etaHigh)
 Configure regions. More...
 
virtual bool setRegion (const CaloSum::CaloRegion &theRegion, const std::vector< double > &etaLow, const std::vector< double > &etaHigh)
 Configure regions. More...
 
virtual CaloRegion getRegion (double theEta) const
 Retrieve region for a given eta. More...
 
virtual bool getRange (const CaloRegion &theRegion, std::vector< double > &lowEtas, std::vector< double > &highEtas) const
 Returns eta range(s) for a given region. More...
 
virtual CaloVarType getVarType () const
 Returns binned variable type. More...
 
virtual size_t getNumberOfBins () const
 Returns number of bins. More...
 
virtual size_t getNumberOfSums () const
 Returns number of sums in each bin. More...
 
virtual bool getVariableRange (double &lowLimit, double &highLimit) const
 Returs lower and upper limit of binned variable range. More...
 
virtual bool getBinEdges (size_t theIndex, double &lowEdge, double &highEdge) const
 Returns bin edges for a given bin. More...
 
virtual bool getBinCenter (size_t theIndex, double &binCenter) const
 Returns bin center. More...
 
virtual const CaloBinDescriptor< double > & getBinDescriptor () const
 Returns reference to complete bin descriptor. More...
 
virtual bool add (const CaloCell *theCell, double theBinnedVariable, const std::vector< double > &theSummedVariables)
 Add to sums. More...
 
virtual bool add (const CaloCell *theCell, double theBinnedVariable, double theSummedVariable)
 Add to sum. More...
 
virtual bool add (const CaloSampling::CaloSample &theSampling, double theEta, double theBinnedVariable, const std::vector< double > &theSummedVariables)
 Add to sums. More...
 
virtual bool add (const CaloSampling::CaloSample &theSampling, double theEta, double theBinnedVariable, double theSummedVariable)
 Add to sums. More...
 
const_iterator begin () const
 Store begin iterator. More...
 
const_iterator end () const
 Store end iterator. More...
 
bool getSums (const_iterator &theIterator, size_t theBinIndex, std::vector< double > &theSums) const
 Returns sums for a given iterator. More...
 
bool getSums (const_iterator &theIterator, double theBinnedVariable, std::vector< double > &theSums) const
 Returns sums for a given binned variable. More...
 
bool getSums (const CaloSum::CaloRegion &theRegion, const CaloSampling::CaloSample &theSampling, size_t theIndex, std::vector< double > &theSums) const
 Returns sums for a given key and index. More...
 
bool getSums (const CaloSum::CaloRegion &theRegion, const CaloSampling::CaloSample &theSampling, double theBinnedVariable, std::vector< double > &theSums) const
 Returns sums for a given key and binned variable. More...
 
virtual bool contains (const CaloSum::CaloRegion &theRegion) const
 Returns sums for a given sampling, eta, and index. More...
 
virtual bool contains (const CaloSampling::CaloSample &theSampling) const
 Checks if sampling in store. More...
 
virtual bool contains (const CaloSum::CaloRegion &theRegion, const CaloSampling::CaloSample &theSampling) const
 Checks if region/sampling combination is in store. More...
 

Static Public Member Functions

static CaloRegion getRegion (const_iterator &theIterator)
 Returns region for a given iterator. More...
 
static CaloSampling::CaloSample getSampling (const_iterator &theIterator)
 Returns sampling for a given iterator. More...
 

Protected Member Functions

key_t getKey (double theEta, const CaloSampling::CaloSample &theSample) const
 Translate into key. More...
 
bool setUp ()
 Set up defaults. More...
 

Static Protected Member Functions

static key_t getKey (const CaloRegion &theRegion, const CaloSampling::CaloSample &theSample)
 Translate into key. More...
 

Private Attributes

bool m_defaultRanges
 Process flow control: indicates default range overwrite. More...
 
size_t m_numberOfSums
 Store size: number of sums. More...
 
CaloVarType m_varType
 Binned variable type. More...
 
CaloBinDescriptor< double > m_binDescriptor
 Bin descriptor. More...
 
range_map_t m_regionRanges
 Store for region ranges. More...
 
store_t m_sumStore
 Store for sums. More...
 

Detailed Description

Container for binned sums of calorimeter variables.

Author
Peter Loch loch@.nosp@m.phys.nosp@m.ics.a.nosp@m.rizo.nosp@m.na.ed.nosp@m.u
Date
Feb.8, 2005
Version
0

Simple data container for indexed running sums. Presently three indices are supported:

  1. CaloRegion indicates a calorimeter region.
  2. CaloSample indicates a calorimeter sampling.
  3. BinIndex indicates a variable bin index

It is possible to run several sums in a given bin. The binned variable can be different from the summed variable(s).

CaloRegions can be configured by the client. Three named regions are available, indentified by enumerators with default settings:

  1. Central central region \( |\eta| < 0.8\) ;
  2. EndCap endcap region \( 0.8 < |\eta| < 2.5 \) ;
  3. Forward forward region \( |\eta| > 2.5 \) ;
  4. EM electromagnetic calorimeter only
  5. HAD hadronic calorimeter only

More than one \( \eta \) range can be assigned for each region, thus allowing categorizing these regions as non-contiguous entities. Also, the regions can overlap. In this case the to-be-summed quantities are added to all sums in overlapping regions.

Warning
Overlapping regions not yet correctly implemented!

Other configuration parameters are the type of the binned variable and the number of sums in each bin.

Code example:

// get a bin descriptor with equidistant bins
CaloBinDescriptor<double> theBins(100,0.,100000.);
// instantiate for energy density binning
CaloSum theSums(CaloSums::EDensity,theBins);
Todo:
Implement an option which allows definition of regions by sampling, i.e. no \( \eta \) cuts.

Definition at line 17 of file CaloSum.h.

Member Typedef Documentation

◆ bin_const_iter_t

typedef bin_t::const_iterator CaloSum::bin_const_iter_t

Bin const iterator type.

Definition at line 58 of file CaloSum.h.

◆ bin_iter_t

typedef bin_t::iterator CaloSum::bin_iter_t

Bin iterator type.

Definition at line 56 of file CaloSum.h.

◆ bin_t

typedef std::vector<data_t> CaloSum::bin_t

Bin type.

Definition at line 54 of file CaloSum.h.

◆ const_iterator

Store iterator type.

Definition at line 123 of file CaloSum.h.

◆ data_const_iter_t

typedef data_t::const_iterator CaloSum::data_const_iter_t

Data const iterator type.

Definition at line 51 of file CaloSum.h.

◆ data_iter_t

typedef data_t::iterator CaloSum::data_iter_t

Data iterator type.

Definition at line 49 of file CaloSum.h.

◆ data_t

typedef std::vector<double> CaloSum::data_t

Data type for parallel running sums in a bin.

Definition at line 47 of file CaloSum.h.

◆ key_t

Key type for compressed storage.

Definition at line 44 of file CaloSum.h.

◆ range_cont_t

typedef std::vector<range_t> CaloSum::range_cont_t

Range container type.

Definition at line 70 of file CaloSum.h.

◆ range_map_t

Range map type.

Definition at line 72 of file CaloSum.h.

◆ range_t

typedef std::pair<double,double> CaloSum::range_t

Range type.

Definition at line 68 of file CaloSum.h.

◆ store_const_iter_t

typedef store_t::const_iterator CaloSum::store_const_iter_t

Store const iterator type.

Definition at line 65 of file CaloSum.h.

◆ store_iter_t

typedef store_t::iterator CaloSum::store_iter_t

Store iterator type.

Definition at line 63 of file CaloSum.h.

◆ store_t

typedef std::map<key_t,bin_t> CaloSum::store_t

Store data type.

Definition at line 61 of file CaloSum.h.

Member Enumeration Documentation

◆ CaloRegion

Region indicator implementation.

Enumerator
Central 

Central region indicator.

EndCap 

Central region indicator.

Forward 

Forward region indicator.

Em 

Electromagnetic calorimeter indicator.

Had 

Hadronic calorimeter indicator.

UnknownRegion 

Unknown region.

Definition at line 22 of file CaloSum.h.

23  {
24  Central = 0x01,
25  EndCap = 0x02,
26  Forward = 0x04,
27  Em = 0x08,
28  Had = 0x10,
29  UnknownRegion = 0xff
30  };

◆ CaloVarType

Binned variable type.

Enumerator

Energy amplitude.

EDensity 

Energy density.

EFraction 

Energy fraction.

Et 

Transverse energy amplitude.

EtFraction 

Transverse energy fraction.

UnknownType 

Unknown variable type.

Definition at line 33 of file CaloSum.h.

34  {
35  E = 0x01,
36  EDensity = 0x02,
37  EFraction = 0x04,
38  Et = 0x08,
39  EtFraction = 0x10,
40  UnknownType = 0xff
41  };

Constructor & Destructor Documentation

◆ CaloSum() [1/2]

CaloSum::CaloSum ( )

Default constructor.

Usefulness limited, allows only default configuration, but has no bin descriptor, i.e. no sums!

Definition at line 18 of file CaloSum.cxx.

18  : m_defaultRanges(true)
19  , m_numberOfSums(0)
21  , m_binDescriptor(size_t(0),0.,0.) {}

◆ CaloSum() [2/2]

CaloSum::CaloSum ( CaloVarType  varType,
const CaloBinDescriptor< double > &  theBins,
size_t  numberOfSums = 1 
)

Useful constructor.

Accepts a variable type indicator, a bin descriptor, and the number of sums in a bin.

Parameters
varTypevariable type indicator
theBinsbin descriptor
numberOfSumsnumber of running sums (default 1 if omitted)

The constructor implements default range assignments to each region

  • Central \( -0.8 < \eta < 0.8 \)
  • EndCap \( -2.5 < \eta < -0.8 \) and \( 0.8 < \eta < 2.5 \)
  • Forward \( -5.0 < \eta < -2.5 \) and \( 2.5 < \eta < 5.0 \)

This constructor implements only the regions defined above.

Definition at line 24 of file CaloSum.cxx.

27  : m_defaultRanges(true)
28  , m_numberOfSums(numberOfSums)
29  , m_varType(varType)
30  , m_binDescriptor(theBins)
31 {
32  this->setUp();
33 }

◆ ~CaloSum()

CaloSum::~CaloSum ( )
virtualdefault

Useful constructor.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Constructor allows to give a list of regions. ‍/ CaloSum(CaloVarType varType, const CaloBinDescriptor<double>& theBins, const std::vector<CaloRegion>& theRegions, size_t numberOfSums = 1 ); /*! Descructor

Member Function Documentation

◆ add() [1/4]

bool CaloSum::add ( const CaloCell theCell,
double  theBinnedVariable,
const std::vector< double > &  theSummedVariables 
)
virtual

Add to sums.

Returns false if problems adding (outside region range, outside binned variable range).

Parameters
theCellpointer to a CaloCell
theBinnedVariablebinned variable
theSummedVariablessummed variables

In case of dimension mismatch, only the members of theSummedVariables fitting within the configured dimensions will be used.

If the cell is in a new region or sampling, a new key is generated and added to the internal store. No pre-setting of included (region,sampling) pairs (the keys) is necessary or possible. Unwanted combinations have to be avoided by the algorithms.

Definition at line 234 of file CaloSum.cxx.

237 {
238  // get sampling
239  CaloSampling::CaloSample theSampling = theCell->caloDDE()->getSampling();
240  // add up
241  return this->add(theSampling,theCell->eta(),theBinnedVariable,
242  theSummedVariables);
243 }

◆ add() [2/4]

bool CaloSum::add ( const CaloCell theCell,
double  theBinnedVariable,
double  theSummedVariable 
)
virtual

Add to sum.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theCellpointer to a CaloCell
theBinnedVariablebinned variable
theSummedVariablesummed variable

Definition at line 226 of file CaloSum.cxx.

229 {
230  std::vector<double> theSums; theSums.push_back(theSummedVariable);
231  return this->add(theCell,theBinnedVariable,theSums);
232 }

◆ add() [3/4]

bool CaloSum::add ( const CaloSampling::CaloSample theSampling,
double  theEta,
double  theBinnedVariable,
const std::vector< double > &  theSummedVariables 
)
virtual

Add to sums.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theSamplingsampling indicator
theEtaeta of CaloCell
theBinnedVariablebinned variable
theSummedVariablessummed variables

Uses explicit sampling indicator and eta instead of CaloCell reference.

Definition at line 255 of file CaloSum.cxx.

259 {
260  // find bin
261  size_t theIndex = m_binDescriptor.getIndex(theBinnedVariable);
262  if ( m_binDescriptor.outOfRange(theIndex) )
263  {
264  return false;
265  }
266  // get key
267  key_t theKey = this->getKey(theEta,theSampling);
268  // find in map and generate new if not found
269  store_iter_t theAllocator = m_sumStore.find(theKey);
270  if ( theAllocator == m_sumStore.end() )
271  {
272  data_t theDataVector;
273  theDataVector.resize(m_numberOfSums,0.);
274  bin_t theBinVector;
275  theBinVector.resize(m_binDescriptor.getNumberOfBins(),
276  theDataVector);
277  m_sumStore[theKey] = theBinVector;
278  theAllocator = m_sumStore.find(theKey);
279  }
280  // sum up
281  size_t theSize =
282  (((*theAllocator).second)[theIndex]).size() <= theSummedVariables.size()
283  ? (((*theAllocator).second)[theIndex]).size()
284  : theSummedVariables.size();
285  for ( unsigned int i=0; i<theSize; i++ )
286  {
287  (((*theAllocator).second)[theIndex])[i] += theSummedVariables[i];
288  }
289 
290  return true;
291 }

◆ add() [4/4]

bool CaloSum::add ( const CaloSampling::CaloSample theSampling,
double  theEta,
double  theBinnedVariable,
double  theSummedVariable 
)
virtual

Add to sums.

Parameters
theSamplingsampling indicator
theEtaeta of CaloCell
theBinnedVariablebinned variable
theSummedVariablesummed variable

Definition at line 246 of file CaloSum.cxx.

250 {
251  std::vector<double> theSums; theSums.push_back(theSummedVariable);
252  return this->add(theSampling,theEta,theBinnedVariable,theSums);
253 }

◆ begin()

CaloSum::const_iterator CaloSum::begin ( ) const

Store begin iterator.

Definition at line 297 of file CaloSum.cxx.

298 {
299  return m_sumStore.begin();
300 }

◆ contains() [1/3]

bool CaloSum::contains ( const CaloSampling::CaloSample theSampling) const
virtual

Checks if sampling in store.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns true if given sampling is in store.

Parameters
theSamplingsampling indicator

Definition at line 402 of file CaloSum.cxx.

403 {
404  bool found = false;
405  store_const_iter_t firstEntry = m_sumStore.begin();
406  store_const_iter_t lastEntry = m_sumStore.end();
407  while ( firstEntry != lastEntry && ! found )
408  {
409  found = ((*firstEntry).first).second == theSampling;
410  ++firstEntry;
411  }
412  return found;
413 }

◆ contains() [2/3]

bool CaloSum::contains ( const CaloSum::CaloRegion theRegion) const
virtual

Returns sums for a given sampling, eta, and index.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theSamplingsampling indicator
theEtaeta value
theIndexbin index
theSumsreference to vector with running sums

Returns sums for a given sampling, eta, and binned variable

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theSamplingsampling indicator
theEtaeta value
theBinnedVariablebinned variable
theSumsreference to vector with running sums

Checks if region in store

Returns true if given region is in store.

Parameters
theRegionregion indicator

Definition at line 389 of file CaloSum.cxx.

390 {
391  bool found = false;
392  store_const_iter_t firstEntry = m_sumStore.begin();
393  store_const_iter_t lastEntry = m_sumStore.end();
394  while ( firstEntry != lastEntry && ! found )
395  {
396  found = ((*firstEntry).first).first == theRegion;
397  ++firstEntry;
398  }
399  return found;
400 }

◆ contains() [3/3]

bool CaloSum::contains ( const CaloSum::CaloRegion theRegion,
const CaloSampling::CaloSample theSampling 
) const
virtual

Checks if region/sampling combination is in store.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Returns true if given region/sampling combination is in store.

Parameters
theRegionregion indicator
theSamplingsampling indicator

Definition at line 415 of file CaloSum.cxx.

417 {
418  return
419  m_sumStore.find(CaloSum::getKey(theRegion,theSampling)) !=
420  m_sumStore.end();
421 }

◆ end()

CaloSum::const_iterator CaloSum::end ( ) const

Store end iterator.

Definition at line 302 of file CaloSum.cxx.

303 {
304  return m_sumStore.end();
305 }

◆ getBinCenter()

bool CaloSum::getBinCenter ( size_t  theIndex,
double &  binCenter 
) const
virtual

Returns bin center.

Returns false if configuration incorrect or index invalid.

Parameters
theIndexbin index
binCentercenter of bin

Definition at line 202 of file CaloSum.cxx.

203 {
204  double lowEdge, highEdge;
205  if ( this->getBinEdges(theIndex,lowEdge,highEdge) )
206  {
207  binCenter = ( highEdge + lowEdge ) / 2.;
208  return true;
209  }
210  else
211  {
212  return false;
213  }
214 }

◆ getBinDescriptor()

const CaloBinDescriptor< double > & CaloSum::getBinDescriptor ( ) const
virtual

Returns reference to complete bin descriptor.

Definition at line 216 of file CaloSum.cxx.

217 {
218  return m_binDescriptor;
219 }

◆ getBinEdges()

bool CaloSum::getBinEdges ( size_t  theIndex,
double &  lowEdge,
double &  highEdge 
) const
virtual

Returns bin edges for a given bin.

Returns false if configuration incorrect or index invalid.

Parameters
theIndexbin index
lowEdgereference to variable containing lower bin limit on return
highEdgereference to variable containing upper bin limit on return

Definition at line 193 of file CaloSum.cxx.

196 {
197  lowerLimit = m_binDescriptor.lowerBinEdge(theIndex);
198  upperLimit = m_binDescriptor.upperBinEdge(theIndex);
199  return lowerLimit < upperLimit;
200 }

◆ getKey() [1/2]

CaloSum::key_t CaloSum::getKey ( const CaloRegion theRegion,
const CaloSampling::CaloSample theSample 
)
staticprotected

Translate into key.

Parameters
theRegionregion indicator
theSamplesampling indicator

Definition at line 443 of file CaloSum.cxx.

446 {
447  return key_t(theRegion,theSampling);
448 }

◆ getKey() [2/2]

CaloSum::key_t CaloSum::getKey ( double  theEta,
const CaloSampling::CaloSample theSample 
) const
protected

Translate into key.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theEtaeta value
theSamplesampling indicator

Definition at line 450 of file CaloSum.cxx.

453 {
454  CaloRegion theRegion = this->getRegion(theEta);
455  return this->getKey(theRegion,theSampling);
456 }

◆ getNumberOfBins()

size_t CaloSum::getNumberOfBins ( ) const
virtual

Returns number of bins.

Return value 0 means incomplete configuration.

Definition at line 173 of file CaloSum.cxx.

174 {
176 }

◆ getNumberOfSums()

size_t CaloSum::getNumberOfSums ( ) const
virtual

Returns number of sums in each bin.

Return value 0 means incomplete configuration.

Definition at line 178 of file CaloSum.cxx.

179 {
180  // return m_sumStore.size() > 0
181  // ? ((m_sumStore.begin()).second).size()
182  // : 0;
183  return m_numberOfSums;
184 }

◆ getRange()

bool CaloSum::getRange ( const CaloRegion theRegion,
std::vector< double > &  lowEtas,
std::vector< double > &  highEtas 
) const
virtual

Returns eta range(s) for a given region.

The ranges are returned in vectors owned by the client. The vectors are not cleared before filling, i.e. ranges are added if vectors already contain data.

Parameters
theRegionregion on input
lowEtasreference to vector for lower eta limits
highEtasreference to vector for upper eta limits

Definition at line 143 of file CaloSum.cxx.

146 {
147  range_map_t::const_iterator fRegion = m_regionRanges.find(theRegion);
148  if ( fRegion != m_regionRanges.end() )
149  {
150  lowEtas.resize(((*fRegion).second).size());
151  highEtas.resize(((*fRegion).second).size());
152  for ( unsigned int i=0; i<((*fRegion).second).size(); i++ )
153  {
154  lowEtas[i] = (((*fRegion).second)[i]).first;
155  highEtas[i] = (((*fRegion).second)[i]).second;
156  }
157  return true;
158  }
159  else
160  {
161  return false;
162  }
163 }

◆ getRegion() [1/2]

CaloSum::CaloRegion CaloSum::getRegion ( const_iterator theIterator)
static

Returns region for a given iterator.

Parameters
theIteratorstore iterator

Definition at line 308 of file CaloSum.cxx.

309 {
310  return ((*theIterator).first).first;
311 }

◆ getRegion() [2/2]

CaloSum::CaloRegion CaloSum::getRegion ( double  theEta) const
virtual

Retrieve region for a given eta.

Returns UnknownRegion if eta outside of all eta ranges. Returns first region in which eta is found.

Parameters
theEtaeta on input

Definition at line 124 of file CaloSum.cxx.

125 {
126  range_map_t::const_iterator fRegion = m_regionRanges.begin();
127  bool isFound = false;
128  while ( ! isFound && fRegion != m_regionRanges.end() )
129  {
130  range_cont_t::const_iterator fRange = ((*fRegion).second).begin();
131  while ( ! isFound && fRange != ((*fRegion).second).end() )
132  {
133  double lowEdge = (*fRange).first;
134  double highEdge = (*fRange).second;
135  isFound = ( lowEdge <= theEta && theEta < highEdge );
136  ++fRange;
137  }
138  ++fRegion;
139  }
140  return isFound ? (*(--fRegion)).first : UnknownRegion ;
141 }

◆ getSampling()

CaloSampling::CaloSample CaloSum::getSampling ( const_iterator theIterator)
static

Returns sampling for a given iterator.

Parameters
theIteratorstore iterator

Definition at line 314 of file CaloSum.cxx.

315 {
316  return ((*theIterator).first).second;
317 }

◆ getSums() [1/4]

bool CaloSum::getSums ( const CaloSum::CaloRegion theRegion,
const CaloSampling::CaloSample theSampling,
double  theBinnedVariable,
std::vector< double > &  theSums 
) const

Returns sums for a given key and binned variable.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theRegionregion indicator
theSamplingsampling indicator
theBinnedVariablebin index
theSumsreference to vector with running sums

Definition at line 369 of file CaloSum.cxx.

373 {
374  return this->getSums(theRegion,
375  theSampling,
376  m_binDescriptor.getIndex(theBinnedVariable),
377  theSums);
378 }

◆ getSums() [2/4]

bool CaloSum::getSums ( const CaloSum::CaloRegion theRegion,
const CaloSampling::CaloSample theSampling,
size_t  theIndex,
std::vector< double > &  theSums 
) const

Returns sums for a given key and index.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theRegionregion indicator
theSamplingsampling indicator
theIndexbin index
theSumsreference to vector with running sums

Definition at line 345 of file CaloSum.cxx.

349 {
350  // check basics
351  if ( m_binDescriptor.outOfRange(theIndex) )
352  {
353  return false;
354  }
355  // find element
356  key_t theKey = CaloSum::getKey(theRegion,theSampling);
357  store_const_iter_t theAccessor = m_sumStore.find(theKey);
358  if ( theAccessor != m_sumStore.end() )
359  {
360  theSums.resize((((*theAccessor).second)[theIndex]).size(),0.);
361  std::copy((((*theAccessor).second)[theIndex]).begin(),
362  (((*theAccessor).second)[theIndex]).end(),
363  theSums.begin());
364  return !theSums.empty();
365  }
366  return false;
367 }

◆ getSums() [3/4]

bool CaloSum::getSums ( const_iterator theIterator,
double  theBinnedVariable,
std::vector< double > &  theSums 
) const

Returns sums for a given binned variable.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
theIteratorstore iterator
theBinnedVariablebin variable value
theSumsreference to vector with running sums

Definition at line 336 of file CaloSum.cxx.

339 {
340  return this->getSums(theIterator,
341  m_binDescriptor.getIndex(theBinnedVariable),
342  theSums);
343 }

◆ getSums() [4/4]

bool CaloSum::getSums ( const_iterator theIterator,
size_t  theBinIndex,
std::vector< double > &  theSums 
) const

Returns sums for a given iterator.

Returns false if invalid iterator or index mismatch. Fills vector on successful return without clearing, i.e. sums are added as new members to the vector.

Parameters
theIteratorstore iterator
theBinIndexindex of bin
theSumsreference to vector with running sums

Definition at line 319 of file CaloSum.cxx.

322 {
323  // check index range
324  if ( m_binDescriptor.outOfRange(theIndex) )
325  {
326  return false;
327  }
328  // check sum vector
329  theSums.resize( (((*theIterator).second)[theIndex]).size(), 0. );
330  std::copy( (((*theIterator).second)[theIndex]).begin(),
331  (((*theIterator).second)[theIndex]).end(),
332  theSums.begin());
333  return !theSums.empty();
334 }

◆ getVariableRange()

bool CaloSum::getVariableRange ( double &  lowLimit,
double &  highLimit 
) const
virtual

Returs lower and upper limit of binned variable range.

Returns false if configuration incorrect, especially if lowLimit < highLimit.

Parameters
lowLimitreference to variable storing lower limit on return
highLimitreference to variable storing upper limit on return

Definition at line 186 of file CaloSum.cxx.

187 {
188  lowerLimit = m_binDescriptor.lowerBound();
189  upperLimit = m_binDescriptor.upperBound();
190  return lowerLimit < upperLimit;
191 }

◆ getVarType()

CaloSum::CaloVarType CaloSum::getVarType ( ) const
virtual

Returns binned variable type.

Definition at line 119 of file CaloSum.cxx.

120 {
121  return m_varType;
122 }

◆ setRegion() [1/2]

bool CaloSum::setRegion ( const CaloSum::CaloRegion theRegion,
const std::vector< double > &  etaLow,
const std::vector< double > &  etaHigh 
)
virtual

Configure regions.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Assigns eta ranges to a region.

Parameters
theRegionregion indicator
etaLowvector of lower eta limits
etaHighvector of upper eta limits

It is expected that both vectors have the same dimension. Otherwise ranges up to the smallest dimension will be configured.

Definition at line 94 of file CaloSum.cxx.

97 {
98  // check matching vectors
99  if ( lowEtas.size() != highEtas.size() || lowEtas.empty() )
100  {
101  return false;
102  }
103  // check on defaults
104  if ( m_defaultRanges )
105  {
106  m_regionRanges.clear();
107  m_defaultRanges = false;
108  }
109 
110  // store eta ranges
111  for (unsigned int i=0; i<lowEtas.size(); i++ )
112  {
113  range_t theRange(lowEtas[i],highEtas[i]);
114  (m_regionRanges[theRegion]).push_back(theRange);
115  }
116  return !m_regionRanges.empty();
117 }

◆ setRegion() [2/2]

bool CaloSum::setRegion ( const CaloSum::CaloRegion theRegion,
double  etaLow,
double  etaHigh 
)
virtual

Configure regions.

Assigns one eta range to a region. This method overwrites the default settings.

Parameters
theRegionregion indicator
etaLowlower eta limit
etaHighupper eta limit

Definition at line 54 of file CaloSum.cxx.

57 {
58  std::vector<double> lowEtas; lowEtas.push_back(etaLow);
59  std::vector<double> highEtas; highEtas.push_back(etaHigh);
60  return this->setRegion(theRegion,lowEtas,highEtas);
61 }

◆ setUp()

bool CaloSum::setUp ( )
protected

Set up defaults.

Definition at line 427 of file CaloSum.cxx.

428 {
429  // pre-defined ranges
430  range_t centralRange(-0.8,0.8);
431  (m_regionRanges[Central]).push_back(centralRange);
432  range_t endCapPos(0.8,2.5);
433  range_t endCapNeg(-2.5,-0.8);
434  (m_regionRanges[EndCap]).push_back(endCapPos);
435  (m_regionRanges[EndCap]).push_back(endCapNeg);
436  range_t forwardPos(2.5,5.0);
437  range_t forwardNeg(-5.0,-2.5);
438  (m_regionRanges[Forward]).push_back(forwardPos);
439  (m_regionRanges[Forward]).push_back(forwardNeg);
440  return true;
441 }

Member Data Documentation

◆ m_binDescriptor

CaloBinDescriptor<double> CaloSum::m_binDescriptor
private

Bin descriptor.

Definition at line 493 of file CaloSum.h.

◆ m_defaultRanges

bool CaloSum::m_defaultRanges
private

Process flow control: indicates default range overwrite.

Definition at line 484 of file CaloSum.h.

◆ m_numberOfSums

size_t CaloSum::m_numberOfSums
private

Store size: number of sums.

Definition at line 487 of file CaloSum.h.

◆ m_regionRanges

range_map_t CaloSum::m_regionRanges
private

Store for region ranges.

Definition at line 496 of file CaloSum.h.

◆ m_sumStore

store_t CaloSum::m_sumStore
private

Store for sums.

Definition at line 499 of file CaloSum.h.

◆ m_varType

CaloVarType CaloSum::m_varType
private

Binned variable type.

Definition at line 490 of file CaloSum.h.


The documentation for this class was generated from the following files:
CaloSum::Central
@ Central
Central region indicator.
Definition: CaloSum.h:24
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
CaloBinDescriptor::upperBinEdge
T upperBinEdge(size_t theIndex) const
Retrieve the upper bin edge of a given bin.
Definition: CaloBinDescriptor.h:190
CaloSum::data_t
std::vector< double > data_t
Data type for parallel running sums in a bin.
Definition: CaloSum.h:47
CaloBinDescriptor::outOfRange
bool outOfRange(size_t theIndex) const
Tests if given index is out of valid range.
Definition: CaloBinDescriptor.h:221
CaloSum::m_regionRanges
range_map_t m_regionRanges
Store for region ranges.
Definition: CaloSum.h:496
CaloSum::E
@ E
Energy amplitude.
Definition: CaloSum.h:35
CaloLCWConfig.theKey
string theKey
Definition: CaloLCWConfig.py:68
CaloSum::Forward
@ Forward
Forward region indicator.
Definition: CaloSum.h:26
CaloSum::EndCap
@ EndCap
Central region indicator.
Definition: CaloSum.h:25
CaloSum::key_t
std::pair< CaloRegion, CaloSampling::CaloSample > key_t
Key type for compressed storage.
Definition: CaloSum.h:44
CaloSum::UnknownType
@ UnknownType
Unknown variable type.
Definition: CaloSum.h:40
CaloSum
Container for binned sums of calorimeter variables.
Definition: CaloSum.h:18
CaloBinDescriptor::getIndex
size_t getIndex(const T &theData) const
Get the index for a iven value.
Definition: CaloBinDescriptor.h:210
CaloSum::store_iter_t
store_t::iterator store_iter_t
Store iterator type.
Definition: CaloSum.h:63
CaloSum::getSums
bool getSums(const_iterator &theIterator, size_t theBinIndex, std::vector< double > &theSums) const
Returns sums for a given iterator.
Definition: CaloSum.cxx:319
CaloSum::m_sumStore
store_t m_sumStore
Store for sums.
Definition: CaloSum.h:499
CaloSum::EtFraction
@ EtFraction
Transverse energy fraction.
Definition: CaloSum.h:39
CaloSum::EFraction
@ EFraction
Energy fraction.
Definition: CaloSum.h:37
CaloSum::begin
const_iterator begin() const
Store begin iterator.
Definition: CaloSum.cxx:297
CaloBinDescriptor< double >
python.setupRTTAlg.size
int size
Definition: setupRTTAlg.py:39
CaloSum::EDensity
@ EDensity
Energy density.
Definition: CaloSum.h:36
CaloSum::range_t
std::pair< double, double > range_t
Range type.
Definition: CaloSum.h:68
CaloBinDescriptor::lowerBound
T lowerBound() const
Retrieve the lower value range boundary.
Definition: CaloBinDescriptor.h:172
CaloSum::Em
@ Em
Electromagnetic calorimeter indicator.
Definition: CaloSum.h:27
lumiFormat.i
int i
Definition: lumiFormat.py:92
CaloSampling::CaloSample
CaloSample
Definition: Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloCell::caloDDE
const CaloDetDescrElement * caloDDE() const
get pointer to CaloDetDescrElement (data member)
Definition: CaloCell.h:305
CaloBinDescriptor::lowerBinEdge
T lowerBinEdge(size_t theIndex) const
Retrieve the lower bin edge of a given bin.
Definition: CaloBinDescriptor.h:184
CaloSum::setUp
bool setUp()
Set up defaults.
Definition: CaloSum.cxx:427
CaloSum::setRegion
virtual bool setRegion(const CaloSum::CaloRegion &theRegion, double etaLow, double etaHigh)
Configure regions.
Definition: CaloSum.cxx:54
CaloSum::UnknownRegion
@ UnknownRegion
Unknown region.
Definition: CaloSum.h:29
CaloSum::m_defaultRanges
bool m_defaultRanges
Process flow control: indicates default range overwrite.
Definition: CaloSum.h:484
CaloBinDescriptor::upperBound
T upperBound() const
Retrieve the upper value range boundary.
Definition: CaloBinDescriptor.h:178
CaloSum::m_varType
CaloVarType m_varType
Binned variable type.
Definition: CaloSum.h:490
CaloSum::getBinEdges
virtual bool getBinEdges(size_t theIndex, double &lowEdge, double &highEdge) const
Returns bin edges for a given bin.
Definition: CaloSum.cxx:193
CaloSum::bin_t
std::vector< data_t > bin_t
Bin type.
Definition: CaloSum.h:54
CondAlgsOpts.found
int found
Definition: CondAlgsOpts.py:101
CaloDetDescrElement::getSampling
CaloCell_ID::CaloSample getSampling() const
cell sampling
Definition: Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:395
CaloSum::Et
@ Et
Transverse energy amplitude.
Definition: CaloSum.h:38
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CaloSum::store_const_iter_t
store_t::const_iterator store_const_iter_t
Store const iterator type.
Definition: CaloSum.h:65
CaloSum::m_binDescriptor
CaloBinDescriptor< double > m_binDescriptor
Bin descriptor.
Definition: CaloSum.h:493
CaloSum::Had
@ Had
Hadronic calorimeter indicator.
Definition: CaloSum.h:28
CaloBinDescriptor::getNumberOfBins
size_t getNumberOfBins() const
Retrieve the number of bins.
Definition: CaloBinDescriptor.h:166
CaloSum::add
virtual bool add(const CaloCell *theCell, double theBinnedVariable, const std::vector< double > &theSummedVariables)
Add to sums.
Definition: CaloSum.cxx:234
calibdata.copy
bool copy
Definition: calibdata.py:27
CaloSum::getRegion
virtual CaloRegion getRegion(double theEta) const
Retrieve region for a given eta.
Definition: CaloSum.cxx:124
CaloSum::CaloRegion
CaloRegion
Region indicator implementation.
Definition: CaloSum.h:23
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:366
CaloSum::m_numberOfSums
size_t m_numberOfSums
Store size: number of sums.
Definition: CaloSum.h:487
CaloSum::getKey
static key_t getKey(const CaloRegion &theRegion, const CaloSampling::CaloSample &theSample)
Translate into key.
Definition: CaloSum.cxx:443