From 47fc13a296dab2a222f7dd71ad0a2dc9bb8ccbf4 Mon Sep 17 00:00:00 2001 From: deserevi <deserevi@nptool> Date: Mon, 11 Oct 2010 12:39:08 +0000 Subject: [PATCH] * Add strips for GaspardTrackerAnnular shape in NPSimulation + Theta and Phi strips are added * Cosmetic changes in AnnularS1.cc --- .../gaspardTestSpheric.detector | 8 ++ Inputs/EventGenerator/alpha.source | 4 +- NPLib/GASPARD/GaspardTrackerNew.cxx | 7 +- NPLib/GASPARD/Makefile | 3 +- NPSimulation/include/GaspardTrackerAnnular.hh | 5 + NPSimulation/src/AnnularS1.cc | 96 +++++++++---------- NPSimulation/src/GaspardScorers.cc | 60 +++++++++--- NPSimulation/vis.mac | 20 ++-- 8 files changed, 121 insertions(+), 82 deletions(-) diff --git a/Inputs/DetectorConfiguration/gaspardTestSpheric.detector b/Inputs/DetectorConfiguration/gaspardTestSpheric.detector index bb2d10ec9..8ee8188be 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 343524fe6..734a62548 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 cb6b1dfe5..fb319dbbb 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 432f67eb7..1060750ba 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 a07513fd0..7b90458ea 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 6b3426484..9c904669d 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 3897c87eb..22ae3d76b 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 a5d707fb4..a42fdb8de 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 -- GitLab