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

DetCondCFloat is a class to hold sets of Identifiers and arrays of floats for detector element specific information Richard Hawkings, started 29/1/04 formerly DetCondFloat but renamed to DetCondCFloat to allow DetCondFloat to be a parallel virtual class with no CLASS_DEF Latter is inherited by specialised TRT conditions data classes. More...

#include <DetCondCFloat.h>

Collaboration diagram for DetCondCFloat:

Public Member Functions

 DetCondCFloat ()
 
 DetCondCFloat (const int size, const std::string &tag)
 
virtual ~DetCondCFloat ()
 
int size () const
 
const std::string & tag () const
 
int add (const Identifier &ident, const float *f)
 
void share (const Identifier &ident, const int index)
 
const float * find (const Identifier &ident) const
 
int findindex (const Identifier &ident) const
 
float get (const Identifier &ident, int k) const
 
void print () const
 
void print2 () const
 

Private Types

typedef std::less< Identifierlessp
 
typedef std::map< Identifier, int, lesspBufferMap
 

Private Attributes

int m_size
 
std::string m_tag
 
BufferMap m_bufmap
 
std::vector< float > m_buf
 

Friends

class DetCondCFloatCnv_p1
 

Detailed Description

DetCondCFloat is a class to hold sets of Identifiers and arrays of floats for detector element specific information Richard Hawkings, started 29/1/04 formerly DetCondFloat but renamed to DetCondCFloat to allow DetCondFloat to be a parallel virtual class with no CLASS_DEF Latter is inherited by specialised TRT conditions data classes.

Based on AlignableTransform but with vectors of floats of arbitrary size (at initialisation time). These objects are designed to reside in the detector store and be kept in the conditionsDB.

Methods are provided to create a new object with a float vector of a specified size, add an Identifier and associated array of floats, and to associate a new Identifier with some already stored set of floats This sharing mechanism can be used to tranparently associate one set of constants to a large number of identifiers (i.e. detector elements) and then increase the granularity later

