ATLAS Offline Software
Loading...
Searching...
No Matches
LArSamples::AbsLArCells Class Referenceabstract

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

#include <AbsLArCells.h>

Inheritance diagram for LArSamples::AbsLArCells:
Collaboration diagram for LArSamples::AbsLArCells:

Public Member Functions

 AbsLArCells ()
virtual ~AbsLArCells ()
virtual std::unique_ptr< const History > newCellHistory (unsigned int i) const
virtual const History * cellHistory (unsigned int i) const
virtual std::unique_ptr< const CellInfo > cellInfo (unsigned int i) const
virtual unsigned int nChannels () const
virtual unsigned int nChannelsSC () const
virtual void resetCache () const
const CellInfo * cellInfoCache (unsigned int i) const
const History * pass (unsigned int i, const FilterParams &f) const
virtual std::unique_ptr< const History > getCellHistory (unsigned int i) const =0
virtual std::unique_ptr< const CellInfo > getCellInfo (unsigned int i) const
virtual std::unique_ptr< const History > getSCHistory (unsigned int i) const =0
const History * cellCache () const
unsigned int cachePos () const

Private Attributes

unsigned int m_pos
std::unique_ptr< const History > m_cellCache
std::vector< std::unique_ptr< CellInfo > > m_cellInfoCache

Detailed Description

A base class for accessing ntuple data.

Definition at line 25 of file AbsLArCells.h.

Constructor & Destructor Documentation

◆ AbsLArCells()

AbsLArCells::AbsLArCells ( )

Definition at line 21 of file AbsLArCells.cxx.

21 :
22 m_pos(nChannels() + 1),
24{ }
virtual unsigned int nChannels() const
Definition AbsLArCells.h:35
std::vector< std::unique_ptr< CellInfo > > m_cellInfoCache
Definition AbsLArCells.h:56

◆ ~AbsLArCells()

AbsLArCells::~AbsLArCells ( )
virtual

Definition at line 26 of file AbsLArCells.cxx.

27{
29}
virtual void resetCache() const

Member Function Documentation

◆ cachePos()

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

Definition at line 49 of file AbsLArCells.h.

49{ return m_pos; }

◆ cellCache()

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

Definition at line 48 of file AbsLArCells.h.

48{ return m_cellCache.get(); }
std::unique_ptr< const History > m_cellCache
Definition AbsLArCells.h:55

◆ cellHistory()

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

Reimplemented in LArSamples::Interface.

Definition at line 54 of file AbsLArCells.cxx.

55{
56 if (m_pos == i) return m_cellCache.get();
57 resetCache();
58 std::unique_ptr<const History> history = newCellHistory(i);
59 if (!history) return nullptr;
60 m_cellCache = std::move(history);
61 m_pos = i;
62 return m_cellCache.get();
63}
virtual std::unique_ptr< const History > newCellHistory(unsigned int i) const

◆ cellInfo()

std::unique_ptr< const CellInfo > AbsLArCells::cellInfo ( unsigned int i) const
virtual

Definition at line 66 of file AbsLArCells.cxx.

67{
68 const CellInfo* info = cellInfoCache(i);
69 if (info) {
70 if (info->isValid()) {
71 return std::make_unique<CellInfo> (*info);
72 }
73 return nullptr;
74 }
75 std::unique_ptr<const CellInfo> infop = getCellInfo(i);
76 if (infop) m_cellInfoCache[i] = std::make_unique<CellInfo>(*infop, false);
77 return infop;
78}
virtual std::unique_ptr< const CellInfo > getCellInfo(unsigned int i) const
const CellInfo * cellInfoCache(unsigned int i) const

◆ cellInfoCache()

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

Definition at line 81 of file AbsLArCells.cxx.

82{
83 return m_cellInfoCache[i].get();
84}

◆ getCellHistory()

virtual std::unique_ptr< const History > LArSamples::AbsLArCells::getCellHistory ( unsigned int i) const
pure virtual

◆ getCellInfo()

std::unique_ptr< const CellInfo > AbsLArCells::getCellInfo ( unsigned int i) const
virtual

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

Definition at line 87 of file AbsLArCells.cxx.

88{
89 std::unique_ptr<const History> history = this->getCellHistory(i);
90 if (!history) return nullptr;
91 if (!history->cellInfo()) return nullptr;
92 return std::make_unique<CellInfo>(*history->cellInfo());
93}
virtual std::unique_ptr< const History > getCellHistory(unsigned int i) const =0

◆ getSCHistory()

virtual std::unique_ptr< const History > LArSamples::AbsLArCells::getSCHistory ( unsigned int i) const
pure virtual

◆ nChannels()

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

Reimplemented in LArSamples::MonitorBase.

Definition at line 35 of file AbsLArCells.h.

◆ nChannelsSC()

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

Definition at line 36 of file AbsLArCells.h.

◆ newCellHistory()

std::unique_ptr< const History > AbsLArCells::newCellHistory ( unsigned int i) const
virtual

Definition at line 39 of file AbsLArCells.cxx.

40{
41 std::unique_ptr<const History> history = getCellHistory(i);
42 if (!history) return nullptr;
43 if (!m_cellInfoCache[i]) {
44 const CellInfo* ci=history->cellInfo();
45 if (ci) {
46 m_cellInfoCache[i]=std::make_unique<CellInfo>(*ci,false);
47 }
48 }
49 // m_cellInfoCache[i] = (history->cellInfo() ? new CellInfo(*history->cellInfo(), false) : new CellInfo());
50 return history;
51}

◆ pass()

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

Definition at line 96 of file AbsLArCells.cxx.

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

◆ resetCache()

void AbsLArCells::resetCache ( ) const
virtual

Definition at line 32 of file AbsLArCells.cxx.

33{
34 m_cellCache.reset();
35 m_pos = nChannels() + 1;
36}

Member Data Documentation

◆ m_cellCache

std::unique_ptr<const History> LArSamples::AbsLArCells::m_cellCache
mutableprivate

Definition at line 55 of file AbsLArCells.h.

◆ m_cellInfoCache

std::vector<std::unique_ptr<CellInfo> > LArSamples::AbsLArCells::m_cellInfoCache
mutableprivate

Definition at line 56 of file AbsLArCells.h.

◆ m_pos

unsigned int LArSamples::AbsLArCells::m_pos
mutableprivate

Definition at line 54 of file AbsLArCells.h.


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