12 #include "G4StepPoint.hh"
14 #include "G4VProcess.hh"
24 : m_stepL(nullptr), m_stepProc(nullptr), m_mscAngle(nullptr),
25 m_stepELoss(nullptr), m_secE(nullptr),
26 m_latPhi(nullptr), m_latEta(nullptr), m_EvsR(nullptr),
27 m_prim(nullptr), m_sec(nullptr),
28 m_primH(0), m_primF(0), m_dh(0), m_dh2(0), m_dp(0), m_dp2(0), m_nsec(0)
46 _SET_TITLE(
m_stepL,
"Step length distribution",
"Step length [log(mm)]",
"Steps");
50 _SET_TITLE(
m_secE,
"Secondary energy distribution",
"Energy [log(MeV)]",
"Secondaries");
51 _SET_TITLE(
m_EvsR,
"Primary Energy vs Radius",
"Radius [m]",
"Primary Energy [MeV]");
52 _SET_TITLE(
m_latPhi,
"Phi energy distribution",
"Energy-weighted #phi RMS",
"Primaries");
53 _SET_TITLE(
m_latEta,
"Eta energy distribution",
"Energy-weighted #eta RMS",
"Primaries");
79 m_stepProc->Fill( aStep->GetPostStepPoint()->GetProcessDefinedStep()->
83 m_stepELoss->Fill( log10(aStep->GetTotalEnergyDeposit()) );
86 m_stepL->Fill( log10( aStep->GetStepLength() ) );
89 auto* preStepPoint = aStep->GetPreStepPoint();
90 auto* postStepPoint = aStep->GetPostStepPoint();
92 m_prim = aStep->GetTrack();
95 else if (aStep->GetTrack()!=
m_prim && aStep->GetTrack()!=
m_sec){
96 m_secE->Fill( log10(preStepPoint->GetTotalEnergy()) );
97 m_sec = aStep->GetTrack();
101 if (postStepPoint->GetProcessDefinedStep()->GetProcessType()==1){
102 if (
m_prim==aStep->GetTrack()){
103 double angle = std::acos(
104 preStepPoint->GetMomentumDirection().dot(
105 postStepPoint->GetMomentumDirection() ) );
107 m_EvsR->Fill( postStepPoint->GetPosition().perp()*0.001,
108 aStep->GetTrack()->GetTotalEnergy() );
112 if (aStep->GetTrack()->GetNextVolume()==0){
114 if (
m_prim==aStep->GetTrack()){
115 m_primH = postStepPoint->GetPosition().eta();
116 m_primF = postStepPoint->GetPosition().phi();
118 m_dh += (postStepPoint->GetPosition().eta() -
m_primH )*aStep->GetTrack()->GetTotalEnergy();
119 m_dh2 +=
std::pow(postStepPoint->GetPosition().eta() -
m_primH,2)*aStep->GetTrack()->GetTotalEnergy();
120 m_dp += (postStepPoint->GetPosition().phi() -
m_primF )*aStep->GetTrack()->GetTotalEnergy();
121 m_dp2 +=
std::pow(postStepPoint->GetPosition().phi() -
m_primF,2)*aStep->GetTrack()->GetTotalEnergy();
122 m_nsec += aStep->GetTrack()->GetTotalEnergy();