CbmRoot
CbmTrdCheckUtil.h
Go to the documentation of this file.
1 #ifndef CBMTRDCHECKUTIL_H
2 #define CBMTRDCHECKUTIL_H
3 
4 #include "CbmTrdDigi.h"
5 #include <map>
6 #include <string>
7 #include <vector>
8 
9 #include <FairRootManager.h>
10 #include <TFile.h>
11 #include <TH1D.h>
12 #include <TH2D.h>
13 #include <TH3D.h>
14 #include <TProfile.h>
15 #include <TProfile2D.h>
16 #include <TProfile3D.h>
17 
18 
19 class CbmTrdCheckUtil : public TObject {
20 
21 
22 public:
26 
27  CbmTrdCheckUtil(std::string readfile);
28 
31  CbmTrdCheckUtil(Double_t cal, Double_t tau, Int_t mode);
32 
35  CbmTrdCheckUtil(Double_t cal, Double_t tau, std::vector<Int_t> mask);
36 
38  virtual ~CbmTrdCheckUtil() { ; }
39 
40  // CbmTrdDigi* MakeDigi(CbmSpadicRawMessage22* raw);
41  CbmTrdDigi* MakeDigi(std::vector<Int_t> samples,
42  Int_t channel,
43  Int_t module,
44  Int_t layer,
45  ULong64_t time);
46 
47  Bool_t fSet = false; // Boolean for module initialisation in simulation
48  std::map<TString, TH1D*> f1D;
49  std::map<TString, TH2D*> f2D;
50  std::map<TString, TH3D*> f3D;
51  std::map<TString, TProfile*> fProfile1D;
52  std::map<TString, TProfile2D*> fProfile2D;
53  std::map<TString, TProfile3D*> fProfile3D;
54 
55  void SetSetter(Bool_t set) { fSet = set; }
56  void DumpPlots() {
57  TDirectory* oldir = gDirectory;
58  TFile* outFile = FairRootManager::Instance()->GetOutFile();
59  if (outFile != NULL) {
60  outFile->cd();
61  if (!f1D.empty())
62  for (auto const& x : f1D)
63  if (x.second) x.second->Write(x.first);
64  if (!f2D.empty())
65  for (auto const& x : f2D)
66  if (x.second) x.second->Write(x.first);
67  if (!f3D.empty())
68  for (auto const& x : f3D)
69  if (x.second) x.second->Write(x.first);
70  if (!fProfile1D.empty())
71  for (auto const& x : fProfile1D)
72  if (x.second) x.second->Write(x.first);
73  if (!fProfile2D.empty())
74  for (auto const& x : fProfile2D)
75  if (x.second) x.second->Write(x.first);
76  if (!fProfile3D.empty())
77  for (auto const& x : fProfile3D)
78  if (x.second) x.second->Write(x.first);
79  }
80  gDirectory->cd(oldir->GetPath());
81  }
82 
83  void CreateHist(std::string name,
84  Int_t xbins,
85  Double_t xlow,
86  Double_t xhigh,
87  Int_t ybins = 0,
88  Double_t ylow = 1.,
89  Double_t yhigh = 1.);
90  void CreateHist3D(std::string name,
91  Int_t xbins,
92  Double_t xlow,
93  Double_t xhigh,
94  Int_t ybins,
95  Double_t ylow,
96  Double_t yhigh,
97  Int_t zbins,
98  Double_t zlow,
99  Double_t zhigh);
100  void CreateProfile(std::string name,
101  Int_t xbins,
102  Double_t xlow,
103  Double_t xhigh,
104  Int_t ybins = 0,
105  Double_t ylow = 1.,
106  Double_t yhigh = 1.);
107  void CreateProfile3D(std::string name,
108  Int_t xbins,
109  Double_t xlow,
110  Double_t xhigh,
111  Int_t ybins,
112  Double_t ylow,
113  Double_t yhigh,
114  Int_t zbins,
115  Double_t zlow,
116  Double_t zhigh);
117  void Fill(std::string name, Double_t x, Double_t y = 9999.);
118  // void FillProfile(std::string name,Double_t x,Double_t y=9999.);
119  void
120  FillProfile(std::string name, Double_t x, Double_t y, Double_t z = 9999.);
121  void FillProfile3D(std::string name,
122  Double_t x,
123  Double_t y,
124  Double_t z,
125  Double_t w = 1.);
126  void Fill(std::string name, Double_t x, Double_t y, Double_t z);
127  void Fill3D(std::string name, Double_t x, Double_t y, Double_t z);
128  void FillW(std::string name, Double_t x, Double_t w);
129  Double_t GetCont2D(std::string name, Double_t x, Double_t y) {
130  if (!f2D[name]) return 0.;
131  return f2D[name]->GetBinContent(x, y);
132  }
133  Bool_t GetSetter() { return fSet; }
134 
135 private:
138 
139 
141 };
142 
143 #endif
CbmTrdCheckUtil::GetCont2D
Double_t GetCont2D(std::string name, Double_t x, Double_t y)
Definition: CbmTrdCheckUtil.h:129
CbmTrdCheckUtil::FillW
void FillW(std::string name, Double_t x, Double_t w)
Definition: CbmTrdCheckUtil.cxx:167
CbmTrdCheckUtil::operator=
CbmTrdCheckUtil operator=(const CbmTrdCheckUtil &)
CbmTrdCheckUtil::GetSetter
Bool_t GetSetter()
Definition: CbmTrdCheckUtil.h:133
CbmTrdCheckUtil::f2D
std::map< TString, TH2D * > f2D
Definition: CbmTrdCheckUtil.h:49
CbmTrdCheckUtil::FillProfile3D
void FillProfile3D(std::string name, Double_t x, Double_t y, Double_t z, Double_t w=1.)
Definition: CbmTrdCheckUtil.cxx:150
CbmTrdCheckUtil::Fill3D
void Fill3D(std::string name, Double_t x, Double_t y, Double_t z)
Definition: CbmTrdCheckUtil.cxx:124
CbmTrdCheckUtil::CreateProfile3D
void CreateProfile3D(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins, Double_t ylow, Double_t yhigh, Int_t zbins, Double_t zlow, Double_t zhigh)
Definition: CbmTrdCheckUtil.cxx:90
CbmTrdCheckUtil::fProfile3D
std::map< TString, TProfile3D * > fProfile3D
Definition: CbmTrdCheckUtil.h:53
CbmTrdCheckUtil::CbmTrdCheckUtil
CbmTrdCheckUtil()
default Constructor with messages
Definition: CbmTrdCheckUtil.cxx:21
CbmTrdDigi.h
CbmTrdCheckUtil::CbmTrdCheckUtil
CbmTrdCheckUtil(Double_t cal, Double_t tau, Int_t mode)
Constructor with messages and preset reconstruction mode.
CbmTrdCheckUtil::CreateHist
void CreateHist(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins=0, Double_t ylow=1., Double_t yhigh=1.)
Definition: CbmTrdCheckUtil.cxx:33
CbmTrdCheckUtil::Fill
void Fill(std::string name, Double_t x, Double_t y=9999.)
Definition: CbmTrdCheckUtil.cxx:114
CbmTrdCheckUtil::f1D
std::map< TString, TH1D * > f1D
Definition: CbmTrdCheckUtil.h:48
CbmTrdCheckUtil::~CbmTrdCheckUtil
virtual ~CbmTrdCheckUtil()
Destructor.
Definition: CbmTrdCheckUtil.h:38
CbmTrdCheckUtil::fProfile2D
std::map< TString, TProfile2D * > fProfile2D
Definition: CbmTrdCheckUtil.h:52
CbmTrdCheckUtil::fProfile1D
std::map< TString, TProfile * > fProfile1D
Definition: CbmTrdCheckUtil.h:51
CbmTrdCheckUtil::CreateProfile
void CreateProfile(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins=0, Double_t ylow=1., Double_t yhigh=1.)
Definition: CbmTrdCheckUtil.cxx:73
CbmTrdCheckUtil::fSet
Bool_t fSet
Definition: CbmTrdCheckUtil.h:47
CbmTrdCheckUtil
Definition: CbmTrdCheckUtil.h:19
CbmTrdCheckUtil::CreateHist3D
void CreateHist3D(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins, Double_t ylow, Double_t yhigh, Int_t zbins, Double_t zlow, Double_t zhigh)
Definition: CbmTrdCheckUtil.cxx:49
CbmTrdCheckUtil::SetSetter
void SetSetter(Bool_t set)
Definition: CbmTrdCheckUtil.h:55
x
Double_t x
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdCheckUtil::CbmTrdCheckUtil
CbmTrdCheckUtil(std::string readfile)
y
Double_t y
Definition: CbmMvdSensorDigiToHitTask.cxx:68
CbmTrdDigi
Definition: CbmTrdDigi.h:14
CbmTrdCheckUtil::f3D
std::map< TString, TH3D * > f3D
Definition: CbmTrdCheckUtil.h:50
CbmTrdCheckUtil::CbmTrdCheckUtil
CbmTrdCheckUtil(const CbmTrdCheckUtil &)
CbmTrdCheckUtil::CbmTrdCheckUtil
CbmTrdCheckUtil(Double_t cal, Double_t tau, std::vector< Int_t > mask)
Constructor with messages and selection mask.
CbmTrdCheckUtil::ClassDef
ClassDef(CbmTrdCheckUtil, 1)
CbmTrdCheckUtil::FillProfile
void FillProfile(std::string name, Double_t x, Double_t y, Double_t z=9999.)
Definition: CbmTrdCheckUtil.cxx:137
CbmTrdCheckUtil::DumpPlots
void DumpPlots()
Definition: CbmTrdCheckUtil.h:56
CbmTrdCheckUtil::MakeDigi
CbmTrdDigi * MakeDigi(std::vector< Int_t > samples, Int_t channel, Int_t module, Int_t layer, ULong64_t time)