Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
np
nptool
Commits
97481dbc
Commit
97481dbc
authored
5 months ago
by
Theodore Efremov
Browse files
Options
Downloads
Patches
Plain Diff
Added spline for chio X and Y and updated readme
parent
cc84575d
No related branches found
Branches containing commit
No related tags found
1 merge request
!27
Draft: [Epic] Preparation of the environement for the new GaseousDetectorScorers...
Pipeline
#360138
failed
5 months ago
Stage: build-NPLib
Stage: build-NPSimulation
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Projects/AlPhaPha/2024/ReadMe.md
+4
-4
4 additions, 4 deletions
Projects/AlPhaPha/2024/ReadMe.md
Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioXY.C
+139
-0
139 additions, 0 deletions
...s/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioXY.C
with
143 additions
and
4 deletions
Projects/AlPhaPha/2024/ReadMe.md
+
4
−
4
View file @
97481dbc
# Code cheat sheet
# Code cheat sheet
## Root Prompt
## Root Prompt
'''
```
- Tree-\>Draw("Branch\>\>HistName(nBin,xmin,xmax)","Condition","Option")
- Tree-\>Draw("Branch\>\>HistName(nBin,xmin,xmax)","Condition","Option")
'''
```
## YCM
## YCM
f to find source
f to find source
...
@@ -10,9 +10,9 @@ ctrl-O to go back
...
@@ -10,9 +10,9 @@ ctrl-O to go back
ctrl-I to go forward
ctrl-I to go forward
## Cmake Set-up for clangd
## Cmake Set-up for clangd
'''
```
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1
'''
```
## Do not forget
## Do not forget
In project config modifiy analysis output before doing a test analysis
In project config modifiy analysis output before doing a test analysis
This diff is collapsed.
Click to expand it.
Projects/AlPhaPha/2024/macro/chio/CalibrationChio/SplineChioXY.C
0 → 100644
+
139
−
0
View file @
97481dbc
#include
<TCanvas.h>
#include
<TChain.h>
#include
<TSpline.h>
#include
<fstream>
#include
<TH2.h>
#include
<TFile.h>
#include
<vector>
using
namespace
std
;
void
MakeSpline
();
void
ApplySplinePerCut
();
void
ApplySpline
();
void
HistoFiller
();
//////////////////////////////////////////////////////////////////////////////////////////
void
SplineChioXY
(){
HistoFiller
();
MakeSpline
();
}
/**
* This function fill the histograms
*/
void
HistoFiller
(){
// Input and setters
TChain
*
chain
=
new
TChain
(
"PhysicsTree"
);
chain
->
Add
(
"../../../root/analysis/VamosCalib241.root"
);
double
FF_IC_X
,
FF_IC_Y
,
fIC_raw
[
11
]
;
chain
->
SetBranchStatus
(
"FF_IC_X"
,
true
);
chain
->
SetBranchAddress
(
"FF_IC_X"
,
&
FF_IC_X
);
chain
->
SetBranchStatus
(
"FF_IC_Y"
,
true
);
chain
->
SetBranchAddress
(
"FF_IC_Y"
,
&
FF_IC_Y
);
chain
->
SetBranchStatus
(
"fIC_raw"
,
true
);
chain
->
SetBranchAddress
(
"fIC_raw"
,
&
fIC_raw
);
// Output of the spline
double
fIC0_CorrX
;
double
fIC0_CorrY
;
// Histograms
TH2F
*
hChio_IC0_IC1_X_all
=
new
TH2F
(
"hChio_IC0_IC1_X_all"
,
"hChio_IC0_IC1_X_all"
,
1000
,
-
600
,
400
,
500
,
0
,
2
);
TH2F
*
hChio_IC0_IC1_Y_all
=
new
TH2F
(
"hChio_IC0_IC1_Y_all"
,
"hChio_IC0_IC1_Y_all"
,
1000
,
-
70
,
70
,
500
,
0
,
2
);
//===========================================================================================================
// Beginning loop on entries
//===========================================================================================================
int
Nentries
=
chain
->
GetEntries
();
for
(
int
e
=
0
;
e
<
Nentries
;
e
++
)
{
//Printing status
if
(
e
%
100000
==
0
)
cout
<<
e
*
100
.
/
Nentries
<<
"%
\r
"
<<
flush
;
chain
->
GetEntry
(
e
);
hChio_IC0_IC1_X_all
->
Fill
(
fIC_raw
[
1
]
/
fIC_raw
[
0
],
FF_IC_X
);
hChio_IC0_IC1_Y_all
->
Fill
(
fIC_raw
[
1
]
/
fIC_raw
[
0
],
FF_IC_Y
);
//for(int i=0;i<Ncuts;i++) if(cutZ[i]->IsInside(FF_Eres,FF_DE)) {hChioDE_E[i]->Fill(FF_Eres,FF_DE); break;}
}
//end loop on entries
//===========================================================================================================
// Output Canvas and files
//===========================================================================================================
TCanvas
*
canX
=
new
TCanvas
(
"X"
,
"X"
,
0
,
0
,
2000
,
1000
);
canX
->
cd
();
hChio_IC0_IC1_X_all
->
Draw
(
"colz"
);
TCanvas
*
canY
=
new
TCanvas
(
"Y"
,
"Y"
,
0
,
0
,
2000
,
1000
);
canY
->
cd
();
hChio_IC0_IC1_Y_all
->
Draw
(
"colz"
);
TFile
*
outFile
=
new
TFile
(
"Output/Spline.root"
,
"recreate"
);
hChio_IC0_IC1_X_all
->
Write
();
hChio_IC0_IC1_Y_all
->
Write
();
outFile
->
Close
();
}
// End HistoFiller
void
MakeSpline
(){
TFile
*
inFile
=
new
TFile
(
"Output/Spline.root"
);
TSpline3
*
gspline
;
vector
<
TH2F
*>
hIC
;
vector
<
TH1F
*>
hProfile
;
vector
<
TH1F
*>
pfx
;
// extended hProfile
vector
<
TFile
*>
fspline
=
new
TFile
(
"Output/spline_Chio_2024.root"
,
"recreate"
);
TCanvas
*
canfit
=
new
TCanvas
(
"canfit"
,
"canfit"
,
0
,
0
,
2000
,
1500
);
// Get the 2D plot in TCutG
hIC
.
push_back
((
TH2F
*
)
inFile
->
Get
(
"hChio_IC0_IC1_X_all"
));
hIC
.
push_back
((
TH2F
*
)
inFile
->
Get
(
"hChio_IC0_IC1_Y_all"
));
for
// Create the TProfile
hProfile
[
i
]
=
(
TH1F
*
)
h2
[
i
]
->
ProfileX
();
hProfile
[
i
]
->
SetLineWidth
(
2
);
hProfile
[
i
]
->
SetDirectory
(
0
);
canfit
->
cd
();
if
(
i
==
0
)
{
hProfile
[
i
]
->
GetYaxis
()
->
SetRangeUser
(
5000
,
26000
);
hProfile
[
i
]
->
Draw
();
}
else
hProfile
[
i
]
->
Draw
(
"same"
);
// Get the range of the TProfile
int
FirstBin
,
LastBin
;
double
parpol3
[
4
];
for
(
int
bin
=
1
;
bin
<
hProfile
[
i
]
->
GetNbinsX
();
bin
++
){
FirstBin
=
bin
;
if
(
hProfile
[
i
]
->
GetBinContent
(
bin
)
>
6000
)
break
;
}
double
parpol1
[
2
];
for
(
int
bin
=
hProfile
[
i
]
->
GetNbinsX
();
bin
>
1
;
bin
--
){
LastBin
=
bin
;
if
(
hProfile
[
i
]
->
GetBinContent
(
bin
)
>
6000
)
break
;
}
//end makespline
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment