92 namePost = volumePost->
GetName();
97 G4double eKin = aStep -> GetPreStepPoint() -> GetKineticEnergy();
101 G4String material= aStep -> GetTrack() -> GetMaterial() -> GetName();
105 if((namePre==
"collimator")||(namePre==
"PhysicExternalMagnet_1Down")||(namePre==
"PhysicExternalMagnet_1")||(namePre==
"PhysicMagnet_1Right")||(namePre==
"PhysicMagnet_1Left")||(namePre==
"PhysicExternalMagnet_2")||(namePre==
"PhysicExternalMagnet_2Down")||(namePre==
"PhysicMagnet_2Right")||(namePre==
"PhysicMagnet_2Left")||(namePre==
"PhysicExternalMagnet_3")||(namePre==
"PhysicExternalMagnet_3Down")||(namePre==
"PhysicMagnet_3Right")||(namePre==
"PhysicMagnet_3Left")||(namePre==
"PhysicExternalMagnet_4")||(namePre==
"PhysicExternalMagnet_4Down")||(namePre==
"physQuadChamberWall")||(namePre==
"PhysicMagnet_4Right")||(namePre==
"PhysicMagnet_4Left")||(namePre==
"ExternalChamber")||(namePre==
"collimatorFinal")||(namePre==
"ExternalSlit")||(namePre==
"PhysFourthQuad")||(namePre==
"PhysThirdQuad")||(namePre==
"PhysSecondQuad")||(namePre==
"PhysFirstQuad"))
134 std::ofstream WriteDataIn(
"new200.out", std::ios::app);
135 WriteDataIn << eKin <<
'\t' <<
" "
136 << eventNum <<
'\t' <<
" "
137 << PosX <<
'\t' <<
" "
138 << PosY <<
'\t' <<
" "
139 << PosZ <<
'\t' <<
" "
163 if ((namePre==
"PhysicEntranceWindow") &&
166 std::ofstream WriteDataIn(
"finestra.out", std::ios::app);
167 WriteDataIn << eKin <<
'\t' <<
" "
168 << eventNum <<
'\t' <<
" "
169 << PreStepX <<
'\t' <<
" "
170 << PreStepY <<
'\t' <<
" "
171 << PreStepZ <<
'\t' <<
" "
172 << parentID <<
'\t' <<
" "
173 << trackID <<
'\t' <<
" "
183 std::ofstream WriteDataBack(
"fondo.out", std::ios::app);
184 WriteDataBack << eKin <<
'\t' <<
" "
185 << eventNum <<
'\t' <<
" "
186 << PreStepX <<
'\t' <<
" "
187 << PreStepY <<
'\t' <<
" "
188 << PreStepZ <<
'\t' <<
" "
189 << parentID <<
'\t' <<
" "
190 << trackID <<
'\t' <<
" "
199 if (((namePost==
"PhysicVirtualWindow") && (namePre!=
"PhysicVirtualWindow")) &&
203 if ((PostStepX - PreStepX)>0)
212 std::ofstream WriteDataIn(
"DatiFCWindowIn.out", std::ios::app);
213 WriteDataIn << eKin <<
'\t' <<
" "
214 << eventNum <<
'\t' <<
" "
215 << PostStepX <<
'\t' <<
" "
216 << PostStepY <<
'\t' <<
" "
217 << PostStepZ <<
'\t' <<
" "
221 << parentID <<
'\t' <<
" "
222 << trackID <<
'\t' <<
" "
232 std::ofstream WriteDataBack(
"DatiFCWindowBack.out", std::ios::app);
233 WriteDataBack << eKin <<
'\t' <<
" "
234 << eventNum <<
'\t' <<
" "
235 << PostStepX <<
'\t' <<
" "
236 << PostStepY <<
'\t' <<
" "
237 << PostStepZ <<
'\t' <<
" "
238 << parentID <<
'\t' <<
" "
239 << trackID <<
'\t' <<
" "
276 if (((namePost==
"PhysicVirtualWindow") && (namePre!=
"PhysicVirtualWindow")) &&
290 std::ofstream WriteData(
"DatiFCAfterWindowProton.out", std::ios::app);
291 WriteData << eKin <<
'\t' <<
" "
292 << eventNum <<
'\t' <<
" "
293 << PostStepX <<
'\t' <<
" "
294 << PostStepY <<
'\t' <<
" "
295 << PostStepZ <<
'\t' <<
" "
296 << parentID <<
'\t' <<
" "
297 << trackID <<
'\t' <<
" "
308 if ((namePre==
"PhysicGuardRing") &&
312 if ((PostStepX - PreStepX)>0)
316 std::ofstream WriteDataIn(
"DatiFCGuardRingIn.out", std::ios::app);
317 WriteDataIn << eKin <<
'\t' <<
" "
318 << eventNum <<
'\t' <<
" "
319 << PreStepX <<
'\t' <<
" "
320 << PreStepY <<
'\t' <<
" "
321 << PreStepZ <<
'\t' <<
" "
322 << parentID <<
'\t' <<
" "
331 std::ofstream WriteDataBack(
"DatiFCGuardRingBack.out", std::ios::app);
332 WriteDataBack << eKin <<
'\t' <<
" "
333 << eventNum <<
'\t' <<
" "
334 << PreStepX <<
'\t' <<
" "
335 << PreStepY <<
'\t' <<
" "
336 << PreStepZ <<
'\t' <<
" "
337 << parentID <<
'\t' <<
" "
345 if (((namePost==
"PhysicVirtualMiddle") && (namePre!=
"PhysicVirtualMiddle")) &&
349 if ((PostStepX - PreStepX)>0)
355 std::ofstream WriteMDataIn(
"DatiFCMiddleIn.out", std::ios::app);
356 WriteMDataIn << eKin <<
'\t' <<
" "
357 << eventNum <<
'\t' <<
" "
358 << PostStepX <<
'\t' <<
" "
359 << PostStepY <<
'\t' <<
" "
360 << PostStepZ <<
'\t' <<
" "
361 << parentID <<
'\t' <<
" "
362 << trackID <<
'\t' <<
" "
370 std::ofstream WriteMDataBack(
"DatiFCMiddleBack.out", std::ios::app);
371 WriteMDataBack << eKin <<
'\t' <<
" "
372 << eventNum <<
'\t' <<
" "
373 << PostStepX <<
'\t' <<
" "
374 << PostStepY <<
'\t' <<
" "
375 << PostStepZ <<
'\t' <<
" "
376 << parentID <<
'\t' <<
" "
377 << trackID <<
'\t' <<
" "
385 if (((namePost==
"PhysicVirtualBottom") && (namePre!=
"PhysicVirtualBottom")) &&
389 if ((PostStepX - PreStepX)>0)
392 std::ofstream WriteDataIn(
"DatiFCBottomIn.out", std::ios::app);
393 WriteDataIn << eKin <<
'\t' <<
" "
394 << eventNum <<
'\t' <<
" "
395 << PostStepX <<
'\t' <<
" "
396 << PostStepY <<
'\t' <<
" "
397 << PostStepZ <<
'\t' <<
" "
398 << parentID <<
'\t' <<
" "
399 << trackID <<
'\t' <<
" "
409 std::ofstream WriteDataBack(
"DatiFCBottomBack.out", std::ios::app);
410 WriteDataBack << eKin <<
'\t' <<
" "
411 << eventNum <<
'\t' <<
" "
412 << PostStepX <<
'\t' <<
" "
413 << PostStepY <<
'\t' <<
" "
414 << PostStepZ <<
'\t' <<
" "
418 << parentID <<
'\t' <<
" "
419 << trackID <<
'\t' <<
" "
430 if (((namePost==
"PhysicCup") && (namePre!=
"PhysicCup")) &&
434 std::ofstream Carica(
"CaricaRaccolta.out", std::ios::app);
435 Carica << eKin <<
'\t' <<
" "
436 << eventNum <<
'\t' <<
" "
437 << PostStepX <<
'\t' <<
" "
438 << PostStepY <<
'\t' <<
" "
439 << PostStepZ <<
'\t' <<
" "
440 << parentID <<
'\t' <<
" "
441 << trackID <<
'\t' <<
" "
448 if (((namePost==
"PhysicFaradayCupBottom") && (namePre!=
"PhysicFaradayCupBottom"))&&
452 std::ofstream CaricaLatFC(
"CaricaRaccoltaLatFC.out", std::ios::app);
453 CaricaLatFC << eKin <<
'\t' <<
" "
454 << eventNum <<
'\t' <<
" "
455 << PostStepX <<
'\t' <<
" "
456 << PostStepY <<
'\t' <<
" "
457 << PostStepZ <<
'\t' <<
" "
458 << parentID <<
'\t' <<
" "
459 << trackID <<
'\t' <<
" "
470 if ((PostStepX - PreStepX)>0)
473 std::ofstream WriteDataIn(
"DatiFCConeBottomCupIn.out", std::ios::app);
474 WriteDataIn << eKin <<
'\t' <<
" "
475 << eventNum <<
'\t' <<
" "
476 << PreStepX <<
'\t' <<
" "
477 << PreStepY <<
'\t' <<
" "
478 << PreStepZ <<
'\t' <<
" "
479 << parentID <<
'\t' <<
" "
489 std::ofstream WriteDataBack(
"DatiFCConeBottomCupBack.out", std::ios::app);
490 WriteDataBack << eKin <<
'\t' <<
" "
491 << eventNum <<
'\t' <<
" "
492 << PreStepX <<
'\t' <<
" "
493 << PreStepY <<
'\t' <<
" "
494 << PreStepZ <<
'\t' <<
" "
495 << parentID <<
'\t' <<
" "
504 if ((namePre==
"PhysicVirtualOverBottom") &&
508 if ((PostStepX - PreStepX)>0)
514 std::ofstream WriteDataIn(
"DatiFCOverBottomIn.out", std::ios::app);
515 WriteDataIn << eKin <<
'\t' <<
" "
516 << eventNum <<
'\t' <<
" "
517 << PreStepX <<
'\t' <<
" "
518 << PreStepY <<
'\t' <<
" "
519 << PreStepZ <<
'\t' <<
" "
520 << parentID <<
'\t' <<
" "
521 << trackID <<
'\t' <<
" "
531 std::ofstream WriteDataBack(
"DatiFCOverBottomBack.out", std::ios::app);
532 WriteDataBack << eKin <<
'\t' <<
" "
533 << eventNum <<
'\t' <<
" "
534 << PreStepX <<
'\t' <<
" "
535 << PreStepY <<
'\t' <<
" "
536 << PreStepZ <<
'\t' <<
" "
537 << parentID <<
'\t' <<
" "
538 << trackID <<
'\t' <<
" "
550 if (((namePost==
"PhysicVirtualLateral") && (namePre!=
"PhysicVirtualLateral"))&&
555 std::ofstream WriteDataIn(
"DatiFCLateral.out", std::ios::app);
556 WriteDataIn << eKin <<
'\t' <<
" "
557 << eventNum <<
'\t' <<
" "
558 << PostStepX <<
'\t' <<
" "
559 << PostStepY <<
'\t' <<
" "
560 << PostStepZ <<
'\t' <<
" "
561 << parentID <<
'\t' <<
" "
562 << trackID <<
'\t' <<
" "
571 #ifdef G4ANALYSIS_USE_ROOT
576 if(particleType ==
"nucleus") {
585 analysisMgr->FillFragmentTuple(A, Z, energy, posX, posY, posZ);
586 }
else if(particleName ==
"proton") {
594 G4String secondaryParticleName = def -> GetParticleName();
599 if(secondaryParticleName ==
"proton") {
600 analysis->hydrogenEnergy(secondaryParticleKineticEnergy /
MeV);
602 if(secondaryParticleName ==
"deuteron") {
603 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) /
MeV);
605 if(secondaryParticleName ==
"triton") {
606 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) /
MeV);
608 if(secondaryParticleName ==
"alpha") {
609 analysis->heliumEnergy((secondaryParticleKineticEnergy/4) /
MeV);
611 if(secondaryParticleName ==
"He3"){
612 analysis->heliumEnergy((secondaryParticleKineticEnergy/3) /
MeV);
621 if ((aStep -> GetTrack() -> GetTrackID() == 1) &&
622 (aStep -> GetTrack() -> GetVolume() -> GetName() ==
"PhantomPhys") &&
623 (aStep -> GetPostStepPoint() -> GetProcessDefinedStep() != NULL))
625 G4String process = aStep -> GetPostStepPoint() ->
626 GetProcessDefinedStep() -> GetProcessName();
628 if ((process ==
"Transportation") || (process ==
"StepLimiter")) {;}
631 if ((process ==
"msc") || (process ==
"hLowEIoni") || (process ==
"hIoni"))
639 if ( (process !=
"LElastic") && (process !=
"ProtonInelastic") && (process !=
"hElastic") )
640 G4cout <<
"Warning! Unknown proton process: "<< process <<
G4endl;
653 G4TrackVector* fSecondary = steppingManager -> GetfSecondary();
655 for(
size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
657 G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName();
659 if (volumeName ==
"phantomPhys")
661 #ifdef G4ANALYSIS_USE_ROOT
662 G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
663 G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();
667 if (secondaryParticleName ==
"e-")
668 analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
670 if (secondaryParticleName ==
"gamma")
671 analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
673 if (secondaryParticleName ==
"deuteron")
674 analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
676 if (secondaryParticleName ==
"triton")
677 analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
679 if (secondaryParticleName ==
"alpha")
680 analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
682 G4double z = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();
685 G4int a = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber();
686 G4int electronOccupancy = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetTotalOccupancy();
690 analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/
MeV);
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
static HadrontherapyAnalysisManager * GetInstance()
Get the pointer to the analysis manager.
HadrontherapySteppingAction(HadrontherapyRunAction *)
G4StepStatus GetStepStatus() const
const G4ThreeVector & GetPosition() const
HadrontherapyRunAction * runAction
const G4String & GetParticleName() const
G4StepPoint * GetPreStepPoint() const
void UserSteppingAction(const G4Step *)
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
const G4String & GetName() const
const G4ThreeVector & GetPosition() const
G4SteppingManager * fpSteppingManager
const G4String & GetParticleType() const
static const G4double A[nN]
static G4RunManager * GetRunManager()
std::vector< G4Track * > G4TrackVector
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4double energy(const ThreeVector &p, const G4double m)
G4StepPoint * GetPostStepPoint() const
G4VPhysicalVolume * GetVolume() const
A class for connecting the simulation to an analysis package.
G4Track * GetTrack() const
G4double GetPDGCharge() const
const G4TouchableHandle & GetTouchableHandle() const
G4int GetBaryonNumber() const
~HadrontherapySteppingAction()