ATLAS Offline Software
Loading...
Searching...
No Matches
LArSamples::DataStore Class Reference

storage of the time histories of all the cells More...

#include <DataStore.h>

Collaboration diagram for LArSamples::DataStore:

Public Member Functions

 DataStore ()
 Constructor.
virtual ~DataStore ()
 Destructor.
const HistoryContainerhistoryContainer (unsigned int i) const
const HistoryContainerhistoryContainerSC (unsigned int i) const
const EventDataeventData (unsigned int i) const
const RunDatarunData (unsigned int i) const
HistoryContainermakeNewHistory (const IdentifierHash &hash, CellInfo *info)
 append data (takes ownership of everything)
HistoryContainermakeNewHistorySC (const IdentifierHash &hash, CellInfo *info)
bool addData (const IdentifierHash &hash, DataContainer *data)
bool addDataSC (const IdentifierHash &hash, DataContainer *data)
unsigned int addEvent (EventData *eventData)
unsigned int addRun (RunData *eventData)
unsigned int nChannels () const
unsigned int nChannelsSC () const
unsigned int size () const
unsigned int nFilledChannels () const
unsigned int nFilledChannelsSC () const
unsigned int nEvents () const
unsigned int nRuns () const
double footprint () const
bool writeTrees (const char *fileName)

Private Member Functions

HistoryContainer *& hist_cont (unsigned int i)
HistoryContainer *& hist_cont_sc (unsigned int i)
EventData *& eventData (unsigned int i)
RunData *& runData (unsigned int i)

Private Attributes

std::vector< HistoryContainer * > m_cellHistories
std::vector< HistoryContainer * > m_cellHistoriesSC
std::vector< EventData * > m_events
std::vector< RunData * > m_runs

Friends

class ::LArShapeDumper
class D3PDConverter

Detailed Description

storage of the time histories of all the cells

Definition at line 32 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

Constructor & Destructor Documentation

◆ DataStore()

DataStore::DataStore ( )

Constructor.

Definition at line 26 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

◆ ~DataStore()

DataStore::~DataStore ( )
virtual

Destructor.

Definition at line 33 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

34{
35 for (HistoryContainer* h : m_cellHistories)
36 delete h;
37}

Member Function Documentation

◆ addData()

bool DataStore::addData ( const IdentifierHash & hash,
DataContainer * data )

Definition at line 57 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

58{
59 HistoryContainer*& histCont = hist_cont(hash);
60 histCont->add(data);
61 return true;
62}
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
HistoryContainer *& hist_cont(unsigned int i)
void add(const DataContainer *data)
append data (takes ownership)

◆ addDataSC()

bool DataStore::addDataSC ( const IdentifierHash & hash,
DataContainer * data )

Definition at line 64 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

65{
66 HistoryContainer*& histCont = hist_cont_sc(hash);
67 histCont->add(data);
68 return true;
69}
HistoryContainer *& hist_cont_sc(unsigned int i)

◆ addEvent()

unsigned int DataStore::addEvent ( EventData * eventData)

Definition at line 72 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

73{
74 m_events.push_back(eventData);
75 return nEvents() - 1;
76}
const EventData * eventData(unsigned int i) const

◆ addRun()

unsigned int DataStore::addRun ( RunData * eventData)

Definition at line 79 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

80{
81 m_runs.push_back(runData);
82 return nRuns() - 1;
83}
const RunData * runData(unsigned int i) const

◆ eventData() [1/2]

EventData *& LArSamples::DataStore::eventData ( unsigned int i)
inlineprivate

Definition at line 74 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

74{ return m_events[i]; }

◆ eventData() [2/2]

const EventData * LArSamples::DataStore::eventData ( unsigned int i) const
inline

Definition at line 44 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

44{ return m_events[i]; }

◆ footprint()

double DataStore::footprint ( ) const

Definition at line 133 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

134{
135 double fp = sizeof(*this);
136 for (unsigned int i = 0; i < nChannels(); i++) {
137 const HistoryContainer* hist = historyContainer(i);
138 if (!hist) continue;
139 fp += hist->footprint();
140 }
141
142 for (unsigned int i = 0; i < nChannelsSC(); i++) {
143 const HistoryContainer* hist = historyContainerSC(i);
144 if (!hist) continue;
145 fp += hist->footprint();
146 }
147
148 return fp;
149}
const HistoryContainer * historyContainerSC(unsigned int i) const
const HistoryContainer * historyContainer(unsigned int i) const

◆ hist_cont()

HistoryContainer *& LArSamples::DataStore::hist_cont ( unsigned int i)
inlineprivate

Definition at line 72 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

72{ return m_cellHistories[i]; }

◆ hist_cont_sc()

HistoryContainer *& LArSamples::DataStore::hist_cont_sc ( unsigned int i)
inlineprivate

Definition at line 73 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

73{ return m_cellHistoriesSC[i]; }

◆ historyContainer()

const HistoryContainer * LArSamples::DataStore::historyContainer ( unsigned int i) const
inline

Definition at line 42 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

42{ return m_cellHistories[i]; }

