BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
EmbDstView.C
Go to the documentation of this file.
1
/**
2
* Macro for tracks versions comparison
3
*/
4
R__ADD_INCLUDE_PATH
($VMCWORKDIR)
5
6
#if !defined(__CLING__) || defined(__MAKECLING__)
7
8
#include <BmnGlobalTrack.h>
9
#include <BmnHit.h>
10
#include <CbmMCTrack.h>
11
#include <DstEventHeader.h>
12
#include <FairMCEventHeader.h>
13
#include <FairMCPoint.h>
14
#include <FairTrackParam.h>
15
#include <
Rtypes.h
>
16
#include <
TCanvas.h
>
17
#include <
TChain.h
>
18
#include <
TClass.h
>
19
#include <
TClonesArray.h
>
20
#include <
TDatime.h
>
21
#include <
TF1.h
>
22
#include <
TFile.h
>
23
#include <
TH1.h
>
24
#include <
TH2.h
>
25
#include <
TMath.h
>
26
#include <
TPad.h
>
27
#include <
TROOT.h
>
28
#include <
TString.h
>
29
#include <
TStyle.h
>
30
#include <
TTree.h
>
31
#include <
TVirtualPad.h
>
32
#include <
csc/BmnCSCStationSet.h
>
33
#include <
gem/BmnGemStripStationSet.h
>
34
#include <ncurses.h>
35
#include <
silicon/BmnSiliconStationSet.h
>
36
// #include <BmnHist.h>
37
#include <physics/bmnrecotools/BmnRecoTools.h>
38
39
#else
40
#include "bmnloadlibs.C"
41
#include "gconfig/basiclibs.C"
42
43
#endif
44
45
// #define PAD_WIDTH_EMB 1920
46
// #define PAD_HEIGHT_EMB 1200
47
#define PAD_WIDTH_EMB 1200
48
#define PAD_HEIGHT_EMB 700
49
#define ROWS 2
50
#define COLS 3
51
#define EV_LIMIT 4
52
using namespace
std
;
53
using namespace
TMath
;
54
55
void
EmbDstView
()
56
{
57
#if !(!defined(__CLING__) || defined(__MAKECLING__))
58
bmnloadlibs();
// load BmnRoot libraries
59
#endif
60
gStyle
->SetOptStat(1);
61
const
Int_t
nColors = 16;
62
Int_t
ColorMap[nColors] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 49, 11, 12, 13, 14, 15, 16};
63
Int_t
runID = 4649;
64
Int_t
fPeriodID = 7;
65
const
Int_t
boxWidth = 40;
66
const
Int_t
boxHeigth = 200;
67
const
Int_t
Bins = 400;
68
// TString inFileNameEve = "eve-p-nofield.root";
69
TString
inFileNameEve =
Form
(
"eve-%d-isAll-nocurl.root"
, runID);
70
TString
inFileNameDigi =
Form
(
"../run/bmn_run%d_digi.root"
, runID);
71
TString
inFileNameEmb =
Form
(
"../run/dst-%d.root"
, runID);
72
TString
inFileNameAna =
Form
(
"../run/an-%d.root"
, runID);
73
// TString inFileNameEmb = Form("dst-%d-emb-qgsm-4h-isAll-nocurl-BaseOff.root", runID);
74
75
// TString fnames[COLS] = {inFileNameEve, inFileNameBase, inFileNameEmb};
76
TString
fnames[
COLS
] = {inFileNameEve, inFileNameDigi, inFileNameEmb};
77
TString
treeNames[
COLS
] = {
"bmndata"
,
"bmndata"
,
"bmndata"
};
//{"BMN_DIGIT", "cbmsim", "cbmsim"};
78
TString
EHNames[
COLS
] = {
"MCEventHeader."
,
"BmnEventHeader."
,
"DstEventHeader."
};
79
TClass
* EHClasses[
COLS
] = {FairMCEventHeader::Class(), BmnEventHeader::Class(), DstEventHeader::Class()};
80
TString
hitNames[
COLS
] = {
"StsPoint"
,
"BmnInnerHits"
,
"BmnInnerHits"
};
81
TString
trackNames[
COLS
] = {
"MCTrack"
,
"BmnGlobalTrack"
,
"BmnGlobalTrack"
};
82
TString
hitNamesGEM[
COLS
] = {
"StsPoint"
,
"BmnGemStripHit"
,
"BmnGemStripHit"
};
83
TString
hitNamesSil[
COLS
] = {
"SiliconPoint"
,
"BmnSiliconHit"
,
"BmnSiliconHit"
};
84
TString
hitNamesCSC[
COLS
] = {
"CSCPoint"
,
"BmnCSCHit"
,
"BmnCSCHit"
};
85
TString
strVertex =
"BmnVertex"
;
86
TFile
* files[
COLS
] = {NULL};
87
TTree
* trees[
COLS
] = {NULL};
88
FairMCEventHeader
* MCEH = NULL;
89
TNamed
* EHs[
COLS
] = {NULL};
90
TClonesArray
* hits[
COLS
] = {NULL};
91
TClonesArray
* tracks[
COLS
] = {NULL};
92
TClonesArray
* silTrack[
COLS
] = {NULL};
93
TClonesArray
* gemTrack[
COLS
] = {NULL};
94
TClonesArray
* silHits[
COLS
] = {NULL};
95
TClonesArray
* cscHits[
COLS
] = {NULL};
96
TClonesArray
* gemHits[
COLS
] = {NULL};
97
TClonesArray
* vertex = NULL;
98
TClonesArray
* tqdc_bc1 = NULL;
99
TClonesArray
* tqdc_bc2 = NULL;
100
// TCanvas* can = new TCanvas("canHits", "", PAD_WIDTH_EMB * 1, PAD_HEIGHT_EMB * ROWS);
101
// can->Divide(1, ROWS);
102
103
/** Open exp files */
104
for
(
Int_t
i
= 1;
i
<
COLS
;
i
++) {
105
files[
i
] =
new
TFile
(fnames[
i
],
"READ"
);
106
if
(files[
i
]->IsOpen() ==
kTRUE
) {
107
trees[
i
] = (
TTree
*)files[
i
]->Get(treeNames[
i
]);
108
printf(
"file %s contains %lld events\n"
, fnames[
i
].Data(), trees[
i
]->GetEntries());
109
}
else
{
110
fprintf(stderr,
"file %s open error\n"
, fnames[
i
].Data());
111
continue
;
112
// return;
113
}
114
trees[
i
]->
SetBranchAddress
(EHNames[
i
], &EHs[
i
]);
115
}
116
MCEH = (
FairMCEventHeader
*)EHs[0];
117
118
const
UInt_t
nEvs = trees[2]->
GetEntries
();
119
120
trees[1]->
SetBranchAddress
(
"TQDC_BC1"
, &tqdc_bc1);
121
trees[1]->
SetBranchAddress
(
"TQDC_BC2"
, &tqdc_bc2);
122
trees[2]->
SetBranchAddress
(strVertex, &vertex);
123
124
TCanvas
* canDST =
new
TCanvas
(
"canCut"
,
""
,
PAD_WIDTH_EMB
* 2,
PAD_HEIGHT_EMB
* 2);
125
canDST->
Divide
(2, 2);
126
// TString n = "Vertex-BC1";
127
// TH2D* hvc1 = new TH2D(n.Data(), n.Data(), PAD_HEIGHT_EMB, 0, 2200, PAD_WIDTH_EMB, -4, 4);
128
// n = "Vertex-BC1-notFound";
129
// TH2D* hvc1Fail = new TH2D(n.Data(), n.Data(), PAD_HEIGHT_EMB, 0, 2200, 5, -1002, -998);
130
// n = "Vertex-BC2";
131
// TH2D* hvc2 = new TH2D(n.Data(), n.Data(), PAD_HEIGHT_EMB, 0, 2200, PAD_WIDTH_EMB, -4, 4);
132
// n = "Vertex-BC2-notFound";
133
// TH2D* hvc2Fail = new TH2D(n.Data(), n.Data(), PAD_HEIGHT_EMB, 0, 2200, 5, -1002, -998);
134
135
// UInt_t iTreeDST = 2;
136
// Long64_t iExpEvent = -1;
137
// for (Int_t iEv = 0; iEv < nEvs; iEv++) {
138
// DrawBar(iEv, nEvs);
139
// trees[iTreeDST]->GetEntry(iEv);
140
// UInt_t EventId = ((DstEventHeader*)EHs[iTreeDST])->GetEventId();
141
//// printf("iEv = %d EventId = %u \n", iEv, EventId);
142
// UInt_t i = 1;
143
// while (iExpEvent < nEvs) {
144
// // printf("iExpEvent %lld\n", iExpEvent);
145
// trees[i]->GetEntry(++iExpEvent);
146
//// printf("EHs[%lld]->GetEventId() = %u \n", iExpEvent, ((BmnEventHeader*)EHs[i])->GetEventId());
147
// if (EventId == ((BmnEventHeader*)EHs[i])->GetEventId())
148
// break;
149
// if (EventId < ((BmnEventHeader*)EHs[i])->GetEventId()) {
150
//// printf("\n%d tree %u event lost!\n", i, EventId);
151
// break;
152
// }
153
// }
154
// Double_t vz = 0.0;
155
// Double_t peak1 = 0.0;
156
// Double_t peak2 = 0.0;
157
// for (Int_t iTrack = 0; iTrack < vertex->GetEntriesFast(); iTrack++) {
158
// CbmVertex* v = (CbmVertex*) vertex->UncheckedAt(iTrack);
159
// vz = v->GetZ();
160
// }
161
//// printf("tqdc_bc1->GetEntriesFast() = %d\n", tqdc_bc1->GetEntriesFast());
162
// for (Int_t iTrack = 0; iTrack < tqdc_bc1->GetEntriesFast(); iTrack++) {
163
// BmnTrigWaveDigit* dig = (BmnTrigWaveDigit*) tqdc_bc1->UncheckedAt(iTrack);
164
// peak1 = dig->GetPeak();
165
// }
166
// for (Int_t iTrack = 0; iTrack < tqdc_bc2->GetEntriesFast(); iTrack++) {
167
// BmnTrigWaveDigit* dig = (BmnTrigWaveDigit*) tqdc_bc2->UncheckedAt(iTrack);
168
// peak2 = dig->GetPeak();
169
// }
170
//// printf("\t\tvz = %f peak = %f\n", vz , peak);
171
// hvc1->Fill(peak1, vz);
172
// hvc2->Fill(peak2, vz);
173
// hvc1Fail->Fill(peak1, vz);
174
// hvc2Fail->Fill(peak2, vz);
175
// }
176
// canDST->cd(1);
177
// hvc1->Draw("colz");
178
// canDST->cd(2);
179
// hvc2->Draw("colz");
180
// canDST->cd(3);
181
// hvc1Fail->Draw("colz");
182
// canDST->cd(4);
183
// hvc2Fail->Draw("colz");
184
185
// canDST->Divide(1, ROWS);
186
// trees[2]->SetName("df");
187
TFriendElement
* fel = trees[2]->
AddFriend
(treeNames[0], inFileNameEmb);
// DST tree
188
TFriendElement
* fAna = trees[2]->
AddFriend
(treeNames[0], inFileNameAna);
189
// TFriendElement * fel = trees[0]->AddFriend(trees[2], "fa");
190
printf(
"friend element %s\n"
, fel->
GetTreeName
());
191
// printf("friend element %s\n", fAna->GetTreeName());
192
// trees[0]->Draw("fa.ParticlePair.fInvMass", "fa.EventHeader.fEventId==bmndata.BmnEventHeader.fEventId");
193
194
/** BC1 ADC amplitude vs Inv Mass diagram */
195
canDST->
cd
(1);
196
trees[2]->
Draw
(
"DstEventHeader.GetADC1():ParticlePair.fInvMass"
,
197
"DstEventHeader.GetADC1() > 0 && ParticlePair.fInvMass > 1.08 && ParticlePair.fInvMass < 1.22"
,
198
"colz"
);
199
200
/** BC1 ADC amplitude vs Q/p */
201
canDST->
cd
(2);
202
trees[2]->
Draw
(
"DstEventHeader.GetADC1():BmnGemTrack.fParamFirst.fQp"
,
"DstEventHeader.GetADC1() > 0"
,
"colz"
);
203
204
canDST->
cd
(3);
205
trees[2]->
Draw
(
"ParticlePair.fInvMass"
,
"ParticlePair.fInvMass > 1.08 && ParticlePair.fInvMass < 1.22"
,
""
);
206
trees[2]->
Draw
(
"ParticlePair.fInvMass"
,
207
"ParticlePair.fInvMass > 1.08 && ParticlePair.fInvMass < 1.22 && DstEventHeader.GetADC1() > 1200 && "
208
"DstEventHeader.GetADC1() < 1600"
,
209
"same"
);
210
211
canDST->
cd
(4);
212
trees[2]->
Draw
(
"BmnGemTrack.fParamFirst.fQp"
,
"DstEventHeader.fADC1 > 0"
,
""
);
213
trees[2]->
Draw
(
"BmnGemTrack.fParamFirst.fQp"
,
214
"DstEventHeader.GetADC1() > 0 && DstEventHeader.GetADC1() > 1200 && DstEventHeader.GetADC1() < 1600"
,
215
"same"
);
216
217
canDST->
Update
();
218
canDST->
Modified
();
219
canDST->
SaveAs
(
Form
(
"can-%d-cut-adc.pdf"
, runID));
220
canDST->
SaveAs
(
Form
(
"can-%d-cut-adc.png"
, runID));
221
222
return
;
223
}
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
UInt_t
unsigned int UInt_t
kTRUE
constexpr Bool_t kTRUE
Rtypes.h
R__ADD_INCLUDE_PATH
#define R__ADD_INCLUDE_PATH(PATH)
COLS
#define COLS
Definition
EmbDstView.C:50
TCanvas.h
TChain.h
TClass.h
TClonesArray.h
TDatime.h
TF1.h
TFile.h
TH1.h
TH2.h
TMath.h
TPad.h
TROOT.h
TString.h
Form
char * Form(const char *fmt,...)
TStyle.h
gStyle
R__EXTERN TStyle * gStyle
TTree.h
TVirtualPad.h
FairMCEventHeader
TCanvas
TCanvas::cd
TVirtualPad * cd(Int_t subpadnumber=0) override
TCanvas::Update
void Update() override
TClass
TClonesArray
TFile
TFriendElement
TFriendElement::GetTreeName
virtual const char * GetTreeName() const
TNamed
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::Modified
void Modified(Bool_t flag=true) override
TPad::SaveAs
void SaveAs(const char *filename="", Option_t *option="") const override
TString
TTree
TTree::AddFriend
virtual TFriendElement * AddFriend(const char *treename, const char *filename="")
TTree::GetEntries
virtual Long64_t GetEntries() const
TTree::Draw
virtual Long64_t Draw(const char *varexp, const char *selection, Option_t *option="", Long64_t nentries=kMaxEntries, Long64_t firstentry=0)
TTree::SetBranchAddress
Int_t SetBranchAddress(const char *bname, T **add, TBranch **ptr=nullptr)
BmnCSCStationSet.h
BmnGemStripStationSet.h
BmnSiliconStationSet.h
EmbDstView
void EmbDstView()
Definition
EmbDstView.C:55
PAD_HEIGHT_EMB
#define PAD_HEIGHT_EMB
Definition
EmbDstView.C:48
PAD_WIDTH_EMB
#define PAD_WIDTH_EMB
Macro for tracks versions comparison.
Definition
EmbDstView.C:47
TMath
std
Definition
json.hpp:4446
install
macro
recotools
EmbDstView.C
Generated on
for BmnRoot by
1.17.0