BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
MwpcDigitsAnalysisHist.C
Go to the documentation of this file.
1
#include "
TCanvas.h
"
2
#include "
TChain.h
"
3
#include "
TClonesArray.h
"
4
#include "
TGraph.h
"
5
#include "
TH1F.h
"
6
#include "
TH2F.h
"
7
#include "
TLine.h
"
8
#include "
TMath.h
"
9
10
// #include "../../globaltracking/BmnHitFinderRun1.h"
11
12
using namespace
TMath
;
13
14
const
UInt_t
kNPLANES
= 16;
15
const
UInt_t
kNREALWIRES
= 240;
16
const
UInt_t
kNWIRES
= 256;
17
const
Int_t
Number
= 4;
18
const
Int_t
nb
= 100;
19
20
void
MwpcDigitsAnalysisHist
(
UInt_t
runId = 0)
21
{
22
// gStyle->SetOptStat(0);
23
/* Load basic libraries */
24
gROOT
->LoadMacro(
"$VMCWORKDIR/macro/run/bmnloadlibs.C"
);
25
bmnloadlibs();
// load bmn libraries
26
27
TChain
* eveTree =
new
TChain
(
"cbmsim"
);
28
TString
inName =
Form
(
"bmn_run%04d_digi.root"
, runId);
29
eveTree->
Add
(inName);
30
31
TClonesArray
* MwpcDigits;
32
TClonesArray
* MwpcHits =
new
TClonesArray
(
"BmnMwpcHit"
);
33
eveTree->
SetBranchAddress
(
"MWPC"
, &MwpcDigits);
34
35
Long64_t
nEvents = eveTree->
GetEntries
();
36
cout << nEvents << endl;
37
38
TH2F
* h_MWPC1 =
new
TH2F
(
"h_MWPC1"
,
"h_MWPC1"
, 200, -20, 20, 200, -20, 20);
39
TH2F
* h_MWPC2 =
new
TH2F
(
"h_MWPC2"
,
"h_MWPC2"
, 200, -20, 20, 200, -20, 20);
40
41
for
(
Int_t
iEv = 0; iEv < nEvents; iEv++) {
42
if
(iEv % 100 == 0)
43
cout <<
"EVENT: "
<< iEv << endl;
44
MwpcHits->
Clear
();
45
eveTree->
GetEntry
(iEv);
46
ProcessMwpcDigits(MwpcDigits, MwpcHits);
47
// cout << MwpcDigits->GetEntriesFast() << endl;
48
for
(
Int_t
iHit = 0; iHit < MwpcHits->
GetEntriesFast
(); ++iHit) {
49
BmnMwpcHit
* hit = (
BmnMwpcHit
*)MwpcHits->
At
(iHit);
50
// cout << hit->GetMwpcId() << endl;
51
if
(hit->
GetMwpcId
() == 0)
52
h_MWPC1->
Fill
(hit->GetX(), hit->GetY());
53
if
(hit->
GetMwpcId
() == 1)
54
h_MWPC2->
Fill
(hit->GetX(), hit->GetY());
55
}
56
}
57
58
TCanvas
* c_mwpc1 =
new
TCanvas
(
"mwpc1"
,
"mwpc1"
, 1000, 1000);
59
h_MWPC1->
Draw
(
"colz"
);
60
TCanvas
* c_mwpc2 =
new
TCanvas
(
"mwpc2"
,
"mwpc2"
, 1000, 1000);
61
h_MWPC2->
Draw
(
"colz"
);
62
}
Int_t
int Int_t
UInt_t
unsigned int UInt_t
Long64_t
long long Long64_t
TCanvas.h
TChain.h
TClonesArray.h
TGraph.h
TH1F.h
TH2F.h
TLine.h
TMath.h
gROOT
#define gROOT
Form
char * Form(const char *fmt,...)
BmnMwpcHit
Definition
BmnMwpcHit.h:18
BmnMwpcHit::GetMwpcId
Short_t GetMwpcId() const
Definition
BmnMwpcHit.h:32
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
TClonesArray::Clear
void Clear(Option_t *option="") override
TH1::Draw
void Draw(Option_t *option="") override
TH2F
TH2::Fill
virtual Int_t Fill(const char *namex, const char *namey, Double_t w)
TObjArray::GetEntriesFast
Int_t GetEntriesFast() const
TObjArray::At
TObject * At(Int_t idx) const override
TString
kNPLANES
const UInt_t kNPLANES
Definition
MwpcDigitsAnalysisHist.C:14
kNWIRES
const UInt_t kNWIRES
Definition
MwpcDigitsAnalysisHist.C:16
Number
const Int_t Number
Definition
MwpcDigitsAnalysisHist.C:17
kNREALWIRES
const UInt_t kNREALWIRES
Definition
MwpcDigitsAnalysisHist.C:15
nb
const Int_t nb
Definition
MwpcDigitsAnalysisHist.C:18
MwpcDigitsAnalysisHist
void MwpcDigitsAnalysisHist(UInt_t runId=0)
Definition
MwpcDigitsAnalysisHist.C:20
TMath
install
macro
raw
MwpcDigitsAnalysisHist.C
Generated on
for BmnRoot by
1.17.0