CbmRoot
Loading...
Searching...
No Matches
CbmTrdCheckUtil.h
Go to the documentation of this file.
1/* Copyright (C) 2020 Institut fuer Kernphysik, Goethe-Universitaet Frankfurt, Frankfurt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Etienne Bechtel [committer] */
4
5#ifndef CBMTRDCHECKUTIL_H
6#define CBMTRDCHECKUTIL_H
7
8#include "CbmTrdDigi.h"
9
10#include <FairRootManager.h>
11
12#include <TFile.h>
13#include <TH1D.h>
14#include <TH2D.h>
15#include <TH3D.h>
16#include <TProfile.h>
17#include <TProfile2D.h>
18#include <TProfile3D.h>
19
20#include <map>
21#include <string>
22#include <vector>
23
24
25class CbmTrdCheckUtil : public TObject {
26
27
28public:
32
33 CbmTrdCheckUtil(std::string readfile);
34
37 CbmTrdCheckUtil(Double_t cal, Double_t tau, Int_t mode);
38
41 CbmTrdCheckUtil(Double_t cal, Double_t tau, std::vector<Int_t> mask);
42
44 virtual ~CbmTrdCheckUtil() { ; }
45
46 // CbmTrdDigi* MakeDigi(CbmSpadicRawMessage22* raw);
47 CbmTrdDigi* MakeDigi(std::vector<Int_t> samples, Int_t channel, Int_t module, Int_t layer, ULong64_t time);
48
49 Bool_t fSet = false; // Boolean for module initialisation in simulation
50 std::map<TString, TH1D*> f1D;
51 std::map<TString, TH2D*> f2D;
52 std::map<TString, TH3D*> f3D;
53 std::map<TString, TProfile*> fProfile1D;
54 std::map<TString, TProfile2D*> fProfile2D;
55 std::map<TString, TProfile3D*> fProfile3D;
56
57 void SetSetter(Bool_t set) { fSet = set; }
58 void DumpPlots()
59 {
60 TDirectory* oldir = gDirectory;
61 TFile* outFile = FairRootManager::Instance()->GetOutFile();
62 if (outFile != NULL) {
63 outFile->cd();
64 if (!f1D.empty())
65 for (auto const& x : f1D)
66 if (x.second) x.second->Write(x.first);
67 if (!f2D.empty())
68 for (auto const& x : f2D)
69 if (x.second) x.second->Write(x.first);
70 if (!f3D.empty())
71 for (auto const& x : f3D)
72 if (x.second) x.second->Write(x.first);
73 if (!fProfile1D.empty())
74 for (auto const& x : fProfile1D)
75 if (x.second) x.second->Write(x.first);
76 if (!fProfile2D.empty())
77 for (auto const& x : fProfile2D)
78 if (x.second) x.second->Write(x.first);
79 if (!fProfile3D.empty())
80 for (auto const& x : fProfile3D)
81 if (x.second) x.second->Write(x.first);
82 }
83 gDirectory->cd(oldir->GetPath());
84 }
85
86 void CreateHist(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins = 0, Double_t ylow = 1.,
87 Double_t yhigh = 1.);
88 void CreateHist3D(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins, Double_t ylow,
89 Double_t yhigh, Int_t zbins, Double_t zlow, Double_t zhigh);
90 void CreateProfile(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins = 0, Double_t ylow = 1.,
91 Double_t yhigh = 1.);
92 void CreateProfile3D(std::string name, Int_t xbins, Double_t xlow, Double_t xhigh, Int_t ybins, Double_t ylow,
93 Double_t yhigh, Int_t zbins, Double_t zlow, Double_t zhigh);
94 void Fill(std::string name, Double_t x, Double_t y = 9999.);
95 // void FillProfile(std::string name,Double_t x,Double_t y=9999.);
96 void FillProfile(std::string name, Double_t x, Double_t y, Double_t z = 9999.);
97 void FillProfile3D(std::string name, Double_t x, Double_t y, Double_t z, Double_t w = 1.);
98 void Fill(std::string name, Double_t x, Double_t y, Double_t z);
99 void Fill3D(std::string name, Double_t x, Double_t y, Double_t z);
100 void FillW(std::string name, Double_t x, Double_t w);
101 Double_t GetCont2D(std::string name, Double_t x, Double_t y)
102 {
103 if (!f2D[name]) return 0.;
104 return f2D[name]->GetBinContent(x, y);
105 }
106 Bool_t GetSetter() { return fSet; }
107
108private:
111
112
114};
115
116#endif
CbmTrdCheckUtil()
default Constructor with messages
std::map< TString, TH1D * > f1D
std::map< TString, TH3D * > f3D
ClassDef(CbmTrdCheckUtil, 1)
CbmTrdCheckUtil operator=(const CbmTrdCheckUtil &)
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.)
void SetSetter(Bool_t set)
std::map< TString, TH2D * > f2D
void Fill(std::string name, Double_t x, Double_t y=9999.)
std::map< TString, TProfile3D * > fProfile3D
void FillW(std::string name, Double_t x, Double_t w)
CbmTrdCheckUtil(const CbmTrdCheckUtil &)
std::map< TString, TProfile * > fProfile1D
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)
std::map< TString, TProfile2D * > fProfile2D
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)
virtual ~CbmTrdCheckUtil()
Destructor.
CbmTrdDigi * MakeDigi(std::vector< Int_t > samples, Int_t channel, Int_t module, Int_t layer, ULong64_t time)
void Fill3D(std::string name, Double_t x, Double_t y, Double_t z)
void FillProfile(std::string name, Double_t x, Double_t y, Double_t z=9999.)
CbmTrdCheckUtil(Double_t cal, Double_t tau, Int_t mode)
Constructor with messages and preset reconstruction mode.
Double_t GetCont2D(std::string name, Double_t x, Double_t y)
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.)
CbmTrdCheckUtil(std::string readfile)
CbmTrdCheckUtil(Double_t cal, Double_t tau, std::vector< Int_t > mask)
Constructor with messages and selection mask.
void FillProfile3D(std::string name, Double_t x, Double_t y, Double_t z, Double_t w=1.)