Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4DNAEventScheduler Class Reference

#include <G4DNAEventScheduler.hh>

+ Inheritance diagram for G4DNAEventScheduler:

Public Types

using MolType = const G4MolecularConfiguration*
 
using MapList = std::map<MolType, size_t>
 
using MapCounter = std::map<MolType, G4int>
 

Public Member Functions

 G4DNAEventScheduler ()
 
 ~G4DNAEventScheduler () override
 
 G4DNAEventScheduler (const G4DNAEventScheduler &)=delete
 
G4DNAEventScheduleroperator= (const G4DNAEventScheduler &right)=delete
 
void Initialize (const G4DNABoundingBox &boundingBox, G4int pixel)
 
void InitializeInMesh ()
 
void Voxelizing ()
 
void ReVoxelizing (G4int)
 
void SetEndTime (const G4double &)
 
G4double GetStartTime () const
 
G4double GetEndTime () const
 
G4double GetTimeStep () const
 
void SetStartTime (G4double time)
 
void SetVerbose (G4int verbose)
 
G4int GetVerbose () const
 
void Stepping ()
 
void SetChangeMesh (G4bool change)
 
void Reset ()
 
void ResetInMesh ()
 
void RunInMesh ()
 
void Run ()
 
void AddTimeToRecord (const G4double &time)
 
void RecordTime ()
 
void ClearAndReChargeCounter ()
 
void PrintRecordTime ()
 
void Stop ()
 
void SetMaxNbSteps (G4int)
 
std::map< G4double, MapCounterGetCounterMap () const
 
G4DNAMeshGetMesh () const
 
G4int GetPixels () const
 
void SetUserMeshAction (std::unique_ptr< G4UserMeshAction >)
 
- Public Member Functions inherited from IEventScheduler
 IEventScheduler ()=default
 
virtual ~IEventScheduler ()=default
 

Static Public Member Functions

static G4bool CheckingReactionRadius (G4double resolution)
 

Detailed Description

Definition at line 54 of file G4DNAEventScheduler.hh.

Member Typedef Documentation

◆ MapCounter

Definition at line 59 of file G4DNAEventScheduler.hh.

◆ MapList

using G4DNAEventScheduler::MapList = std::map<MolType, size_t>

Definition at line 58 of file G4DNAEventScheduler.hh.

◆ MolType

Constructor & Destructor Documentation

◆ G4DNAEventScheduler() [1/2]

G4DNAEventScheduler::G4DNAEventScheduler ( )

Definition at line 41 of file G4DNAEventScheduler.cc.

◆ ~G4DNAEventScheduler()

G4DNAEventScheduler::~G4DNAEventScheduler ( )
overridedefault

◆ G4DNAEventScheduler() [2/2]

G4DNAEventScheduler::G4DNAEventScheduler ( const G4DNAEventScheduler & )
delete

Member Function Documentation

◆ AddTimeToRecord()

void G4DNAEventScheduler::AddTimeToRecord ( const G4double & time)

Definition at line 106 of file G4DNAEventScheduler.cc.

107{
108 if(fTimeToRecord.find(time) == fTimeToRecord.end())
109 {
110 fTimeToRecord.insert(time);
111 }
112}

◆ CheckingReactionRadius()

G4bool G4DNAEventScheduler::CheckingReactionRadius ( G4double resolution)
static

Definition at line 626 of file G4DNAEventScheduler.cc.

627{
628 auto pMolecularReactionTable = G4DNAMolecularReactionTable::Instance();
629 auto reactionDataList = pMolecularReactionTable->GetVectorOfReactionData();
630 if(reactionDataList.empty())
631 {
632 G4cout << "reactionDataList.empty()" << G4endl;
633 return true;
634 }
635
636 for(auto it : reactionDataList)
637 {
638 if(it->GetEffectiveReactionRadius() >= resolution / CLHEP::pi)
639 {
640 G4cout << it->GetReactant1()->GetName() << " + "
641 << it->GetReactant2()->GetName() << G4endl;
642 G4cout << "G4DNAEventScheduler::ReactionRadius : "
643 << G4BestUnit(it->GetEffectiveReactionRadius(), "Length")
644 << G4endl;
645 G4cout << "resolution : " << G4BestUnit(resolution, "Length") << G4endl;
646 return false;
647 }
648 }
649 return true;
650}
#define G4BestUnit(a, b)
#define G4endl
Definition G4ios.hh:67
G4GLOB_DLL std::ostream G4cout
static G4DNAMolecularReactionTable * Instance()

