diff --git a/Inputs/DetectorConfiguration/gaspardTestSpheric.detector b/Inputs/DetectorConfiguration/gaspardTestSpheric.detector index bb2d10ec9784e8d7c337f8f47fe4e07b3e30f893..8ee8188be61d41ff3714a3699d54624cf067bfe1 100644 --- a/Inputs/DetectorConfiguration/gaspardTestSpheric.detector +++ b/Inputs/DetectorConfiguration/gaspardTestSpheric.detector @@ -27,6 +27,14 @@ Target %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% GaspardTracker %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%0 Central Barrel +GPDAnnular + Z= 200 + RMIN= 16 + RMAX= 52 + FIRSTSTAGE= 1 + SECONDSTAGE= 1 + THIRDSTAGE= 1 + VIS= all %GPDTrapezoid THETA= 90 PHI= 90 diff --git a/Inputs/EventGenerator/alpha.source b/Inputs/EventGenerator/alpha.source index 343524fe6bf0f84f05874a7e5090b5475ba93b40..734a625482fe1def06458662252b6976f487be90 100644 --- a/Inputs/EventGenerator/alpha.source +++ b/Inputs/EventGenerator/alpha.source @@ -6,8 +6,8 @@ Isotropic EnergyLow= 0 EnergyHigh= 25 - HalfOpenAngleMin= 0 - HalfOpenAngleMax= 90 + HalfOpenAngleMin= 155 + HalfOpenAngleMax= 180 x0= 0 y0= 0 z0= 0 diff --git a/NPLib/GASPARD/GaspardTrackerNew.cxx b/NPLib/GASPARD/GaspardTrackerNew.cxx index cb6b1dfe582d9909d477ee0716b6b243d710d17a..fb319dbbb7d64debe9a540e3dd841b49154eb58f 100644 --- a/NPLib/GASPARD/GaspardTrackerNew.cxx +++ b/NPLib/GASPARD/GaspardTrackerNew.cxx @@ -42,6 +42,7 @@ // Gaspard headers #include "GaspardTrackerDummyShape.h" #include "GaspardTrackerTrapezoid.h" +#include "GaspardTrackerAnnular.h" using namespace std ; @@ -115,9 +116,9 @@ void GaspardTrackerNew::ReadConfiguration(string Path) } else if (LineBuffer.compare(0, 10, "GPDAnnular") == 0 && GPDTrkAnnular == false) { GPDTrkAnnular = true; -/* + // instantiate a new "detector" corresponding to the Trapezoid elements - GaspardTrackerModule* myDetector = new GaspardTrackerAnnular(); + GaspardTrackerModule* myDetector = new GaspardTrackerAnnular(m_ModulesMap, m_EventPhysics); // Pass the data object to the GaspardTracker*** object myDetector->SetGaspardDataPointer(m_EventData); @@ -126,7 +127,7 @@ void GaspardTrackerNew::ReadConfiguration(string Path) ConfigFile.close(); myDetector->ReadConfiguration(Path); ConfigFile.open(Path.c_str()); -*/ } + } else if (LineBuffer.compare(0, 13, "GPDDummyShape") == 0 && GPDTrkDummyShape == false) { GPDTrkDummyShape = true; diff --git a/NPLib/GASPARD/Makefile b/NPLib/GASPARD/Makefile index 432f67eb72f205832cae20f5dca6197577ac9512..1060750baf2d9b78cf8dd54728e51fb0af0ff4ef 100644 --- a/NPLib/GASPARD/Makefile +++ b/NPLib/GASPARD/Makefile @@ -295,7 +295,7 @@ TGaspardTrackerPhysicsNewDict.cxx: TGaspardTrackerPhysicsNew.h rootcint -f $@ -c $^ libGaspardTrackerModules.so: GaspardTrackerModule.o GaspardTrackerDummyShape.o \ - GaspardTrackerTrapezoid.o + GaspardTrackerTrapezoid.o GaspardTrackerAnnular.o $(LD) $(SOFLAGS) $^ $(OutPutOpt) $@ @@ -309,6 +309,7 @@ TGaspardTrackerPhysicsNew.o: TGaspardTrackerPhysicsNew.cxx TGaspardTrackerPhysic GaspardTrackerModule.o: GaspardTrackerModule.cxx GaspardTrackerModule.h GaspardTrackerDummyShape.o: GaspardTrackerDummyShape.cxx GaspardTrackerDummyShape.h GaspardTrackerTrapezoid.o: GaspardTrackerTrapezoid.cxx GaspardTrackerTrapezoid.h +GaspardTrackerAnnular.o: GaspardTrackerAnnular.cxx GaspardTrackerAnnular.h ####################################### ############# Clean and More ########## diff --git a/NPSimulation/include/GaspardTrackerAnnular.hh b/NPSimulation/include/GaspardTrackerAnnular.hh index a07513fd035fc4cb2c4dd51452778bb6f0e4289d..7b90458ea73d9a333e1775e91ea6c0960de0544d 100644 --- a/NPSimulation/include/GaspardTrackerAnnular.hh +++ b/NPSimulation/include/GaspardTrackerAnnular.hh @@ -147,6 +147,11 @@ namespace GPDANNULAR const G4double MylarCsIThickness = 3*micrometer; const G4double ThirdStageThickness = 1.5*mm; + // Characteristics + const G4int NbPhiStrips = 16; + const G4int NbThetaStrips = 16; + const G4int NbThetaQuadrant = 4; + // Starting at the front and going in direction of third stage const G4double AluStripFront_PosZ = Length* -0.5 + 0.5*AluStripThickness ; const G4double Silicon_PosZ = AluStripFront_PosZ + 0.5*AluStripThickness + 0.5*FirstStageThickness ; diff --git a/NPSimulation/src/AnnularS1.cc b/NPSimulation/src/AnnularS1.cc index 6b3426484162d020a23fb354701b3eca186b079c..9c904669d19b1bf4d9cfee5be62c4e6095ebe1d4 100644 --- a/NPSimulation/src/AnnularS1.cc +++ b/NPSimulation/src/AnnularS1.cc @@ -251,63 +251,57 @@ void AnnularS1::ReadConfiguration(string Path) string LineBuffer, DataBuffer; G4double Z = 0; - bool check_Z = false , check_VIS=false,ReadingStatus = false ; + bool check_Z = false; + bool check_VIS = false; + bool ReadingStatus = false; while (!ConfigFile.eof()) { getline(ConfigFile, LineBuffer); - - if (LineBuffer.compare(0, 9, "AnnularS1") == 0) { + if (LineBuffer.compare(0, 9, "AnnularS1") == 0) { G4cout << "///" << G4endl ; G4cout << "Annular element found: " << G4endl ; - ReadingStatus = true ; - } - - else ReadingStatus = false ; - - while(ReadingStatus) - { - ConfigFile >> DataBuffer; - - //Search for comment Symbol % - if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - - //Position method - else if (DataBuffer.compare(0, 2, "Z=") == 0) { - check_Z = true; - ConfigFile >> DataBuffer ; - Z = atof(DataBuffer.c_str()) ; - Z = Z * mm; - cout << "Z: " << Z / mm << endl; - } - - else if (DataBuffer.compare(0, 4, "VIS=") == 0) { - check_VIS = true ; - ConfigFile >> DataBuffer; - if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; - } - - - /////////////////////////////////////////////////// - // If no Detector Token and no comment, toggle out - else - {ReadingStatus = false; G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl ;} - - - //Add The previously define telescope - //With position method - if (check_Z&&check_VIS) { - AddModule(Z); - check_Z = false ; - check_VIS=false ; - ReadingStatus = false ; - cout << "///"<< endl ; - } - - } - - - + ReadingStatus = true ; + } + else ReadingStatus = false ; + + while (ReadingStatus) { + ConfigFile >> DataBuffer; + + // Search for comment Symbol % + if (DataBuffer.compare(0, 1, "%") == 0) { + ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' ); + } + + // Position method + else if (DataBuffer.compare(0, 2, "Z=") == 0) { + check_Z = true; + ConfigFile >> DataBuffer ; + Z = atof(DataBuffer.c_str()) ; + Z = Z * mm; + cout << "Z: " << Z / mm << endl; + } + else if (DataBuffer.compare(0, 4, "VIS=") == 0) { + check_VIS = true; + ConfigFile >> DataBuffer; + if (DataBuffer.compare(0, 3, "all") == 0) m_non_sensitive_part_visiualisation = true; + } + else { + /////////////////////////////////////////////////// + // If no Detector Token and no comment, toggle out + ReadingStatus = false; + G4cout << "Wrong Token Sequence: Getting out " << DataBuffer << G4endl; + } + + // Add The previously define module + if (check_Z && check_VIS) { + AddModule(Z); + check_Z = false; + check_VIS = false; + ReadingStatus = false; + cout << "///"<< endl; + } + } } } diff --git a/NPSimulation/src/GaspardScorers.cc b/NPSimulation/src/GaspardScorers.cc index 3897c87ebd874a10c61c58505aa7fcc8b7750860..22ae3d76bc402bdb2bf8957275529788ba92584d 100644 --- a/NPSimulation/src/GaspardScorers.cc +++ b/NPSimulation/src/GaspardScorers.cc @@ -648,20 +648,43 @@ G4bool GPDScorerFirstStageFrontStripAnnular::ProcessHits(G4Step* aStep, G4Toucha // get detector number int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "GPDAnnular"); - // get front strip + // Hit position in the world frame G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); + + // Hit position in the detector frame POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - G4double StripPitch = m_StripPlaneSize / m_NumberOfStrip; + // Radial position in the Oxy plane + G4double r = sqrt(pow(POS(0), 2) + pow(POS(1), 2)); + + // Phi angle + G4double phi = atan2(POS(1), POS(0)) / deg; + if (phi < 0) phi += 360; + + // Phi quadrant + G4double PhiWidth = 360. / GPDANNULAR::NbThetaQuadrant; + G4double PhiQuadrantNumber = floor(phi / PhiWidth); + + // Theta strip pitch + // Interstrip should be taken into account here. To be done + G4double ThetaStripPitch = (GPDANNULAR::FirstStageRmax - GPDANNULAR::FirstStageRmin) / GPDANNULAR::NbThetaStrips; + G4double dummy = (r - GPDANNULAR::FirstStageRmin); + if (dummy < 0 && fabs(dummy) < 1e-6) dummy *= -1; + G4double ThetaStripNumber = floor(dummy / ThetaStripPitch); + ThetaStripNumber += PhiQuadrantNumber * GPDANNULAR::NbThetaStrips; + + if (ThetaStripNumber < 1e-6) { + /* G4cout << "POS: " << POS << G4endl; + G4cout << "r, phi " << r << " " << phi << G4endl; + G4cout << "PhiWidth, PhiQuadrantNumber " << PhiWidth << " " << PhiQuadrantNumber << G4endl; + G4cout << "ThetaStripPitch, ThetaStripNumber, dummy " << ThetaStripPitch << " " << ThetaStripNumber << " " << dummy << G4endl;*/ + } - G4double temp = (POS(0) + m_StripPlaneSize / 2.) / StripPitch ; - G4double X = int(temp) + 1 ; - //Rare case where particle is close to edge of silicon plan - if (X == 129) X = 128; G4double edep = aStep->GetTotalEnergyDeposit(); if (edep < 100*keV) return FALSE; G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, X); + EvtMap->set(DetNbr + index, ThetaStripNumber); + return TRUE; } @@ -713,22 +736,29 @@ G4bool GPDScorerFirstStageBackStripAnnular::ProcessHits(G4Step* aStep, G4Touchab // get detector number int DetNbr = GENERALSCORERS::PickUpDetectorNumber(aStep, "GPDAnnular"); - // get back strip + // Hit position in the world frame G4ThreeVector POS = aStep->GetPreStepPoint()->GetPosition(); + + // Hit position in the detector frame POS = aStep->GetPreStepPoint()->GetTouchableHandle()->GetHistory()->GetTopTransform().TransformPoint(POS); - G4double StripPitch = m_StripPlaneSize / m_NumberOfStrip; + // Phi angle + G4double phi = atan2(POS(1), POS(0)) / deg; + if (phi < 0) phi += 360; - G4double temp = (POS(1) + m_StripPlaneSize / 2.) / StripPitch ; - G4int temp2 = temp ; - G4double Y = temp2 + 1 ; - //Rare case where particle is close to edge of silicon plan - if (Y == 129) Y = 128; + // Phi strip number + // Interstrip should be taken into account here. To be done + G4double PhiWidth = 360. / (GPDANNULAR::NbPhiStrips * GPDANNULAR::NbThetaQuadrant); + G4double PhiStripNumber = floor(phi / PhiWidth); + +// G4cout << POS << G4endl; +// G4cout << "phi " << phi << " PhiWidth " << PhiWidth << " PhiStripNumber " << PhiStripNumber << G4endl; G4double edep = aStep->GetTotalEnergyDeposit(); if (edep < 100*keV) return FALSE; G4int index = aStep->GetTrack()->GetTrackID(); - EvtMap->set(DetNbr + index, Y); + EvtMap->set(DetNbr + index, PhiStripNumber); + return TRUE; } diff --git a/NPSimulation/vis.mac b/NPSimulation/vis.mac index a5d707fb4bdc1aa0e81ebe7c24fcf0af0c750fda..a42fdb8de3c89788d47f48d8f55812954380745d 100644 --- a/NPSimulation/vis.mac +++ b/NPSimulation/vis.mac @@ -10,18 +10,18 @@ ##/vis/open OGLIX ##/vis/open OGLSX #/vis/open VRML2FILE -#/vis/scene/create -#/vis/drawVolume -#/vis/viewer/set/viewpointThetaPhi 0 0 deg -#/vis/viewer/zoom 7 +/vis/scene/create +/vis/drawVolume +/vis/viewer/set/viewpointThetaPhi 0 0 deg +/vis/viewer/zoom 7 ## options to draw trajectories -#/vis/scene/endOfEventAction accumulate -#/vis/scene/add/trajectories 1 -#/tracking/storeTrajectory 1 -#/vis/scene/add/axes 0 0 0 20 cm -#/vis/viewer/refresh +/vis/scene/endOfEventAction accumulate +/vis/scene/add/trajectories 1 +/tracking/storeTrajectory 1 +/vis/scene/add/axes 0 0 0 20 cm +/vis/viewer/refresh # run event #/run/beamOn 0 -#/run/beamOn 10000 +/run/beamOn 1