BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
CheckMap.C
Go to the documentation of this file.
1
using namespace
TMath
;
2
3
void
CheckMap
()
4
{
5
6
TString
name1900 =
"FieldMap_1900_extrap.root"
;
7
TFile
* file1900 =
TFile::Open
(name1900);
8
TTreeReader
reader(
"Field_map"
, file1900);
9
TTreeReaderArray<Double_t>
x(reader,
"field_points.X"
);
10
TTreeReaderArray<Double_t>
y(reader,
"field_points.Y"
);
11
TTreeReaderArray<Double_t>
z(reader,
"field_points.Z"
);
12
TTreeReaderArray<Double_t>
bx(reader,
"field_points.Bx"
);
13
TTreeReaderArray<Double_t>
by(reader,
"field_points.By"
);
14
TTreeReaderArray<Double_t>
bz(reader,
"field_points.Bz"
);
15
16
Int_t
fNx = 206;
17
Int_t
fNy = 87;
18
Int_t
fNz = 341;
19
20
TGraph
* gBy_vs_z[fNy][fNx];
21
22
Int_t
pntNumber = 0;
23
while
(reader.
Next
()) {
24
if
(pntNumber % 10000 == 0)
25
printf(
"pntNumber = %d\n"
, pntNumber);
26
27
Int_t
iz = pntNumber % fNz;
28
Int_t
ix = (pntNumber / fNz) % fNx;
29
Int_t
iy = ((pntNumber / fNz) / fNx) % fNy;
30
31
if
(iz == 0) {
32
gBy_vs_z[iy][ix] =
new
TGraph
(fNz);
33
gBy_vs_z[iy][ix]->
SetTitle
(
Form
(
"%3.2f_%3.2f"
, y[0], x[0]));
34
gBy_vs_z[iy][ix]->
SetName
(
Form
(
"%3.2f_%3.2f"
, y[0], x[0]));
35
}
36
37
gBy_vs_z[iy][ix]->
SetPoint
(iz, z[0], by[0]);
38
39
pntNumber++;
40
}
41
42
TFile
* f =
new
TFile
(
"MagFieldGraphs.root"
,
"RECREATE"
);
43
for
(
Int_t
iy = 0; iy < fNy; ++iy) {
44
for
(
Int_t
ix = 0; ix < fNx; ++ix) {
45
Bool_t
badGraph =
kFALSE
;
46
for
(
Int_t
iz = 1; iz < fNz; ++iz) {
47
if
(
Abs
(gBy_vs_z[iy][ix]->GetPointY(iz) - gBy_vs_z[iy][ix]->GetPointY(iz - 1)) > 1.0) {
48
badGraph =
kTRUE
;
49
break
;
50
}
51
}
52
if
(badGraph) {
53
cout << iy <<
" "
<< ix << endl;
54
gBy_vs_z[iy][ix]->
Write
();
55
}
56
}
57
}
58
f->Write();
59
}
Bool_t
bool Bool_t
Int_t
int Int_t
kFALSE
constexpr Bool_t kFALSE
kTRUE
constexpr Bool_t kTRUE
Form
char * Form(const char *fmt,...)
TFile
TFile::Open
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
TGraph
TGraph::SetPoint
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
TGraph::SetName
void SetName(const char *name="") override
TGraph::SetTitle
void SetTitle(const char *title="") override
TObject::Write
virtual Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
TString
TTreeReaderArray
TTreeReader
TTreeReader::Next
bool Next()
CheckMap
void CheckMap()
Definition
CheckMap.C:3
TMath
TMath::Abs
Double_t Abs(Double_t d)
install
macro
magfield
CheckMap.C
Generated on
for BmnRoot by
1.17.0