Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Analysis
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
Analysis
Commits
58937fd7
Commit
58937fd7
authored
1 year ago
by
Abhijit Mathad
Committed by
Patrick Koppenburg
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add multiple candidate info with a switch
parent
dc445a9b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!980
Add multiple candidate info with a switch
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Phys/FunTuple/src/FunTuple.cpp
+43
-2
43 additions, 2 deletions
Phys/FunTuple/src/FunTuple.cpp
with
43 additions
and
2 deletions
Phys/FunTuple/src/FunTuple.cpp
+
43
−
2
View file @
58937fd7
...
...
@@ -222,6 +222,10 @@ protected:
// function for filling void functors
void
fill_void_func_output
(
const
Tuples
::
Tuple
&
ntuple
)
const
;
// function for filling multiple candidate info
void
fill_multiple_cand_info
(
const
Tuples
::
Tuple
&
ntuple
,
const
std
::
size_t
totcand
,
const
unsigned
int
icand
)
const
;
// function for filling loki functors
void
fill_loki_func_output
(
const
typename
LHCb
::
InputTypeSignature
<
T
>::
LoKiItemType
&
cand
,
const
unsigned
int
&
nfield
,
const
Tuples
::
Tuple
&
ntuple
)
const
;
...
...
@@ -267,6 +271,10 @@ private:
Gaudi
::
Property
<
std
::
vector
<
std
::
string
>>
m_preamble_def_loki
{
this
,
"loki_preamble"
,
{},
"List of preamble strings"
};
std
::
string
m_preamble_loki
;
/// boolean to store multiple candidate information (default: false)
Gaudi
::
Property
<
bool
>
m_store_multiple_cand_info
{
this
,
"store_multiple_cand_info"
,
false
,
"Store the candidate index and the total number of candidates"
};
//// Loki functor factory
ToolHandle
<
typename
LHCb
::
InputTypeSignature
<
T
>::
LoKiFactory
>
m_factory_loki
=
{
LHCb
::
InputTypeSignature
<
T
>::
LoKiFactoryString
,
this
};
...
...
@@ -694,12 +702,18 @@ void FunTupleBase<T>::write_tuple( const LHCb::FTuple::retype<T>& vector_of_cand
if
(
this
->
msgLevel
(
MSG
::
DEBUG
)
)
{
debug
<<
"write_tuple: Candidates found booking their info"
<<
endmsg
;
}
Tuples
::
Tuple
ntuple
=
this
->
nTuple
(
m_ntupleTname
);
for
(
unsigned
int
ncand
=
0
;
ncand
<
vector_of_cands
[
0
].
size
();
ncand
++
)
{
// number of cands (write tuple)
// total number of candidates
std
::
size_t
totcand
{
vector_of_cands
[
0
].
size
()};
for
(
unsigned
int
icand
=
0
;
icand
<
vector_of_cands
[
0
].
size
();
icand
++
)
{
// number of cands (write tuple)
// if requested store the total number of candidates and the candidate index
if
(
m_store_multiple_cand_info
)
fill_multiple_cand_info
(
ntuple
,
totcand
,
icand
);
// fill void functors
fill_void_func_output
(
ntuple
);
for
(
unsigned
int
nfield
=
0
;
nfield
<
vector_of_cands
.
size
();
nfield
++
)
{
// number of fields i.e decay descriptors
// get the particle
const
auto
cand
=
vector_of_cands
[
nfield
][
n
cand
];
const
auto
cand
=
vector_of_cands
[
nfield
][
i
cand
];
// fill loki functors
if
(
!
m_all_empty_lokifuncs
)
fill_loki_func_output
(
*
cand
,
nfield
,
ntuple
);
// fill thor functors
...
...
@@ -733,7 +747,14 @@ void FunTupleBase<T>::write_tuple( const LHCb::FTuple::retype<T>& vector_of_cand
// Hard code "nfield" to zero ie head of the decay here
unsigned
int
nfield
{
0
};
auto
const
iterable
=
LHCb
::
Event
::
make_zip
<
SIMDWrapper
::
Scalar
>
(
vector_of_cands
);
// total number of candidates
std
::
size_t
totcand
{
vector_of_cands
.
size
()};
unsigned
int
icand
{
0
};
for
(
auto
const
&
cand
:
iterable
)
{
// number of cands (write tuple)
// if requested store the total number of candidates and the candidate index
if
(
m_store_multiple_cand_info
)
fill_multiple_cand_info
(
ntuple
,
totcand
,
icand
);
// fill void functors
fill_void_func_output
(
ntuple
);
// fill thor functors
if
(
!
m_all_empty_thorfuncs
)
fill_thor_func_output
(
cand
,
nfield
,
ntuple
);
...
...
@@ -741,6 +762,9 @@ void FunTupleBase<T>::write_tuple( const LHCb::FTuple::retype<T>& vector_of_cand
if
(
this
->
msgLevel
(
MSG
::
DEBUG
)
)
{
debug
<<
"write_tuple: Writing tuple after booking"
<<
endmsg
;
}
StatusCode
sc_write
=
ntuple
->
write
();
if
(
sc_write
.
isFailure
()
)
{
this
->
err
()
<<
"Unable to write the tuple"
<<
endmsg
;
}
// increment counter
++
icand
;
}
}
...
...
@@ -771,6 +795,23 @@ void FunTupleBase<T>::fill_void_func_output( const Tuples::Tuple& ntuple ) const
}
}
template
<
class
T
>
void
FunTupleBase
<
T
>::
fill_multiple_cand_info
(
const
Tuples
::
Tuple
&
ntuple
,
const
std
::
size_t
totcand
,
const
unsigned
int
icand
)
const
{
// A warning is raised by GaudiTupleAlg about "'unsigned long' has different sizes on 32/64 bit systems, casting
// 'totCandidates' to 'unsigned long long'". To avoid this warning thrown after event loop, we cast the size_t to
// unsigned long long here itself.
// See also issue: https://gitlab.cern.ch/lhcb/DaVinci/-/issues/48
StatusCode
sc_totcand
=
ntuple
->
column
(
"totCandidates"
,
static_cast
<
unsigned
long
long
>
(
totcand
)
);
if
(
sc_totcand
.
isFailure
()
)
throw
GaudiException
(
"Error booking the total number of candidates (totCandidates)"
,
"write_tuple"
,
StatusCode
::
FAILURE
);
StatusCode
sc_ncand
=
ntuple
->
column
(
"nCandidate"
,
icand
);
if
(
sc_ncand
.
isFailure
()
)
throw
GaudiException
(
"Error booking the candidate number (nCandidate)"
,
"write_tuple"
,
StatusCode
::
FAILURE
);
}
template
<
class
T
>
void
FunTupleBase
<
T
>::
fill_loki_func_output
(
const
typename
LHCb
::
InputTypeSignature
<
T
>::
LoKiItemType
&
cand
,
const
unsigned
int
&
nfield
,
const
Tuples
::
Tuple
&
ntuple
)
const
{
...
...
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