ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
LArSamples::Accessor Class Referenceabstract

A base class for accessing ntuple data. More...

#include <Accessor.h>

Inheritance diagram for LArSamples::Accessor:
Collaboration diagram for LArSamples::Accessor:

Public Member Functions

 Accessor ()
 
virtual ~Accessor ()
 
virtual const EventDataeventData (unsigned int i) const =0
 
virtual const RunDatarunData (unsigned int i) const =0
 
virtual unsigned int nEvents () const =0
 
virtual unsigned int nRuns () const =0
 
virtual unsigned int historySize (unsigned int i) const =0
 
virtual bool writeToFile (const TString &fileName) const =0
 
virtual const HistorynewCellHistory (unsigned int i) const
 
virtual const HistorycellHistory (unsigned int i) const
 
virtual const CellInfocellInfo (unsigned int i) const
 
virtual unsigned int nChannels () const
 
virtual void resetCache () const
 
const CellInfocellInfoCache (unsigned int i) const
 
const Historypass (unsigned int i, const FilterParams &f) const
 
virtual const HistorygetCellHistory (unsigned int i) const =0
 
virtual const CellInfogetCellInfo (unsigned int i) const
 
const HistorycellCache () const
 
unsigned int cachePos () const
 
void resetCellInfoCache ()
 

Private Attributes

unsigned int m_pos
 
const Historym_cellCache
 
std::vector< CellInfo * > m_cellInfoCache
 

Detailed Description

A base class for accessing ntuple data.

Definition at line 24 of file LArCalorimeter/LArSamplesMon/LArSamplesMon/Accessor.h.

Constructor & Destructor Documentation

◆ Accessor()

LArSamples::Accessor::Accessor ( )
inline

Definition at line 28 of file LArCalorimeter/LArSamplesMon/LArSamplesMon/Accessor.h.

28 { }

◆ ~Accessor()

virtual LArSamples::Accessor::~Accessor ( )
inlinevirtual

Definition at line 29 of file LArCalorimeter/LArSamplesMon/LArSamplesMon/Accessor.h.

29 { }

Member Function Documentation

◆ cachePos()

unsigned int LArSamples::AbsLArCells::cachePos ( ) const
inlineinherited

Definition at line 45 of file AbsLArCells.h.

45 { return m_pos; }

◆ cellCache()

const History* LArSamples::AbsLArCells::cellCache ( ) const
inlineinherited

Definition at line 44 of file AbsLArCells.h.

44 { return m_cellCache; }

◆ cellHistory()

const History * AbsLArCells::cellHistory ( unsigned int  i) const
virtualinherited

Reimplemented in LArSamples::Interface.

Definition at line 57 of file AbsLArCells.cxx.

58 {
59  if (m_pos == i) return m_cellCache;
60  resetCache();
61  const History* history = newCellHistory(i);
62  if (!history) return nullptr;
63  m_cellCache = history;
64  m_pos = i;
65  return m_cellCache;
66 }

◆ cellInfo()

const CellInfo * AbsLArCells::cellInfo ( unsigned int  i) const
virtualinherited

Definition at line 69 of file AbsLArCells.cxx.

70 {
71  const CellInfo* info = cellInfoCache(i);
72  if (info) return (info->isValid() ? new CellInfo(*info) : nullptr);
73  info = getCellInfo(i);
74  if (info) m_cellInfoCache[i] = new CellInfo(*info, false);
75  //m_cellInfoCache[i] = (info ? new CellInfo(*info, false) : new CellInfo());
76  return info;
77 }

◆ cellInfoCache()

const CellInfo * AbsLArCells::cellInfoCache ( unsigned int  i) const
inherited

Definition at line 80 of file AbsLArCells.cxx.

81 {
82  return m_cellInfoCache[i];
83 }

◆ eventData()

virtual const EventData* LArSamples::Accessor::eventData ( unsigned int  i) const
pure virtual

◆ getCellHistory()

virtual const History* LArSamples::AbsLArCells::getCellHistory ( unsigned int  i) const
pure virtualinherited

◆ getCellInfo()

const CellInfo * AbsLArCells::getCellInfo ( unsigned int  i) const
virtualinherited

Reimplemented in LArSamples::Interface, LArSamples::MonitorBase, LArSamples::TreeAccessor, and LArSamples::MultiTreeAccessor.

Definition at line 86 of file AbsLArCells.cxx.

87 {
88  const History* history = this->getCellHistory(i);
89  if (!history) return nullptr;
90  if (!history->cellInfo()) { delete history; return nullptr; }
91  CellInfo* info = new CellInfo(*history->cellInfo());
92  delete history;
93  return info;
94 }

◆ historySize()

virtual unsigned int LArSamples::Accessor::historySize ( unsigned int  i) const
pure virtual

◆ nChannels()

virtual unsigned int LArSamples::AbsLArCells::nChannels ( ) const
inlinevirtualinherited

Reimplemented in LArSamples::MonitorBase.

Definition at line 34 of file AbsLArCells.h.

34 { return Definitions::nChannels; }

◆ nEvents()

