ATLAS Offline Software
FastJetInterfaceTool.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef JETREC_FASTJETINTERFACETOOL_H
8 #define JETREC_FASTJETINTERFACETOOL_H
9 
10 //#include "AthenaBaseComps/AthAlgTool.h"
11 #include "AsgTools/AsgTool.h"
12 
13 
14 #include "fastjet/ClusterSequence.hh"
15 #include "fastjet/JetDefinition.hh"
16 #include "fastjet/AreaDefinition.hh"
17 
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 #include <stdint.h>
24 
25 #ifndef XAOD_STANDALONE
26 // support contribs only in athena for now
27 #include "fastjet/SISConePlugin.hh"
28 #include "fastjet/CMSIterativeConePlugin.hh"
29 #endif
30 
31 // #include <iostream>
32 
34 {
36  typedef std::map<std::string,fastjet::JetAlgorithm> algomap_t;
38  typedef std::map<std::string,fastjet::Strategy> strategymap_t;
40  typedef std::map<std::string,fastjet::RecombinationScheme> schememap_t;
42 #ifndef XAOD_STANDALONE
43  typedef std::map<std::string,fastjet::SISConePlugin::SplitMergeScale> splitMergeScaleMap_t;
44 #else
45  typedef std::map<std::string,int> splitMergeScaleMap_t;
46 #endif
47 
48  typedef std::map<std::string,fastjet::AreaType> areamap_t;
49 
51  typedef fastjet::PseudoJet fjet_t;
53  typedef std::vector<fjet_t> fjetlist_t;
54 
55  // static const algomap_t& getKnownAlgorithms();
56  // static const strategymap_t& getKnownStrategies();
57  // static const schememap_t& getKnownRecombinationSchemes();
58  // static const areamap_t& getKnownAreas();
59 
71  template<class D,class M>
72  static bool chkConfig(const std::string& key,D& tag,const M& map)
73  {
74  // std::cout << "Looking for key <" << key << "> in " << map.size() << " entries." << std::endl;
75  typename M::const_iterator fMap(map.find(key));
76  if ( fMap != map.end() ) { tag = (*fMap).second; return true; }
77  else { return false; }
78  }
79 
91  template<class D,class M>
92  const std::string& cfgName(D tag,const M& map,const std::string& invalidKey)
93  {
94  typename M::const_iterator fMap(map.begin());
95  typename M::const_iterator lMap(map.end());
96  while ( fMap != lMap && (*fMap).second != tag ) { ++fMap; }
97  return fMap != lMap ? (*fMap).first : invalidKey;
98  }
99 }
100 
108  virtual public IFastJetInterfaceTool {
109 
110 public:
111 
113 
114 
115  FastJetInterfaceTool(const std::string& n);
117  virtual ~FastJetInterfaceTool();
118 
123  virtual StatusCode initialize();
124 
134  virtual StatusCode execute(const fjetlist_t& inJets,fjetlist_t& outJets);
135 
145 
154  virtual const fastjet::ClusterSequence* clusterSequence() const;
155 
167  template<class S>
169  { return dynamic_cast<S*>(this->clusterSequence()); }
170 
171 
183  template<class S>
184  const S* specificClusterSequence() const
185  { return dynamic_cast<const S*>(this->clusterSequence()); }
186 
193  const fastjet::JetDefinition* getJetDefinition() const;
194 
201  const fastjet::AreaDefinition* getAreaDefinition() const;
202 
209  const std::string getAreaDefinitionType() const;
210 
221 
222 protected:
223 
227  std::string m_jetAlgorithmType;
232 
247 
249  double m_radius;
257  double m_pTmin;
258 
279 
287  bool checkConfig(const std::string& key,fastjet::JetAlgorithm& fjalg);
288 
296  bool checkConfig(const std::string& key,fastjet::Strategy& fjstr);
297 
305  bool checkConfig(const std::string& key,fastjet::RecombinationScheme& fjrs);
306 
314 #ifndef XAOD_STANDALONE
315  bool checkConfig(const std::string& key,fastjet::SISConePlugin::SplitMergeScale& fjsms);
316 #endif
317 
324  bool checkConfig(const std::string& tag,fastjet::AreaType& fjart);
325 
332  const std::string& configName(fastjet::JetAlgorithm fjalg);
333 
340  const std::string& configName(fastjet::Strategy fjstr);
341 
348  const std::string& configName(fastjet::RecombinationScheme fjrs);
349 
356 #ifndef XAOD_STANDALONE
357  const std::string& configName(fastjet::SISConePlugin::SplitMergeScale fjsms);
358 #endif
359 
366  const std::string& configName(fastjet::AreaType fjart);
367 
368 
369 private:
370 
372  static const std::string m_invalidKeyReference;
373 
375  unsigned int m_failedExecCtr;
377  static const unsigned int m_failedExecCtrMax;
378 
379 
380 
381 
382 protected:
383 
385  fastjet::JetAlgorithm m_jetAlgorithm;
389  fastjet::AreaType m_areaType;
391  fastjet::RecombinationScheme m_recombinationScheme;
393 #ifndef XAOD_STANDALONE
394  fastjet::SISConePlugin::SplitMergeScale m_SIS_splitMergeScale;
395 #endif
396 
397  fastjet::JetDefinition* m_jetDefinition;
401  fastjet::AreaDefinition* m_areaDefinition;
402 
407 
408 
410  typedef StatusCode
414  typedef StatusCode
416 
421 
439 
456 
497 
498 
499 
501  virtual void updateRandomSeeds();
502 
503 
504 };
505 
529 // inline
530 // const FastJetInterface::algomap_t& FastJetInterface::getKnownAlgorithms()
531 // { return FastJetInterfaceTool::getKnownAlgorithms(); }
532 
533 // inline
534 // const FastJetInterface::strategymap_t& FastJetInterface::getKnownStrategies()
535 // { return FastJetInteraceTool::getKnownStrategies(); }
536 
537 // inline
538 // const FastJetInterface::schememap_t&
539 // FastJetInterface::getKnownRecombinationSchemes()
540 // { return FastJetInterfaceTool::getKnownRecombinationSchemes(); }
541 
542 // inline
543 // const FastJetInterface::areamap_t& FastJetInterface::getKnownAreas()
544 // { return FastJetInterfaceTool::getKnownAreas(); }
545 
546 #endif
FastJetInterfaceTool::m_processor
PROCESSOR m_processor
Pointer to processor.
Definition: FastJetInterfaceTool.h:418
FastJetInterfaceTool::m_invalidKeyReference
static const std::string m_invalidKeyReference
Reference for invalid fastjet tag.
Definition: FastJetInterfaceTool.h:372
FastJetInterfaceTool::getAreaDefinition
const fastjet::AreaDefinition * getAreaDefinition() const
Access fastjet AreaDefinition.
Definition: FastJetInterfaceTool.cxx:587
FastJetInterfaceTool::m_jetDefinition
fastjet::JetDefinition * m_jetDefinition
Pointer to jet definition.
Definition: FastJetInterfaceTool.h:397
FastJetInterfaceTool::m_jetAreaDefinitionType
std::string m_jetAreaDefinitionType
fastjet property: jet area definition
Definition: FastJetInterfaceTool.h:262
FastJetInterfaceTool::m_pTmin
double m_pTmin
Inclusive jet finder property: pTmin cut.
Definition: FastJetInterfaceTool.h:257
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
FastJetInterfaceTool::initialize
virtual StatusCode initialize()
Initialize tool.
Definition: FastJetInterfaceTool.cxx:234
FastJetInterfaceTool::m_failedExecCtrMax
static const unsigned int m_failedExecCtrMax
Execution failure counter reporting cut-off.
Definition: FastJetInterfaceTool.h:377
FastJetInterfaceTool::specificClusterSequence
S * specificClusterSequence()
Access to specific cluster sequence.
Definition: FastJetInterfaceTool.h:168
FastJetInterface::fjetlist_t
std::vector< fjet_t > fjetlist_t
Container for fastjet jets.
Definition: FastJetInterfaceTool.h:53
FastJetInterface::areamap_t
std::map< std::string, fastjet::AreaType > areamap_t
Mapping keyword on fastjet area type tag.
Definition: FastJetInterfaceTool.h:48
FastJetInterfaceTool::m_CMS_seedThreshold
double m_CMS_seedThreshold
fastjet property for CMS Cone plugin: seed threshold
Definition: FastJetInterfaceTool.h:234
FastJetInterfaceTool::m_jetAlgorithm
fastjet::JetAlgorithm m_jetAlgorithm
fastjet tag: jet algorithm
Definition: FastJetInterfaceTool.h:385
FastJetInterfaceTool::PROCESSOR
StatusCode(FastJetInterfaceTool::* PROCESSOR)(const FastJetInterface::fjetlist_t &inJets, FastJetInterface::fjetlist_t &outJets)
Processor function pointer type.
Definition: FastJetInterfaceTool.h:411
FastJetInterfaceTool::configName
const std::string & configName(fastjet::JetAlgorithm fjalg)
Get keyword for fastjet configuration.
Definition: FastJetInterfaceTool.cxx:497
FastJetInterfaceTool::checkConfig
bool checkConfig(const std::string &key, fastjet::JetAlgorithm &fjalg)
Check configuration keyword for jet algorithm.
Definition: FastJetInterfaceTool.cxx:460
FastJetInterfaceTool::specificClusterSequence
const S * specificClusterSequence() const
Access to specific cluster sequence.
Definition: FastJetInterfaceTool.h:184
Trig::MatchingStrategy::Strategy
Strategy
Definition: MatchingImplementation.h:26
FastJetInterfaceTool::f_processWithoutArea
StatusCode f_processWithoutArea(const FastJetInterface::fjetlist_t &inJets, FastJetInterface::fjetlist_t &outJets)
Processor implementation: cluster sequence without area calculation.
Definition: FastJetInterfaceTool.cxx:534
FastJetInterfaceTool::m_SIS_overlapThreshold
double m_SIS_overlapThreshold
fastjet property for SIS Cone plugin: overlap threshold
Definition: FastJetInterfaceTool.h:236
FastJetInterfaceTool::m_jetAlgorithmType
std::string m_jetAlgorithmType
fastjet property: jet algorithm
Definition: FastJetInterfaceTool.h:227
FastJetInterfaceTool::m_areaType
fastjet::AreaType m_areaType
fastjet tag: jet area type
Definition: FastJetInterfaceTool.h:389
FastJetInterfaceTool::m_doJetArea
bool m_doJetArea
Tool property: flag controls if jet area is calculated.
Definition: FastJetInterfaceTool.h:260
FastJetInterface::cfgName
const std::string & cfgName(D tag, const M &map, const std::string &invalidKey)
General configuration keyword finder.
Definition: FastJetInterfaceTool.h:92
IFastJetInterfaceTool
General tool configuring fastjet functionality.
Definition: IFastJetInterfaceTool.h:24
FastJetInterfaceTool::m_ghostedMinRap
double m_ghostedMinRap
fastjet property: ghost area rapidity limit (min)
Definition: FastJetInterfaceTool.h:268
FastJetInterfaceTool::m_strategy
fastjet::Strategy m_strategy
fastjet tag: jet clustering strategy
Definition: FastJetInterfaceTool.h:387
FastJetInterfaceTool::~FastJetInterfaceTool
virtual ~FastJetInterfaceTool()
Base class destructor.
Definition: FastJetInterfaceTool.cxx:222
FastJetInterfaceTool::configJetAreas
StatusCode configJetAreas()
Configures jet area calculation strategy.
Definition: FastJetInterfaceTool.cxx:593
JetTiledMap::S
@ S
Definition: TiledEtaPhiMap.h:44
FastJetInterface::splitMergeScaleMap_t
std::map< std::string, fastjet::SISConePlugin::SplitMergeScale > splitMergeScaleMap_t
Mapping keyword on fastjet SIS Cone split merge scale tag.
Definition: FastJetInterfaceTool.h:43
FastJetInterfaceTool::getKnownRecombinationSchemes
const FastJetInterface::schememap_t & getKnownRecombinationSchemes()
Get known recombination schemes.
Definition: FastJetInterfaceTool.cxx:76
FastJetInterfaceTool::m_ghostedKtScatter
double m_ghostedKtScatter
fastjet property: scatter of kT of ghosts
Definition: FastJetInterfaceTool.h:276
FastJetInterfaceTool::m_extractor
EXTRACTOR m_extractor
Pointer to extractor.
Definition: FastJetInterfaceTool.h:420
IFastJetInterfaceTool.h
FastJetInterfaceTool::getKnownAreas
const FastJetInterface::areamap_t & getKnownAreas()
Get known area types.
Definition: FastJetInterfaceTool.cxx:112
FastJetInterfaceTool::m_ghostedMeanKt
double m_ghostedMeanKt
fastjet property: average kT of ghosts
Definition: FastJetInterfaceTool.h:278
FastJetInterfaceTool::m_ghostedArea
double m_ghostedArea
fastjet property: size of area coverded by each ghost
Definition: FastJetInterfaceTool.h:272
FastJetInterfaceTool::m_SIS_splitMergeStopScale
double m_SIS_splitMergeStopScale
fastjet property for SIS Cone plugin: split merge stop scale
Definition: FastJetInterfaceTool.h:246
FastJetInterfaceTool::m_clusterSequence
fastjet::ClusterSequence * m_clusterSequence
Pointer to actual cluster sequence.
Definition: FastJetInterfaceTool.h:399
FastJetInterfaceTool::m_SIS_splitMergeScale_STRING
std::string m_SIS_splitMergeScale_STRING
fastjet property for SIS Cone plugin: split merge scale
Definition: FastJetInterfaceTool.h:244
jet::ClusterSequence
fastjet::ClusterSequence ClusterSequence
Definition: ClusterSequence.h:21
beamspotman.n
n
Definition: beamspotman.py:731
FastJetInterfaceTool::EXTRACTOR
StatusCode(FastJetInterfaceTool::* EXTRACTOR)(FastJetInterface::fjetlist_t &outJets)
Extractor function pointer type.
Definition: FastJetInterfaceTool.h:415
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
FastJetInterfaceTool::m_voronoiEffectiveRfact
double m_voronoiEffectiveRfact
fastjet property: Voronoi area effective radius
Definition: FastJetInterfaceTool.h:264
FastJetInterfaceTool::execute
virtual StatusCode execute(const fjetlist_t &inJets, fjetlist_t &outJets)
Execute method.
Definition: FastJetInterfaceTool.cxx:421
FastJetInterfaceTool::m_exclusiveDcut
double m_exclusiveDcut
Exclusive jet finder property: d cut.
Definition: FastJetInterfaceTool.h:253
FastJetInterfaceTool::f_processWithArea
StatusCode f_processWithArea(const FastJetInterface::fjetlist_t &inJets, FastJetInterface::fjetlist_t &outJets)
Processor implementation: cluster sequence with area calculation.
Definition: FastJetInterfaceTool.cxx:544
xAOD::uint64_t
uint64_t
Definition: EventInfo_v1.cxx:123
FastJetInterfaceTool::m_inclusive
bool m_inclusive
Jet algorithm control property: inclusive/exclusive jet finding.
Definition: FastJetInterfaceTool.h:251
FastJetInterfaceTool::m_SIS_nPass
int m_SIS_nPass
fastjet property for SIS Cone plugin: max number of passes
Definition: FastJetInterfaceTool.h:238
FastJetInterfaceTool::m_recombinationSchemeType
std::string m_recombinationSchemeType
fastjet property: recombination scheme
Definition: FastJetInterfaceTool.h:231
FastJetInterfaceTool
Wrapper for fastjet verion 2.4.4.
Definition: FastJetInterfaceTool.h:108
FastJetInterfaceTool::FastJetInterfaceTool
FastJetInterfaceTool(const std::string &n)
Standard AlgTool constructor.
Definition: FastJetInterfaceTool.cxx:131
FastJetInterfaceTool::f_extractExclNjets
StatusCode f_extractExclNjets(FastJetInterface::fjetlist_t &outJets)
Exclusive extractor implementation.
Definition: FastJetInterfaceTool.cxx:563
FastJetInterfaceTool::m_SIS_protojetPtMin
double m_SIS_protojetPtMin
fastjet property for SIS Cone plugin: protojet min pt
Definition: FastJetInterfaceTool.h:240
IFastJetInterfaceTool::fjetlist_t
std::vector< fjet_t > fjetlist_t
Definition: IFastJetInterfaceTool.h:30
FastJetInterfaceTool::m_exclusiveNjets
int m_exclusiveNjets
Exclusive jet finder property: number of jets requested.
Definition: FastJetInterfaceTool.h:255
FastJetInterface::strategymap_t
std::map< std::string, fastjet::Strategy > strategymap_t
Mapping keyword on fastjet clustering strategy tag.
Definition: FastJetInterfaceTool.h:38
FastJetInterfaceTool::m_baseRNDSeed
uint64_t m_baseRNDSeed
Base seed for random generator. Constructed from m_jetAlgorithm and m_radius.
Definition: FastJetInterfaceTool.h:404
FastJetInterfaceTool::getKnownSplitMergeScales
const FastJetInterface::splitMergeScaleMap_t & getKnownSplitMergeScales()
Get known split merge scales.
Definition: FastJetInterfaceTool.cxx:93
FastJetInterfaceTool::updateRandomSeeds
virtual void updateRandomSeeds()
Set the area rnd seed according to run/event numbers.
Definition: FastJetInterfaceTool.cxx:649
FastJetInterfaceTool::m_ghostedMaxRap
double m_ghostedMaxRap
fastjet property: ghost area rapidity limit (max)
Definition: FastJetInterfaceTool.h:266
FastJetInterfaceTool::getAreaDefinitionType
const std::string getAreaDefinitionType() const
Access fastjet area definition type.
Definition: FastJetInterfaceTool.cxx:590
FastJetInterfaceTool::m_ghostedGridScatter
double m_ghostedGridScatter
fastjet property: scatter of ghosts on grid
Definition: FastJetInterfaceTool.h:274
FastJetInterfaceTool::m_areaDefinition
fastjet::AreaDefinition * m_areaDefinition
Pointer to area definition.
Definition: FastJetInterfaceTool.h:401
FastJetInterface
Collection of types for the internal dictionary.
Definition: FastJetInterfaceTool.h:34
FastJetInterfaceTool::getJetDefinition
const fastjet::JetDefinition * getJetDefinition() const
Access fastjet JetDefinition.
Definition: FastJetInterfaceTool.cxx:584
ASG_TOOL_CLASS
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Definition: AsgToolMacros.h:68
FastJetInterfaceTool::m_radius
double m_radius
Jet algorithm property: radius/distance parameter.
Definition: FastJetInterfaceTool.h:249
FastJetInterfaceTool::m_SIS_doCaching
bool m_SIS_doCaching
fastjet property for SIS Cone plugin: do caching
Definition: FastJetInterfaceTool.h:242
FastJetInterfaceTool::getKnownStrategies
const FastJetInterface::strategymap_t & getKnownStrategies()
Get known jet finding strategies.
Definition: FastJetInterfaceTool.cxx:53
FastJetInterfaceTool::m_userRNDSeed
uint64_t m_userRNDSeed
Seed modifier for random generator : a user property (default to 0, i.e m_baseRNDSeed is unmodified)
Definition: FastJetInterfaceTool.h:406
FastJetInterface::fjet_t
fastjet::PseudoJet fjet_t
fastjet data model for jet
Definition: FastJetInterfaceTool.h:51
FastJetInterfaceTool::f_extractInclusive
StatusCode f_extractInclusive(FastJetInterface::fjetlist_t &outJets)
Inclusive extractor implementation.
Definition: FastJetInterfaceTool.cxx:556
FastJetInterfaceTool::m_SIS_splitMergeScale
fastjet::SISConePlugin::SplitMergeScale m_SIS_splitMergeScale
fastjet tag: SIS split merge scale
Definition: FastJetInterfaceTool.h:394
CaloCondBlobAlgs_fillNoiseFromASCII.tag
string tag
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:24
FastJetInterface::schememap_t
std::map< std::string, fastjet::RecombinationScheme > schememap_t
Mapping keyword on fastjet recombination scheme tag.
Definition: FastJetInterfaceTool.h:40
FastJetInterfaceTool::m_ghostedRepeat
int m_ghostedRepeat
fastjet property: ghost area calculation repeatitions
Definition: FastJetInterfaceTool.h:270
FastJetInterfaceTool::getKnownAlgorithms
const FastJetInterface::algomap_t & getKnownAlgorithms()
Get known jet algorithms.
Definition: FastJetInterfaceTool.cxx:29
FastJetInterface::algomap_t
std::map< std::string, fastjet::JetAlgorithm > algomap_t
Mapping keyword on fastjet jet algorithm tag.
Definition: FastJetInterfaceTool.h:36
AsgTool.h
FastJetInterfaceTool::clusterSequence
virtual fastjet::ClusterSequence * clusterSequence()
Access fastjet ClusterSequence.
Definition: FastJetInterfaceTool.cxx:578
FastJetInterfaceTool::m_recombinationScheme
fastjet::RecombinationScheme m_recombinationScheme
fastjet tag: recombination scheme
Definition: FastJetInterfaceTool.h:391
FastJetInterfaceTool::f_extractExclDcut
StatusCode f_extractExclDcut(FastJetInterface::fjetlist_t &outJets)
Exclusive extractor implementation.
Definition: FastJetInterfaceTool.cxx:571
FastJetInterfaceTool::m_clusterStrategyType
std::string m_clusterStrategyType
fastjet property: cluster strategy
Definition: FastJetInterfaceTool.h:229
FastJetInterfaceTool::m_clusterSequenceType
std::string m_clusterSequenceType
fastjet property: cluster sequence type
Definition: FastJetInterfaceTool.h:225
FastJetInterfaceTool::m_failedExecCtr
unsigned int m_failedExecCtr
Execution failure counter.
Definition: FastJetInterfaceTool.h:375
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37