55 if (!fHasReacted) fHasReacted =
new std::map<const G4Track*, G4bool>;
61 fCurrentModel.assign(
G4ITType::size(), std::vector<G4VITStepModel*>());
67 fUserMinTimeStep = -1.;
74 fCurrentModel.clear();
75 fReactionInfo.clear();
87 fUserMinTimeStep = -1.;
93 if (
this == &rhs)
return *
this;
100 fpModelHandler->Initialize();
109 if (fpModelHandler == 0)
113 <<
"No G4ITModelHandler was passed to the modelProcessor.";
114 G4Exception(
"G4ITModelProcessor::InitializeStepper",
"ITModelProcessor002",
117 const std::vector<std::vector<G4ITModelManager*> >* modelManager =
118 fpModelHandler->GetAllModelManager();
120 if (modelManager == 0)
124 <<
"No G4ITModelManager was register to G4ITModelHandler.";
125 G4Exception(
"G4ITModelProcessor::InitializeStepper",
"ITModelProcessor003",
129 int nbModels1 = modelManager->size();
140 for (
int i = 0; i < nbModels1; i++)
142 nbModels2 = (*modelManager)[i].size();
144 for (
int j = 0; j <= i; j++)
146 modman = (*modelManager)[i][j];
148 if (modman == 0)
continue;
150 model = modman->
GetModel(currentGlobalTime);
153 #if defined (DEBUG_MEM)
154 MemStat mem_first, mem_second, mem_diff;
157 #if defined (DEBUG_MEM)
164 #if defined (DEBUG_MEM)
166 mem_diff = mem_second-mem_first;
167 G4cout <<
"\t || MEM || G4ITModelProcessor::InitializeStepper || After computing stepper -> Prepare(), diff is : " << mem_diff <<
G4endl;
169 fCurrentModel[i][j] = model;
173 if (nbModels1 == 1 && nbModels2 == 1)
175 fpModelManager = modman;
191 exceptionDescription <<
"No track was passed to the method (track == 0).";
192 G4Exception(
"G4ITModelProcessor::CalculateStep",
"ITModelProcessor004",
196 fUserMinTimeStep = userMinTimeStep;
206 fpModel->GetTimeStepper()->CalculateStep(*fpTrack, fUserMinTimeStep);
210 std::vector<G4VITStepModel*>& model = fCurrentModel[
GetIT(fpTrack)
213 for (
int i = 0; i < (int) model.size(); i++)
215 if (model[i] == 0)
continue;
216 model[i]->GetTimeStepper()->CalculateStep(*fpTrack, fUserMinTimeStep);
224 const double currentStepTime,
225 const double previousStepTime,
226 const bool reachedUserStepTimeLimit)
231 if(reactionSet == 0)
return;
232 if (fpModelHandler->GetAllModelManager()->empty())
return;
236 std::map<G4Track*, G4ITReactionPerTrackPtr, compTrackPerID>::iterator tracks_i = reactionPerTrackMap.begin();
243 for (tracks_i = reactionPerTrackMap.begin();
244 tracks_i != reactionPerTrackMap.end() ;
245 tracks_i = reactionPerTrackMap.begin())
248 G4Track* trackA = tracks_i->first;
261 const std::vector<G4VITStepModel*> model = fCurrentModel[ITypeA];
268 assert(reactionList.begin() != reactionList.end());
270 for(G4ITReactionList::iterator it = reactionList.begin() ;
271 it != reactionList.end() ; it = reactionList.begin() )
274 trackB = reaction->GetReactant(trackA);
281 if (trackB == trackA)
285 <<
"The IT reaction process sent back a reaction between trackA and trackB. ";
286 exceptionDescription <<
"The problem is trackA == trackB";
287 G4Exception(
"G4ITModelProcessor::FindReaction",
"ITModelProcessor005",
294 if (ITypeB != ITypeBtmp)
298 if (model[ITypeB]) process = model[ITypeB]->GetReactionProcess();
306 reachedUserStepTimeLimit))
313 fReactionInfo.push_back(changes);
virtual G4bool TestReactibility(const G4Track &, const G4Track &, const double, const double, bool)=0
Similar to G4ParticleChange, but deal with two tracks rather than one.
The G4ITModelProcessor will call the two processes defined in G4VITModel.
static G4ThreadLocal std::map< const G4Track *, G4bool > * fHasReacted
std::ostringstream G4ExceptionDescription
Define what to do before stepping and after stepping.
G4TrackStatus GetTrackStatus() const
void CalculateTimeStep(const G4Track *, const G4double)
G4VITReactionProcess defines the reaction between two G4IT.
Tag the G4IT Should be automatically setup by G4IT using : ITDef(MyIT) and ITImp(MyIT) ...
G4shared_ptr< G4ITReaction > G4ITReactionPtr
std::map< G4Track *, G4ITReactionPerTrackPtr, compTrackPerID > G4ITReactionPerTrackMap
G4ITReactionPerTrackMap & GetReactionMap()
static void SetTimes(const G4double &, const G4double &)
void SelectThisReaction(G4ITReactionPtr reaction)
void FindReaction(G4ITReactionSet *reactionSet, const double currentStepTime, const double previousStepTime, const bool reachedUserStepTimeLimit)
G4IT * GetIT(const G4Track *track)
std::list< G4ITReactionPtr > G4ITReactionList
G4GLOB_DLL std::ostream G4cout
virtual ~G4ITModelProcessor()
G4VITTimeStepComputer * GetTimeStepper()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4ITModelProcessor & operator=(const G4ITModelProcessor &other)
Assignment operator.
G4shared_ptr< G4ITReactionPerTrack > G4ITReactionPerTrackPtr
virtual const G4ITType GetITType() const =0
void InitializeStepper(const G4double ¤tGlobalTime, const G4double &userMinTime)
G4VITStepModel * GetModel(const G4double globalTime)
virtual G4ITReactionChange * MakeReaction(const G4Track &, const G4Track &)=0
Before stepping all tracks G4Scheduler calls all the G4VITModel which may contain a G4VITTimeStepper ...
G4ITModelManager chooses which model to use according to the global simulation time.