ATLAS Offline Software
Loading...
Searching...
No Matches
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
10
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>
22class TH1F;
23class TH2F;
24class TH1I;
25class SCT_ID;
26
27class 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};
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
void setNumberOfLb(const int nLb)
set number of lumiblocks
void setLb(const int nLb)
set lumiblock for Lb dependent maps
int LbToMerge() const
get number of lumiblocks
void binHistograms(const int nLbMerged)
SmartIF< ITHistSvc > m_thistSvc
virtual int getNumberOfEventsInBin(const int nbin) const
get number of events in a specific bin
std::vector< TH1F * > m_phistoVector
virtual bool fillFromData()=0
fill histograms from data
int size() const
get total number of entries in the number of events histo
DeclareInterfaceID(ISCT_CalibHistoTool, 1, 0)
virtual ~ISCT_CalibHistoTool()=default
no-op destructor
void setLbToMerge(const int nLbMerge)
set number of lumiblocks
virtual bool fill(const bool fromData=false)=0
fill histograms from simulation
std::vector< TH2F * > m_phistoVector2D
virtual bool read(const std::string &fileName)=0
read histograms
int numberOfLb() const
get number of lumiblocks
const SCT_ID * m_pSCTHelper
virtual bool book()=0
book histograms
double getBinForHistogramIndex(const int bin, const int histogramIndex) const
get bin content for bin in specific histogram
std::pair< std::string, bool > retrievedTool(T &tool) const
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)