ATLAS Offline Software
Loading...
Searching...
No Matches
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{
43 m_physicsOptionType = G4AtlasPhysicsOption::Type::GlobalProcesses;
44 ATH_MSG_INFO("LucidPhysicsTool "<<type<<" "<<name);
45 declareInterface< IPhysicsOptionTool >( this ) ;
46}
47
48//=============================================================================
49// Destructor
50//=============================================================================
51
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}
#define ATH_MSG_INFO(x)
#define ATH_MSG_DEBUG(x)
#define PARTICLEITERATOR
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
std::unique_ptr< G4VPhysicsConstructor > UPPhysicsConstructor
G4AtlasPhysicsOption::Type m_physicsOptionType
virtual void ConstructParticle() override
virtual StatusCode initialize() override final
Initialize method.
UPPhysicsConstructor GetPhysicsOption() override
Implements.
LucidPhysicsTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
virtual ~LucidPhysicsTool()
Destructor.