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' <<
" "
157 if ((namePre==
"PhysicEntranceWindow") &&
160 std::ofstream WriteDataIn(
"finestra.out", std::ios::app);
161 WriteDataIn << eKin <<
'\t' <<
" "
162 << eventNum <<
'\t' <<
" "
163 << PreStepX <<
'\t' <<
" "
164 << PreStepY <<
'\t' <<
" "
165 << PreStepZ <<
'\t' <<
" "
166 << parentID <<
'\t' <<
" "
167 << trackID <<
'\t' <<
" "
177 std::ofstream WriteDataBack(
"fondo.out", std::ios::app);
178 WriteDataBack << eKin <<
'\t' <<
" "
179 << eventNum <<
'\t' <<
" "
180 << PreStepX <<
'\t' <<
" "
181 << PreStepY <<
'\t' <<
" "
182 << PreStepZ <<
'\t' <<
" "
183 << parentID <<
'\t' <<
" "
184 << trackID <<
'\t' <<
" "
193 if (((namePost==
"PhysicVirtualWindow") && (namePre!=
"PhysicVirtualWindow")) &&
197 if ((PostStepX - PreStepX)>0)
206 std::ofstream WriteDataIn(
"DatiFCWindowIn.out", std::ios::app);
207 WriteDataIn << eKin <<
'\t' <<
" "
208 << eventNum <<
'\t' <<
" "
209 << PostStepX <<
'\t' <<
" "
210 << PostStepY <<
'\t' <<
" "
211 << PostStepZ <<
'\t' <<
" "
215 << parentID <<
'\t' <<
" "
216 << trackID <<
'\t' <<
" "
226 std::ofstream WriteDataBack(
"DatiFCWindowBack.out", std::ios::app);
227 WriteDataBack << eKin <<
'\t' <<
" "
228 << eventNum <<
'\t' <<
" "
229 << PostStepX <<
'\t' <<
" "
230 << PostStepY <<
'\t' <<
" "
231 << PostStepZ <<
'\t' <<
" "
232 << parentID <<
'\t' <<
" "
233 << trackID <<
'\t' <<
" "
270 if (((namePost==
"PhysicVirtualWindow") && (namePre!=
"PhysicVirtualWindow")) &&
284 std::ofstream WriteData(
"DatiFCAfterWindowProton.out", std::ios::app);
285 WriteData << eKin <<
'\t' <<
" "
286 << eventNum <<
'\t' <<
" "
287 << PostStepX <<
'\t' <<
" "
288 << PostStepY <<
'\t' <<
" "
289 << PostStepZ <<
'\t' <<
" "
290 << parentID <<
'\t' <<
" "
291 << trackID <<
'\t' <<
" "
302 if ((namePre==
"PhysicGuardRing") &&
306 if ((PostStepX - PreStepX)>0)
310 std::ofstream WriteDataIn(
"DatiFCGuardRingIn.out", std::ios::app);
311 WriteDataIn << eKin <<
'\t' <<
" "
312 << eventNum <<
'\t' <<
" "
313 << PreStepX <<
'\t' <<
" "
314 << PreStepY <<
'\t' <<
" "
315 << PreStepZ <<
'\t' <<
" "
316 << parentID <<
'\t' <<
" "
325 std::ofstream WriteDataBack(
"DatiFCGuardRingBack.out", std::ios::app);
326 WriteDataBack << eKin <<
'\t' <<
" "
327 << eventNum <<
'\t' <<
" "
328 << PreStepX <<
'\t' <<
" "
329 << PreStepY <<
'\t' <<
" "
330 << PreStepZ <<
'\t' <<
" "
331 << parentID <<
'\t' <<
" "
339 if (((namePost==
"PhysicVirtualMiddle") && (namePre!=
"PhysicVirtualMiddle")) &&
343 if ((PostStepX - PreStepX)>0)
349 std::ofstream WriteMDataIn(
"DatiFCMiddleIn.out", std::ios::app);
350 WriteMDataIn << eKin <<
'\t' <<
" "
351 << eventNum <<
'\t' <<
" "
352 << PostStepX <<
'\t' <<
" "
353 << PostStepY <<
'\t' <<
" "
354 << PostStepZ <<
'\t' <<
" "
355 << parentID <<
'\t' <<
" "
356 << trackID <<
'\t' <<
" "
364 std::ofstream WriteMDataBack(
"DatiFCMiddleBack.out", std::ios::app);
365 WriteMDataBack << eKin <<
'\t' <<
" "
366 << eventNum <<
'\t' <<
" "
367 << PostStepX <<
'\t' <<
" "
368 << PostStepY <<
'\t' <<
" "
369 << PostStepZ <<
'\t' <<
" "
370 << parentID <<
'\t' <<
" "
371 << trackID <<
'\t' <<
" "
379 if (((namePost==
"PhysicVirtualBottom") && (namePre!=
"PhysicVirtualBottom")) &&
383 if ((PostStepX - PreStepX)>0)
386 std::ofstream WriteDataIn(
"DatiFCBottomIn.out", std::ios::app);
387 WriteDataIn << eKin <<
'\t' <<
" "
388 << eventNum <<
'\t' <<
" "
389 << PostStepX <<
'\t' <<
" "
390 << PostStepY <<
'\t' <<
" "
391 << PostStepZ <<
'\t' <<
" "
392 << parentID <<
'\t' <<
" "
393 << trackID <<
'\t' <<
" "
403 std::ofstream WriteDataBack(
"DatiFCBottomBack.out", std::ios::app);
404 WriteDataBack << eKin <<
'\t' <<
" "
405 << eventNum <<
'\t' <<
" "
406 << PostStepX <<
'\t' <<
" "
407 << PostStepY <<
'\t' <<
" "
408 << PostStepZ <<
'\t' <<
" "
412 << parentID <<
'\t' <<
" "
413 << trackID <<
'\t' <<
" "
424 if (((namePost==
"PhysicCup") && (namePre!=
"PhysicCup")) &&
428 std::ofstream Carica(
"CaricaRaccolta.out", std::ios::app);
429 Carica << eKin <<
'\t' <<
" "
430 << eventNum <<
'\t' <<
" "
431 << PostStepX <<
'\t' <<
" "
432 << PostStepY <<
'\t' <<
" "
433 << PostStepZ <<
'\t' <<
" "
434 << parentID <<
'\t' <<
" "
435 << trackID <<
'\t' <<
" "
442 if (((namePost==
"PhysicFaradayCupBottom") && (namePre!=
"PhysicFaradayCupBottom"))&&
446 std::ofstream CaricaLatFC(
"CaricaRaccoltaLatFC.out", std::ios::app);
447 CaricaLatFC << eKin <<
'\t' <<
" "
448 << eventNum <<
'\t' <<
" "
449 << PostStepX <<
'\t' <<
" "
450 << PostStepY <<
'\t' <<
" "
451 << PostStepZ <<
'\t' <<
" "
452 << parentID <<
'\t' <<
" "
453 << trackID <<
'\t' <<
" "
464 if ((PostStepX - PreStepX)>0)
467 std::ofstream WriteDataIn(
"DatiFCConeBottomCupIn.out", std::ios::app);
468 WriteDataIn << eKin <<
'\t' <<
" "
469 << eventNum <<
'\t' <<
" "
470 << PreStepX <<
'\t' <<
" "
471 << PreStepY <<
'\t' <<
" "
472 << PreStepZ <<
'\t' <<
" "
473 << parentID <<
'\t' <<
" "
483 std::ofstream WriteDataBack(
"DatiFCConeBottomCupBack.out", std::ios::app);
484 WriteDataBack << eKin <<
'\t' <<
" "
485 << eventNum <<
'\t' <<
" "
486 << PreStepX <<
'\t' <<
" "
487 << PreStepY <<
'\t' <<
" "
488 << PreStepZ <<
'\t' <<
" "
489 << parentID <<
'\t' <<
" "
498 if ((namePre==
"PhysicVirtualOverBottom") &&
502 if ((PostStepX - PreStepX)>0)
508 std::ofstream WriteDataIn(
"DatiFCOverBottomIn.out", std::ios::app);
509 WriteDataIn << eKin <<
'\t' <<
" "
510 << eventNum <<
'\t' <<
" "
511 << PreStepX <<
'\t' <<
" "
512 << PreStepY <<
'\t' <<
" "
513 << PreStepZ <<
'\t' <<
" "
514 << parentID <<
'\t' <<
" "
515 << trackID <<
'\t' <<
" "
525 std::ofstream WriteDataBack(
"DatiFCOverBottomBack.out", std::ios::app);
526 WriteDataBack << eKin <<
'\t' <<
" "
527 << eventNum <<
'\t' <<
" "
528 << PreStepX <<
'\t' <<
" "
529 << PreStepY <<
'\t' <<
" "
530 << PreStepZ <<
'\t' <<
" "
531 << parentID <<
'\t' <<
" "
532 << trackID <<
'\t' <<
" "
544 if (((namePost==
"PhysicVirtualLateral") && (namePre!=
"PhysicVirtualLateral"))&&
549 std::ofstream WriteDataIn(
"DatiFCLateral.out", std::ios::app);
550 WriteDataIn << eKin <<
'\t' <<
" "
551 << eventNum <<
'\t' <<
" "
552 << PostStepX <<
'\t' <<
" "
553 << PostStepY <<
'\t' <<
" "
554 << PostStepZ <<
'\t' <<
" "
555 << parentID <<
'\t' <<
" "
556 << trackID <<
'\t' <<
" "
565 #ifdef G4ANALYSIS_USE_ROOT
570 if(particleType ==
"nucleus") {
579 analysisMgr->FillFragmentTuple(A, Z, energy, posX, posY, posZ);
580 }
else if(particleName ==
"proton") {
588 G4String secondaryParticleName = def -> GetParticleName();
593 if(secondaryParticleName ==
"proton") {
594 analysis->hydrogenEnergy(secondaryParticleKineticEnergy /
MeV);
596 if(secondaryParticleName ==
"deuteron") {
597 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/2) /
MeV);
599 if(secondaryParticleName ==
"triton") {
600 analysis->hydrogenEnergy((secondaryParticleKineticEnergy/3) /
MeV);
602 if(secondaryParticleName ==
"alpha") {
603 analysis->heliumEnergy((secondaryParticleKineticEnergy/4) /
MeV);
605 if(secondaryParticleName ==
"He3"){
606 analysis->heliumEnergy((secondaryParticleKineticEnergy/3) /
MeV);
615 if ((aStep -> GetTrack() -> GetTrackID() == 1) &&
616 (aStep -> GetTrack() -> GetVolume() -> GetName() ==
"PhantomPhys") &&
617 (aStep -> GetPostStepPoint() -> GetProcessDefinedStep() != NULL))
619 G4String process = aStep -> GetPostStepPoint() ->
620 GetProcessDefinedStep() -> GetProcessName();
622 if ((process ==
"Transportation") || (process ==
"StepLimiter")) {;}
625 if ((process ==
"msc") || (process ==
"hLowEIoni") || (process ==
"hIoni"))
633 if ( (process !=
"LElastic") && (process !=
"ProtonInelastic") && (process !=
"hElastic") )
634 G4cout <<
"Warning! Unknown proton process: "<< process <<
G4endl;
647 G4TrackVector* fSecondary = steppingManager -> GetfSecondary();
649 for(
size_t lp1=0;lp1<(*fSecondary).size(); lp1++)
651 G4String volumeName = (*fSecondary)[lp1] -> GetVolume() -> GetName();
653 if (volumeName ==
"phantomPhys")
655 #ifdef G4ANALYSIS_USE_ROOT
656 G4String secondaryParticleName = (*fSecondary)[lp1]->GetDefinition() -> GetParticleName();
657 G4double secondaryParticleKineticEnergy = (*fSecondary)[lp1] -> GetKineticEnergy();
661 if (secondaryParticleName ==
"e-")
662 analysis -> electronEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
664 if (secondaryParticleName ==
"gamma")
665 analysis -> gammaEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
667 if (secondaryParticleName ==
"deuteron")
668 analysis -> deuteronEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
670 if (secondaryParticleName ==
"triton")
671 analysis -> tritonEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
673 if (secondaryParticleName ==
"alpha")
674 analysis -> alphaEnergyDistribution(secondaryParticleKineticEnergy/
MeV);
676 G4double z = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetPDGCharge();
679 G4int a = (*fSecondary)[lp1]-> GetDynamicParticle() -> GetDefinition() -> GetBaryonNumber();
680 G4int electronOccupancy = (*fSecondary)[lp1] -> GetDynamicParticle() -> GetTotalOccupancy();
684 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()