Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
LHCb
Rec
Commits
0dff2df4
Commit
0dff2df4
authored
1 year ago
by
Gitlab CI
Committed by
Sascha Stahl
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Fixed formatting
patch generated by
https://gitlab.cern.ch/lhcb/Rec/-/jobs/34695717
parent
67901089
No related branches found
No related tags found
No related merge requests found
Pipeline
#6611926
passed
1 year ago
Stage: test
Stage: .post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Phys/SelAlgorithms/src/VoidMonitor.cpp
+35
-39
35 additions, 39 deletions
Phys/SelAlgorithms/src/VoidMonitor.cpp
with
35 additions
and
39 deletions
Phys/SelAlgorithms/src/VoidMonitor.cpp
+
35
−
39
View file @
0dff2df4
...
...
@@ -27,84 +27,78 @@ namespace {
using
Signature
=
std
::
any
();
static
constexpr
auto
PropertyName
=
"VariableY"
;
};
using
base_type
=
with_functors
<
LHCb
::
Algorithm
::
Producer
<
int
()
>
,
VoidFunctor
>
;
using
base_type
=
with_functors
<
LHCb
::
Algorithm
::
Producer
<
int
()
>
,
VoidFunctor
>
;
using
base_type2
=
with_functors
<
LHCb
::
Algorithm
::
Producer
<
int
()
>
,
VoidFunctorX
,
VoidFunctorY
>
;
using
value_type
=
float
;
}
// namespace
/** @class EventVariableMonitor EventVariableMonitor.cpp
*/
struct
EventVariableMonitor
final
:
public
base_type
{
EventVariableMonitor
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
base_type
{
name
,
pSvcLocator
,
{
"Dummy"
,
""
}}
{}
:
base_type
{
name
,
pSvcLocator
,
{
"Dummy"
,
""
}}
{}
int
operator
()()
const
override
{
auto
const
&
functor
=
getFunctor
<
VoidFunctor
>
();
auto
const
&
functor
=
getFunctor
<
VoidFunctor
>
();
Functors
::
detail
::
with_output_tree
::
numeric_value_wrapper
w
(
functor
.
rtype
()
);
std
::
visit
(
[
&
](
auto
&
x
)
{
auto
unwrapped
=
std
::
any_cast
<
std
::
decay_t
<
decltype
(
x
)
>>
(
std
::
invoke
(
functor
)
);
++
(
*
m_histogram
)[
LHCb
::
Utils
::
as_arithmetic
(
unwrapped
)];
},
w
.
get
()
);
[
&
](
auto
&
x
)
{
auto
unwrapped
=
std
::
any_cast
<
std
::
decay_t
<
decltype
(
x
)
>>
(
std
::
invoke
(
functor
)
);
++
(
*
m_histogram
)[
LHCb
::
Utils
::
as_arithmetic
(
unwrapped
)];
},
w
.
get
()
);
return
1
;
}
StatusCode
initialize
()
override
{
auto
sc
=
base_type
::
initialize
();
if
(
sc
.
isFailure
()
)
return
sc
;
if
(
m_histogram_title
.
value
().
empty
()
)
m_histogram_title
=
m_histogram_name
.
value
();
m_histogram
.
emplace
(
if
(
sc
.
isFailure
()
)
return
sc
;
if
(
m_histogram_title
.
value
().
empty
()
)
m_histogram_title
=
m_histogram_name
.
value
();
m_histogram
.
emplace
(
this
,
m_histogram_name
.
value
(),
m_histogram_title
.
value
(),
Gaudi
::
Accumulators
::
Axis
<
value_type
>
{
m_bins
.
value
(),
m_range
.
value
().
first
,
m_range
.
value
().
second
}
);
return
sc
;
return
sc
;
}
private
:
// Counter for recording cut retention statistics
mutable
Gaudi
::
Accumulators
::
BinomialCounter
<>
m_cutEff
{
this
,
"Cut selection efficiency"
};
private
:
private
:
// properties
Gaudi
::
Property
<
std
::
string
>
m_histogram_name
{
this
,
"HistogramName"
,
"Histogram"
,
"Histogram name"
};
Gaudi
::
Property
<
std
::
string
>
m_histogram_title
{
this
,
"HistogramTitle"
,
""
,
"Histogram title (it defaults to the histogram name)"
};
Gaudi
::
Property
<
unsigned
int
>
m_bins
{
this
,
"Bins"
,
100
};
Gaudi
::
Property
<
std
::
pair
<
value_type
,
value_type
>>
m_range
{
this
,
"Range"
,
{
0.
,
1.
}};
mutable
std
::
optional
<
Gaudi
::
Accumulators
::
Histogram
<
1
,
Gaudi
::
Accumulators
::
atomicity
::
full
,
value_type
>>
m_histogram
;
mutable
std
::
optional
<
Gaudi
::
Accumulators
::
Histogram
<
1
,
Gaudi
::
Accumulators
::
atomicity
::
full
,
value_type
>>
m_histogram
;
};
DECLARE_COMPONENT_WITH_ID
(
EventVariableMonitor
,
"Monitor__EventVariable"
)
struct
EventCorrelationsMonitor
final
:
public
base_type2
{
EventCorrelationsMonitor
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
)
:
base_type2
{
name
,
pSvcLocator
,
{
"Dummy"
,
""
}}
{}
:
base_type2
{
name
,
pSvcLocator
,
{
"Dummy"
,
""
}}
{}
int
operator
()()
const
override
{
auto
const
&
functorX
=
getFunctor
<
VoidFunctorX
>
();
auto
const
&
functorY
=
getFunctor
<
VoidFunctorY
>
();
auto
const
&
functorX
=
getFunctor
<
VoidFunctorX
>
();
auto
const
&
functorY
=
getFunctor
<
VoidFunctorY
>
();
Functors
::
detail
::
with_output_tree
::
numeric_value_wrapper
wX
(
functorX
.
rtype
()
);
Functors
::
detail
::
with_output_tree
::
numeric_value_wrapper
wY
(
functorY
.
rtype
()
);
Functors
::
detail
::
with_output_tree
::
numeric_value
valueX
;
auto
fval
=
std
::
invoke
(
functorX
);
Functors
::
detail
::
with_output_tree
::
numeric_value
valueX
;
auto
fval
=
std
::
invoke
(
functorX
);
std
::
visit
(
[
&
](
auto
&
x
)
{
valueX
=
std
::
any_cast
<
std
::
decay_t
<
decltype
(
x
)
>>
(
fval
);
},
valueX
);
// LHCb::Utils::as_arithmetic( valueX.get() );
std
::
visit
(
[
&
](
auto
&
x
)
{
auto
unwrappedX
=
std
::
any_cast
<
std
::
decay_t
<
decltype
(
x
)
>>
(
std
::
invoke
(
functorX
)
);
auto
unwrappedY
=
std
::
any_cast
<
std
::
decay_t
<
decltype
(
x
)
>>
(
std
::
invoke
(
functorY
)
);
++
(
*
m_histogram
)[{
LHCb
::
Utils
::
as_arithmetic
(
unwrappedX
),
LHCb
::
Utils
::
as_arithmetic
(
unwrappedY
)}]
;
},
wX
.
get
()
);
[
&
](
auto
&
x
)
{
auto
unwrappedX
=
std
::
any_cast
<
std
::
decay_t
<
decltype
(
x
)
>>
(
std
::
invoke
(
functorX
)
);
auto
unwrappedY
=
std
::
any_cast
<
std
::
decay_t
<
decltype
(
x
)
>>
(
std
::
invoke
(
functorY
)
);
++
(
*
m_histogram
)[{
LHCb
::
Utils
::
as_arithmetic
(
unwrappedX
),
LHCb
::
Utils
::
as_arithmetic
(
unwrappedY
)}];
},
wX
.
get
()
);
return
1
;
}
...
...
@@ -112,19 +106,20 @@ struct EventCorrelationsMonitor final : public base_type2 {
StatusCode
initialize
()
override
{
auto
sc
=
base_type2
::
initialize
();
if
(
sc
.
isFailure
()
)
return
sc
;
if
(
m_histogram_title
.
value
().
empty
()
)
m_histogram_title
=
m_histogram_name
.
value
();
m_histogram
.
emplace
(
if
(
sc
.
isFailure
()
)
return
sc
;
if
(
m_histogram_title
.
value
().
empty
()
)
m_histogram_title
=
m_histogram_name
.
value
();
m_histogram
.
emplace
(
this
,
m_histogram_name
.
value
(),
m_histogram_title
.
value
(),
Gaudi
::
Accumulators
::
Axis
<
value_type
>
{
m_binsX
.
value
(),
m_rangeX
.
value
().
first
,
m_rangeX
.
value
().
second
},
Gaudi
::
Accumulators
::
Axis
<
value_type
>
{
m_binsY
.
value
(),
m_rangeY
.
value
().
first
,
m_rangeY
.
value
().
second
}
);
return
sc
;
return
sc
;
}
private
:
// Counter for recording cut retention statistics
mutable
Gaudi
::
Accumulators
::
BinomialCounter
<>
m_cutEff
{
this
,
"Cut selection efficiency"
};
private
:
private
:
// properties
Gaudi
::
Property
<
std
::
string
>
m_histogram_name
{
this
,
"HistogramName"
,
"Histogram"
,
"Histogram name"
};
Gaudi
::
Property
<
std
::
string
>
m_histogram_title
{
this
,
"HistogramTitle"
,
""
,
...
...
@@ -133,7 +128,8 @@ private:
Gaudi
::
Property
<
unsigned
int
>
m_binsY
{
this
,
"BinsY"
,
100
};
Gaudi
::
Property
<
std
::
pair
<
value_type
,
value_type
>>
m_rangeX
{
this
,
"RangeX"
,
{
0.
,
1.
}};
Gaudi
::
Property
<
std
::
pair
<
value_type
,
value_type
>>
m_rangeY
{
this
,
"RangeY"
,
{
0.
,
1.
}};
mutable
std
::
optional
<
Gaudi
::
Accumulators
::
Histogram
<
2
,
Gaudi
::
Accumulators
::
atomicity
::
full
,
value_type
>>
m_histogram
;
mutable
std
::
optional
<
Gaudi
::
Accumulators
::
Histogram
<
2
,
Gaudi
::
Accumulators
::
atomicity
::
full
,
value_type
>>
m_histogram
;
};
DECLARE_COMPONENT_WITH_ID
(
EventCorrelationsMonitor
,
"EventCorrelationsMonitor"
)
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