virtual unsigned int LArSamples::Accessor::nEvents ( ) const
pure virtual

◆ newCellHistory()

const History * AbsLArCells::newCellHistory ( unsigned int  i) const
virtualinherited

Definition at line 42 of file AbsLArCells.cxx.

43 {
44  const History* history = getCellHistory(i);
45  if (!history) return nullptr;
46  if (!m_cellInfoCache[i]) {
47  const CellInfo* ci=history->cellInfo();
48  if (ci) {
49  m_cellInfoCache[i]=new CellInfo(*ci,false);
50  }
51  }
52  // m_cellInfoCache[i] = (history->cellInfo() ? new CellInfo(*history->cellInfo(), false) : new CellInfo());
53  return history;
54 }

◆ nRuns()

virtual unsigned int LArSamples::Accessor::nRuns ( ) const
pure virtual

◆ pass()

const History * AbsLArCells::pass ( unsigned int  i,
const FilterParams f 
) const
inherited

Definition at line 97 of file AbsLArCells.cxx.

98 {
99  //std::cout << "Called AbsLArCells with hash " << i << std::endl;
100  if (!f.passHash(i)) return nullptr;
101  const CellInfo* info = cellInfo(i);
102  if (!info) {
103  return nullptr;
104  }
105  //std::cout << "Called AbsLArCells::pass on a cell belonging to " << Id::str(info->calo()) << std::endl;
106  bool result = f.passCell(*info);
107  delete info;
108  return result ? cellHistory(i) : nullptr;
109 }

◆ resetCache()

void AbsLArCells::resetCache ( ) const
virtualinherited

Definition at line 32 of file AbsLArCells.cxx.

33 {
34  if (m_cellCache) {
35  delete m_cellCache;
36  m_cellCache = nullptr;
37  }
38  m_pos = nChannels() + 1;
39 }

◆ resetCellInfoCache()

void AbsLArCells::resetCellInfoCache ( )
inherited

Definition at line 112 of file AbsLArCells.cxx.

113 {
114  unsigned int i = 0;
116  cellInfo != m_cellInfoCache.end(); ++cellInfo, i++)
117  if (*cellInfo) {
118  delete *cellInfo;
119  *cellInfo = 0;
120  }
121 }

◆ runData()

virtual const RunData* LArSamples::Accessor::runData ( unsigned int  i) const
pure virtual

◆ writeToFile()

virtual bool LArSamples::Accessor::writeToFile ( const TString &  fileName) const
pure virtual

Member Data Documentation

◆ m_cellCache

const History* LArSamples::AbsLArCells::m_cellCache
mutableprivateinherited

Definition at line 52 of file AbsLArCells.h.

◆ m_cellInfoCache

std::vector<CellInfo*> LArSamples::AbsLArCells::m_cellInfoCache
mutableprivateinherited

Definition at line 53 of file AbsLArCells.h.

◆ m_pos

unsigned int LArSamples::AbsLArCells::m_pos
mutableprivateinherited

Definition at line 51 of file AbsLArCells.h.


The documentation for this class was generated from the following file:
grepfile.info
info
Definition: grepfile.py:38
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
LArSamples::AbsLArCells::m_pos
unsigned int m_pos
Definition: AbsLArCells.h:51
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
get_generator_info.result
result
Definition: get_generator_info.py:21
LArSamples::AbsLArCells::newCellHistory
virtual const History * newCellHistory(unsigned int i) const
Definition: AbsLArCells.cxx:42
LArSamples::History::cellInfo
const CellInfo * cellInfo() const
Definition: History.h:61
LArSamples::AbsLArCells::cellHistory
virtual const History * cellHistory(unsigned int i) const
Definition: AbsLArCells.cxx:57
LArSamples::History
Definition: History.h:40
LArSamples::AbsLArCells::m_cellInfoCache
std::vector< CellInfo * > m_cellInfoCache
Definition: AbsLArCells.h:53
LArSamples::AbsLArCells::cellInfo
virtual const CellInfo * cellInfo(unsigned int i) const
Definition: AbsLArCells.cxx:69
LArSamples::Definitions::nChannels
static const unsigned int nChannels
Definition: Definitions.h:14
lumiFormat.i
int i
Definition: lumiFormat.py:92
LArSamples::AbsLArCells::getCellInfo
virtual const CellInfo * getCellInfo(unsigned int i) const
Definition: AbsLArCells.cxx:86
LArSamples::AbsLArCells::getCellHistory
virtual const History * getCellHistory(unsigned int i) const =0
LArSamples::AbsLArCells::cellInfoCache
const CellInfo * cellInfoCache(unsigned int i) const
Definition: AbsLArCells.cxx:80
LArSamples::AbsLArCells::m_cellCache
const History * m_cellCache
Definition: AbsLArCells.h:52
LArSamples::CellInfo
Definition: CellInfo.h:31
LArSamples::AbsLArCells::resetCache
virtual void resetCache() const
Definition: AbsLArCells.cxx:32
LArSamples::AbsLArCells::nChannels
virtual unsigned int nChannels() const
Definition: AbsLArCells.h:34