Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
PersistentAccessor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
10 #ifndef LArSamples_PersistentAccessor_H
11 #define LArSamples_PersistentAccessor_H
12 
13 #include "LArCafJobs/CellInfo.h"
15 #include "LArCafJobs/EventData.h"
16 #include "LArCafJobs/RunData.h"
17 #include "TString.h"
18 #include "TTree.h"
19 
20 class TFile;
21 
22 namespace LArSamples {
23 
25 
26  public:
27 
29  PersistentAccessor(TTree& cellTree, TTree& SCTree, TTree& eventTree, TTree* runTree, TFile* file);
30  PersistentAccessor(const TString& fileName);
31 
34 
35  static PersistentAccessor* open(const TString& fileName);
36 
37  virtual ~PersistentAccessor();
38 
39  unsigned int historySize(unsigned int i) const;
40  unsigned int historySizeSC(unsigned int i) const;
41 
42  bool save() const;
43 
44  const TTree& cellTree() const { return *m_cellTree; }
45  const TTree& SCTree() const { return *m_SCTree; }
46  const TTree& eventTree() const { return *m_eventTree; }
47  const TTree& runTree() const { return *m_runTree; }
48 
49  TFile* file() const { return m_file; }
50  TString fileName() const;
51 
52  const HistoryContainer* historyContainer(unsigned int i) const;
53  const HistoryContainer* historyContainerSC(unsigned int i) const;
54 
55  unsigned int nEvents() const { return m_eventTree->GetEntries(); }
56  const EventData* eventData(unsigned int i) const;
57 
58  unsigned int nRuns() const { return m_runTree->GetEntries(); }
59  const RunData* runData(unsigned int i) const;
60 
61  void add(HistoryContainer* cont);
62  void addSC(HistoryContainer* cont);
63  void addEvent(EventData* eventData);
64  void addRun(RunData* runData);
65 
66  HistoryContainer* currentContainer() const { return m_historyCont; }
67  HistoryContainer* currentContainerSC() const { return m_historyContSC; }
68 
69  static PersistentAccessor* merge(const std::vector<const PersistentAccessor*>& accessors, const TString& fileName);
70  static PersistentAccessor* merge(const std::vector<TString>& inputFiles, const TString& fileName);
71 
72  int getCellEntry(unsigned int i) const { return m_cellTree->GetEntry(i); }
73  int getSCEntry(unsigned int i) const { return m_SCTree->GetEntry(i); }
74 
75  private:
76 
77  TTree* m_cellTree, *m_SCTree, *m_eventTree, *m_runTree;
78  mutable TFile* m_file;
82  mutable RunData* m_runData;
83  mutable std::map<unsigned int, const RunData*> m_runCache;
84  };
85 }
86 
87 #endif
RunData.h
LArSamples::PersistentAccessor::m_SCTree
TTree * m_SCTree
Definition: PersistentAccessor.h:77
LArSamples::PersistentAccessor::currentContainer
HistoryContainer * currentContainer() const
Definition: PersistentAccessor.h:66
ATLAS_NOT_THREAD_SAFE
#define ATLAS_NOT_THREAD_SAFE
getNoisyStrip() Find noisy strips from hitmaps and write out into xml/db formats
Definition: checker_macros.h:212
columnar::operator=
AccessorTemplate & operator=(AccessorTemplate &&that)
Definition: VectorColumn.h:88
Epos_Base_Fragment.inputFiles
string inputFiles
Definition: Epos_Base_Fragment.py:18
LArSamples::PersistentAccessor
Definition: PersistentAccessor.h:24
LArSamples
Definition: AbsShape.h:24
LArSamples::PersistentAccessor::runTree
const TTree & runTree() const
Definition: PersistentAccessor.h:47
LArSamples::PersistentAccessor::SCTree
const TTree & SCTree() const
Definition: PersistentAccessor.h:45
m_file
std::unique_ptr< TFile > m_file
description: this is a custom writer for the old-school drivers that don't use an actual writer
Definition: OutputStreamData.cxx:52
LArSamples::PersistentAccessor::file
TFile * file() const
Definition: PersistentAccessor.h:49
LArSamples::PersistentAccessor::m_historyContSC
HistoryContainer * m_historyContSC
Definition: PersistentAccessor.h:80
LArSamples::RunData
Definition: RunData.h:21
checkTP.save
def save(self, fileName="./columbo.out")
Definition: checkTP.py:178
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
LArSamples::PersistentAccessor::nEvents
unsigned int nEvents() const
Definition: PersistentAccessor.h:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
file
TFile * file
Definition: tile_monitor.h:29
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
LArSamples::PersistentAccessor::m_file
TFile * m_file
Definition: PersistentAccessor.h:78
LArSamples::PersistentAccessor::m_historyCont
HistoryContainer * m_historyCont
Definition: PersistentAccessor.h:79
EventData.h
LArSamples::PersistentAccessor::m_eventData
EventData * m_eventData
Definition: PersistentAccessor.h:81
LArSamples::PersistentAccessor::getCellEntry
int getCellEntry(unsigned int i) const
Definition: PersistentAccessor.h:72
HistoryContainer.h
LArSamples::PersistentAccessor::nRuns
unsigned int nRuns() const
Definition: PersistentAccessor.h:58
LArSamples::PersistentAccessor::cellTree
const TTree & cellTree() const
Definition: PersistentAccessor.h:44
LArSamples::PersistentAccessor::PersistentAccessor
PersistentAccessor(const PersistentAccessor &)
Trk::open
@ open
Definition: BinningType.h:40
LArSamples::PersistentAccessor::m_runData
RunData * m_runData
Definition: PersistentAccessor.h:82
LArSamples::HistoryContainer
Definition: HistoryContainer.h:29
LArSamples::PersistentAccessor::currentContainerSC
HistoryContainer * currentContainerSC() const
Definition: PersistentAccessor.h:67
LArSamples::PersistentAccessor::getSCEntry
int getSCEntry(unsigned int i) const
Definition: PersistentAccessor.h:73
python.utility.LHE.merge
def merge(input_file_pattern, output_file)
Merge many input LHE files into a single output file.
Definition: LHE.py:29
LArSamples::PersistentAccessor::eventTree
const TTree & eventTree() const
Definition: PersistentAccessor.h:46
xAODRootTest.accessors
dictionary accessors
Definition: xAODRootTest.py:73
LArSamples::PersistentAccessor::m_runCache
std::map< unsigned int, const RunData * > m_runCache
Definition: PersistentAccessor.h:83
LArSamples::EventData
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/EventData.h:29
CellInfo.h