diff --git a/NPAnalysis/Gaspard/src/Analysis.cc b/NPAnalysis/Gaspard/src/Analysis.cc index d7f4e226aaf736bf6219e3b5e80b356ac4f12c55..196d2f3e42de699c8a28c22040b2655245934575 100644 --- a/NPAnalysis/Gaspard/src/Analysis.cc +++ b/NPAnalysis/Gaspard/src/Analysis.cc @@ -5,23 +5,19 @@ using namespace std; int main(int argc,char** argv) { - // test if number of arguments is correct - if (argc != 4) { - cout << - "you need to specify both a Reaction file and a Detector file such as : Analysis myReaction.reaction myDetector.detector runToRead.run" - << endl; - return 0; - } - // get arguments - string reactionfileName = argv[1]; - string detectorfileName = argv[2]; - string runToReadfileName = argv[3]; + NPOptionManager* myOptionManager = NPOptionManager::getInstance(argc,argv) ; + string reactionfileName = myOptionManager->GetReactionFilePath() ; + string detectorfileName = myOptionManager->GetDetectorFilePath() ; + string calibrationfileName = myOptionManager->GetCalibrationFilePath() ; + string runToReadfileName = myOptionManager->GetRunToReadFilePath() ; + string OutputfileName = myOptionManager->GetOutputFilePath() ; // Instantiate RootInput and RootOutput singleton classes RootInput:: getInstance(runToReadfileName); +// RootOutput::getInstance("Analysis/"+OutputfileName, "AnalyzedTree") ; RootOutput::getInstance("Analysis/Gaspard_AnalyzedData", "AnalyzedTree"); - + // Initialize the reaction NPL::Reaction* myReaction = new Reaction(); myReaction->ReadConfigurationFile(reactionfileName); @@ -38,7 +34,7 @@ int main(int argc,char** argv) Double_t BeamEnergyNominal = myReaction->GetBeamEnergy() * MeV; cout << "Nominal beam energy (MeV): " << BeamEnergyNominal << endl; // Slow beam at target middle - Double_t BeamEnergy = BeamEnergyNominal - BeamTarget.Slow(BeamEnergyNominal, myDetector->GetTargetThickness()/2 * micrometer, 0); + Double_t BeamEnergy = BeamTarget.Slow(BeamEnergyNominal, myDetector->GetTargetThickness()/2 * micrometer, 0); cout << "Middle-target beam energy (MeV): " << BeamEnergy << endl << endl; // Set energy beam at target middle myReaction->SetBeamEnergy(BeamEnergy); diff --git a/NPLib/GASPARD/GaspardTrackerAnnular.h b/NPLib/GASPARD/GaspardTrackerAnnular.h index 367d80ba56389d812b7216f4af9f0a7e09d5bb77..33b9522d25f592a966c85e1ba052d0770241564f 100644 --- a/NPLib/GASPARD/GaspardTrackerAnnular.h +++ b/NPLib/GASPARD/GaspardTrackerAnnular.h @@ -63,7 +63,7 @@ public: // Getters to retrieve the (X,Y,Z) coordinates of a pixel defined by strips (X,Y) double GetStripPositionX(int N ,int X ,int Y) { return m_StripPositionX[N-1-m_index["Annular"]][X-1][Y-1]; } double GetStripPositionY(int N ,int X ,int Y) { return m_StripPositionY[N-1-m_index["Annular"]][X-1][Y-1]; } - double GetStripPositionZ(int N ,int X ,int Y) { cout << N << " " << X << " " << Y << " " << endl ; return m_StripPositionZ[N-1-m_index["Annular"]][X-1][Y-1]; } + double GetStripPositionZ(int N ,int X ,int Y) { return m_StripPositionZ[N-1-m_index["Annular"]][X-1][Y-1]; } double GetNumberOfModule() { return m_NumberOfModule; } private: diff --git a/NPLib/Makefile b/NPLib/Makefile index 7542417d5c051c374aecbb20d9b81c8a46ea5418..41e9bebb433cd9760fa8882fa8e404fb6e435983 100644 --- a/NPLib/Makefile +++ b/NPLib/Makefile @@ -41,7 +41,6 @@ ROOTLIBS := $(shell $(ROOTCONFIG) --libs) ROOTGLIBS := $(shell $(ROOTCONFIG) --glibs) HASTHREAD := $(shell $(ROOTCONFIG) --has-thread) ROOTDICTTYPE := $(shell $(ROOTCONFIG) --dicttype) -NOSTUBS := $(shell $(ROOTCONFIG) --nostubs) ROOTCINT := rootcint ifeq ($(ARCH),linux) @@ -268,189 +267,41 @@ GLIBS = $(ROOTGLIBS) $(SYSLIBS) INCLUDE = -I$(CLHEP_BASE_DIR)/include #------------------------------------------------------------------------------ -SHARELIB = CalibManager Vdetec InputOutputRoot InitCond InterCoord \ - Must2All GaspardData AnnularS1Data PlasticData DummyDetectorData SSSDData\ - Reaction EnergyLoss ParisData ShieldData +SHARELIB = SharedLib +FILLINC = FillIncludeDir +FILLLIB = FillLibraryDir +LIBLIST = liblistfile -all: $(SHARELIB) - rm -f ./include/*Dict.h +all: $(FILLINC) $(SHARELIB) $(FILLLIB) $(LIBLIST) #------------------------------------------------------------------------------ -############### Calibration ############## +############### fillinclib ############## +FillIncludeDir: + ./scripts/fillincdir.sh -## CalibrationManager ## -CalibManager: - make -C ./CalibrationManager - cp ./CalibrationManager/*.so ./lib ; cp ./CalibrationManager/*.h ./include +FillLibraryDir: + ./scripts/filllibdir.sh ifeq ($(ARCH),macosx) - cd lib; ln -sf libCalibrationManager.so libCalibrationManager.dylib + ./scripts/filllibmacdir.sh endif -############### Detector ############## +############### liblist ############## +liblistfile: + ./scripts/buildliblist.sh -## VDetector ## -Vdetec: - cp ./VDetector/*.h ./include - make -C ./VDetector - cp ./VDetector/*.so ./lib -ifeq ($(ARCH),macosx) - cd lib; ln -sf libVDetector.so libVDetector.dylib -endif - -## MUST2 ## -Must2All: - make -C ./MUST2 - cp ./MUST2/*.so ./lib ; cp ./MUST2/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libMust2Data.so libMust2Data.dylib - cd lib; ln -sf libMust2Physics.so libMust2Physics.dylib -endif - -## SSSD ## -SSSDData: - make -C ./SSSD - cp ./SSSD/*.so ./lib ; cp ./SSSD/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libSSSDData.so libSSSDData.dylib - cd lib; ln -sf libSSSDPhysics.so libSSSDPhysics.dylib -endif - -## AnnularS1 ## -AnnularS1Data: - make -C ./AnnularS1 - cp ./AnnularS1/*.so ./lib ; cp ./AnnularS1/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libAnnularS1Data.so libAnnularS1Data.dylib -endif - -## Gaspard ## -GaspardData: - make -C ./GASPARD - cp ./GASPARD/*.so ./lib ; cp ./GASPARD/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libGaspardData.so libGaspardData.dylib - cd lib; ln -sf libGaspardPhysics.so libGaspardPhysics.dylib -endif - -## Plastic ## -PlasticData: - make -C ./Plastic - cp ./Plastic/*.so ./lib ; cp ./Plastic/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libPlasticData.so libPlasticData.dylib - cd lib; ln -sf libPlasticPhysics.so libPlasticPhysics.dylib -endif - -## DUMMY Detector ## -DummyDetectorData: - make -C ./DummyDetector - cp ./DummyDetector/*.so ./lib ; cp ./DummyDetector/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libDummyDetectorData.so libDummyDetectorData.dylib -endif - -## Paris Detector ## -ParisData: - make -C ./Paris - cp ./Paris/*.so ./lib ; cp ./Paris/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libParisData.so libParisData.dylib - cd lib; ln -sf libParisPhysics.so libParisPhysics.dylib -endif - - -## Paris Shield Detector ## -ShieldData: - make -C ./Shield - cp ./Shield/*.so ./lib ; cp ./Shield/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libShieldData.so libShieldData.dylib - cd lib; ln -sf libShieldPhysics.so libShieldPhysics.dylib -endif - -############# Simulation ############## - -## InitialConditions ## -InitCond: - make -C ./InitialConditions - cp ./InitialConditions/*.so ./lib ; cp ./InitialConditions/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libInitialConditions.so libInititalConditions.dylib -endif - -## InteractionCoordinates ## -InterCoord: - make -C ./InteractionCoordinates - cp ./InteractionCoordinates/*.so ./lib ; cp ./InteractionCoordinates/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libInteractionCoordinates.so libInteractionCoordinates.dylib -endif - -############# I/O Root File ############ -InputOutputRoot: - make -C ./IORoot - cp ./IORoot/*.so ./lib ; cp ./IORoot/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libIORoot.so libIORoot.dylib -endif - - - -############# Various Tools ############ - -## Reaction ## -Reaction: - make libReaction.so -C ./Tools - cp ./Tools/*.so ./lib ; cp ./Tools/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libReaction.so libReaction.dylib -endif - -EnergyLoss: - make libEnergyLoss.so -C ./Tools - cp ./Tools/*.so ./lib ; cp ./Tools/*.h ./include -ifeq ($(ARCH),macosx) - cd lib; ln -sf libEnergyLoss.so libEnergyLoss.dylib -endif - -####################################### +############### sharedlib ############## +SharedLib: + ./scripts/makefile.sh ############# Clean and More ########## clean: - make clean -C ./Tools - make clean -C ./IORoot - make clean -C ./VDetector - make clean -C ./CalibrationManager - make clean -C ./MUST2 - make clean -C ./SSSD - make clean -C ./AnnularS1 - make clean -C ./GASPARD - make clean -C ./InteractionCoordinates - make clean -C ./InitialConditions - make clean -C ./DummyDetector - make clean -C ./Plastic - make clean -C ./Paris - make clean -C ./Shield + ./scripts/makefile.sh clean distclean: - rm -f ./lib/*.so -ifeq ($(ARCH),macosx) - rm -f ./lib/*.dylib -endif + rm -f ./lib/* rm -f ./include/*.h - make distclean -C ./Tools - make distclean -C ./IORoot - make distclean -C ./VDetector - make distclean -C ./CalibrationManager - make distclean -C ./MUST2 - make distclean -C ./SSSD - make distclean -C ./AnnularS1 - make distclean -C ./GASPARD - make distclean -C ./InteractionCoordinates - make distclean -C ./InitialConditions - make distclean -C ./DummyDetector - make distclean -C ./Plastic - make distclean -C ./Paris - make distclean -C ./Shield + rm -f liblist + ./scripts/makefile.sh distclean + .SUFFIXES: .$(SrcSuf) ### diff --git a/NPLib/Tools/NPEnergyLoss.cxx b/NPLib/Tools/NPEnergyLoss.cxx index 85582a9a0266769bffa99da15267e4c9292840c0..7e7da225b397644058cf2dca6baa03ce7f7d1df8 100644 --- a/NPLib/Tools/NPEnergyLoss.cxx +++ b/NPLib/Tools/NPEnergyLoss.cxx @@ -232,6 +232,18 @@ void EnergyLoss::Print() const } + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +double EnergyLoss::EnergyLossCalulation( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const + { + return(Energy - Slow(Energy,TargetThickness,Angle) ) ; + } + + + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... double EnergyLoss::Slow( double Energy , // Energy of the detected particle double TargetThickness , // Target Thickness at 0 degree diff --git a/NPLib/Tools/NPEnergyLoss.h b/NPLib/Tools/NPEnergyLoss.h index 080c3298a0ccd631bff74667bd76eda58f40b028..66cb6783c49efc0b1f9ccf3fbe0c58c22203d54f 100644 --- a/NPLib/Tools/NPEnergyLoss.h +++ b/NPLib/Tools/NPEnergyLoss.h @@ -83,12 +83,18 @@ namespace NPL public : // Function to Slow down particle or reconstruct their initial energy - // Calculate Energy loss of a particle inside material + // Calculate Energy of a particle after crossing material double Slow( double Energy , // Energy of the detected particle double TargetThickness , // Target Thickness at 0 degree double Angle ) // Particle Angle const; + // Calculate Energy Loss of a particle inside a material + double EnergyLossCalulation( double Energy , // Energy of the detected particle + double TargetThickness , // Target Thickness at 0 degree + double Angle ) // Particle Angle + const; + // Evaluate Initial Energy of particle before crossing material knowing Angle, final Energy // and Target Thickness. double EvaluateInitialEnergy( double energy , // Energy of the detected particle diff --git a/NPLib/Tools/NPOptionManager.cxx b/NPLib/Tools/NPOptionManager.cxx index 18cf752ae7786dd1b899c2c03c314dee549c1fcb..dd36a146a61cd0a661a9c10e2eeb5820009815d4 100644 --- a/NPLib/Tools/NPOptionManager.cxx +++ b/NPLib/Tools/NPOptionManager.cxx @@ -39,7 +39,7 @@ NPOptionManager::NPOptionManager(int argc,char** argv) // Default Setting fReactionFileName = "myReaction.reaction" ; fDetectorFileName = "myDetector.detector" ; - fOutputFileName = "myResult.root" ; + fOutputFileName = "myResult" ; fRunToReadFileName = "RunToRead.txt" ; fCalibrationFileName = "Calibration.txt" ; @@ -47,18 +47,28 @@ NPOptionManager::NPOptionManager(int argc,char** argv) { string argument = argv[i]; - if(argument == "-H" || argument == "-h" || argument == "-help") + if(argument == "-H" || argument == "-h" || argument == "--help") DisplayHelp(); - else if(argument == "-R" && argc>=i+1 ) fReactionFileName = argv[i+1] ; + else if(argument == "--event-generator" && argc>=i+1 ) fReactionFileName = argv[i+1] ; + + else if(argument == "-E" && argc>=i+1 ) fReactionFileName = argv[i+1] ; + + else if(argument == "--detector" && argc>=i+1 ) fDetectorFileName = argv[i+1] ; + + else if(argument == "-D" && argc>=i+1 ) fDetectorFileName = argv[i+1] ; - else if(argument == "-C" && argc>=i+1 ) fDetectorFileName = argv[i+1] ; + else if(argument == "--output" && argc>=i+1 ) fOutputFileName = argv[i+1] ; else if(argument == "-O" && argc>=i+1 ) fOutputFileName = argv[i+1] ; - else if(argument == "-run" && argc>=i+1 ) fRunToReadFileName = argv[i+1] ; + else if(argument == "--run" && argc>=i+1 ) fRunToReadFileName = argv[i+1] ; + + else if(argument == "-R" && argc>=i+1 ) fRunToReadFileName = argv[i+1] ; + + else if(argument == "--cal" && argc>=i+1 ) fCalibrationFileName = argv[i+1] ; - else if(argument == "-cal" && argc>=i+1 ) fCalibrationFileName = argv[i+1] ; + else if(argument == "-C" && argc>=i+1 ) fCalibrationFileName = argv[i+1] ; else ; } @@ -70,10 +80,11 @@ void NPOptionManager::DisplayHelp() { cout << "----NPOptionManager Help----" << endl ; cout << "List of Option " << endl ; - cout << "\t -C <arg>\t \t \t \t \t Set arg as the detector configuration file" << endl ; - cout << "\t -cal <arg>\t \t \t \t \t Set arg as the calibration file list" << endl ; - cout << "\t -H -h -help\t \t \t \t \t Display this help message" << endl ; - cout << "\t -O <arg>\t \t \t \t \t Set arg as the Output File Name (output tree)" << endl ; - cout << "\t -run <arg>\t \t \t \t \t Set arg as the run to read file list" << endl ; + cout << "\t --detector -D <arg>\t \t \t \t \t \t Set arg as the detector configuration file" << endl ; + cout << "\t --event-generator -E <arg>\t \t \t \t \t Set arg as the event generator file" << endl ; + cout << "\t --cal -C <arg>\t \t \t \t \t \t \t Set arg as the calibration file list" << endl ; + cout << "\t --help -H -h\t \t \t \t \t \t \t Display this help message" << endl ; + cout << "\t --output -O <arg>\t \t \t \t \t \t Set arg as the Output File Name (output tree)" << endl ; + cout << "\t --run -R <arg>\t \t \t \t \t \t \t Set arg as the run to read file list" << endl ; cout << endl << endl ; } diff --git a/NPSimulation/src/GaspardTrackerSquare.cc b/NPSimulation/src/GaspardTrackerSquare.cc index 9d820d70293acc8f5e05ac9c6570a3b62185eecd..c8ba9e5a9983ff4f46c6aaa2a455dc8973b2f508 100644 --- a/NPSimulation/src/GaspardTrackerSquare.cc +++ b/NPSimulation/src/GaspardTrackerSquare.cc @@ -111,14 +111,14 @@ void GaspardTrackerSquare::AddModule(G4ThreeVector X1_Y1 , //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void GaspardTrackerSquare::AddModule(G4double R , - G4double Theta , - G4double Phi , - G4double beta_u , - G4double beta_v , - G4double beta_w , - bool wFirstStage , - bool wSecondStage , - bool wThirdStage) + G4double Theta , + G4double Phi , + G4double beta_u , + G4double beta_v , + G4double beta_w , + bool wFirstStage , + bool wSecondStage , + bool wThirdStage) { G4ThreeVector empty = G4ThreeVector(0, 0, 0); @@ -188,7 +188,7 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, // Al density = 2.702 * g / cm3; a = 26.98 * g / mole; - G4Material* Aluminium = new G4Material("Aluminium", z = 13., a, density); +// G4Material* Aluminium = new G4Material("Aluminium", z = 13., a, density); // Iron // density = 7.874 * g / cm3; @@ -228,37 +228,15 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, // Little trick to avoid warning in compilation: Use a PVPlacement "buffer". // If don't you will have a Warning unused variable 'myPVP' G4PVPlacement* PVPBuffer ; + G4String Name = "GPDSquare" + DetectorNumber; - G4Trd* solidMM = new G4Trd("GPDSquare" + DetectorNumber, 0.5*FaceFront, 0.5*FaceFront, 0.5*FaceFront, 0.5*FaceFront, 0.5*Length); -// G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Iron, "GPDSquare" + DetectorNumber, 0, 0, 0) ; - G4LogicalVolume* logicMM = new G4LogicalVolume(solidMM, Vacuum, "GPDSquare" + DetectorNumber, 0, 0, 0) ; - - G4String Name = "GPDSquare" + DetectorNumber ; - PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot, MMpos) , - logicMM , - Name , - world , - false , - 0); - - logicMM->SetVisAttributes(G4VisAttributes::Invisible); - if (m_non_sensitive_part_visiualisation) logicMM->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); - - G4ThreeVector positionVacBox = G4ThreeVector(0, 0, VacBox_PosZ); + G4Box* solidGPDSquare = new G4Box(Name, 0.5*FaceFront, 0.5*FaceFront, 0.5*Length); + G4LogicalVolume* logicGPDSquare = new G4LogicalVolume(solidGPDSquare, Vacuum, Name, 0, 0, 0); - G4Trd* solidVacBox = new G4Trd("solidVacBox", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*SiliconFace, 0.5*SiliconFace, 0.5*VacBoxThickness); - G4LogicalVolume* logicVacBox = new G4LogicalVolume(solidVacBox, Vacuum, "logicVacBox", 0, 0, 0); + PVPBuffer = new G4PVPlacement(G4Transform3D(*MMrot, MMpos), logicGPDSquare, Name, world, false, 0); - PVPBuffer = new G4PVPlacement(0, positionVacBox, logicVacBox, "G" + DetectorNumber + "VacBox", logicMM, false, 0); - - logicVacBox->SetVisAttributes(G4VisAttributes::Invisible); - - // Add a degrader plate between Si and CsI: - /* - G4Box* Degrader = new G4Box("Degrader" , 50*mm , 50*mm , 0.1*mm ); - G4LogicalVolume* logicDegrader = new G4LogicalVolume( Degrader , Harvar, "logicDegrader",0,0,0); - PVPBuffer = new G4PVPlacement(0,G4ThreeVector(0,0,0),logicDegrader,"Degrader",logicVacBox,false,0) ; - */ + logicGPDSquare->SetVisAttributes(G4VisAttributes::Invisible); + if (m_non_sensitive_part_visiualisation) logicGPDSquare->SetVisAttributes(G4VisAttributes(G4Colour(0.90, 0.90, 0.90))); //Place two marker to identify the u and v axis on silicon face: //marker are placed a bit before the silicon itself so they don't perturbate simulation @@ -284,166 +262,55 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, */ //////////////////////////////////////////////////////////////// - /////////////////Si Strip Construction////////////////////////// + //////////////// First Stage Construction ////////////////////// //////////////////////////////////////////////////////////////// if (wFirstStage) { - // Aluminium dead layers - G4ThreeVector positionAluStripFront = G4ThreeVector(0, 0, AluStripFront_PosZ); - G4ThreeVector positionAluStripBack = G4ThreeVector(0, 0, AluStripBack_PosZ); - - G4Box* solidAluStrip = new G4Box("AluBox", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*AluStripThickness); -// G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Aluminium, "logicAluStrip", 0, 0, 0); - G4LogicalVolume* logicAluStrip = new G4LogicalVolume(solidAluStrip, Vacuum, "logicAluStrip", 0, 0, 0); - - PVPBuffer = new G4PVPlacement(0, positionAluStripFront, logicAluStrip, "G" + DetectorNumber + "AluStripFront", logicMM, false, 0); - PVPBuffer = new G4PVPlacement(0, positionAluStripBack, logicAluStrip, "G" + DetectorNumber + "AluStripBack", logicMM, false, 0); - - logicAluStrip->SetVisAttributes(G4VisAttributes::Invisible); - // Silicon detector itself - G4ThreeVector positionSilicon = G4ThreeVector(0, 0, Silicon_PosZ); - - G4Box* solidSilicon = new G4Box("solidSilicon", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*SiliconThickness); - G4LogicalVolume* logicSilicon = new G4LogicalVolume(solidSilicon, Silicon, "logicSilicon", 0, 0, 0); + G4ThreeVector positionFirstStage = G4ThreeVector(0, 0, FirstStage_PosZ); - PVPBuffer = new G4PVPlacement(0, positionSilicon, logicSilicon, Name + "_Silicon", logicMM, false, 0); + G4Box* solidFirstStage = new G4Box("solidFirstStage", 0.5*FirstStageFace, 0.5*FirstStageFace, 0.5*FirstStageThickness); + G4LogicalVolume* logicFirstStage = new G4LogicalVolume(solidFirstStage, Silicon, "logicFirstStage", 0, 0, 0); + PVPBuffer = new G4PVPlacement(0, + positionFirstStage, + logicFirstStage, + Name + "_FirstStage", + logicGPDSquare, + false, + 0); // Set First Stage sensible - logicSilicon->SetSensitiveDetector(m_FirstStageScorer); + logicFirstStage->SetSensitiveDetector(m_FirstStageScorer); - ///Visualisation of Silicon Strip - G4VisAttributes* SiliconVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; - logicSilicon->SetVisAttributes(SiliconVisAtt) ; + ///Visualisation of FirstStage Strip + G4VisAttributes* FirstStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9)); // blue + logicFirstStage->SetVisAttributes(FirstStageVisAtt); } //////////////////////////////////////////////////////////////// - //////////////////// SiLi Construction //////////////////////// + //////////////////// Second Stage Construction //////////////// //////////////////////////////////////////////////////////////// if (wSecondStage) { - G4double SiLiSpace = 8 * mm; - - G4RotationMatrix* rotSiLi = Rotation(0., 0., 0.); - - G4ThreeVector positionSiLi = G4ThreeVector(-0.25 * SiliconFace - 0.5 * SiLiSpace, 0, 0); - G4ThreeVector positionSiLi2 = G4ThreeVector(0.25 * SiliconFace + 0.5 * SiLiSpace, 0, 0); - - G4Box* solidSiLi = new G4Box("SiLi", 0.5*SiLiFaceX, 0.5*SiLiFaceY, 0.5*SiLiThickness); - - G4LogicalVolume* logicSiLi = new G4LogicalVolume(solidSiLi, Aluminium, "SiLi" + DetectorNumber, 0, 0, 0); - - // First Si(Li) 2 time 4 detectore - PVPBuffer = new G4PVPlacement(G4Transform3D(*rotSiLi, positionSiLi) , - logicSiLi , - "SiLi" + DetectorNumber , - logicVacBox , - false , - 0); - - // Second Si(Li) 2 time 4 detectore - PVPBuffer = new G4PVPlacement(G4Transform3D(*rotSiLi, positionSiLi2) , - logicSiLi , - "SiLi" + DetectorNumber , - logicVacBox , - false , - 1); - - // SiLi are placed inside of the VacBox... - // Left/Right define when looking to detector from Si to CsI - G4double SiLi_HighY_Upper = 19.86 * mm; - G4double SiLi_HighY_Center = 25.39 * mm ; - G4double SiLi_WidthX_Left = 22.85 * mm; - G4double SiLi_WidthX_Right = 24.9 * mm ; - G4double SiLi_ShiftX = 0.775 * mm ; - - // SiLi : left side of SiLi detector - G4Box* solidSiLi_LT = new G4Box("SiLi_LT" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_RT = new G4Box("SiLi_RT" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_LC1 = new G4Box("SiLi_LC1" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - G4Box* solidSiLi_RC1 = new G4Box("SiLi_RC1" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - G4Box* solidSiLi_LB = new G4Box("SiLi_LB" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_RB = new G4Box("SiLi_RB" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Upper , 0.5*SiLiThickness); - G4Box* solidSiLi_LC2 = new G4Box("SiLi_LC2" , 0.5*SiLi_WidthX_Left , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - G4Box* solidSiLi_RC2 = new G4Box("SiLi_RC2" , 0.5*SiLi_WidthX_Right , 0.5*SiLi_HighY_Center , 0.5*SiLiThickness); - - G4LogicalVolume* logicSiLi_LT = new G4LogicalVolume(solidSiLi_LT , Silicon , "SiLi_LT" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RT = new G4LogicalVolume(solidSiLi_RT , Silicon , "SiLi_RT" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LC1 = new G4LogicalVolume(solidSiLi_LC1 , Silicon , "SiLi_LC1" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RC1 = new G4LogicalVolume(solidSiLi_RC1 , Silicon , "SiLi_RC1" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LB = new G4LogicalVolume(solidSiLi_LB , Silicon , "SiLi_LB" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RB = new G4LogicalVolume(solidSiLi_RB , Silicon , "SiLi_RB" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_LC2 = new G4LogicalVolume(solidSiLi_LC2 , Silicon , "SiLi_LC2" , 0 , 0 , 0); - G4LogicalVolume* logicSiLi_RC2 = new G4LogicalVolume(solidSiLi_RC2 , Silicon , "SiLi_RC2" , 0 , 0 , 0); - - G4double interSiLi = 0.5 * mm; - - // Top - G4ThreeVector positionSiLi_LT = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RT = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Upper + SiLi_HighY_Center + 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_LC1 = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RC1 = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - 0.5 * SiLi_HighY_Center + 0.5 * interSiLi , - 0); - - // Bottom - G4ThreeVector positionSiLi_LB = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RB = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Upper - SiLi_HighY_Center - 1.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_LC2 = G4ThreeVector(-0.5 * SiLi_WidthX_Left - interSiLi - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); - - G4ThreeVector positionSiLi_RC2 = G4ThreeVector(0.5 * SiLi_WidthX_Right - SiLi_ShiftX , - -0.5 * SiLi_HighY_Center - 0.5 * interSiLi , - 0); - - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LT , logicSiLi_LT , Name + "_SiLi_LT" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RT , logicSiLi_RT , Name + "_SiLi_RT" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC1 , logicSiLi_LC1 , Name + "_SiLi_LC1" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC1 , logicSiLi_RC1 , Name + "_SiLi_RC1" , logicSiLi , false , 0) ; - - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LB , logicSiLi_LB , Name + "_SiLi_LB" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RB , logicSiLi_RB , Name + "_SiLi_RB" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_LC2 , logicSiLi_LC2 , Name + "_SiLi_LC2" , logicSiLi , false , 0) ; - PVPBuffer = new G4PVPlacement(0 , positionSiLi_RC2 , logicSiLi_RC2 , Name + "_SiLi_RC2" , logicSiLi , false , 0) ; - - logicSiLi->SetVisAttributes(G4VisAttributes(G4Colour(1, 1., 1.))); + // Second stage silicon detector + G4ThreeVector positionSecondStage = G4ThreeVector(0, 0, SecondStage_PosZ); + + G4Box* solidSecondStage = new G4Box("solidSecondStage", 0.5*SecondStageFace, 0.5*SecondStageFace, 0.5*SecondStageThickness); + G4LogicalVolume* logicSecondStage = new G4LogicalVolume(solidSecondStage, Silicon, "logicSecondStage", 0, 0, 0); + + PVPBuffer = new G4PVPlacement(0, + positionSecondStage, + logicSecondStage, + Name + "_SecondStage", + logicGPDSquare, + false, + 0); // Set Second Stage sensible - logicSiLi_LT->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RT->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_LC1->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RC1->SetSensitiveDetector(m_SecondStageScorer); - - logicSiLi_LB->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RB->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_LC2->SetSensitiveDetector(m_SecondStageScorer); - logicSiLi_RC2->SetSensitiveDetector(m_SecondStageScorer); - - // Mark blue a SiLi to see telescope orientation - logicSiLi_LT->SetVisAttributes(G4VisAttributes(G4Colour(0, 0., 1.))); - logicSiLi_RT->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_LC1->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_RC1->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - - logicSiLi_LB->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_RB->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_LC2->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); - logicSiLi_RC2->SetVisAttributes(G4VisAttributes(G4Colour(0, 1., 0))); + logicSecondStage->SetSensitiveDetector(m_SecondStageScorer); + + ///Visualisation of SecondStage Strip + G4VisAttributes* SecondStageVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5)) ; + logicSecondStage->SetVisAttributes(SecondStageVisAtt) ; } //////////////////////////////////////////////////////////////// @@ -453,19 +320,23 @@ void GaspardTrackerSquare::VolumeMaker(G4int TelescopeNumber, // Third stage silicon detector G4ThreeVector positionThirdStage = G4ThreeVector(0, 0, ThirdStage_PosZ); -// G4Box* solidThirdStage = new G4Box("solidThirdStage", 0.5*SiliconFace, 0.5*SiliconFace, 0.5*ThirdStageThickness); - G4Box* solidThirdStage = new G4Box("solidThirdStage", 0.5*FaceFront, 0.5*FaceFront, 0.5*ThirdStageThickness); + G4Box* solidThirdStage = new G4Box("solidThirdStage", 0.5*ThirdStageFace, 0.5*ThirdStageFace, 0.5*ThirdStageThickness); G4LogicalVolume* logicThirdStage = new G4LogicalVolume(solidThirdStage, Silicon, "logicThirdStage", 0, 0, 0); - PVPBuffer = new G4PVPlacement(0, positionThirdStage, logicThirdStage, Name + "_ThirdStage", logicMM, false, 0); - - ///Visualisation of Third Stage - G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.7, 0.7, 0.7)) ; - logicThirdStage->SetVisAttributes(ThirdStageVisAtt) ; -// logicThirdStage->SetVisAttributes(G4VisAttributes::Invisible); + PVPBuffer = new G4PVPlacement(0, + positionThirdStage, + logicThirdStage, + Name + "_ThirdStage", + logicGPDSquare, + false, + 0); // Set Third Stage sensible logicThirdStage->SetSensitiveDetector(m_ThirdStageScorer); + + ///Visualisation of Third Stage + G4VisAttributes* ThirdStageVisAtt = new G4VisAttributes(G4Colour(0.0, 0.9, 0.0)); // green + logicThirdStage->SetVisAttributes(ThirdStageVisAtt); } } @@ -711,18 +582,14 @@ void GaspardTrackerSquare::ReadConfiguration(string Path) void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) { G4RotationMatrix* MMrot = NULL ; -/* G4ThreeVector MMpos = G4ThreeVector(0, 0, 0) ; + G4ThreeVector MMpos = G4ThreeVector(0, 0, 0) ; G4ThreeVector MMu = G4ThreeVector(0, 0, 0) ; G4ThreeVector MMv = G4ThreeVector(0, 0, 0) ; - G4ThreeVector MMw = G4ThreeVector(0, 0, 0) ;*/ - MMpos = G4ThreeVector(0, 0, 0) ; - MMu = G4ThreeVector(0, 0, 0) ; - MMv = G4ThreeVector(0, 0, 0) ; - MMw = G4ThreeVector(0, 0, 0) ; + G4ThreeVector MMw = G4ThreeVector(0, 0, 0) ; G4ThreeVector MMCenter = G4ThreeVector(0, 0, 0) ; - bool FirstStage = true ; - bool SecondStage = true ; - bool ThirdStage = true ; + bool FirstStage = true; + bool SecondStage = true; + bool ThirdStage = true; G4int NumberOfTelescope = m_DefinitionType.size() ; @@ -732,31 +599,21 @@ void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) // (u,v,w) unitary vector associated to telescope referencial // (u,v) // to silicon plan // w perpendicular to (u,v) plan and pointing ThirdStage - G4cout << "############ Gaspard " << i << " #############" << G4endl; - MMu = m_X128_Y1[i] - m_X1_Y1[i] ; - G4cout << "MMu: X = " << MMu(0) << " , Y = " << MMu(1) << " , Z = " << MMu(2) << G4endl; - MMu = MMu.unit() ; - G4cout << "Norm MMu: X = " << MMu(0) << " , Y = " << MMu(1) << " , Z = " << MMu(2) << G4endl; - - MMv = m_X1_Y128[i] - m_X1_Y1[i] ; - G4cout << "MMv X = " << MMv(0) << " , Y = " << MMv(1) << " , Z = " << MMv(2) << G4endl; - MMv = MMv.unit() ; - G4cout << "Norm MMv X = " << MMv(0) << " , Y = " << MMv(1) << " , Z = " << MMv(2) << G4endl; + MMu = m_X128_Y1[i] - m_X1_Y1[i]; + MMu = MMu.unit(); - G4ThreeVector MMscal = MMu.dot(MMv); - G4cout << "Norm MMu.MMv X = " << MMv(0) << " , Y = " << MMv(1) << " , Z = " << MMv(2) << G4endl; + MMv = m_X1_Y128[i] - m_X1_Y1[i]; + MMv = MMv.unit(); - MMw = MMu.cross(MMv) ; -// if (MMw.z() > 0) MMw = MMv.cross(MMu) ; - MMw = MMw.unit() ; + MMw = MMu.cross(MMv); + MMw = MMw.unit(); - MMCenter = (m_X1_Y1[i] + m_X1_Y128[i] + m_X128_Y1[i] + m_X128_Y128[i]) / 4 ; + MMCenter = (m_X1_Y1[i] + m_X1_Y128[i] + m_X128_Y1[i] + m_X128_Y128[i]) / 4; // Passage Matrix from Lab Referential to Telescope Referential - // MUST2 - MMrot = new G4RotationMatrix(MMu, MMv, MMw) ; + MMrot = new G4RotationMatrix(MMu, MMv, MMw); // translation to place Telescope - MMpos = MMw * Length * 0.5 + MMCenter ; + MMpos = MMw * Length * 0.5 + MMCenter; } // By Angle @@ -769,13 +626,13 @@ void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) // w perpendicular to (u,v) plan and pointing ThirdStage // Phi is angle between X axis and projection in (X,Y) plan // Theta is angle between position vector and z axis - G4double wX = m_R[i] * sin(Theta / rad) * cos(Phi / rad) ; - G4double wY = m_R[i] * sin(Theta / rad) * sin(Phi / rad) ; - G4double wZ = m_R[i] * cos(Theta / rad) ; - MMw = G4ThreeVector(wX, wY, wZ) ; + G4double wX = m_R[i] * sin(Theta / rad) * cos(Phi / rad); + G4double wY = m_R[i] * sin(Theta / rad) * sin(Phi / rad); + G4double wZ = m_R[i] * cos(Theta / rad); + MMw = G4ThreeVector(wX, wY, wZ); // vector corresponding to the center of the module - CT = MMw; + MMCenter = MMw; // vector parallel to one axis of silicon plane G4double ii = cos(Theta / rad) * cos(Phi / rad); @@ -797,7 +654,7 @@ void GaspardTrackerSquare::ConstructDetector(G4LogicalVolume* world) MMrot->rotate(m_beta_v[i], MMv); MMrot->rotate(m_beta_w[i], MMw); // translation to place Telescope - MMpos = MMw * Length * 0.5 + CT ; + MMpos = MMw * Length * 0.5 + MMCenter; } FirstStage = m_wFirstStage[i] ;