From 3b09f0256afeb2d63ab1d36f5d9cfd057d4fe5e6 Mon Sep 17 00:00:00 2001 From: Unknown <unknown> Date: Wed, 2 Oct 2013 10:00:25 +0000 Subject: [PATCH] --- Inputs/EventGenerator/10He.reaction | 2 - NPSimulation/include/GeneralScorers.hh | 49 +++++++- NPSimulation/include/MUST2Array.hh | 74 ++++++------ NPSimulation/include/Must2Scorers.hh | 4 +- NPSimulation/include/ThinSi.hh | 21 ++++ NPSimulation/src/DetectorConstruction.cc | 29 ++++- NPSimulation/src/GeneralScorers.cc | 142 +++++++++++++++++++++-- NPSimulation/src/MUST2Array.cc | 2 +- NPSimulation/src/Must2Scorers.cc | 1 - NPSimulation/src/ThinSi.cc | 23 ---- NPSimulation/vis.mac | 2 +- 11 files changed, 263 insertions(+), 86 deletions(-) diff --git a/Inputs/EventGenerator/10He.reaction b/Inputs/EventGenerator/10He.reaction index ea6f60ae5..b305e5854 100644 --- a/Inputs/EventGenerator/10He.reaction +++ b/Inputs/EventGenerator/10He.reaction @@ -22,5 +22,3 @@ TransfertToResonance ShootHeavy= 0 ShootDecayProduct= 0 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - -%0.69u diff --git a/NPSimulation/include/GeneralScorers.hh b/NPSimulation/include/GeneralScorers.hh index e7320f447..646d62125 100644 --- a/NPSimulation/include/GeneralScorers.hh +++ b/NPSimulation/include/GeneralScorers.hh @@ -27,7 +27,27 @@ #include "G4VPrimitiveScorer.hh" #include "G4THitsMap.hh" +class PSEnergy : public G4VPrimitiveScorer + { + + public: // with description + PSEnergy(G4String name, G4int depth = 0); + virtual ~PSEnergy(); + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4int HCID; + G4THitsMap<G4double>* EvtMap; + }; class PSTOF : public G4VPrimitiveScorer { @@ -52,9 +72,6 @@ class PSTOF : public G4VPrimitiveScorer }; - - - class PSInteractionCoordinatesX : public G4VPrimitiveScorer { public: // with description @@ -76,8 +93,6 @@ class PSInteractionCoordinatesX : public G4VPrimitiveScorer G4THitsMap<G4double>* EvtMap; }; - - class PSInteractionCoordinatesY : public G4VPrimitiveScorer { public: // with description @@ -167,4 +182,28 @@ private: G4int HCID; G4THitsMap<G4double>* EvtMap; }; + + +class PSDetectorNumber : public G4VPrimitiveScorer + { + + public: // with description + PSDetectorNumber(G4String name, G4int depth = 0 , G4String VolumeName = "xxx"); + virtual ~PSDetectorNumber(); + + protected: // with description + virtual G4bool ProcessHits(G4Step*, G4TouchableHistory*); + + public: + virtual void Initialize(G4HCofThisEvent*); + virtual void EndOfEvent(G4HCofThisEvent*); + virtual void clear(); + virtual void DrawAll(); + virtual void PrintAll(); + + private: + G4int HCID; + G4THitsMap<G4int>* EvtMap; + G4String m_VolumeName ; + }; #endif diff --git a/NPSimulation/include/MUST2Array.hh b/NPSimulation/include/MUST2Array.hh index efd9f9564..383d90c8c 100644 --- a/NPSimulation/include/MUST2Array.hh +++ b/NPSimulation/include/MUST2Array.hh @@ -30,6 +30,42 @@ #include "G4MultiFunctionalDetector.hh" #include <vector> +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +namespace MUST2 +{ + // Resolution + const G4double ResoTimeMust = 0.212765957 ;// = 500ps // Unit is ns/2.35 + const G4double ResoTimePPAC = 0.106382979 ;// = 250ps // Unit is ns/2.35 + const G4double ResoSiLi = 0.055 ;// = 130 keV of resolution // Unit is MeV/2.35 + const G4double ResoCsI = 0.08 ;// = 188 kev of resolution // Unit is MeV/2.35 + const G4double ResoStrip = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 + + // Geometry + const G4double FaceFront = 11.*cm ; + const G4double FaceBack = 16.5*cm ; + const G4double Length = 7.2*cm ; + + const G4double AluStripThickness = 0.4*micrometer ; + const G4double SiliconThickness = 300*micrometer ; + const G4double SiliconFace = 98*mm ; + const G4double VacBoxThickness = 3*cm ; + + const G4double SiLiThickness = 5.1*mm ; // Must be checked + const G4double SiLiFaceX = 48.25*mm ; + const G4double SiLiFaceY = 92*mm ; + const G4double MylarCsIThickness = 3*micrometer ; + const G4double CsIThickness = 4.*cm + 2*MylarCsIThickness ; + const G4double CsIFaceFront = 12.2*cm ; + const G4double CsIFaceBack = 16*cm ; + + // Starting at the front and going to CsI + const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness ; + const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*SiliconThickness ; + const G4double AluStripBack_PosZ = Silicon_PosZ + 0.5*SiliconThickness + 0.5*AluStripThickness ; + const G4double VacBox_PosZ = AluStripBack_PosZ + 0.5*AluStripThickness + 0.5* VacBoxThickness ; + const G4double CsI_PosZ = VacBox_PosZ + 0.5*VacBoxThickness + 0.5*CsIThickness ; +} + class MUST2Array : public VDetector { //////////////////////////////////////////////////// @@ -175,43 +211,5 @@ private: }; -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace MUST2 -{ - // Resolution - const G4double ResoTimeMust = 0.212765957 ;// = 500ps // Unit is ns/2.35 - const G4double ResoTimePPAC = 0.106382979 ;// = 250ps // Unit is ns/2.35 - const G4double ResoSiLi = 0.055 ;// = 130 keV of resolution // Unit is MeV/2.35 - const G4double ResoCsI = 0.08 ;// = 188 kev of resolution // Unit is MeV/2.35 - const G4double ResoStrip = 0.022 ;// = 52keV of Resolution // Unit is MeV/2.35 - - // Geometry - const G4double FaceFront = 11.*cm ; - const G4double FaceBack = 16.5*cm ; - const G4double Length = 7.2*cm ; - - const G4double AluStripThickness = 0.4*micrometer ; - const G4double SiliconThickness = 300*micrometer ; - const G4double SiliconFace = 98*mm ; - const G4double VacBoxThickness = 3*cm ; - - const G4double SiLiThickness = 5.1*mm ; // Must be checked - const G4double SiLiFaceX = 48.25*mm ; - const G4double SiLiFaceY = 92*mm ; - const G4double MylarCsIThickness = 3*micrometer ; - const G4double CsIThickness = 4.*cm + 2*MylarCsIThickness ; - const G4double CsIFaceFront = 12.2*cm ; - const G4double CsIFaceBack = 16*cm ; - - // Starting at the front and going to CsI - const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness ; - const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*SiliconThickness ; - const G4double AluStripBack_PosZ = Silicon_PosZ + 0.5*SiliconThickness + 0.5*AluStripThickness ; - const G4double VacBox_PosZ = AluStripBack_PosZ + 0.5*AluStripThickness + 0.5* VacBoxThickness ; - const G4double CsI_PosZ = VacBox_PosZ + 0.5*VacBoxThickness + 0.5*CsIThickness ; -} - - - extern G4RotationMatrix* Rotation(double tetaX, double tetaY, double tetaZ); #endif diff --git a/NPSimulation/include/Must2Scorers.hh b/NPSimulation/include/Must2Scorers.hh index 798be053f..2240f81dc 100644 --- a/NPSimulation/include/Must2Scorers.hh +++ b/NPSimulation/include/Must2Scorers.hh @@ -99,8 +99,7 @@ namespace MUST2 { G4int HCID; G4THitsMap<G4double>* EvtMap; }; - - + class PSDetectorNumber : public G4VPrimitiveScorer { @@ -123,6 +122,7 @@ namespace MUST2 { G4THitsMap<G4int>* EvtMap; G4String m_VolumeName ; }; + } #endif diff --git a/NPSimulation/include/ThinSi.hh b/NPSimulation/include/ThinSi.hh index acf22cd4a..86d5f7fbb 100644 --- a/NPSimulation/include/ThinSi.hh +++ b/NPSimulation/include/ThinSi.hh @@ -37,7 +37,28 @@ using namespace std; +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +namespace THINSI +{ + // Energy and time Resolution + const G4double ResoTime = 0 ; + const G4double ResoEnergy = 0.042 ;// = 100keV of Resolution // Unit is MeV/2.35 + + // Geometry + const G4double DetectorSize = 68*mm ; + const G4double SiliconThickness = 20*micrometer ; + const G4double FrameThickness = 3*mm ; + const G4double SiliconSize = 50*mm ; + const G4double AluThickness = 0.4*micrometer ; + const G4int NumberOfStrip = 32 ; + + const G4double AluStripFront_PosZ = -0.5*SiliconThickness - 0.5*AluThickness ; + const G4double Si_PosZ = 0 ; + const G4double AluStripBack_PosZ = 0.5*SiliconThickness + 0.5*AluThickness ; + +} +using namespace THINSI ; class ThinSi : public VDetector { diff --git a/NPSimulation/src/DetectorConstruction.cc b/NPSimulation/src/DetectorConstruction.cc index 94fa7155a..a09b3a79a 100644 --- a/NPSimulation/src/DetectorConstruction.cc +++ b/NPSimulation/src/DetectorConstruction.cc @@ -42,6 +42,7 @@ #include "AnnularS1.hh" #include "Target.hh" #include "ThinSi.hh" +#include "Plastic.hh" //Not G4 #include <cstdlib> #include<fstream> @@ -125,6 +126,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) bool GeneralTarget = false; bool GPDTracker = false; // Gaspard Tracker bool S1 = false; + bool cPlastic = false; ////////////////////////////////////////////////////////////////////////////////////////// // added by Nicolas [07/05/09] string GlobalPath = getenv("NPTOOL"); @@ -144,9 +146,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) //Pick-up next line getline(ConfigFile, LineBuffer); //Search for comment Symbol: % - if (LineBuffer.compare(0, 1, "%") == 0) { /*Do Nothing*/ - ; - } + if (LineBuffer.compare(0, 1, "%") == 0) { /*Do Nothing*/;} //////////////////////////////////////////// //////////// Search for Gaspard //////////// @@ -206,7 +206,7 @@ void DetectorConstruction::ReadConfigurationFile(string Path) } //////////////////////////////////////////// - ////////// Search for Add.ThinSi /////////// + ////////// Search for ThinSi /////////// //////////////////////////////////////////// else if (LineBuffer.compare(0, 9, "AddThinSi") == 0 && AddThinSi == false) { AddThinSi = true ; @@ -223,6 +223,25 @@ void DetectorConstruction::ReadConfigurationFile(string Path) // Add array to the VDetector Vector AddDetector(myDetector) ; } + + //////////////////////////////////////////// + ////////// Search for Plastic /////////// + //////////////////////////////////////////// + else if (LineBuffer.compare(0, 19, "ScintillatorPlastic") == 0 && cPlastic == false) { + cPlastic = true ; + G4cout << "//////// Plastic ////////" << G4endl << G4endl ; + + // Instantiate the new array as a VDetector Object + VDetector* myDetector = new Plastic() ; + + // Read Position of detector + ConfigFile.close() ; + myDetector->ReadConfiguration(Path) ; + ConfigFile.open(Path.c_str()) ; + + // Add array to the VDetector Vector + AddDetector(myDetector) ; + } //////////////////////////////////////////// //////////// Search for Target ///////////// @@ -269,7 +288,7 @@ void DetectorConstruction::ReadAllSensitive(const G4Event* event) if(m_Detectors.size()>0) m_Detectors[0]->GetInterCoordPointer()->Clear(); - for (G4int i = 0 ; i < m_Detectors.size() ; i++) { + for (ushort i = 0 ; i < m_Detectors.size() ; i++) { m_Detectors[i]->ReadSensitive(event); } } diff --git a/NPSimulation/src/GeneralScorers.cc b/NPSimulation/src/GeneralScorers.cc index b0c9f445e..614ed22a3 100644 --- a/NPSimulation/src/GeneralScorers.cc +++ b/NPSimulation/src/GeneralScorers.cc @@ -12,8 +12,8 @@ * Last update : * *---------------------------------------------------------------------------* * Decription: * - * This class old some of the General Scorer, shared by different detector. - Thos scorer could be a could basis for your own scorer * + * This class hold some of the General Scorer, shared by different detector.* + * Those scorer could be a could basis for your own scorer * *---------------------------------------------------------------------------* * Comment: * * Those Scorer use TrackID as map index. This way ones can rebuild energy * @@ -26,14 +26,66 @@ #include "G4UnitsTable.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Added by Adrien MATTA: -// -// -// -// //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//Strip Energy Scorer (deal with multiple particle hit) +// Energy Scorer (deal with multiple particle hit) + +PSEnergy::PSEnergy(G4String name, G4int depth) + : G4VPrimitiveScorer(name, depth), HCID(-1) +{ +} + +PSEnergy::~PSEnergy() +{ +} + +G4bool PSEnergy::ProcessHits(G4Step* aStep, G4TouchableHistory*) +{ + G4double edep = aStep->GetTotalEnergyDeposit(); + if (edep < 100*keV) return FALSE; + + G4int index = aStep->GetTrack()->GetTrackID(); + + EvtMap->add(index, edep); + return TRUE; +} + +void PSEnergy::Initialize(G4HCofThisEvent* HCE) +{ + EvtMap = new G4THitsMap<G4double>(GetMultiFunctionalDetector()->GetName(), GetName()); + if (HCID < 0) { + HCID = GetCollectionID(0); + } + HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); +} + +void PSEnergy::EndOfEvent(G4HCofThisEvent*) +{ + ; +} + +void PSEnergy::clear() +{ + EvtMap->clear(); +} + +void PSEnergy::DrawAll() +{ + ; +} + +void PSEnergy::PrintAll() +{ + G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl; + G4cout << " PrimitiveScorer " << GetName() << G4endl; + G4cout << " Number of entries " << EvtMap->entries() << G4endl; + std::map<G4int, G4double*>::iterator itr = EvtMap->GetMap()->begin(); + for (; itr != EvtMap->GetMap()->end(); itr++) { + G4cout << " copy no.: " << itr->first + << " energy deposit: " << G4BestUnit(*(itr->second), "Energy") + << G4endl; + } +} //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //TOF Scorer// @@ -352,3 +404,77 @@ void PSInteractionCoordinatesAnglePhi::PrintAll() G4cout << " PrimitiveScorer " << GetName() << G4endl ; G4cout << " Number of entries " << EvtMap->entries() << G4endl ; } + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... + //Detector Number Scorer +PSDetectorNumber::PSDetectorNumber(G4String name, G4int depth, G4String VolumeName ) + : G4VPrimitiveScorer(name, depth), HCID(-1) +{ + m_VolumeName = VolumeName; +} + +PSDetectorNumber::~PSDetectorNumber() +{ + ; +} + +G4bool PSDetectorNumber::ProcessHits(G4Step* aStep, G4TouchableHistory*) +{ + std::string name = aStep->GetTrack()->GetVolume()->GetName(); + std::string nbr ; + size_t found; + found=name.find(m_VolumeName); + found = found + m_VolumeName.length(); + + int numberOfCharacterInDetectorNumber = name.length() - (int)found ; + + for( int i = found ; i < found + numberOfCharacterInDetectorNumber ; i++ ) + nbr += name[i] ; + + G4int DetNbr = atoi( nbr.c_str() ) ; + G4double edep = aStep->GetTotalEnergyDeposit(); + + if (edep < 100*keV) return FALSE; + + G4int index = aStep->GetTrack()->GetTrackID(); + EvtMap->set(index, DetNbr); + return TRUE; +} + +void PSDetectorNumber::Initialize(G4HCofThisEvent* HCE) +{ + EvtMap = new G4THitsMap<G4int>(GetMultiFunctionalDetector()->GetName(), GetName()); + if (HCID < 0) { + HCID = GetCollectionID(0); + } + HCE->AddHitsCollection(HCID, (G4VHitsCollection*)EvtMap); +} + +void PSDetectorNumber::EndOfEvent(G4HCofThisEvent*) +{ + ; +} + +void PSDetectorNumber::clear() +{ + EvtMap->clear(); +} + +void PSDetectorNumber::DrawAll() +{ + ; +} + +void PSDetectorNumber::PrintAll() +{ + G4cout << " MultiFunctionalDet " << detector->GetName() << G4endl; + G4cout << " PrimitiveScorer " << GetName() << G4endl; + G4cout << " Number of entries " << EvtMap->entries() << G4endl; + std::map<G4int, G4int*>::iterator itr = EvtMap->GetMap()->begin(); + for (; itr != EvtMap->GetMap()->end(); itr++) { + G4cout << " copy no.: " << itr->first + << " energy deposit: " << G4BestUnit(*(itr->second), "Energy") + << G4endl; + } +} diff --git a/NPSimulation/src/MUST2Array.cc b/NPSimulation/src/MUST2Array.cc index 23cdf2610..85b9902b1 100644 --- a/NPSimulation/src/MUST2Array.cc +++ b/NPSimulation/src/MUST2Array.cc @@ -1222,7 +1222,7 @@ void MUST2Array::InitializeScorers() // Silicon Associate Scorer m_StripScorer = new G4MultiFunctionalDetector("StripScorer"); - G4VPrimitiveScorer* DetNbr = new PSDetectorNumber("DetectorNumber", 0, "Silicon") ; + G4VPrimitiveScorer* DetNbr = new MUST2::PSDetectorNumber("DetectorNumber", 0, "Silicon") ; G4VPrimitiveScorer* Energy = new PSStripE("StripEnergy", 0) ; G4VPrimitiveScorer* TOF = new PSTOF("StripTime", 0) ; G4VPrimitiveScorer* StripPositionX = new PSStripNumberX("StripNumberX", 0, SiliconFace, 128) ; diff --git a/NPSimulation/src/Must2Scorers.cc b/NPSimulation/src/Must2Scorers.cc index aff1db1b7..685781f4d 100644 --- a/NPSimulation/src/Must2Scorers.cc +++ b/NPSimulation/src/Must2Scorers.cc @@ -227,7 +227,6 @@ void PSStripNumberY::PrintAll() G4cout << " Number of entries " << EvtMap->entries() << G4endl ; } - //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //Detector Number Scorer diff --git a/NPSimulation/src/ThinSi.cc b/NPSimulation/src/ThinSi.cc index 494c4d01b..94a2313ad 100644 --- a/NPSimulation/src/ThinSi.cc +++ b/NPSimulation/src/ThinSi.cc @@ -56,29 +56,6 @@ using namespace std; using namespace CLHEP; - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace THINSI -{ - // Energy and time Resolution - const G4double ResoTime = 0 ; - const G4double ResoEnergy = 0.042 ;// = 100keV of Resolution // Unit is MeV/2.35 - - // Geometry - const G4double DetectorSize = 68*mm ; - const G4double SiliconThickness = 20*micrometer ; - const G4double FrameThickness = 3*mm ; - const G4double SiliconSize = 50*mm ; - const G4double AluThickness = 0.4*micrometer ; - const G4int NumberOfStrip = 32 ; - - const G4double AluStripFront_PosZ = -0.5*SiliconThickness - 0.5*AluThickness ; - const G4double Si_PosZ = 0 ; - const G4double AluStripBack_PosZ = 0.5*SiliconThickness + 0.5*AluThickness ; - -} - -using namespace THINSI ; //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... diff --git a/NPSimulation/vis.mac b/NPSimulation/vis.mac index 7130261ec..e8345fb35 100644 --- a/NPSimulation/vis.mac +++ b/NPSimulation/vis.mac @@ -9,7 +9,7 @@ # choose a graphic system #/vis/open OGLIX #/vis/open OGLSX -#/vis/open VRML2FILE +/vis/open VRML2FILE /vis/scene/create /vis/drawVolume /vis/viewer/set/viewpointThetaPhi 0 0 deg -- GitLab