Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /* 26 /* 27 * G4MIMolecularTracks.cc 27 * G4MIMolecularTracks.cc 28 * 28 * 29 * Created on: 17 sept. 2014 29 * Created on: 17 sept. 2014 30 * Author: kara 30 * Author: kara 31 */ 31 */ 32 32 33 #include <G4Scheduler.hh> 33 #include <G4Scheduler.hh> 34 #include <G4VScheduler.hh> 34 #include <G4VScheduler.hh> 35 #include "G4ITTrackHolder.hh" 35 #include "G4ITTrackHolder.hh" 36 #include "G4IT.hh" 36 #include "G4IT.hh" 37 #include "G4Track.hh" 37 #include "G4Track.hh" 38 #include "G4UnitsTable.hh" 38 #include "G4UnitsTable.hh" 39 #include "G4AutoLock.hh" 39 #include "G4AutoLock.hh" 40 #include "G4Threading.hh" 40 #include "G4Threading.hh" 41 41 42 using namespace std; 42 using namespace std; 43 43 44 PriorityList::PriorityList() : 44 PriorityList::PriorityList() : 45 fpMainList(nullptr), fpWaitingList(nullpt << 45 G4TrackList::Watcher(), fpMainList(0), fpWaitingList(0) 46 { 46 { 47 } 47 } 48 48 49 PriorityList::PriorityList(G4TrackManyList& al 49 PriorityList::PriorityList(G4TrackManyList& allMainList): 50 fpMainList(nullptr), fpWaitingList(nullpt << 50 G4TrackList::Watcher(), fpMainList(0), fpWaitingList(0) 51 { 51 { 52 NewMainList(allMainList); 52 NewMainList(allMainList); 53 } 53 } 54 54 55 PriorityList::PriorityList(const PriorityList& 55 PriorityList::PriorityList(const PriorityList& right) : 56 << 56 G4TrackList::Watcher(), 57 fpMainList(right.fpMainList), 57 fpMainList(right.fpMainList), 58 fpWaitingList(right.fpWaitingList) 58 fpWaitingList(right.fpWaitingList) 59 { 59 { 60 } 60 } 61 61 62 PriorityList::~PriorityList() 62 PriorityList::~PriorityList() 63 { 63 { 64 if (fpMainList != nullptr) << 64 if (fpMainList) 65 { 65 { 66 delete fpMainList; 66 delete fpMainList; 67 fpMainList = nullptr; << 67 fpMainList = 0; 68 } 68 } 69 if (fpWaitingList != nullptr) << 69 if (fpWaitingList) 70 { 70 { 71 delete fpWaitingList; 71 delete fpWaitingList; 72 fpWaitingList = nullptr; << 72 fpWaitingList = 0; 73 } 73 } 74 } 74 } 75 75 76 void PriorityList::NotifyDeletingList(G4TrackL 76 void PriorityList::NotifyDeletingList(G4TrackList* __list) 77 { 77 { 78 if (__list == fpMainList) 78 if (__list == fpMainList) 79 { 79 { 80 // StopWatching(fpMainList); 80 // StopWatching(fpMainList); 81 fpMainList = nullptr; << 81 fpMainList = 0; 82 } 82 } 83 else if (__list == fpWaitingList) 83 else if (__list == fpWaitingList) 84 { 84 { 85 // StopWatching(fpWaitingList); 85 // StopWatching(fpWaitingList); 86 fpWaitingList = nullptr; << 86 fpWaitingList = 0; 87 } 87 } 88 } 88 } 89 89 90 void PriorityList::NewMainList(G4TrackList* __ 90 void PriorityList::NewMainList(G4TrackList* __list, 91 G4TrackManyList 91 G4TrackManyList& allMainList) 92 { 92 { 93 fpMainList = __list; 93 fpMainList = __list; 94 allMainList.Add(__list); 94 allMainList.Add(__list); 95 Watch(fpMainList); 95 Watch(fpMainList); 96 } 96 } 97 97 98 G4TrackList* PriorityList::NewMainList(G4Track 98 G4TrackList* PriorityList::NewMainList(G4TrackManyList& allMainList) 99 { 99 { 100 auto trackList = new G4TrackList(); << 100 G4TrackList* trackList = new G4TrackList(); 101 NewMainList(trackList, allMainList); 101 NewMainList(trackList, allMainList); 102 return fpMainList; 102 return fpMainList; 103 } 103 } 104 104 105 void PriorityList::PushToMainList(G4Track* __t 105 void PriorityList::PushToMainList(G4Track* __track, 106 G4TrackManyL 106 G4TrackManyList& allMainList) 107 { 107 { 108 if (fpMainList == nullptr) << 108 if (fpMainList == 0) 109 { 109 { 110 NewMainList(allMainList); 110 NewMainList(allMainList); 111 } 111 } 112 fpMainList->push_back(__track); 112 fpMainList->push_back(__track); 113 } 113 } 114 114 115 void PriorityList::TransferToMainList(G4TrackL 115 void PriorityList::TransferToMainList(G4TrackList*& __list, 116 G4TrackM 116 G4TrackManyList& allMainList) 117 { 117 { 118 if (fpMainList != nullptr) << 118 if (fpMainList) 119 { 119 { 120 __list->transferTo(fpMainList); 120 __list->transferTo(fpMainList); 121 delete __list; 121 delete __list; 122 __list = nullptr; << 122 __list = 0; 123 } 123 } 124 else 124 else 125 { 125 { 126 NewMainList(__list, allMainList); 126 NewMainList(__list, allMainList); 127 } 127 } 128 } 128 } 129 129 130 void PriorityList::PushToListOfSecondaries(G4T 130 void PriorityList::PushToListOfSecondaries(G4Track* __track, 131 G4T 131 G4TrackManyList& listOfAllSecondaries) 132 { 132 { 133 // if (priorityList->fSecondaries.empty 133 // if (priorityList->fSecondaries.empty()) 134 if (fSecondaries.GetListNode() != nullptr) << 134 if (fSecondaries.GetListNode()) 135 { 135 { 136 listOfAllSecondaries.Add(&fSecondaries); 136 listOfAllSecondaries.Add(&fSecondaries); 137 } 137 } 138 fSecondaries.push_back(__track); 138 fSecondaries.push_back(__track); 139 } 139 } 140 140 141 void PriorityList::PushToWaitingList(G4Track* 141 void PriorityList::PushToWaitingList(G4Track* __track) 142 { 142 { 143 if (fpWaitingList == nullptr) << 143 if (fpWaitingList == 0) 144 { 144 { 145 fpWaitingList = new G4TrackList(); 145 fpWaitingList = new G4TrackList(); 146 } 146 } 147 fpWaitingList->push_back(__track); 147 fpWaitingList->push_back(__track); 148 } 148 } 149 149 150 void PriorityList::TransferSecondariesToMainLi 150 void PriorityList::TransferSecondariesToMainList() 151 { 151 { 152 fSecondaries.transferTo(fpMainList); 152 fSecondaries.transferTo(fpMainList); 153 } 153 } 154 154 155 void PriorityList::PushToMainList(G4Track* tra 155 void PriorityList::PushToMainList(G4Track* track) 156 { 156 { 157 if (fpMainList == nullptr) fpMainList = new << 157 if (fpMainList == 0) fpMainList = new G4TrackList(); 158 fpMainList->push_back(track); 158 fpMainList->push_back(track); 159 } 159 } 160 160 161 void PriorityList::MergeWithMainList(G4TrackLi 161 void PriorityList::MergeWithMainList(G4TrackList* trackList) 162 { 162 { 163 if (fpMainList == nullptr) fpMainList = new << 163 if (fpMainList == 0) fpMainList = new G4TrackList(); 164 trackList->transferTo(trackList); 164 trackList->transferTo(trackList); 165 } 165 } 166 166 167 int PriorityList::GetNTracks() 167 int PriorityList::GetNTracks() 168 { 168 { 169 int nTracks = 0; 169 int nTracks = 0; 170 170 171 if (fpMainList != nullptr) << 171 if (fpMainList) 172 { 172 { 173 nTracks += fpMainList->size(); 173 nTracks += fpMainList->size(); 174 } 174 } 175 175 176 if (fpWaitingList != nullptr) << 176 if (fpWaitingList) 177 { 177 { 178 nTracks += fpWaitingList->size(); 178 nTracks += fpWaitingList->size(); 179 } 179 } 180 180 181 nTracks += fSecondaries.size(); 181 nTracks += fSecondaries.size(); 182 182 183 return nTracks; 183 return nTracks; 184 } 184 } 185 185 186 //============================================ 186 //============================================================================= 187 // G4ITTrackHolder 187 // G4ITTrackHolder 188 //============================================ 188 //============================================================================= 189 189 190 G4ThreadLocal G4ITTrackHolder* G4ITTrackHolder << 190 G4ThreadLocal G4ITTrackHolder* G4ITTrackHolder::fgInstance(0); 191 G4ITTrackHolder* G4ITTrackHolder::fgMasterInst << 191 G4ITTrackHolder* G4ITTrackHolder::fgMasterInstance(0); 192 192 193 G4Mutex creationOfTheMasterInstance; 193 G4Mutex creationOfTheMasterInstance; 194 G4Mutex pushToTheMasterInstance; 194 G4Mutex pushToTheMasterInstance; 195 195 196 G4ITTrackHolder* G4ITTrackHolder::Instance() 196 G4ITTrackHolder* G4ITTrackHolder::Instance() 197 { 197 { 198 if (fgInstance == nullptr) << 198 if (fgInstance == 0) 199 { 199 { 200 fgInstance = new G4ITTrackHolder(); 200 fgInstance = new G4ITTrackHolder(); 201 if(G4Threading::IsMasterThread() || 201 if(G4Threading::IsMasterThread() || 202 !G4Threading::IsMultithreadedApplicatio << 202 G4Threading::IsMultithreadedApplication() == false 203 ) 203 ) 204 { 204 { 205 fgMasterInstance = fgInstance; 205 fgMasterInstance = fgInstance; 206 } 206 } 207 207 208 } 208 } 209 return fgInstance; 209 return fgInstance; 210 } 210 } 211 211 212 G4ITTrackHolder* G4ITTrackHolder::MasterInstan 212 G4ITTrackHolder* G4ITTrackHolder::MasterInstance() 213 { 213 { 214 G4AutoLock lock(&creationOfTheMasterInstance 214 G4AutoLock lock(&creationOfTheMasterInstance); 215 if (fgMasterInstance == nullptr) << 215 if (fgMasterInstance == 0) 216 { 216 { 217 fgMasterInstance = new G4ITTrackHolder(); 217 fgMasterInstance = new G4ITTrackHolder(); 218 } 218 } 219 lock.unlock(); 219 lock.unlock(); 220 return fgMasterInstance; 220 return fgMasterInstance; 221 } 221 } 222 222 223 G4ITTrackHolder::G4ITTrackHolder() << 223 G4ITTrackHolder::G4ITTrackHolder() : >> 224 G4VITTrackHolder() 224 { 225 { 225 fNbTracks = -1; 226 fNbTracks = -1; 226 fMainListHaveBeenSet = false; 227 fMainListHaveBeenSet = false; 227 fVerbose = 0; 228 fVerbose = 0; 228 229 229 fPostActivityGlobalTime = -1; 230 fPostActivityGlobalTime = -1; 230 // fPreActivityGlobalTime = -1; 231 // fPreActivityGlobalTime = -1; 231 } 232 } 232 233 233 G4ITTrackHolder::~G4ITTrackHolder() 234 G4ITTrackHolder::~G4ITTrackHolder() 234 { 235 { 235 auto end = fLists.end(); << 236 std::map<Key, PriorityList*>::iterator end = fLists.end(); 236 237 237 for (auto it = fLists.begin(); it != end; << 238 for (std::map<Key, PriorityList*>::iterator it = fLists.begin(); it != end; 238 it++) 239 it++) 239 { 240 { 240 delete it->second; 241 delete it->second; 241 it->second = 0; 242 it->second = 0; 242 } 243 } 243 244 244 if (!fDelayedList.empty()) 245 if (!fDelayedList.empty()) 245 { 246 { 246 auto fDelayedList_i = fDelayedList.begin() << 247 MapOfDelayedLists::iterator fDelayedList_i = fDelayedList.begin(); 247 auto fDelayedList_end = fDelayedList.end() << 248 MapOfDelayedLists::iterator fDelayedList_end = fDelayedList.end(); 248 249 249 for (; fDelayedList_i != fDelayedList_end; 250 for (; fDelayedList_i != fDelayedList_end; fDelayedList_i++) 250 { 251 { 251 auto it = fDelayedList_i->second.begin() << 252 std::map<Key, G4TrackList*>::iterator it = fDelayedList_i->second.begin(); 252 auto __end = << 253 std::map<Key, G4TrackList*>::iterator __end = 253 fDelayedList_i->second.end(); 254 fDelayedList_i->second.end(); 254 255 255 for (; it != __end; it++) 256 for (; it != __end; it++) 256 { 257 { 257 delete (it->second); << 258 if (it->second) delete (it->second); 258 it->second = 0; 259 it->second = 0; 259 } 260 } 260 } 261 } 261 fDelayedList.clear(); 262 fDelayedList.clear(); 262 } 263 } 263 264 264 fAllMainList.RemoveLists(); 265 fAllMainList.RemoveLists(); 265 fAllSecondariesList.RemoveLists(); 266 fAllSecondariesList.RemoveLists(); 266 fNbTracks = -1; 267 fNbTracks = -1; 267 } 268 } 268 269 269 /* 270 /* 270 void G4MIMolecularTracks::Decide() 271 void G4MIMolecularTracks::Decide() 271 { 272 { 272 cout << "G4MIMolecularTracks::Decide" << endl 273 cout << "G4MIMolecularTracks::Decide" << endl; 273 274 274 if (fDelayedList.empty()) 275 if (fDelayedList.empty()) 275 { 276 { 276 cout << "fDelayedList.empty()" << endl; 277 cout << "fDelayedList.empty()" << endl; 277 return; 278 return; 278 } 279 } 279 fPostActivityGlobalTime = GetNextTime(); 280 fPostActivityGlobalTime = GetNextTime(); 280 // PushActivity(workspace->GetScheduler(), t 281 // PushActivity(workspace->GetScheduler(), this); 281 } 282 } 282 */ 283 */ 283 284 284 /* 285 /* 285 * param time = time of the merged list 286 * param time = time of the merged list 286 * returned = was there actually merged data ? 287 * returned = was there actually merged data ? 287 */ 288 */ 288 bool G4ITTrackHolder::MergeNextTimeToMainList( 289 bool G4ITTrackHolder::MergeNextTimeToMainList(double& time) 289 { 290 { 290 // G4cout << "G4ITTrackHolder::MergeNextTimeT 291 // G4cout << "G4ITTrackHolder::MergeNextTimeToMainList" << G4endl; 291 if (fDelayedList.empty()) 292 if (fDelayedList.empty()) 292 { 293 { 293 return false; 294 return false; 294 } 295 } 295 296 296 // G4cout << "fDelayedList.size = " << fDelay 297 // G4cout << "fDelayedList.size = " << fDelayedList.size() <<G4endl; 297 298 298 auto it = << 299 std::map<Key, G4TrackList*>::iterator it = 299 fDelayedList.begin()->second.begin(); 300 fDelayedList.begin()->second.begin(); 300 auto end = << 301 std::map<Key, G4TrackList*>::iterator end = 301 fDelayedList.begin()->second.end(); 302 fDelayedList.begin()->second.end(); 302 if (it == end) return false; 303 if (it == end) return false; 303 304 304 bool output = false; 305 bool output = false; 305 for (; it != end; it++) 306 for (; it != end; it++) 306 { 307 { 307 PriorityList* right_listUnion(nullptr); << 308 PriorityList* right_listUnion(0); 308 309 309 auto it_listUnion = fLists.find( << 310 std::map<Key, PriorityList*>::iterator it_listUnion = fLists.find( 310 it->first); 311 it->first); 311 if (it_listUnion == fLists.end()) 312 if (it_listUnion == fLists.end()) 312 { 313 { 313 right_listUnion = (fLists[it->first] = n 314 right_listUnion = (fLists[it->first] = new PriorityList()); 314 } 315 } 315 else 316 else 316 { 317 { 317 if (it_listUnion->second == 0) 318 if (it_listUnion->second == 0) 318 { 319 { 319 it_listUnion->second = new PriorityLis 320 it_listUnion->second = new PriorityList(); 320 } 321 } 321 right_listUnion = it_listUnion->second; 322 right_listUnion = it_listUnion->second; 322 } 323 } 323 324 324 if (it->second == 0) continue; 325 if (it->second == 0) continue; 325 326 326 /* 327 /* 327 if (right_listUnion->GetMainList() == 0) 328 if (right_listUnion->GetMainList() == 0) 328 { 329 { 329 // right_listUnion->fpMainList = new 330 // right_listUnion->fpMainList = new G4TrackList(); 330 // if(it->second) 331 // if(it->second) 331 // { 332 // { 332 right_listUnion->NewMainList(it->second, 333 right_listUnion->NewMainList(it->second, fAllMainList); 333 // } 334 // } 334 } 335 } 335 else 336 else 336 { 337 { 337 right_listUnion->TransferToMainList(it->s 338 right_listUnion->TransferToMainList(it->second); 338 delete it->second; 339 delete it->second; 339 }*/ 340 }*/ 340 341 341 right_listUnion->TransferToMainList(it->se 342 right_listUnion->TransferToMainList(it->second, fAllMainList); 342 343 343 if (!output) << 344 if (output == false) 344 { 345 { 345 if (static_cast<int>(!right_listUnion->G << 346 if (right_listUnion->GetMainList()->size()) 346 { 347 { 347 output = true; 348 output = true; 348 } 349 } 349 } 350 } 350 it->second = 0; 351 it->second = 0; 351 } 352 } 352 353 353 if (output) time = fDelayedList.begin()->fir 354 if (output) time = fDelayedList.begin()->first; 354 fDelayedList.erase(fDelayedList.begin()); 355 fDelayedList.erase(fDelayedList.begin()); 355 return output; 356 return output; 356 } 357 } 357 358 358 void G4ITTrackHolder::MergeSecondariesWithMain 359 void G4ITTrackHolder::MergeSecondariesWithMainList() 359 { 360 { 360 auto it = fLists.begin(); << 361 std::map<Key, PriorityList*>::iterator it = fLists.begin(); 361 auto end = fLists.end(); << 362 std::map<Key, PriorityList*>::iterator end = fLists.end(); 362 363 363 for (; it != end; it++) 364 for (; it != end; it++) 364 { 365 { 365 if (it->second->GetMainList() == nullptr) << 366 if (it->second->GetMainList() == 0) 366 { 367 { 367 it->second->NewMainList(fAllMainList); 368 it->second->NewMainList(fAllMainList); 368 } 369 } 369 370 370 it->second->TransferSecondariesToMainList( 371 it->second->TransferSecondariesToMainList(); 371 } 372 } 372 } 373 } 373 374 374 //____________________________________________ 375 //_________________________________________________________________________ 375 376 376 void G4ITTrackHolder::AddTrackID(G4Track* trac 377 void G4ITTrackHolder::AddTrackID(G4Track* track) 377 { 378 { 378 //if(fNbTracks == 0) fNbTracks = -1; 379 //if(fNbTracks == 0) fNbTracks = -1; 379 track->SetTrackID(fNbTracks); 380 track->SetTrackID(fNbTracks); 380 fNbTracks--; 381 fNbTracks--; 381 } 382 } 382 383 383 //____________________________________________ 384 //_________________________________________________________________________ 384 385 385 void G4ITTrackHolder::Push(G4Track* track) 386 void G4ITTrackHolder::Push(G4Track* track) 386 { 387 { 387 // if (G4VScheduler::Instance()->IsRunning()) 388 // if (G4VScheduler::Instance()->IsRunning()) 388 // { 389 // { 389 // G4ExceptionDescription exceptionDescript 390 // G4ExceptionDescription exceptionDescription; 390 // exceptionDescription 391 // exceptionDescription 391 // << "G4ITTrackHolder::PushTrack : You 392 // << "G4ITTrackHolder::PushTrack : You are trying to push tracks while the " 392 // "ITStepManager is running"; 393 // "ITStepManager is running"; 393 // G4Exception("G4ITTrackHolder::PushTrack" 394 // G4Exception("G4ITTrackHolder::PushTrack", "ITStepManager012", 394 // FatalErrorInArgument, except 395 // FatalErrorInArgument, exceptionDescription); 395 // } 396 // } 396 _PushTrack(track); 397 _PushTrack(track); 397 398 398 // G4MIConstituent::NotifyEntityAdded(track); 399 // G4MIConstituent::NotifyEntityAdded(track); 399 } 400 } 400 //____________________________________________ 401 //_________________________________________________________________________ 401 void G4ITTrackHolder::PushTo(G4Track* track, P 402 void G4ITTrackHolder::PushTo(G4Track* track, PriorityList::Type type) 402 { 403 { 403 int moleculeID = GetIT(track)->GetITSubType( 404 int moleculeID = GetIT(track)->GetITSubType(); 404 auto it = fLists.find(moleculeID); << 405 std::map<Key, PriorityList*>::iterator it = fLists.find(moleculeID); 405 406 406 PriorityList* priorityList(nullptr); << 407 PriorityList* priorityList(0); 407 408 408 if (it == fLists.end()) 409 if (it == fLists.end()) 409 { 410 { 410 priorityList = new PriorityList(fAllMainLi 411 priorityList = new PriorityList(fAllMainList); 411 fLists[moleculeID] = priorityList; 412 fLists[moleculeID] = priorityList; 412 } 413 } 413 else 414 else 414 { 415 { 415 priorityList = it->second; 416 priorityList = it->second; 416 } 417 } 417 418 418 switch (type) 419 switch (type) 419 { 420 { 420 case PriorityList::MainList: 421 case PriorityList::MainList: 421 { 422 { 422 priorityList->PushToMainList(track, fAll 423 priorityList->PushToMainList(track, fAllMainList); 423 break; 424 break; 424 } 425 } 425 case PriorityList::SecondariesList: 426 case PriorityList::SecondariesList: 426 { 427 { 427 priorityList->PushToListOfSecondaries(tr 428 priorityList->PushToListOfSecondaries(track, fAllSecondariesList); 428 break; 429 break; 429 } 430 } 430 case PriorityList::WaitingList: 431 case PriorityList::WaitingList: 431 { 432 { 432 priorityList->PushToWaitingList(track); 433 priorityList->PushToWaitingList(track); 433 return; 434 return; 434 break; 435 break; 435 } 436 } 436 437 437 default: 438 default: 438 { 439 { 439 return; 440 return; 440 break; 441 break; 441 } 442 } 442 } 443 } 443 } 444 } 444 //____________________________________________ 445 //_________________________________________________________________________ 445 446 446 void G4ITTrackHolder::_PushTrack(G4Track* trac 447 void G4ITTrackHolder::_PushTrack(G4Track* track) 447 { 448 { 448 if (track == nullptr) << 449 if (track == 0) 449 { 450 { 450 G4ExceptionDescription exceptionDescriptio 451 G4ExceptionDescription exceptionDescription; 451 exceptionDescription 452 exceptionDescription 452 << "You are trying to push a non-exist 453 << "You are trying to push a non-existing track (track pointer is null)" 453 << G4endl; 454 << G4endl; 454 455 455 G4Exception("G4ITTrackHolder::_PushTrack", 456 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager014", 456 FatalErrorInArgument, exceptio 457 FatalErrorInArgument, exceptionDescription); 457 } 458 } 458 459 459 G4double globalTime = track->GetGlobalTime() 460 G4double globalTime = track->GetGlobalTime(); 460 461 461 if (track->GetTrackID() == 0) 462 if (track->GetTrackID() == 0) 462 { 463 { 463 // Set track ID 464 // Set track ID 464 AddTrackID(track); 465 AddTrackID(track); 465 } 466 } 466 467 467 double currentGlobalTime = G4Scheduler::Inst 468 double currentGlobalTime = G4Scheduler::Instance()->GetGlobalTime(); 468 469 469 #ifdef G4VERBOSE 470 #ifdef G4VERBOSE 470 if (fVerbose != 0) << 471 if (fVerbose) 471 { 472 { 472 G4cout << G4endl; 473 G4cout << G4endl; 473 G4cout << "\t"<< ">> Pushing a track --> 474 G4cout << "\t"<< ">> Pushing a track --> "; 474 G4cout << GetIT(track)->GetName() << " (" 475 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")" 475 << " -- "; 476 << " -- "; 476 G4cout << "Global current time: " << G4Bes 477 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time") 477 << "\t"; 478 << "\t"; 478 G4cout << "Track's time: " << G4BestUnit(t 479 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time") 479 << G4endl; 480 << G4endl; 480 } 481 } 481 #endif 482 #endif 482 483 483 if (!G4Scheduler::Instance()->IsRunning()) << 484 if (G4Scheduler::Instance()->IsRunning() == false) 484 { 485 { 485 if (globalTime < currentGlobalTime) 486 if (globalTime < currentGlobalTime) 486 { 487 { 487 G4ExceptionDescription exceptionDescript 488 G4ExceptionDescription exceptionDescription; 488 exceptionDescription 489 exceptionDescription 489 << "You are trying to push a track w 490 << "You are trying to push a track with a global time" 490 << " inferior to the current simulat 491 << " inferior to the current simulation time." << G4endl<< "The time is going back : " << G4endl 491 << "The time in the step manager : " 492 << "The time in the step manager : " 492 << G4BestUnit(currentGlobalTime,"Time") 493 << G4BestUnit(currentGlobalTime,"Time") 493 << G4endl 494 << G4endl 494 << "The time of the track : " 495 << "The time of the track : " 495 << G4BestUnit(globalTime,"Time") 496 << G4BestUnit(globalTime,"Time") 496 << G4endl 497 << G4endl 497 << "(ITStepManager is not yet running)" 498 << "(ITStepManager is not yet running)" 498 << G4endl; 499 << G4endl; 499 500 500 G4Exception("G4ITTrackHolder::_PushTrack 501 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager014", 501 FatalErrorInArgument, except 502 FatalErrorInArgument, exceptionDescription); 502 } 503 } 503 504 504 // Push the track to the rigth track list 505 // Push the track to the rigth track list : 505 // If the track time is the same as the ma 506 // If the track time is the same as the main track list, 506 // it will be push to the main track list 507 // it will be push to the main track list 507 // otherwise, it will be pushed to the del 508 // otherwise, it will be pushed to the delayed track list. 508 if (!fMainListHaveBeenSet) << 509 if (fMainListHaveBeenSet == false) 509 { 510 { 510 PushDelayed(track); 511 PushDelayed(track); 511 } 512 } 512 else 513 else 513 { 514 { 514 if (globalTime == currentGlobalTime) 515 if (globalTime == currentGlobalTime) 515 { 516 { 516 #ifdef G4VERBOSE 517 #ifdef G4VERBOSE 517 if (fVerbose != 0) << 518 if (fVerbose) 518 { 519 { 519 G4cout << G4endl; 520 G4cout << G4endl; 520 G4cout << "\t"<< ">> Pushing to *m 521 G4cout << "\t"<< ">> Pushing to *main* list --> "; 521 G4cout << GetIT(track)->GetName() 522 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")" 522 << " -- "; 523 << " -- "; 523 G4cout << "Global current time: " 524 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time") 524 << "\t"; 525 << "\t"; 525 G4cout << "Track's time: " << G4Be 526 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time") 526 << G4endl; 527 << G4endl; 527 } 528 } 528 #endif 529 #endif 529 PushTo(track, PriorityList::MainList); 530 PushTo(track, PriorityList::MainList); 530 } 531 } 531 else 532 else 532 { 533 { 533 // if(currentGlobalTime > 1*CLHEP::pic 534 // if(currentGlobalTime > 1*CLHEP::picosecond) abort(); 534 #ifdef G4VERBOSE 535 #ifdef G4VERBOSE 535 if (fVerbose != 0) << 536 if (fVerbose) 536 { 537 { 537 G4cout << G4endl; 538 G4cout << G4endl; 538 G4cout << "\t"<< ">> Pushing to *d 539 G4cout << "\t"<< ">> Pushing to *delayed* list --> "; 539 G4cout << GetIT(track)->GetName() 540 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")" 540 << " -- "; 541 << " -- "; 541 G4cout << "Global current time: " 542 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time") 542 << "\t"; 543 << "\t"; 543 G4cout << "Track's time: " << G4Be 544 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time") 544 << G4endl; 545 << G4endl; 545 } 546 } 546 #endif 547 #endif 547 PushDelayed(track); 548 PushDelayed(track); 548 } 549 } 549 } 550 } 550 } 551 } 551 else // Is running 552 else // Is running 552 { 553 { 553 double timeDifference = globalTime - curre 554 double timeDifference = globalTime - currentGlobalTime; 554 double timeTolerance = G4Scheduler::Instan 555 double timeTolerance = G4Scheduler::Instance()->GetTimeTolerance(); 555 556 556 if (timeDifference < -1 * timeTolerance) 557 if (timeDifference < -1 * timeTolerance) 557 { 558 { 558 G4ExceptionDescription exceptionDescript 559 G4ExceptionDescription exceptionDescription; 559 exceptionDescription 560 exceptionDescription 560 << "You are trying to push a track w 561 << "You are trying to push a track with a global time" 561 << " inferior to the current simulat 562 << " inferior to the current simulation time." << G4endl<< "The time is going back : " 562 << G4endl 563 << G4endl 563 << "The time in the step manager : " 564 << "The time in the step manager : " 564 << G4BestUnit(timeDifference,"Time") 565 << G4BestUnit(timeDifference,"Time") 565 << G4endl 566 << G4endl 566 << "The time of the track : " << G4BestU 567 << "The time of the track : " << G4BestUnit(globalTime,"Time") 567 << G4endl 568 << G4endl 568 << "(ITStepManager is running)" 569 << "(ITStepManager is running)" 569 << G4endl; 570 << G4endl; 570 571 571 G4Exception("G4ITTrackHolder::_PushTrack 572 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager015", 572 FatalErrorInArgument, except 573 FatalErrorInArgument, exceptionDescription); 573 } 574 } 574 575 575 // Push the track to the rigth track list 576 // Push the track to the rigth track list : 576 // If the track time is the same as the ma 577 // If the track time is the same as the main track list, 577 // it will be push to the secondary list 578 // it will be push to the secondary list 578 // otherwise, it will be pushed to the del 579 // otherwise, it will be pushed to the delayed track list. 579 if (fabs(timeDifference) < timeTolerance) 580 if (fabs(timeDifference) < timeTolerance) 580 { 581 { 581 // G4cout << "Is pushing " << GetIT(track 582 // G4cout << "Is pushing " << GetIT(track)->GetName() << G4endl; 582 583 583 #ifdef G4VERBOSE 584 #ifdef G4VERBOSE 584 if (fVerbose != 0) << 585 if (fVerbose) 585 { 586 { 586 G4cout << G4endl; 587 G4cout << G4endl; 587 G4cout << "\t"<< ">> Pushing to *sec 588 G4cout << "\t"<< ">> Pushing to *secondary* list --> "; 588 G4cout << GetIT(track)->GetName() << 589 G4cout << GetIT(track)->GetName() << " (" << track->GetTrackID() <<")" 589 << " -- "; 590 << " -- "; 590 G4cout << "Global current time: " << 591 G4cout << "Global current time: " << G4BestUnit(currentGlobalTime,"Time") 591 << "\t"; 592 << "\t"; 592 G4cout << "Track's time: " << G4Best 593 G4cout << "Track's time: " << G4BestUnit(track->GetGlobalTime(),"Time") 593 << G4endl; 594 << G4endl; 594 } 595 } 595 #endif 596 #endif 596 PushTo(track, PriorityList::SecondariesL 597 PushTo(track, PriorityList::SecondariesList); 597 } 598 } 598 else // globalTime < fGlobalTime already t 599 else // globalTime < fGlobalTime already taken into account above 599 { 600 { 600 G4ExceptionDescription exceptionDescript 601 G4ExceptionDescription exceptionDescription; 601 exceptionDescription 602 exceptionDescription 602 << "While running you cannot push a 603 << "While running you cannot push a track" 603 << " with a bigger global time than 604 << " with a bigger global time than the current global time" << G4endl<< "The time in the step manager : " 604 << G4BestUnit(currentGlobalTime,"Time") 605 << G4BestUnit(currentGlobalTime,"Time") 605 << G4endl 606 << G4endl 606 << "The time of the track : " << G4BestU 607 << "The time of the track : " << G4BestUnit(globalTime,"Time") 607 << G4endl 608 << G4endl 608 << "(ITStepManager is running)" 609 << "(ITStepManager is running)" 609 << G4endl; 610 << G4endl; 610 611 611 G4Exception("G4ITTrackHolder::_PushTrack 612 G4Exception("G4ITTrackHolder::_PushTrack", "ITStepManager016", 612 FatalErrorInArgument, except 613 FatalErrorInArgument, exceptionDescription); 613 // PushDelayed(track, globalTime); 614 // PushDelayed(track, globalTime); 614 } 615 } 615 } 616 } 616 } 617 } 617 618 618 //____________________________________________ 619 //_________________________________________________________________________ 619 620 620 void G4ITTrackHolder::PushDelayed(G4Track* tra 621 void G4ITTrackHolder::PushDelayed(G4Track* track) 621 { 622 { 622 #ifdef G4VERBOSE 623 #ifdef G4VERBOSE 623 if (fVerbose != 0) << 624 if (fVerbose) 624 { 625 { 625 G4cout << "\t" << ">> Pushing a delayed tr 626 G4cout << "\t" << ">> Pushing a delayed track" << G4endl; 626 } 627 } 627 #endif 628 #endif 628 629 629 int moleculeID = GetIT(track)->GetITSubType( 630 int moleculeID = GetIT(track)->GetITSubType(); 630 // std::map<int, PriorityList>::iterator it 631 // std::map<int, PriorityList>::iterator it = fLists.find(moleculeID); 631 632 632 G4double globalTime = track->GetGlobalTime() 633 G4double globalTime = track->GetGlobalTime(); 633 634 634 auto it_delayed = << 635 std::map<double, std::map<Key, G4TrackList*> >::iterator it_delayed = 635 fDelayedList.find(globalTime); 636 fDelayedList.find(globalTime); 636 637 637 if (it_delayed == fDelayedList.end()) 638 if (it_delayed == fDelayedList.end()) 638 { 639 { 639 (fDelayedList[globalTime][moleculeID] = ne 640 (fDelayedList[globalTime][moleculeID] = new G4TrackList())->push_back( 640 track); 641 track); 641 } 642 } 642 else 643 else 643 { 644 { 644 auto it_trackList = << 645 std::map<Key, G4TrackList*>::iterator it_trackList = 645 it_delayed->second.find(moleculeID); 646 it_delayed->second.find(moleculeID); 646 647 647 if (it_trackList == it_delayed->second.end 648 if (it_trackList == it_delayed->second.end()) 648 { 649 { 649 (it_delayed->second[moleculeID] = new G4 650 (it_delayed->second[moleculeID] = new G4TrackList())->push_back(track); 650 } 651 } 651 else 652 else 652 { 653 { 653 if (it_trackList->second != 0) 654 if (it_trackList->second != 0) 654 { 655 { 655 it_trackList->second->push_back(track) 656 it_trackList->second->push_back(track); 656 } 657 } 657 } 658 } 658 } 659 } 659 660 660 // fDelayedList[globalTime][moleculeID] 661 // fDelayedList[globalTime][moleculeID] 661 662 662 /* 663 /* 663 std::map<double,std::map<int, G4TrackList* 664 std::map<double,std::map<int, G4TrackList* > >::iterator it_delayed = 664 fDelayedList.begin(); 665 fDelayedList.begin(); 665 666 666 std::map<double,std::map<int, G4TrackList* 667 std::map<double,std::map<int, G4TrackList* > >::iterator end_delayed = 667 fDelayedList.end(); 668 fDelayedList.end(); 668 669 669 for(it_delayed != end_delayed ; it_delayed+ 670 for(it_delayed != end_delayed ; it_delayed++) 670 { 671 { 671 std::map<int, G4TrackList*> & trackListMap 672 std::map<int, G4TrackList*> & trackListMap = it->second; 672 673 673 674 674 } 675 } 675 */ 676 */ 676 /* 677 /* 677 std::map<double,G4TrackList* > :: iterator 678 std::map<double,G4TrackList* > :: iterator 678 fDelayedList_i = fDelayedList.find(globalTi 679 fDelayedList_i = fDelayedList.find(globalTime) ; 679 680 680 if(fDelayedList_i == fDelayedList.end()) 681 if(fDelayedList_i == fDelayedList.end()) 681 { 682 { 682 683 683 G4TrackList* newList = new G4TrackList ; 684 G4TrackList* newList = new G4TrackList ; 684 newList -> push_back(track); 685 newList -> push_back(track); 685 fDelayedList[globalTime] = newList ; 686 fDelayedList[globalTime] = newList ; 686 } 687 } 687 else 688 else 688 { 689 { 689 fDelayedList_i->second-> push_back(track); 690 fDelayedList_i->second-> push_back(track); 690 } 691 } 691 */ 692 */ 692 } 693 } 693 //____________________________________________ 694 //______________________________________________________________________________ 694 695 695 void G4ITTrackHolder::KillTracks() 696 void G4ITTrackHolder::KillTracks() 696 { 697 { 697 if (fToBeKilledList.empty()) return; << 698 if (fToBeKilledList.size() == 0) return; 698 #ifdef G4VERBOSE 699 #ifdef G4VERBOSE 699 if (fVerbose > 1) 700 if (fVerbose > 1) 700 { 701 { 701 G4cout << "*** G4ITTrackHolder::KillTracks 702 G4cout << "*** G4ITTrackHolder::KillTracks , step #" 702 << G4VScheduler::Instance()->GetNbS 703 << G4VScheduler::Instance()->GetNbSteps() 703 << " ***" << G4endl; 704 << " ***" << G4endl; 704 G4cout << "Nb of tracks to kill "<< fToBeK 705 G4cout << "Nb of tracks to kill "<< fToBeKilledList.size() << G4endl; 705 G4cout << setw(25) << left << "#Name" 706 G4cout << setw(25) << left << "#Name" 706 << setw(25) << "track ID"<< G4endl; 707 << setw(25) << "track ID"<< G4endl; 707 708 708 G4TrackList::iterator it = fToBeKilledList 709 G4TrackList::iterator it = fToBeKilledList.begin(); 709 for(; it != fToBeKilledList.end();) 710 for(; it != fToBeKilledList.end();) 710 { 711 { 711 G4Track* toBeErased = *it; 712 G4Track* toBeErased = *it; 712 713 713 G4cout << setw(25) << GetIT(toBeErased)- 714 G4cout << setw(25) << GetIT(toBeErased)->GetName() 714 << setw(25) << toBeErased->GetTrackID() 715 << setw(25) << toBeErased->GetTrackID() 715 << G4endl; 716 << G4endl; 716 717 717 it = fToBeKilledList.erase(toBeErased); 718 it = fToBeKilledList.erase(toBeErased); 718 } 719 } 719 } 720 } 720 else 721 else 721 #endif 722 #endif 722 fToBeKilledList.erase(fToBeKilledList.begin( 723 fToBeKilledList.erase(fToBeKilledList.begin(), fToBeKilledList.end()); 723 } 724 } 724 725 725 void G4ITTrackHolder::Clear() 726 void G4ITTrackHolder::Clear() 726 { 727 { 727 fAllMainList.ClearLists(); 728 fAllMainList.ClearLists(); 728 fAllSecondariesList.ClearLists(); 729 fAllSecondariesList.ClearLists(); 729 // fAllMainList.RemoveLists(); 730 // fAllMainList.RemoveLists(); 730 // fAllSecondariesList.RemoveLists(); 731 // fAllSecondariesList.RemoveLists(); 731 732 732 auto it = fLists.begin(); << 733 std::map<Key, PriorityList*>::iterator it = fLists.begin(); 733 734 734 for (; it != fLists.end(); it++) 735 for (; it != fLists.end(); it++) 735 { 736 { 736 delete it->second; << 737 if (it->second) delete it->second; 737 it->second = 0; 738 it->second = 0; 738 } 739 } 739 fLists.clear(); 740 fLists.clear(); 740 741 741 auto it1 = fDelayedList.begin(); << 742 MapOfDelayedLists::iterator it1 = fDelayedList.begin(); 742 743 743 for (; it1 != fDelayedList.end(); it1++) 744 for (; it1 != fDelayedList.end(); it1++) 744 { 745 { 745 auto it2 = it1->second.begin(); << 746 std::map<Key, G4TrackList*>::iterator it2 = it1->second.begin(); 746 747 747 for (; it2 != it1->second.end(); it2++) 748 for (; it2 != it1->second.end(); it2++) 748 { 749 { 749 delete it2->second; << 750 if (it2->second) delete it2->second; 750 it2->second = 0; 751 it2->second = 0; 751 } 752 } 752 } 753 } 753 754 754 fDelayedList.clear(); 755 fDelayedList.clear(); 755 756 756 // fAllMainList.ClearLists(); 757 // fAllMainList.ClearLists(); 757 // fAllSecondariesList.ClearLists(); 758 // fAllSecondariesList.ClearLists(); 758 fAllMainList.RemoveLists(); 759 fAllMainList.RemoveLists(); 759 fAllSecondariesList.RemoveLists(); 760 fAllSecondariesList.RemoveLists(); 760 KillTracks(); 761 KillTracks(); 761 762 762 fNbTracks = -1; 763 fNbTracks = -1; 763 } 764 } 764 765 765 PriorityList* G4ITTrackHolder::GetPriorityList 766 PriorityList* G4ITTrackHolder::GetPriorityList(Key i) 766 { 767 { 767 auto it = fLists.find(i); << 768 std::map<Key, PriorityList*>::iterator it = fLists.find(i); 768 if (it == fLists.end()) return nullptr; << 769 if (it == fLists.end()) return 0; 769 return it->second; 770 return it->second; 770 } 771 } 771 772 772 G4TrackList* G4ITTrackHolder::GetMainList(G4in 773 G4TrackList* G4ITTrackHolder::GetMainList(G4int i) 773 { 774 { 774 PriorityList* priorityList = GetPriorityList 775 PriorityList* priorityList = GetPriorityList(i); 775 if (priorityList != nullptr) << 776 if (priorityList) 776 { 777 { 777 return priorityList->GetMainList(); 778 return priorityList->GetMainList(); 778 } 779 } 779 return nullptr; << 780 return 0; 780 } 781 } 781 782 782 bool G4ITTrackHolder::AddWatcher(Key id, 783 bool G4ITTrackHolder::AddWatcher(Key id, 783 G4TrackList:: 784 G4TrackList::Watcher* watcher, 784 PriorityList: 785 PriorityList::Type type) 785 { 786 { 786 auto it = fLists.find(id); << 787 std::map<Key, PriorityList*>::iterator it = fLists.find(id); 787 if (it == fLists.end()) return false; 788 if (it == fLists.end()) return false; 788 789 789 G4TrackList* trackList = it->second->Get(typ 790 G4TrackList* trackList = it->second->Get(type); 790 if (trackList == nullptr) return false; << 791 if (trackList == 0) return false; 791 trackList->AddWatcher(watcher); 792 trackList->AddWatcher(watcher); 792 return true; 793 return true; 793 } 794 } 794 795 795 void G4ITTrackHolder::AddWatcherForMainList(G4 796 void G4ITTrackHolder::AddWatcherForMainList(G4TrackList::Watcher* watcher) 796 { 797 { 797 fAllMainList.AddGlobalWatcher(watcher); 798 fAllMainList.AddGlobalWatcher(watcher); 798 } 799 } 799 800 800 void G4ITTrackHolder::AddWatcherForKillList(G4 801 void G4ITTrackHolder::AddWatcherForKillList(G4TrackList::Watcher* watcher) 801 { 802 { 802 watcher->Watch(&fToBeKilledList); 803 watcher->Watch(&fToBeKilledList); 803 } 804 } 804 805 805 void G4ITTrackHolder::PushToMaster(G4Track* tr 806 void G4ITTrackHolder::PushToMaster(G4Track* track) 806 { 807 { 807 G4ITTrackHolder* trackHolder = MasterInstanc 808 G4ITTrackHolder* trackHolder = MasterInstance(); 808 809 809 G4AutoLock lock(&pushToTheMasterInstance); 810 G4AutoLock lock(&pushToTheMasterInstance); 810 trackHolder->PushDelayed(track); 811 trackHolder->PushDelayed(track); 811 lock.unlock(); 812 lock.unlock(); 812 } 813 } 813 814 814 size_t G4ITTrackHolder::GetNTracks() 815 size_t G4ITTrackHolder::GetNTracks() 815 { 816 { 816 size_t nTracks(0); 817 size_t nTracks(0); 817 nTracks += fAllMainList.size(); 818 nTracks += fAllMainList.size(); 818 nTracks += fAllSecondariesList.size(); 819 nTracks += fAllSecondariesList.size(); 819 820 820 // G4cout << "nTracks = " << nTracks << G 821 // G4cout << "nTracks = " << nTracks << G4endl; 821 822 822 auto delayedmap_it = fDelayedList.begin(); << 823 MapOfDelayedLists::iterator delayedmap_it = fDelayedList.begin(); 823 auto delayedmap_end = fDelayedList.end(); << 824 MapOfDelayedLists::iterator delayedmap_end = fDelayedList.end(); 824 825 825 for (; delayedmap_it != delayedmap_end; dela 826 for (; delayedmap_it != delayedmap_end; delayedmap_it++) 826 { 827 { 827 auto it = delayedmap_it->second.begin(); << 828 std::map<Key, G4TrackList*>::iterator it = delayedmap_it->second.begin(); 828 auto end = delayedmap_it->second.end(); << 829 std::map<Key, G4TrackList*>::iterator end = delayedmap_it->second.end(); 829 830 830 for (; it != end; it++) 831 for (; it != end; it++) 831 { 832 { 832 if (it->second != nullptr) nTracks += it << 833 if (it->second) nTracks += it->second->size(); 833 } 834 } 834 } 835 } 835 836 836 // G4cout << "nTracks = " << nTracks << G 837 // G4cout << "nTracks = " << nTracks << G4endl; 837 838 838 return nTracks; 839 return nTracks; 839 } 840 } 840 841 841 void G4ITTrackHolder::MoveMainToWaitingList() 842 void G4ITTrackHolder::MoveMainToWaitingList() 842 { 843 { 843 auto it = fLists.begin(); << 844 MapOfPriorityLists::iterator it = fLists.begin(); 844 auto end = fLists.end(); << 845 MapOfPriorityLists::iterator end = fLists.end(); 845 for (; it != end; it++) 846 for (; it != end; it++) 846 { 847 { 847 if (PriorityList* lists = it->second) 848 if (PriorityList* lists = it->second) 848 { 849 { 849 lists->SetWaitingList(lists->GetMainList 850 lists->SetWaitingList(lists->GetMainList()); 850 //TODO 851 //TODO 851 } 852 } 852 } 853 } 853 fAllMainList.RemoveLists(); 854 fAllMainList.RemoveLists(); 854 } 855 } 855 856 856 bool G4ITTrackHolder::DelayListsNOTEmpty() 857 bool G4ITTrackHolder::DelayListsNOTEmpty() 857 { 858 { 858 auto __it = fDelayedList.begin(); << 859 MapOfDelayedLists::iterator __it = fDelayedList.begin(); 859 auto __end = fDelayedList.end(); << 860 MapOfDelayedLists::iterator __end = fDelayedList.end(); 860 for (; __it != __end; __it++) 861 for (; __it != __end; __it++) 861 { 862 { 862 std::map<Key, G4TrackList*>& mapOfLists = 863 std::map<Key, G4TrackList*>& mapOfLists = __it->second; 863 if (!mapOfLists.empty()) << 864 if (mapOfLists.empty() == false) 864 { 865 { 865 auto it = mapOfLists.begin(); << 866 std::map<Key, G4TrackList*>::iterator it = mapOfLists.begin(); 866 auto end = mapOfLists.end(); << 867 std::map<Key, G4TrackList*>::iterator end = mapOfLists.end(); 867 for (; it != end; it++) 868 for (; it != end; it++) 868 { 869 { 869 if (G4TrackList* mainList = it->second 870 if (G4TrackList* mainList = it->second) 870 { 871 { 871 if (!(mainList->empty())) return tru 872 if (!(mainList->empty())) return true; 872 } 873 } 873 } 874 } 874 } 875 } 875 } 876 } 876 return false; 877 return false; 877 } 878 } 878 879 879 bool G4ITTrackHolder::CheckMapIsNOTEmpty(MapOf 880 bool G4ITTrackHolder::CheckMapIsNOTEmpty(MapOfPriorityLists& mapOfLists, 880 Prior 881 PriorityList::Type type) 881 { 882 { 882 auto it = mapOfLists.begin(); << 883 MapOfPriorityLists::iterator it = mapOfLists.begin(); 883 auto end = mapOfLists.end(); << 884 MapOfPriorityLists::iterator end = mapOfLists.end(); 884 for (; it != end; it++) 885 for (; it != end; it++) 885 { 886 { 886 if (PriorityList* lists = it->second) 887 if (PriorityList* lists = it->second) 887 { 888 { 888 if (G4TrackList* trackList = lists->Get( 889 if (G4TrackList* trackList = lists->Get(type)) 889 { 890 { 890 if (!(trackList->empty())) return true 891 if (!(trackList->empty())) return true; 891 } 892 } 892 } 893 } 893 } 894 } 894 return false; 895 return false; 895 } 896 } 896 897