ATLAS Offline Software
PersistentAccessor.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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& 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 
41  bool save() const;
42 
43  const TTree& cellTree() const { return *m_cellTree; }
44  const TTree& eventTree() const { return *m_eventTree; }
45  const TTree& runTree() const { return *m_runTree; }
46 
47  TFile* file() const { return m_file; }
48  TString fileName() const;
49 
50  const HistoryContainer* historyContainer(unsigned int i) const;
51 
52  unsigned int nEvents() const { return m_eventTree->GetEntries(); }
53  const EventData* eventData(unsigned int i) const;
54 
55  unsigned int nRuns() const { return m_runTree->GetEntries(); }
56  const RunData* runData(unsigned int i) const;
57 
58  void add(HistoryContainer* cont);
59  void addEvent(EventData* eventData);
60  void addRun(RunData* runData);
61 
62  HistoryContainer* currentContainer() const { return m_historyCont; }
63 
64  static PersistentAccessor* merge(const std::vector<const PersistentAccessor*>& accessors, const TString& fileName);
65  static PersistentAccessor* merge(const std::vector<TString>& inputFiles, const TString& fileName);
66 
67  int getCellEntry(unsigned int i) const { return m_cellTree->GetEntry(i); }
68 
69  private:
70 
71  TTree* m_cellTree, *m_eventTree, *m_runTree;
72  mutable TFile* m_file;
75  mutable RunData* m_runData;
76  mutable std::map<unsigned int, const RunData*> m_runCache;
77  };
78 }
79 
80 #endif
RunData.h
LArSamples::PersistentAccessor::currentContainer
HistoryContainer * currentContainer() const
Definition: PersistentAccessor.h:62
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
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: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:47
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:52
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:72
LArSamples::PersistentAccessor::m_historyCont
HistoryContainer * m_historyCont
Definition: PersistentAccessor.h:73
EventData.h
LArSamples::PersistentAccessor::m_eventData
EventData * m_eventData
Definition: PersistentAccessor.h:74
LArSamples::PersistentAccessor::getCellEntry
int getCellEntry(unsigned int i) const
Definition: PersistentAccessor.h:67
HistoryContainer.h
LArSamples::PersistentAccessor::nRuns
unsigned int nRuns() const
Definition: PersistentAccessor.h:55
LArSamples::PersistentAccessor::cellTree
const TTree & cellTree() const
Definition: PersistentAccessor.h:43
LArSamples::PersistentAccessor::m_runTree
TTree * m_runTree
Definition: PersistentAccessor.h:71
LArSamples::PersistentAccessor::PersistentAccessor
PersistentAccessor(const PersistentAccessor &)
Trk::open
@ open
Definition: BinningType.h:40
LArSamples::PersistentAccessor::m_runData
RunData * m_runData
Definition: PersistentAccessor.h:75
LArSamples::HistoryContainer
Definition: HistoryContainer.h:29
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:44
xAODRootTest.accessors
dictionary accessors
Definition: xAODRootTest.py:73
LArSamples::PersistentAccessor::m_runCache
std::map< unsigned int, const RunData * > m_runCache
Definition: PersistentAccessor.h:76
LArSamples::EventData
Definition: LArCalorimeter/LArCafJobs/LArCafJobs/EventData.h:29
CellInfo.h