Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AculUtils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pavel Sharov
AculUtils
Commits
8bd7b5f0
Commit
8bd7b5f0
authored
Oct 24, 2016
by
Vratislav Chudoba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Probably all functionality of CsI calibration works in newArch.
parent
33892834
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
390 additions
and
36 deletions
+390
-36
AculCalPars.h
AculCalib/AculCalPars.h
+11
-7
AculCalParsScint.cpp
AculCalib/AculCalParsScint.cpp
+31
-2
AculCalParsScint.h
AculCalib/AculCalParsScint.h
+3
-1
AculCalib.cpp
AculCalib/AculCalib.cpp
+15
-0
AculCalib.h
AculCalib/AculCalib.h
+2
-0
AculCalibScint.cpp
AculCalib/AculCalibScint.cpp
+281
-10
AculCalibScint.h
AculCalib/AculCalibScint.h
+30
-13
calibrationSQ13Alpha.cxx
macros/calibration_CsI/calibrationSQ13Alpha.cxx
+1
-0
parTest.cxx
macros/myMacros/parTest.cxx
+16
-3
No files found.
AculCalib/AculCalPars.h
View file @
8bd7b5f0
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
#include "TString.h"
#include "TString.h"
#include "TArrayD.h"
#include "TArrayD.h"
#include "TArrayI.h"
#include "TArrayI.h"
#include "TCutG.h"
//todo ommit this constant
//todo ommit this constant
#define NOCALFILES 5
#define NOCALFILES 5
...
@@ -58,17 +59,20 @@ public:
...
@@ -58,17 +59,20 @@ public:
//getters
//getters
const
char
*
GetParFileName
()
{
return
fParFileName
.
Data
();}
const
char
*
GetParFileName
()
{
return
fParFileName
.
Data
();}
// Int_t GetNoCrystals() {return fNoCrystals;}
// Int_t GetNoCrystals() {return fNoCrystals;}
// const char* GetDetName() {return fDetName.Data()
;}
virtual
const
char
*
GetDetName
()
{
return
0
;}
// const char* GetParticleName() {return fPartName.Data()
;}
virtual
const
char
*
GetParticleName
()
{
return
0
;}
virtual
Int_t
GetNoRawFiles
()
{
return
0
;};
virtual
Int_t
GetNoRawFiles
()
{
return
0
;};
virtual
const
char
*
GetFileName
(
Int_t
i
)
{
return
0
;};
virtual
const
char
*
GetFileName
(
Int_t
i
)
{
return
0
;};
// const char* GetCutName(Int_t i);
// const char* GetCutName(Int_t i);
// Int_t GetNoEPoints() {return fEnergyPoints
;}
virtual
Int_t
GetNoEPoints
()
{
return
0
;}
// Double_t GetCalEnergy(Int_t i)
;
virtual
Double_t
GetCalEnergy
(
Int_t
i
)
{
return
0
.;}
;
virtual
const
char
*
GetCutsFileName
()
{
return
0
;}
virtual
const
char
*
GetCutsFileName
()
{
return
0
;}
Int_t
GetNoCuts
()
{
return
0
;}
virtual
Int_t
GetNoCuts
()
{
return
0
;}
// Int_t GetMinChannel(Int_t energy, Int_t crystal);
virtual
TCutG
*
GetCut
(
Int_t
i
)
{
return
0
;};
// Int_t GetMaxChannel(Int_t energy, Int_t crystal);
virtual
TCutG
*
GetCut
(
const
char
*
cutName
)
{
return
0
;};
// virtual TCutG* GetCutName(Int_t i) {return 0;};
virtual
Int_t
GetMinChannel
(
Int_t
energy
,
Int_t
crystal
)
{
return
0
;};
virtual
Int_t
GetMaxChannel
(
Int_t
energy
,
Int_t
crystal
)
{
return
0
;};
void
SetParFileName
(
const
char
*
parFile
)
{
fParFileName
=
parFile
;}
void
SetParFileName
(
const
char
*
parFile
)
{
fParFileName
=
parFile
;}
...
...
AculCalib/AculCalParsScint.cpp
View file @
8bd7b5f0
...
@@ -204,6 +204,32 @@ const char* AculCalParsScint::GetCutName(Int_t i) {
...
@@ -204,6 +204,32 @@ const char* AculCalParsScint::GetCutName(Int_t i) {
return
fCutName
[
i
].
Data
();
return
fCutName
[
i
].
Data
();
}
}
TCutG
*
AculCalParsScint
::
GetCut
(
Int_t
i
)
{
if
(
i
>=
(
Int_t
)
fCuts
.
size
()
)
{
cerr
<<
"
\"
AculCalParsScint::GetCut
\"
index i cannot be higher than "
<<
fCuts
.
size
()
-
1
<<
endl
;
return
0
;
}
return
&
fCuts
[
i
];
}
TCutG
*
AculCalParsScint
::
GetCut
(
const
char
*
cutName
)
{
// TClonesArray cutsCol;
//
// for (Int_t i = 0; i < nCuts; i++) {
// cutsCol[i] = (TCutG*)fCuts->Get(cutNames[i]);
// }
const
TString
cName
=
cutName
;
for
(
Int_t
i
=
0
;
i
<=
(
Int_t
)
fCuts
.
size
();
i
++
)
{
if
(
cName
.
EqualTo
(
fCutName
[
i
]))
{
return
&
fCuts
[
i
];
}
}
cerr
<<
"
\"
AculCalParsScint::GetCut
\"
cut
\"
"
<<
cutName
<<
"
\"
was not found."
<<
endl
;
return
0
;
}
Double_t
AculCalParsScint
::
GetCalEnergy
(
Int_t
i
)
{
Double_t
AculCalParsScint
::
GetCalEnergy
(
Int_t
i
)
{
if
(
i
>
(
Int_t
)
fE
.
size
()
-
1
)
{
if
(
i
>
(
Int_t
)
fE
.
size
()
-
1
)
{
...
@@ -262,9 +288,12 @@ void AculCalParsScint::LoadCuts() {
...
@@ -262,9 +288,12 @@ void AculCalParsScint::LoadCuts() {
for
(
Int_t
i
=
0
;
i
<
(
Int_t
)
fCutName
.
size
();
i
++
)
{
for
(
Int_t
i
=
0
;
i
<
(
Int_t
)
fCutName
.
size
();
i
++
)
{
TCutG
*
currentCut
=
(
TCutG
*
)
cutFile
.
Get
(
fCutName
[
i
]);
TCutG
*
currentCut
=
(
TCutG
*
)
cutFile
.
Get
(
fCutName
[
i
]);
if
(
currentCut
)
{
if
(
!
currentCut
)
{
fCuts
.
push_back
(
*
currentCut
);
cout
<<
"
\"
AculCalParsScint::LoadCuts
\"
Cut
\"
"
<<
fCutName
[
i
]
<<
"
\"
was not found in file "
<<
fCutsFileName
<<
"."
<<
endl
;
continue
;
}
}
fCuts
.
push_back
(
*
currentCut
);
}
}
}
}
AculCalib/AculCalParsScint.h
View file @
8bd7b5f0
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#define ACULCALIB_ACULCALPARSSCINT_H_
#define ACULCALIB_ACULCALPARSSCINT_H_
#include "AculCalPars.h"
#include "AculCalPars.h"
#include "TCutG.h"
//
#include "TCutG.h"
using
std
::
cerr
;
using
std
::
cerr
;
...
@@ -60,6 +60,8 @@ public:
...
@@ -60,6 +60,8 @@ public:
Double_t
GetCalEnergy
(
Int_t
i
);
Double_t
GetCalEnergy
(
Int_t
i
);
const
char
*
GetCutsFileName
()
{
return
fCutsFileName
.
Data
();}
const
char
*
GetCutsFileName
()
{
return
fCutsFileName
.
Data
();}
Int_t
GetNoCuts
()
{
return
fNoCuts
;}
Int_t
GetNoCuts
()
{
return
fNoCuts
;}
TCutG
*
GetCut
(
Int_t
i
);
TCutG
*
GetCut
(
const
char
*
cutName
);
Int_t
GetMinChannel
(
Int_t
energy
,
Int_t
crystal
);
Int_t
GetMinChannel
(
Int_t
energy
,
Int_t
crystal
);
Int_t
GetMaxChannel
(
Int_t
energy
,
Int_t
crystal
);
Int_t
GetMaxChannel
(
Int_t
energy
,
Int_t
crystal
);
...
...
AculCalib/AculCalib.cpp
View file @
8bd7b5f0
...
@@ -68,3 +68,18 @@ Double_t AculCalib::GetB(Int_t i) {
...
@@ -68,3 +68,18 @@ Double_t AculCalib::GetB(Int_t i) {
}
}
return
fB
[
i
];
return
fB
[
i
];
}
}
void
AculCalib
::
CanDivider
(
TCanvas
*
c
,
Int_t
noPads
,
Int_t
columns
,
Int_t
rows
)
{
c
->
Clear
();
if
(
noPads
==
16
)
{
c
->
Divide
(
4
,
4
);
return
;
}
if
(
rows
!=
0
&&
columns
!=
0
)
{
c
->
Divide
(
columns
,
rows
);
return
;
}
}
AculCalib/AculCalib.h
View file @
8bd7b5f0
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include "TArrayD.h"
#include "TArrayD.h"
#include "TString.h"
#include "TString.h"
#include "TCanvas.h"
#include "./AculCalPars.h"
#include "./AculCalPars.h"
...
@@ -45,6 +46,7 @@ public:
...
@@ -45,6 +46,7 @@ public:
protected
:
protected
:
//essential
//essential
void
CanDivider
(
TCanvas
*
c
,
Int_t
noPads
,
Int_t
columns
=
0
,
Int_t
rows
=
0
);
};
};
...
...
AculCalib/AculCalibScint.cpp
View file @
8bd7b5f0
...
@@ -38,6 +38,12 @@ void AculCalibScint::Init() {
...
@@ -38,6 +38,12 @@ void AculCalibScint::Init() {
fPars
=
new
AculCalParsScint
(
fParFileName
.
Data
());
fPars
=
new
AculCalParsScint
(
fParFileName
.
Data
());
OpenFiles
();
OpenFiles
();
LoadTrees
();
LoadTrees
();
fHistFull
.
resize
(
fPars
->
GetNoRawFiles
());
fHistCut
.
resize
(
fPars
->
GetNoRawFiles
());
fMeanPeakPos
.
resize
(
fPars
->
GetNoRawFiles
());
fMeanPeakRMS
.
resize
(
fPars
->
GetNoRawFiles
());
// SetPars();
// SetPars();
}
}
...
@@ -55,7 +61,7 @@ void AculCalibScint::PrintTrees() {
...
@@ -55,7 +61,7 @@ void AculCalibScint::PrintTrees() {
if
(
fTrees
[
i
])
{
if
(
fTrees
[
i
])
{
printf
(
"
\t
Tree No. %d; File: %s; Name: %s
\n
"
,
i
,
fTrees
[
i
]
->
GetDirectory
()
->
GetName
(),
fTrees
[
i
]
->
GetName
());
printf
(
"
\t
Tree No. %d; File: %s; Name: %s
\n
"
,
i
,
fTrees
[
i
]
->
GetDirectory
()
->
GetName
(),
fTrees
[
i
]
->
GetName
());
}
else
{
}
else
{
printf
(
"
\t
Tree No. %d was not loaded. Maximal number of trees is %d
\n
"
,
i
,
NOCALFILES
);
printf
(
"
\t
Tree No. %d was not loaded. Maximal number of trees is %d
\n
"
,
i
,
fPars
->
GetNoRawFiles
()
);
}
}
}
}
...
@@ -94,29 +100,43 @@ void AculCalibScint::LoadTrees() {
...
@@ -94,29 +100,43 @@ void AculCalibScint::LoadTrees() {
}
}
void
AculCalibScint
::
DrawVariable
(
const
char
*
variable
,
Int_t
tree
,
TCanvas
*
canvas
,
Int_t
lowRange
,
Int_t
upRange
)
{
TTree
*
AculCalibScint
::
GetTree
(
Int_t
treeID
)
{
if
(
treeID
>=
fPars
->
GetNoRawFiles
())
{
cerr
<<
"
\"
AculCalibScint::DrawVariable
\"
Tree number "
<<
treeID
<<
" cannot exist. Maximal treeID is "
<<
fPars
->
GetNoRawFiles
()
-
1
<<
"."
<<
endl
;
return
0
;
}
return
fTrees
[
treeID
];
}
void
AculCalibScint
::
DrawVariable
(
const
char
*
variable
,
Int_t
treeID
,
TCanvas
*
canvas
,
Int_t
lowRange
,
Int_t
upRange
)
{
// if (!canvas) TCanvas *c = new TCanvas();
if
(
!
canvas
)
return
;
canvas
->
Clear
();
if
(
!
canvas
)
{
canvas
->
Divide
(
4
,
4
);
cerr
<<
"
\"
AculCalibScint::DrawVariable
\"
Canvas pointer was NULL"
<<
endl
;
return
;
}
//todo change 16 to parameter
const
Int_t
nPads
=
16
;
CanDivider
(
canvas
,
nPads
);
TString
canvasTitle
;
TString
canvasTitle
;
TString
var
;
TString
var
;
TString
con
;
TString
con
;
TTree
*
curTree
=
0
;
TTree
*
curTree
=
0
;
curTree
=
fTrees
[
tree
]
;
curTree
=
GetTree
(
treeID
)
;
if
(
!
curTree
)
{
if
(
!
curTree
)
{
printf
(
"AculCalibScint::DrawVariable: Tree No. %d was not found.
\n
"
,
tree
);
printf
(
"AculCalibScint::DrawVariable: Tree No. %d was not found.
\n
"
,
tree
ID
);
return
;
return
;
}
}
canvasTitle
.
Form
(
"variable: %s; tree: %d"
,
variable
,
tree
);
canvasTitle
.
Form
(
"variable: %s; tree: %d"
,
variable
,
tree
ID
);
canvas
->
SetTitle
(
canvasTitle
.
Data
());
canvas
->
SetTitle
(
canvasTitle
.
Data
());
for
(
Int_t
i
=
0
;
i
<
16
;
i
++
)
{
for
(
Int_t
i
=
0
;
i
<
nPads
;
i
++
)
{
var
.
Form
(
"%s[%d]"
,
variable
,
i
);
var
.
Form
(
"%s[%d]"
,
variable
,
i
);
con
.
Form
(
"%s[%d]>%d && %s[%d]<%d"
,
variable
,
i
,
lowRange
,
variable
,
i
,
upRange
);
con
.
Form
(
"%s[%d]>%d && %s[%d]<%d"
,
variable
,
i
,
lowRange
,
variable
,
i
,
upRange
);
canvas
->
cd
(
i
+
1
);
canvas
->
cd
(
i
+
1
);
...
@@ -125,3 +145,254 @@ void AculCalibScint::DrawVariable(const char* variable, Int_t tree, TCanvas *can
...
@@ -125,3 +145,254 @@ void AculCalibScint::DrawVariable(const char* variable, Int_t tree, TCanvas *can
}
}
}
}
void
AculCalibScint
::
DrawBeam
(
TCanvas
*
canvas
,
Int_t
file
,
const
char
*
variable
)
{
canvas
->
SetTitle
(
"Beam"
);
const
Int_t
noFiles
=
file
;
//todo delet parameter "files"
CanDivider
(
canvas
,
0
,
noFiles
,
3
);
TTree
*
curTree
=
0
;
TCutG
*
curCutG
=
0
;
TString
var
;
TString
con
;
cout
<<
"cuts "
<<
fPars
->
GetNoCuts
()
<<
endl
;
for
(
Int_t
i
=
0
;
i
<
noFiles
;
i
++
)
{
canvas
->
cd
(
i
+
1
);
curTree
=
GetTree
(
i
);
if
(
!
curTree
)
{
printf
(
"AculCalibCsI::DrawBeam: Tree No. %d was not found.
\n
"
,
i
);
continue
;
}
curTree
->
Draw
(
"QDC[0]:TDC[0]"
,
"TDC[0]<1000 && QDC[0]<2000"
,
"cont"
);
// curTree->Draw("QDC[0]+QDC[1]:(TDC[2]+TDC[3])/2. - (TDC[0]+TDC[1])/2.", "", "cont");
// cout << "aksjda\t" << energyPoints << endl;
for
(
Int_t
j
=
0
;
j
<
fPars
->
GetNoRawFiles
();
j
++
)
{
if
(
fPars
->
GetCut
(
j
)
)
{
TCutG
*
cutTemp
=
fPars
->
GetCut
(
j
);
curCutG
=
new
TCutG
(
*
cutTemp
);
curCutG
->
Draw
(
"same"
);
// printf("AculCalibCsI::DrawBeam: cTOF cut No. %d cannot be drawn, need to repair this function.\n", j);
}
}
canvas
->
cd
(
noFiles
+
1
+
i
);
curTree
->
Draw
(
"QDC[0]:QDC[1]"
,
""
,
"cont"
);
for
(
Int_t
j
=
0
;
j
<
fPars
->
GetNoRawFiles
();
j
++
)
{
if
(
fPars
->
GetCut
(
noFiles
+
j
)
)
{
TCutG
*
cutTemp
=
fPars
->
GetCut
(
noFiles
+
j
);
curCutG
=
new
TCutG
(
*
cutTemp
);
curCutG
->
Draw
(
"same"
);
// printf("AculCalibCsI::DrawBeam: cQCD cut No. %d cannot be drawn, need to repair this function.\n", j);
}
}
canvas
->
cd
(
2
*
noFiles
+
1
+
i
);
var
.
Form
(
"%s[5]:TDC[0]"
,
variable
);
con
.
Form
(
"%s[5]>200"
,
variable
);
curTree
->
Draw
(
var
.
Data
(),
con
.
Data
(),
"cont"
);
for
(
Int_t
j
=
0
;
j
<
fPars
->
GetNoRawFiles
();
j
++
)
{
// if ( cutsCol.At(files + j) ) {
// curCutG = (TCutG*)cutsCol.At(files + j);
// curCutG->Draw("same");
// printf("AculCalibCsI::DrawBeam: cQCD cut No. %d cannot be drawn, need to repair this function.\n", j);
// }
}
canvas
->
Update
();
}
}
void
AculCalibScint
::
GetPeakMean
(
const
char
*
variable
,
Int_t
treeID
,
Int_t
energy
,
TCanvas
*
canvas
,
const
char
*
beamcut
,
const
Int_t
nbins
,
Int_t
lowRange
)
{
// todo: change this parameter as nonconstant
const
Int_t
noCrystals
=
16
;
CanDivider
(
canvas
,
noCrystals
);
TString
var
;
TString
con
;
TString
hname
;
TString
canvasTitle
;
// todo manage the canvas name using cut name
canvasTitle
.
Form
(
"variable: %s; tree: %d; cut: %s;"
,
variable
,
treeID
,
fPars
->
GetCut
(
beamcut
)
->
GetName
());
canvas
->
SetTitle
(
canvasTitle
.
Data
());
TTree
*
curTree
=
0
;
curTree
=
GetTree
(
treeID
);
if
(
!
curTree
)
{
printf
(
"AculCalibCsI::GetPeakMean: Tree No. %d was not found.
\n
"
,
treeID
);
return
;
}
TString
sVariable
=
variable
;
sVariable
.
ToLower
();
Int_t
channel
=
0
;
for
(
Int_t
i
=
0
;
i
<
noCrystals
;
i
++
)
{
if
(
sVariable
.
Contains
(
"anc"
))
{
channel
=
i
+
1
;
}
else
{
channel
=
i
;
}
var
.
Form
(
"%s[%d]>>hfull[%d][%d]"
,
variable
,
channel
,
treeID
,
i
);
con
.
Form
(
"%s[%d]>%d && %s"
,
variable
,
channel
,
lowRange
,
fPars
->
GetCut
(
beamcut
)
->
GetName
());
canvas
->
cd
(
i
+
1
);
hname
.
Form
(
"hfull[%d][%d]"
,
treeID
,
i
);
fHistFull
[
treeID
].
push_back
(
new
TH1I
(
hname
.
Data
(),
"title"
,
nbins
,
0
,
4096
)
);
curTree
->
SetLineColor
(
1
);
curTree
->
Draw
(
var
.
Data
(),
con
.
Data
());
var
.
Form
(
"%s[%d]>>hcut[%d][%d]"
,
variable
,
channel
,
treeID
,
i
);
con
.
Form
(
"%s[%d]>%d && %s[%d]<%d && %s"
,
variable
,
channel
,
fPars
->
GetMinChannel
(
energy
,
i
),
variable
,
channel
,
fPars
->
GetMaxChannel
(
energy
,
i
),
fPars
->
GetCut
(
beamcut
)
->
GetName
());
hname
.
Form
(
"hcut[%d][%d]"
,
treeID
,
i
);
fHistCut
[
treeID
].
push_back
(
new
TH1I
(
hname
.
Data
(),
"title"
,
nbins
,
0
,
4096
)
);
fHistCut
[
treeID
][
i
]
->
SetLineColor
(
3
);
curTree
->
Draw
(
var
.
Data
(),
con
.
Data
(),
"same"
);
gPad
->
Update
();
fMeanPeakPos
[
treeID
].
push_back
(
fHistCut
[
treeID
][
i
]
->
GetMean
());
// cout << fMeanPeakPos[treeID][i] << endl;
fMeanPeakRMS
[
treeID
].
push_back
(
fHistCut
[
treeID
][
i
]
->
GetRMS
());
}
// cout << fMeanPeakPos.size() << "\t" << fMeanPeakPos[treeID].size() << endl;
// cout << fMeanPeakPos.size() << "\t" << fMeanPeakPos[0].size() << endl;
// cout << fMeanPeakPos.size() << "\t" << fMeanPeakPos[1].size() << endl;
// cout << fMeanPeakPos.size() << "\t" << fMeanPeakPos[2].size() << endl;
// cout << fMeanPeakPos.size() << "\t" << fMeanPeakPos[3].size() << endl;
canvas
->
Update
();
}
void
AculCalibScint
::
Calibrate
(
TCanvas
*
canvas
,
Bool_t
savefile
,
const
char
*
filename
,
const
char
*
option
)
{
//todo change this parameter as nonconstant
//e.g. the number of found fPeakMeans
const
Int_t
noChannels
=
16
;
//todo
if
(
!
canvas
)
return
;
CanDivider
(
canvas
,
noChannels
);
for
(
Int_t
i
=
0
;
i
<
fPars
->
GetNoRawFiles
();
i
++
)
{
cout
<<
i
<<
"
\t
"
<<
fMeanPeakPos
[
i
].
size
()
<<
endl
;
if
(
fMeanPeakPos
[
i
].
size
()
<
noChannels
||
fMeanPeakRMS
[
i
].
size
()
<
noChannels
)
{
// cout << i << "\t" << fMeanPeakPos[i].size() << endl;
cout
<<
"
\"
AculCalibScint::Calibrate
\"
something bad here"
<<
endl
;
return
;
}
}
// cout << alphas2.GetSize()+1 << endl;
// cout << energyPoints+1 << endl;
cout
<<
fPars
->
GetNoEPoints
()
<<
endl
;
const
Int_t
energyPoints
=
fPars
->
GetNoEPoints
();
TString
gName
;
TString
gTitle
;
// if (savefile) fGraphs->Open(filename, "RECREATE");
TF1
*
fnc
;
for
(
Int_t
i
=
0
;
i
<
noChannels
;
i
++
)
{
canvas
->
cd
(
i
+
1
);
gCal
[
i
]
=
new
TGraphErrors
(
energyPoints
+
1
);
// FillGraph(gCal[i], energies.GetSize()+1, energies.GetArray(), i);
FillGraph
(
gCal
[
i
],
energyPoints
+
1
,
i
);
// if (savefile) gCal[i]->Write();
// gCal[i]->Draw("Al*");
gCal
[
i
]
->
Draw
(
"A*"
);
gName
.
Form
(
"g%s%s%d
\n
"
,
fPars
->
GetDetName
(),
fPars
->
GetParticleName
(),
i
);
gTitle
.
Form
(
"%s %s
\n
"
,
fPars
->
GetDetName
(),
fPars
->
GetParticleName
());
// gCal[i]->SetTitle(gTitle.Data());
gCal
[
i
]
->
SetName
(
gName
.
Data
());
gCal
[
i
]
->
Fit
(
"pol1"
);
fnc
=
gCal
[
i
]
->
GetFunction
(
"pol1"
);
fnc
->
SetLineColor
(
kRed
);
fA
.
push_back
(
fnc
->
GetParameter
(
1
));
fB
.
push_back
(
fnc
->
GetParameter
(
0
));
canvas
->
Update
();
}
if
(
savefile
)
SaveClbGraphs
(
filename
,
option
);
}
void
AculCalibScint
::
FillGraph
(
TGraphErrors
*
g
,
Int_t
npoints
,
/*Double_t *energies,*/
Int_t
graphNumber
,
const
char
*
option
)
{
TString
opt
=
option
;
//todo check if fMeanPeakPos is full
//all available energy points and (0,0)
g
->
SetPoint
(
0
,
0.
,
0.
);
for
(
Int_t
i
=
0
;
i
<
npoints
-
1
;
i
++
)
{
// g->SetPoint(i+1, energies[i], mean[i][graphNumber]);
// g->SetPointError(i+1, 0, meanRMS[i][graphNumber]);
// cout << "Graph number: " << graphNumber << endl;
// cout << graphNumber << "\t" << fMeanPeakPos[i][graphNumber] << endl;
g
->
SetPoint
(
i
+
1
,
fMeanPeakPos
[
i
][
graphNumber
],
fPars
->
GetCalEnergy
(
i
));
g
->
SetPointError
(
i
+
1
,
fMeanPeakRMS
[
i
][
graphNumber
],
0
);
}
// for (Int_t j = 1; j < 4; j++) {
// g->SetPoint(j, 0., 0.);
// }
}
void
AculCalibScint
::
SaveClbGraphs
(
const
char
*
filename
,
const
char
*
option
)
{
// cout << "asdasd" << endl;
// cout << fGraphs << endl;
TFile
fGraphs
(
filename
,
option
);
// if (fGraphs) fGraphs->Close();
// cout << "asdasd" << endl;
// fGraphs = new TFile(filename, option);
cout
<<
fGraphs
.
IsOpen
()
<<
endl
;
cout
<<
fGraphs
.
GetName
()
<<
endl
;
fGraphs
.
Print
();
// if (!fGraphs->IsOpen()) {
// printf("AculCalibCsI::SaveClbGraphs: file %s was not open.\n", filename);
// return;
// }
for
(
Int_t
i
=
0
;
i
<
16
;
i
++
)
{
fGraphs
.
cd
();
gCal
[
i
]
->
Write
();
}
fGraphs
.
Close
();
return
;
}
void
AculCalibScint
::
WriteClbParameters
(
const
char
*
filename
)
{
std
::
ofstream
outfile
(
filename
);
if
(
!
outfile
.
is_open
()
)
{
printf
(
"AculCalibCsI::WriteClbParameters: File %s was not open.
\n
"
,
filename
);
return
;
}
outfile
<<
"#detector:
\t
"
<<
fPars
->
GetDetName
()
<<
",
\t
particle:
\t
"
<<
fPars
->
GetParticleName
()
<<
endl
;
outfile
<<
"#channel
\t
fA
\t
fB"
<<
endl
;
for
(
Int_t
i
=
0
;
i
<
(
Int_t
)
fA
.
size
();
i
++
)
{
outfile
<<
i
<<
"
\t
"
<<
fA
[
i
]
<<
"
\t
"
<<
fB
[
i
]
<<
endl
;
}
outfile
.
close
();
}
AculCalib/AculCalibScint.h
View file @
8bd7b5f0
...
@@ -4,19 +4,21 @@
...
@@ -4,19 +4,21 @@
//#include "TROOT.h"
//#include "TROOT.h"
#include <iostream>
#include <iostream>
#include <fstream>
#include <fstream>
//#include <vector>
#include "TFile.h"
#include "TFile.h"
#include "TTree.h"
#include "TTree.h"
#include "TCanvas.h"
//
#include "TCanvas.h"
//
#include "TH1I.h"
#include "TH1I.h"
//
#include "TGraphErrors.h"
#include "TGraphErrors.h"
//#include "TArrayD.h"
//#include "TArrayD.h"
//
#include "TF1.h"
#include "TF1.h"
#include "./AculCalib.h"
#include "./AculCalib.h"
using
std
::
cout
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
endl
;
//using std::vector;
class
AculCalibScint
:
public
AculCalib
{
class
AculCalibScint
:
public
AculCalib
{
...
@@ -29,13 +31,18 @@ private:
...
@@ -29,13 +31,18 @@ private:
TFile
*
fCutFile
;
TFile
*
fCutFile
;
// TClonesArray cutsCol;
// TClonesArray cutsCol;
//
//
// TH1I *hfull[NOCALFILES][16];
// TH1I *fHistFull[NOCALFILES][16];
// TH1I *hcut[NOCALFILES][16];
vector
<
vector
<
TH1I
*>
>
fHistFull
;
// TH1I *fHistCut[NOCALFILES][16];
vector
<
vector
<
TH1I
*>
>
fHistCut
;
//
//
// Double_t mean[NOCALFILES][16];
// Double_t fMeanPeakPos[NOCALFILES][16];
// Double_t meanRMS[NOCALFILES][16];
vector
<
vector
<
Double_t
>
>
fMeanPeakPos
;
// Double_t fMeanPeakRMS[NOCALFILES][16];
vector
<
vector
<
Double_t
>
>
fMeanPeakRMS
;
//
//
// TGraphErrors *gCal[16];
//todo make vector of graphs
TGraphErrors
*
gCal
[
16
];
// TFile *fGraphs;
// TFile *fGraphs;
public
:
public
:
...
@@ -54,10 +61,15 @@ public:
...
@@ -54,10 +61,15 @@ public:
// void PrintParameters(const char* option = "");
// void PrintParameters(const char* option = "");
// void PrintPeakRanges();
// void PrintPeakRanges();
void
DrawVariable
(
const
char
*
variable
,
Int_t
tree
,
TCanvas
*
canvas
,
Int_t
lowRange
=
0
,
Int_t
upRange
=
4096
);
void
DrawVariable
(
const
char
*
variable
,
Int_t
treeID
,
TCanvas
*
canvas
,
Int_t
lowRange
=
0
,
Int_t
upRange
=
4096
);
// void DrawBeam(TCanvas *canvas, Int_t files, const char* variable);
void
DrawBeam
(
TCanvas
*
canvas
,
Int_t
file
,
const
char
*
variable
);
// void DrawdEE(const char* variable, Int_t tree, TCanvas *canvas);
// void DrawVariableCut(const char* variable, Int_t tree, TCanvas *canvas, const char* cut1, const char* cut2 = "", Int_t lowRange = 0);
void
GetPeakMean
(
const
char
*
variable
,
Int_t
treeID
,
Int_t
energy
,
TCanvas
*
canvas
,
const
char
*
beamcut
,
const
Int_t
nbins
=
4096
,
Int_t
lowRange
=
0
);
void
Calibrate
(
TCanvas
*
canvas
,
Bool_t
savefile
=
0
,
const
char
*
filename
=
""
,
const
char
*
option
=
"READ"
);
void
WriteClbParameters
(
const
char
*
filename
);
TTree
*
GetTree
(
Int_t
treeID
);
//private functions:
//private functions:
// void LoadCuts();
// void LoadCuts();
...
@@ -65,5 +77,10 @@ public:
...
@@ -65,5 +77,10 @@ public:
private
:
private
:
void
OpenFiles
();
void
OpenFiles
();
void
LoadTrees
();
void
LoadTrees
();
void
SaveClbGraphs
(
const
char
*
filename
,
const
char
*
option
=
"READ"
);
void
FillGraph
(
TGraphErrors
*
g
,
Int_t
npoints
,
/*Double_t *energies,*/
Int_t
graphNumber
,
const
char
*
option
=
""
);
// void SetPars();
// void SetPars();
};
};
macros/calibration_CsI/calibrationSQ13Alpha.cxx
View file @
8bd7b5f0
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
// cal.DrawBeam(c4, 4, "SQ13");
// cal.DrawBeam(c4, 4, "SQ13");
//return;
//return;
// cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16");
// cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16");
// return;
// cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16", "cutSQ13Alpha16Amp");
// cal.DrawVariableCut("SQ13", 0, c1, "cutsSQ13Alpha16", "cutSQ13Alpha16Amp");
//return;
//return;
// cal.DrawVariableCut("SQ13", 1, c2, "cutSQ13Alpha21", "cutSQ13Alpha21Amp");
// cal.DrawVariableCut("SQ13", 1, c2, "cutSQ13Alpha21", "cutSQ13Alpha21Amp");
...
...
macros/myMacros/parTest.cxx
View file @
8bd7b5f0
//#include "../../AculCalib/AculCalPars.h"
//#include "../../AculCalib/AculCalPars.h"
//#include "../../AculCalib/AculCalibScint.h"
//#include "TSystem.h"
void
parTest
()
void
parTest
()
{
{
...
@@ -19,16 +21,27 @@ void parTest()
...
@@ -19,16 +21,27 @@ void parTest()
// c.LoadTrees();
// c.LoadTrees();
c
.
PrintTrees
();
c
.
PrintTrees
();
// c.DrawVariable(.........)
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"Plain"
);
TCanvas
*
c2
=
new
TCanvas
(
"c2"
,
"Plain"
);
TCanvas
*
c3
=
new
TCanvas
(
"c3"
,
"Plain"
);
TCanvas
*
c4
=
new
TCanvas
(
"c4"
,
"Plain"
);
// c.DrawVariable("SQ13", 2, c1);
// c.DrawBeam(c1, 4, "SQ13");
c
.
GetPeakMean
(
"SQ13"
,
0
,
0
,
c1
,
"cutSQ13Alpha16Amp"
,
256
);
c
.
GetPeakMean
(
"SQ13"
,
1
,
1
,
c2
,
"cutSQ13Alpha21Amp"
,
256
);
c
.
GetPeakMean
(
"SQ13"
,
2
,
2
,
c3
,
"cutSQ13Alpha26Amp"
,
256
);
c
.
GetPeakMean
(
"SQ13"
,
3
,
3
,
c4
,
"cutSQ13Alpha30Amp"
,
256
);
//return;
// c.PrintFiles();
// c.PrintFiles();
// c.PrintCuts();
// c.PrintCuts();
// TCanvas *c1 = new TCanvas("c1", "Plain");
// TCanvas *c1 = new TCanvas("c1", "Plain");
// c.GetPeakMean("SQ13", 0, 0, c1, "cutSQ13Alpha16Amp", 256);
// c.GetPeakMean("SQ13", 0, 0, c1, "cutSQ13Alpha16Amp", 256);
//
TCanvas *cCal = new TCanvas("cCal", "calibration Alpha");
TCanvas
*
cCal
=
new
TCanvas
(
"cCal"
,
"calibration Alpha"
);
// cal
.Calibrate(cCal);
c
.
Calibrate
(
cCal
);
return
;
return
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment