ATLAS Offline Software
Loading...
Searching...
No Matches
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 unsigned int historySizeSC (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 unsigned int nChannelsSC () 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
virtual const HistorygetSCHistory (unsigned int i) const =0
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 48 of file AbsLArCells.h.

48{ return m_pos; }

◆ cellCache()

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

Definition at line 47 of file AbsLArCells.h.

47{ return m_cellCache; }
const History * m_cellCache
Definition AbsLArCells.h:55

◆ cellHistory()

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

Reimplemented in LArSamples::Interface.

Definition at line 59 of file AbsLArCells.cxx.

60{
61 if (m_pos == i) return m_cellCache;
62 resetCache();
63 const History* history = newCellHistory(i);
64 if (!history) return nullptr;
65 m_cellCache = history;
66 m_pos = i;
67 return m_cellCache;
68}
virtual void resetCache() const
virtual const History * newCellHistory(unsigned int i) const

◆ cellInfo()

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

Definition at line 71 of file AbsLArCells.cxx.

72{
73 const CellInfo* info = cellInfoCache(i);
74 if (info) return (info->isValid() ? new CellInfo(*info) : nullptr);
75 info = getCellInfo(i);
76 if (info) m_cellInfoCache[i] = new CellInfo(*info, false);
77 //m_cellInfoCache[i] = (info ? new CellInfo(*info, false) : new CellInfo());
78 return info;
79}
std::vector< CellInfo * > m_cellInfoCache
Definition AbsLArCells.h:56
virtual const CellInfo * getCellInfo(unsigned int i) const
const CellInfo * cellInfoCache(unsigned int i) const

◆ cellInfoCache()

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

Definition at line 82 of file AbsLArCells.cxx.

83{
84 return m_cellInfoCache[i];
85}

◆ 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::MultiTreeAccessor, and LArSamples::TreeAccessor.

Definition at line 88 of file AbsLArCells.cxx.

89{
90 const History* history = this->getCellHistory(i);
91 if (!history) return nullptr;
92 if (!history->cellInfo()) { delete history; return nullptr; }
93 CellInfo* info = new CellInfo(*history->cellInfo());
94 delete history;
95 return info;
96}
virtual const History * getCellHistory(unsigned int i) const =0
const CellInfo * cellInfo() const
Definition History.h:56

◆ getSCHistory()

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

◆ historySize()

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

◆ historySizeSC()

virtual unsigned int LArSamples::Accessor::historySizeSC ( 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.

◆ nChannelsSC()

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

Definition at line 35 of file AbsLArCells.h.

◆ nEvents()

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

◆ newCellHistory()

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

Definition at line 44 of file AbsLArCells.cxx.

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

◆ 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 99 of file AbsLArCells.cxx.

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

◆ resetCache()

void AbsLArCells::resetCache ( ) const
virtualinherited

Definition at line 34 of file AbsLArCells.cxx.

35{
36 if (m_cellCache) {
37 delete m_cellCache;
38 m_cellCache = nullptr;
39 }
40 m_pos = nChannels() + 1;
41}
virtual unsigned int nChannels() const
Definition AbsLArCells.h:34

◆ resetCellInfoCache()

void AbsLArCells::resetCellInfoCache ( )
inherited

Definition at line 114 of file AbsLArCells.cxx.

115{
116 unsigned int i = 0;
117 for (std::vector<CellInfo*>::iterator cellInfo = m_cellInfoCache.begin();
118 cellInfo != m_cellInfoCache.end(); ++cellInfo, i++)
119 if (*cellInfo) {
120 delete *cellInfo;
121 *cellInfo = 0;
122 }
123}

◆ 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 55 of file AbsLArCells.h.

◆ m_cellInfoCache

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

Definition at line 56 of file AbsLArCells.h.

◆ m_pos

unsigned int LArSamples::AbsLArCells::m_pos
mutableprivateinherited

Definition at line 54 of file AbsLArCells.h.


The documentation for this class was generated from the following file: