diff --git a/NPAnalysis/S1554/Analysis.cxx b/NPAnalysis/S1554/Analysis.cxx index 6478e0de4b061bcdada0cccb788501247c249d68..6570ce369e1473de8f5a7051a847477cf5cfbc6f 100644 --- a/NPAnalysis/S1554/Analysis.cxx +++ b/NPAnalysis/S1554/Analysis.cxx @@ -37,19 +37,31 @@ void Analysis::Init(){ InitOutputBranch(); InitInputBranch(); + myReaction = new NPL::Reaction(); + myReaction->ReadConfigurationFile(NPOptionManager::getInstance()->GetReactionFile()); + + string ligth,heavy; + if(myReaction->GetNucleus3()->GetZ()==1 && myReaction->GetNucleus3()->GetA()==1) + ligth = "proton"; + else + ligth = "deuteron"; + + if(myReaction->GetNucleus4()->GetZ()==12) + heavy = "Mg28"; + else + heavy = "Si28"; + + Sharc = (TSharcPhysics*) m_DetectorManager -> GetDetector("Sharc"); Tigress = (TTigressPhysics*) m_DetectorManager -> GetDetector("Tigress"); - LightCD2 = EnergyLoss("proton_CD2.G4table","G4Table",10); - LightAl = EnergyLoss("proton_Al.G4table","G4Table",10); + LightCD2 = EnergyLoss(ligth+"_CD2.G4table","G4Table",10); + LightAl = EnergyLoss(ligth+"_Al.G4table","G4Table",10); // LightAl = EnergyLoss("alpha_Al.G4table","G4Table",10); - BeamCD2 = EnergyLoss("Si28_CD2.G4table","G4Table",10); - myReaction = new NPL::Reaction(); - myReaction->ReadConfigurationFile(NPOptionManager::getInstance()->GetReactionFile()); -// TargetThickness = m_DetectorManager->GetTargetThickness()*micrometer; - TargetThickness = 0; + BeamCD2 = EnergyLoss(heavy+"_CD2.G4table","G4Table",10); + TargetThickness = m_DetectorManager->GetTargetThickness()*micrometer; OriginalBeamEnergy = myReaction->GetBeamEnergy(); Rand = TRandom3(); DetectorNumber = 0 ; @@ -63,6 +75,9 @@ void Analysis::Init(){ X_Sharc = 0; Y_Sharc = 0; Z_Sharc = 0; + X_Trifoil = 0; + Y_Trifoil = 0 ; + Si_E_Sharc = 0; E_Sharc = 0; ThetaDetector = 0; @@ -71,44 +86,6 @@ void Analysis::Init(){ double finalEnergy = BeamCD2.Slow(224,TargetThickness*0.5,0); myReaction->SetBeamEnergy(finalEnergy); cout << "Set Beam energy to: " << finalEnergy << " MeV" << endl; - - // Load cut for second Pad cal -/* TFile* file ; - file = new TFile("cuts/cut_elgs_det10.root","READ"); - cut_deuton_d10 = (TCutG*) file->FindObjectAny("cut_elgs_det10"); - file = new TFile("cuts/cut_elgs_det12.root","READ"); - cut_deuton_d12 = (TCutG*) file->FindObjectAny("cut_elgs_det12"); - file = new TFile("cuts/Cut_dd.root","READ"); - cut_dd = (TCutG*) file->FindObjectAny("Cut_dd"); - PADFile.open("PADEvent.txt"); -*/ - - - // Load cut for PAD cal -/* TFile* file ; - file = new TFile("cuts/deuton_d10.root","READ"); - cut_deuton_d10 = (TCutG*) file->FindObjectAny("deuton_d10"); - file = new TFile("cuts/proton_d10.root","READ"); - cut_proton_d10 = (TCutG*) file->FindObjectAny("proton_d10"); - file = new TFile("cuts/deuton_d12.root","READ"); - cut_deuton_d12 = (TCutG*) file->FindObjectAny("deuton_d12"); - file = new TFile("cuts/proton_d12.root","READ"); - cut_proton_d12 = (TCutG*) file->FindObjectAny("proton_d12"); - PADFile.open("PADEvent.txt"); - */ - /* // Load the cut for alignement - for(unsigned int i = 0 ; i < 8 ; i++){ - TFile* file = new TFile(Form("cuts/Ex5_D%i.root",i+1),"READ"); - cut_ex5.push_back((TCutG*) file->FindObjectAny(Form("Ex5_D%i",i+1))); - if(! file->FindObjectAny(Form("Ex5_D%i",i+1))){ - cout << "Fail to Load " << Form("Ex5_D%i",i+1) << endl; - exit(1); - } - } - - box_pos.open("BoxPos.txt"); - qqq_pos.open("QQQPos.txt"); - */ } //////////////////////////////////////////////////////////////////////////////// @@ -147,84 +124,35 @@ void Analysis::TreatEvent(){ // Target Correction ELab = LightCD2.EvaluateInitialEnergy( Energy ,TargetThickness*0.5, ThetaNormalTarget); - /************************************************/ - /* int DetectorNumber = Sharc->DetectorNumber[0]; - if(DetectorNumber==10 && Sharc->PAD_E[0]>0){ - if(cut_proton_d10->IsInside(Sharc->PAD_E[0],Sharc->Strip_E[0]*cos(ThetaDetector))){ - PADFile << "10 proton " << Sharc->Strip_E[0] << " " << Sharc->PAD_E[0] << " " << ThetaDetector << endl; - } - else if(cut_deuton_d10->IsInside(Sharc->PAD_E[0],Sharc->Strip_E[0]*cos(ThetaDetector))) - PADFile << "10 deuton " << Sharc->Strip_E[0] << " " << Sharc->PAD_E[0] << " " << ThetaDetector << endl; - } - - if(DetectorNumber==12 && Sharc->PAD_E[0]>0){ - if(cut_proton_d12->IsInside(Sharc->PAD_E[0],Sharc->Strip_E[0]*cos(ThetaDetector))) - PADFile << "12 proton " << Sharc->Strip_E[0] << " " << Sharc->PAD_E[0] << " " << ThetaDetector << endl; - else if(cut_deuton_d12->IsInside(Sharc->PAD_E[0], Sharc->Strip_E[0]*cos(ThetaDetector))) - PADFile << "12 deuton " << Sharc->Strip_E[0] << " " << Sharc->PAD_E[0] << " " << ThetaDetector << endl; - } - */ - - /************************************************/ - /* int DetectorNumber = Sharc->DetectorNumber[0]; - if(cut_dd->IsInside(Sharc->PAD_E[0],Sharc->Strip_E[0]*cos(ThetaDetector))){ - if(DetectorNumber == 10){ - if(cut_deuton_d10->IsInside(ThetaLab/deg,ELab)){ - double a = 9.23351e-13 ; - double b = 8.35809e-06 ; - double c = 5.77842e-01-Sharc->PAD_E[0]; - double delta = b*b-4*a*c; - double RawE = (-b + sqrt(delta))/(2*a); - PADFile << "10 deuton " << Sharc->Strip_E[0] << " " << RawE << " " << ThetaLab << " " << ThetaNormalTarget << endl; - } - } - - else if(DetectorNumber == 12){ - if(cut_deuton_d12->IsInside(ThetaLab/deg,ELab)){ - double a = 1.63514e-12; - double b = 7.52050e-06; - double c = 5.93687e-01-Sharc->PAD_E[0]; - double delta = b*b-4*a*c; - double RawE = (-b + sqrt(delta))/(2*a); - PADFile << "12 deuton " << Sharc->Strip_E[0] << " " << RawE<< " " << ThetaLab << " " << ThetaNormalTarget << endl; - } - } - - }*/ - - /************************************************/ - /* int DetectorNumber = Sharc->DetectorNumber[0]; - bool checkT = false; - if(Tigress->AddBack_DC.size()>0){ - if(Tigress->AddBack_DC[0]/1000.> 4.6 && Tigress->AddBack_DC[0]/1000.< 5.4) - checkT=true; - } - - if(checkT){ - if(DetectorNumber<5){ - if(cut_ex5[DetectorNumber-1]->IsInside(ThetaLab/deg,ELab)) - qqq_pos << DetectorNumber << " " << Energy << " " << HitDirection.X() << " " << HitDirection.Y() << " " << HitDirection.Z() << endl; - } - - else if(DetectorNumber<9){ - if(cut_ex5[DetectorNumber-1]->IsInside(ThetaLab/deg,ELab)) - box_pos << DetectorNumber << " " << Energy << " " << HitDirection.X() << " " << HitDirection.Y() << " " << HitDirection.Z() << endl; - } - } - */ - /************************************************/ - /************************************************/ // Part 3 : Excitation Energy Calculation Ex = myReaction -> ReconstructRelativistic( ELab , ThetaLab ); - /************************************************/ /************************************************/ // Part 4 : Theta CM Calculation ThetaCM = myReaction -> EnergyLabToThetaCM( ELab , ThetaLab)/deg; + + /************************************************/ + // Part 5: Compute the X and Y coordinate of the Heavy in the Trifoil plan + myReaction->SetThetaCM(ThetaCM*deg); + myReaction->SetExcitationHeavy(Ex); + + double d1,d2,d3,t; + myReaction->KineRelativistic(d1,d2,t,d3); + double x = tan(t)*400; + TVector3 P; + P.SetXYZ(x,0,400); + P.RotateZ(HitDirection.Phi()+3.14159); + X_Trifoil = P.X(); + Y_Trifoil = P.Y(); + + myReaction->SetThetaCM(0); + myReaction->SetExcitationHeavy(0); + + + /************************************************/ + // Unit conversion ThetaLab=ThetaLab/deg; - /* if(ThetaLab>140) - ThetaLab=Rand.Uniform(ThetaLab-0.4,ThetaLab+0.4);*/ /************************************************/ }//end loop Sharc } @@ -243,6 +171,8 @@ void Analysis::InitOutputBranch(){ RootOutput::getInstance()->GetTree()->Branch("X_Sharc",&X_Sharc,"X_Sharc/D"); RootOutput::getInstance()->GetTree()->Branch("Y_Sharc",&Y_Sharc,"Y_Sharc/D"); RootOutput::getInstance()->GetTree()->Branch("Z_Sharc",&Z_Sharc,"Z_Sharc/D"); + RootOutput::getInstance()->GetTree()->Branch("X_Trifoil",&X_Trifoil,"X_Trifoil/D"); + RootOutput::getInstance()->GetTree()->Branch("Y_Trifoil",&Y_Trifoil,"Y_Trifoil/D"); RootOutput::getInstance()->GetTree()->Branch("RunNumber",&RunNumber,"RunNumber/I"); RootOutput::getInstance()->GetTree()->Branch("RunNumberMinor",&RunNumberMinor,"RunNumberMinor/I"); @@ -261,6 +191,11 @@ void Analysis::ReInitValue(){ ThetaLab = -1000; ThetaCM = -1000; ThetaDetector=-1000; + X_Sharc = -1000; + Y_Sharc = -1000; + Z_Sharc = -1000; + X_Trifoil = -1000; + Y_Trifoil = -1000; } diff --git a/NPAnalysis/S1554/Analysis.h b/NPAnalysis/S1554/Analysis.h index 22d78fdf0593980638346d9b1567928703544c4a..ebe1b6d41bf1b847beaa642b8ab3831bea827019 100644 --- a/NPAnalysis/S1554/Analysis.h +++ b/NPAnalysis/S1554/Analysis.h @@ -82,6 +82,8 @@ TInitialConditions* myInit ; double X_Sharc ; double Y_Sharc ; double Z_Sharc ; + double X_Trifoil; + double Y_Trifoil; double ThetaDetector; double Si_E_Sharc ; double E_Sharc ; diff --git a/NPLib/Core/NPOptionManager.cxx b/NPLib/Core/NPOptionManager.cxx index 905a4c4772490dc5d3aa174d6dbb3bcc971500d9..126bd11e7c3459b8338132215f5b068c81cb8dae 100644 --- a/NPLib/Core/NPOptionManager.cxx +++ b/NPLib/Core/NPOptionManager.cxx @@ -61,6 +61,10 @@ void NPOptionManager::ReadTheInputArgument(int argc, char** argv){ fRunToReadFileName = fDefaultRunToReadFileName; fCalibrationFileName = fDefaultCalibrationFileName; fG4MacroPath = fDefaultG4MacroPath; + fLastSimFile = false; + fLastPhyFile = false; + fLastResFile = false; + fLastAnyFile = false; fVerboseLevel = 1; fNumberOfEntryToAnalyse = -1; fDisableAllBranchOption = false; diff --git a/NPLib/Physics/NPReaction.cxx b/NPLib/Physics/NPReaction.cxx index 8fef2325dca94fbc09d2db7dd527543cf5e973d0..e48b763b5d411efbcd105d23bf11e7014cb43b39 100644 --- a/NPLib/Physics/NPReaction.cxx +++ b/NPLib/Physics/NPReaction.cxx @@ -677,6 +677,25 @@ TGraph* Reaction::GetThetaLabVersusThetaCM(double AngleStep_CM){ fAngleLine= new TGraph(vx.size(),&vx[0],&vy[0]); return(fAngleLine); } +//////////////////////////////////////////////////////////////////////////////////////////// +TGraph* Reaction::GetELabVersusThetaCM(double AngleStep_CM){ + + vector<double> vx; + vector<double> vy; + double theta3,E3,theta4,E4; + + for (double angle=0 ; angle < 360 ; angle+=AngleStep_CM){ + SetThetaCM(angle*deg); + KineRelativistic(theta3, E3, theta4, E4); + + vx.push_back(E3); + vy.push_back(fThetaCM/deg); + } + + fAngleLine= new TGraph(vx.size(),&vx[0],&vy[0]); + return(fAngleLine); +} + //////////////////////////////////////////////////////////////////////////////////////////// void Reaction::PrintKinematic(){ diff --git a/NPLib/Physics/NPReaction.h b/NPLib/Physics/NPReaction.h index 74e20255c293d8db370c2f5453d11b0780e01aa3..ac713aaf3879d0094ee7fb2d93ad089855d77521 100644 --- a/NPLib/Physics/NPReaction.h +++ b/NPLib/Physics/NPReaction.h @@ -208,6 +208,7 @@ namespace NPL{ TGraph* GetKinematicLine4(double AngleStep_CM=1); TGraph* GetBrhoLine3(double AngleStep_CM=1); TGraph* GetThetaLabVersusThetaCM(double AngleStep_CM=1); + TGraph* GetELabVersusThetaCM(double AngleStep_CM=1); TGraph* GetTheta3VsTheta4(double AngleStep_CM=1); void PrintKinematic(); double GetP_CM_1() {return pCM_1;} diff --git a/NPSimulation/Sharc/Sharc.cc b/NPSimulation/Sharc/Sharc.cc index 65932ebca50f43af3b431c4700d9996170018a14..8ae4e8c9aae2111b2566051230342b85532cf5e3 100644 --- a/NPSimulation/Sharc/Sharc.cc +++ b/NPSimulation/Sharc/Sharc.cc @@ -39,7 +39,7 @@ #include "G4Colour.hh" #include "G4PVDivision.hh" #include "G4SubtractionSolid.hh" - +#include "G4UnionSolid.hh" // NPS #include "Sharc.hh" #include "SiliconScorers.hh" @@ -82,24 +82,24 @@ Sharc::~Sharc(){ //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Sharc::AddBoxDetector(G4double Z,G4double Thickness1,G4double Thickness2,G4double Thickness3,G4double Thickness4,G4double ThicknessPAD1,G4double ThicknessPAD2,G4double ThicknessPAD3,G4double ThicknessPAD4){ - + m_Type.push_back(true); m_Z.push_back(Z); - + vector<G4double> ThicknessBOX; ThicknessBOX.push_back(Thickness1); ThicknessBOX.push_back(Thickness2); ThicknessBOX.push_back(Thickness3); ThicknessBOX.push_back(Thickness4); m_ThicknessBOX.push_back(ThicknessBOX); - + vector<G4double> ThicknessPAD; ThicknessPAD.push_back(ThicknessPAD1); ThicknessPAD.push_back(ThicknessPAD2); ThicknessPAD.push_back(ThicknessPAD3); ThicknessPAD.push_back(ThicknessPAD4); m_ThicknessPAD.push_back(ThicknessPAD); - + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -118,10 +118,10 @@ void Sharc::ReadConfiguration(string Path){ ConfigFile.open(Path.c_str()) ; string LineBuffer ; string DataBuffer ; - + G4double R,Phi,Thickness,Thickness1,Thickness2,Thickness3,Thickness4,ThicknessPAD1,ThicknessPAD2,ThicknessPAD3,ThicknessPAD4,Z; R=Phi=Thickness=Thickness1=Thickness2=Thickness3=Thickness4=ThicknessPAD1=ThicknessPAD2=ThicknessPAD3=ThicknessPAD4=Z=0; - + G4ThreeVector Pos; bool check_R = false ; bool check_Phi = false ; @@ -135,45 +135,45 @@ void Sharc::ReadConfiguration(string Path){ bool check_PAD3 = false ; bool check_PAD4 = false ; bool check_Z = false ; - + bool ReadingStatusQQQ = false ; bool ReadingStatusBOX = false ; bool ReadingStatus = false ; while (!ConfigFile.eof()){ int VerboseLevel = NPOptionManager::getInstance()->GetVerboseLevel(); - + getline(ConfigFile, LineBuffer); // G4cout << LineBuffer << G4endl; if (LineBuffer.compare(0, 5, "Sharc") == 0) ReadingStatus = true; - + while (ReadingStatus && !ConfigFile.eof()) { ConfigFile >> DataBuffer ; // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - + // CD case if (DataBuffer=="SharcQQQ"){ if(VerboseLevel==1) G4cout << "///" << G4endl ; if(VerboseLevel==1) G4cout << "QQQ Quadrant found: " << G4endl ; ReadingStatusQQQ = true ; } - + // Box case else if (DataBuffer=="SharcBOX"){ if(VerboseLevel==1) G4cout << "///" << G4endl ; if(VerboseLevel==1) G4cout << "Box Detector found: " << G4endl ; ReadingStatusBOX = true ; } - + // Reading Block while(ReadingStatusQQQ){ // Pickup Next Word ConfigFile >> DataBuffer ; - + // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - + //Position method else if (DataBuffer == "Z=") { check_Z = true; @@ -181,28 +181,28 @@ void Sharc::ReadConfiguration(string Path){ Z= atof(DataBuffer.c_str())*mm; if(VerboseLevel==1) G4cout << " Z= " << Z/mm << "mm" << G4endl; } - + else if (DataBuffer == "R=") { check_R = true; ConfigFile >> DataBuffer ; R= atof(DataBuffer.c_str())*mm; if(VerboseLevel==1) G4cout << " R= " << R/mm << "mm" << G4endl; } - + else if (DataBuffer == "Phi=") { check_Phi = true; ConfigFile >> DataBuffer ; Phi= atof(DataBuffer.c_str())*deg; if(VerboseLevel==1) G4cout << " Phi= " << Phi/deg << "deg" << G4endl; } - + else if (DataBuffer == "ThicknessDector=") { check_Thickness = true; ConfigFile >> DataBuffer ; Thickness= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessDetector= " << Thickness/um << "um" << G4endl; } - + /////////////////////////////////////////////////// // If no Detector Token and no comment, toggle out else{ @@ -210,12 +210,12 @@ void Sharc::ReadConfiguration(string Path){ G4cout << "Error: Wrong Token Sequence: Getting out " << DataBuffer << G4endl ; exit(1); } - + ///////////////////////////////////////////////// // If All necessary information there, toggle out - + if (check_R && check_Phi && check_Z && check_Thickness){ - + ReadingStatusQQQ = false; AddQQQDetector(G4ThreeVector(R,Phi,Z),Thickness); // Reinitialisation of Check Boolean @@ -223,16 +223,16 @@ void Sharc::ReadConfiguration(string Path){ check_Phi = false ; check_Thickness = false ; } - + } - + while(ReadingStatusBOX){ // Pickup Next Word ConfigFile >> DataBuffer ; - + // Comment Line if (DataBuffer.compare(0, 1, "%") == 0) { ConfigFile.ignore ( std::numeric_limits<std::streamsize>::max(), '\n' );} - + //Position method else if (DataBuffer == "Z=") { check_Z = true; @@ -240,63 +240,63 @@ void Sharc::ReadConfiguration(string Path){ Z= atof(DataBuffer.c_str())*mm; if(VerboseLevel==1) G4cout << " Z= " << Z/mm << "mm" << G4endl; } - + else if (DataBuffer == "ThicknessDector1=") { check_Thickness1 = true; ConfigFile >> DataBuffer ; Thickness1= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessDetector1= " << Thickness1/um << "um" << G4endl; } - + else if (DataBuffer == "ThicknessDector2=") { check_Thickness2 = true; ConfigFile >> DataBuffer ; Thickness2= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessDetector2= " << Thickness2/um << "um" << G4endl; } - + else if (DataBuffer == "ThicknessDector3=") { check_Thickness3 = true; ConfigFile >> DataBuffer ; Thickness3= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessDetector3= " << Thickness3/um << "um" << G4endl; } - + else if (DataBuffer == "ThicknessDector4=") { check_Thickness4 = true; ConfigFile >> DataBuffer ; Thickness4= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessDetector4= " << Thickness4/um << "um" << G4endl; } - + else if (DataBuffer == "ThicknessPAD1=") { check_PAD1 = true; ConfigFile >> DataBuffer ; ThicknessPAD1= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessPAD1= " << ThicknessPAD1<< "um" << G4endl; } - + else if (DataBuffer == "ThicknessPAD2=") { check_PAD2 = true; ConfigFile >> DataBuffer ; ThicknessPAD2= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessPAD2= " << ThicknessPAD2<< "um" << G4endl; } - + else if (DataBuffer == "ThicknessPAD3=") { check_PAD3 = true; ConfigFile >> DataBuffer ; ThicknessPAD3= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessPAD3= " << ThicknessPAD3<< "um" << G4endl; } - + else if (DataBuffer == "ThicknessPAD4=") { check_PAD4 = true; ConfigFile >> DataBuffer ; ThicknessPAD4= atof(DataBuffer.c_str())*um; if(VerboseLevel==1) G4cout << " ThicknessPAD4= " << ThicknessPAD4<< "um" << G4endl; } - + /////////////////////////////////////////////////// // If no Detector Token and no comment, toggle out else{ @@ -304,16 +304,16 @@ void Sharc::ReadConfiguration(string Path){ G4cout << "Error: Wrong Token Sequence: Getting out " << DataBuffer << G4endl ; exit(1); } - + ///////////////////////////////////////////////// // If All necessary information there, toggle out - + if (check_Thickness1 && check_Thickness2 && check_Thickness3 && check_Thickness4 && check_PAD1 && check_PAD2 && check_PAD3 && check_PAD4 && check_Z){ ReadingStatusBOX = false; AddBoxDetector(Z,Thickness1,Thickness2,Thickness3,Thickness4, - ThicknessPAD1,ThicknessPAD2,ThicknessPAD3,ThicknessPAD4); + ThicknessPAD1,ThicknessPAD2,ThicknessPAD3,ThicknessPAD4); // Reinitialisation of Check Boolean check_R = false ; check_Phi = false ; @@ -326,7 +326,7 @@ void Sharc::ReadConfiguration(string Path){ check_PAD3 = false; check_PAD4 = false; check_Z = false ; - + } } } @@ -339,66 +339,123 @@ void Sharc::ReadConfiguration(string Path){ void Sharc::ConstructDetector(G4LogicalVolume* world){ ConstructBOXDetector(world); ConstructQQQDetector(world); + ConstructTargetFan(world); +} + +//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... +void Sharc::ConstructTargetFan(G4LogicalVolume* world){ + G4double FanBase_OutterRadius = 8*mm; + G4double FanBase_InnerRadius = 4*mm; + G4double FanBase_Thickness = 9*mm; + + G4double FanPlate_OutterRadius = 66*mm; + G4double FanPlate_InnerRadius = 0*mm; + G4double FanPlateHole_OutterRadius = 53*mm; + G4double FanPlateHole_InnerRadius = 18*mm; + G4double FanPlate_Thickness = 3*mm; + + G4double TargetFrame_Thickness = 0.5*mm; + G4double Fan_Shift = 70*mm+16*mm; + + G4Tubs* FanBaseSolid= new G4Tubs("TargetFanBase" , + FanBase_InnerRadius, + FanBase_OutterRadius, + FanBase_Thickness*0.5, + 0., + M_PI*2); + + G4Tubs* FanPlateWholeSolid= new G4Tubs("TargetFanPlate" , + FanPlate_InnerRadius, + FanPlate_OutterRadius, + FanPlate_Thickness*0.5, + 0*deg, + 60*deg); + + G4Tubs* FanPlateHoleSolid= new G4Tubs("TargetFanPlateHole" , + FanPlateHole_InnerRadius, + FanPlateHole_OutterRadius, + FanPlate_Thickness, + 0*deg, + 60*deg); + + G4SubtractionSolid* FanPlateSolid = + new G4SubtractionSolid("TargetFanSolid",FanPlateWholeSolid,FanPlateHoleSolid,new G4RotationMatrix(),G4ThreeVector(8*mm*sin(60*deg),8*mm*cos(60*deg),0)); + + + G4UnionSolid* TargetFanSolid = + new G4UnionSolid("TargetFanSolid",FanPlateSolid,FanBaseSolid,new G4RotationMatrix(),G4ThreeVector(16*mm*sin(60*deg),16*mm*cos(60*deg),FanPlate_Thickness)); + + + G4LogicalVolume* TargetFan = + new G4LogicalVolume(TargetFanSolid,m_MaterialVacuum,"TargetFan", 0, 0, 0); + + G4RotationMatrix* Rot = new G4RotationMatrix(); + Rot->rotateZ(30*deg-9*deg); + new G4PVPlacement(Rot, + G4ThreeVector(-Fan_Shift,0,0.5*FanPlate_Thickness), + TargetFan,"TargetFan",world,false,0); + + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Sharc::ConstructBOXDetector(G4LogicalVolume* world){ for(unsigned int i = 0 ; i < m_Z.size() ; i++){ for (unsigned int j = 0 ; j < 4; j++) { - + int DetNbr = 0; if(m_Z[i]<0) DetNbr=j+1+4; else DetNbr=j+1+8; // create the Box DSSD // Make the a single detector geometry G4Box* PCBFull = new G4Box("PCBFull" , - BOX_PCB_Length/2., - BOX_PCB_Width/2., - BOX_PCB_Thickness/2.); - + BOX_PCB_Length/2., + BOX_PCB_Width/2., + BOX_PCB_Thickness/2.); + G4Box* WaferShape = new G4Box("WaferShape", - BOX_Wafer_Length/2., - BOX_Wafer_Width/2., - BOX_PCB_Thickness/2.+0.1*mm); - + BOX_Wafer_Length/2., + BOX_Wafer_Width/2., + BOX_PCB_Thickness/2.+0.1*mm); + G4Box* Wafer = new G4Box("Wafer", - BOX_Wafer_Length/2., - BOX_Wafer_Width/2., - m_ThicknessBOX[i][j]/2.); - + BOX_Wafer_Length/2., + BOX_Wafer_Width/2., + m_ThicknessBOX[i][j]/2.); + G4Box* ActiveWafer = new G4Box("ActiveWafer", - BOX_ActiveWafer_Length/2., - BOX_ActiveWafer_Width/2., - m_ThicknessBOX[i][j]/2.); - + BOX_ActiveWafer_Length/2., + BOX_ActiveWafer_Width/2., + m_ThicknessBOX[i][j]/2.); + G4double BOX_PCB_Slot_Width; G4double BOX_PCB_Slot_Deepness; G4double BOX_PCB_Slot_Position; G4double BOX_DetectorSpacing; - + if(m_ThicknessPAD[i][j]>0){ //PAD Case BOX_PCB_Slot_Width = BOX_PCB_Slot_Width2; BOX_PCB_Slot_Deepness = BOX_PCB_Slot_Deepness2; BOX_PCB_Slot_Position = BOX_PCB_Slot_Position2; BOX_DetectorSpacing = BOX_DetectorSpacing2; } - + else{ // No Pad Case BOX_PCB_Slot_Width = BOX_PCB_Slot_Width1; BOX_PCB_Slot_Deepness = BOX_PCB_Slot_Deepness1; BOX_PCB_Slot_Position = BOX_PCB_Slot_Position1; BOX_DetectorSpacing = BOX_DetectorSpacing1 ; } - + G4Box* SlotShape = new G4Box("SlotShape", - BOX_PCB_Slot_Width/2., - BOX_PCB_Width/2.+0.1*mm, - BOX_PCB_Slot_Deepness); - + BOX_PCB_Slot_Width/2., + BOX_PCB_Width/2.+0.1*mm, + BOX_PCB_Slot_Deepness); + G4ThreeVector Box_Wafer_Offset ; if(m_Z[i]<0 ){ - Box_Wafer_Offset = G4ThreeVector(BOX_Wafer_Length_Offset1, BOX_Wafer_Width_Offset1,0 ); + Box_Wafer_Offset = G4ThreeVector(BOX_Wafer_Length_Offset1, BOX_Wafer_Width_Offset1,0 ); } else{ @@ -407,7 +464,7 @@ void Sharc::ConstructBOXDetector(G4LogicalVolume* world){ G4SubtractionSolid* PCB1 = new G4SubtractionSolid("PCB", PCBFull, SlotShape,new G4RotationMatrix,G4ThreeVector(BOX_PCB_Slot_Position, 0,0.5*BOX_PCB_Thickness)); G4SubtractionSolid* PCB = new G4SubtractionSolid("PCB", PCB1, WaferShape,new G4RotationMatrix,Box_Wafer_Offset); - + // Master Volume G4LogicalVolume* logicBoxDetector = new G4LogicalVolume(PCB1,m_MaterialVacuum,"logicBoxDetector", 0, 0, 0); @@ -416,7 +473,7 @@ void Sharc::ConstructBOXDetector(G4LogicalVolume* world){ G4LogicalVolume* logicPCB = new G4LogicalVolume(PCB,m_MaterialPCB,"logicPCB", 0, 0, 0); logicPCB->SetVisAttributes(PCBVisAtt); - + // Sub Volume Wafer G4LogicalVolume* logicWafer = new G4LogicalVolume(Wafer,m_MaterialSilicon,"logicWafer", 0, 0, 0); @@ -428,139 +485,169 @@ void Sharc::ConstructBOXDetector(G4LogicalVolume* world){ // Place the sub volume in the master volume new G4PVPlacement(new G4RotationMatrix(0,0,0), - G4ThreeVector(0,0,0), - logicPCB,"Box_PCB",logicBoxDetector,false,DetNbr); - + G4ThreeVector(0,0,0), + logicPCB,"Box_PCB",logicBoxDetector,false,DetNbr); + if(m_ThicknessBOX[i][j]>0){ new G4PVPlacement(new G4RotationMatrix(0,0,0), - Box_Wafer_Offset+G4ThreeVector(0,0,0.5*BOX_PCB_Thickness-0.5*m_ThicknessBOX[i][j]), - logicWafer,"Box_Wafer",logicBoxDetector,false,DetNbr); + Box_Wafer_Offset+G4ThreeVector(0,0,0.5*BOX_PCB_Thickness-0.5*m_ThicknessBOX[i][j]), + logicWafer,"Box_Wafer",logicBoxDetector,false,DetNbr); new G4PVPlacement(new G4RotationMatrix(0,0,0), - G4ThreeVector(0,0,0), - logicActiveWafer,"Box_ActiveWafer",logicWafer,false,DetNbr); - + G4ThreeVector(0,0,0), + logicActiveWafer,"Box_ActiveWafer",logicWafer,false,DetNbr); + logicActiveWafer->SetSensitiveDetector(m_BOXScorer); } - + // create the PAD // Make a single detector geometry G4LogicalVolume* logicPADDetector = NULL; - + G4ThreeVector PAD_Wafer_Offset = - G4ThreeVector(PAD_Wafer_Length_Offset, PAD_Wafer_Width_Offset,0 ); + G4ThreeVector(PAD_Wafer_Length_Offset, PAD_Wafer_Width_Offset,0 ); if(m_ThicknessPAD[i][j]>0){ G4Box* PADDetector = new G4Box("PADDetector" , - PAD_PCB_Length/2., - PAD_PCB_Width/2., - PAD_PCB_Thickness/2.); - + PAD_PCB_Length/2., + PAD_PCB_Width/2., + PAD_PCB_Thickness/2.); + G4Box* PADPCBFull = new G4Box("PCBFull" , - PAD_PCB_Length/2., - PAD_PCB_Width/2., - PAD_PCB_Thickness/2.); - + PAD_PCB_Length/2., + PAD_PCB_Width/2., + PAD_PCB_Thickness/2.); + G4Box* PADWaferShape = new G4Box("PADWaferShape", - PAD_Wafer_Length/2., - PAD_Wafer_Width/2., - PAD_PCB_Thickness/2.+0.1*mm); - + PAD_Wafer_Length/2., + PAD_Wafer_Width/2., + PAD_PCB_Thickness/2.+0.1*mm); + G4Box* PADWafer = new G4Box("PADWafer", - PAD_Wafer_Length/2., - PAD_Wafer_Width/2., - m_ThicknessPAD[i][j]/2.); - + PAD_Wafer_Length/2., + PAD_Wafer_Width/2., + m_ThicknessPAD[i][j]/2.); + + G4Box* PADActiveWafer = new G4Box("PADActiveWafer", + PAD_ActiveWafer_Length/2., + PAD_ActiveWafer_Width/2., + m_ThicknessPAD[i][j]/2.); + + G4SubtractionSolid* PADPCB = new G4SubtractionSolid("PADPCB", PADPCBFull, PADWaferShape,new G4RotationMatrix,PAD_Wafer_Offset); - + // Master Volume logicPADDetector = - new G4LogicalVolume(PADDetector,m_MaterialVacuum,"logicPADDetector", 0, 0, 0); + new G4LogicalVolume(PADDetector,m_MaterialVacuum,"logicPADDetector", 0, 0, 0); logicPADDetector->SetVisAttributes(G4VisAttributes::Invisible); - + // Sub Volume PCB G4LogicalVolume* logicPADPCB = - new G4LogicalVolume(PADPCB,m_MaterialPCB,"logicPADPCB", 0, 0, 0); + new G4LogicalVolume(PADPCB,m_MaterialPCB,"logicPADPCB", 0, 0, 0); logicPADPCB->SetVisAttributes(PADVisAtt); - + // Sub Volume Wafer G4LogicalVolume* logicPADWafer = - new G4LogicalVolume(PADWafer,m_MaterialSilicon,"logicPADWafer", 0, 0, 0); + new G4LogicalVolume(PADWafer,m_MaterialSilicon,"logicPADWafer", 0, 0, 0); logicPADWafer->SetVisAttributes(SiliconVisAtt); - - logicPADWafer->SetSensitiveDetector(m_PADScorer); - + // Sub Volume ActiveWafer + G4LogicalVolume* logicPADActiveWafer = + new G4LogicalVolume(PADActiveWafer,m_MaterialSilicon,"logicPADActiveWafer", 0, 0, 0); + logicPADActiveWafer->SetVisAttributes(SiliconVisAtt); + + // Sensitive Volume + logicPADActiveWafer->SetSensitiveDetector(m_PADScorer); + // Place the sub volume in the master volume new G4PVPlacement(new G4RotationMatrix(0,0,0), - G4ThreeVector(0,0,0), - logicPADPCB,"PAD_PCB",logicPADDetector,false,DetNbr); - + G4ThreeVector(0,0,0), + logicPADPCB,"PAD_PCB",logicPADDetector,false,DetNbr); + new G4PVPlacement(new G4RotationMatrix(0,0,0), - PAD_Wafer_Offset-G4ThreeVector(0,0,0.5*PAD_PCB_Thickness-0.5*m_ThicknessPAD[i][j]), - logicPADWafer,"PAD_Wafer",logicPADDetector,false,DetNbr); + PAD_Wafer_Offset-G4ThreeVector(0,0,0.5*PAD_PCB_Thickness-0.5*m_ThicknessPAD[i][j]), + logicPADWafer,"PAD_Wafer",logicPADDetector,false,DetNbr); + + new G4PVPlacement(new G4RotationMatrix(0,0,0), + G4ThreeVector(0,0,0), + logicPADActiveWafer,"PAD_ActiveWafer",logicPADWafer,false,DetNbr); } /////////////////////////////////////////////////////////////////////////////////// // Place the detector in the world // Position of the center of the PCB - + G4ThreeVector DetectorPosition; if(m_ThicknessPAD[i][j]>0){ //PAD Case DetectorPosition = G4ThreeVector(-BOX_CenterOffset2,-Box_Wafer_Offset.y(),0); } - + else{ // No Pad Case DetectorPosition = G4ThreeVector(-BOX_CenterOffset1,-Box_Wafer_Offset.y(),0); } - + // Distance of the PCB to the target G4ThreeVector DetectorSpacing = -G4ThreeVector(0,0,BOX_DetectorSpacing); - + DetectorPosition+=DetectorSpacing; - + G4ThreeVector PADDetectorPosition = DetectorPosition ; G4ThreeVector PADDetectorSpacing = -G4ThreeVector(0,0,0.5*BOX_PCB_Thickness+0.5*PAD_PCB_Thickness); - - + + PADDetectorPosition += PADDetectorSpacing; - + G4RotationMatrix* DetectorRotation= new G4RotationMatrix; // The Rotation Matrix is different for each detector - if(j==0){ - DetectorRotation->rotateX(90*deg); - } - else if(j==1){ - DetectorRotation->rotateZ(180*deg); - DetectorRotation->rotateX(-90*deg); - } - else if(j==2){ - DetectorRotation->rotateX(90*deg); - DetectorRotation->rotateZ(90*deg); - } - else if(j==3){ - DetectorRotation->rotateX(90*deg); - DetectorRotation->rotateZ(-90*deg); - } - - double Z = 0; + double Z= 0; if(m_Z[i]<0){ + if(j==0){ + DetectorRotation->rotateX(90*deg); + } + else if(j==1){ + DetectorRotation->rotateX(90*deg); + DetectorRotation->rotateZ(-90*deg); + } + else if(j==2){ + DetectorRotation->rotateZ(180*deg); + DetectorRotation->rotateX(-90*deg); + } + else if(j==3){ + DetectorRotation->rotateX(90*deg); + DetectorRotation->rotateZ(90*deg); + } DetectorRotation->rotateY(180*deg); Z = m_Z[i] -2*mm; } + else{ + if(j==0){ + DetectorRotation->rotateX(90*deg); + } + else if(j==1){ + DetectorRotation->rotateX(90*deg); + DetectorRotation->rotateZ(90*deg); - else - Z= m_Z[i]+2*mm; + } + else if(j==2){ + DetectorRotation->rotateZ(180*deg); + DetectorRotation->rotateX(-90*deg); + } + else if(j==3){ + DetectorRotation->rotateX(90*deg); + DetectorRotation->rotateZ(-90*deg); + } + Z= m_Z[i]+2*mm; + } DetectorPosition.transform(*DetectorRotation); DetectorPosition+=G4ThreeVector(0,0,Z); - + PADDetectorPosition.transform(*DetectorRotation); PADDetectorPosition+=G4ThreeVector(0,0,Z); - + new G4PVPlacement(G4Transform3D(*DetectorRotation,DetectorPosition), logicBoxDetector,"Box",world,false,DetNbr); - + if(m_ThicknessPAD[i][j]>0){ new G4PVPlacement(G4Transform3D(*DetectorRotation, PADDetectorPosition), - logicPADDetector,"PAD",world,false,DetNbr); + logicPADDetector,"PAD",world,false,DetNbr); } } } @@ -575,68 +662,68 @@ void Sharc::ConstructQQQDetector(G4LogicalVolume* world){ else DetNbr = i+1 + 8; // Make the a single detector geometry G4Tubs* QQQDetector = new G4Tubs("QQQDetector" , - QQQ_PCB_Inner_Radius, - QQQ_PCB_Outer_Radius, - QQQ_PCB_Thickness*0.5, - 0., - M_PI/2.); - + QQQ_PCB_Inner_Radius, + QQQ_PCB_Outer_Radius, + QQQ_PCB_Thickness*0.5, + 0., + M_PI/2.); + G4Tubs* PCBFull = new G4Tubs("PCBFull" , - QQQ_PCB_Inner_Radius, - QQQ_PCB_Outer_Radius, - QQQ_PCB_Thickness*0.5, - 0., - M_PI*0.5); - + QQQ_PCB_Inner_Radius, + QQQ_PCB_Outer_Radius, + QQQ_PCB_Thickness*0.5, + 0., + M_PI*0.5); + G4Tubs* WaferShape = new G4Tubs("WaferShape" , - QQQ_Wafer_Inner_Radius, - QQQ_Wafer_Outer_Radius, - QQQ_PCB_Thickness*0.5+0.1*mm, - QQQ_Wafer_Starting_Phi, - QQQ_Wafer_Stopping_Phi); - + QQQ_Wafer_Inner_Radius, + QQQ_Wafer_Outer_Radius, + QQQ_PCB_Thickness*0.5+0.1*mm, + QQQ_Wafer_Starting_Phi, + QQQ_Wafer_Stopping_Phi); + G4Tubs* Wafer = new G4Tubs("Wafer" , - QQQ_Wafer_Inner_Radius, - QQQ_Wafer_Outer_Radius, - m_ThicknessQQQ[i]*0.5, - QQQ_Wafer_Starting_Phi, - QQQ_Wafer_Stopping_Phi); - + QQQ_Wafer_Inner_Radius, + QQQ_Wafer_Outer_Radius, + m_ThicknessQQQ[i]*0.5, + QQQ_Wafer_Starting_Phi, + QQQ_Wafer_Stopping_Phi); + G4SubtractionSolid* PCB = new G4SubtractionSolid("PCB", PCBFull, WaferShape,new G4RotationMatrix, - G4ThreeVector(0, 0,0)); - + G4ThreeVector(0, 0,0)); + // Master Volume G4LogicalVolume* logicQQQDetector = - new G4LogicalVolume(QQQDetector,m_MaterialVacuum,"logicQQQDetector", 0, 0, 0); + new G4LogicalVolume(QQQDetector,m_MaterialVacuum,"logicQQQDetector", 0, 0, 0); logicQQQDetector->SetVisAttributes(G4VisAttributes::Invisible); // Sub Volume PCB G4LogicalVolume* logicPCB = - new G4LogicalVolume(PCB,m_MaterialPCB,"logicPCB", 0, 0, 0); + new G4LogicalVolume(PCB,m_MaterialPCB,"logicPCB", 0, 0, 0); logicPCB->SetVisAttributes(PCBVisAtt); - + // Sub Volume Wafer G4LogicalVolume* logicWafer = - new G4LogicalVolume(Wafer,m_MaterialSilicon,"logicWafer", 0, 0, 0); + new G4LogicalVolume(Wafer,m_MaterialSilicon,"logicWafer", 0, 0, 0); logicWafer->SetVisAttributes(SiliconVisAtt); - + logicWafer->SetSensitiveDetector(m_QQQScorer); - - + + // Place the sub volume in the master volume new G4PVPlacement(new G4RotationMatrix(0,0,0), - G4ThreeVector(0,0,0), - logicPCB,"QQQ_PCB",logicQQQDetector,false,DetNbr); - + G4ThreeVector(0,0,0), + logicPCB,"QQQ_PCB",logicQQQDetector,false,DetNbr); + new G4PVPlacement(new G4RotationMatrix(0,0,0), - G4ThreeVector(0,0,0), - logicWafer,"QQQ_Wafer",logicQQQDetector,false,DetNbr); - + G4ThreeVector(0,0,0), + logicWafer,"QQQ_Wafer",logicQQQDetector,false,DetNbr); + // Place the masters volume in the world - + new G4PVPlacement(new G4RotationMatrix(0,0,m_Pos[i].y()), - G4ThreeVector(0,0,m_Pos[i].z()), - logicQQQDetector,"QQQ",world,false,DetNbr); + G4ThreeVector(0,0,m_Pos[i].z()), + logicQQQDetector,"QQQ",world,false,DetNbr); } } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... @@ -649,29 +736,29 @@ void Sharc::InitializeRootOutput(){ pTree->SetBranchAddress("Sharc", &m_Event) ; } - + //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... // Read sensitive part and fill the Root tree. // Called at in the EventAction::EndOfEventAvtion void Sharc::ReadSensitive(const G4Event* event){ m_Event->Clear(); - + /////////// // BOX G4THitsMap<G4double*>* BOXHitMap; std::map<G4int, G4double**>::iterator BOX_itr; - + G4int BOXCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("Sharc_BOXScorer/SharcBOX"); BOXHitMap = (G4THitsMap<G4double*>*)(event->GetHCofThisEvent()->GetHC(BOXCollectionID)); - + // Loop on the BOX map for (BOX_itr = BOXHitMap->GetMap()->begin() ; BOX_itr != BOXHitMap->GetMap()->end() ; BOX_itr++){ - + G4double* Info = *(BOX_itr->second); - + double Energy = Info[0]; - + if(Energy>EnergyThreshold){ double Time = Info[1]; int DetNbr = (int) Info[7]; @@ -683,86 +770,86 @@ void Sharc::ReadSensitive(const G4Event* event){ m_Event->SetFront_Energy(RandGauss::shoot(Energy, ResoEnergy)); m_Event->SetFront_TimeCFD(RandGauss::shoot(Time, ResoTime)); m_Event->SetFront_TimeLED(RandGauss::shoot(Time, ResoTime)); - + m_Event->SetBack_DetectorNbr(DetNbr); m_Event->SetBack_StripNbr(BOX_Wafer_Back_NumberOfStrip-StripBack+1); m_Event->SetBack_Energy(RandGauss::shoot(Energy, ResoEnergy)); m_Event->SetBack_TimeCFD(RandGauss::shoot(Time, ResoTime)); m_Event->SetBack_TimeLED(RandGauss::shoot(Time, ResoTime)); - + // Interraction Coordinates ms_InterCoord->SetDetectedPositionX(Info[2]) ; ms_InterCoord->SetDetectedPositionY(Info[3]) ; ms_InterCoord->SetDetectedPositionZ(Info[4]) ; ms_InterCoord->SetDetectedAngleTheta(Info[5]/deg) ; ms_InterCoord->SetDetectedAnglePhi(Info[6]/deg) ; - + } } // clear map for next event BOXHitMap->clear(); - + /////////// // PAD G4THitsMap<G4double*>* PADHitMap; std::map<G4int, G4double**>::iterator PAD_itr; - + G4int PADCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("Sharc_PADScorer/SharcPAD"); PADHitMap = (G4THitsMap<G4double*>*)(event->GetHCofThisEvent()->GetHC(PADCollectionID)); - + // Loop on the BOX map for (PAD_itr = PADHitMap->GetMap()->begin() ; PAD_itr != PADHitMap->GetMap()->end() ; PAD_itr++){ - + G4double* Info = *(PAD_itr->second); - + double Energy = Info[0]; if(Energy>EnergyThreshold){ double Time = Info[1]; int DetNbr = (int) Info[7]; - + m_Event->SetPAD_DetectorNbr(DetNbr); m_Event->SetPAD_Energy(RandGauss::shoot(Energy, ResoEnergy)); m_Event->SetPAD_TimeCFD(RandGauss::shoot(Time, ResoTime)); m_Event->SetPAD_TimeLED(RandGauss::shoot(Time, ResoTime)); } } - + // clear map for next event PADHitMap->clear(); - + /////////// // QQQ G4THitsMap<G4double*>* QQQHitMap; std::map<G4int, G4double**>::iterator QQQ_itr; - + G4int QQQCollectionID = G4SDManager::GetSDMpointer()->GetCollectionID("Sharc_QQQScorer/SharcQQQ"); QQQHitMap = (G4THitsMap<G4double*>*)(event->GetHCofThisEvent()->GetHC(QQQCollectionID)); - + // Loop on the BOX map for (QQQ_itr = QQQHitMap->GetMap()->begin() ; QQQ_itr != QQQHitMap->GetMap()->end() ; QQQ_itr++){ - + G4double* Info = *(QQQ_itr->second); - + double Energy = Info[0]; if(Energy>EnergyThreshold){ double Time = Info[1]; int DetNbr = (int) Info[7]; int StripFront = (int) Info[8]; int StripBack = (int) Info[9]; - + m_Event->SetFront_DetectorNbr(DetNbr); m_Event->SetFront_StripNbr(QQQ_Wafer_NumberOf_AnnularStrip-StripFront+1); // Order is reverse (1 is outtermost strip) m_Event->SetFront_Energy(RandGauss::shoot(Energy, ResoEnergy)); m_Event->SetFront_TimeCFD(RandGauss::shoot(Time, ResoTime)); m_Event->SetFront_TimeLED(RandGauss::shoot(Time, ResoTime)); - + m_Event->SetBack_DetectorNbr(DetNbr); m_Event->SetBack_StripNbr(StripBack); m_Event->SetBack_Energy(RandGauss::shoot(Energy, ResoEnergy)); m_Event->SetBack_TimeCFD(RandGauss::shoot(Time, ResoTime)); m_Event->SetBack_TimeLED(RandGauss::shoot(Time, ResoTime)); - + // Interraction Coordinates ms_InterCoord->SetDetectedPositionX(Info[2]) ; ms_InterCoord->SetDetectedPositionY(Info[3]) ; @@ -771,52 +858,52 @@ void Sharc::ReadSensitive(const G4Event* event){ ms_InterCoord->SetDetectedAnglePhi(Info[6]/deg) ; } } - + // clear map for next event QQQHitMap->clear(); - + } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Sharc::InitializeScorers(){ - + // Silicon Associate Scorer bool already_exist = false; m_BOXScorer = CheckScorer("Sharc_BOXScorer",already_exist); m_PADScorer = CheckScorer("Sharc_PADScorer",already_exist); m_QQQScorer = CheckScorer("Sharc_QQQScorer",already_exist); - + // if the scorer were created previously nothing else need to be made if(already_exist) return; - + G4VPrimitiveScorer* BOXScorer = - new SILICONSCORERS::PS_Silicon_Rectangle("SharcBOX",0, - BOX_ActiveWafer_Length, - BOX_ActiveWafer_Width, - BOX_Wafer_Front_NumberOfStrip , - BOX_Wafer_Back_NumberOfStrip); - + new SILICONSCORERS::PS_Silicon_Rectangle("SharcBOX",0, + BOX_ActiveWafer_Length, + BOX_ActiveWafer_Width, + BOX_Wafer_Front_NumberOfStrip , + BOX_Wafer_Back_NumberOfStrip); + G4VPrimitiveScorer* PADScorer = - new SILICONSCORERS::PS_Silicon_Rectangle("SharcPAD",0, - PAD_Wafer_Length, - PAD_Wafer_Width, - 1 , - 1); - + new SILICONSCORERS::PS_Silicon_Rectangle("SharcPAD",0, + PAD_Wafer_Length, + PAD_Wafer_Width, + 1 , + 1); + G4VPrimitiveScorer* QQQScorer = - new SILICONSCORERS::PS_Silicon_Annular("SharcQQQ",0, - QQQ_Wafer_Inner_Radius, - QQQ_Wafer_Outer_Radius, - QQQ_Wafer_Starting_Phi, - QQQ_Wafer_Stopping_Phi, - QQQ_Wafer_NumberOf_AnnularStrip, - QQQ_Wafer_NumberOf_RadialStrip,1); - + new SILICONSCORERS::PS_Silicon_Annular("SharcQQQ",0, + QQQ_Wafer_Inner_Radius, + QQQ_Wafer_Outer_Radius, + QQQ_Wafer_Starting_Phi, + QQQ_Wafer_Stopping_Phi, + QQQ_Wafer_NumberOf_AnnularStrip, + QQQ_Wafer_NumberOf_RadialStrip,1); + //and register it to the multifunctionnal detector m_BOXScorer->RegisterPrimitive(BOXScorer); m_PADScorer->RegisterPrimitive(PADScorer); m_QQQScorer->RegisterPrimitive(QQQScorer); - + // Add All Scorer to the Global Scorer Manager G4SDManager::GetSDMpointer()->AddNewDetector(m_BOXScorer) ; G4SDManager::GetSDMpointer()->AddNewDetector(m_PADScorer) ; @@ -835,24 +922,24 @@ void Sharc::InitializeMaterial(){ } - //////////////////////////////////////////////////////////////////////////////// - // Construct Method to be pass to the DetectorFactory // - //////////////////////////////////////////////////////////////////////////////// - NPS::VDetector* Sharc::Construct(){ +//////////////////////////////////////////////////////////////////////////////// +// Construct Method to be pass to the DetectorFactory // +//////////////////////////////////////////////////////////////////////////////// +NPS::VDetector* Sharc::Construct(){ return (NPS::VDetector*) new Sharc(); - } - - //////////////////////////////////////////////////////////////////////////////// - // Registering the construct method to the factory // - //////////////////////////////////////////////////////////////////////////////// - extern"C" { - class proxy_nps_sharc{ - public: - proxy_nps_sharc(){ - NPS::DetectorFactory::getInstance()->AddToken("Sharc","Sharc"); - NPS::DetectorFactory::getInstance()->AddDetector("Sharc",Sharc::Construct); - } -}; +} - proxy_nps_sharc p_nps_sharc; - } +//////////////////////////////////////////////////////////////////////////////// +// Registering the construct method to the factory // +//////////////////////////////////////////////////////////////////////////////// +extern"C" { + class proxy_nps_sharc{ + public: + proxy_nps_sharc(){ + NPS::DetectorFactory::getInstance()->AddToken("Sharc","Sharc"); + NPS::DetectorFactory::getInstance()->AddDetector("Sharc",Sharc::Construct); + } + }; + + proxy_nps_sharc p_nps_sharc; +} diff --git a/NPSimulation/Sharc/Sharc.hh b/NPSimulation/Sharc/Sharc.hh index 2cbe0b638b47035a879d12961aeb070b382aada3..7f8c4ac2900f07f618580f53b54b125c8678f3e5 100644 --- a/NPSimulation/Sharc/Sharc.hh +++ b/NPSimulation/Sharc/Sharc.hh @@ -96,8 +96,11 @@ namespace SHARC{ const G4double PAD_PCB_Border_ShortSide = 2.5*mm; // PAD Wafer - const G4double PAD_Wafer_Width = 51.00*mm; - const G4double PAD_Wafer_Length = 77.00*mm; + const G4double PAD_Wafer_Width = 53.20*mm; + const G4double PAD_Wafer_Length = 73.20*mm; + const G4double PAD_ActiveWafer_Width = 50*mm; + const G4double PAD_ActiveWafer_Length = 70*mm; + // const G4double PAD_Wafer_Width = 42.00*mm; // const G4double PAD_Wafer_Length = 72.00*mm; @@ -161,7 +164,7 @@ public: // Effectively construct Volume void ConstructBOXDetector(G4LogicalVolume* world); void ConstructQQQDetector(G4LogicalVolume* world); - + void ConstructTargetFan(G4LogicalVolume* world); //////////////////////////////////////////////////// ///////// Inherite from NPS::VDetector class /////////// ////////////////////////////////////////////////////