CbmRoot
Loading...
Searching...
No Matches
CbmRichDraw.h
Go to the documentation of this file.
1/* Copyright (C) 2016-2020 GSI/JINR-LIT, Darmstadt/Dubna
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Semen Lebedev, Andrey Lebedev [committer], Florian Uhlig */
4
5#ifndef RICH_CbmRichDraw
6#define RICH_CbmRichDraw
7
8
9#include "CbmRichUtil.h"
10
11#include <RtypesCore.h> // for ROOT data types
12#include <TCanvas.h> // for TCanvas
13#include <TGraph2D.h> // for TGraph2D
14#include <TH2.h> // for TH2D
15#include <TPad.h> // for gPad
16#include <TVector3.h> // for TVector3
17
18#include <vector> // for vector
19
21
22public:
23 static void DrawPmtH2(TH2* h, TCanvas* c, Bool_t usePmtBins = false)
24 {
25 if (c == nullptr) return;
26 c->Divide(1, 2);
27 c->cd(1);
28 TH2D* hUp = (TH2D*) h->Clone();
29 DrawH2(hUp);
30 if (usePmtBins) {
31 std::vector<Double_t> yPmtBins = CbmRichUtil::GetPmtHistYbins();
32 hUp->GetYaxis()->SetRange(yPmtBins.size() / 2 + 1, yPmtBins.size());
33 }
34 else {
35 hUp->GetYaxis()->SetRangeUser(120, 210);
36 }
37 hUp->GetYaxis()->SetTitleOffset(0.75);
38 hUp->GetZaxis()->SetTitleOffset(0.87);
39 gPad->SetLeftMargin(0.1);
40 gPad->SetRightMargin(0.15);
41 c->cd(2);
42 TH2D* hDown = (TH2D*) h->Clone();
43 if (usePmtBins) {
44 std::vector<Double_t> yPmtBins = CbmRichUtil::GetPmtHistYbins();
45 hDown->GetYaxis()->SetRange(0, yPmtBins.size() / 2 - 1);
46 }
47 else {
48 hDown->GetYaxis()->SetRangeUser(-210, -120);
49 }
50 DrawH2(hDown);
51 hDown->GetYaxis()->SetTitleOffset(0.75);
52 hDown->GetZaxis()->SetTitleOffset(0.87);
53 gPad->SetLeftMargin(0.1);
54 gPad->SetRightMargin(0.15);
55 }
56
57 static void DrawPmtGraph2D(TGraph2D* gUp, TGraph2D* gDown, TCanvas* c)
58 {
59 if (c == nullptr) return;
60 c->Divide(1, 2);
61 c->cd(1);
62 DrawGraph2D(gUp);
63 gUp->GetYaxis()->SetTitleOffset(0.75);
64 gUp->GetZaxis()->SetTitleOffset(0.87);
65 gPad->SetLeftMargin(0.1);
66 gPad->SetRightMargin(0.15);
67 c->cd(2);
68 DrawGraph2D(gDown);
69 gDown->GetYaxis()->SetTitleOffset(0.75);
70 gDown->GetZaxis()->SetTitleOffset(0.87);
71 gPad->SetLeftMargin(0.1);
72 gPad->SetRightMargin(0.15);
73 }
74};
75
76#endif
void DrawH2(TH2 *hist, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
void DrawGraph2D(TGraph2D *graph, HistScale logx, HistScale logy, HistScale logz, const string &drawOpt)
static void DrawPmtH2(TH2 *h, TCanvas *c, Bool_t usePmtBins=false)
Definition CbmRichDraw.h:23
static void DrawPmtGraph2D(TGraph2D *gUp, TGraph2D *gDown, TCanvas *c)
Definition CbmRichDraw.h:57
static std::vector< double > GetPmtHistYbins()
Data class with information on a STS local track.