Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LucidPhysicsTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // local
6 #include "LucidPhysicsTool.h"
7 
8 #include <memory>
9 
10 #include "G4Cerenkov.hh"
11 #include "G4OpAbsorption.hh"
12 #include "G4OpBoundaryProcess.hh"
13 #include "G4OpRayleigh.hh"
14 #include "G4ParticleTable.hh"
15 #include "G4ProcessManager.hh"
16 #include "G4Scintillation.hh"
17 #include "G4VProcess.hh"
18 #include "G4Version.hh"
19 
20 #if G4VERSION_NUMBER > 1029
21 #define PARTICLEITERATOR (this->GetParticleIterator())
22 #elif G4VERSION_NUMBER > 1009
23 #define PARTICLEITERATOR aParticleIterator
24 #else
25 #define PARTICLEITERATOR theParticleIterator
26 #endif
27 
28 //-----------------------------------------------------------------------------
29 // Implementation file for class : LucidPhysicsTool
30 //
31 // 18-05-2015 : Edoardo Farina
32 //-----------------------------------------------------------------------------
33 
34 
35 
36 //=============================================================================
37 // Standard constructor, initializes variables
38 //=============================================================================
40  const std::string& name,const IInterface* parent )
41  : AthAlgTool ( type, name , parent )
42 {
44  ATH_MSG_INFO("LucidPhysicsTool "<<type<<" "<<name);
45  declareInterface< IPhysicsOptionTool >( this ) ;
46 }
47 
48 //=============================================================================
49 // Destructor
50 //=============================================================================
51 
53 {
54 }
55 
56 //=============================================================================
57 // Initialize
58 //=============================================================================
60 {
61  ATH_MSG_INFO("LucidPhysicsTool initialize( )");
62  return StatusCode::SUCCESS;
63 }
64 
66  return std::make_unique<LucidPhysicsTool::PhysicsConstructor>(
67  name(), this->msgLevel());
68 }
69 
72  G4Cerenkov* theCerenkovProcess = new G4Cerenkov ("Cerenkov");
73  G4Scintillation* theScintillationProcess = new G4Scintillation ("Scintillation");
74  G4OpAbsorption* theOpAbsorptionProcess = new G4OpAbsorption ();
75  G4OpRayleigh* theOpRayleighProcess = new G4OpRayleigh ();
76  G4OpBoundaryProcess* theOpBoundaryProcess = new G4OpBoundaryProcess();
77 
78  theCerenkovProcess->SetVerboseLevel(0);
79  theScintillationProcess->SetVerboseLevel(0);
80  theOpAbsorptionProcess->SetVerboseLevel(0);
81  theOpRayleighProcess->SetVerboseLevel(0);
82  theOpBoundaryProcess->SetVerboseLevel(0);
83 
84  G4int MaxNumPhotons = 300;
85 
86  theCerenkovProcess->SetTrackSecondariesFirst(true);
87  theCerenkovProcess->SetMaxNumPhotonsPerStep(MaxNumPhotons);
88 
89  theScintillationProcess->SetTrackSecondariesFirst(true);
90 #if G4VERSION_NUMBER < 1100
91  // This should be defaulted to 1. in 11.0 and newer
92  theScintillationProcess->SetScintillationYieldFactor(1.);
93 #endif
94 
95  PARTICLEITERATOR->reset();
96 
97  while ((*PARTICLEITERATOR)())
98  {
99 
100  G4ParticleDefinition* particle = PARTICLEITERATOR->value();
101  G4ProcessManager* pmanager = particle->GetProcessManager();
102  G4String particleName = particle->GetParticleName();
103 
104  if (theCerenkovProcess->IsApplicable(*particle)) {
105  ATH_MSG_DEBUG( " Adding CerenkovProcess to: " << particleName );
106  pmanager->AddProcess (theCerenkovProcess);
107  pmanager->SetProcessOrdering(theCerenkovProcess, idxPostStep);
108  }
109 
110  if (theScintillationProcess->IsApplicable(*particle)) {
111  ATH_MSG_DEBUG( " Adding ScintillationProcess to: " << particleName );
112  pmanager->AddProcess (theScintillationProcess);
113  pmanager->SetProcessOrderingToLast(theScintillationProcess, idxAtRest);
114  pmanager->SetProcessOrderingToLast(theScintillationProcess, idxPostStep);
115  }
116 
117  if (particleName == "opticalphoton") {
118 
119  ATH_MSG_DEBUG(" Adding OpAbsorptionProcess, OpRayleighProcess and OpBoundaryProcess to opticalphoton " );
120  pmanager->AddDiscreteProcess(theOpAbsorptionProcess);
121  pmanager->AddDiscreteProcess(theOpRayleighProcess);
122  pmanager->AddDiscreteProcess(theOpBoundaryProcess);
123  }
124  }
125 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:76
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
PARTICLEITERATOR
#define PARTICLEITERATOR
Definition: LucidPhysicsTool.cxx:25
LucidPhysicsTool::GetPhysicsOption
UPPhysicsConstructor GetPhysicsOption() override
Implements.
Definition: LucidPhysicsTool.cxx:65
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
LucidPhysicsTool::PhysicsConstructor::ConstructParticle
virtual void ConstructParticle() override
Definition: LucidPhysicsTool.cxx:70
LucidPhysicsTool::LucidPhysicsTool
LucidPhysicsTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: LucidPhysicsTool.cxx:39
LucidPhysicsTool.h
LucidPhysicsTool::initialize
virtual StatusCode initialize() override final
Initialize method.
Definition: LucidPhysicsTool.cxx:59
LucidPhysicsTool::PhysicsConstructor::ConstructProcess
virtual void ConstructProcess() override
Definition: LucidPhysicsTool.cxx:71
G4StepHelper::particleName
std::string particleName(const G4Step *theStep)
TODO.
Definition: StepHelper.cxx:24
IPhysicsOptionTool::UPPhysicsConstructor
std::unique_ptr< G4VPhysicsConstructor > UPPhysicsConstructor
Definition: IPhysicsOptionTool.h:34
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
IPhysicsOptionTool::m_physicsOptionType
G4AtlasPhysicsOption::Type m_physicsOptionType
Definition: IPhysicsOptionTool.h:49
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
G4AtlasPhysicsOption::GlobalProcesses
@ GlobalProcesses
Definition: IPhysicsOptionTool.h:26
LucidPhysicsTool::~LucidPhysicsTool
virtual ~LucidPhysicsTool()
Destructor.
Definition: LucidPhysicsTool.cxx:52
AthAlgTool
Definition: AthAlgTool.h:26