ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4Scheduler.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4Scheduler.hh
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
// Author: Mathieu Karamitros
28
29
// The code is developed in the framework of the ESA AO7146
30
//
31
// We would be very happy hearing from you, send us your feedback! :)
32
//
33
// In order for Geant4-DNA to be maintained and still open-source,
34
// article citations are crucial.
35
// If you use Geant4-DNA chemistry and you publish papers about your software,
36
// in addition to the general paper on Geant4-DNA:
37
//
38
// Int. J. Model. Simul. Sci. Comput. 1 (2010) 157–178
39
//
40
// we would be very happy if you could please also cite the following
41
// reference papers on chemistry:
42
//
43
// J. Comput. Phys. 274 (2014) 841-882
44
// Prog. Nucl. Sci. Tec. 2 (2011) 503-508
45
46
47
48
#ifndef G4Scheduler_h
49
#define G4Scheduler_h
50
51
#include <
G4VScheduler.hh
>
52
#include <vector>
53
#include <map>
54
#include <memory>
55
56
#include "
globals.hh
"
57
58
#include "
G4ITModelHandler.hh
"
59
#include "
G4ITStepStatus.hh
"
60
#include "
G4ITTrackHolder.hh
"
61
#include "
G4VStateDependent.hh
"
62
#include "
G4ITReaction.hh
"
63
64
class
G4ITTrackingManager
;
65
class
G4ITModelProcessor
;
66
class
G4ITStepProcessor
;
67
class
G4Track
;
68
class
G4UserTimeStepAction
;
69
class
G4SchedulerMessenger
;
70
class
G4ITTrackingInteractivity
;
71
class
G4ITGun
;
72
73
#ifndef compTrackPerID__
74
#define compTrackPerID__
75
struct
compTrackPerID
76
{
77
bool
operator()
(
G4Track
* rhs,
G4Track
* lhs)
const
78
{
79
return
rhs->
GetTrackID
() < lhs->
GetTrackID
();
80
}
81
};
82
#endif
83
87
class
G4Scheduler
:
88
public
G4VScheduler
,
89
public
G4VStateDependent
90
{
91
protected
:
92
virtual
~G4Scheduler
();
93
94
public
:
95
static
G4Scheduler
*
Instance
();
99
static
void
DeleteInstance
();
100
virtual
G4bool
Notify
(
G4ApplicationState
requestedState);
101
102
virtual
void
RegisterModel
(
G4VITStepModel
*,
double
);
103
104
void
Initialize
();
105
void
ForceReinitialization
();
106
inline
bool
IsInitialized
();
107
inline
bool
IsRunning
(){
return
fRunning
;}
108
void
Reset
();
109
void
Process
();
110
void
ClearList
();
111
112
inline
void
SetGun
(
G4ITGun
*);
113
inline
G4ITGun
*
GetGun
();
114
115
inline
void
Stop
();
116
void
Clear
();
117
118
// To be called only in UserReactionAction::EndProcessing()
119
// after fRunning flag has been turned off.
120
// This is not done automatically before UserReactionAction::EndProcessing()
121
// is called in case one would like to access some track information
122
void
EndTracking
();
123
124
void
SetEndTime
(
const
double
);
125
126
/* Two tracks below the time tolerance are supposed to be
127
* in the same time slice
128
*/
129
inline
void
SetTimeTolerance
(
double
);
130
inline
double
GetTimeTolerance
()
const
;
131
132
inline
void
SetMaxZeroTimeAllowed
(
int
);
133
inline
int
GetMaxZeroTimeAllowed
()
const
;
134
135
inline
G4ITModelHandler
*
GetModelHandler
();
136
137
inline
void
SetTimeSteps
(std::map<double, double>*);
138
inline
void
AddTimeStep
(
double
,
double
);
139
inline
void
SetDefaultTimeStep
(
double
);
140
double
GetLimitingTimeStep
()
const
;
141
inline
G4int
GetNbSteps
()
const
;
142
inline
void
SetMaxNbSteps
(
G4int
);
143
inline
G4int
GetMaxNbSteps
()
const
;
144
inline
G4double
GetStartTime
()
const
;
145
inline
G4double
GetEndTime
()
const
;
146
virtual
inline
G4double
GetTimeStep
()
const
;
147
inline
G4double
GetPreviousTimeStep
()
const
;
148
inline
G4double
GetGlobalTime
()
const
;
149
inline
void
SetUserAction
(
G4UserTimeStepAction
*);
150
inline
G4UserTimeStepAction
*
GetUserTimeStepAction
()
const
;
151
152
// To use with transportation only, no reactions
153
inline
void
UseDefaultTimeSteps
(
G4bool
);
154
inline
G4bool
AreDefaultTimeStepsUsed
();
155
156
inline
G4ITStepStatus
GetStatus
()
const
;
157
158
/* 1 : Reaction information
159
* 2 : (1) + time step information
160
* 3 : (2) + step info for individual tracks
161
* 4 : (2) + trackList processing info + pushed and killed track info
162
*/
163
inline
void
SetVerbose
(
int
);
164
165
inline
int
GetVerbose
()
const
;
166
167
inline
void
WhyDoYouStop
();
168
169
void
SetInteractivity
(
G4ITTrackingInteractivity
*);
170
inline
G4ITTrackingInteractivity
*
GetInteractivity
();
171
172
virtual
size_t
GetNTracks
();
173
174
void
GetCollisionType
(
G4String
& interactionType);
175
176
void
AddWatchedTime
(
double
time
)
177
{
178
fWatchedTimes
.insert(time);
179
}
180
181
double
GetNextWatchedTime
()
const
;
182
183
inline
void
SetMaxTimeStep
(
double
maxTimeStep)
184
{
185
fMaxTimeStep
= maxTimeStep;
186
}
187
188
inline
double
GetMaxTimeStep
()
const
189
{
190
return
fMaxTimeStep
;
191
}
192
193
protected
:
194
195
void
DoProcess
();
196
void
SynchronizeTracks
();
197
void
Stepping
();
198
199
void
FindUserPreDefinedTimeStep
();
200
201
bool
CanICarryOn
();
202
203
void
PrintWhyDoYouStop
();
204
205
private
:
206
G4Scheduler
();
207
void
Create
();
208
G4Scheduler
(
const
G4Scheduler
&);
209
G4Scheduler
&
operator=
(
const
G4Scheduler
&);
210
211
G4SchedulerMessenger
*
fpMessenger
;
212
213
static
G4ThreadLocal
G4Scheduler
*
fgScheduler
;
214
int
fVerbose
;
215
bool
fWhyDoYouStop
;
216
bool
fInitialized
;
217
bool
fRunning
;
218
G4bool
fContinue
;
219
220
int
fNbSteps
;
221
int
fMaxSteps
;
222
223
G4ITStepStatus
fITStepStatus
;
224
225
// Time members
226
G4bool
fUseDefaultTimeSteps
;
227
double
fTimeTolerance
;
228
double
fGlobalTime
;
229
double
fTmpGlobalTime
;
230
double
fStartTime
;
231
double
fStopTime
;
232
double
fEndTime
;
233
double
fPreviousTimeStep
;
234
int
fZeroTimeCount
;
235
int
fMaxNZeroTimeStepsAllowed
;
236
237
double
fTimeStep
;
// The selected minimum time step
238
double
fMaxTimeStep
;
239
240
// User steps
241
bool
fUsePreDefinedTimeSteps
;
242
double
fDefaultMinTimeStep
;
243
std::map<double, double>*
fpUserTimeSteps
;
244
// One can give time steps in respect to the global time
245
mutable
double
fUserUpperTimeLimit
;
246
double
fDefinedMinTimeStep
;
247
// selected user time step in respect to the global time
248
bool
fReachedUserTimeLimit
;
// if fMinTimeStep == the user time step
249
250
std::set<double>
fWatchedTimes
;
251
252
G4UserTimeStepAction
*
fpUserTimeStepAction
;
253
254
// ==========================================
255
// TO BE REMOVED
256
G4ITStepProcessor
*
fpStepProcessor
;
257
G4ITModelProcessor
*
fpModelProcessor
;
258
G4ITTrackingManager
*
fpTrackingManager
;
259
G4ITTrackingInteractivity
*
fpTrackingInteractivity
;
260
G4ITReactionSet
*
fReactionSet
;
261
G4ITTrackHolder
&
fTrackContainer
;
262
G4ITModelHandler
*
fpModelHandler
;
263
// ==========================================
264
265
double
fTSTimeStep
;
266
// Time calculated by the time stepper in CalculateMinTimeStep()
267
double
fILTimeStep
;
268
// Time calculated by the interaction length methods
269
// in ComputeInteractionLength()
270
271
bool
fInteractionStep
;
272
// Flag : if the step is driven by the interaction with the matter and
273
// NOT by the reaction between tracks
274
275
G4ITGun
*
fpGun
;
276
277
// ==========================================
278
//
279
280
};
281
282
inline
bool
G4Scheduler::IsInitialized
()
283
{
284
return
fInitialized
;
285
}
286
287
inline
G4ITModelHandler
*
G4Scheduler::GetModelHandler
()
288
{
289
return
fpModelHandler
;
290
}
291
292
inline
void
G4Scheduler::SetEndTime
(
const
double
__endtime)
293
{
294
fEndTime
= __endtime;
295
}
296
297
inline
298
void
G4Scheduler::SetTimeSteps
(std::map<double, double>*
steps
)
299
{
300
fUsePreDefinedTimeSteps
=
true
;
301
fpUserTimeSteps
=
steps
;
302
}
303
304
inline
void
G4Scheduler::AddTimeStep
(
double
startingTime,
double
timeStep)
305
{
306
if
(
fpUserTimeSteps
== 0)
307
{
308
fpUserTimeSteps
=
new
std::map<double, double>();
309
fUsePreDefinedTimeSteps
=
true
;
310
}
311
312
(*fpUserTimeSteps)[startingTime] = timeStep;
313
}
314
315
inline
G4int
G4Scheduler::GetNbSteps
()
const
316
{
317
return
fNbSteps
;
318
}
319
320
inline
void
G4Scheduler::SetMaxNbSteps
(
G4int
maxSteps)
321
{
322
fMaxSteps
= maxSteps;
323
}
324
325
inline
G4int
G4Scheduler::GetMaxNbSteps
()
const
326
{
327
return
fMaxSteps
;
328
}
329
330
inline
G4double
G4Scheduler::GetStartTime
()
const
331
{
332
return
fStartTime
;
333
}
334
335
inline
G4double
G4Scheduler::GetEndTime
()
const
336
{
337
return
fEndTime
;
338
}
339
340
inline
G4double
G4Scheduler::GetTimeStep
()
const
341
{
342
return
fTimeStep
;
343
}
344
345
inline
void
G4Scheduler::SetDefaultTimeStep
(
double
timeStep)
346
{
347
fDefaultMinTimeStep
= timeStep;
348
}
349
350
inline
G4double
G4Scheduler::GetGlobalTime
()
const
351
{
352
return
fGlobalTime
;
353
}
354
355
inline
356
void
G4Scheduler::SetUserAction
(
G4UserTimeStepAction
* userITAction)
357
{
358
fpUserTimeStepAction
= userITAction;
359
}
360
361
inline
G4UserTimeStepAction
*
G4Scheduler::GetUserTimeStepAction
()
const
362
{
363
return
fpUserTimeStepAction
;
364
}
365
366
inline
void
G4Scheduler::SetVerbose
(
int
verbose)
367
{
368
fVerbose
= verbose;
369
}
370
371
inline
int
G4Scheduler::GetVerbose
()
const
372
{
373
return
fVerbose
;
374
}
375
376
inline
377
void
G4Scheduler::SetMaxZeroTimeAllowed
(
int
maxTimeStepAllowed)
378
{
379
fMaxNZeroTimeStepsAllowed
= maxTimeStepAllowed;
380
}
381
382
inline
int
G4Scheduler::GetMaxZeroTimeAllowed
()
const
383
{
384
return
fMaxNZeroTimeStepsAllowed
;
385
}
386
387
inline
void
G4Scheduler::SetTimeTolerance
(
double
time
)
388
{
389
fTimeTolerance
=
time
;
390
}
391
392
inline
double
G4Scheduler::GetTimeTolerance
()
const
393
{
394
return
fTimeTolerance
;
395
}
396
397
inline
G4double
G4Scheduler::GetPreviousTimeStep
()
const
398
{
399
return
fPreviousTimeStep
;
400
}
401
402
inline
G4ITStepStatus
G4Scheduler::GetStatus
()
const
403
{
404
return
fITStepStatus
;
405
}
406
407
inline
void
G4Scheduler::Stop
()
408
{
409
fContinue
=
false
;
410
}
411
412
inline
G4ITTrackingInteractivity
*
G4Scheduler::GetInteractivity
()
413
{
414
return
fpTrackingInteractivity
;
415
}
416
417
inline
void
G4Scheduler::SetGun
(
G4ITGun
* gun)
418
{
419
fpGun
= gun;
420
}
421
422
inline
G4ITGun
*
G4Scheduler::GetGun
()
423
{
424
return
fpGun
;
425
}
426
427
inline
void
G4Scheduler::WhyDoYouStop
()
428
{
429
fWhyDoYouStop
=
true
;
430
}
431
432
inline
void
G4Scheduler::UseDefaultTimeSteps
(
G4bool
flag)
433
{
434
fUseDefaultTimeSteps
= flag;
435
}
436
437
inline
G4bool
G4Scheduler::AreDefaultTimeStepsUsed
()
438
{
439
return
(
fUseDefaultTimeSteps
==
false
&&
fUsePreDefinedTimeSteps
==
false
);
440
}
441
442
#endif
geant4
tree
geant4-10.6-release
source
processes
electromagnetic
dna
management
include
G4Scheduler.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:28
using
1.8.2 with
ECCE GitHub integration