From e204ab9475d91d7e81769ce1d56f7c324a0af40c Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Tue, 18 Mar 2025 01:34:41 +0000 Subject: [PATCH] Fixed formatting patch generated by https://gitlab.cern.ch/lhcb/Phys/-/jobs/52878593 --- Phys/JetAccessories/src/HltJetBuilder.cpp | 40 ++-- Phys/JetAccessories/src/HltJetBuilder.h | 14 +- Phys/LoKiJets/src/LoKiConstituentSub.cpp | 52 ++--- Phys/LoKiJets/src/LoKiConstituentSub.h | 226 +++++++++++----------- Phys/LoKiJets/src/LoKiFastJetMaker.cpp | 33 ++-- Phys/LoKiJets/src/LoKiFastJetMaker.h | 60 +++--- 6 files changed, 224 insertions(+), 201 deletions(-) diff --git a/Phys/JetAccessories/src/HltJetBuilder.cpp b/Phys/JetAccessories/src/HltJetBuilder.cpp index 334facc52..fef6eeed5 100644 --- a/Phys/JetAccessories/src/HltJetBuilder.cpp +++ b/Phys/JetAccessories/src/HltJetBuilder.cpp @@ -62,23 +62,30 @@ HltJetBuilder::HltJetBuilder( const string& name, ISvcLocator* svc ) : DaVinciHi "FastJet clustering strategy: 0 N3Dumb, 1 Best, 2 NlnN, ...; " "see fastjet::Strategy for more options." ); - //declare constituent properties + // declare constituent properties declareProperty( "JB_enableConstituentSubtractor", jb_m_cs_enable = false, "enable constituent subtractor" ); - declareProperty( "JB_MaxDistance", jb_m_max_distance = 0.3, "Maximum allowed distance between particle i and ghost k" ); + declareProperty( "JB_MaxDistance", jb_m_max_distance = 0.3, + "Maximum allowed distance between particle i and ghost k" ); declareProperty( "JB_Alpha", jb_m_alpha = 1, "Free parameter for distance measure (exponent of pT)]" ); - declareProperty( "JB_GhostArea", jb_m_ghost_area = 0.01, "Ghost 'area' (A_g) to set density of" + declareProperty( "JB_GhostArea", jb_m_ghost_area = 0.01, + "Ghost 'area' (A_g) to set density of" " ghosts (smaller is better but slower)" ); declareProperty( "JB_MinEta", jb_m_min_eta = 2, "Minimum pseudorapidity for input particles to the subtraction" ); declareProperty( "JB_MaxEta", jb_m_max_eta = 4.5, "Maximum pseudorapidity for input particles to the subtraction" ); - declareProperty( "JB_BgERhoGridSize_rap", jb_m_bge_rho_grid_size_rap = 0.2, "Requested rapidity grid spacing for" + declareProperty( "JB_BgERhoGridSize_rap", jb_m_bge_rho_grid_size_rap = 0.2, + "Requested rapidity grid spacing for" " grid-median background estimator" ); - declareProperty( "JB_BgERhoGridSize_azm", jb_m_bge_rho_grid_size_azm = 0.2, "Requested azimuthal grid spacing for" + declareProperty( "JB_BgERhoGridSize_azm", jb_m_bge_rho_grid_size_azm = 0.2, + "Requested azimuthal grid spacing for" " grid-median background estimator" ); - declareProperty( "JB_MaxPtCorrect", jb_m_max_pt_correct = 2000, "Particles with pT > MaxPtCorrect" + declareProperty( "JB_MaxPtCorrect", jb_m_max_pt_correct = 2000, + "Particles with pT > MaxPtCorrect" " will not be corrected" ); - declareProperty( "JB_SuppressLogging", jb_m_suppress_logging = false, "Suppress standard output" + declareProperty( "JB_SuppressLogging", jb_m_suppress_logging = false, + "Suppress standard output" " logging (useful for batch mode)" ); - declareProperty( "JB_DistanceType", jb_m_distance_type = 0, "Type of distance measure between" + declareProperty( "JB_DistanceType", jb_m_distance_type = 0, + "Type of distance measure between" " particle i and ghost k. Options: 0 (deltaR), 1 (angle)" ); } @@ -99,18 +106,23 @@ StatusCode HltJetBuilder::initialize() { fj->setProperty( "Type", m_fjAlg ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); fj->setProperty( "Recombination", m_fjScheme ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - //enable constituent subtractor - fj->setProperty( "JM_enableConstituentSubtractor", jb_m_cs_enable).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ );; - //set constituent subtractor properties + // enable constituent subtractor + fj->setProperty( "JM_enableConstituentSubtractor", jb_m_cs_enable ) + .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); + ; + // set constituent subtractor properties fj->setProperty( "JM_MaxDistance", jb_m_max_distance ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); fj->setProperty( "JM_Alpha", jb_m_alpha ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); fj->setProperty( "JM_MinEta", jb_m_min_eta ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); fj->setProperty( "JM_MaxEta", jb_m_max_eta ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - fj->setProperty( "JM_BgERhoGridSize_rap", jb_m_bge_rho_grid_size_rap ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - fj->setProperty( "JM_BgERhoGridSize_azm", jb_m_bge_rho_grid_size_azm ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); + fj->setProperty( "JM_BgERhoGridSize_rap", jb_m_bge_rho_grid_size_rap ) + .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); + fj->setProperty( "JM_BgERhoGridSize_azm", jb_m_bge_rho_grid_size_azm ) + .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); fj->setProperty( "JM_MaxPtCorrect", jb_m_max_pt_correct ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); fj->setProperty( "JM_GhostArea", jb_m_ghost_area ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - fj->setProperty( "JM_SuppressLogging", jb_m_suppress_logging ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); + fj->setProperty( "JM_SuppressLogging", jb_m_suppress_logging ) + .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); fj->setProperty( "JM_DistanceType", jb_m_distance_type ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); // Retrieve the JEC histograms. if ( !m_jetEcPath.empty() ) { diff --git a/Phys/JetAccessories/src/HltJetBuilder.h b/Phys/JetAccessories/src/HltJetBuilder.h index 5b772e512..caf98925b 100644 --- a/Phys/JetAccessories/src/HltJetBuilder.h +++ b/Phys/JetAccessories/src/HltJetBuilder.h @@ -20,8 +20,8 @@ #include "Kernel/DaVinciHistoAlgorithm.h" // Jets. -#include "Kernel/IJetMaker.h" #include "Kernel/IConstituentSubtractor.h" +#include "Kernel/IJetMaker.h" #include "Kernel/JetEnums.h" // Event. @@ -141,14 +141,14 @@ private: // Constituent Subtractor property members. // declare parameters of constituent subtractor - double jb_m_max_distance; // maximum allowed distance between particle i and ghost k - double jb_m_alpha; // free parameter for distance measure (exponent of pT) - double jb_m_ghost_area; // ghost "area" (A_g) to set density of ghosts (smaller is better but slower) - double jb_m_min_eta; // minimum pseudorapidity for input particles to the subtraction - double jb_m_max_eta; // maximum pseudorapidity for input particles to the subtraction + double jb_m_max_distance; // maximum allowed distance between particle i and ghost k + double jb_m_alpha; // free parameter for distance measure (exponent of pT) + double jb_m_ghost_area; // ghost "area" (A_g) to set density of ghosts (smaller is better but slower) + double jb_m_min_eta; // minimum pseudorapidity for input particles to the subtraction + double jb_m_max_eta; // maximum pseudorapidity for input particles to the subtraction double jb_m_bge_rho_grid_size_rap; // requested rapidity grid spacing for grid-median background estimator double jb_m_bge_rho_grid_size_azm; // requested azimuthal grid spacing for grid-median background estimator - double jb_m_max_pt_correct; // particles with pT above this value will not be corrected + double jb_m_max_pt_correct; // particles with pT above this value will not be corrected // type of distance between particle i and ghost k // Options: 0 (fastjet::contrib::ConstituentSubtractor::deltaR) // 1 (fastjet::contrib::ConstituentSubtractor::angle) diff --git a/Phys/LoKiJets/src/LoKiConstituentSub.cpp b/Phys/LoKiJets/src/LoKiConstituentSub.cpp index 65b45eb2d..68c836d2c 100644 --- a/Phys/LoKiJets/src/LoKiConstituentSub.cpp +++ b/Phys/LoKiJets/src/LoKiConstituentSub.cpp @@ -12,12 +12,12 @@ // ============================================================================ /** @file * Implementation file for class LoKi::ConstituentSub - * @author Ruide Xu ruidexu@umich.edu, Ezra LESSER elesser@berkeley.edu + * @author Ruide Xu ruidexu@umich.edu, Ezra LESSER elesser@berkeley.edu * @date 2025-02-24 */ #include "LoKiConstituentSub.h" -#include "LoKi/ILoKiSvc.h" // for initializing class +#include "LoKi/ILoKiSvc.h" // for initializing class // =========================================================================== // Standard initialization of the tool @@ -34,61 +34,63 @@ StatusCode LoKi::ConstituentSub::initialize() { // =========================================================================== // Initialize the fastjet constituent subtractor using provided parameters -StatusCode LoKi::ConstituentSub::initializeSubtractor( - const bool keep_original_masses /*= false*/, const bool fix_pseudorapidity /*= false*/, - const bool do_mass_subtraction /*= false*/, const bool scale_fourmomentum /*= false*/) { +StatusCode LoKi::ConstituentSub::initializeSubtractor( const bool keep_original_masses /*= false*/, + const bool fix_pseudorapidity /*= false*/, + const bool do_mass_subtraction /*= false*/, + const bool scale_fourmomentum /*= false*/ ) { // Set distance metric between particle i and ghost k - if (m_distance_type) { + if ( m_distance_type ) { // Euclidean angle between the momenta - m_subtractor->set_distance_type(fastjet::contrib::ConstituentSubtractor::angle); + m_subtractor->set_distance_type( fastjet::contrib::ConstituentSubtractor::angle ); } else { // Default distance metric (deltaR), where // deltaR = sqrt( (y_i-y_k)^2 + (phi_i-phi_k)^2 ) - m_subtractor->set_distance_type(fastjet::contrib::ConstituentSubtractor::deltaR); + m_subtractor->set_distance_type( fastjet::contrib::ConstituentSubtractor::deltaR ); } - m_subtractor->set_max_distance(m_max_distance); - m_subtractor->set_alpha(m_alpha); - m_subtractor->set_ghost_area(m_ghost_area); - m_subtractor->set_max_eta(m_max_eta); - m_subtractor->set_background_estimator((fastjet::BackgroundEstimatorBase*)(&m_bge_rho)); + m_subtractor->set_max_distance( m_max_distance ); + m_subtractor->set_alpha( m_alpha ); + m_subtractor->set_ghost_area( m_ghost_area ); + m_subtractor->set_max_eta( m_max_eta ); + m_subtractor->set_background_estimator( (fastjet::BackgroundEstimatorBase*)( &m_bge_rho ) ); // How to treat massive particles - if (keep_original_masses) { m_subtractor->set_keep_original_masses(); } - if (fix_pseudorapidity) { m_subtractor->set_fix_pseudorapidity(); } - if (do_mass_subtraction) { m_subtractor->set_do_mass_subtraction(); } - if (scale_fourmomentum) { m_subtractor->set_scale_fourmomentum(); } + if ( keep_original_masses ) { m_subtractor->set_keep_original_masses(); } + if ( fix_pseudorapidity ) { m_subtractor->set_fix_pseudorapidity(); } + if ( do_mass_subtraction ) { m_subtractor->set_do_mass_subtraction(); } + if ( scale_fourmomentum ) { m_subtractor->set_scale_fourmomentum(); } // Include any desired selectors - sel_max_pt = fastjet::SelectorPtMax(m_max_pt_correct); + sel_max_pt = fastjet::SelectorPtMax( m_max_pt_correct ); - m_subtractor->set_particle_selector(&sel_max_pt); + m_subtractor->set_particle_selector( &sel_max_pt ); // Initialize subtractor and print helpful info (if desired) m_subtractor->initialize(); - if (!(m_suppress_logging)) { std::cout << m_subtractor->description() << std::endl; } + if ( !( m_suppress_logging ) ) { std::cout << m_subtractor->description() << std::endl; } return StatusCode::SUCCESS; } -StatusCode LoKi::ConstituentSub::subJets( IConstituentSubtractor::Input const &rawJets, IConstituentSubtractor::Output &subtractedJets ) const { +StatusCode LoKi::ConstituentSub::subJets( IConstituentSubtractor::Input const& rawJets, + IConstituentSubtractor::Output& subtractedJets ) const { // Trivial case of no particles in event if ( rawJets.empty() ) { subtractedJets = rawJets; - if ( msgLevel( MSG::DEBUG ) && !(m_suppress_logging) ) { counter( "#jets" ) += rawJets.size(); } + if ( msgLevel( MSG::DEBUG ) && !( m_suppress_logging ) ) { counter( "#jets" ) += rawJets.size(); } return StatusCode::SUCCESS; } // Estimate the background density (rho) for this event - m_bge_rho.set_particles(rawJets); + m_bge_rho.set_particles( rawJets ); // Constituent Subtraction Routine - std::vector<fastjet::PseudoJet> corrected_event = m_subtractor->subtract_event(rawJets); + std::vector<fastjet::PseudoJet> corrected_event = m_subtractor->subtract_event( rawJets ); subtractedJets = corrected_event; - if ( msgLevel( MSG::DEBUG ) && !(m_suppress_logging) ) { counter( "#jets" ) += subtractedJets.size(); } + if ( msgLevel( MSG::DEBUG ) && !( m_suppress_logging ) ) { counter( "#jets" ) += subtractedJets.size(); } return StatusCode::SUCCESS; } diff --git a/Phys/LoKiJets/src/LoKiConstituentSub.h b/Phys/LoKiJets/src/LoKiConstituentSub.h index faea60138..ecc48353b 100644 --- a/Phys/LoKiJets/src/LoKiConstituentSub.h +++ b/Phys/LoKiJets/src/LoKiConstituentSub.h @@ -12,7 +12,7 @@ // ============================================================================ /** @file * Header file for class LoKi::ConstituentSub - * @author Ruide Xu ruidexu@umich.edu Ezra LESSER elesser@berkeley.edu + * @author Ruide Xu ruidexu@umich.edu Ezra LESSER elesser@berkeley.edu * @date 2025-02-24 */ @@ -23,15 +23,15 @@ // ============================================================================ // from Gaudi // ============================================================================ -#include "GaudiAlg/GaudiTool.h" // inherit properties from GaudiTool +#include "GaudiAlg/GaudiTool.h" // inherit properties from GaudiTool // ============================================================================ // DaVinci Kernel // ============================================================================ -#include "Kernel/IConstituentSubtractor.h" // create PseudoJet object for each "particle" +#include "Kernel/IConstituentSubtractor.h" // create PseudoJet object for each "particle" // ============================================================================ // LoKi // ============================================================================ -#include "LoKi/Geometry.h" // for LoKi::Point3D +#include "LoKi/Geometry.h" // for LoKi::Point3D // ============================================================================ // FastJet // ============================================================================ @@ -39,10 +39,8 @@ #include "fastjet/Selector.hh" //#include "fastjet/tools/BackgroundEstimatorBase.hh" //#include "fastjet/tools/JetMedianBackgroundEstimator.hh" -#include "fastjet/tools/GridMedianBackgroundEstimator.hh" #include "fastjet/contrib/ConstituentSubtractor.hh" - - +#include "fastjet/tools/GridMedianBackgroundEstimator.hh" namespace LoKi { /* @@ -59,113 +57,119 @@ namespace LoKi { // class ConstituentSub : public virtual IConstituentSubtractor, public GaudiTool { - public: - StatusCode subJets( IConstituentSubtractor::Input const &rawJets, IConstituentSubtractor::Output& subtractedJets) const override; - - // Constructor - ConstituentSub( const std::string& type, const std::string& name, const IInterface* parent ) - : GaudiTool( type, name, parent ), - // Default background subtraction parameters - m_max_distance( 0.3 ), - m_alpha( 1 ), - m_ghost_area( 0.01 ), - m_min_eta( 2 ), - m_max_eta( 4.5 ), - m_bge_rho_grid_size_rap( 0.2 ), - m_bge_rho_grid_size_azm( 0.2 ), - m_max_pt_correct( 2000 ), - m_distance_type( 0 ), - m_keep_original_masses( false ), - m_fix_pseudorapidity( false ), - m_do_mass_subtraction( false ), - m_scale_fourmomentum( false ), - m_suppress_logging( false ) { - - // Set the background estimator to calculate background desnity (rho) - // Options: GridMedianBackgroundEstimator or JetMedianBackgroundEstimator - // -- use former by default (TODO: implement choice of estimator) - //this->m_bge_rho = new fastjet::GridMedianBackgroundEstimator( this->m_max_eta, this->m_bge_rho_grid_size ); - - // Initialize background subtractor - this->m_subtractor = new fastjet::contrib::ConstituentSubtractor(); - StatusCode sc = this->initializeSubtractor( - this->m_keep_original_masses, this->m_fix_pseudorapidity, - this->m_do_mass_subtraction, this->m_scale_fourmomentum ); - - declareInterface<IConstituentSubtractor>( this ); - declareProperty( "CS_MaxDistance", m_max_distance, "Maximum allowed distance between particle i and ghost k" ); - declareProperty( "CS_Alpha", m_alpha, "Free parameter for distance measure (exponent of pT)]" ); - declareProperty( "CS_MinEta", m_min_eta, "Minimum pseudorapidity for input particles to the subtraction" ); - declareProperty( "CS_MaxEta", m_max_eta, "Maximum pseudorapidity for input particles to the subtraction" ); - declareProperty( "CS_BgERhoGridSize_rap", m_bge_rho_grid_size_rap, "Requested rapidity grid spacing for grid-median background estimator" ); - declareProperty( "CS_BgERhoGridSize_azm", m_bge_rho_grid_size_azm, "Requested azimuthal grid spacing for grid-median background estimator" ); - declareProperty( "CS_MaxPtCorrect", m_max_pt_correct, "Particles with pT > MaxPtCorrect will not be corrected" ); - declareProperty( "CS_GhostArea", m_ghost_area, "Ghost 'area' (A_g) to set density of ghosts (smaller is better but slower)" ); - declareProperty( "CS_SuppressLogging", m_suppress_logging, "Suppress standard output logging (useful for batch mode)" ); - declareProperty( "CS_DistanceType", m_distance_type, "Type of distance measure between particle i and ghost k. Options: 0 (deltaR), 1 (angle)" ); - } - - // Destructor - virtual ~ConstituentSub( ) { - // Clean up virtual memory - //delete m_bge_rho; - delete m_subtractor; - } - - // Standard initialization of the tool - StatusCode initialize() override; - - private: - // the default constructor is disabled - ConstituentSub(); - // the copy constructor is disabled - ConstituentSub( const ConstituentSub& ); - // the assignement operator is disabled - ConstituentSub& operator=( const ConstituentSub& ); - - protected: - double m_max_distance; // maximum allowed distance between particle i and ghost k - double m_alpha; // free parameter for distance measure (exponent of pT) - double m_ghost_area; // ghost "area" (A_g) to set density of ghosts (smaller is better but slower) - double m_min_eta; // minimum pseudorapidity for input particles to the subtraction - double m_max_eta; // maximum pseudorapidity for input particles to the subtraction - double m_bge_rho_grid_size_rap; // requested rapidity grid spacing for grid-median background estimator - double m_bge_rho_grid_size_azm; // requested azimuthal grid spacing for grid-median background estimator - double m_max_pt_correct; // particles with pT above this value will not be corrected - - // type of distance between particle i and ghost k - // Options: 0 (fastjet::contrib::ConstituentSubtractor::deltaR) - // 1 (fastjet::contrib::ConstituentSubtractor::angle) - int m_distance_type; - - // mass handling settings - bool m_keep_original_masses; - bool m_fix_pseudorapidity; - bool m_do_mass_subtraction; - bool m_scale_fourmomentum; - - bool m_suppress_logging; // suppress standard output logging (useful for batch mode) - - fastjet::Selector sel_max_pt; - - // Check all of the parameters which should be initialized - inline StatusCode checkParams() const { - if ( m_max_distance < 0 || m_alpha < 0 || m_min_eta < 0 || m_max_eta < 0 || m_bge_rho_grid_size_rap < 0 || - m_bge_rho_grid_size_azm < 0 ||m_max_pt_correct < 0 || m_ghost_area <= 0 || m_distance_type < 0 ) { - return Error( "Invalid input parameters specified" ); - } - return StatusCode::SUCCESS; + public: + StatusCode subJets( IConstituentSubtractor::Input const& rawJets, + IConstituentSubtractor::Output& subtractedJets ) const override; + + // Constructor + ConstituentSub( const std::string& type, const std::string& name, const IInterface* parent ) + : GaudiTool( type, name, parent ) + , + // Default background subtraction parameters + m_max_distance( 0.3 ) + , m_alpha( 1 ) + , m_ghost_area( 0.01 ) + , m_min_eta( 2 ) + , m_max_eta( 4.5 ) + , m_bge_rho_grid_size_rap( 0.2 ) + , m_bge_rho_grid_size_azm( 0.2 ) + , m_max_pt_correct( 2000 ) + , m_distance_type( 0 ) + , m_keep_original_masses( false ) + , m_fix_pseudorapidity( false ) + , m_do_mass_subtraction( false ) + , m_scale_fourmomentum( false ) + , m_suppress_logging( false ) { + + // Set the background estimator to calculate background desnity (rho) + // Options: GridMedianBackgroundEstimator or JetMedianBackgroundEstimator + // -- use former by default (TODO: implement choice of estimator) + // this->m_bge_rho = new fastjet::GridMedianBackgroundEstimator( this->m_max_eta, this->m_bge_rho_grid_size ); + + // Initialize background subtractor + this->m_subtractor = new fastjet::contrib::ConstituentSubtractor(); + StatusCode sc = this->initializeSubtractor( this->m_keep_original_masses, this->m_fix_pseudorapidity, + this->m_do_mass_subtraction, this->m_scale_fourmomentum ); + + declareInterface<IConstituentSubtractor>( this ); + declareProperty( "CS_MaxDistance", m_max_distance, "Maximum allowed distance between particle i and ghost k" ); + declareProperty( "CS_Alpha", m_alpha, "Free parameter for distance measure (exponent of pT)]" ); + declareProperty( "CS_MinEta", m_min_eta, "Minimum pseudorapidity for input particles to the subtraction" ); + declareProperty( "CS_MaxEta", m_max_eta, "Maximum pseudorapidity for input particles to the subtraction" ); + declareProperty( "CS_BgERhoGridSize_rap", m_bge_rho_grid_size_rap, + "Requested rapidity grid spacing for grid-median background estimator" ); + declareProperty( "CS_BgERhoGridSize_azm", m_bge_rho_grid_size_azm, + "Requested azimuthal grid spacing for grid-median background estimator" ); + declareProperty( "CS_MaxPtCorrect", m_max_pt_correct, "Particles with pT > MaxPtCorrect will not be corrected" ); + declareProperty( "CS_GhostArea", m_ghost_area, + "Ghost 'area' (A_g) to set density of ghosts (smaller is better but slower)" ); + declareProperty( "CS_SuppressLogging", m_suppress_logging, + "Suppress standard output logging (useful for batch mode)" ); + declareProperty( "CS_DistanceType", m_distance_type, + "Type of distance measure between particle i and ghost k. Options: 0 (deltaR), 1 (angle)" ); + } + + // Destructor + virtual ~ConstituentSub() { + // Clean up virtual memory + // delete m_bge_rho; + delete m_subtractor; + } + + // Standard initialization of the tool + StatusCode initialize() override; + + private: + // the default constructor is disabled + ConstituentSub(); + // the copy constructor is disabled + ConstituentSub( const ConstituentSub& ); + // the assignement operator is disabled + ConstituentSub& operator=( const ConstituentSub& ); + + protected: + double m_max_distance; // maximum allowed distance between particle i and ghost k + double m_alpha; // free parameter for distance measure (exponent of pT) + double m_ghost_area; // ghost "area" (A_g) to set density of ghosts (smaller is better but slower) + double m_min_eta; // minimum pseudorapidity for input particles to the subtraction + double m_max_eta; // maximum pseudorapidity for input particles to the subtraction + double m_bge_rho_grid_size_rap; // requested rapidity grid spacing for grid-median background estimator + double m_bge_rho_grid_size_azm; // requested azimuthal grid spacing for grid-median background estimator + double m_max_pt_correct; // particles with pT above this value will not be corrected + + // type of distance between particle i and ghost k + // Options: 0 (fastjet::contrib::ConstituentSubtractor::deltaR) + // 1 (fastjet::contrib::ConstituentSubtractor::angle) + int m_distance_type; + + // mass handling settings + bool m_keep_original_masses; + bool m_fix_pseudorapidity; + bool m_do_mass_subtraction; + bool m_scale_fourmomentum; + + bool m_suppress_logging; // suppress standard output logging (useful for batch mode) + + fastjet::Selector sel_max_pt; + + // Check all of the parameters which should be initialized + inline StatusCode checkParams() const { + if ( m_max_distance < 0 || m_alpha < 0 || m_min_eta < 0 || m_max_eta < 0 || m_bge_rho_grid_size_rap < 0 || + m_bge_rho_grid_size_azm < 0 || m_max_pt_correct < 0 || m_ghost_area <= 0 || m_distance_type < 0 ) { + return Error( "Invalid input parameters specified" ); } + return StatusCode::SUCCESS; + } - // Determines the area and the grid size for background mometum estimator - mutable fastjet::GridMedianBackgroundEstimator m_bge_rho = fastjet::GridMedianBackgroundEstimator( m_min_eta, m_max_eta, m_bge_rho_grid_size_rap, m_bge_rho_grid_size_azm); - fastjet::contrib::ConstituentSubtractor* m_subtractor = nullptr; // Background subtractor object + // Determines the area and the grid size for background mometum estimator + mutable fastjet::GridMedianBackgroundEstimator m_bge_rho = fastjet::GridMedianBackgroundEstimator( + m_min_eta, m_max_eta, m_bge_rho_grid_size_rap, m_bge_rho_grid_size_azm ); + fastjet::contrib::ConstituentSubtractor* m_subtractor = nullptr; // Background subtractor object - // Initialize the fastjet constituent subtractor using provided parameters - StatusCode initializeSubtractor( - const bool keep_original_masses = false, const bool fix_pseudorapidity = false, - const bool do_mass_subtraction = false, const bool scale_fourmomentum = false); + // Initialize the fastjet constituent subtractor using provided parameters + StatusCode initializeSubtractor( const bool keep_original_masses = false, const bool fix_pseudorapidity = false, + const bool do_mass_subtraction = false, const bool scale_fourmomentum = false ); }; -} +} // namespace LoKi #endif diff --git a/Phys/LoKiJets/src/LoKiFastJetMaker.cpp b/Phys/LoKiJets/src/LoKiFastJetMaker.cpp index 99edcd7a8..873c70311 100644 --- a/Phys/LoKiJets/src/LoKiFastJetMaker.cpp +++ b/Phys/LoKiJets/src/LoKiFastJetMaker.cpp @@ -126,7 +126,6 @@ StatusCode LoKi::FastJetMaker::makeJets( const IJetMaker::Input& input_, IJetMak fastjet::ClusterSequence* clusters = nullptr; - // trivial case of empty event if ( inputs.empty() ) { IJetMaker::Jets output; @@ -136,38 +135,36 @@ StatusCode LoKi::FastJetMaker::makeJets( const IJetMaker::Input& input_, IJetMak if ( msgLevel( MSG::DEBUG ) ) { counter( "#jets" ) += output.size(); } return StatusCode::SUCCESS; - } + } // execute constituent subtractor if enabled - if (m_cs_enable) { - subjets.reserve(inputs.size()); + if ( m_cs_enable ) { + subjets.reserve( inputs.size() ); - //set constituent subtractor properties + // set constituent subtractor properties GaudiTool* cs = dynamic_cast<GaudiTool*>( m_cs ); cs->setProperty( "CS_MaxDistance", jm_m_max_distance ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); cs->setProperty( "CS_Alpha", jm_m_alpha ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); cs->setProperty( "CS_MinEta", jm_m_min_eta ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); cs->setProperty( "CS_MaxEta", jm_m_max_eta ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - cs->setProperty( "CS_BgERhoGridSize_rap", jm_m_bge_rho_grid_size_azm ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - cs->setProperty( "CS_BgERhoGridSize_azm", jm_m_bge_rho_grid_size_rap ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); + cs->setProperty( "CS_BgERhoGridSize_rap", jm_m_bge_rho_grid_size_azm ) + .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); + cs->setProperty( "CS_BgERhoGridSize_azm", jm_m_bge_rho_grid_size_rap ) + .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); cs->setProperty( "CS_MaxPtCorrect", jm_m_max_pt_correct ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); cs->setProperty( "CS_GhostArea", jm_m_ghost_area ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - cs->setProperty( "CS_SuppressLogging", jm_m_suppress_logging ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); + cs->setProperty( "CS_SuppressLogging", jm_m_suppress_logging ) + .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); cs->setProperty( "CS_DistanceType", jm_m_distance_type ).ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); - - //run constituent subtractor - StatusCode sc = m_cs->subJets(inputs, subjets); - - if (sc.isFailure()) { - return sc; - } + + // run constituent subtractor + StatusCode sc = m_cs->subJets( inputs, subjets ); + + if ( sc.isFailure() ) { return sc; } clusters = new fastjet::ClusterSequence( subjets, jetDef ); } else { // if constituent subtractor is disabled clusters = new fastjet::ClusterSequence( inputs, jetDef ); } - - - switch ( m_sort ) { case 3: diff --git a/Phys/LoKiJets/src/LoKiFastJetMaker.h b/Phys/LoKiJets/src/LoKiFastJetMaker.h index dd6788bde..0669c9c40 100644 --- a/Phys/LoKiJets/src/LoKiFastJetMaker.h +++ b/Phys/LoKiJets/src/LoKiFastJetMaker.h @@ -117,7 +117,7 @@ namespace LoKi { */ FastJetMaker( const std::string& type, const std::string& name, const IInterface* parent ) : GaudiTool( type, name, parent ) - , m_cs(0) + , m_cs( 0 ) //, jm_m_max_distance( 0.3 ) //, jm_m_alpha( 1 ) //, jm_m_ghost_area( 0.01 ) @@ -128,7 +128,7 @@ namespace LoKi { //, jm_m_max_pt_correct(2000) //, jm_m_distance_type( 0 ) //, jm_m_suppress_logging( false ) - + , m_jetID( 98 ) // , m_type( 0 ) @@ -143,8 +143,8 @@ namespace LoKi { // , m_combinerName( "MomentumCombiner" ) , m_combiner( 0 ) - //, m_cs_enable(false) - { + //, m_cs_enable(false) + { // declareInterface<IJetMaker>( this ); // @@ -160,18 +160,26 @@ namespace LoKi { declareProperty( "ShowBanner", m_showBanner = false, "Print the FastJet banner if true." ); // define momentum combiner declareProperty( "ParticleCombiner", m_combinerName ); - //constituent subtractor properties - declareProperty( "JM_enableConstituentSubtractor", m_cs_enable=false, "enable constituent subtractor" ); - declareProperty( "JM_MaxDistance", jm_m_max_distance=0.3, "Maximum allowed distance between particle i and ghost k" ); - declareProperty( "JM_Alpha", jm_m_alpha=1, "Free parameter for distance measure (exponent of pT)]" ); - declareProperty( "JM_GhostArea", jm_m_ghost_area=0.01, "Ghost 'area' (A_g) to set density of ghosts (smaller is better but slower)" ); - declareProperty( "JM_MinEta", jm_m_min_eta=2, "Minimum pseudorapidity for input particles to the subtraction" ); - declareProperty( "JM_MaxEta", jm_m_max_eta=4.5, "Maximum pseudorapidity for input particles to the subtraction" ); - declareProperty( "JM_BgERhoGridSize_rap", jm_m_bge_rho_grid_size_rap=0.2, "Requested rapidity grid spacing for grid-median background estimator" ); - declareProperty( "JM_BgERhoGridSize_azm", jm_m_bge_rho_grid_size_azm=0.2, "Requested azimuthal grid spacing for grid-median background estimator" ); - declareProperty( "JM_MaxPtCorrect", jm_m_max_pt_correct = 2000, "Particles with pT > MaxPtCorrect will not be corrected" ); - declareProperty( "JM_SuppressLogging", jm_m_suppress_logging=false, "Suppress standard output logging (useful for batch mode)" ); - declareProperty( "JM_DistanceType", jm_m_distance_type=0, "Type of distance measure between particle i and ghost k. Options: 0 (deltaR), 1 (angle)" ); + // constituent subtractor properties + declareProperty( "JM_enableConstituentSubtractor", m_cs_enable = false, "enable constituent subtractor" ); + declareProperty( "JM_MaxDistance", jm_m_max_distance = 0.3, + "Maximum allowed distance between particle i and ghost k" ); + declareProperty( "JM_Alpha", jm_m_alpha = 1, "Free parameter for distance measure (exponent of pT)]" ); + declareProperty( "JM_GhostArea", jm_m_ghost_area = 0.01, + "Ghost 'area' (A_g) to set density of ghosts (smaller is better but slower)" ); + declareProperty( "JM_MinEta", jm_m_min_eta = 2, "Minimum pseudorapidity for input particles to the subtraction" ); + declareProperty( "JM_MaxEta", jm_m_max_eta = 4.5, + "Maximum pseudorapidity for input particles to the subtraction" ); + declareProperty( "JM_BgERhoGridSize_rap", jm_m_bge_rho_grid_size_rap = 0.2, + "Requested rapidity grid spacing for grid-median background estimator" ); + declareProperty( "JM_BgERhoGridSize_azm", jm_m_bge_rho_grid_size_azm = 0.2, + "Requested azimuthal grid spacing for grid-median background estimator" ); + declareProperty( "JM_MaxPtCorrect", jm_m_max_pt_correct = 2000, + "Particles with pT > MaxPtCorrect will not be corrected" ); + declareProperty( "JM_SuppressLogging", jm_m_suppress_logging = false, + "Suppress standard output logging (useful for batch mode)" ); + declareProperty( "JM_DistanceType", jm_m_distance_type = 0, + "Type of distance measure between particle i and ghost k. Options: 0 (deltaR), 1 (angle)" ); } /// destructor virtual ~FastJetMaker() {} @@ -286,25 +294,25 @@ namespace LoKi { FastJetMaker( const FastJetMaker& ); // the assignement operator is disabled FastJetMaker& operator=( const FastJetMaker& ); - + protected: - //constituent subtractor related declarations - double jm_m_max_distance; // maximum allowed distance between particle i and ghost k - double jm_m_alpha; // free parameter for distance measure (exponent of pT) - double jm_m_ghost_area; // ghost "area" (A_g) to set density of ghosts (smaller is better but slower) - double jm_m_min_eta; // minimum pseudorapidity for input particles to the subtraction - double jm_m_max_eta; // maximum pseudorapidity for input particles to the subtraction + // constituent subtractor related declarations + double jm_m_max_distance; // maximum allowed distance between particle i and ghost k + double jm_m_alpha; // free parameter for distance measure (exponent of pT) + double jm_m_ghost_area; // ghost "area" (A_g) to set density of ghosts (smaller is better but slower) + double jm_m_min_eta; // minimum pseudorapidity for input particles to the subtraction + double jm_m_max_eta; // maximum pseudorapidity for input particles to the subtraction double jm_m_bge_rho_grid_size_rap; // requested rapidity grid spacing for grid-median background estimator double jm_m_bge_rho_grid_size_azm; // requested azimuthal grid spacing for grid-median background estimator - double jm_m_max_pt_correct; // particles with pT above this value will not be corrected + double jm_m_max_pt_correct; // particles with pT above this value will not be corrected // type of distance between particle i and ghost k // Options: 0 (fastjet::contrib::ConstituentSubtractor::deltaR) // 1 (fastjet::contrib::ConstituentSubtractor::angle) int jm_m_distance_type; // if suppress output for constituent subtractor bool jm_m_suppress_logging; - //Declare constituent subtractor interface - IConstituentSubtractor* m_cs; + // Declare constituent subtractor interface + IConstituentSubtractor* m_cs; protected: // proposed jet ID -- GitLab