Access to the data is provided by the find method, which returns a pointer to the floats associated with a particular identifier (or a null pointer if the identifier is not known. The index within the internal storage of a particular identifier's data can also be retrieved, for use in a subsequent call to the share method (this index is also returned by the add method). print and print2 methods print the data with varying amounts of detail

Definition at line 45 of file DetCondCFloat.h.

Member Typedef Documentation

◆ BufferMap

typedef std::map<Identifier,int,lessp> DetCondCFloat::BufferMap
private

Definition at line 68 of file DetCondCFloat.h.

◆ lessp

typedef std::less<Identifier> DetCondCFloat::lessp
private

Definition at line 67 of file DetCondCFloat.h.

Constructor & Destructor Documentation

◆ DetCondCFloat() [1/2]

DetCondCFloat::DetCondCFloat ( )
inline

Definition at line 78 of file DetCondCFloat.h.

78 : m_size(0), m_tag("null") {}

◆ DetCondCFloat() [2/2]

DetCondCFloat::DetCondCFloat ( const int  size,
const std::string &  tag 
)
inline

Definition at line 80 of file DetCondCFloat.h.

80  :
81 m_size(size), m_tag(tag) {}

◆ ~DetCondCFloat()

DetCondCFloat::~DetCondCFloat ( )
inlinevirtual

Definition at line 83 of file DetCondCFloat.h.

83 {}

Member Function Documentation

◆ add()

int DetCondCFloat::add ( const Identifier ident,
const float *  f 
)

Definition at line 13 of file DetCondCFloat.cxx.

13  {
14  // get pointer to added objects
15  size_t j=m_buf.size();
16  // add them in to the buffer
17  m_buf.resize(j+m_size);
18  for (int i=0;i<m_size;++i) m_buf[j+i]=f[i];
19  // put new map entry
20  m_bufmap[ident]=j;
21  return j;
22 }

◆ find()

const float * DetCondCFloat::find ( const Identifier ident) const

Definition at line 29 of file DetCondCFloat.cxx.

29  {
30  BufferMap::const_iterator itr=m_bufmap.find(ident);
31  if (itr!=m_bufmap.end()) {
32  // return pointer to datastructure
33  return &m_buf[itr->second];
34  } else {
35  // identifier not in map, return null pointer
36  return 0;
37  }
38 }

◆ findindex()

int DetCondCFloat::findindex ( const Identifier ident) const

Definition at line 40 of file DetCondCFloat.cxx.

40  {
41  BufferMap::const_iterator itr=m_bufmap.find(ident);
42  if (itr!=m_bufmap.end()) {
43  // return index in datastructure, for subsequent share call
44  return itr->second;
45  } else {
46  // identifier not in map, return -ve offset to signal error
47  return -1;
48  }
49 }

◆ get()

float DetCondCFloat::get ( const Identifier ident,
int  k 
) const

Definition at line 51 of file DetCondCFloat.cxx.

51  {
52  return m_buf.at(findindex(ident)+k);
53 }

◆ print()

void DetCondCFloat::print ( ) const

Definition at line 55 of file DetCondCFloat.cxx.

55  {
56  std::cout << "DetCondCFloat " << m_tag << " has granularity " << m_size <<
57  " with " << m_bufmap.size() << " entries and " << m_buf.size() <<
58  " elements" << std::endl;
59 }

◆ print2()

void DetCondCFloat::print2 ( ) const

Definition at line 61 of file DetCondCFloat.cxx.

61  {
62  print();
63  int i=0;
64  for (BufferMap::const_iterator itr=m_bufmap.begin();
65  itr!=m_bufmap.end(); ++itr,++i) {
66  int j=itr->second;
67  std::cout << "Element " << i << " ident " << (itr->first).getString() <<
68  "offset " << j << " values:";
69  for (int k=j; k<j+m_size; ++k) std::cout << " " << m_buf[k];
70  std::cout << std::endl;
71  }
72 }

◆ share()

void DetCondCFloat::share ( const Identifier ident,
const int  index 
)

Definition at line 24 of file DetCondCFloat.cxx.

24  {
25  // add object which is pointing to already existing buffer space
27 }

◆ size()

int DetCondCFloat::size ( ) const
inline

Definition at line 85 of file DetCondCFloat.h.

85 {return m_size;}

◆ tag()

const std::string & DetCondCFloat::tag ( ) const
inline

Definition at line 87 of file DetCondCFloat.h.

87 {return m_tag;}

Friends And Related Function Documentation

◆ DetCondCFloatCnv_p1

friend class DetCondCFloatCnv_p1
friend

Definition at line 63 of file DetCondCFloat.h.

Member Data Documentation

◆ m_buf

std::vector<float> DetCondCFloat::m_buf
private

Definition at line 70 of file DetCondCFloat.h.

◆ m_bufmap

BufferMap DetCondCFloat::m_bufmap
private

Definition at line 69 of file DetCondCFloat.h.

◆ m_size

int DetCondCFloat::m_size
private

Definition at line 65 of file DetCondCFloat.h.

◆ m_tag

std::string DetCondCFloat::m_tag
private

Definition at line 66 of file DetCondCFloat.h.


The documentation for this class was generated from the following files:
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
DetCondCFloat::m_buf
std::vector< float > m_buf
Definition: DetCondCFloat.h:70
DetCondCFloat::findindex
int findindex(const Identifier &ident) const
Definition: DetCondCFloat.cxx:40
DetCondCFloat::m_size
int m_size
Definition: DetCondCFloat.h:65
lumiFormat.i
int i
Definition: lumiFormat.py:92
DetCondCFloat::size
int size() const
Definition: DetCondCFloat.h:85
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
DeMoScan.index
string index
Definition: DeMoScan.py:362
DetCondCFloat::m_bufmap
BufferMap m_bufmap
Definition: DetCondCFloat.h:69
DetCondCFloat::print
void print() const
Definition: DetCondCFloat.cxx:55
DetCondCFloat::m_tag
std::string m_tag
Definition: DetCondCFloat.h:66
DetCondCFloat::tag
const std::string & tag() const
Definition: DetCondCFloat.h:87
fitman.k
k
Definition: fitman.py:528