From 77ba3a16c152bb7b9bcdcf0e35288004d2bd38e4 Mon Sep 17 00:00:00 2001 From: Audrey Chatillon <audrey.chatillon@gmail.com> Date: Mon, 27 Jan 2025 18:08:07 +0100 Subject: [PATCH] [Epic] on-going fix-step size along z axis --- NPSimulation/Detectors/Epic/Epic.cc | 47 +++++++++++++------ .../Scorers/GaseousDetectorScorers.cc | 4 +- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/NPSimulation/Detectors/Epic/Epic.cc b/NPSimulation/Detectors/Epic/Epic.cc index f3673dff1..64a35e4f8 100644 --- a/NPSimulation/Detectors/Epic/Epic.cc +++ b/NPSimulation/Detectors/Epic/Epic.cc @@ -557,7 +557,6 @@ void Epic::ReadSensitive(const G4Event* ){ posZ_anode += m_mapping_A[Anode] * (2. * (m_Distance_AK*mm + m_Thickness_K*mm) + m_InterDistance_KK*mm + thickness_A) ; //// FIXME : need a fixed binning in dz of 25*um and in time - //// FIXME : one TrackID per input for TEpicData //// FIXME : fill another event class FasterData with only the vectors sorted in time @@ -566,21 +565,15 @@ void Epic::ReadSensitive(const G4Event* ){ string name_pertrackID = ""; double influence_pertrackID = 0; double time_pertrackID = -1; + + vector<double> dz; vector<double> de; vector<double> dt; - bool end_of_new_trackID = false ; cout << "step_name.size() = " << step_name.size() << endl; for(int j=0; j<step_name.size(); j++){ - //if(step_name.at(j)!="e-" && step_name.at(j)!="anti_nu_e"){ - // cout << " ======================================================================== " << endl; - // cout << "STEP #" << j << " Particle |" << step_name.at(j) << "|" << endl; - // cout << " " << " TrackID " << step_trackID.at(j) << " [previous " << previous_trackID - // << "] Actual m_Event mult : " << m_Event->GetMultiplicity() - // << " GetStepTime = " << step_time.at(j) << endl; - //} if(step_trackID.at(j) != previous_trackID){ //if(m_Event->GetMultiplicity()>0) end_of_new_trackID = true; if(previous_trackID != -1) end_of_new_trackID = true; @@ -588,30 +581,51 @@ void Epic::ReadSensitive(const G4Event* ){ trackID = step_trackID.at(j); name_pertrackID = step_name.at(j); time_pertrackID = step_time.at(j); + } previous_trackID = step_trackID.at(j) ; } if(end_of_new_trackID == true || j==step_name.size()-1) { if(name_pertrackID!="e-" && name_pertrackID!="anti_nu_e"){ - //cout << "TEpicData m_Event->Set() : TrackID #" << trackID << " |" << name_pertrackID << "| influence = " << influence_pertrackID << " and time at " << time_pertrackID << endl; + //cout << "================================================" << endl; + //cout << "TrackID " << trackID << " time_pertrackID = " << time_pertrackID << endl; + //int num_bins = (int)(std::ceil( (m_Distance_AK-dz.at(dz.size()-1)) / (25.*um) )) ; + //vector<double> rebinned_dz; rebinned_dz.resize(num_bins); + //vector<double> rebinned_de; rebinned_de.assign(num_bins, 0.0); + //vector<double> rebinned_dt; rebinned_dt.resize(num_bins); + //int bin_first = 0; + //rebinned_de[0] += de.at(0); + //cout << " step #0 de = " << de.at(0) << " dz = " << dz.at(0) << endl; + //for(int step=1; step<dz.size(); step++){ + //cout << " step #" << step << " de = " << de.at(step) << " dz = " << dz.at(step) << endl; + //for(int bin=0; bin<num_bins-1; bin++){ + //double dzmax= m_Distance_AK*mm - bin * (25.*um); + //double dzmin= m_Distance_AK*mm - (bin+1) * (25.*um); + // full bin is in step + //if(dzmin <= dz.at(step) && dz.at(step) < dzmax){ + //cout << "bin = " << bin << " dz in [" << dzmin << " ; " << dzmax << "]" << endl; + //} + //} + //} + //for(int i = 0 ; i< num_bins; i++) cout << "rebinned_de[" << i << "] = " << rebinned_de.at(i) << endl; m_Event->Set(trackID, name_pertrackID, m_mapping_A[Anode], // set anode number influence_pertrackID, // set Q1 FF or alpha only time_pertrackID, // set Time dz, de, dt); - dz.clear(); - de.clear(); - dt.clear(); + // rebinned_dz, rebinned_de, rebinned_dt); } trackID = step_trackID.at(j); name_pertrackID = step_name.at(j); influence_pertrackID = 0; time_pertrackID = step_time.at(j); + dz.clear(); + de.clear(); + dt.clear(); end_of_new_trackID = false; } - double dz_anode = TMath::Abs(step_posZ.at(j) - posZ_anode) - 0.5*thickness_A ; // need to remove half thickness of Anode influence_pertrackID += (step_DE.at(j) * dz_anode) / m_Distance_AK*mm; dz.push_back(dz_anode); @@ -622,7 +636,10 @@ void Epic::ReadSensitive(const G4Event* ){ //// FIXME : fill the FasterData if(m_Event->GetMultiplicity()>0){ - // fill clean-up data to FasterData + // fill clean-up data to FasterData sorted with time and not position + vector<double> dt_allTracks; + vector<double> dz_allTracks; + vector<double> de_allTracks; } } diff --git a/NPSimulation/Scorers/GaseousDetectorScorers.cc b/NPSimulation/Scorers/GaseousDetectorScorers.cc index cc1bc635a..a98c7dd6b 100644 --- a/NPSimulation/Scorers/GaseousDetectorScorers.cc +++ b/NPSimulation/Scorers/GaseousDetectorScorers.cc @@ -76,8 +76,8 @@ G4bool PS_GaseousDetector::ProcessHits(G4Step* aStep, G4TouchableHistory*) { //if (particlename != "alpha") return TRUE; int trackID = aStep->GetTrack()->GetTrackID(); - double step_posZ = aStep->GetPreStepPoint()->GetPosition().z(); - t_Energy = aStep->GetTotalEnergyDeposit(); + double step_posZ = aStep->GetPostStepPoint()->GetPosition().z(); // z coordinate at the end of the step. + t_Energy = aStep->GetTotalEnergyDeposit(); t_Time = aStep->GetPreStepPoint()->GetGlobalTime(); // DeltaT [ns] since the begining of the simulated event up to the begining of the step t_ParticleName.push_back(particlename); t_TrackID.push_back(trackID); -- GitLab