ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Extensions
Quirks
src
QuirkPhysicsTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
// class header
6
#include "
QuirkPhysicsTool.h
"
7
8
// package headers
9
#include "
Quirk.h
"
10
#include "
InfracolorForce.h
"
11
#include "
QuirkTransportation.h
"
12
#include "
QuirkWatcher.h
"
13
#include "
QuirkStackingAction.h
"
14
#include "
DebugSteppingAction.h
"
15
16
// Geant4 headers
17
#include "globals.hh"
18
#include "G4ProcessManager.hh"
19
#include "G4RunManager.hh"
20
#include "G4EventManager.hh"
21
#include "G4hMultipleScattering.hh"
22
#include "G4hIonisation.hh"
23
#include "G4hBremsstrahlung.hh"
24
#include "G4hPairProduction.hh"
25
26
// STL headers
27
#include <G4VPhysicsConstructor.hh>
28
#include <fstream>
29
#include <iostream>
30
#include <memory>
31
32
//-----------------------------------------------------------------------------
33
// Implementation file for class : QuirksPhysicsTool
34
//
35
// 15-05-2015 : Edoardo Farina
36
//-----------------------------------------------------------------------------
37
#include "G4Version.hh"
38
#if G4VERSION_NUMBER > 1029
39
#define PARTICLEITERATOR (this->GetParticleIterator())
40
#elif G4VERSION_NUMBER > 1009
41
#define PARTICLEITERATOR aParticleIterator
42
#else
43
#define PARTICLEITERATOR theParticleIterator
44
#endif
45
46
//=============================================================================
47
// Standard constructor, initializes variables
48
//=============================================================================
49
QuirksPhysicsTool::QuirksPhysicsTool
(
const
std::string&
type
,
50
const
std::string& nam,
const
IInterface* parent )
51
: base_class (
type
, nam , parent )
52
{
53
m_physicsOptionType = G4AtlasPhysicsOption::Type::BSMPhysics;
54
std::ifstream f;
55
f.open(
"quirks_setup.txt"
);
56
f >>
m_mass
;
m_mass
*= CLHEP::MeV;
57
f >>
m_charge
;
m_charge
*= CLHEP::eplus;
58
f >>
m_pdgid
;
59
f >>
m_stringForce
;
m_stringForce
*= CLHEP::MeV/CLHEP::mm;
60
f >>
m_firstStringLength
;
m_firstStringLength
*= CLHEP::mm;
61
f >>
m_maxBoost
;
62
f >>
m_maxMergeT
;
m_maxMergeT
*= CLHEP::mm;
63
f >>
m_maxMergeMag
;
m_maxMergeMag
*= CLHEP::mm;
64
f >>
m_enableDebug
;
65
if
(
m_enableDebug
) {
66
f >>
m_debugStep
;
m_debugStep
*= CLHEP::mm;
67
f >>
m_numDebugSteps
;
68
}
69
f.close();
70
}
71
72
//=============================================================================
73
// Destructor
74
//=============================================================================
75
76
QuirksPhysicsTool::~QuirksPhysicsTool
()
77
{
78
79
}
80
81
//=============================================================================
82
// Initialize
83
//=============================================================================
84
StatusCode
QuirksPhysicsTool::initialize
( )
85
{
86
ATH_MSG_DEBUG
(
"QuirksPhysicsTool initialize( )"
);
87
return
StatusCode::SUCCESS;
88
}
89
90
auto
QuirksPhysicsTool::GetPhysicsOption
() -> UPPhysicsConstructor {
91
return
std::make_unique<QuirksPhysicsTool::PhysicsConstructor>(
92
name(), this->msgLevel(),
m_mass
,
m_charge
,
m_pdgid
,
m_stringForce
,
93
m_firstStringLength
,
m_maxBoost
,
m_maxMergeT
,
m_maxMergeMag
);
94
}
95
96
void
QuirksPhysicsTool::PhysicsConstructor::ConstructParticle
() {
97
ATH_MSG_DEBUG
(
"ConstructParticle for the Quirks being run"
);
98
99
Quirk
* q1 =
new
Quirk
(
100
/*name*/
"quirk+"
,
m_mass
,
/*width*/
0.0, +
m_charge
,
101
/*2*spin*/
1,
/*parity*/
0,
/*C-conjugation*/
0,
102
/*2*Isospin*/
0,
/*2*Isospin3*/
0,
/*G-parity*/
0,
103
/*type*/
"lepton"
,
/*lepton number*/
+1,
/*baryon number*/
0, +
m_pdgid
,
104
/*stable*/
true
,
/*lifetime*/
-1.0,
/*decay table*/
0,
105
/*shortlived*/
false
106
);
107
new
Quirk
(
108
/*name*/
"quirk-"
,
m_mass
,
/*width*/
0.0, -
m_charge
,
109
/*2*spin*/
1,
/*parity*/
0,
/*C-conjugation*/
0,
110
/*2*Isospin*/
0,
/*2*Isospin3*/
0,
/*G-parity*/
0,
111
/*type*/
"lepton"
,
/*lepton number*/
-1,
/*baryon number*/
0, -
m_pdgid
,
112
/*stable*/
true
,
/*lifetime*/
-1.0,
/*decay table*/
0,
113
/*shortlived*/
false
114
);
115
116
InfracolorForce
& s = q1->
GetStringIn
();
117
s.SetStringForce(
m_stringForce
);
118
s.SetFirstStringLength(
m_firstStringLength
);
119
s.SetMaxBoost(
m_maxBoost
);
120
s.SetMaxMergeT(
m_maxMergeT
);
121
s.SetMaxMergeMag(
m_maxMergeMag
);
122
}
123
124
void
QuirksPhysicsTool::PhysicsConstructor::ConstructProcess
() {
125
ATH_MSG_DEBUG
(
" ConstructProcess for Quirks being run"
);
126
PARTICLEITERATOR
->reset();
127
while
( (*
PARTICLEITERATOR
)() ){
128
G4ParticleDefinition* particle =
PARTICLEITERATOR
->value();
129
if
(
dynamic_cast<
Quirk
*
>
(particle) != 0) {
130
G4ProcessManager* pmanager = particle->GetProcessManager();
131
//G4cout << "# processes = " << pmanager->GetProcessListLength() << G4endl;
132
//for (int i = 0; i < pmanager->GetProcessList()->size(); i++) {
133
// G4cout << "process i: " << (*pmanager->GetProcessList())[i]->GetProcessName() << G4endl;
134
//}
135
while
(pmanager->GetProcessListLength() != 0) pmanager->RemoveProcess(0);
136
G4VProcess* aTransportation =
new
QuirkTransportation
;
137
pmanager->AddProcess(aTransportation);
138
pmanager->SetProcessOrderingToFirst(aTransportation, idxAlongStep);
139
pmanager->SetProcessOrderingToFirst(aTransportation, idxPostStep);
140
pmanager->AddProcess(
new
G4hMultipleScattering,-1, 1, 1);
141
pmanager->AddProcess(
new
G4hIonisation, -1, 2, 2);
142
pmanager->AddProcess(
new
G4hBremsstrahlung, -1, 3, 3);
143
pmanager->AddProcess(
new
G4hPairProduction, -1, 4, 4);
144
//pmanager->AddProcess(new TestProcess, -1, 1, 1);
145
pmanager->AddProcess(
new
QuirkWatcher
, -1,-1, 5);
146
//G4cout << "# processes = " << pmanager->GetProcessListLength() << G4endl;
147
//for (int i = 0; i < pmanager->GetProcessList()->size(); i++) {
148
// G4cout << "process i: " << (*pmanager->GetProcessList())[i]->GetProcessName() << G4endl;
149
//}
150
}
151
}
152
G4RunManager* runManager = G4RunManager::GetRunManager();
153
runManager->SetNumberOfAdditionalWaitingStacks(1);
154
G4UserStackingAction* defaultStackingAction = G4EventManager::GetEventManager()->GetUserStackingAction();
155
ATH_MSG_WARNING
(
"This tool is interfering with the normal G4Atlas workflow, by forcing a differentcustom StackingAction instead of the default one. This is acceptable only as a temporary solution, and should be fixed asap."
);
156
runManager->SetUserAction(
new
QuirkStackingAction
(defaultStackingAction));
157
158
// ADS this must be done on the python side
159
//f (m_enableDebug) {
160
// DebugSteppingAction* debugger = new DebugSteppingAction(m_debugStep, m_numDebugSteps);
161
//#//f QUIRKS_STANDALONE
162
// runManager->SetUserAction(debugger);
163
//#//
164
// FADS::FadsSteppingAction::GetSteppingAction()->RegisterAction(debugger);
165
//#//f
166
//
167
}
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
DebugSteppingAction.h
InfracolorForce.h
PARTICLEITERATOR
#define PARTICLEITERATOR
Definition
LucidPhysicsTool.cxx:25
QuirkPhysicsTool.h
QuirkStackingAction.h
QuirkTransportation.h
QuirkWatcher.h
Quirk.h
InfracolorForce
Definition
InfracolorForce.h:14
QuirkStackingAction
Definition
QuirkStackingAction.h:11
QuirkTransportation
Definition
QuirkTransportation.h:60
QuirkWatcher
Definition
QuirkWatcher.h:11
Quirk
Definition
Quirk.h:12
Quirk::GetStringIn
const InfracolorForce & GetStringIn() const
Definition
Quirk.h:29
QuirksPhysicsTool::PhysicsConstructor::m_firstStringLength
G4double m_firstStringLength
Definition
QuirkPhysicsTool.h:58
QuirksPhysicsTool::PhysicsConstructor::m_pdgid
G4int m_pdgid
Definition
QuirkPhysicsTool.h:56
QuirksPhysicsTool::PhysicsConstructor::ConstructProcess
virtual void ConstructProcess() override
Definition
QuirkPhysicsTool.cxx:124
QuirksPhysicsTool::PhysicsConstructor::m_maxMergeT
G4double m_maxMergeT
Definition
QuirkPhysicsTool.h:60
QuirksPhysicsTool::PhysicsConstructor::m_stringForce
G4double m_stringForce
Definition
QuirkPhysicsTool.h:57
QuirksPhysicsTool::PhysicsConstructor::m_maxMergeMag
G4double m_maxMergeMag
Definition
QuirkPhysicsTool.h:61
QuirksPhysicsTool::PhysicsConstructor::m_mass
G4double m_mass
Definition
QuirkPhysicsTool.h:54
QuirksPhysicsTool::PhysicsConstructor::m_maxBoost
G4double m_maxBoost
Definition
QuirkPhysicsTool.h:59
QuirksPhysicsTool::PhysicsConstructor::m_charge
G4double m_charge
Definition
QuirkPhysicsTool.h:55
QuirksPhysicsTool::PhysicsConstructor::ConstructParticle
virtual void ConstructParticle() override
Definition
QuirkPhysicsTool.cxx:96
QuirksPhysicsTool::m_mass
G4double m_mass
Definition
QuirkPhysicsTool.h:65
QuirksPhysicsTool::m_debugStep
G4double m_debugStep
Definition
QuirkPhysicsTool.h:74
QuirksPhysicsTool::initialize
virtual StatusCode initialize() override final
Initialize method.
Definition
QuirkPhysicsTool.cxx:84
QuirksPhysicsTool::m_maxMergeMag
G4double m_maxMergeMag
Definition
QuirkPhysicsTool.h:72
QuirksPhysicsTool::GetPhysicsOption
virtual UPPhysicsConstructor GetPhysicsOption() override final
Definition
QuirkPhysicsTool.cxx:90
QuirksPhysicsTool::m_charge
G4double m_charge
Definition
QuirkPhysicsTool.h:66
QuirksPhysicsTool::m_enableDebug
G4int m_enableDebug
Definition
QuirkPhysicsTool.h:73
QuirksPhysicsTool::QuirksPhysicsTool
QuirksPhysicsTool(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition
QuirkPhysicsTool.cxx:49
QuirksPhysicsTool::m_stringForce
G4double m_stringForce
Definition
QuirkPhysicsTool.h:68
QuirksPhysicsTool::~QuirksPhysicsTool
virtual ~QuirksPhysicsTool()
Destructor.
Definition
QuirkPhysicsTool.cxx:76
QuirksPhysicsTool::m_pdgid
G4int m_pdgid
Definition
QuirkPhysicsTool.h:67
QuirksPhysicsTool::m_numDebugSteps
G4int m_numDebugSteps
Definition
QuirkPhysicsTool.h:75
QuirksPhysicsTool::m_maxMergeT
G4double m_maxMergeT
Definition
QuirkPhysicsTool.h:71
QuirksPhysicsTool::m_firstStringLength
G4double m_firstStringLength
Definition
QuirkPhysicsTool.h:69
QuirksPhysicsTool::m_maxBoost
G4double m_maxBoost
Definition
QuirkPhysicsTool.h:70
type
Generated on
for ATLAS Offline Software by
1.17.0