90 namePost = volumePost->
GetName();
95 G4double eKin = aStep -> GetPreStepPoint() -> GetKineticEnergy();
103 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"))
133 WriteDataIn << eKin <<
'\t' <<
" "
134 << eventNum <<
'\t' <<
" "
135 << PosX <<
'\t' <<
" "
136 << PosY <<
'\t' <<
" "
137 << PosZ <<
'\t' <<
" "
155 if ((namePre==
"PhysicEntranceWindow") &&
159 WriteDataIn << eKin <<
'\t' <<
" "
160 << eventNum <<
'\t' <<
" "
161 << PreStepX <<
'\t' <<
" "
162 << PreStepY <<
'\t' <<
" "
163 << PreStepZ <<
'\t' <<
" "
164 << parentID <<
'\t' <<
" "
165 << trackID <<
'\t' <<
" "
176 WriteDataBack << eKin <<
'\t' <<
" "
177 << eventNum <<
'\t' <<
" "
178 << PreStepX <<
'\t' <<
" "
179 << PreStepY <<
'\t' <<
" "
180 << PreStepZ <<
'\t' <<
" "
181 << parentID <<
'\t' <<
" "
182 << trackID <<
'\t' <<
" "
191 if (((namePost==
"PhysicVirtualWindow") && (namePre!=
"PhysicVirtualWindow")) &&
195 if ((PostStepX - PreStepX)>0)
204 std::ofstream WriteDataIn(
"DatiFCWindowIn.out",
std::ios::app);
205 WriteDataIn << eKin <<
'\t' <<
" "
206 << eventNum <<
'\t' <<
" "
207 << PostStepX <<
'\t' <<
" "
208 << PostStepY <<
'\t' <<
" "
209 << PostStepZ <<
'\t' <<
" "
213 << parentID <<
'\t' <<
" "
214 << trackID <<
'\t' <<
" "
224 std::ofstream WriteDataBack(
"DatiFCWindowBack.out",
std::ios::app);
225 WriteDataBack << eKin <<
'\t' <<
" "
226 << eventNum <<
'\t' <<
" "
227 << PostStepX <<
'\t' <<
" "
228 << PostStepY <<
'\t' <<
" "
229 << PostStepZ <<
'\t' <<
" "
230 << parentID <<
'\t' <<
" "
231 << trackID <<
'\t' <<
" "
268 if (((namePost==
"PhysicVirtualWindow") && (namePre!=
"PhysicVirtualWindow")) &&
282 std::ofstream WriteData(
"DatiFCAfterWindowProton.out",
std::ios::app);
283 WriteData << eKin <<
'\t' <<
" "
284 << eventNum <<
'\t' <<
" "
285 << PostStepX <<
'\t' <<
" "
286 << PostStepY <<
'\t' <<
" "
287 << PostStepZ <<
'\t' <<
" "
288 << parentID <<
'\t' <<
" "
289 << trackID <<
'\t' <<
" "
300 if ((namePre==
"PhysicGuardRing") &&
304 if ((PostStepX - PreStepX)>0)
308 std::ofstream WriteDataIn(
"DatiFCGuardRingIn.out",
std::ios::app);
309 WriteDataIn << eKin <<
'\t' <<
" "
310 << eventNum <<
'\t' <<
" "
311 << PreStepX <<
'\t' <<
" "
312 << PreStepY <<
'\t' <<
" "
313 << PreStepZ <<
'\t' <<
" "
314 << parentID <<
'\t' <<
" "
323 std::ofstream WriteDataBack(
"DatiFCGuardRingBack.out",
std::ios::app);
324 WriteDataBack << eKin <<
'\t' <<
" "
325 << eventNum <<
'\t' <<
" "
326 << PreStepX <<
'\t' <<
" "
327 << PreStepY <<
'\t' <<
" "
328 << PreStepZ <<
'\t' <<
" "
329 << parentID <<
'\t' <<
" "
337 if (((namePost==
"PhysicVirtualMiddle") && (namePre!=
"PhysicVirtualMiddle")) &&
341 if ((PostStepX - PreStepX)>0)
347 std::ofstream WriteMDataIn(
"DatiFCMiddleIn.out",
std::ios::app);
348 WriteMDataIn << eKin <<
'\t' <<
" "
349 << eventNum <<
'\t' <<
" "
350 << PostStepX <<
'\t' <<
" "
351 << PostStepY <<
'\t' <<
" "
352 << PostStepZ <<
'\t' <<
" "
353 << parentID <<
'\t' <<
" "
354 << trackID <<
'\t' <<
" "
362 std::ofstream WriteMDataBack(
"DatiFCMiddleBack.out",
std::ios::app);
363 WriteMDataBack << eKin <<
'\t' <<
" "
364 << eventNum <<
'\t' <<
" "
365 << PostStepX <<
'\t' <<
" "
366 << PostStepY <<
'\t' <<
" "
367 << PostStepZ <<
'\t' <<
" "
368 << parentID <<
'\t' <<
" "
369 << trackID <<
'\t' <<
" "
377 if (((namePost==
"PhysicVirtualBottom") && (namePre!=
"PhysicVirtualBottom")) &&
381 if ((PostStepX - PreStepX)>0)
384 std::ofstream WriteDataIn(
"DatiFCBottomIn.out",
std::ios::app);
385 WriteDataIn << eKin <<
'\t' <<
" "
386 << eventNum <<
'\t' <<
" "
387 << PostStepX <<
'\t' <<
" "
388 << PostStepY <<
'\t' <<
" "
389 << PostStepZ <<
'\t' <<
" "
390 << parentID <<
'\t' <<
" "
391 << trackID <<
'\t' <<
" "
401 std::ofstream WriteDataBack(
"DatiFCBottomBack.out",
std::ios::app);
402 WriteDataBack << eKin <<
'\t' <<
" "
403 << eventNum <<
'\t' <<
" "
404 << PostStepX <<
'\t' <<
" "
405 << PostStepY <<
'\t' <<
" "
406 << PostStepZ <<
'\t' <<
" "
410 << parentID <<
'\t' <<
" "
411 << trackID <<
'\t' <<
" "
422 if (((namePost==
"PhysicCup") && (namePre!=
"PhysicCup")) &&
427 Carica << eKin <<
'\t' <<
" "
428 << eventNum <<
'\t' <<
" "
429 << PostStepX <<
'\t' <<
" "
430 << PostStepY <<
'\t' <<
" "
431 << PostStepZ <<
'\t' <<
" "
432 << parentID <<
'\t' <<
" "
433 << trackID <<
'\t' <<
" "
440 if (((namePost==
"PhysicFaradayCupBottom") && (namePre!=
"PhysicFaradayCupBottom"))&&
444 std::ofstream CaricaLatFC(
"CaricaRaccoltaLatFC.out",
std::ios::app);
445 CaricaLatFC << eKin <<
'\t' <<
" "
446 << eventNum <<
'\t' <<
" "
447 << PostStepX <<
'\t' <<
" "
448 << PostStepY <<
'\t' <<
" "
449 << PostStepZ <<
'\t' <<
" "
450 << parentID <<
'\t' <<
" "
451 << trackID <<
'\t' <<
" "
462 if ((PostStepX - PreStepX)>0)
465 std::ofstream WriteDataIn(
"DatiFCConeBottomCupIn.out",
std::ios::app);
466 WriteDataIn << eKin <<
'\t' <<
" "
467 << eventNum <<
'\t' <<
" "
468 << PreStepX <<
'\t' <<
" "
469 << PreStepY <<
'\t' <<
" "
470 << PreStepZ <<
'\t' <<
" "
471 << parentID <<
'\t' <<
" "
481 std::ofstream WriteDataBack(
"DatiFCConeBottomCupBack.out",
std::ios::app);
482 WriteDataBack << eKin <<
'\t' <<
" "
483 << eventNum <<
'\t' <<
" "
484 << PreStepX <<
'\t' <<
" "
485 << PreStepY <<
'\t' <<
" "
486 << PreStepZ <<
'\t' <<
" "
487 << parentID <<
'\t' <<
" "
496 if ((namePre==
"PhysicVirtualOverBottom") &&
500 if ((PostStepX - PreStepX)>0)
506 std::ofstream WriteDataIn(
"DatiFCOverBottomIn.out",
std::ios::app);
507 WriteDataIn << eKin <<
'\t' <<
" "
508 << eventNum <<
'\t' <<
" "
509 << PreStepX <<
'\t' <<
" "
510 << PreStepY <<
'\t' <<
" "
511 << PreStepZ <<
'\t' <<
" "
512 << parentID <<
'\t' <<
" "
513 << trackID <<
'\t' <<
" "
523 std::ofstream WriteDataBack(
"DatiFCOverBottomBack.out",
std::ios::app);
524 WriteDataBack << eKin <<
'\t' <<
" "
525 << eventNum <<
'\t' <<
" "
526 << PreStepX <<
'\t' <<
" "
527 << PreStepY <<
'\t' <<
" "
528 << PreStepZ <<
'\t' <<
" "
529 << parentID <<
'\t' <<
" "
530 << trackID <<
'\t' <<
" "
542 if (((namePost==
"PhysicVirtualLateral") && (namePre!=
"PhysicVirtualLateral"))&&
547 std::ofstream WriteDataIn(
"DatiFCLateral.out",
std::ios::app);
548 WriteDataIn << eKin <<
'\t' <<
" "
549 << eventNum <<
'\t' <<
" "
550 << PostStepX <<
'\t' <<
" "
551 << PostStepY <<
'\t' <<
" "
552 << PostStepZ <<
'\t' <<
" "
553 << parentID <<
'\t' <<
" "
554 << trackID <<
'\t' <<
" "
563 #ifdef G4ANALYSIS_USE_ROOT
568 if(particleType ==
"nucleus") {
577 analysisMgr->FillFragmentTuple(A, Z, energy, posX, posY, posZ);
578 }
else if(particleName ==
"proton") {
586 G4String secondaryParticleName = def -> GetParticleName();
591 if(secondaryParticleName ==
"proton") {
592 analysis->hydrogenEnergy(secondaryParticleKineticEnergy /
MeV);
594 if(secondaryParticleName ==
"deuteron") {
595 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) /
MeV);
597 if(secondaryParticleName ==
"triton") {
598 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) /
MeV);
600 if(secondaryParticleName ==
"alpha") {
601 analysis->heliumEnergy((secondaryParticleKineticEnergy/4) /
MeV);
603 if(secondaryParticleName ==
"He3"){
604 analysis->heliumEnergy((secondaryParticleKineticEnergy/3) /
MeV);
613 if ((aStep -> GetTrack() -> GetTrackID() == 1) &&
614 (aStep -> GetTrack() -> GetVolume() -> GetName() ==
"PhantomPhys") &&
615 (aStep -> GetPostStepPoint() -> GetProcessDefinedStep() != NULL))
617 G4String process = aStep -> GetPostStepPoint() ->
618 GetProcessDefinedStep() -> GetProcessName();
620 if ((process ==
"Transportation") || (process ==
"StepLimiter")) {;}
623 if ((process ==
"msc") || (process ==
"hLowEIoni") || (process ==
"hIoni"))
625 runAction -> AddEMProcess();
629 runAction -> AddHadronicProcess();
631 if ( (process !=
"LElastic") && (process !=
"ProtonInelastic") && (process !=
"hElastic") )
632 G4cout <<
"Warning! Unknown proton process: "<< process <<
G4endl;
645 G4TrackVector* fSecondary = steppingManager -> GetfSecondary();
647 for(
size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
649 G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName();
651 if (volumeName ==
"phantomPhys")
653 #ifdef G4ANALYSIS_USE_ROOT
654 G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
655 G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();
659 if (secondaryParticleName ==
"e-")
660 analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
662 if (secondaryParticleName ==
"gamma")
663 analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
665 if (secondaryParticleName ==
"deuteron")
666 analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
668 if (secondaryParticleName ==
"triton")
669 analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
671 if (secondaryParticleName ==
"alpha")
672 analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
674 G4double z = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();
677 G4int a = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber();
678 G4int electronOccupancy = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetTotalOccupancy();
682 analysis -> genericIonInformation(a, z, electronOccupancy, secondaryParticleKineticEnergy/
MeV);
void SetTrackStatus(const G4TrackStatus aTrackStatus)
G4ParticleDefinition * GetDefinition() const
G4int GetParentID() const
static HadrontherapyAnalysisManager * GetInstance()
HadrontherapySteppingAction(HadrontherapyRunAction *)
std::vector< ExP01TrackerHit * > a
G4StepStatus GetStepStatus() const
const G4ThreeVector & GetPosition() const
const G4String & GetParticleName() const
G4StepPoint * GetPreStepPoint() const
void UserSteppingAction(const G4Step *)
G4double GetKineticEnergy() const
G4GLOB_DLL std::ostream G4cout
double A(double temperature)
const G4String & GetName() const
const G4ThreeVector & GetPosition() const
G4SteppingManager * fpSteppingManager
static constexpr double cm
const G4String & GetParticleType() const
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
static constexpr double MeV
G4Track * GetTrack() const
G4double GetPDGCharge() const
const G4TouchableHandle & GetTouchableHandle() const
G4int GetBaryonNumber() const
~HadrontherapySteppingAction()