51 , fGlobalTime(fStartTime)
55 , fIsChangeMesh(false)
56 , fSetChangeMesh(true)
57 , fStepNumberInMesh(0)
58 , fInitialPixels(fPixel)
59 , fpMesh(new
G4DNAMesh(boundingBox, fPixel))
63 , fpUserMeshAction(nullptr)
67 G4String WarMessage =
"resolution is not good : " +
68 std::to_string(
fpMesh->GetResolution() /
nm);
69 G4Exception(
"G4DNAEventScheduler::InitializeInMesh()",
"WrongResolution",
87 if(species.get() ==
nullptr)
91 else if(species->empty())
103 for(
auto molecule : *species)
110 G4cerr <<
"G4DNAEventScheduler::ClearAndReChargeCounter() ::N "
111 "molecules not valid < 0 "
138 std::map<G4DNAMesh::Key, MapList> TrackKeyMap;
139 for(
auto track : *pMainList)
145 if(pScavengerMaterial !=
nullptr &&
146 pScavengerMaterial->find(molType))
151 auto key =
fpMesh->GetKey(track->GetPosition());
152 if(TrackKeyMap.find(key) != TrackKeyMap.end())
154 std::map<MolType, size_t>& TrackTypeMap = TrackKeyMap[key];
155 if(TrackTypeMap.find(molType) != TrackTypeMap.end())
157 TrackTypeMap[molType]++;
161 TrackTypeMap[molType] = 1;
166 TrackKeyMap[key][molType] = 1;
170 for(
auto& it : TrackKeyMap)
172 fpMesh->SetVoxelMapList(it.first, std::move(it.second));
181 auto begin =
fpMesh->begin();
183 std::map<G4DNAMesh::Key, MapList> TrackKeyMap;
184 for(; begin != end; begin++)
186 auto index =
fpMesh->GetIndex(begin->first);
187 auto newKey = newMesh->GetKey(
fpMesh->GetIndex(index,
fPixel));
188 auto node = begin->second;
190 if(TrackKeyMap.find(newKey) == TrackKeyMap.end())
192 TrackKeyMap[newKey] = node->GetMapList();
196 for(
const auto& it : node->GetMapList())
198 TrackKeyMap[newKey][it.first] += it.second;
202 G4cout <<
"key : " << begin->first <<
" index : " << index
204 <<
" new key : " << newKey
205 <<
" number: " << node->GetMapList().begin()->second <<
G4endl;
211 for(
auto& it : TrackKeyMap)
213 fpMesh->SetVoxelMapList(it.first, std::move(it.second));
226 G4cout <<
"End Processing and reset Gird, ScavengerTable, EventSet for new "
253 if(pScavengerMaterial ==
nullptr)
261 pScavengerMaterial->PrintInfo();
307 <<
"*** End Processing In Mesh and reset Mesh, EventSet for new Mesh!!!!"
360 G4cout <<
"***G4DNAEventScheduler::Ending::"
380 localtimerInMesh.
Start();
386 G4cout <<
"***G4DNAEventScheduler::RunInMesh*** for Pixel : " <<
fPixel
426 exceptionDescription <<
"D == 0";
427 G4Exception(
"G4DNAEventScheduler::RunInMesh",
"G4DNAEventScheduler001",
444 <<
" transferTime : " <<
G4BestUnit(transferTime,
"Time")
456 localtimerInMesh.
Stop();
457 G4cout <<
"***G4DNAEventScheduler::Ending::"
460 G4cout <<
" Computing Time : " << localtimerInMesh <<
" Due to : ";
468 <<
" pixels to : " <<
fPixel / 2 <<
" pixels" <<
G4endl;
499 exceptionDescription <<
"fpEventSet->size() > fpMesh->size()";
500 G4Exception(
"G4DNAEventScheduler::Stepping",
"G4DNAEventScheduler002",
505 const auto& key = (*selected)->GetKey();
506 auto index =
fpMesh->GetIndex(key);
510 G4cout <<
"G4DNAEventScheduler::Stepping()*********************************"
513 (*selected)->PrintEvent();
520 auto pJumping = (*selected)->GetJumpingData();
521 auto pReaction = (*selected)->GetReactionData();
526 if(pJumping ==
nullptr && pReaction ==
nullptr)
529 exceptionDescription <<
"pJumping == nullptr && pReaction == nullptr";
530 G4Exception(
"G4DNAEventScheduler::Stepping",
"G4DNAEventScheduler003",
536 if(pJumping ==
nullptr)
548 else if(pReaction ==
nullptr)
552 auto jumpingKey =
fpMesh->GetKey(pJumping->second);
564 G4cout <<
"G4DNAEventScheduler::Stepping::end "
565 "Print***********************************"
582 auto begin =
fpMesh->begin();
584 for(; begin != end; begin++)
586 auto node = begin->second;
587 if(node ==
nullptr) {
590 for(
const auto& it : node->GetMapList())
604 auto conf = iter.value();
607 <<
" recordTime : " <<
G4BestUnit(recordTime,
"Time") <<
" "
610 <<
" MoleculeCounter : "
628 auto begin =
map.begin();
629 auto end =
map.end();
630 for(; begin != end; begin++)
632 auto molecule = begin->first;
633 auto number = begin->second;
638 G4cout <<
"molecule : " << molecule->GetName() <<
" number : " << number
651 std::unique_ptr<G4UserMeshAction> pUserMeshAction)
663 auto reactionDataList = pMolecularReactionTable->GetVectorOfReactionData();
664 if(reactionDataList.empty())
671 for(
auto it : reactionDataList)
673 if(it->GetEffectiveReactionRadius() >= resolution /
CLHEP::pi)
675 G4cout << it->GetReactant1()->GetName() <<
" + "
676 << it->GetReactant2()->GetName() <<
G4endl;
677 G4cout <<
"G4DNAEventScheduler::ReactionRadius : "
678 <<
G4BestUnit(it->GetEffectiveReactionRadius(),
"Length")
G4double C(G4double temp)
G4double D(G4double temp)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4Molecule * GetMolecule(const G4Track &track)
static constexpr double nm
static constexpr double s
static constexpr double ps
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
std::unique_ptr< G4DNAMesh > fpMesh
std::unique_ptr< G4DNAGillespieDirectMethod > fpGillespieReaction
static G4bool CheckingReactionRadius(G4double resolution)
std::unique_ptr< G4DNAUpdateSystemModel > fpUpdateSystem
void SetMaxNbSteps(G4int)
G4DNAEventScheduler(const G4DNABoundingBox &boundingBox, G4int pixel)
void SetUserMeshAction(std::unique_ptr< G4UserMeshAction >)
std::map< G4double, MapCounter > GetCounterMap() const
void SetEndTime(const G4double &)
std::map< G4double, MapCounter > fCounterMap
std::unique_ptr< G4DNAEventSet > fpEventSet
G4double GetTimeStep() const
G4double GetEndTime() const
~G4DNAEventScheduler() override
std::set< G4double > fTimeToRecord
G4DNAMesh * GetMesh() const
G4double GetStartTime() const
void SetStartTime(G4double time)
void ClearAndReChargeCounter()
std::map< MolType, G4int > MapCounter
void AddTimeToRecord(const G4double &time)
std::set< G4double >::iterator fLastRecoredTime
std::unique_ptr< G4UserMeshAction > fpUserMeshAction
static G4DNAMolecularReactionTable * Instance()
G4TrackList * GetMainList(Key)
static G4ITTrackHolder * Instance()
G4double GetDiffusionCoefficient() const
std::unique_ptr< ReactantList > RecordedMolecules
static G4MoleculeCounter * Instance()
void ResetCounter() override
int GetNMoleculesAtTime(Reactant *molecule, double time)
RecordedMolecules GetRecordedMolecules()
G4MolecularConfiguration * GetConfiguration(const G4String &, bool mustExist=true)
static G4MoleculeTable * Instance()
G4ConfigurationIterator GetConfigurationIterator()
const G4MolecularConfiguration * GetMolecularConfiguration() const
static G4Scheduler * Instance()
G4VScavengerMaterial * GetScavengerMaterial() const
static void Use(G4bool flag=true)
static G4VMoleculeCounter * Instance()
static constexpr double pi
T max(const T t1, const T t2)
brief Return the largest of the two arguments