BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
drawMultCorrBMN.C
Go to the documentation of this file.
1
2
#include <FairHit.h>
3
#include <
Rtypes.h
>
4
#include <
TCanvas.h
>
5
#include <
TChain.h
>
6
#include <
TClonesArray.h
>
7
#include <
TFitResultPtr.h
>
8
#include <
TGraph.h
>
9
#include <
TH2F.h
>
10
#include <
TLatex.h
>
11
#include <
TString.h
>
12
#include <
TStyle.h
>
13
14
R__ADD_INCLUDE_PATH
($VMCWORKDIR)
15
#include "macro/run/bmnloadlibs.C"
16
//
17
void
drawMultCorrBMN
(
TString
fileName =
"../run/bmndst_4699.root"
,
Int_t
nEvents = 10000)
18
{
19
bmnloadlibs();
// load libraries
20
21
TChain
* out =
new
TChain
(
"bmndata"
);
22
out->
Add
(fileName.Data());
23
24
cout <<
"#recorded entries = "
<< out->
GetEntries
() << endl;
25
26
TClonesArray
* fdHits =
nullptr
;
27
out->
SetBranchAddress
(
"BmnFdHit"
, &fdHits);
28
TClonesArray
* dchTracks =
nullptr
;
29
out->
SetBranchAddress
(
"BmnDchTrack"
, &dchTracks);
30
TClonesArray
* gemTracks =
nullptr
;
31
out->
SetBranchAddress
(
"BmnGemTrack"
, &gemTracks);
32
TClonesArray
* silTracks =
nullptr
;
33
out->
SetBranchAddress
(
"BmnSiliconTrack"
, &silTracks);
34
TClonesArray
* cscHits =
nullptr
;
35
out->
SetBranchAddress
(
"BmnCSCHit"
, &cscHits);
36
TClonesArray
* tof400Hits =
nullptr
;
37
out->
SetBranchAddress
(
"BmnTof400Hit"
, &tof400Hits);
38
TClonesArray
* tof700Hits =
nullptr
;
39
out->
SetBranchAddress
(
"BmnTof700Hit"
, &tof700Hits);
40
41
const
Int_t
nDet = 8;
42
43
TString
names[nDet] = {
"FD"
,
"SIL"
,
"GEM"
,
"CSC"
,
"TOF400"
,
"TOF700"
,
"DCH1"
,
"DCH2"
};
44
45
gStyle
->SetOptStat(0);
46
gStyle
->SetPalette(53);
//(kGreyScale);
47
48
TH2F
* hist[nDet][nDet];
49
for
(
Int_t
iDet = 0; iDet < nDet; iDet++)
50
for
(
Int_t
jDet = 0; jDet < nDet; jDet++) {
51
TString
histName = names[iDet] +
" - "
+ names[jDet];
52
hist[iDet][jDet] =
new
TH2F
(histName,
""
, 40, 0, 40, 40, 0, 40);
53
}
54
55
for
(
Int_t
iEv = 0; iEv < nEvents; iEv++) {
56
out->
GetEntry
(iEv);
57
if
(iEv % 1000 == 0)
58
printf(
"event: %d\n"
, iEv);
59
60
Int_t
nFd = (fdHits) ? fdHits->
GetEntriesFast
() : 0;
61
Int_t
nSil = (silTracks) ? silTracks->
GetEntriesFast
() : 0;
62
Int_t
nGem = (gemTracks) ? gemTracks->
GetEntriesFast
() : 0;
63
Int_t
nCsc = (cscHits) ? cscHits->
GetEntriesFast
() : 0;
64
Int_t
nTof400 = (tof400Hits) ? tof400Hits->
GetEntriesFast
() : 0;
65
Int_t
nTof700 = (tof700Hits) ? tof700Hits->
GetEntriesFast
() : 0;
66
Int_t
nDch = (dchTracks) ? dchTracks->
GetEntriesFast
() : 0;
67
Int_t
nDch1 = 0;
68
Int_t
nDch2 = 0;
69
for
(
Int_t
iTrack = 0; iTrack < dchTracks->
GetEntriesFast
(); iTrack++) {
70
BmnDchTrack
* track = (
BmnDchTrack
*)dchTracks->
At
(iTrack);
71
if
(track->
GetParamFirst
()->GetZ() < 550.0)
72
nDch1++;
73
if
(track->
GetParamFirst
()->GetZ() > 650.0)
74
nDch2++;
75
}
76
77
Int_t
nItem[nDet] = {nFd, nSil, nGem, nCsc, nTof400, nTof700, nDch1, nDch2};
78
79
for
(
Int_t
iDet = 0; iDet < nDet; iDet++)
80
for
(
Int_t
jDet = 0; jDet < nDet; jDet++)
81
hist[iDet][jDet]->Fill(nItem[jDet], nItem[iDet]);
82
}
83
84
TCanvas
* corr =
new
TCanvas
(
"corr"
,
"corr"
, 1000, 1000);
85
corr->
Divide
(nDet + 1, nDet + 1, 0, 0);
86
for
(
Int_t
iDet = 0; iDet < nDet; iDet++)
87
for
(
Int_t
jDet = 0; jDet < nDet; jDet++) {
88
Int_t
padId = (iDet + 1) * (nDet + 1) + jDet + 2;
89
TPad
* pad = (
TPad
*)corr->
cd
(padId);
90
pad->
SetGrid
(0, 0);
91
hist[iDet][jDet]->
Draw
(
"col"
);
92
hist[iDet][jDet]->
GetXaxis
()->
SetLabelSize
(0.1);
93
}
94
for
(
Int_t
iDet = 0; iDet < nDet; iDet++) {
95
corr->
cd
(iDet + 2);
96
TLatex
latexX;
97
latexX.
SetTextSize
(0.2);
98
latexX.
DrawLatex
(0.2, 0.5, names[iDet]);
99
corr->
cd
((iDet + 1) * (nDet + 1) + 1);
100
TLatex
latexY;
101
latexY.
SetTextSize
(0.2);
102
latexY.
DrawLatex
(0.2, 0.5, names[iDet]);
103
}
104
corr->
SaveAs
(
"MultCorrBMN.pdf"
);
105
}
Int_t
int Int_t
Rtypes.h
R__ADD_INCLUDE_PATH
#define R__ADD_INCLUDE_PATH(PATH)
TCanvas.h
TChain.h
TClonesArray.h
TFitResultPtr.h
TGraph.h
TH2F.h
TLatex.h
TString.h
TStyle.h
gStyle
R__EXTERN TStyle * gStyle
BmnDchTrack
Definition
BmnDchTrack.h:7
BmnTrack::GetParamFirst
FairTrackParam * GetParamFirst()
Definition
BmnTrack.h:63
TAttAxis::SetLabelSize
virtual void SetLabelSize(Float_t size=0.04)
TAttText::SetTextSize
virtual void SetTextSize(Float_t tsize=1)
TCanvas
TCanvas::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
TChain
TChain::SetBranchAddress
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
TChain::Add
virtual Int_t Add(const char *name, Long64_t nentries=TTree::kMaxEntries)
TChain::GetEntries
Long64_t GetEntries() const override
TChain::GetEntry
Int_t GetEntry(Long64_t entry=0, Int_t getall=0) override
TClonesArray
TH1::GetXaxis
TAxis * GetXaxis()
TH1::Draw
void Draw(Option_t *option="") override
TH2F
TLatex
TLatex::DrawLatex
TLatex * DrawLatex(Double_t x, Double_t y, const char *text)
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
TObjArray::At
TObject * At(Int_t idx) const override
TPad
TPad::SetGrid
void SetGrid(Int_t valuex=1, Int_t valuey=1) override
TPad::Divide
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
TPad::SaveAs
void SaveAs(const char *filename="", Option_t *option="") const override
TString
drawMultCorrBMN
void drawMultCorrBMN(TString fileName="../run/bmndst_4699.root", Int_t nEvents=10000)
Definition
drawMultCorrBMN.C:17
macro
miscellaneous
drawMultCorrBMN.C
Generated on
for BmnRoot by
1.17.0