Referenced by Initialize().

◆ ClearAndReChargeCounter()

void G4DNAEventScheduler::ClearAndReChargeCounter ( )

Definition at line 47 of file G4DNAEventScheduler.cc.

48{
49 fCounterMap.clear();
50 if(fTimeToRecord.empty())
51 {
52 G4String WarMessage = "fTimeToRecord is empty ";
53 G4Exception("G4DNAEventScheduler::ClearAndReChargeCounter()",
54 "TimeToRecord is empty", JustWarning, WarMessage);
55 }
56 fLastRecoredTime = fTimeToRecord.begin();
57
58 if(G4VMoleculeCounter::Instance()->InUse()) // copy from MoleculeCounter
59 {
62 if(species.get() == nullptr)
63 {
64 return;
65 }
66 if(species->empty())
67 {
69 return;
70 }
71 for(auto time_mol : fTimeToRecord)
72 {
73 if(time_mol > fStartTime)
74 {
75 continue;
76 }
77
78 for(auto molecule : *species)
79 {
81 molecule, time_mol);
82
83 if(n_mol < 0)
84 {
85 G4cerr << "G4DNAEventScheduler::ClearAndReChargeCounter() ::N "
86 "molecules not valid < 0 "
87 << G4endl;
88 G4Exception("", "N<0", FatalException, "");
89 }
90 fCounterMap[time_mol][molecule] = n_mol;
91 }
92 fLastRecoredTime++;
93 }
95 G4MoleculeCounter::Instance()->Use(false); // no more used
96 }
97 else
98 {
99 G4ExceptionDescription exceptionDescription;
100 exceptionDescription << "G4VMoleculeCounter is not used";
101 G4Exception("G4DNAEventScheduler::ClearAndReChargeCounter()",
102 "G4DNAEventScheduler010", JustWarning, exceptionDescription);
103 }
104}
@ JustWarning
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
int G4int
Definition G4Types.hh:85
G4GLOB_DLL std::ostream G4cerr
std::unique_ptr< ReactantList > RecordedMolecules
static G4MoleculeCounter * Instance()
void ResetCounter() override
int GetNMoleculesAtTime(Reactant *molecule, double time)
RecordedMolecules GetRecordedMolecules()
void Use(G4bool flag=true)
static G4VMoleculeCounter * Instance()

Referenced by Initialize().

◆ GetCounterMap()

std::map< G4double, G4DNAEventScheduler::MapCounter > G4DNAEventScheduler::GetCounterMap ( ) const

Definition at line 611 of file G4DNAEventScheduler.cc.

612{
613 return fCounterMap;
614}

◆ GetEndTime()

G4double G4DNAEventScheduler::GetEndTime ( ) const

Definition at line 308 of file G4DNAEventScheduler.cc.

308{ return fEndTime; }

◆ GetMesh()

G4DNAMesh * G4DNAEventScheduler::GetMesh ( ) const

Definition at line 622 of file G4DNAEventScheduler.cc.

622{ return fpMesh.get(); }

◆ GetPixels()

G4int G4DNAEventScheduler::GetPixels ( ) const

Definition at line 624 of file G4DNAEventScheduler.cc.

624{ return fPixel; }

◆ GetStartTime()

G4double G4DNAEventScheduler::GetStartTime ( ) const

Definition at line 306 of file G4DNAEventScheduler.cc.

306{ return fStartTime; }

◆ GetTimeStep()

G4double G4DNAEventScheduler::GetTimeStep ( ) const

