ATLAS Offline Software
ISCT_CalibHistoTool.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #ifndef ISCT_CalibHistoTool_h
12 #define ISCT_CalibHistoTool_h
13 
14 //Gaudi includes
15 #include "GaudiKernel/IInterface.h"
16 #include "GaudiKernel/IAlgTool.h"
17 #include "GaudiKernel/ITHistSvc.h"
18 #include "GaudiKernel/ToolHandle.h"
19 #include <vector>
20 #include <string>
21 #include <utility>
22 class TH1F;
23 class TH2F;
24 class TH1I;
25 class SCT_ID;
26 
27 class ISCT_CalibHistoTool: virtual public IAlgTool {
28  public:
30 
33  virtual ~ISCT_CalibHistoTool() = default;
35  virtual bool book()=0;
37  virtual bool read(const std::string& fileName)=0;
39  virtual bool fill(const bool fromData=false)=0;
41  virtual bool fillFromData()=0;
43  virtual int getNumberOfEventsInBin(const int nbin) const;
45  int size() const;
47  double getBinForHistogramIndex(const int bin, const int histogramIndex) const;
49  int size(const int histogramIndex) const;
50  void binHistograms(const int nLbMerged);
52  void setNumberOfLb(const int nLb);
54  int numberOfLb() const;
56  void setLbToMerge(const int nLbMerge);
58  void setLb(const int nLb);
60  int LbToMerge() const;
61  protected:
62  std::vector<TH1F*> m_phistoVector;
63  std::vector<TH2F*> m_phistoVector2D;
64  TH1I* m_numberOfEventsHisto{nullptr};
65  SmartIF<ITHistSvc> m_thistSvc{nullptr};
66  const SCT_ID* m_pSCTHelper{nullptr};
67  int m_lumiBlock{0};
68  int m_nLb{0};
69  int m_nLbMerge{0};
70  //
71  bool init();
72  template<class T>
73  std::pair<std::string, bool> retrievedTool(T& tool) const {
74  if (tool.retrieve().isFailure() ) return std::make_pair(std::string{"Unable to retrieve "}+tool.name(), false);
75  return std::make_pair("", true);
76  }
77 };
78 
79 #endif
ISCT_CalibHistoTool::retrievedTool
std::pair< std::string, bool > retrievedTool(T &tool) const
Definition: ISCT_CalibHistoTool.h:73
ISCT_CalibHistoTool::m_nLb
int m_nLb
Definition: ISCT_CalibHistoTool.h:68
ISCT_CalibHistoTool::fillFromData
virtual bool fillFromData()=0
fill histograms from data
ISCT_CalibHistoTool::m_pSCTHelper
const SCT_ID * m_pSCTHelper
Definition: ISCT_CalibHistoTool.h:66
bin
Definition: BinsDiffFromStripMedian.h:43
ISCT_CalibHistoTool
Definition: ISCT_CalibHistoTool.h:27
ISCT_CalibHistoTool::m_numberOfEventsHisto
TH1I * m_numberOfEventsHisto
Definition: ISCT_CalibHistoTool.h:64
ISCT_CalibHistoTool::setLbToMerge
void setLbToMerge(const int nLbMerge)
set number of lumiblocks
Definition: ISCT_CalibHistoTool.cxx:81
ISCT_CalibHistoTool::numberOfLb
int numberOfLb() const
get number of lumiblocks
Definition: ISCT_CalibHistoTool.cxx:76
ISCT_CalibHistoTool::size
int size() const
get total number of entries in the number of events histo
Definition: ISCT_CalibHistoTool.cxx:29
ISCT_CalibHistoTool::binHistograms
void binHistograms(const int nLbMerged)
Definition: ISCT_CalibHistoTool.cxx:60
ISCT_CalibHistoTool::setLb
void setLb(const int nLb)
set lumiblock for Lb dependent maps
Definition: ISCT_CalibHistoTool.cxx:86
ISCT_CalibHistoTool::ISCT_CalibHistoTool
ISCT_CalibHistoTool()
Definition: ISCT_CalibHistoTool.cxx:18
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
ISCT_CalibHistoTool::fill
virtual bool fill(const bool fromData=false)=0
fill histograms from simulation
ISCT_CalibHistoTool::read
virtual bool read(const std::string &fileName)=0
read histograms
ISCT_CalibHistoTool::DeclareInterfaceID
DeclareInterfaceID(ISCT_CalibHistoTool, 1, 0)
ISCT_CalibHistoTool::~ISCT_CalibHistoTool
virtual ~ISCT_CalibHistoTool()=default
no-op destructor
ISCT_CalibHistoTool::LbToMerge
int LbToMerge() const
get number of lumiblocks
Definition: ISCT_CalibHistoTool.cxx:91
ISCT_CalibHistoTool::m_nLbMerge
int m_nLbMerge
Definition: ISCT_CalibHistoTool.h:69
ISCT_CalibHistoTool::init
bool init()
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
ISCT_CalibHistoTool::m_thistSvc
SmartIF< ITHistSvc > m_thistSvc
Definition: ISCT_CalibHistoTool.h:65
SCT_ID
Definition: SCT_ID.h:68
ISCT_CalibHistoTool::getBinForHistogramIndex
double getBinForHistogramIndex(const int bin, const int histogramIndex) const
get bin content for bin in specific histogram
Definition: ISCT_CalibHistoTool.cxx:47
ISCT_CalibHistoTool::setNumberOfLb
void setNumberOfLb(const int nLb)
set number of lumiblocks
Definition: ISCT_CalibHistoTool.cxx:71
ISCT_CalibHistoTool::m_phistoVector
std::vector< TH1F * > m_phistoVector
Definition: ISCT_CalibHistoTool.h:62
python.TrigEgammaMonitorHelper.TH1F
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:24
ISCT_CalibHistoTool::m_lumiBlock
int m_lumiBlock
Definition: ISCT_CalibHistoTool.h:67
ISCT_CalibHistoTool::book
virtual bool book()=0
book histograms
ISCT_CalibHistoTool::getNumberOfEventsInBin
virtual int getNumberOfEventsInBin(const int nbin) const
get number of events in a specific bin
Definition: ISCT_CalibHistoTool.cxx:22
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35
ISCT_CalibHistoTool::m_phistoVector2D
std::vector< TH2F * > m_phistoVector2D
Definition: ISCT_CalibHistoTool.h:63