From 98c8cb83ef62f1d95d95bf053d05dd3ea69cf7d7 Mon Sep 17 00:00:00 2001 From: lheitz <heitz@ijclab.in2p3.fr> Date: Mon, 3 Jun 2024 14:50:51 +0200 Subject: [PATCH] Back to previous PS_Rectangle --- NPSimulation/Scorers/DSSDScorers.cc | 73 ++++------------------------- NPSimulation/Scorers/DSSDScorers.hh | 10 +--- 2 files changed, 11 insertions(+), 72 deletions(-) diff --git a/NPSimulation/Scorers/DSSDScorers.cc b/NPSimulation/Scorers/DSSDScorers.cc index 8e70bb11c..c1cc74934 100644 --- a/NPSimulation/Scorers/DSSDScorers.cc +++ b/NPSimulation/Scorers/DSSDScorers.cc @@ -22,21 +22,7 @@ #include "DSSDScorers.hh" #include "G4UnitsTable.hh" using namespace DSSDScorers; -/* -vector<DSSDData>::iterator DSSDDataVector::find(const unsigned int& index, const double& time , const double TimeThreshold = 0) { - for (vector<DSSDData>::iterator it = m_Data.begin(); it != m_Data.end(); it++) { - G4bool checkIndex =(*it).GetIndex() == index; - G4bool checkTime = 1; - if (TimeThreshold>0) - { - checkTime = std::abs((*it).GetTime() - time) < TimeThreshold; - }; - if (checkIndex & checkTime) - return it; //Autre possibilité : rajouter Temps en argument, + check *it.GetTime() == Temps) - } - return m_Data.end(); -} -*/ + vector<DSSDData>::iterator DSSDDataVector::find(const unsigned int& index) { for (vector<DSSDData>::iterator it = m_Data.begin(); it != m_Data.end(); it++) { if ((*it).GetIndex() == index) @@ -44,27 +30,7 @@ vector<DSSDData>::iterator DSSDDataVector::find(const unsigned int& index) { } return m_Data.end(); } -/* -vector<DSSDData>::iterator DSSDDataVector::find(const unsigned int& index) { - for (vector<DSSDData>::iterator it = m_Data.begin(); it != m_Data.end(); it++) { - G4bool checkIndex =(*it).GetIndex() == index; - if (checkIndex) - return it; //Autre possibilité : rajouter Temps en argument, + check *it.GetTime() == Temps) - } - return m_Data.end(); -} -*/ -/* -vector<DSSDData>::iterator DSSDDataVector::findTime(const unsigned int& index, const double& time, const double thresh = 1000* ns) { - for (vector<DSSDData>::iterator it = m_Data.begin(); it != m_Data.end(); it++) { - G4bool checkIndex =(*it).GetIndex() == index; - G4bool checkTime = std::abs((*it).GetTime() - time) < thresh; - if ( checkIndex && checkTime) - return it; //Autre possibilité : rajouter Temps en argument, + check *it.GetTime() == Temps) - } - return m_Data.end(); -} -*/ + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... PS_Images::PS_Images(G4String name, string imageFront, string imageBack, double scalingFront, double scalingBack, @@ -182,8 +148,7 @@ void PS_Images::GetARGBBack(unsigned int& i, unsigned int& a, unsigned int& r, u //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... PS_Rectangle::PS_Rectangle(G4String name, G4int Level, G4double StripPlaneLength, G4double StripPlaneWidth, - G4int NumberOfStripLength, G4int NumberOfStripWidth, G4int depth, G4String axis, - G4double TimeThreshold, G4double InterStripLength, G4double InterStripWidth) + G4int NumberOfStripLength, G4int NumberOfStripWidth, G4int depth, G4String axis) : G4VPrimitiveScorer(name, depth) { m_StripPlaneLength = StripPlaneLength; @@ -193,9 +158,6 @@ PS_Rectangle::PS_Rectangle(G4String name, G4int Level, G4double StripPlaneLength m_StripPitchLength = m_StripPlaneLength / m_NumberOfStripLength ; m_StripPitchWidth = m_StripPlaneWidth / m_NumberOfStripWidth; m_Level = Level; - m_TimeThreshold = TimeThreshold; - m_InterStripLength = InterStripLength; - m_InterStripWidth = InterStripWidth; if (axis == "xy") m_Axis = ps_xy; else if (axis == "yz") @@ -218,20 +180,10 @@ G4bool PS_Rectangle::ProcessHits(G4Step* aStep, G4TouchableHistory*) { t_Position = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(t_Position); - G4bool checkInterStrip_x = 1; - G4bool checkInterStrip_y = 1; if (m_Axis == ps_xy) { t_StripLengthNumber = (int)((t_Position.x() + m_StripPlaneLength / 2.) / m_StripPitchLength) + 1; t_StripWidthNumber = (int)((t_Position.y() + m_StripPlaneWidth / 2.) / m_StripPitchWidth) + 1; - - G4double x0 =t_Position.x() + m_StripPlaneLength / 2.; - G4double middle_x = (2*t_StripLengthNumber-1) * m_StripPitchLength/2; - checkInterStrip_x =std::abs(x0-middle_x)<(m_StripPitchLength - m_InterStripLength)/2 ; - - G4double y0 = t_Position.y() + m_StripPlaneWidth/2.; - G4double middle_y = (2*t_StripWidthNumber-1) * m_StripPitchWidth/2; - checkInterStrip_y =std::abs(y0-middle_y)<(m_StripPitchWidth - m_InterStripWidth)/2 ; } else if (m_Axis == ps_yz) { t_StripLengthNumber = (int)((t_Position.y() + m_StripPlaneLength / 2.) / m_StripPitchLength) + 1; @@ -251,31 +203,24 @@ G4bool PS_Rectangle::ProcessHits(G4Step* aStep, G4TouchableHistory*) { // Check if the particle has interact before, if yes, add up the energies. vector<DSSDData>::iterator it; // Length - //it = m_HitLength.find(DSSDData::CalculateIndex(t_StripLengthNumber, t_DetectorNumber),t_Time,m_TimeThreshold); it = m_HitLength.find(DSSDData::CalculateIndex(t_StripLengthNumber, t_DetectorNumber)); - //if(checkInterStrip_x!=0) - //{ - /* if (it != m_HitLength.end()) { + it->Add(t_Energy); } else - */ - m_HitLength.Set(t_Energy, t_Time, t_StripLengthNumber, t_DetectorNumber); + { + m_HitLength.Set(t_Energy, t_Time, t_StripWidthNumber, t_DetectorNumber); + } - //it = m_HitWidth.find(DSSDData::CalculateIndex(t_StripWidthNumber, t_DetectorNumber),t_Time,m_TimeThreshold); it = m_HitWidth.find(DSSDData::CalculateIndex(t_StripWidthNumber, t_DetectorNumber)); - //if(checkInterStrip_y!=0) - //{ - // Width - //it = m_HitWidth.find(DSSDData::CalculateIndex(t_StripWidthNumber, t_DetectorNumber)); - /* if (it != m_HitWidth.end()) { it->Add(t_Energy); } else - */ + { m_HitWidth.Set(t_Energy, t_Time, t_StripWidthNumber, t_DetectorNumber); + } //} return TRUE; } diff --git a/NPSimulation/Scorers/DSSDScorers.hh b/NPSimulation/Scorers/DSSDScorers.hh index 303657911..4c5d1586d 100644 --- a/NPSimulation/Scorers/DSSDScorers.hh +++ b/NPSimulation/Scorers/DSSDScorers.hh @@ -87,10 +87,8 @@ namespace DSSDScorers { vector<DSSDData> m_Data; public: - //vector<DSSDData>::iterator find(const unsigned int& index, const double& time, const double TimeThreshold); + vector<DSSDData>::iterator find(const unsigned int& index); - //vector<DSSDData>::iterator findTime(const unsigned int& index, const double& time, const double thresh) ; - //const unsigned int& index, const double& time, const double TimeThreshold inline void clear() { m_Data.clear(); }; inline vector<DSSDData>::iterator end() { return m_Data.end(); }; inline vector<DSSDData>::iterator begin() { return m_Data.begin(); }; @@ -169,8 +167,7 @@ namespace DSSDScorers { public: // with description PS_Rectangle(G4String name, G4int Level, G4double StripPlaneLength, G4double StripPlaneWidth, - G4int NumberOfStripLength, G4int NumberOfStripWidth, G4int depth = 0, G4String axis = "xy", - G4double TimeThreshold = 0, G4double InterStripLength = 0,G4double InterStripWidth = 0); + G4int NumberOfStripLength, G4int NumberOfStripWidth, G4int depth = 0, G4String axis = "xy"); ~PS_Rectangle(); private: @@ -194,9 +191,6 @@ namespace DSSDScorers { unsigned int m_NumberOfStripWidth; double m_StripPitchLength; double m_StripPitchWidth; - double m_TimeThreshold; - double m_InterStripLength; - double m_InterStripWidth; // Level at which to find the copy number linked to the detector number int m_Level; -- GitLab