Definition at line 310 of file G4DNAEventScheduler.cc.

311{
312 return fTimeStep;
313}

◆ GetVerbose()

G4int G4DNAEventScheduler::GetVerbose ( ) const
inline

Definition at line 315 of file G4DNAEventScheduler.cc.

315{ return fVerbose; }

◆ Initialize()

void G4DNAEventScheduler::Initialize ( const G4DNABoundingBox & boundingBox,
G4int pixel )

Definition at line 221 of file G4DNAEventScheduler.cc.

223{
224 if(!fInitialized)
225 {
226 fPixel = pixel;
227 fpMesh = std::make_unique<G4DNAMesh>(boundingBox, pixel);
228
229 if(!CheckingReactionRadius(fpMesh->GetResolution()))
230 {
231 G4String WarMessage = "resolution is not good : " +
232 std::to_string(fpMesh->GetResolution() / nm);
233 G4Exception("G4DNAEventScheduler::InitializeInMesh()", "WrongResolution",
234 JustWarning, WarMessage);
235 }
236
237 // Scavenger();
238
239 auto pScavengerMaterial = dynamic_cast<G4DNAScavengerMaterial*>(
241 if(pScavengerMaterial == nullptr)
242 {
243 G4cout << "There is no scavenger" << G4endl;
244 }
245 else
246 {
247 if(fVerbose > 1)
248 {
249 pScavengerMaterial->PrintInfo();
250 }
251 }
252
253 Voxelizing();
254 fpGillespieReaction->SetVoxelMesh(*fpMesh);
255 fpGillespieReaction->SetEventSet(fpEventSet.get());
256 fpGillespieReaction->SetTimeStep(0);// reset fTimeStep = 0 in fpGillespieReaction
257 fpGillespieReaction->Initialize();
258 fpGillespieReaction->CreateEvents();
259 fpUpdateSystem->SetMesh(fpMesh.get());
261 fInitialized = true;
262 }
263
264 if(fVerbose > 0)
265 {
266 fpUpdateSystem->SetVerbose(1);
267 }
268
269 if(fVerbose > 2)
270 {
271 fpMesh->PrintMesh();
272 }
273}
static G4bool CheckingReactionRadius(G4double resolution)
static G4Scheduler * Instance()
G4VScavengerMaterial * GetScavengerMaterial() const

◆ InitializeInMesh()

void G4DNAEventScheduler::InitializeInMesh ( )

Definition at line 274 of file G4DNAEventScheduler.cc.

275{
276 if(fPixel <= 1)
277 {
278 fRunning = false;
279 return;
280 }
281 // TEST /3
282 ReVoxelizing(fPixel / 2); //
283 // ReVoxelizing(fPixel/3);//
284
285 fpGillespieReaction->SetVoxelMesh(*fpMesh);
286 fpUpdateSystem->SetMesh(fpMesh.get());
287 fpGillespieReaction->CreateEvents();
288}

Referenced by RunInMesh().

◆ operator=()

G4DNAEventScheduler & G4DNAEventScheduler::operator= ( const G4DNAEventScheduler & right)
delete

◆ PrintRecordTime()

void G4DNAEventScheduler::PrintRecordTime ( )

Definition at line 588 of file G4DNAEventScheduler.cc.

589{
590 G4cout << "CounterMap.size : " << fCounterMap.size() << G4endl;
591 for(const auto& i : fCounterMap)
592 {
593 auto map = i.second;
594 auto begin = map.begin(); //
595 auto end = map.end(); //
596 for(; begin != end; begin++)
597 {
598 auto molecule = begin->first;
599 auto number = begin->second;
600 if(number == 0)
601 {
602 continue;
603 }
604 G4cout << "molecule : " << molecule->GetName() << " number : " << number
605 << G4endl;
606 }
607 }
608}

◆ RecordTime()

void G4DNAEventScheduler::RecordTime ( )

Definition at line 565 of file G4DNAEventScheduler.cc.

566{
567 auto recordTime = *fLastRecoredTime;
568 if(fGlobalTime >= recordTime && fCounterMap[recordTime].empty())
569 {
570 auto begin = fpMesh->begin();
571 auto end = fpMesh->end();
572 for(; begin != end; begin++)
573 {
574 const auto& mapData = std::get<2>(*begin);
575 if(mapData.empty())
576 {
577 continue;
578 }
579 for(const auto& it : mapData)
580 {
581 fCounterMap[recordTime][it.first] += it.second;
582 }
583 }
584 fLastRecoredTime++;
585 }
586}

Referenced by Stepping().

◆ Reset()

void G4DNAEventScheduler::Reset ( )

Definition at line 194 of file G4DNAEventScheduler.cc.

195{
196 // find another solultion
197 fGlobalTime = fEndTime;
198
199 //
200 LastRegisterForCounter();//Last register for counter
201
202 if(fVerbose > 0)
203 {
204 G4cout << "End Processing and reset Gird, ScavengerTable, EventSet for new "
205 "simulation!!!!"
206 << G4endl;
207 }
208 fInitialized = false;
209 fTimeStep = 0;
210 fStepNumber = 0;
211 fGlobalTime = fStartTime;
212 fRunning = true;
213 fReactionNumber = 0;
214 fJumpingNumber = 0;
215
216 fpEventSet->RemoveEventSet();
217 fpMesh->Reset();
218 fpGillespieReaction->ResetEquilibrium();
219}

Referenced by Run().

◆ ResetInMesh()

void G4DNAEventScheduler::ResetInMesh ( )

Definition at line 290 of file G4DNAEventScheduler.cc.

291{
292 if(fVerbose > 0)
293 {
294 G4cout
295 << "*** End Processing In Mesh and reset Mesh, EventSet for new Mesh!!!!"
296 << G4endl;
297 }
298 fpEventSet->RemoveEventSet();
299 fInitialized = false;
300 fIsChangeMesh = false;
301 fReactionNumber = 0;
302 fJumpingNumber = 0;
303 fStepNumberInMesh = 0;
304}

Referenced by RunInMesh().

◆ ReVoxelizing()

void G4DNAEventScheduler::ReVoxelizing ( G4int pixel)

Definition at line 157 of file G4DNAEventScheduler.cc.

158{
159 fPixel = pixel;
160 auto newMesh = new G4DNAMesh(fpMesh->GetBoundingBox(), fPixel);
161
162 auto begin = fpMesh->begin();
163 auto end = fpMesh->end();
164 std::map<G4VDNAMesh::Index, MapList> TrackKeyMap;
165 for(; begin != end; begin++)
166 {
167 auto index = std::get<0>(*begin);
168 auto newIndex = fpMesh->ConvertIndex(index, fPixel);
169 if(TrackKeyMap.find(newIndex) == TrackKeyMap.end())
170 {
171 TrackKeyMap[newIndex] = std::get<2>(*begin);
172 }
173 else
174 {
175 for(const auto& it : std::get<2>(*begin))
176 {
177 TrackKeyMap[newIndex][it.first] += it.second;
178 }
179 if(fVerbose > 1)
180 {
181 G4cout << " ReVoxelizing:: Old index : " << index
182 << " new index : " << fpMesh->ConvertIndex(index, fPixel)
183 << " number: " << std::get<2>(*begin).begin()->second << G4endl;
184 }
185 }
186 }
187 fpMesh.reset(newMesh);
188
189 for(auto& it : TrackKeyMap)
190 {
191 fpMesh->InitializeVoxel(it.first, std::move(it.second));
192 }
193}

Referenced by InitializeInMesh().

◆ Run()

void G4DNAEventScheduler::Run ( )

Definition at line 329 of file G4DNAEventScheduler.cc.

330{
331 G4Timer localtimer;
332 if(fVerbose > 2)
333 {
334 localtimer.Start();
335 G4cout << "***G4DNAEventScheduler::Run*** for Pixel : " << fPixel << G4endl;
336 }
337 while(fEndTime > fGlobalTime && fRunning)
338 {
339 RunInMesh();
340 }
341 if(fVerbose > 2)
342 {
343 if(!fRunning)
344 {
345 G4cout << " StepNumber(" << fStepNumber << ") = MaxStep(" << fMaxStep
346 << ")" << G4endl;
347 }
348 else if(fEndTime <= fGlobalTime)
349 {
350 G4cout << " GlobalTime(" << fGlobalTime << ") > EndTime(" << fEndTime
351 << ")"
352 << " StepNumber : " << fStepNumber << G4endl;
353 }
354 localtimer.Stop();
355 G4cout << "***G4DNAEventScheduler::Ending::"
356 << G4BestUnit(fGlobalTime, "Time")
357 << " Events left : " << fpEventSet->size() << G4endl;
358 if(fVerbose > 1)
359 {
360 fpMesh->PrintMesh();
361 }
362 G4cout << " Computing Time : " << localtimer << G4endl;
363 }
364 Reset();
365}
void Stop()
void Start()

◆ RunInMesh()

void G4DNAEventScheduler::RunInMesh ( )

Definition at line 367 of file G4DNAEventScheduler.cc.

368{
369 if(!fInitialized)
370 {
372 }
373 if(fVerbose > 0)
374 {
375 G4double resolution = fpMesh->GetResolution();
376 G4cout << "At Time : " << std::setw(7) << G4BestUnit(fGlobalTime, "Time")
377 << " the Mesh has " << fPixel << " x " << fPixel << " x " << fPixel
378 << " voxels with Resolution " << G4BestUnit(resolution, "Length")
379 << " during next "
380 << G4BestUnit(resolution * resolution * C / (6 * D), "Time")
381 << G4endl;
382 }
383
384 if(fVerbose > 2)
385 {
386 fpMesh->PrintMesh();
387 }
388
389 if(fpUserMeshAction != nullptr)
390 {
391 fpUserMeshAction->BeginOfMesh(fpMesh.get(), fGlobalTime);
392 }
393
394 // if diffusive jumping is avaiable, EventSet is never empty
395
396 while(!fpEventSet->Empty() && !fIsChangeMesh && fEndTime > fGlobalTime)
397 {
398 Stepping();
399 fGlobalTime = fTimeStep + fStartTime;
400
401 if(fpUserMeshAction != nullptr)
402 {
403 fpUserMeshAction->InMesh(fpMesh.get(), fGlobalTime);
404 }
405
406 if(fVerbose > 2)
407 {
408 G4cout << "fGlobalTime : " << G4BestUnit(fGlobalTime, "Time")
409 << " fTimeStep : " << G4BestUnit(fTimeStep, "Time") << G4endl;
410 }
411 G4double resolution = fpMesh->GetResolution();
412 fTransferTime = resolution * resolution * C / (6 * D);
413 if(fTransferTime == 0)
414 {
415 G4ExceptionDescription exceptionDescription;
416 exceptionDescription << "fTransferTime == 0";
417 G4Exception("G4DNAEventScheduler::RunInMesh", "G4DNAEventScheduler001",
418 FatalErrorInArgument, exceptionDescription);
419 }
420 if(fTransferTime < fTimeStep &&
421 fPixel != 1) // dont change Mesh if fPixel == 1
422 {
423 if(fSetChangeMesh)
424 {
425 if(fVerbose > 1)
426 {
427 G4cout << " Pixels : " << fPixel << " resolution : "
428 << G4BestUnit(fpMesh->GetResolution(), "Length")
429 << " fStepNumberInMesh : " << fStepNumberInMesh
430 << " at fGlobalTime : " << G4BestUnit(fGlobalTime, "Time")
431 << " at fTimeStep : " << G4BestUnit(fTimeStep, "Time")
432 << " fReactionNumber : " << fReactionNumber
433 << " transferTime : " << G4BestUnit(fTransferTime, "Time")
434 << G4endl;
435 }
436 fIsChangeMesh = true;
437 }
438 }
439 }
440
441 if(fVerbose > 1)
442 {
443 G4cout << "***G4DNAEventScheduler::Ending::"
444 << G4BestUnit(fGlobalTime, "Time")
445 << " Event left : " << fpEventSet->size() << G4endl;
446 G4cout << " Due to : ";
447 if(fpEventSet->Empty())
448 {
449 G4cout << "EventSet is Empty" << G4endl;
450 }
451 else if(fIsChangeMesh)
452 {
453 G4cout << "Changing Mesh from : " << fPixel
454 << " pixels to : " << fPixel / 2 << " pixels" << G4endl;
455 G4cout << "Info : ReactionNumber : " << fReactionNumber
456 << " JumpingNumber : " << fJumpingNumber << G4endl;
457 }
458 else if(fEndTime > fGlobalTime)
459 {
460 G4cout << " GlobalTime(" << fGlobalTime << ") > EndTime(" << fEndTime
461 << ")"
462 << " StepNumber : " << fStepNumber << G4endl;
463 }
464 if(fVerbose > 2)
465 {
466 fpMesh->PrintMesh();
467 }
468 G4cout << G4endl;
469 }
470
471 if(fpUserMeshAction != nullptr)
472 {
473 fpUserMeshAction->EndOfMesh(fpMesh.get(), fGlobalTime);
474 }
475 ResetInMesh();
476}
@ FatalErrorInArgument
double G4double
Definition G4Types.hh:83

Referenced by Run().

◆ SetChangeMesh()

void G4DNAEventScheduler::SetChangeMesh ( G4bool change)
inline

Definition at line 77 of file G4DNAEventScheduler.hh.

77{ fSetChangeMesh = change; }

◆ SetEndTime()

void G4DNAEventScheduler::SetEndTime ( const G4double & endTime)

Definition at line 560 of file G4DNAEventScheduler.cc.

561{
562 fEndTime = endTime;
563}

◆ SetMaxNbSteps()

void G4DNAEventScheduler::SetMaxNbSteps ( G4int max)

Definition at line 317 of file G4DNAEventScheduler.cc.

318{
319 fMaxStep = max;
320}
T max(const T t1, const T t2)
brief Return the largest of the two arguments

◆ SetStartTime()

void G4DNAEventScheduler::SetStartTime ( G4double time)

Definition at line 322 of file G4DNAEventScheduler.cc.

323{
324 fStartTime = time;
325 fGlobalTime = fStartTime;
326}

◆ SetUserMeshAction()

void G4DNAEventScheduler::SetUserMeshAction ( std::unique_ptr< G4UserMeshAction > pUserMeshAction)

Definition at line 616 of file G4DNAEventScheduler.cc.

618{
619 fpUserMeshAction = std::move(pUserMeshAction);
620}

◆ SetVerbose()

void G4DNAEventScheduler::SetVerbose ( G4int verbose)
inline

Definition at line 74 of file G4DNAEventScheduler.hh.

74{ fVerbose = verbose; }

◆ Stepping()

void G4DNAEventScheduler::Stepping ( )

Definition at line 478 of file G4DNAEventScheduler.cc.

479{
480 fStepNumber < fMaxStep ? fStepNumber++ : static_cast<int>(fRunning = false);
481 if(fpEventSet->size() > fpMesh->size())
482 {
483 G4ExceptionDescription exceptionDescription;
484 exceptionDescription
485 << "impossible that fpEventSet->size() > fpMesh->size()";
486 G4Exception("G4DNAEventScheduler::Stepping", "G4DNAEventScheduler002",
487 FatalErrorInArgument, exceptionDescription);
488 }
489
490 auto selected = fpEventSet->begin();
491 auto index = (*selected)->GetIndex();
492
493 if(fVerbose > 1)
494 {
495 G4cout << "G4DNAEventScheduler::Stepping()*********************************"
496 "*******"
497 << G4endl;
498 (*selected)->PrintEvent();
499 }
500
501 // get selected time step
502 fTimeStep = (*selected)->GetTime();
503
504 // selected data
505 auto pJumping = (*selected)->GetJumpingData();
506 auto pReaction = (*selected)->GetReactionData();
507
508 fpUpdateSystem->SetGlobalTime(fTimeStep +
509 fStartTime); // this is just for printing
510 fpGillespieReaction->SetTimeStep(fTimeStep);
511 if(pJumping == nullptr && pReaction != nullptr)
512 {
513 fpUpdateSystem->UpdateSystem(index, *pReaction);
514 fpEventSet->RemoveEvent(selected);
515
516 //hoang's exp
517 if(fpGillespieReaction->SetEquilibrium(pReaction))
518 {
519 ResetEventSet();
520 }
521 //end Hoang's exp
522
523 // create new event
524 fpGillespieReaction->CreateEvent(index);
525 fReactionNumber++;
526 // recordTime in reaction
527 RecordTime();
528 }
529 else if(pJumping != nullptr && pReaction == nullptr)
530 {
531 // dont change this
532 fpUpdateSystem->UpdateSystem(index, *pJumping);
533 // save jumping Index before delete selected event
534 auto jumpingIndex = pJumping->second;
535 fpEventSet->RemoveEvent(selected);
536 // create new event
537 // should create Jumping before key
538 fpGillespieReaction->CreateEvent(jumpingIndex);
539 fpGillespieReaction->CreateEvent(index);
540 fJumpingNumber++;
541 }
542 else
543 {
544 G4ExceptionDescription exceptionDescription;
545 exceptionDescription << "pJumping == nullptr && pReaction == nullptr";
546 G4Exception("G4DNAEventScheduler::Stepping", "G4DNAEventScheduler003",
547 FatalErrorInArgument, exceptionDescription);
548 }
549
550 if(fVerbose > 1)
551 {
552 G4cout << "G4DNAEventScheduler::Stepping::end "
553 "Print***********************************"
554 << G4endl;
555 G4cout << G4endl;
556 }
557 fStepNumberInMesh++;
558}

Referenced by RunInMesh().

◆ Stop()

void G4DNAEventScheduler::Stop ( )

Definition at line 328 of file G4DNAEventScheduler.cc.

328{ fRunning = false; }

◆ Voxelizing()

void G4DNAEventScheduler::Voxelizing ( )

Definition at line 116 of file G4DNAEventScheduler.cc.

117{
118 auto pMainList = G4ITTrackHolder::Instance()->GetMainList();
119 std::map<G4VDNAMesh::Index, MapList> TrackKeyMap;
120 for(auto track : *pMainList)
121 {
122 auto molType = GetMolecule(track)->GetMolecularConfiguration();
123
124 auto pScavengerMaterial = dynamic_cast<G4DNAScavengerMaterial*>(
126 if(pScavengerMaterial != nullptr &&
127 pScavengerMaterial->find(molType)) // avoid voxelize the scavenger
128 {
129 continue;
130 }
131
132 auto key = fpMesh->GetIndex(track->GetPosition());
133 if(TrackKeyMap.find(key) != TrackKeyMap.end())
134 {
135 std::map<MolType, size_t>& TrackTypeMap = TrackKeyMap[key];
136 if(TrackTypeMap.find(molType) != TrackTypeMap.end())
137 {
138 TrackTypeMap[molType]++;
139 }
140 else
141 {
142 TrackTypeMap[molType] = 1;
143 }
144 }
145 else
146 {
147 TrackKeyMap[key][molType] = 1;
148 }
149 }
150
151 for(auto& it : TrackKeyMap)
152 {
153 fpMesh->InitializeVoxel(it.first, std::move(it.second));
154 }
155}
G4Molecule * GetMolecule(const G4Track &track)
Definition G4Molecule.cc:74
G4TrackList * GetMainList(Key)
static G4ITTrackHolder * Instance()
const G4MolecularConfiguration * GetMolecularConfiguration() const

Referenced by Initialize().


The documentation for this class was generated from the following files: