48 #ifdef CEXMC_USE_PERSISTENCY 49 #include <boost/archive/binary_iarchive.hpp> 50 #include <boost/archive/binary_oarchive.hpp> 100 G4String gdmlFileExtension(
".gdml" );
101 G4String gdmlbz2FileExtension(
".gdml.bz2" );
107 G4bool overrideExistingProject ) :
110 gdmlFileName(
"default.gdml" ), shouldGdmlFileBeValidated( true ),
111 zipGdmlFile( false ), projectsDir(
"." ), projectId( projectId ),
112 rProject( rProject ), guiMacroName(
"" ), cfFileName(
"" ),
114 skipInteractionsWithoutEDTonWrite( true ),
117 numberOfEventsProcessedEffective( 0 ), curEventRead( 0 ),
118 #ifdef CEXMC_USE_PERSISTENCY
119 eventsArchive( NULL ), fastEventsArchive( NULL ),
120 #ifdef CEXMC_USE_CUSTOM_FILTER
121 customFilter( NULL ),
124 physicsManager( NULL ), messenger( NULL )
127 if ( rProject !=
"" && rProject == projectId )
130 const char * projectsDirEnv( getenv(
"CEXMC_PROJECTS_DIR" ) );
132 if ( projectsDirEnv )
137 stat( (
projectsDir +
"/" + projectId +
".rdb" ).c_str(), &tmp ) == 0
138 && ! overrideExistingProject )
143 #ifdef CEXMC_USE_PERSISTENCY 152 #ifdef CEXMC_USE_CUSTOM_FILTER 159 #ifdef CEXMC_USE_PERSISTENCY 173 boost::archive::binary_iarchive archive( runDataFile );
196 gdmlbz2FileExtension;
205 void CexmcRunManager::ReadProject(
void )
214 sObject.angularRanges );
216 for ( CexmcDecayBranchesStore::const_iterator
217 k( sObject.etaDecayTable.GetDecayBranches().begin() );
218 k != sObject.etaDecayTable.GetDecayBranches().end(); ++k )
224 sObject.fermiMotionIsOn,
false );
233 sObject.calorimeterRegCuts );
236 static_cast< const CexmcPrimaryGeneratorAction * >(
239 const_cast< CexmcPrimaryGeneratorAction * >(
240 primaryGeneratorAction ) );
245 sObject.beamParticle ) );
246 if ( ! particleDefinition )
249 particleGun->SetParticleDefinition( particleDefinition );
250 particleGun->SetOrigPosition( sObject.beamPos,
false );
251 particleGun->SetOrigDirection( sObject.beamDir,
false );
252 particleGun->SetOrigMomentumAmp( sObject.beamMomentumAmp,
false );
254 thePrimaryGeneratorAction->
SetFwhmPosX( sObject.beamFwhmPosX,
false );
255 thePrimaryGeneratorAction->
SetFwhmPosY( sObject.beamFwhmPosY,
false );
256 thePrimaryGeneratorAction->
SetFwhmDirX( sObject.beamFwhmDirX,
false );
257 thePrimaryGeneratorAction->
SetFwhmDirY( sObject.beamFwhmDirY,
false );
259 sObject.beamFwhmMomentumAmp,
false );
263 static_cast< CexmcEnergyDepositDigitizer * >(
270 sObject.vetoCounterEDLeftThreshold,
false );
272 sObject.vetoCounterEDRightThreshold,
false );
274 sObject.calorimeterEDLeftThreshold,
false );
276 sObject.calorimeterEDRightThreshold,
false );
278 sObject.calorimeterTriggerAlgorithm,
false );
280 sObject.outerCrystalsVetoAlgorithm,
false );
282 sObject.outerCrystalsVetoFraction,
false );
284 sObject.applyFiniteCrystalResolution,
false );
296 if ( ! reconstructor )
299 reconstructor->SetCalorimeterEntryPointDefinitionAlgorithm(
300 sObject.epDefinitionAlgorithm );
301 reconstructor->SetCalorimeterEntryPointDepthDefinitionAlgorithm(
302 sObject.epDepthDefinitionAlgorithm );
303 reconstructor->SetCrystalSelectionAlgorithm( sObject.csAlgorithm );
304 reconstructor->UseInnerRefCrystal( sObject.useInnerRefCrystal );
305 reconstructor->SetCalorimeterEntryPointDepth( sObject.epDepth );
306 reconstructor->UseTableMass( sObject.useTableMass );
307 reconstructor->UseMassCut( sObject.useMassCut );
308 reconstructor->SetMassCutOPCenter( sObject.mCutOPCenter );
309 reconstructor->SetMassCutNOPCenter( sObject.mCutNOPCenter );
310 reconstructor->SetMassCutOPWidth( sObject.mCutOPWidth );
311 reconstructor->SetMassCutNOPWidth( sObject.mCutNOPWidth );
312 reconstructor->SetMassCutEllipseAngle( sObject.mCutAngle );
313 reconstructor->UseAbsorbedEnergyCut( sObject.useAbsorbedEnergyCut );
314 reconstructor->SetAbsorbedEnergyCutCLCenter( sObject.aeCutCLCenter );
315 reconstructor->SetAbsorbedEnergyCutCRCenter( sObject.aeCutCRCenter );
316 reconstructor->SetAbsorbedEnergyCutCLWidth( sObject.aeCutCLWidth );
317 reconstructor->SetAbsorbedEnergyCutCRWidth( sObject.aeCutCRWidth );
318 reconstructor->SetAbsorbedEnergyCutEllipseAngle( sObject.aeCutAngle );
319 reconstructor->SetExpectedMomentumAmp( sObject.expectedMomentumAmp );
320 reconstructor->SetEDCollectionAlgorithm( sObject.edCollectionAlgorithm );
329 void CexmcRunManager::SaveProject(
void )
338 CexmcSimpleDecayTableStore etaDecayTable(
341 static_cast< const CexmcPrimaryGeneratorAction * >(
344 const_cast< CexmcPrimaryGeneratorAction * >(
345 primaryGeneratorAction ) );
351 static_cast< CexmcEnergyDepositDigitizer * >(
363 std::vector< G4double > calorimeterRegCuts( 4 );
366 calorimeterRegCuts = sObject.calorimeterRegCuts;
383 G4int nmbOfFalseHitsTriggeredEDT( 0 );
384 G4int nmbOfFalseHitsTriggeredRec( 0 );
385 G4int nmbOfSavedEvents( 0 );
386 G4int nmbOfSavedFastEvents( 0 );
402 CexmcRunSObject sObjectToWrite = {
407 particleGun->GetParticleDefinition()->GetParticleName(),
408 particleGun->GetOrigPosition(), particleGun->GetOrigDirection(),
409 particleGun->GetOrigMomentumAmp(),
425 reconstructor->GetCalorimeterEntryPointDefinitionAlgorithm(),
426 reconstructor->GetCalorimeterEntryPointDepthDefinitionAlgorithm(),
427 reconstructor->GetCrystalSelectionAlgorithm(),
428 reconstructor->IsInnerRefCrystalUsed(),
429 reconstructor->GetCalorimeterEntryPointDepth(),
430 reconstructor->IsTableMassUsed(), reconstructor->IsMassCutUsed(),
431 reconstructor->GetMassCutOPCenter(),
432 reconstructor->GetMassCutNOPCenter(),
433 reconstructor->GetMassCutOPWidth(), reconstructor->GetMassCutNOPWidth(),
434 reconstructor->GetMassCutEllipseAngle(),
435 reconstructor->IsAbsorbedEnergyCutUsed(),
436 reconstructor->GetAbsorbedEnergyCutCLCenter(),
437 reconstructor->GetAbsorbedEnergyCutCRCenter(),
438 reconstructor->GetAbsorbedEnergyCutCLWidth(),
439 reconstructor->GetAbsorbedEnergyCutCRWidth(),
440 reconstructor->GetAbsorbedEnergyCutEllipseAngle(),
441 nmbOfHitsSampled, nmbOfHitsSampledFull, nmbOfHitsTriggeredRealRange,
442 nmbOfHitsTriggeredRecRange, nmbOfOrphanHits, nmbOfFalseHitsTriggeredEDT,
443 nmbOfFalseHitsTriggeredRec, nmbOfSavedEvents, nmbOfSavedFastEvents,
447 reconstructor->GetExpectedMomentumAmp(),
448 reconstructor->GetEDCollectionAlgorithm(), 0 };
454 boost::archive::binary_oarchive archive( runDataFile );
455 archive << sObjectToWrite;
466 G4int iEventEffective( 0 );
468 for ( iEvent = 0; iEventEffective < nEvent; ++iEvent )
493 if ( iEvent < nSelect )
506 #ifdef CEXMC_USE_PERSISTENCY 508 void CexmcRunManager::DoReadEventLoop(
G4int nEvent )
511 G4int iEventEffective( 0 );
512 G4int nEventCount( 0 );
522 if ( ! productionModel )
529 CexmcEventSObject evSObject;
530 CexmcEventFastSObject evFastSObject;
533 std::ifstream eventsDataFile(
535 if ( ! eventsDataFile )
538 boost::archive::binary_iarchive evArchive( eventsDataFile );
540 std::ifstream eventsFastDataFile(
542 if ( ! eventsFastDataFile )
545 boost::archive::binary_iarchive evFastArchive( eventsFastDataFile );
555 G4int hcId( digiManager->GetHitsCollectionID(
560 hcOfThisEvent->AddHitsCollection( hcId, monitorED );
561 hcId = digiManager->GetHitsCollectionID(
566 hcOfThisEvent->AddHitsCollection( hcId, vetoCounterED );
567 hcId = digiManager->GetHitsCollectionID(
572 hcOfThisEvent->AddHitsCollection( hcId, calorimeterED );
573 hcId = digiManager->GetHitsCollectionID(
577 hcOfThisEvent->AddHitsCollection( hcId, monitorTP );
578 hcId = digiManager->GetHitsCollectionID(
583 hcOfThisEvent->AddHitsCollection( hcId, vetoCounterTP );
584 hcId = digiManager->GetHitsCollectionID(
589 hcOfThisEvent->AddHitsCollection( hcId, calorimeterTP );
590 hcId = digiManager->GetHitsCollectionID(
594 hcOfThisEvent->AddHitsCollection( hcId, targetTP );
596 #ifdef CEXMC_USE_CUSTOM_FILTER 598 customFilter->SetAddressedData( &evFastSObject, &evSObject );
602 sObject.nmbOfSavedFastEvents );
606 for (
int i( 0 ); i < nmbOfSavedEvents; ++i )
608 evFastArchive >> evFastSObject;
612 if ( eventDataWrittenOnEveryTPT ||
613 evFastSObject.edDigitizerHasTriggered )
615 evArchive >> evSObject;
616 if ( evFastSObject.edDigitizerHasTriggered )
624 productionModel->SetTriggeredAngularRanges(
625 evFastSObject.opCosThetaSCM );
627 productionModel->GetTriggeredAngularRanges() );
629 if ( ! eventDataWrittenOnEveryTPT &&
630 ! evFastSObject.edDigitizerHasTriggered )
632 #ifdef CEXMC_USE_CUSTOM_FILTER 638 if ( customFilter && ! customFilter->EvalTPT() )
641 SaveCurrentTPTEvent( evFastSObject, triggeredAngularRanges,
646 evArchive >> evSObject;
648 G4bool skipEDTOnThisEvent(
false );
650 #ifdef CEXMC_USE_CUSTOM_FILTER 651 if ( customFilter && ! customFilter->EvalTPT() )
653 if ( customFilter && ! customFilter->EvalEDT() )
655 if ( ! eventDataWrittenOnEveryTPT )
657 SaveCurrentTPTEvent( evFastSObject, triggeredAngularRanges,
661 skipEDTOnThisEvent =
true;
665 event.SetEventID( evSObject.eventId );
672 monitorED->GetMap()->operator[]( 0 ) = &evSObject.monitorED;
673 vetoCounterED->
GetMap()->operator[]( 0 ) = &evSObject.vetoCounterEDLeft;
674 vetoCounterED->
GetMap()->operator[]( 1 <<
676 &evSObject.vetoCounterEDRight;
679 for ( CexmcEnergyDepositCalorimeterCollection::iterator
680 k( evSObject.calorimeterEDLeftCollection.begin() );
681 k != evSObject.calorimeterEDLeftCollection.end(); ++k )
686 for ( CexmcEnergyDepositCrystalRowCollection::iterator
687 l( k->begin() ); l != k->end(); ++l )
689 calorimeterED->
GetMap()->operator[]( index | column ) = &*l;
695 for ( CexmcEnergyDepositCalorimeterCollection::iterator
696 k( evSObject.calorimeterEDRightCollection.begin() );
697 k != evSObject.calorimeterEDRightCollection.end(); ++k )
704 for ( CexmcEnergyDepositCrystalRowCollection::iterator
705 l( k->begin() ); l != k->end(); ++l )
707 calorimeterED->
GetMap()->operator[]( index | column ) = &*l;
715 evSObject.targetTPBeamParticle );
717 evSObject.targetTPOutputParticle );
719 evSObject.targetTPNucleusParticle );
721 evSObject.targetTPOutputParticleDecayProductParticle1 );
723 evSObject.targetTPOutputParticleDecayProductParticle2 );
725 evSObject.vetoCounterTPLeft );
727 evSObject.vetoCounterTPRight );
729 evSObject.calorimeterTPLeft );
731 evSObject.calorimeterTPRight );
736 if ( targetTPBeamParticleInfo.
IsValid() )
737 targetTP->
GetMap()->operator[](
738 targetTPBeamParticleInfo.
trackId ) =
739 &targetTPBeamParticleInfo;
740 if ( targetTPOutputParticleInfo.
IsValid() )
741 targetTP->
GetMap()->operator[](
742 targetTPOutputParticleInfo.
trackId ) =
743 &targetTPOutputParticleInfo;
744 if ( targetTPNucleusParticleInfo.
IsValid() )
745 targetTP->
GetMap()->operator[](
746 targetTPNucleusParticleInfo.
trackId ) =
747 &targetTPNucleusParticleInfo;
748 if ( targetTPOutputParticleDecayProductParticle1Info.
IsValid() )
749 targetTP->
GetMap()->operator[](
750 targetTPOutputParticleDecayProductParticle1Info.
trackId ) =
751 &targetTPOutputParticleDecayProductParticle1Info;
752 if ( targetTPOutputParticleDecayProductParticle2Info.
IsValid() )
753 targetTP->
GetMap()->operator[](
754 targetTPOutputParticleDecayProductParticle2Info.
trackId ) =
755 &targetTPOutputParticleDecayProductParticle2Info;
756 if ( vetoCounterTPLeftInfo.
IsValid() )
757 vetoCounterTP->
GetMap()->operator[](
758 vetoCounterTPLeftInfo.
trackId ) = &vetoCounterTPLeftInfo;
759 if ( vetoCounterTPRightInfo.
IsValid() )
760 vetoCounterTP->
GetMap()->operator[](
762 vetoCounterTPRightInfo.
trackId ) = &vetoCounterTPRightInfo;
765 if ( calorimeterTPLeftInfo.
IsValid() )
771 calorimeterTP->
GetMap()->operator[](
776 calorimeterTPLeftInfo.
trackId ) = &calorimeterTPLeftInfo;
778 if ( calorimeterTPRightInfo.
IsValid() )
784 calorimeterTP->
GetMap()->operator[](
790 calorimeterTPRightInfo.
trackId ) = &calorimeterTPRightInfo;
793 productionModel->SetProductionModelData(
794 evSObject.productionModelData );
803 monitorED->GetMap()->clear();
804 vetoCounterED->
GetMap()->clear();
805 calorimeterED->
GetMap()->clear();
806 monitorTP->
GetMap()->clear();
807 targetTP->
GetMap()->clear();
808 vetoCounterTP->
GetMap()->clear();
809 calorimeterTP->
GetMap()->clear();
813 if ( skipEDTOnThisEvent )
828 event.SetUserInformation( NULL );
830 monitorED->GetMap()->clear();
831 vetoCounterED->
GetMap()->clear();
832 calorimeterED->
GetMap()->clear();
833 monitorTP->
GetMap()->clear();
834 targetTP->
GetMap()->clear();
835 vetoCounterTP->
GetMap()->clear();
836 calorimeterTP->
GetMap()->clear();
840 if ( nEvent > 0 && iEventEffective == nEvent )
849 #ifdef CEXMC_USE_CUSTOM_FILTER 851 customFilter->SetAddressedData( NULL, NULL );
856 void CexmcRunManager::SaveCurrentTPTEvent(
857 const CexmcEventFastSObject & evFastSObject,
866 for ( CexmcAngularRangeList::const_iterator k( angularRanges.begin() );
867 k != angularRanges.end(); ++k )
870 if ( evFastSObject.edDigitizerMonitorHasTriggered )
874 if ( writeToDatabase )
876 fastEventsArchive->operator<<( evFastSObject );
892 if ( macroFile != 0 )
896 cmd =
"/control/execute ";
907 #ifdef CEXMC_USE_PERSISTENCY 908 eventsArchive = NULL;
909 fastEventsArchive = NULL;
914 std::ofstream eventsDataFile(
916 boost::archive::binary_oarchive eventsArchive_( eventsDataFile );
917 std::ofstream fastEventsDataFile(
919 boost::archive::binary_oarchive fastEventsArchive_(
920 fastEventsDataFile );
921 eventsArchive = &eventsArchive_;
922 fastEventsArchive = &fastEventsArchive_;
923 DoReadEventLoop( nEvent );
927 DoReadEventLoop( nEvent );
934 std::ofstream eventsDataFile(
936 boost::archive::binary_oarchive eventsArchive_( eventsDataFile );
937 std::ofstream fastEventsDataFile(
939 boost::archive::binary_oarchive fastEventsArchive_(
940 fastEventsDataFile );
941 eventsArchive = &eventsArchive_;
942 fastEventsArchive = &fastEventsArchive_;
950 eventsArchive = NULL;
951 fastEventsArchive = NULL;
964 " events processed." <<
G4endl;
968 G4cout <<
" Number of events processed : " <<
977 #ifdef CEXMC_USE_PERSISTENCY 979 void CexmcRunManager::PrintReadRunData(
void )
const 984 G4bool refCrystalInfoPrinted(
false );
988 G4cout <<
" (archive class version " <<
989 sObject.actualVersion <<
")" <<
G4endl;
990 if ( ! sObject.rProject.empty() )
992 G4cout <<
" -- Based on project '" << sObject.rProject <<
"'" <<
994 if ( ! sObject.cfFileName.empty() )
995 G4cout <<
" -- Custom filter script '" << sObject.cfFileName <<
996 "' was used" << G4endl;
998 G4cout <<
" -- Event data verbose level (0 - not saved, 1 - triggers, " 999 "2 - interactions): " << sObject.evDataVerboseLevel <<
G4endl;
1000 if ( ! sObject.rProject.empty() )
1004 G4cout <<
" -- (fdb file contains " <<
1005 ( sObject.interactionsWithoutEDTWereSkipped ?
1006 "only interactions when an event was triggered" :
1007 "all interactions" ) <<
")" << std::endl;
1010 G4cout <<
" -- Base physics used" 1011 "(1 - QGSP_BERT, 2 - QGSP_BIC_EMY, 3 - FTFP_BERT): " <<
1012 sObject.basePhysicsUsed <<
G4endl;
1013 G4cout <<
" -- Production model (1 - pi0, 2 - eta): " <<
1014 sObject.productionModelType <<
G4endl;
1015 G4cout <<
" -- Geometry definition file: " << sObject.gdmlFileName <<
1017 G4cout <<
" -- Angular ranges: " << sObject.angularRanges <<
G4endl;
1020 G4cout <<
" -- Fermi motion status (0 - disabled, 1 - enabled): " <<
1021 sObject.fermiMotionIsOn <<
G4endl;
1022 if ( sObject.calorimeterRegCuts.size() < 4 )
1024 G4cout <<
" -- Production cuts in calorimeter (gamma, e-, e+, p): " <<
1025 G4BestUnit( sObject.calorimeterRegCuts[ 0 ],
"Length" ) <<
", " <<
1026 G4BestUnit( sObject.calorimeterRegCuts[ 1 ],
"Length" ) <<
", " <<
1027 G4BestUnit( sObject.calorimeterRegCuts[ 2 ],
"Length" ) <<
", " <<
1029 G4cout <<
" -- Proposed max interaction length in the target: " <<
1031 G4cout <<
" -- Event count policy (0 - all, 1 - interaction, 2 - trigger)" 1032 ": " << sObject.eventCountPolicy <<
G4endl;
1033 G4cout <<
" -- Number of events (processed / effective / ordered): " <<
1034 sObject.numberOfEventsProcessed <<
" / " <<
1035 sObject.numberOfEventsProcessedEffective <<
" / " <<
1036 sObject.numberOfEventsToBeProcessed <<
G4endl;
1037 G4cout <<
" -- Incident beam particle: " << sObject.beamParticle <<
G4endl;
1038 G4cout <<
" position: " <<
1040 G4cout <<
" direction: " <<
1042 G4cout <<
" momentum: " <<
1044 G4cout <<
" momentum fwhm: " << sObject.beamFwhmMomentumAmp <<
1046 G4cout <<
" pos fwhm (x): " <<
1048 G4cout <<
" pos fwhm (y): " <<
1050 G4cout <<
" dir fwhm (x): " << sObject.beamFwhmDirX /
deg <<
1052 G4cout <<
" dir fwhm (y): " << sObject.beamFwhmDirY /
deg <<
1054 G4cout <<
" -- Monitor ED threshold: " <<
1056 G4cout <<
" -- Veto counter (l/r) ED threshold: " <<
1057 G4BestUnit( sObject.vetoCounterEDLeftThreshold,
"Energy" ) <<
1059 G4BestUnit( sObject.vetoCounterEDRightThreshold,
"Energy" ) <<
1061 G4cout <<
" -- Calorimeter (l/r) ED threshold: " <<
1062 G4BestUnit( sObject.calorimeterEDLeftThreshold,
"Energy" ) <<
1064 G4BestUnit( sObject.calorimeterEDRightThreshold,
"Energy" ) <<
1066 G4cout <<
" -- Calorimeter trigger algorithm (0 - all, 1 - inner): " <<
1067 sObject.calorimeterTriggerAlgorithm <<
G4endl;
1068 G4cout <<
" -- Outer crystals veto algorithm " 1069 "(0 - none, 1 - max, 2 - fraction): " <<
1070 sObject.outerCrystalsVetoAlgorithm <<
G4endl;
1071 if ( sObject.outerCrystalsVetoAlgorithm ==
1074 G4cout <<
" -- Outer crystals veto fraction: " <<
1075 sObject.outerCrystalsVetoFraction <<
G4endl;
1077 G4cout <<
" -- Finite crystal resolution applied (0 - no, 1 - yes): " <<
1078 sObject.applyFiniteCrystalResolution <<
G4endl;
1079 if ( sObject.applyFiniteCrystalResolution )
1081 G4cout <<
" -- Crystal resolution data: " <<
1082 sObject.crystalResolutionData;
1085 if ( sObject.expectedMomentumAmp > 0 )
1087 G4cout <<
" -- expected momentum in the target: " <<
1090 G4cout <<
" -- ed collection algorithm (0 - all, 1 - adjacent): " <<
1091 sObject.edCollectionAlgorithm <<
G4endl;
1095 " -- inner crystal used as reference (0 - no, 1 - yes): " <<
1096 sObject.useInnerRefCrystal <<
G4endl;
1097 refCrystalInfoPrinted =
true;
1099 G4cout <<
" -- entry point definition algorithm " <<
G4endl;
1100 G4cout <<
" (0 - center of calorimeter, 1 - center of crystal with " 1102 G4cout <<
" 2 - linear, 3 - square): " <<
1103 sObject.epDefinitionAlgorithm <<
G4endl;
1104 G4cout <<
" -- entry point depth definition algorithm " 1105 "(0 - plain, 1 - sphere): " <<
1106 sObject.epDepthDefinitionAlgorithm <<
G4endl;
1107 G4cout <<
" -- entry point depth: " <<
1113 " -- crystal selection algorithm (0 - all, 1 - adjacent): " <<
1114 sObject.csAlgorithm <<
G4endl;
1116 if ( ! refCrystalInfoPrinted &&
1117 ( sObject.epDefinitionAlgorithm ==
1120 sObject.epDefinitionAlgorithm ==
1125 " -- inner crystal used as reference (0 - no, 1 - yes): " <<
1126 sObject.useInnerRefCrystal <<
G4endl;
1128 G4cout <<
" -- table mass of output particle used " 1129 "(0 - no, 1 - yes): " << sObject.useTableMass <<
G4endl;
1130 G4cout <<
" -- mass cut is enabled (0 - no, 1 - yes): " <<
1131 sObject.useMassCut <<
G4endl;
1132 if ( sObject.useMassCut )
1134 G4cout <<
" -- mass cut output particle center: " <<
1136 G4cout <<
" -- mass cut nucleus output particle center: " <<
1138 G4cout <<
" -- mass cut output particle width of the ellipse: " <<
1140 G4cout <<
" -- mass cut nucleus output particle width of the " 1143 G4cout <<
" -- mass cut angle of the ellipse: " <<
1144 sObject.mCutAngle /
deg <<
" deg" <<
G4endl;
1146 G4cout <<
" -- absorbed energy cut is enabled (0 - no, 1 - yes): " <<
1147 sObject.useAbsorbedEnergyCut <<
G4endl;
1148 if ( sObject.useAbsorbedEnergyCut )
1150 G4cout <<
" -- absorbed energy cut left calorimeter center: " <<
1152 G4cout <<
" -- absorbed energy cut right calorimeter center: " <<
1154 G4cout <<
" -- absorbed energy cut left calorimeter width of the " 1157 G4cout <<
" -- absorbed energy cut right calorimeter width of the " 1160 G4cout <<
" -- absorbed energy cut angle of the ellipse: " <<
1161 sObject.aeCutAngle /
deg <<
" deg" <<
G4endl;
1165 sObject.nmbOfHitsSampledFull,
1166 sObject.nmbOfHitsTriggeredRealRange,
1167 sObject.nmbOfHitsTriggeredRecRange,
1168 sObject.nmbOfOrphanHits,
1169 sObject.angularRanges,
1170 sObject.nmbOfFalseHitsTriggeredEDT,
1171 sObject.nmbOfFalseHitsTriggeredRec );
1176 void CexmcRunManager::ReadAndPrintEventsData(
void )
const 1181 CexmcEventSObject evSObject;
1184 std::ifstream eventsDataFile(
1186 if ( ! eventsDataFile )
1189 boost::archive::binary_iarchive evArchive( eventsDataFile );
1191 for (
int i( 0 ); i < sObject.nmbOfSavedEvents; ++i )
1193 evArchive >> evSObject;
1195 if ( ! evSObject.edDigitizerMonitorHasTriggered )
1199 evSObject.vetoCounterEDLeft, evSObject.vetoCounterEDRight,
1200 evSObject.calorimeterEDLeft, evSObject.calorimeterEDRight,
1201 0, 0, 0, 0, evSObject.calorimeterEDLeftCollection,
1202 evSObject.calorimeterEDRightCollection );
1205 evSObject.targetTPBeamParticle, evSObject.targetTPOutputParticle,
1206 evSObject.targetTPNucleusParticle,
1207 evSObject.targetTPOutputParticleDecayProductParticle1,
1208 evSObject.targetTPOutputParticleDecayProductParticle2,
1209 evSObject.vetoCounterTPLeft, evSObject.vetoCounterTPRight,
1210 evSObject.calorimeterTPLeft, evSObject.calorimeterTPRight );
1213 evSObject.productionModelData );
1217 G4cout <<
" --- Production model data: " << pmData;
1223 void CexmcRunManager::PrintReadData(
1229 G4bool addSpace(
false );
1231 CexmcOutputDataTypeSet::const_iterator found(
1233 if ( found != outputData.end() )
1236 gdmlFileExtension );
1237 if (
system( cmd ) != 0 )
1244 if (
system( cmd ) != 0 )
1252 if ( found != outputData.end() )
1257 ReadAndPrintEventsData();
1263 if ( found != outputData.end() )
1269 for ( CexmcDecayBranchesStore::const_iterator
1270 k( sObject.etaDecayTable.GetDecayBranches().begin() );
1271 k != sObject.etaDecayTable.GetDecayBranches().end(); ++k )
1281 #ifdef CEXMC_USE_CUSTOM_FILTER 1283 void CexmcRunManager::SetCustomFilter(
const G4String & cfFileName_ )
1287 delete customFilter;
1288 customFilter = NULL;
1291 if ( cfFileName_.empty() )
1300 customFilter =
new CexmcCustomFilterEval(
cfFileName );
1310 G4VisManager * visManager( static_cast< G4VisManager * >(
1320 #if G4VERSION_NUMBER < 960 1321 typedef std::vector< G4VModel * > MList;
1323 typedef std::vector< G4Scene::Model > MList;
1325 const MList & mList( curScene->GetRunDurationModelList() );
1327 for ( MList::const_iterator k( mList.begin() ); k != mList.end(); ++k )
1329 #if G4VERSION_NUMBER < 960 1330 const G4String & modelDesc( ( *k )->GetGlobalDescription() );
1332 const G4String & modelDesc( k->fpModel->GetGlobalDescription() );
1352 if ( ! eventAction )
1363 #ifdef CEXMC_USE_PERSISTENCY 1391 if ( ! cmd.empty() &&
system( cmd ) != 0 )
G4int numberOfEventToBeProcessed
void IncrementNmbOfSavedFastEvents(void)
void SetOuterCrystalsVetoFraction(G4double value, G4bool fromMessenger=true)
void EndOfEventAction(const G4Event *event)
void SetBR(G4double value)
G4double GetFwhmDirY(void) const
G4bool IsFiniteCrystalResolutionApplied(void) const
CLHEP::Hep3Vector G4ThreeVector
std::map< G4int, T * > * GetMap() const
const G4String CexmcScenePrimitivesDescription("CexmcScenePrimitives")
G4bool ProjectIsRead(void) const
G4double GetProposedMaxIL(void) const
G4double GetCalorimeterLeftThreshold(void) const
void SetCalorimeterLeftThreshold(G4double value, G4bool fromMessenger=true)
G4double GetOuterCrystalsVetoFraction(void) const
G4int GetNmbOfFalseHitsTriggeredEDT(void) const
static G4VVisManager * GetConcreteInstance()
G4Scene * GetCurrentScene() const
G4int numberOfEventsProcessed
void SetupConstructionHook(void)
G4bool IsValid(void) const
const CexmcNmbOfHitsInRanges & GetNmbOfHitsSampledFull(void) const
static G4int GetCopyDepth1BitsOffset(void)
G4ThreeVector positionLocal
const G4String CexmcDetectorTypeName[CexmcNumberOfDetectorTypes]
static G4DigiManager * GetDMpointer()
void DoCommonEventLoop(G4int nEvent, const G4String &cmd, G4int nSelect)
G4double GetFwhmDirX(void) const
void SetOuterCrystalsVetoAlgorithm(CexmcOuterCrystalsVetoAlgorithm value, G4bool fromMessenger=true)
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
void SetCalorimeterRightThreshold(G4double value, G4bool fromMessenger=true)
G4double GetCalorimeterRightThreshold(void) const
const CexmcNmbOfHitsInRanges & GetNmbOfHitsTriggeredRealRange(void) const
void SetVetoCounterRightThreshold(G4double value, G4bool fromMessenger=true)
void ReadPreinitProjectData(void)
G4double GetVetoCounterLeftThreshold(void) const
static G4int GetLeftRightBitsOffset(void)
const CexmcAngularRangeList & GetAngularRanges(void) const
void DoEventLoop(G4int nEvent, const char *macroFile, G4int nSelect)
G4bool ProjectIsSaved(void) const
virtual ~CexmcRunManager()
const G4String CexmcEDDigitizerName("EDDig")
CexmcProductionModelType productionModelType
static G4UImanager * GetUIpointer()
CexmcEventDataVerboseLevel rEvDataVerboseLevel
static G4RegionStore * GetInstance()
G4double GetFwhmPosX(void) const
G4VUserPrimaryGeneratorAction * userPrimaryGeneratorAction
virtual G4Event * GenerateEvent(G4int i_event)
G4VUserEventInformation * GetUserInformation() const
G4double GetVetoCounterRightThreshold(void) const
G4GLOB_DLL std::ostream G4cout
G4int GetNmbOfSavedFastEvents(void) const
CexmcEventCountPolicy eventCountPolicy
void IncrementNmbOfHitsSampled(G4int index)
CexmcPhysicsManager * physicsManager
G4int GetNmbOfSavedEvents(void) const
G4bool EdTriggerIsOk(void) const
virtual void AnalyzeEvent(G4Event *anEvent)
void SetFwhmDirY(G4double value, G4bool fromMessenger=true)
G4double GetFwhmPosY(void) const
void IncrementNmbOfHitsSampledFull(G4int index)
static G4int GetCopyDepth0BitsOffset(void)
G4UserEventAction * userEventAction
static G4Eta * Definition()
static void PrintTrackPoints(const CexmcTrackPointsStore *tpStore)
const CexmcEnergyRangeWithDoubleValueList & GetCrystalResolutionData(void) const
G4DecayTable * GetDecayTable() const
const G4String CexmcDetectorRoleName[CexmcNumberOfDetectorRoles]
static void PrintEnergyDeposit(const CexmcEnergyDepositStore *edStore)
void BeamParticleChangeHook(void)
void SetCrystalResolutionData(const CexmcEnergyRangeWithDoubleValueList &data)
void SetFwhmPosX(G4double value, G4bool fromMessenger=true)
CexmcOuterCrystalsVetoAlgorithm GetOuterCrystalsVetoAlgorithm(void) const
void RegisterScenePrimitives(void)
static G4int GetCopyDepth1BitsOffset(void)
G4HCofThisEvent * PrepareNewEvent()
static void PrintResults(const CexmcNmbOfHitsInRanges &nmbOfHitsSampled, const CexmcNmbOfHitsInRanges &nmbOfHitsSampledFull, const CexmcNmbOfHitsInRanges &nmbOfHitsTriggeredRealRange, const CexmcNmbOfHitsInRanges &nmbOfHitsTriggeredRecRange, const CexmcNmbOfHitsInRanges &nmbOfOrphanHits, const CexmcAngularRangeList &angularRanges, G4int nmbOfFalseHitsTriggeredEDT, G4int nmbOfFalseHitsTriggeredRec)
const G4String CexmcCalorimeterRegionName("Calorimeter")
void ConvertToCrystalGeometry(const G4ThreeVector &src, G4int &row, G4int &column, G4ThreeVector &dst) const
static G4ParticleTable * GetParticleTable()
G4VDecayChannel * GetDecayChannel(G4int index) const
CexmcCalorimeterTriggerAlgorithm GetCalorimeterTriggerAlgorithm(void) const
G4double GetFwhmMomentumAmp(void) const
G4double GetMonitorThreshold(void) const
CexmcChargeExchangeReconstructor * GetReconstructor(void)
const CexmcNmbOfHitsInRanges & GetNmbOfHitsTriggeredRecRange(void) const
static G4SDManager * GetSDMpointer()
G4HCofThisEvent * GetHCofThisEvent() const
CexmcEventDataVerboseLevel evDataVerboseLevel
const CexmcNmbOfHitsInRanges & GetNmbOfHitsSampled(void) const
void SetFwhmDirX(G4double value, G4bool fromMessenger=true)
void SetFwhmMomentumAmp(G4double value, G4bool fromMessenger=true)
void ApplyFiniteCrystalResolution(G4bool value, G4bool fromMessenger=true)
system("rm -rf microbeam.root")
std::vector< CexmcAngularRange > CexmcAngularRangeList
CexmcParticleGun * GetParticleGun(void)
void StackPreviousEvent(G4Event *anEvent)
void SetCalorimeterTriggerAlgorithm(CexmcCalorimeterTriggerAlgorithm value, G4bool fromMessenger=true)
void SetVetoCounterLeftThreshold(G4double value, G4bool fromMessenger=true)
G4bool skipInteractionsWithoutEDTonWrite
G4int numberOfEventsProcessedEffective
void SetFwhmPosY(G4double value, G4bool fromMessenger=true)
void ProcessOneEvent(G4Event *anEvent)
CexmcBasePhysicsUsed basePhysicsUsed
G4ProductionCuts * GetProductionCuts() const
CexmcRunManager(const G4String &projectId="", const G4String &rProject="", G4bool overrideExistingProject=false)
std::set< CexmcOutputDataType > CexmcOutputDataTypeSet
G4bool IsFermiMotionOn(void) const
G4bool TpTriggerIsOk(void) const
G4EventManager * eventManager
void ApplyFermiMotion(G4bool on, G4bool fromMessenger=true)
virtual CexmcProductionModel * GetProductionModel(void)=0
G4VUserDetectorConstruction * userDetector
static G4int GetLeftRightBitsOffset(void)
void SetAngularRanges(const CexmcAngularRangeList &angularRanges_)
void SetMonitorThreshold(G4double value, G4bool fromMessenger=true)
G4VDigitizerModule * FindDigitizerModule(G4String mName)
G4int GetNmbOfFalseHitsTriggeredRec(void) const
void SetProposedMaxIL(G4double value)
CexmcRunManagerMessenger * messenger
static const G4double pos
void SetProductionCuts(std::vector< G4double > &)
std::map< G4int, G4int > CexmcNmbOfHitsInRanges
const CexmcNmbOfHitsInRanges & GetNmbOfOrphanHits(void) const
const std::vector< G4double > & GetProductionCuts() const
G4int ApplyCommand(const char *aCommand)
void BeamParticleChangeHook(void)