Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pwg-c2f
data
analysis_tree_qa
Commits
72acedd4
Commit
72acedd4
authored
Aug 06, 2020
by
Viktor
Browse files
update AT interface
parent
92fe7074
Changes
8
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
72acedd4
...
...
@@ -51,6 +51,7 @@ set(EXTERNAL_DIR ${CMAKE_BINARY_DIR}/external)
set
(
EXTERNAL_INSTALL_DIR
${
CMAKE_INSTALL_PREFIX
}
/external
)
include
(
cmake_modules/cuts.cmake
)
include
(
cmake_modules/plots_maker.cmake
)
add_subdirectory
(
src
)
#add_subdirectory(test)
...
...
cmake_modules/plots_maker.cmake
0 → 100644
View file @
72acedd4
set
(
PlotsMaker_INSTALL_DIR
${
EXTERNAL_INSTALL_DIR
}
/
)
set
(
PlotsMaker_INCLUDE_DIR
${
PlotsMaker_INSTALL_DIR
}
/include
)
set
(
PlotsMaker_LIBRARY_DIR
${
PlotsMaker_INSTALL_DIR
}
/lib
)
ExternalProject_Add
(
PlotsMaker_Ext
GIT_REPOSITORY
"https://git.cbm.gsi.de/pwg-c2f/utils/plots_maker.git"
GIT_TAG
"master"
UPDATE_DISCONNECTED
${
UPDATE_DISCONNECTED
}
SOURCE_DIR
"
${
EXTERNAL_DIR
}
/PlotsMaker_src"
BINARY_DIR
"
${
EXTERNAL_DIR
}
/PlotsMaker_build"
INSTALL_DIR
"
${
PlotsMaker_INSTALL_DIR
}
"
CMAKE_ARGS
"-DCMAKE_INSTALL_PREFIX=
${
PlotsMaker_INSTALL_DIR
}
"
"-DCMAKE_BUILD_TYPE=
${
CMAKE_BUILD_TYPE
}
"
)
list
(
APPEND PROJECT_DEPENDENCIES PlotsMaker_Ext
)
list
(
APPEND PROJECT_LINK_DIRECTORIES
${
PlotsMaker_LIBRARY_DIR
}
)
list
(
APPEND PROJECT_INCLUDE_DIRECTORIES
${
PlotsMaker_INCLUDE_DIR
}
)
src/EntryConfig.cxx
View file @
72acedd4
...
...
@@ -5,8 +5,6 @@
#include
"EntryConfig.h"
namespace
AnalysisTree
::
QA
{
EntryConfig
::
EntryConfig
(
const
Axis
&
axis
,
Cuts
*
cuts
)
:
...
...
@@ -106,6 +104,7 @@ void EntryConfig::Write() const {
}
void
EntryConfig
::
Fill
(
double
value
)
{
get_func
<
TH1
*>
(
plot_
)
->
Fill
(
value
);
}
std
::
string
EntryConfig
::
GetDirectoryName
()
const
{
std
::
set
<
std
::
string
>
branches
{};
...
...
src/EntryConfig.h
View file @
72acedd4
...
...
@@ -48,8 +48,8 @@ class EntryConfig {
Cuts
*
GetEntryCuts
()
const
{
return
entry_cuts_
;
}
PlotType
GetType
()
const
{
return
type_
;
}
int
GetVariablesId
()
const
{
return
vars_id_
;}
void
SetVariablesId
(
int
var_id
)
{
vars_id_
=
var_id
;
}
std
::
pair
<
int
,
std
::
vector
<
int
>>
GetVariablesId
()
const
{
return
vars_id_
;}
void
SetVariablesId
(
const
std
::
pair
<
int
,
std
::
vector
<
int
>>&
var_id
)
{
vars_id_
=
var_id
;
}
std
::
vector
<
Variable
>
GetVariables
()
const
{
std
::
vector
<
Variable
>
vars
{};
...
...
@@ -63,6 +63,8 @@ class EntryConfig {
void
SetOutDir
(
TDirectory
*
out_dir
)
{
out_dir_
=
out_dir
;
}
PlotPointer
GetPlot
()
{
return
plot_
;
}
protected:
void
InitPlot
();
...
...
@@ -71,14 +73,14 @@ class EntryConfig {
TProfile
*
CreateProfile
()
const
;
void
Set2DName
();
PlotPointer
plot_
{}
;
std
::
string
name_
{
""
}
;
///< Name of the plot
std
::
string
title_
{
""
}
;
PlotType
type_
{};
PlotPointer
plot_
;
std
::
string
name_
;
///< Name of the plot
std
::
string
title_
;
PlotType
type_
{
PlotType
(
-
1
)
};
std
::
vector
<
Axis
>
axes_
{};
Cuts
*
entry_cuts_
{
nullptr
};
int
vars_id_
{
-
1
};
std
::
pair
<
int
,
std
::
vector
<
int
>>
vars_id_
{};
TDirectory
*
out_dir_
{
nullptr
};
...
...
src/Task.cxx
View file @
72acedd4
...
...
@@ -5,10 +5,11 @@ namespace QA{
void
Task
::
Exec
()
{
for
(
auto
&
plot
:
entries_
){
for
(
auto
var
:
var_manager_
->
GetValues
(
plot
.
GetVariablesId
()))
{
auto
var_ids
=
plot
.
GetVariablesId
();
for
(
auto
var
:
var_manager_
->
GetValues
(
var_ids
.
first
))
{
switch
(
plot
.
GetNdimentions
())
{
case
1
:
{
plot
.
Fill
(
var
[
0
]);
break
;
}
case
2
:
{
plot
.
Fill
(
var
[
0
],
var
[
1
]);
break
;
}
case
1
:
{
plot
.
Fill
(
var
[
var_ids
.
second
.
at
(
0
)
]);
break
;
}
case
2
:
{
plot
.
Fill
(
var
[
var_ids
.
second
.
at
(
0
)],
var
[
var_ids
.
second
.
at
(
1
)
]);
break
;
}
}
}
}
// plots
...
...
src/Task.h
View file @
72acedd4
...
...
@@ -20,18 +20,24 @@ class Task : public FillTask{
void
Exec
()
override
;
void
Finish
()
override
;
void
AddEntry
(
const
EntryConfig
&
entry
)
{
entries_
.
push_back
(
entry
);
}
size_t
AddEntry
(
const
EntryConfig
&
entry
)
{
entries_
.
push_back
(
entry
);
return
entries_
.
size
()
-
1
;
}
void
AddH1
(
const
Axis
&
x
,
Cuts
*
cuts
=
nullptr
)
{
size_t
AddH1
(
const
Axis
&
x
,
Cuts
*
cuts
=
nullptr
)
{
entries_
.
emplace_back
(
EntryConfig
(
x
,
cuts
));
return
entries_
.
size
()
-
1
;
}
void
AddH2
(
const
Axis
&
x
,
const
Axis
&
y
,
Cuts
*
cuts
=
nullptr
)
{
size_t
AddH2
(
const
Axis
&
x
,
const
Axis
&
y
,
Cuts
*
cuts
=
nullptr
)
{
entries_
.
emplace_back
(
EntryConfig
(
x
,
y
,
cuts
));
return
entries_
.
size
()
-
1
;
}
void
AddProfile
(
const
Axis
&
x
,
const
Axis
&
y
,
Cuts
*
cuts
=
nullptr
)
{
size_t
AddProfile
(
const
Axis
&
x
,
const
Axis
&
y
,
Cuts
*
cuts
=
nullptr
)
{
entries_
.
emplace_back
(
EntryConfig
(
x
,
y
,
cuts
,
true
));
return
entries_
.
size
()
-
1
;
}
std
::
vector
<
EntryConfig
>&
Entries
()
{
return
entries_
;
}
...
...
@@ -40,9 +46,7 @@ class Task : public FillTask{
private:
std
::
vector
<
EntryConfig
>
entries_
{};
VarManager
*
var_manager_
{
nullptr
};
std
::
map
<
std
::
string
,
TDirectory
*>
dir_map_
{};
};
}
...
...
src/Utils.h
View file @
72acedd4
...
...
@@ -45,5 +45,19 @@ void AddTracksMatchQA(Task* task, const std::string& rec_tracks, const std::stri
task
->
AddH2
({
"#phi"
,
{
rec_tracks
,
"phi"
},
{
gNbins
,
-
3.2
,
3.2
}},
{
"#phi"
,
{
sim_particles
,
"phi"
},
{
gNbins
,
-
3.2
,
3.2
}},
cuts
);
}
void
AddParticlesFlowQA
(
Task
*
task
,
const
std
::
string
&
particles
,
const
Field
&
psi_RP
,
const
std
::
vector
<
int
>&
pdg_codes
){
Variable
v1
(
"v1"
,{
{
particles
,
"phi"
},
psi_RP
},
[](
std
::
vector
<
double
>
phi
)
{
return
cos
(
phi
[
0
]
-
phi
[
1
]);
});
Variable
v2
(
"v2"
,{
{
particles
,
"phi"
},
psi_RP
},
[](
std
::
vector
<
double
>
phi
)
{
return
cos
(
2
*
(
phi
[
0
]
-
phi
[
1
]));
});
for
(
auto
pdg
:
pdg_codes
){
auto
*
pid_cut
=
new
Cuts
(
"mc_"
+
std
::
to_string
(
pdg
),
{{{
particles
,
"pid"
},
pdg
}});
task
->
AddProfile
({
"#it{y}"
,
{
particles
,
"rapidity"
},
{
20
,
0.5
,
2.5
}},
{
"v_{1}"
,
v1
,
{}},
pid_cut
);
task
->
AddProfile
({
"#it{y}"
,
{
particles
,
"rapidity"
},
{
20
,
0.5
,
2.5
}},
{
"v_{2}"
,
v2
,
{}},
pid_cut
);
}
}
}
#endif //ANALYSISTREEQA_SRC_UTILS_H_
tasks/cbm_qa.cpp
View file @
72acedd4
#include
"AnalysisTree/Cuts.hpp"
#include
"CbmCuts.h"
#include
"Canvas.h"
#include
"src/Manager.h"
#include
"src/Task.h"
#include
"src/Utils.h"
#include
"src/EntryConfig.h"
using
namespace
AnalysisTree
;
...
...
@@ -21,6 +24,30 @@ const std::string sim_particles = "SimParticles";
const
std
::
string
rec_tracks
=
"VtxTracks"
;
const
std
::
string
tof_hits
=
"TofHits"
;
std
::
vector
<
size_t
>
pdf_plots
{};
typedef
AnalysisTree
::
QA
::
EntryConfig
::
PlotType
PlotType
;
//void SavePdf(QA::Task* task){
//
// Helper::Canvas t("");
// t.SetCanvasSize(1200, 900);
// t.SetLabelPosition(0.5, 0.87);
// t.AddLabel("CBM simulation, GEANT3");
// t.AddLabel("UrQMD, EoS=0");
// t.AddLabel("Au+Au @ 12#it{A} GeV/#it{c}");
//
// for(auto plot_id : pdf_plots){
// auto plot = task->Entries().at(plot_id);
//
// switch(plot.GetType()) {
// case PlotType::kHisto1D : t.Add1DPlot(plot.GetPlot() )
//
// }
// }
//
//}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
<=
1
)
{
...
...
@@ -41,13 +68,15 @@ int main(int argc, char** argv)
auto
*
task
=
new
QA
::
Task
;
//
KFPFTracksQA(*task);
KFPFTracksQA
(
*
task
);
VertexTracksQA
(
*
task
);
// TofHitsQA(*task);
// SimParticlesQA(*task);
// SimEventHeaderQA(*task);
// RecEventHeaderQA(*task);
// EfficiencyMaps(*task);
TofHitsQA
(
*
task
);
SimParticlesQA
(
*
task
);
SimEventHeaderQA
(
*
task
);
RecEventHeaderQA
(
*
task
);
EfficiencyMaps
(
*
task
);
AddParticlesFlowQA
(
task
,
sim_particles
,
{
sim_event_header
,
"psi_RP"
},
{
2212
,
211
,
-
211
});
man
.
AddTask
(
task
);
...
...
@@ -65,18 +94,17 @@ void VertexTracksQA(QA::Task& task)
AddTracksMatchQA
(
&
task
,
rec_tracks
,
sim_particles
);
}
// Variable chi2_over_ndf("chi2_ndf", {{rec_tracks, "chi2"}, {rec_tracks, "ndf"}}, []( std::vector<double>& var ) { return var.at(0)/var.at(1); });
//
// task.AddH1({"DCA_{x}, cm", {rec_tracks, "dcax"}, {gNbins, -1, 1}});
// task.AddH1({"DCA_{y}, cm", {rec_tracks, "dcay"}, {gNbins, -1, 1}});
// task.AddH1({"DCA_{z}, cm", {rec_tracks, "dcaz"}, {gNbins, -1, 1}});
// task.AddH1({"NDF", {rec_tracks, "ndf"}, {30, 0, 30}});
// task.AddH1({"Number of hits (STS+MVD)", {rec_tracks, "nhits"}, {15, 0, 15}});
// task.AddH1({"Number of hits (MVD)", {rec_tracks, "nhits_mvd"}, {5, 0, 5}});
// task.AddH1({"#chi^{2}_{vertex}", {rec_tracks, "vtx_chi2"}, {500, 0, 100}});
// task.AddH1({"#chi^{2}/NDF", chi2_over_ndf, {gNbins, 0, 10}});
// task.AddH2({"DCA_{x}, cm", {rec_tracks, "dcax"}, {gNbins, -1, 1}}, {"DCA_{y}, cm", {rec_tracks, "dcay"}, {gNbins, -1, 1}});
//
Variable
chi2_over_ndf
(
"chi2_ndf"
,
{{
rec_tracks
,
"chi2"
},
{
rec_tracks
,
"ndf"
}},
[](
std
::
vector
<
double
>&
var
)
{
return
var
.
at
(
0
)
/
var
.
at
(
1
);
});
task
.
AddH1
({
"DCA_{x}, cm"
,
{
rec_tracks
,
"dcax"
},
{
gNbins
,
-
1
,
1
}});
task
.
AddH1
({
"DCA_{y}, cm"
,
{
rec_tracks
,
"dcay"
},
{
gNbins
,
-
1
,
1
}});
task
.
AddH1
({
"DCA_{z}, cm"
,
{
rec_tracks
,
"dcaz"
},
{
gNbins
,
-
1
,
1
}});
task
.
AddH1
({
"NDF"
,
{
rec_tracks
,
"ndf"
},
{
30
,
0
,
30
}});
task
.
AddH1
({
"Number of hits (STS+MVD)"
,
{
rec_tracks
,
"nhits"
},
{
15
,
0
,
15
}});
task
.
AddH1
({
"Number of hits (MVD)"
,
{
rec_tracks
,
"nhits_mvd"
},
{
5
,
0
,
5
}});
task
.
AddH1
({
"#chi^{2}_{vertex}"
,
{
rec_tracks
,
"vtx_chi2"
},
{
500
,
0
,
100
}});
task
.
AddH1
({
"#chi^{2}/NDF"
,
chi2_over_ndf
,
{
gNbins
,
0
,
10
}});
task
.
AddH2
({
"DCA_{x}, cm"
,
{
rec_tracks
,
"dcax"
},
{
gNbins
,
-
1
,
1
}},
{
"DCA_{y}, cm"
,
{
rec_tracks
,
"dcay"
},
{
gNbins
,
-
1
,
1
}});
}
void
TofHitsQA
(
QA
::
Task
&
task
)
...
...
@@ -86,11 +114,18 @@ void TofHitsQA(QA::Task& task)
task
.
AddH1
({
"TOF hit z-position (cm)"
,
{
tof_hits
,
"z"
},
{
gNbins
,
600
,
800
}});
task
.
AddH2
({
"TOF hit x-position (cm)"
,
{
tof_hits
,
"x"
},
{
gNbins
,
-
600
,
600
}},
{
"TOF hit y-position (cm)"
,
{
tof_hits
,
"y"
},
{
gNbins
,
-
600
,
600
}});
Variable
qp_sts
(
"qp_reco"
,
{{
rec_tracks
,
"q"
},
{
rec_tracks
,
"p"
}},
[](
std
::
vector
<
double
>&
qp
)
{
return
qp
.
at
(
0
)
*
qp
.
at
(
1
);
});
task
.
AddH2
({
"sign(q)*p, GeV/c"
,
qp_sts
,
{
gNbins
,
-
10
,
10
}},
{
"m^{2}, GeV^{2}/c^{2}"
,
{
tof_hits
,
"mass2"
},
{
gNbins
,
-
1
,
2
}});
task
.
AddH2
({
"sign(q)*p STS, GeV/c"
,
qp_sts
,
{
gNbins
,
-
10
,
10
}},
{
"sign(q)*p TOF, GeV/c"
,
{
tof_hits
,
"qp_tof"
},
{
gNbins
,
-
10
,
10
}});
}
void
SimParticlesQA
(
QA
::
Task
&
task
)
{
AddTrackQA
(
&
task
,
sim_particles
);
AddParticleQA
(
&
task
,
sim_particles
);
task
.
AddH1
({
"PDG code"
,
{
sim_particles
,
"pid"
},
{
8001
,
-
3999.5
,
4000.5
}});
}
...
...
@@ -151,14 +186,10 @@ void RecEventHeaderQA(QA::Task& task)
task
.
AddH2
({
"#it{y}_{Lab}"
,
{
sim_particles
,
"rapidity"
},
{
gNbins
,
-
1
,
5
}},
{
"p_{T}, GeV/c"
,
{
sim_particles
,
"pT"
},
{
gNbins
,
0
,
2
}},
mc_pions_pos
);
task
.
AddH2
({
"#it{y}_{Lab}"
,
pion_y
,
{
gNbins
,
-
1
,
5
}},
{
"p_{T}, GeV/c"
,
{
rec_tracks
,
"pT"
},
{
gNbins
,
0
,
2
}},
mc_pions_pos
);
}
void
KFPFTracksQA
(
QA
::
Task
&
task
)
{
const
std
::
vector
<
std
::
string
>
field_par_names_
{
"cx0"
,
"cx1"
,
"cx2"
,
"cy1"
,
"cy2"
,
"cz0"
,
"cz1"
,
"cz2"
};
const
std
::
vector
<
std
::
string
>
cov_names_
{
"cov1"
,
"cov2"
,
"cov3"
,
"cov4"
,
"cov5"
,
"cov6"
,
"cov7"
,
"cov8"
,
"cov9"
,
"cov10"
,
"cov11"
,
"cov12"
,
"cov13"
,
"cov14"
,
"cov15"
};
...
...
@@ -178,7 +209,6 @@ void KFPFTracksQA(QA::Task& task)
task
.
AddH1
({
"cy0"
,
{
rec_tracks
,
"cy0"
},
{
gNbins
,
-
12
,
-
8
}});
task
.
AddH1
({
"z0"
,
{
rec_tracks
,
"z0"
},
{
gNbins
,
0
,
40
}});
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment