38 #include "ExErrorDetectorConstruction.hh" 39 #include "G4SteppingVerbose.hh" 41 #include "G4ErrorPropagator.hh" 42 #include "G4ErrorPropagatorData.hh" 43 #include "G4ErrorPropagatorManager.hh" 44 #include "G4ErrorPlaneSurfaceTarget.hh" 45 #include "G4ErrorCylSurfaceTarget.hh" 46 #include "G4ErrorGeomVolumeTarget.hh" 47 #include "G4ErrorTrackLengthTarget.hh" 48 #include "G4ErrorFreeTrajState.hh" 50 #include "G4UImanager.hh" 51 #include "G4SystemOfUnits.hh" 71 char* prop = std::getenv(
"G4ERROR_PROP");
78 G4Exception(
"exG4eReco",
"Fatal error in Argument",
81 " It must be: UNTIL_TARGET or STEP_BY_STEP").c_str());
84 G4Exception(
"exG4eReco",
"Fatal error in Argument",
86 "Variable G4ERROR_PROP not defined, taking it = UNTIL_TARGET");
90 for(
size_t ii = 0; ii < nEvents; ii++ ){
102 G4VSteppingVerbose::SetInstance(
new G4SteppingVerbose);
105 G4ErrorPropagatorManager* g4emgr
106 = G4ErrorPropagatorManager::GetErrorPropagatorManager();
107 G4ErrorPropagatorData* g4edata
108 = G4ErrorPropagatorData::GetErrorPropagatorData();
110 g4emgr->SetUserInitialization(
new ExErrorDetectorConstruction);
112 G4UImanager::GetUIpointer()->ApplyCommand(
"/exerror/setField -10. kilogauss");
114 g4emgr->InitGeant4e();
116 G4UImanager::GetUIpointer()->ApplyCommand(
"/control/verbose 1");
117 G4UImanager::GetUIpointer()->ApplyCommand(
"/tracking/verbose 1");
118 G4UImanager::GetUIpointer()->ApplyCommand(
"/geant4e/limits/stepLength 100 mm");
126 char*
target = std::getenv(
"G4ERROR_TARGET");
137 G4Exception(
"exG4eReco",
"Fatal error in Argument",
138 FatalErrorInArgument,
140 " It must be: PLANE_SURFACE, CYL_SURFACE, VOLUME, TRKLEN").c_str());
143 G4Exception(
"exG4eReco",
"Fatal error in Argument",
144 JustWarning,
"Variable G4ERROR_TARGET not defined, taking it = PLANE_SURFACE");
151 char* mode = std::getenv(
"G4ERROR_MODE");
158 G4Exception(
"exG4eReco",
"Fatal error in Argument",
159 FatalErrorInArgument,
161 " It must be: FORWARDS or BACKWARDS").c_str());
164 G4Exception(
"exG4eReco",
"Fatal error in Argument",
165 JustWarning,
"Variable G4ERROR_MODE not defined, taking it = BACKWARDS");
175 G4ThreeVector xv3( 0, 0, 0 );
176 G4ThreeVector pv3( 20.0*GeV, 0.0, 0.0 );
177 G4ErrorTrajErr
error( 5, 0 );
178 G4ErrorFreeTrajState* g4ErrorTrajState
179 =
new G4ErrorFreeTrajState(
"mu-", xv3, pv3, error );
181 G4ErrorPropagatorManager* g4emgr
182 = G4ErrorPropagatorManager::GetErrorPropagatorManager();
186 G4Point3D surfPos(224.*cm,0.,0.);
187 G4Normal3D surfNorm(1.,0.,0.);
195 }
else if( iProp == 1){
199 g4emgr->InitTrackPropagation();
210 if( g4emgr->GetPropagator()->CheckIfLastStep( g4ErrorTrajState->GetG4Track() )) {
211 g4emgr->GetPropagator()
212 ->InvokePostUserTrackingAction( g4ErrorTrajState->GetG4Track() );
214 G4cout <<
"STEP_BY_STEP propagation: Last Step " << G4endl;
219 G4cout <<
" $$$ PROPAGATION ENDED " << G4endl;
221 G4Point3D posEnd = g4ErrorTrajState->GetPosition();
222 G4Normal3D momEnd = g4ErrorTrajState->GetMomentum();
223 G4ErrorTrajErr errorEnd = g4ErrorTrajState->GetError();
225 G4cout <<
" Position: " << posEnd << G4endl
226 <<
" Momentum: " << momEnd << G4endl
227 <<
" Error: " << errorEnd << G4endl;
235 G4ErrorTarget*
target = 0;
237 G4Point3D surfPos(221.*cm,0.,0.);
238 G4Normal3D surfNorm(1.,0.,0.);
239 target =
new G4ErrorPlaneSurfaceTarget(surfNorm, surfPos );
240 }
else if( iTarget == 2 ) {
242 target =
new G4ErrorCylSurfaceTarget(radius);
243 }
else if( iTarget == 3 ) {
244 target =
new G4ErrorGeomVolumeTarget(
"MUON");
245 }
else if( iTarget == 4 ) {
246 target =
new G4ErrorTrackLengthTarget(223.*cm);
248 G4Exception(
"exG4eReco",
"Fatal error in Argument",
249 FatalErrorInArgument,
"Target type has to be between 1 and 4");
258 G4ErrorPropagatorManager::GetErrorPropagatorManager()->CloseGeometry();
void ProcessEvent(G4int iProp, size_t nEv)
G4ErrorMode theG4ErrorMode
G4ErrorTarget * theTarget
G4ErrorTarget * BuildTarget(G4int iTarget)
cout<< "-> Edep in the target