Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • yoyang/Analysis
  • malexand/Analysis
  • johndan/Analysis
  • mamartin/Analysis
  • oboenteg/Analysis
  • sstahl/Analysis
  • lhcb/Analysis
7 results
Show changes
Commits on Source (1)
......@@ -31,6 +31,7 @@ gaudi_add_module(FunTuple
Rec::LoKiArrayFunctorsLib
Rec::LoKiPhysLib
Rec::FunctorCoreLib
MooreAnalysis::DecayTreeTupleBaseLib
)
gaudi_install(PYTHON)
......
......@@ -12,10 +12,8 @@
from . import functorcollections
from .FunctorCollection import FunctorCollection
from .functions import FunTuple_Particles
from .functions import FunTuple_MCParticles
from Configurables import MakeDummyMCParticles
from Configurables import MakeDummyParticles
__all__ = ("functorcollections", "FunctorCollection", "FunTuple_Particles",
"FunTuple_MCParticles", "MakeDummyMCParticles",
__all__ = ("functorcollections", "FunctorCollection", "FunTuple_Particles", "MakeDummyMCParticles",
"MakeDummyParticles")
......@@ -10,9 +10,12 @@
###############################################################################
from PyConf.Algorithms import FunTupleBase_Particles
from PyConf.Algorithms import FunTupleBase_MCParticles
#from PyConf.Algorithms import FunTupleBase_MCParticles
from PyConf.Tools import TupleToolEventInfo
from .common_util import conduct_checks_and_transform
from PyConf.application import make_odin
from PyConf.dataflow import DataHandle
from PyConf.application import make_data_with_FetchDataFromFile
def FunTuple_Particles(name,
tree_name,
......@@ -44,6 +47,7 @@ def FunTuple_Particles(name,
loki_functor_branch_names = output_args[3]
thor_functors = output_args[4]
thor_functor_branch_names = output_args[5]
return FunTupleBase_Particles(
name=name,
tree_name=tree_name,
......@@ -59,47 +63,47 @@ def FunTuple_Particles(name,
**kwargs)
def FunTuple_MCParticles(name,
tree_name,
branches,
variables,
inputs,
loki_preamble=[],
run_full_counter_mode=True,
**kwargs):
"""
Wrapper function for FunTupleBase_MCParticles
Parameters:
tree_name (string): Name of the TTree.
branches (dict): Dictionary of {branch name : decay descriptor}. The branch name is used in naming the variable in nTuple and decay descriptor in finding the candidates.
variables (dict): Dictionary of {variable name: Functor code}. The variable name is used in naming the variable in nTuple (for a given branch) and functor code used to retrive LoKi or ThOr functors.
inputs (PyConf DataHandle): Input location of LHCb::MCParticles to run over.
loki_preamble (string): A LoKi preamble that renames a complex functor built out of base functors that could be used as Functor code in "variables" dictionary above.
run_full_counter_mode (bool): A boolean to set counters and monitor each of the branches.
**kwargs: extra arguments like OutputLevel (inherited from Gaudi Algorithms) or thor_preamble (which is list of extra header files to be included when instantiating ThOr functors, usage need to be known)
Returns:
FunTuple PyConf algorithm corresponding to LHCb::MCParticles as input
"""
# def FunTuple_MCParticles(name,
# tree_name,
# branches,
# variables,
# inputs,
# loki_preamble=[],
# run_full_counter_mode=True,
# **kwargs):
# """
# Wrapper function for FunTupleBase_MCParticles
# Parameters:
# tree_name (string): Name of the TTree.
# branches (dict): Dictionary of {branch name : decay descriptor}. The branch name is used in naming the variable in nTuple and decay descriptor in finding the candidates.
# variables (dict): Dictionary of {variable name: Functor code}. The variable name is used in naming the variable in nTuple (for a given branch) and functor code used to retrive LoKi or ThOr functors.
# inputs (PyConf DataHandle): Input location of LHCb::MCParticles to run over.
# loki_preamble (string): A LoKi preamble that renames a complex functor built out of base functors that could be used as Functor code in "variables" dictionary above.
# run_full_counter_mode (bool): A boolean to set counters and monitor each of the branches.
# **kwargs: extra arguments like OutputLevel (inherited from Gaudi Algorithms) or thor_preamble (which is list of extra header files to be included when instantiating ThOr functors, usage need to be known)
# Returns:
# FunTuple PyConf algorithm corresponding to LHCb::MCParticles as input
# """
#conduct some type checks and transform to output_args that can be used to set the attributes of FunTupleBase_Particles class
input_args = (name, tree_name, branches, variables, loki_preamble)
output_args = conduct_checks_and_transform(input_args)
branch_names_prefix = output_args[0]
decay_descriptors = output_args[1]
loki_functors = output_args[2]
loki_functor_branch_names = output_args[3]
thor_functors = output_args[4]
thor_functor_branch_names = output_args[5]
return FunTupleBase_MCParticles(
name=name,
tree_name=tree_name,
branch_names_prefix=branch_names_prefix,
decay_descriptors=decay_descriptors,
loki_functors=loki_functors,
loki_functor_branch_names=loki_functor_branch_names,
thor_functors=thor_functors,
thor_functor_branch_names=thor_functor_branch_names,
loki_preamble=loki_preamble,
input_location=inputs,
run_full_counter_mode=run_full_counter_mode,
**kwargs)
# #conduct some type checks and transform to output_args that can be used to set the attributes of FunTupleBase_Particles class
# input_args = (name, tree_name, branches, variables, loki_preamble)
# output_args = conduct_checks_and_transform(input_args)
# branch_names_prefix = output_args[0]
# decay_descriptors = output_args[1]
# loki_functors = output_args[2]
# loki_functor_branch_names = output_args[3]
# thor_functors = output_args[4]
# thor_functor_branch_names = output_args[5]
# return FunTupleBase_MCParticles(
# name=name,
# tree_name=tree_name,
# branch_names_prefix=branch_names_prefix,
# decay_descriptors=decay_descriptors,
# loki_functors=loki_functors,
# loki_functor_branch_names=loki_functor_branch_names,
# thor_functors=thor_functors,
# thor_functor_branch_names=thor_functor_branch_names,
# loki_preamble=loki_preamble,
# input_location=inputs,
# run_full_counter_mode=run_full_counter_mode,
# **kwargs)
......@@ -50,6 +50,12 @@
#include "Functors/FunctorDesc.h"
#include "Functors/IFactory.h"
// TupleTool support
#include "Kernel/IParticleTupleTool.h" // Interface
#include "Kernel/IEventTupleTool.h" // Interface
namespace LHCb {
namespace FTuple {
// typedef of Consumer algorithm
......@@ -377,6 +383,10 @@ private:
ToolHandle<LoKi::IHybridFactory> m_factory_loki = {"LoKi::Hybrid::Tool/HybridFactory:PUBLIC", this};
ToolHandle<LoKi::IMCHybridFactory> m_mcfactory_loki = {"LoKi::Hybrid::MCTool/MCHybridFactory:PUBLIC", this};
ToolHandleArray<const IEventTupleTool> m_event_info_tools{this, "EventVariables", {"TupleToolTrigger", "TupleToolEventInfo"}};
// These come next :D
mutable ToolHandle<IParticleTupleTool> m_kinematics = {this, "TupleToolKinematic", "TupleToolKinematic"};
// flags to check if any loki or thor functors are empty or not
bool m_all_empty_lokifuncs{true};
bool m_all_empty_thorfuncs{true};
......@@ -744,9 +754,21 @@ void FunTupleBase<T>::write_tuple( const std::vector<std::vector<ValueType>>& ve
if ( this->msgLevel( MSG::DEBUG ) ) debug << "write_tuple: Looping over the candidates and branches" << endmsg;
for ( unsigned int ncand = 0; ncand < vector_of_cands[0].size(); ncand++ ) { // number of cands (write tuple)
for ( const auto& add_event_info : m_event_info_tools ){
add_event_info->fill(ntuple).ignore();
}
//m_event->fill(ntuple).ignore();
//m_trigger->fill(ntuple).ignore();
for ( unsigned int nbranch = 0; nbranch < vector_of_cands.size(); nbranch++ ) { // number of branches
// get the particle
const auto cand = vector_of_cands[nbranch][ncand];
auto cand_no_const = const_cast<ValueType>(cand);
std::string kinematics_name = "tupletool";
// don't know the particles name for now, so fill only once.
if (nbranch==0){
//ignore mother pointer
m_kinematics->fill(cand_no_const, cand_no_const, kinematics_name, ntuple).ignore();
}
if ( this->msgLevel( MSG::DEBUG ) ) {
debug << "write_tuple: Retrieving candidate info: " << endmsg;
debug << "write_tuple: Candidate info: " << *cand << endmsg;
......@@ -995,4 +1017,4 @@ void FunTupleBase<T>::update_counters( const unsigned int& branch_indx, const un
}
DECLARE_COMPONENT_WITH_ID( FunTupleBase<LHCb::Particle::Range>, "FunTupleBase_Particles" )
DECLARE_COMPONENT_WITH_ID( FunTupleBase<LHCb::MCParticles>, "FunTupleBase_MCParticles" )
//DECLARE_COMPONENT_WITH_ID( FunTupleBase<LHCb::MCParticles>, "FunTupleBase_MCParticles" )
......@@ -23,6 +23,7 @@ endif()
# -- Public dependencies
lhcb_find_package(Rec REQUIRED)
lhcb_find_package(MooreAnalysis REQUIRED)
find_package(Boost 1.62 REQUIRED headers)
find_package(ROOT 6.20 REQUIRED
......
......@@ -3,3 +3,4 @@ name: Analysis
license: GPL-3.0-only
dependencies:
- Rec
- MooreAnalysis