MCPcopy Create free account
hub / github.com/Geant4/geant4 / DoReadEventLoop

Method DoReadEventLoop

examples/advanced/ChargeExchangeMC/src/CexmcRunManager.cc:508–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506#ifdef CEXMC_USE_PERSISTENCY
507
508void CexmcRunManager::DoReadEventLoop( G4int nEvent )
509{
510 G4int iEvent( 0 );
511 G4int iEventEffective( 0 );
512 G4int nEventCount( 0 );
513
514 if ( ! ProjectIsRead() )
515 return;
516
517 if ( ! physicsManager )
518 throw CexmcException( CexmcWeirdException );
519
520 CexmcProductionModel * productionModel(
521 physicsManager->GetProductionModel() );
522 if ( ! productionModel )
523 throw CexmcException( CexmcWeirdException );
524
525 CexmcSetup * setup( static_cast< CexmcSetup * >( userDetector ) );
526 if ( ! setup )
527 throw CexmcException( CexmcWeirdException );
528
529 CexmcEventSObject evSObject;
530 CexmcEventFastSObject evFastSObject;
531
532 /* read events data */
533 std::ifstream eventsDataFile(
534 ( projectsDir + "/" + rProject + ".edb" ).c_str() );
535 if ( ! eventsDataFile )
536 throw CexmcException( CexmcReadProjectIncomplete );
537
538 boost::archive::binary_iarchive evArchive( eventsDataFile );
539
540 std::ifstream eventsFastDataFile(
541 ( projectsDir + "/" + rProject + ".fdb" ).c_str() );
542 if ( ! eventsFastDataFile )
543 throw CexmcException( CexmcReadProjectIncomplete );
544
545 boost::archive::binary_iarchive evFastArchive( eventsFastDataFile );
546
547 G4Event event;
548 currentEvent = &event;
549 G4SDManager * sdManager( G4SDManager::GetSDMpointer() );
550 event.SetHCofThisEvent( sdManager->PrepareNewEvent() );
551 G4HCofThisEvent * hcOfThisEvent( event.GetHCofThisEvent() );
552
553 G4DigiManager * digiManager( G4DigiManager::GetDMpointer() );
554
555 G4int hcId( digiManager->GetHitsCollectionID(
556 CexmcDetectorRoleName[ CexmcMonitorDetectorRole ] +
557 "/" + CexmcDetectorTypeName[ CexmcEDDetector ] ) );
558 CexmcEnergyDepositCollection * monitorED(
559 new CexmcEnergyDepositCollection );
560 hcOfThisEvent->AddHitsCollection( hcId, monitorED );
561 hcId = digiManager->GetHitsCollectionID(
562 CexmcDetectorRoleName[ CexmcVetoCounterDetectorRole ] +
563 "/" + CexmcDetectorTypeName[ CexmcEDDetector ] );
564 CexmcEnergyDepositCollection * vetoCounterED(
565 new CexmcEnergyDepositCollection );

Callers

nothing calls this directly

Calls 15

CexmcExceptionClass · 0.85
GetProductionModelMethod · 0.80
c_strMethod · 0.80
SetHCofThisEventMethod · 0.80
GetHCofThisEventMethod · 0.80
GetHitsCollectionIDMethod · 0.80
AddHitsCollectionMethod · 0.80
EvalTPTMethod · 0.80
EvalEDTMethod · 0.80

Tested by

no test coverage detected