BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
extract_zdc_histo_from_reco.C
Go to the documentation of this file.
1
/*************************************************************************************
2
* Example by: Elena Litvinenko
3
* e-mail: litvin@nf.jinr.ru
4
* Version: 29-Jan-2016
5
************************************************************************************/
6
7
void
extract_zdc_histo_from_reco
(
const
char
* filename =
"reco_zdc.root"
)
8
{
9
10
Double_t
x, y, ee;
11
12
TFile
* f =
new
TFile
(filename);
13
14
TH2F
* hist_zdc_orig = (
TH2F
*)f->Get(
"HistZdcEn"
);
15
16
TChain
chain(
"cbmsim"
);
17
chain.
Add
(filename);
18
TChain
* t = &chain;
19
Int_t
n_events = t->
GetEntries
();
20
21
TClonesArray
* ELossZdcHisto_arr = 0;
22
t->
SetBranchAddress
(
"ELossZdcHisto"
, &ELossZdcHisto_arr);
23
24
TString
main_title_zdc1 = hist_zdc_orig->
GetTitle
();
25
26
Int_t
n_entries = t->
GetEntries
();
27
if
(n_entries > 8)
28
n_entries = 4;
29
30
for
(
int
i
= 0;
i
< n_entries;
i
++) {
31
32
t->
GetEntry
(
i
);
33
34
TH2F
* hist_zdc = hist_zdc_orig->
Clone
(
"hist_zdc"
);
35
36
TVectorT<float>
& v1 = *((
TVectorT<float>
*)ELossZdcHisto_arr->
At
(0));
37
hist_zdc->
Set
(v1.
GetNoElements
(), v1.
GetMatrixArray
());
38
hist_zdc->
SetEntries
(v1.
GetNoElements
());
39
hist_zdc->
SetTitle
(
Form
(
"%s (event %d)"
, main_title_zdc1.
Data
(),
i
));
40
cout << hist_zdc->
GetTitle
() <<
" "
<< hist_zdc->
GetSum
() << endl;
41
42
if
(
i
< 8)
43
new
TCanvas
();
44
hist_zdc->
Draw
(
"colz"
);
45
}
46
}
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
Double_t
double Double_t
Form
char * Form(const char *fmt,...)
TArrayF::GetSum
Stat_t GetSum() const
TArrayF::Set
void Set(Int_t n) override
TCanvas
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
TFile
TH1::SetTitle
void SetTitle(const char *title) override
TH1::Draw
void Draw(Option_t *option="") override
TH1::Clone
TObject * Clone(const char *newname="") const override
TH1::SetEntries
virtual void SetEntries(Double_t n)
TH2F
TNamed::GetTitle
const char * GetTitle() const override
TObjArray::At
TObject * At(Int_t idx) const override
TString
TString::Data
const char * Data() const
TVectorT
TVectorT::GetNoElements
Int_t GetNoElements() const
TVectorT::GetMatrixArray
Element * GetMatrixArray()
extract_zdc_histo_from_reco
void extract_zdc_histo_from_reco(const char *filename="reco_zdc.root")
Definition
extract_zdc_histo_from_reco.C:7
macro
detectors
zdc
extract_zdc_histo_from_reco.C
Generated on
for BmnRoot by
1.17.0