◆ historyContainerSC()

const HistoryContainer * LArSamples::DataStore::historyContainerSC ( unsigned int i) const
inline

Definition at line 43 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

43{ return m_cellHistoriesSC[i]; }

◆ makeNewHistory()

HistoryContainer * DataStore::makeNewHistory ( const IdentifierHash & hash,
CellInfo * info )

append data (takes ownership of everything)

Definition at line 40 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

41{
42 HistoryContainer*& histCont = hist_cont(hash);
43 if (histCont) return histCont;
44 histCont = new HistoryContainer(info);
45 return histCont;
46}

◆ makeNewHistorySC()

HistoryContainer * DataStore::makeNewHistorySC ( const IdentifierHash & hash,
CellInfo * info )

Definition at line 48 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

49{
50 HistoryContainer*& histCont = hist_cont_sc(hash);
51 if (histCont) return histCont;
52 histCont = new HistoryContainer(info);
53 return histCont;
54}

◆ nChannels()

unsigned int LArSamples::DataStore::nChannels ( ) const
inline

◆ nChannelsSC()

unsigned int LArSamples::DataStore::nChannelsSC ( ) const
inline

◆ nEvents()

unsigned int LArSamples::DataStore::nEvents ( ) const
inline

Definition at line 61 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

61{ return m_events.size(); }

◆ nFilledChannels()

unsigned int DataStore::nFilledChannels ( ) const

Definition at line 106 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

107{
108 unsigned int n = 0;
109
110 for (unsigned int i = 0; i < nChannels(); i++) {
111 const HistoryContainer* hist = historyContainer(i);
112 if (!hist) continue;
113 n++;
114 }
115
116 return n;
117}

◆ nFilledChannelsSC()

unsigned int DataStore::nFilledChannelsSC ( ) const

Definition at line 119 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

120{
121 unsigned int n = 0;
122
123 for (unsigned int i = 0; i < nChannelsSC(); i++) {
124 const HistoryContainer* hist = historyContainerSC(i);
125 if (!hist) continue;
126 n++;
127 }
128
129 return n;
130}

◆ nRuns()

unsigned int LArSamples::DataStore::nRuns ( ) const
inline

Definition at line 62 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

62{ return m_runs.size(); }

◆ runData() [1/2]

RunData *& LArSamples::DataStore::runData ( unsigned int i)
inlineprivate

Definition at line 75 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

75{ return m_runs[i]; }

◆ runData() [2/2]

const RunData * LArSamples::DataStore::runData ( unsigned int i) const
inline

Definition at line 45 of file LArCalorimeter/LArCafJobs/LArCafJobs/DataStore.h.

45{ return m_runs[i]; }

◆ size()

unsigned int DataStore::size ( ) const

Definition at line 86 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

87{
88 unsigned int size = 0;
89
90 for (unsigned int i = 0; i < nChannels(); i++) {
91 const HistoryContainer* hist = historyContainer(i);
92 if (!hist) continue;
93 size += hist->nDataContainers();
94 }
95
96 for (unsigned int i = 0; i < nChannelsSC(); i++) {
97 const HistoryContainer* hist = historyContainerSC(i);
98 if (!hist) continue;
99 size += hist->nDataContainers();
100 }
101
102 return size;
103}

◆ writeTrees()

bool DataStore::writeTrees ( const char * fileName)

Definition at line 152 of file LArCalorimeter/LArCafJobs/src/DataStore.cxx.

153{
154 PersistentAccessor* acc = new PersistentAccessor(fileName);
155
156 for (unsigned int i = 0; i < nRuns(); i++) {
157 RunData*& r = runData(i);
158 acc->addRun(r);
159 delete r; r = nullptr;
160 }
161
162 for (unsigned int i = 0; i < nEvents(); i++) {
163 EventData*& ev = eventData(i);
164 acc->addEvent(ev);
165 delete ev; ev = nullptr;
166 }
167
168 for (unsigned int i = 0; i < nChannels(); i++) {
169 HistoryContainer*& hc = hist_cont(i);
170 acc->add(hc);
171 delete hc; hc = nullptr;
172 }
173
174 for (unsigned int i = 0; i < nChannelsSC(); i++) {
175 HistoryContainer*& hc = hist_cont_sc(i);
176 acc->addSC(hc);
177 delete hc; hc = nullptr;
178 }
179
180 bool result = acc->save();
181 delete acc;
182 return result;
183}
int r
Definition globals.cxx:22
int ev
Definition globals.cxx:25

◆ ::LArShapeDumper

friend class ::LArShapeDumper
friend

◆ D3PDConverter

friend class D3PDConverter
friend

Member Data Documentation

◆ m_cellHistories

std::vector<HistoryContainer*> LArSamples::DataStore::m_cellHistories
private

◆ m_cellHistoriesSC

std::vector<HistoryContainer*> LArSamples::DataStore::m_cellHistoriesSC
private

◆ m_events

std::vector<EventData*> LArSamples::DataStore::m_events
private

◆ m_runs

std::vector<RunData*> LArSamples::DataStore::m_runs
private

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