ATLAS Offline Software
BaseSimulationSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
9 
10 
12 ISF::BaseSimulationSelector::BaseSimulationSelector(const std::string& type, const std::string& name, const IInterface* parent) :
13  base_class(type, name, parent),
14  m_simulator("", name),
15  m_isDynamic(false),
16  m_invertCuts(false)
17 {
18  declareProperty("Simulator", m_simulator );
19  declareProperty("IsDynamic", m_isDynamic );
20  declareProperty("InvertCuts", m_invertCuts );
21  declareProperty("SimulationFlavor", m_simFlavorProp);
22  m_simFlavorProp.verifier().setLower(ISF::UndefinedSim+1);
23  m_simFlavorProp.verifier().setUpper(ISF::NFlavors-1);
25 }
26 
27 void ISF::BaseSimulationSelector::SimulationFlavorHandler(Gaudi::Details::PropertyBase&)
28 {
29  // FIXME would probably be better to have this in SimulationFlavor.h
30  switch(m_simFlavorProp.value())
31  {
32  case 1: m_simflavor = ISF::ParticleKiller; break;
33  case 2: m_simflavor = ISF::Fatras; break;
34  case 3: m_simflavor = ISF::Geant4; break;
35  case 4: m_simflavor = ISF::FastCaloSim; break;
36  case 5: m_simflavor = ISF::FastCaloSimV2; break;
37  case 6: m_simflavor = ISF::Parametric; break;
38  case 7: m_simflavor = ISF::FatrasPileup; break;
39  case 8: m_simflavor = ISF::FastCaloSimPileup; break;
40  }
41 }
42 
45 {
47 
48  if (!m_simulator.empty()) {
49  ATH_CHECK( m_simulator.retrieve() );
50  }
51 
52  return StatusCode::SUCCESS;
53 }
54 
55 
58 
60 bool
62 {
63  bool pass = passSelectorCuts(particle);
64  pass = ( m_invertCuts ? (!pass) : pass );
65 
66  return pass;
67 }
68 
70 ServiceHandle<ISF::ISimulationSvc>* ISF::BaseSimulationSelector::simulator ATLAS_NOT_THREAD_SAFE () {
71  return &m_simulator;
72 }
73 
77  return m_isDynamic;
78 }
79 
81 ISF::SimSvcID ISF::BaseSimulationSelector::simSvcID ATLAS_NOT_THREAD_SAFE () {
82  return m_simulator->simSvcID();
83 }
84 
87  return m_simflavor;
88 }
89 
92 
95 void ISF::BaseSimulationSelector::beginEvent ATLAS_NOT_THREAD_SAFE () { }
96 
99 void ISF::BaseSimulationSelector::endEvent ATLAS_NOT_THREAD_SAFE () { }
100 
ISF::BaseSimulationSelector::initializeSelector
virtual void initializeSelector() override
initialize Selector
Definition: BaseSimulationSelector.cxx:91
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ISF::NFlavors
@ NFlavors
Definition: SimulationFlavor.h:29
ISF::BaseSimulationSelector::sysInitialize
virtual StatusCode sysInitialize() override
Gaudi sysInitialize() method.
Definition: BaseSimulationSelector.cxx:44
ISF::ParticleKiller
@ ParticleKiller
Definition: SimulationFlavor.h:21
ISF::ISFParticle
Definition: ISFParticle.h:42
ISF::BaseSimulationSelector::m_simulator
ServiceHandle< ISimulationSvc > m_simulator
simulation service assigned to a single advisor
Definition: BaseSimulationSelector.h:73
ATLAS_NOT_THREAD_SAFE
ServiceHandle< ISF::ISimulationSvc > *ISF::BaseSimulationSelector::simulator ATLAS_NOT_THREAD_SAFE()
return a handle on the simulator
Definition: BaseSimulationSelector.cxx:70
ISF::BaseSimulationSelector::m_simFlavorProp
Gaudi::CheckedProperty< unsigned short > m_simFlavorProp
the simulation flavour that this selector will select
Definition: BaseSimulationSelector.h:76
ISF::BaseSimulationSelector::SimulationFlavorHandler
void SimulationFlavorHandler(Gaudi::Details::PropertyBase &)
Definition: BaseSimulationSelector.cxx:27
ISF::FastCaloSimV2
@ FastCaloSimV2
Definition: SimulationFlavor.h:25
ISFParticle.h
ISF::FatrasPileup
@ FatrasPileup
Definition: SimulationFlavor.h:27
ISF::BaseSimulationSelector::simFlavor
virtual ISF::SimulationFlavor simFlavor() const override
return the simulation flavor
Definition: BaseSimulationSelector.cxx:86
ISF::BaseSimulationSelector::selfSelect
virtual bool selfSelect(const ISFParticle &particle) const override
make the routing decision
Definition: BaseSimulationSelector.cxx:61
ISF::Geant4
@ Geant4
Definition: SimulationFlavor.h:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ISF::BaseSimulationSelector::m_invertCuts
bool m_invertCuts
invert the result given by passesCuts(..) method
Definition: BaseSimulationSelector.h:75
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
ISF::FastCaloSimPileup
@ FastCaloSimPileup
Definition: SimulationFlavor.h:28
BaseSimulationSelector.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize
virtual StatusCode sysInitialize() override
Perform system initialization for an algorithm.
ISF::UndefinedSim
@ UndefinedSim
Definition: SimulationFlavor.h:20
ISF::Fatras
@ Fatras
Definition: SimulationFlavor.h:22
ISF::BaseSimulationSelector::~BaseSimulationSelector
virtual ~BaseSimulationSelector()
virtual destructor
Definition: BaseSimulationSelector.cxx:57
dqt_zlumi_pandas.update
update
Definition: dqt_zlumi_pandas.py:42
ISF::SimSvcID
uint8_t SimSvcID
Simulation service ID datatype.
Definition: SimSvcID.h:28
ISF::BaseSimulationSelector::m_isDynamic
bool m_isDynamic
this selector is either dynamic or static
Definition: BaseSimulationSelector.h:74
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
ISF::BaseSimulationSelector::BaseSimulationSelector
BaseSimulationSelector(const std::string &t, const std::string &n, const IInterface *p)
Constructor with parameters.
Definition: BaseSimulationSelector.cxx:12
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
ISF::BaseSimulationSelector::isDynamic
virtual bool isDynamic() override
return if is this a static or dynamic SimulationSelector (is used by fully dynamic particle routers)
Definition: BaseSimulationSelector.cxx:76
ISF::Parametric
@ Parametric
Definition: SimulationFlavor.h:26
ISF::SimulationFlavor
int SimulationFlavor
Identifier type for simulation flavor.
Definition: SimulationFlavor.h:16
ISF::FastCaloSim
@ FastCaloSim
Definition: SimulationFlavor.h:24
SimulationFlavor.h
ServiceHandle< ISF::ISimulationSvc >