diff --git a/NPSimulation/Detectors/Dali/.emacshist b/NPSimulation/Detectors/Dali/.emacshist deleted file mode 100644 index 530f3759a80e9d1a0d8ff3b7e2dd71fa47300b1d..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/.emacshist +++ /dev/null @@ -1,7 +0,0 @@ -;; -*- mode: emacs-lisp; coding: utf-8-unix -*- -;; Minibuffer history file, automatically generated by `savehist'. - -(setq savehist-minibuffer-history-variables '(minibuffer-history query-replace-history extended-command-history)) -(setq minibuffer-history '("Scorer" "m_SquareDetector" "Scorer" "Score")) -(setq query-replace-history '("^\\1" "\\^{\\([0-9]?\\)}" "\\^{\\([0-9]?\\)}" "_\\1" "_{\\([0-9]?\\)}" "_{\\([0-9]?\\)}" "_\\1" "_{\\([0_9]?\\)}" "_{\\([0_9]?\\)}" "_\\&" "_{\\([0_9]?\\)}" "_{\\([0_9]?\\)}" "_" "_{1}")) -(setq extended-command-history '("query-replace-regexp" "query-replace" "query-replace-regexp")) diff --git a/NPSimulation/Detectors/Dali/Dali.cc.~14~ b/NPSimulation/Detectors/Dali/Dali.cc.~14~ deleted file mode 100644 index cedb27ac763944c87dda97b14fc53dc120f35c57..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.cc.~14~ +++ /dev/null @@ -1,417 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <cmath> -#include <limits> -//G4 Geometry object -#include "G4Tubs.hh" -#include "G4Box.hh" - -//G4 sensitive -#include "G4SDManager.hh" -#include "G4MultiFunctionalDetector.hh" - -//G4 various object -#include "G4Material.hh" -#include "G4Transform3D.hh" -#include "G4PVPlacement.hh" -//#include "G4VPhysicalVolume.hh" -#include "G4PVReplica.hh" -#include "G4VisAttributes.hh" -#include "G4Colour.hh" - -// NPTool header -#include "Dali.hh" -#include "CalorimeterScorers.hh" -#include "InteractionScorers.hh" -#include "RootOutput.h" -#include "MaterialManager.hh" -#include "NPSDetectorFactory.hh" -#include "NPOptionManager.h" -#include "NPSHitsMap.hh" -// CLHEP header -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; - - - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace Dali_NS{ - // Energy and time Resolution - const double EnergyThreshold = 0*MeV; - const double ResoTime = 4.5*ns ; - const double ResoEnergy = 0.001*MeV ; - const double Radius = 50*mm ; - const double Width = 49.76*mm ; - const double Hight = 84.81*mm ; - const double Thickness = 164.82*mm ; - const string Material = "NaI"; //Change to drug it with Tl -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Dali Specific Method -Dali::Dali(){ - m_Event = new TDaliData() ; - m_DaliScorer = 0; - m_SquareDetector = 0; - m_SquareDetector_Can = 0; - m_SquareDetector_CanMgO =0; - m_CylindricalDetector = 0; - m_SquareDetector_Crystal = 0; - Logic_ArrayDali_1 =0; - - // RGB Color + Transparency - m_VisSquare = new G4VisAttributes(G4Colour(0, 1, 0, 0.5)); - m_VisCylinder = new G4VisAttributes(G4Colour(0, 0, 1, 0.5)); - -} - -Dali::~Dali(){ -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(G4ThreeVector POS, string Shape){ - // Convert the POS value to R theta Phi as Cylindrical coordinate is easier in G4 - m_R.push_back(POS.perp()); - m_Alpha.push_back(POS.phi()); - m_Zeta.push_back(POS.y()); - m_Shape.push_back(Shape); -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(double R, double Theta, double Phi, string Shape){ - - double m_r, m_alpha, m_zeta; - - m_r = R*cos(Phi); - m_alpha = Theta; - m_zeta = R*sin(Phi); - - m_R.push_back(m_r); - m_Alpha.push_back(m_alpha); - m_Zeta.push_back(m_zeta); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -void Dali::AddDetector2(double R, double Alpha, double Zeta, string Shape){ - m_R.push_back(R); - m_Alpha.push_back(Alpha); - m_Zeta.push_back(Zeta); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - - - -G4LogicalVolume* Dali::BuildSquareDetector(){ - if(!m_SquareDetector){ - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - - - G4Element* H = new G4Element("Hydrogen","H" , 1., 1.01*g/mole); - - G4Isotope* Mg24 = new G4Isotope ("Mg24", 12, 24, 23.985041*g/mole); - G4Isotope* Mg25 = new G4Isotope ("Mg25", 12, 25, 24.985836*g/mole); - G4Isotope* Mg26 = new G4Isotope ("Mg26", 12, 26, 25.982592*g/mole); - G4Element* Mg= new G4Element("elMagnesium","Mg",3); - Mg->AddIsotope(Mg24, 78.99*perCent); - Mg->AddIsotope(Mg25, 10*perCent); - Mg->AddIsotope(Mg26, 11.01*perCent); - - G4Isotope* O16 = new G4Isotope ("O16", 8, 16, 15.99*g/mole); - G4Isotope* O17 = new G4Isotope ("O17", 8, 17, 17.00*g/mole); - G4Isotope* O18 = new G4Isotope ("O18", 8, 18, 18.00*g/mole); - G4Element* O= new G4Element("elOxygen","O",3); - O->AddIsotope(O16, 99.76*perCent); - O->AddIsotope(O17, 0.04*perCent); - O->AddIsotope(O18, 0.20*perCent); - - G4Material* MgO = new G4Material("MgO",3.6*g/cm3,2); - MgO->AddElement(Mg,1); - MgO->AddElement(O, 1); - - G4Element *elTl = new G4Element("Thallium","Tl",81.,204.383*g/mole ); - G4Material* NaI_Tl = new G4Material("NaI_Tl",3.6667*g/cm3, 2); - NaI_Tl->AddMaterial(MaterialManager::getInstance()->GetMaterialFromLibrary("NaI"),99.6*perCent); - NaI_Tl->AddElement(elTl,0.4*perCent); - - - - - - - G4Box* box_3can = new G4Box("Dali_3BoxCan", Dali_NS::Hight*0.5, - Dali_NS::Width*0.5*3, Dali_NS::Thickness*0.5); - G4Material* Aria = MaterialManager::getInstance()->GetMaterialFromLibrary("Air"); - Logic_ArrayDali_1 = new G4LogicalVolume(box_3can,Aria,"logic_ArrayDali",0,0,0); - - - - G4Box* box_can = new G4Box("Dali_BoxCan", Dali_NS::Hight*0.5, - Dali_NS::Width*0.5, Dali_NS::Thickness*0.5); - G4Material* DetectorCanMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary("Al"); - m_SquareDetector_Can = new G4LogicalVolume(box_can,Aria,"logic_Dali_Can",0,0,0); - G4VisAttributes* Can_Attributes = new G4VisAttributes(G4Colour(0.5,0.5,0.5)); - m_SquareDetector_Can->SetVisAttributes(Can_Attributes); - - G4Box* box_MgO = new G4Box("Dali_BoxMgO", Dali_NS::Hight*0.5-1*mm, - Dali_NS::Width*0.5-1*mm, Dali_NS::Thickness*0.5-1*mm); - - m_SquareDetector_CanMgO = new G4LogicalVolume(box_MgO,Aria,"logic_Dali_CanMg0",0,0,0); - - G4Box* box_crystal = new G4Box("Dali_BoxNaI", Dali_NS::Hight*0.5-2.4*mm, - Dali_NS::Width*0.5-2.4*mm, Dali_NS::Thickness*0.5-2.4*mm); - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_SquareDetector_Crystal = new G4LogicalVolume(box_crystal,NaI_Tl,"logic_Dali_Box",0,0,0); - - G4ThreeVector positionnull = G4ThreeVector(0,0,0); - - // MgO Volume - - G4PVPlacement* physi_MgO = new G4PVPlacement(0, positionnull, - m_SquareDetector_CanMgO, - "MgO", - m_SquareDetector_Can, - false, - 0); - G4VisAttributes* MgO_Attributes = new G4VisAttributes(G4Colour(0.0,1.0,0.5)); - m_SquareDetector_CanMgO->SetVisAttributes(MgO_Attributes); - - - // NaI Volume - - G4PVPlacement* physi_NaI = new G4PVPlacement(0, positionnull, - m_SquareDetector_Crystal, - "Crystal NaI", - m_SquareDetector_CanMgO, - false, - 0); - m_SquareDetector_Crystal->SetVisAttributes(m_VisSquare); - m_SquareDetector_Crystal->SetSensitiveDetector(m_DaliScorer); - - G4VPhysicalVolume* ArrayDali_1 = new G4PVReplica("ArrayDali_1", - m_SquareDetector_Can, - Logic_ArrayDali_1 , - kYAxis, - 3, - Dali_NS::Width, //????????? - 0); - - } - - return Logic_ArrayDali_1; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Dali::BuildCylindricalDetector(){ - if(!m_CylindricalDetector){ - G4Tubs* tub = new G4Tubs("Dali_Cyl",0,Dali_NS::Radius, Dali_NS::Thickness*0.5,0,360*deg); - - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_CylindricalDetector = new G4LogicalVolume(tub,DetectorMaterial,"logic_Dali_tub",0,0,0); - m_CylindricalDetector->SetVisAttributes(m_VisSquare); - m_CylindricalDetector->SetSensitiveDetector(m_DaliScorer); - - } - return m_CylindricalDetector; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Virtual Method of NPS::VDetector class - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void Dali::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Dali"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> cart = {"POS","Shape"}; - vector<string> sphe = {"R","Theta","Phi","Shape"}; - vector<string> cyli = {"R","Alpha","Zeta","Shape"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - - G4ThreeVector Pos = NPS::ConvertVector(blocks[i]->GetTVector3("POS","mm")); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(Pos,Shape); - } - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Theta = blocks[i]->GetDouble("Theta","deg"); - double Phi = blocks[i]->GetDouble("Phi","deg"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(R,Theta,Phi,Shape); - } - else if(blocks[i]->HasTokenList(cyli)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Alpha = blocks[i]->GetDouble("Alpha","deg"); - double Zeta = blocks[i]->GetDouble("Zeta","mm"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector2(R,Alpha,Zeta,Shape); - } - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Dali::ConstructDetector(G4LogicalVolume* world){ - - for (unsigned short i = 0 ; i < m_R.size() ; i++) { - - G4double wX = m_R[i] * cos(m_Alpha[i] ) ; - G4double wY = m_R[i] * sin(m_Alpha[i] ) ; - G4double wZ = m_Zeta[i]; - G4ThreeVector Det_pos = G4ThreeVector(wX, wY, wZ) ; - - G4RotationMatrix* Rot = new G4RotationMatrix(); - - if(m_Zeta[i]>0){ - Rot->rotateX(180*deg); Rot->rotateZ(m_Alpha[i]); - } else{Rot->rotateZ(m_Alpha[i]);} - - - if(m_Shape[i] == "Cylindrical"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildCylindricalDetector(), - "Dali",world,false,i+1); - } - - else if(m_Shape[i] == "Square"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildSquareDetector(), - "Dali",world,false,i+1); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Add Detector branch to the EventTree. -// Called After DetecorConstruction::AddDetector Method -void Dali::InitializeRootOutput(){ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - if(!pTree->FindBranch("Dali")){ - pTree->Branch("Dali", "TDaliData", &m_Event) ; - } - pTree->SetBranchAddress("Dali", &m_Event) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void Dali::ReadSensitive(const G4Event* ){ - m_Event->Clear(); - - /////////// - // Calorimeter scorer - CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_DaliScorer->GetPrimitive(0); - - unsigned int size = Scorer->GetMult(); - // cout << "size " << size << endl; - for(unsigned int i = 0 ; i < size ; i++){ - vector<unsigned int> level = Scorer->GetLevel(i); - double Energy = RandGauss::shoot(Scorer->GetEnergy(i),Dali_NS::ResoEnergy); - // cout << Energy << endl; - if(Energy>Dali_NS::EnergyThreshold){ - double Time = RandGauss::shoot(Scorer->GetTime(i),Dali_NS::ResoTime); - int DetectorNbr = level[0]; - int InsideDetectNbr = level[1]; - m_Event->SetEnergy(DetectorNbr,Energy); - m_Event->SetTime(DetectorNbr,Time); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////// -void Dali::InitializeScorers() { - // This check is necessary in case the geometry is reloaded - bool already_exist = false; - vector<G4int> NestingLevel; - NestingLevel.push_back(0); - NestingLevel.push_back(1); - - m_DaliScorer = CheckScorer("DaliScorer",already_exist) ; - - if(already_exist) - return ; - - // Otherwise the scorer is initialised - vector<int> level; level.push_back(0); - G4VPrimitiveScorer* Calorimeter= new CalorimeterScorers::PS_Calorimeter("Calorimeter",NestingLevel) ; - G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; - //and register it to the multifunctionnal detector - m_DaliScorer->RegisterPrimitive(Calorimeter); - m_DaliScorer->RegisterPrimitive(Interaction); - G4SDManager::GetSDMpointer()->AddNewDetector(m_DaliScorer) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPS::VDetector* Dali::Construct(){ - return (NPS::VDetector*) new Dali(); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern"C" { - class proxy_nps_Dali{ - public: - proxy_nps_Dali(){ - NPS::DetectorFactory::getInstance()->AddToken("Dali","Dali"); - NPS::DetectorFactory::getInstance()->AddDetector("Dali",Dali::Construct); - } - }; - - proxy_nps_Dali p_nps_Dali; -} diff --git a/NPSimulation/Detectors/Dali/Dali.cc.~15~ b/NPSimulation/Detectors/Dali/Dali.cc.~15~ deleted file mode 100644 index 360a3f6598772c96e27e343ada11d4186820ede1..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.cc.~15~ +++ /dev/null @@ -1,420 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <cmath> -#include <limits> -//G4 Geometry object -#include "G4Tubs.hh" -#include "G4Box.hh" - -//G4 sensitive -#include "G4SDManager.hh" -#include "G4MultiFunctionalDetector.hh" - -//G4 various object -#include "G4Material.hh" -#include "G4Transform3D.hh" -#include "G4PVPlacement.hh" -//#include "G4VPhysicalVolume.hh" -#include "G4PVReplica.hh" -#include "G4VisAttributes.hh" -#include "G4Colour.hh" - -// NPTool header -#include "Dali.hh" -#include "CalorimeterScorers.hh" -#include "InteractionScorers.hh" -#include "RootOutput.h" -#include "MaterialManager.hh" -#include "NPSDetectorFactory.hh" -#include "NPOptionManager.h" -#include "NPSHitsMap.hh" -// CLHEP header -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; - - - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace Dali_NS{ - // Energy and time Resolution - const double EnergyThreshold = 0*MeV; - const double ResoTime = 4.5*ns ; - const double ResoEnergy = 0.001*MeV ; - const double Radius = 50*mm ; - const double Width = 49.76*mm ; - const double Hight = 84.81*mm ; - const double Thickness = 164.82*mm ; - const string Material = "NaI"; //Change to drug it with Tl -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Dali Specific Method -Dali::Dali(){ - m_Event = new TDaliData() ; - m_DaliScorer = 0; - m_SquareDetector = 0; - m_SquareDetector_Can = 0; - m_SquareDetector_CanMgO =0; - m_CylindricalDetector = 0; - m_SquareDetector_Crystal = 0; - Logic_ArrayDali_1 =0; - - // RGB Color + Transparency - m_VisSquare = new G4VisAttributes(G4Colour(0, 1, 0, 0.5)); - m_VisCylinder = new G4VisAttributes(G4Colour(0, 0, 1, 0.5)); - -} - -Dali::~Dali(){ -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(G4ThreeVector POS, string Shape){ - // Convert the POS value to R theta Phi as Cylindrical coordinate is easier in G4 - m_R.push_back(POS.perp()); - m_Alpha.push_back(POS.phi()); - m_Zeta.push_back(POS.y()); - m_Shape.push_back(Shape); -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(double R, double Theta, double Phi, string Shape){ - - double m_r, m_alpha, m_zeta; - - m_r = R*cos(Phi); - m_alpha = Theta; - m_zeta = R*sin(Phi); - - m_R.push_back(m_r); - m_Alpha.push_back(m_alpha); - m_Zeta.push_back(m_zeta); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -void Dali::AddDetector2(double R, double Alpha, double Zeta, string Shape){ - m_R.push_back(R); - m_Alpha.push_back(Alpha); - m_Zeta.push_back(Zeta); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - - - -G4LogicalVolume* Dali::BuildSquareDetector(){ - if(!m_SquareDetector){ - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - - - G4Element* H = new G4Element("Hydrogen","H" , 1., 1.01*g/mole); - - G4Isotope* Mg24 = new G4Isotope ("Mg24", 12, 24, 23.985041*g/mole); - G4Isotope* Mg25 = new G4Isotope ("Mg25", 12, 25, 24.985836*g/mole); - G4Isotope* Mg26 = new G4Isotope ("Mg26", 12, 26, 25.982592*g/mole); - G4Element* Mg= new G4Element("elMagnesium","Mg",3); - Mg->AddIsotope(Mg24, 78.99*perCent); - Mg->AddIsotope(Mg25, 10*perCent); - Mg->AddIsotope(Mg26, 11.01*perCent); - - G4Isotope* O16 = new G4Isotope ("O16", 8, 16, 15.99*g/mole); - G4Isotope* O17 = new G4Isotope ("O17", 8, 17, 17.00*g/mole); - G4Isotope* O18 = new G4Isotope ("O18", 8, 18, 18.00*g/mole); - G4Element* O= new G4Element("elOxygen","O",3); - O->AddIsotope(O16, 99.76*perCent); - O->AddIsotope(O17, 0.04*perCent); - O->AddIsotope(O18, 0.20*perCent); - - G4Material* MgO = new G4Material("MgO",3.6*g/cm3,2); - MgO->AddElement(Mg,1); - MgO->AddElement(O, 1); - - G4Element *elTl = new G4Element("Thallium","Tl",81.,204.383*g/mole ); - G4Material* NaI_Tl = new G4Material("NaI_Tl",3.6667*g/cm3, 2); - NaI_Tl->AddMaterial(MaterialManager::getInstance()->GetMaterialFromLibrary("NaI"),99.6*perCent); - NaI_Tl->AddElement(elTl,0.4*perCent); - - - - - - - G4Box* box_3can = new G4Box("Dali_3BoxCan", Dali_NS::Hight*0.5, - Dali_NS::Width*0.5*3, Dali_NS::Thickness*0.5); - G4Material* Aria = MaterialManager::getInstance()->GetMaterialFromLibrary("Air"); - Logic_ArrayDali_1 = new G4LogicalVolume(box_3can,Aria,"logic_ArrayDali",0,0,0); - - - - G4Box* box_can = new G4Box("Dali_BoxCan", Dali_NS::Hight*0.5, - Dali_NS::Width*0.5, Dali_NS::Thickness*0.5); - G4Material* DetectorCanMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary("Al"); - m_SquareDetector_Can = new G4LogicalVolume(box_can,Aria,"logic_Dali_Can",0,0,0); - G4VisAttributes* Can_Attributes = new G4VisAttributes(G4Colour(0.5,0.5,0.5)); - m_SquareDetector_Can->SetVisAttributes(Can_Attributes); - - G4Box* box_MgO = new G4Box("Dali_BoxMgO", Dali_NS::Hight*0.5-1*mm, - Dali_NS::Width*0.5-1*mm, Dali_NS::Thickness*0.5-1*mm); - - m_SquareDetector_CanMgO = new G4LogicalVolume(box_MgO,Aria,"logic_Dali_CanMg0",0,0,0); - - G4Box* box_crystal = new G4Box("Dali_BoxNaI", Dali_NS::Hight*0.5-2.4*mm, - Dali_NS::Width*0.5-2.4*mm, Dali_NS::Thickness*0.5-2.4*mm); - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_SquareDetector_Crystal = new G4LogicalVolume(box_crystal,NaI_Tl,"logic_Dali_Box",0,0,0); - - G4ThreeVector positionnull = G4ThreeVector(0,0,0); - - // MgO Volume - - G4PVPlacement* physi_MgO = new G4PVPlacement(0, positionnull, - m_SquareDetector_CanMgO, - "MgO", - m_SquareDetector_Can, - false, - 0); - G4VisAttributes* MgO_Attributes = new G4VisAttributes(G4Colour(0.0,1.0,0.5)); - m_SquareDetector_CanMgO->SetVisAttributes(MgO_Attributes); - - - // NaI Volume - - G4PVPlacement* physi_NaI = new G4PVPlacement(0, positionnull, - m_SquareDetector_Crystal, - "Crystal NaI", - m_SquareDetector_CanMgO, - false, - 0); //this is the num detect level[0]?? - - m_SquareDetector_Crystal->SetVisAttributes(m_VisSquare); - m_SquareDetector_Crystal->SetSensitiveDetector(m_DaliScorer); - - G4VPhysicalVolume* ArrayDali_1 = new G4PVReplica("ArrayDali_1", - m_SquareDetector_Can, - Logic_ArrayDali_1 , - kYAxis, - 3, - Dali_NS::Width, //????????? - 0); - - } - - return Logic_ArrayDali_1; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Dali::BuildCylindricalDetector(){ - if(!m_CylindricalDetector){ - G4Tubs* tub = new G4Tubs("Dali_Cyl",0,Dali_NS::Radius, Dali_NS::Thickness*0.5,0,360*deg); - - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_CylindricalDetector = new G4LogicalVolume(tub,DetectorMaterial,"logic_Dali_tub",0,0,0); - m_CylindricalDetector->SetVisAttributes(m_VisSquare); - m_CylindricalDetector->SetSensitiveDetector(m_DaliScorer); - - } - return m_CylindricalDetector; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Virtual Method of NPS::VDetector class - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void Dali::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Dali"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> cart = {"POS","Shape"}; - vector<string> sphe = {"R","Theta","Phi","Shape"}; - vector<string> cyli = {"R","Alpha","Zeta","Shape"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - - G4ThreeVector Pos = NPS::ConvertVector(blocks[i]->GetTVector3("POS","mm")); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(Pos,Shape); - } - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Theta = blocks[i]->GetDouble("Theta","deg"); - double Phi = blocks[i]->GetDouble("Phi","deg"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(R,Theta,Phi,Shape); - } - else if(blocks[i]->HasTokenList(cyli)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Alpha = blocks[i]->GetDouble("Alpha","deg"); - double Zeta = blocks[i]->GetDouble("Zeta","mm"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector2(R,Alpha,Zeta,Shape); - } - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Dali::ConstructDetector(G4LogicalVolume* world){ - - for (unsigned short i = 0 ; i < m_R.size() ; i++) { - - G4double wX = m_R[i] * cos(m_Alpha[i] ) ; - G4double wY = m_R[i] * sin(m_Alpha[i] ) ; - G4double wZ = m_Zeta[i]; - G4ThreeVector Det_pos = G4ThreeVector(wX, wY, wZ) ; - - G4RotationMatrix* Rot = new G4RotationMatrix(); - - if(m_Zeta[i]>0){ - Rot->rotateY(180*deg); Rot->rotateZ(m_Alpha[i]); - } else{Rot->rotateZ(m_Alpha[i]);} - - - if(m_Shape[i] == "Cylindrical"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildCylindricalDetector(), - "Dali",world,false,i+1); - } - - else if(m_Shape[i] == "Square"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildSquareDetector(), - "Dali",world,false,i+1); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Add Detector branch to the EventTree. -// Called After DetecorConstruction::AddDetector Method -void Dali::InitializeRootOutput(){ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - if(!pTree->FindBranch("Dali")){ - pTree->Branch("Dali", "TDaliData", &m_Event) ; - } - pTree->SetBranchAddress("Dali", &m_Event) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void Dali::ReadSensitive(const G4Event* ){ - m_Event->Clear(); - /////////// - // Calorimeter scorer - CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_DaliScorer->GetPrimitive(0); - - - - unsigned int size = Scorer->GetMult(); - // cout << "size " << size << endl; - for(unsigned int i = 0 ; i < size ; i++){ - vector<unsigned int> level = Scorer->GetLevel(i); - double Energy = RandGauss::shoot(Scorer->GetEnergy(i),Dali_NS::ResoEnergy); - // cout << Energy << endl; - if(Energy>Dali_NS::EnergyThreshold){ - double Time = RandGauss::shoot(Scorer->GetTime(i),Dali_NS::ResoTime); - int ArrayNbr = level[1]; - int DetectinsArrayNbr = level[0]+1; - int DetectorNbr = (ArrayNbr-1)*3+DetectinsArrayNbr; - m_Event->SetEnergy(DetectorNbr,Energy); - m_Event->SetTime(DetectorNbr,Time); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////// -void Dali::InitializeScorers() { - // This check is necessary in case the geometry is reloaded - bool already_exist = false; - vector<G4int> NestingLevel; - NestingLevel.push_back(2); - NestingLevel.push_back(3); - - m_DaliScorer = CheckScorer("DaliScorer",already_exist) ; - - if(already_exist) - return ; - - // Otherwise the scorer is initialised - //vector<int> level; level.push_back(0); - G4VPrimitiveScorer* Calorimeter= new CalorimeterScorers::PS_Calorimeter("Calorimeter", NestingLevel) ; - G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; - //and register it to the multifunctionnal detector - m_DaliScorer->RegisterPrimitive(Calorimeter); - m_DaliScorer->RegisterPrimitive(Interaction); - G4SDManager::GetSDMpointer()->AddNewDetector(m_DaliScorer) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPS::VDetector* Dali::Construct(){ - return (NPS::VDetector*) new Dali(); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern"C" { - class proxy_nps_Dali{ - public: - proxy_nps_Dali(){ - NPS::DetectorFactory::getInstance()->AddToken("Dali","Dali"); - NPS::DetectorFactory::getInstance()->AddDetector("Dali",Dali::Construct); - } - }; - - proxy_nps_Dali p_nps_Dali; -} diff --git a/NPSimulation/Detectors/Dali/Dali.cc.~16~ b/NPSimulation/Detectors/Dali/Dali.cc.~16~ deleted file mode 100644 index 9631a93e6092365d2d9e196583e8d322055bb832..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.cc.~16~ +++ /dev/null @@ -1,432 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <cmath> -#include <limits> -//G4 Geometry object -#include "G4Tubs.hh" -#include "G4Box.hh" - -//G4 sensitive -#include "G4SDManager.hh" -#include "G4MultiFunctionalDetector.hh" - -//G4 various object -#include "G4Material.hh" -#include "G4Transform3D.hh" -#include "G4PVPlacement.hh" -//#include "G4VPhysicalVolume.hh" -#include "G4PVReplica.hh" -#include "G4VisAttributes.hh" -#include "G4Colour.hh" - -// NPTool header -#include "Dali.hh" -#include "CalorimeterScorers.hh" -#include "InteractionScorers.hh" -#include "RootOutput.h" -#include "MaterialManager.hh" -#include "NPSDetectorFactory.hh" -#include "NPOptionManager.h" -#include "NPSHitsMap.hh" -// CLHEP header -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; - - - - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace Dali_NS{ - // Energy and time Resolution - const double EnergyThreshold = 0*MeV; - const double ResoTime = 4.5*ns ; - const double ResoEnergy = 0.001*MeV ; - const double Radius = 50*mm ; - const double Width = 49.76*mm ; - const double Hight = 84.81*mm ; - const double Thickness = 164.82*mm ; - const string Material = "NaI"; //Change to drug it with Tl -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Dali Specific Method -Dali::Dali(){ - m_Event = new TDaliData() ; - m_DaliScorer = 0; - m_SquareDetector = 0; - m_SquareDetector_Can = 0; - m_SquareDetector_CanMgO =0; - m_CylindricalDetector = 0; - m_SquareDetector_Crystal = 0; - Logic_ArrayDali_1 =0; - - // RGB Color + Transparency - m_VisSquare = new G4VisAttributes(G4Colour(0, 1, 0, 0.5)); - m_VisCylinder = new G4VisAttributes(G4Colour(0, 0, 1, 0.5)); - -} - -Dali::~Dali(){ -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(G4ThreeVector POS, string Shape){ - // Convert the POS value to R theta Phi as Cylindrical coordinate is easier in G4 - m_R.push_back(POS.perp()); - m_Alpha.push_back(POS.phi()); - m_Zeta.push_back(POS.y()); - m_Shape.push_back(Shape); -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(double R, double Theta, double Phi, string Shape){ - - double m_r, m_alpha, m_zeta; - - m_r = R*cos(Phi); - m_alpha = Theta; - m_zeta = R*sin(Phi); - - m_R.push_back(m_r); - m_Alpha.push_back(m_alpha); - m_Zeta.push_back(m_zeta); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -void Dali::AddDetector2(double R, double Alpha, double Zeta, string Shape){ - m_R.push_back(R); - m_Alpha.push_back(Alpha); - m_Zeta.push_back(Zeta); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - - - -G4LogicalVolume* Dali::BuildSquareDetector(){ - if(!m_SquareDetector){ - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - - - G4Element* H = new G4Element("Hydrogen","H" , 1., 1.01*g/mole); - - G4Isotope* Mg24 = new G4Isotope ("Mg24", 12, 24, 23.985041*g/mole); - G4Isotope* Mg25 = new G4Isotope ("Mg25", 12, 25, 24.985836*g/mole); - G4Isotope* Mg26 = new G4Isotope ("Mg26", 12, 26, 25.982592*g/mole); - G4Element* Mg= new G4Element("elMagnesium","Mg",3); - Mg->AddIsotope(Mg24, 78.99*perCent); - Mg->AddIsotope(Mg25, 10*perCent); - Mg->AddIsotope(Mg26, 11.01*perCent); - - G4Isotope* O16 = new G4Isotope ("O16", 8, 16, 15.99*g/mole); - G4Isotope* O17 = new G4Isotope ("O17", 8, 17, 17.00*g/mole); - G4Isotope* O18 = new G4Isotope ("O18", 8, 18, 18.00*g/mole); - G4Element* O= new G4Element("elOxygen","O",3); - O->AddIsotope(O16, 99.76*perCent); - O->AddIsotope(O17, 0.04*perCent); - O->AddIsotope(O18, 0.20*perCent); - - G4Material* MgO = new G4Material("MgO",3.6*g/cm3,2); - MgO->AddElement(Mg,1); - MgO->AddElement(O, 1); - - G4Element *elTl = new G4Element("Thallium","Tl",81.,204.383*g/mole ); - G4Material* NaI_Tl = new G4Material("NaI_Tl",3.6667*g/cm3, 2); - NaI_Tl->AddMaterial(MaterialManager::getInstance()->GetMaterialFromLibrary("NaI"),99.6*perCent); - NaI_Tl->AddElement(elTl,0.4*perCent); - - - - - - - G4Box* box_3can = new G4Box("Dali_3BoxCan", Dali_NS::Hight*0.5, - Dali_NS::Width*0.5*3, Dali_NS::Thickness*0.5); - G4Material* Aria = MaterialManager::getInstance()->GetMaterialFromLibrary("Air"); - Logic_ArrayDali_1 = new G4LogicalVolume(box_3can,Aria,"logic_ArrayDali",0,0,0); - - - - G4Box* box_can = new G4Box("Dali_BoxCan", Dali_NS::Hight*0.5, - Dali_NS::Width*0.5, Dali_NS::Thickness*0.5); - G4Material* DetectorCanMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary("Al"); - m_SquareDetector_Can = new G4LogicalVolume(box_can,DetectorCanMaterial,"logic_Dali_Can",0,0,0); - G4VisAttributes* Can_Attributes = new G4VisAttributes(G4Colour(0.5,0.5,0.5)); - m_SquareDetector_Can->SetVisAttributes(Can_Attributes); - - G4Box* box_MgO = new G4Box("Dali_BoxMgO", Dali_NS::Hight*0.5-1*mm, - Dali_NS::Width*0.5-1*mm, Dali_NS::Thickness*0.5-1*mm); - - m_SquareDetector_CanMgO = new G4LogicalVolume(box_MgO,MgO,"logic_Dali_CanMg0",0,0,0); - - G4Box* box_crystal = new G4Box("Dali_BoxNaI", Dali_NS::Hight*0.5-2.4*mm, - Dali_NS::Width*0.5-2.4*mm, Dali_NS::Thickness*0.5-2.4*mm); - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_SquareDetector_Crystal = new G4LogicalVolume(box_crystal,NaI_Tl,"logic_Dali_Box",0,0,0); - - G4ThreeVector positionnull = G4ThreeVector(0,0,0); - - // MgO Volume - - G4PVPlacement* physi_MgO = new G4PVPlacement(0, positionnull, - m_SquareDetector_CanMgO, - "MgO", - m_SquareDetector_Can, - false, - 0); - G4VisAttributes* MgO_Attributes = new G4VisAttributes(G4Colour(0.0,1.0,0.5)); - m_SquareDetector_CanMgO->SetVisAttributes(MgO_Attributes); - - - // NaI Volume - - G4PVPlacement* physi_NaI = new G4PVPlacement(0, positionnull, - m_SquareDetector_Crystal, - "Crystal NaI", - m_SquareDetector_CanMgO, - false, - 0); - - m_SquareDetector_Crystal->SetVisAttributes(m_VisSquare); - m_SquareDetector_Crystal->SetSensitiveDetector(m_DaliScorer); - - G4VPhysicalVolume* ArrayDali_1 = new G4PVReplica("ArrayDali_1", - m_SquareDetector_Can, - Logic_ArrayDali_1 , - kYAxis, - 3, - Dali_NS::Width, //????????? - 0); - - - - - - } - - return Logic_ArrayDali_1; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Dali::BuildCylindricalDetector(){ - if(!m_CylindricalDetector){ - G4Tubs* tub = new G4Tubs("Dali_Cyl",0,Dali_NS::Radius, Dali_NS::Thickness*0.5,0,360*deg); - - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_CylindricalDetector = new G4LogicalVolume(tub,DetectorMaterial,"logic_Dali_tub",0,0,0); - m_CylindricalDetector->SetVisAttributes(m_VisSquare); - m_CylindricalDetector->SetSensitiveDetector(m_DaliScorer); - - } - return m_CylindricalDetector; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Virtual Method of NPS::VDetector class - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void Dali::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Dali"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> cart = {"POS","Shape"}; - vector<string> sphe = {"R","Theta","Phi","Shape"}; - vector<string> cyli = {"R","Alpha","Zeta","Shape"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - - G4ThreeVector Pos = NPS::ConvertVector(blocks[i]->GetTVector3("POS","mm")); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(Pos,Shape); - } - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Theta = blocks[i]->GetDouble("Theta","deg"); - double Phi = blocks[i]->GetDouble("Phi","deg"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(R,Theta,Phi,Shape); - } - else if(blocks[i]->HasTokenList(cyli)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Alpha = blocks[i]->GetDouble("Alpha","deg"); - double Zeta = blocks[i]->GetDouble("Zeta","mm"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector2(R,Alpha,Zeta,Shape); - } - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Dali::ConstructDetector(G4LogicalVolume* world){ - - - - for (unsigned short i = 0 ; i < m_R.size() ; i++) { - - G4double wX = m_R[i] * cos(m_Alpha[i] ) ; - G4double wY = m_R[i] * sin(m_Alpha[i] ) ; - G4double wZ = m_Zeta[i]; - G4ThreeVector Det_pos = G4ThreeVector(wX, wY, wZ) ; - - - - G4RotationMatrix* Rot = new G4RotationMatrix(); - - - - - - if(m_Zeta[i]>0){ - Rot->rotateY(180*deg); Rot->rotateZ(m_Alpha[i]); - } else{Rot->rotateZ(m_Alpha[i]);} - - - if(m_Shape[i] == "Cylindrical"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildCylindricalDetector(), - "Dali",world,false,i+1); - } - - else if(m_Shape[i] == "Square"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildSquareDetector(), - "Dali",world,false,i+1); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Add Detector branch to the EventTree. -// Called After DetecorConstruction::AddDetector Method -void Dali::InitializeRootOutput(){ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - if(!pTree->FindBranch("Dali")){ - pTree->Branch("Dali", "TDaliData", &m_Event) ; - } - pTree->SetBranchAddress("Dali", &m_Event) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void Dali::ReadSensitive(const G4Event* ){ - m_Event->Clear(); - /////////// - // Calorimeter scorer - CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_DaliScorer->GetPrimitive(0); - - - - unsigned int size = Scorer->GetMult(); - // cout << "size " << size << endl; - for(unsigned int i = 0 ; i < size ; i++){ - vector<unsigned int> level = Scorer->GetLevel(i); - double Energy = RandGauss::shoot(Scorer->GetEnergy(i),Dali_NS::ResoEnergy); - // cout << Energy << endl; - if(Energy>Dali_NS::EnergyThreshold){ - double Time = RandGauss::shoot(Scorer->GetTime(i),Dali_NS::ResoTime); - int ArrayNbr = level[1]; - int DetectinsArrayNbr = level[0]+1; - int DetectorNbr = (ArrayNbr-1)*3+DetectinsArrayNbr; - m_Event->SetEnergy(DetectorNbr,Energy); - m_Event->SetTime(DetectorNbr,Time); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////// -void Dali::InitializeScorers() { - // This check is necessary in case the geometry is reloaded - bool already_exist = false; - vector<G4int> NestingLevel; - NestingLevel.push_back(2); - NestingLevel.push_back(3); - - m_DaliScorer = CheckScorer("DaliScorer",already_exist) ; - - if(already_exist) - return ; - - // Otherwise the scorer is initialised - //vector<int> level; level.push_back(0); - G4VPrimitiveScorer* Calorimeter= new CalorimeterScorers::PS_Calorimeter("Calorimeter", NestingLevel) ; - G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; - //and register it to the multifunctionnal detector - m_DaliScorer->RegisterPrimitive(Calorimeter); - m_DaliScorer->RegisterPrimitive(Interaction); - G4SDManager::GetSDMpointer()->AddNewDetector(m_DaliScorer) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPS::VDetector* Dali::Construct(){ - return (NPS::VDetector*) new Dali(); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern"C" { - class proxy_nps_Dali{ - public: - proxy_nps_Dali(){ - NPS::DetectorFactory::getInstance()->AddToken("Dali","Dali"); - NPS::DetectorFactory::getInstance()->AddDetector("Dali",Dali::Construct); - } - }; - - proxy_nps_Dali p_nps_Dali; -} diff --git a/NPSimulation/Detectors/Dali/Dali.cc.~1~ b/NPSimulation/Detectors/Dali/Dali.cc.~1~ deleted file mode 100644 index f81da00736576d00f5df26274f3785123725ae43..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.cc.~1~ +++ /dev/null @@ -1,292 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <cmath> -#include <limits> -//G4 Geometry object -#include "G4Tubs.hh" -#include "G4Box.hh" - -//G4 sensitive -#include "G4SDManager.hh" -#include "G4MultiFunctionalDetector.hh" - -//G4 various object -#include "G4Material.hh" -#include "G4Transform3D.hh" -#include "G4PVPlacement.hh" -#include "G4VisAttributes.hh" -#include "G4Colour.hh" - -// NPTool header -#include "Dali.hh" -#include "CalorimeterScorers.hh" -#include "InteractionScorers.hh" -#include "RootOutput.h" -#include "MaterialManager.hh" -#include "NPSDetectorFactory.hh" -#include "NPOptionManager.h" -#include "NPSHitsMap.hh" -// CLHEP header -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace Dali_NS{ - // Energy and time Resolution - const double EnergyThreshold = 0.1*MeV; - const double ResoTime = 4.5*ns ; - const double ResoEnergy = 1.0*MeV ; - const double Radius = 50*mm ; - const double Width = 100*mm ; - const double Thickness = 300*mm ; - const string Material = "NaI"; -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Dali Specific Method -Dali::Dali(){ - m_Event = new TDaliData() ; - m_DaliScorer = 0; - m_SquareDetector = 0; - m_CylindricalDetector = 0; - - - // RGB Color + Transparency - m_VisSquare = new G4VisAttributes(G4Colour(0, 1, 0, 0.5)); - m_VisCylinder = new G4VisAttributes(G4Colour(0, 0, 1, 0.5)); - -} - -Dali::~Dali(){ -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(G4ThreeVector POS, string Shape){ - // Convert the POS value to R theta Phi as Spherical coordinate is easier in G4 - m_R.push_back(POS.mag()); - m_Theta.push_back(POS.theta()); - m_Phi.push_back(POS.phi()); - m_Shape.push_back(Shape); -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(double R, double Theta, double Phi, string Shape){ - m_R.push_back(R); - m_Theta.push_back(Theta); - m_Phi.push_back(Phi); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Dali::BuildSquareDetector(){ - if(!m_SquareDetector){ - G4Box* box = new G4Box("Dali_Box",Dali_NS::Width*0.5, - Dali_NS::Width*0.5,Dali_NS::Thickness*0.5); - - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_SquareDetector = new G4LogicalVolume(box,DetectorMaterial,"logic_Dali_Box",0,0,0); - m_SquareDetector->SetVisAttributes(m_VisSquare); - m_SquareDetector->SetSensitiveDetector(m_DaliScorer); - } - return m_SquareDetector; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Dali::BuildCylindricalDetector(){ - if(!m_CylindricalDetector){ - G4Tubs* tub = new G4Tubs("Dali_Cyl",0,Dali_NS::Radius,Dali_NS::Thickness*0.5,0,360*deg); - - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_CylindricalDetector = new G4LogicalVolume(tub,DetectorMaterial,"logic_Dali_tub",0,0,0); - m_CylindricalDetector->SetVisAttributes(m_VisSquare); - m_CylindricalDetector->SetSensitiveDetector(m_DaliScorer); - - } - return m_CylindricalDetector; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Virtual Method of NPS::VDetector class - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void Dali::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Dali"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> cart = {"POS","Shape"}; - vector<string> sphe = {"R","Theta","Phi","Shape"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - - G4ThreeVector Pos = NPS::ConvertVector(blocks[i]->GetTVector3("POS","mm")); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(Pos,Shape); - } - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Theta = blocks[i]->GetDouble("Theta","deg"); - double Phi = blocks[i]->GetDouble("Phi","deg"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(R,Theta,Phi,Shape); - } - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Dali::ConstructDetector(G4LogicalVolume* world){ - for (unsigned short i = 0 ; i < m_R.size() ; i++) { - - G4double wX = m_R[i] * sin(m_Theta[i] ) * cos(m_Phi[i] ) ; - G4double wY = m_R[i] * sin(m_Theta[i] ) * sin(m_Phi[i] ) ; - G4double wZ = m_R[i] * cos(m_Theta[i] ) ; - G4ThreeVector Det_pos = G4ThreeVector(wX, wY, wZ) ; - // So the face of the detector is at R instead of the middle - Det_pos+=Det_pos.unit()*Dali_NS::Thickness*0.5; - // Building Detector reference frame - G4double ii = cos(m_Theta[i]) * cos(m_Phi[i]); - G4double jj = cos(m_Theta[i]) * sin(m_Phi[i]); - G4double kk = -sin(m_Theta[i]); - G4ThreeVector Y(ii,jj,kk); - G4ThreeVector w = Det_pos.unit(); - G4ThreeVector u = w.cross(Y); - G4ThreeVector v = w.cross(u); - v = v.unit(); - u = u.unit(); - - G4RotationMatrix* Rot = new G4RotationMatrix(u,v,w); - - if(m_Shape[i] == "Cylindrical"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildCylindricalDetector(), - "Dali",world,false,i+1); - } - - else if(m_Shape[i] == "Square"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildSquareDetector(), - "Dali",world,false,i+1); - } - } -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Add Detector branch to the EventTree. -// Called After DetecorConstruction::AddDetector Method -void Dali::InitializeRootOutput(){ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - if(!pTree->FindBranch("Dali")){ - pTree->Branch("Dali", "TDaliData", &m_Event) ; - } - pTree->SetBranchAddress("Dali", &m_Event) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void Dali::ReadSensitive(const G4Event* ){ - m_Event->Clear(); - - /////////// - // Calorimeter scorer - CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_DaliScorer->GetPrimitive(0); - - unsigned int size = Scorer->GetMult(); - for(unsigned int i = 0 ; i < size ; i++){ - vector<unsigned int> level = Scorer->GetLevel(i); - double Energy = RandGauss::shoot(Scorer->GetEnergy(i),Dali_NS::ResoEnergy); - if(Energy>Dali_NS::EnergyThreshold){ - double Time = RandGauss::shoot(Scorer->GetTime(i),Dali_NS::ResoTime); - int DetectorNbr = level[0]; - m_Event->SetEnergy(DetectorNbr,Energy); - m_Event->SetTime(DetectorNbr,Time); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////// -void Dali::InitializeScorers() { - // This check is necessary in case the geometry is reloaded - bool already_exist = false; - m_DaliScorer = CheckScorer("DaliScorer",already_exist) ; - - if(already_exist) - return ; - - // Otherwise the scorer is initialised - vector<int> level; level.push_back(0); - G4VPrimitiveScorer* Calorimeter= new CalorimeterScorers::PS_Calorimeter("Calorimeter",level, 0) ; - G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; - //and register it to the multifunctionnal detector - m_DaliScorer->RegisterPrimitive(Calorimeter); - m_DaliScorer->RegisterPrimitive(Interaction); - G4SDManager::GetSDMpointer()->AddNewDetector(m_DaliScorer) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPS::VDetector* Dali::Construct(){ - return (NPS::VDetector*) new Dali(); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern"C" { - class proxy_nps_Dali{ - public: - proxy_nps_Dali(){ - NPS::DetectorFactory::getInstance()->AddToken("Dali","Dali"); - NPS::DetectorFactory::getInstance()->AddDetector("Dali",Dali::Construct); - } - }; - - proxy_nps_Dali p_nps_Dali; -} diff --git a/NPSimulation/Detectors/Dali/Dali.cc.~2~ b/NPSimulation/Detectors/Dali/Dali.cc.~2~ deleted file mode 100644 index 5923ec94df6825c9cdb5ede5b892988bb5034191..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.cc.~2~ +++ /dev/null @@ -1,294 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ headers -#include <sstream> -#include <cmath> -#include <limits> -//G4 Geometry object -#include "G4Tubs.hh" -#include "G4Box.hh" - -//G4 sensitive -#include "G4SDManager.hh" -#include "G4MultiFunctionalDetector.hh" - -//G4 various object -#include "G4Material.hh" -#include "G4Transform3D.hh" -#include "G4PVPlacement.hh" -#include "G4VisAttributes.hh" -#include "G4Colour.hh" - -// NPTool header -#include "Dali.hh" -#include "CalorimeterScorers.hh" -#include "InteractionScorers.hh" -#include "RootOutput.h" -#include "MaterialManager.hh" -#include "NPSDetectorFactory.hh" -#include "NPOptionManager.h" -#include "NPSHitsMap.hh" -// CLHEP header -#include "CLHEP/Random/RandGauss.h" - -using namespace std; -using namespace CLHEP; - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -namespace Dali_NS{ - // Energy and time Resolution - const double EnergyThreshold = 0.1*MeV; - const double ResoTime = 4.5*ns ; - const double ResoEnergy = 1.0*MeV ; - const double Radius = 50*mm ; - const double Width = 44.96*mm ; - const double Hight = 160.02*mm ; - const double Thickness = 80.01*mm ; - const string Material = "NaI(Tl)"; -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Dali Specific Method -Dali::Dali(){ - m_Event = new TDaliData() ; - m_DaliScorer = 0; - m_SquareDetector = 0; - m_CylindricalDetector = 0; - - - // RGB Color + Transparency - m_VisSquare = new G4VisAttributes(G4Colour(0, 1, 0, 0.5)); - m_VisCylinder = new G4VisAttributes(G4Colour(0, 0, 1, 0.5)); - -} - -Dali::~Dali(){ -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(G4ThreeVector POS, string Shape){ - // Convert the POS value to R theta Phi as Spherical coordinate is easier in G4 - m_R.push_back(POS.mag()); - m_Theta.push_back(POS.theta()); - m_Phi.push_back(POS.phi()); - m_Shape.push_back(Shape); -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -void Dali::AddDetector(double R, double Theta, double Phi, string Shape){ - m_R.push_back(R); - m_Theta.push_back(Theta); - m_Phi.push_back(Phi); - m_Shape.push_back(Shape); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Dali::BuildSquareDetector(){ - if(!m_SquareDetector){ - G4Box* box = new G4Box("Dali_Box", Dali_NS::Width*0.5, - Dali_NS::Hight*0.5, Dali_NS::Thickness*0.5); - - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_SquareDetector = new G4LogicalVolume(box,DetectorMaterial,"logic_Dali_Box",0,0,0); - m_SquareDetector_Can = new G4LogicalVolume(box,DetectorMaterial,"logic_Dali_Can",0,0,0); - m_SquareDetector->SetVisAttributes(m_VisSquare); - m_SquareDetector->SetSensitiveDetector(m_DaliScorer); - } - return m_SquareDetector; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -G4LogicalVolume* Dali::BuildCylindricalDetector(){ - if(!m_CylindricalDetector){ - G4Tubs* tub = new G4Tubs("Dali_Cyl",0,Dali_NS::Radius, Dali_NS::Thickness*0.5,0,360*deg); - - G4Material* DetectorMaterial = MaterialManager::getInstance()->GetMaterialFromLibrary(Dali_NS::Material); - m_CylindricalDetector = new G4LogicalVolume(tub,DetectorMaterial,"logic_Dali_tub",0,0,0); - m_CylindricalDetector->SetVisAttributes(m_VisSquare); - m_CylindricalDetector->SetSensitiveDetector(m_DaliScorer); - - } - return m_CylindricalDetector; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Virtual Method of NPS::VDetector class - -// Read stream at Configfile to pick-up parameters of detector (Position,...) -// Called in DetecorConstruction::ReadDetextorConfiguration Method -void Dali::ReadConfiguration(NPL::InputParser parser){ - vector<NPL::InputBlock*> blocks = parser.GetAllBlocksWithToken("Dali"); - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << "//// " << blocks.size() << " detectors found " << endl; - - vector<string> cart = {"POS","Shape"}; - vector<string> sphe = {"R","Theta","Phi","Shape"}; - - for(unsigned int i = 0 ; i < blocks.size() ; i++){ - if(blocks[i]->HasTokenList(cart)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - - G4ThreeVector Pos = NPS::ConvertVector(blocks[i]->GetTVector3("POS","mm")); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(Pos,Shape); - } - else if(blocks[i]->HasTokenList(sphe)){ - if(NPOptionManager::getInstance()->GetVerboseLevel()) - cout << endl << "//// Dali " << i+1 << endl; - double R = blocks[i]->GetDouble("R","mm"); - double Theta = blocks[i]->GetDouble("Theta","deg"); - double Phi = blocks[i]->GetDouble("Phi","deg"); - string Shape = blocks[i]->GetString("Shape"); - AddDetector(R,Theta,Phi,Shape); - } - else{ - cout << "ERROR: check your input file formatting " << endl; - exit(1); - } - } -} - - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... - -// Construct detector and inialise sensitive part. -// Called After DetecorConstruction::AddDetector Method -void Dali::ConstructDetector(G4LogicalVolume* world){ - for (unsigned short i = 0 ; i < m_R.size() ; i++) { - - G4double wX = m_R[i] * sin(m_Theta[i] ) * cos(m_Phi[i] ) ; - G4double wY = m_R[i] * sin(m_Theta[i] ) * sin(m_Phi[i] ) ; - G4double wZ = m_R[i] * cos(m_Theta[i] ) ; - G4ThreeVector Det_pos = G4ThreeVector(wX, wY, wZ) ; - // So the face of the detector is at R instead of the middle - Det_pos+=Det_pos.unit()*Dali_NS::Thickness*0.5; - // Building Detector reference frame - G4double ii = cos(m_Theta[i]) * cos(m_Phi[i]); - G4double jj = cos(m_Theta[i]) * sin(m_Phi[i]); - G4double kk = -sin(m_Theta[i]); - G4ThreeVector Y(ii,jj,kk); - G4ThreeVector w = Det_pos.unit(); - G4ThreeVector u = w.cross(Y); - G4ThreeVector v = w.cross(u); - v = v.unit(); - u = u.unit(); - - G4RotationMatrix* Rot = new G4RotationMatrix(u,v,w); - - if(m_Shape[i] == "Cylindrical"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildCylindricalDetector(), - "Dali",world,false,i+1); - } - - else if(m_Shape[i] == "Square"){ - new G4PVPlacement(G4Transform3D(*Rot,Det_pos), - BuildSquareDetector(), - "Dali",world,false,i+1); - } - } -} -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Add Detector branch to the EventTree. -// Called After DetecorConstruction::AddDetector Method -void Dali::InitializeRootOutput(){ - RootOutput *pAnalysis = RootOutput::getInstance(); - TTree *pTree = pAnalysis->GetTree(); - if(!pTree->FindBranch("Dali")){ - pTree->Branch("Dali", "TDaliData", &m_Event) ; - } - pTree->SetBranchAddress("Dali", &m_Event) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -// Read sensitive part and fill the Root tree. -// Called at in the EventAction::EndOfEventAvtion -void Dali::ReadSensitive(const G4Event* ){ - m_Event->Clear(); - - /////////// - // Calorimeter scorer - CalorimeterScorers::PS_Calorimeter* Scorer= (CalorimeterScorers::PS_Calorimeter*) m_DaliScorer->GetPrimitive(0); - - unsigned int size = Scorer->GetMult(); - for(unsigned int i = 0 ; i < size ; i++){ - vector<unsigned int> level = Scorer->GetLevel(i); - double Energy = RandGauss::shoot(Scorer->GetEnergy(i),Dali_NS::ResoEnergy); - if(Energy>Dali_NS::EnergyThreshold){ - double Time = RandGauss::shoot(Scorer->GetTime(i),Dali_NS::ResoTime); - int DetectorNbr = level[0]; - m_Event->SetEnergy(DetectorNbr,Energy); - m_Event->SetTime(DetectorNbr,Time); - } - } -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////// -void Dali::InitializeScorers() { - // This check is necessary in case the geometry is reloaded - bool already_exist = false; - m_DaliScorer = CheckScorer("DaliScorer",already_exist) ; - - if(already_exist) - return ; - - // Otherwise the scorer is initialised - vector<int> level; level.push_back(0); - G4VPrimitiveScorer* Calorimeter= new CalorimeterScorers::PS_Calorimeter("Calorimeter",level, 0) ; - G4VPrimitiveScorer* Interaction= new InteractionScorers::PS_Interactions("Interaction",ms_InterCoord, 0) ; - //and register it to the multifunctionnal detector - m_DaliScorer->RegisterPrimitive(Calorimeter); - m_DaliScorer->RegisterPrimitive(Interaction); - G4SDManager::GetSDMpointer()->AddNewDetector(m_DaliScorer) ; -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Construct Method to be pass to the DetectorFactory // -//////////////////////////////////////////////////////////////////////////////// -NPS::VDetector* Dali::Construct(){ - return (NPS::VDetector*) new Dali(); -} - -//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... -//////////////////////////////////////////////////////////////////////////////// -// Registering the construct method to the factory // -//////////////////////////////////////////////////////////////////////////////// -extern"C" { - class proxy_nps_Dali{ - public: - proxy_nps_Dali(){ - NPS::DetectorFactory::getInstance()->AddToken("Dali","Dali"); - NPS::DetectorFactory::getInstance()->AddDetector("Dali",Dali::Construct); - } - }; - - proxy_nps_Dali p_nps_Dali; -} diff --git a/NPSimulation/Detectors/Dali/Dali.hh.~1~ b/NPSimulation/Detectors/Dali/Dali.hh.~1~ deleted file mode 100644 index 2a0df874836328a57c77b2c38903d99fc026a850..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.hh.~1~ +++ /dev/null @@ -1,117 +0,0 @@ -#ifndef Dali_h -#define Dali_h 1 -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ header -#include <string> -#include <vector> -using namespace std; - -// G4 headers -#include "G4ThreeVector.hh" -#include "G4RotationMatrix.hh" -#include "G4LogicalVolume.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool header -#include "NPSVDetector.hh" -#include "TDaliData.h" -#include "NPInputParser.h" - -class Dali : public NPS::VDetector{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// - public: - Dali() ; - virtual ~Dali() ; - - //////////////////////////////////////////////////// - /////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// - public: - // Cartesian - void AddDetector(G4ThreeVector POS, string Shape); - // Spherical - void AddDetector(double R,double Theta,double Phi,string Shape); - - - G4LogicalVolume* BuildSquareDetector(); - G4LogicalVolume* BuildCylindricalDetector(); - - private: - G4LogicalVolume* m_SquareDetector; - G4LogicalVolume* m_CylindricalDetector; - - //////////////////////////////////////////////////// - ////// Inherite from NPS::VDetector class ///////// - //////////////////////////////////////////////////// - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser) ; - - // Construct detector and inialise sensitive part. - // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; - - // Add Detector branch to the EventTree. - // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; - - // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; - - public: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Associated Scorer - G4MultiFunctionalDetector* m_DaliScorer ; - //////////////////////////////////////////////////// - ///////////Event class to store Data//////////////// - //////////////////////////////////////////////////// - private: - TDaliData* m_Event ; - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// - private: // Geometry - // Detector Coordinate - vector<double> m_R; - vector<double> m_Theta; - vector<double> m_Phi; - - // Shape type - vector<string> m_Shape ; - - // Visualisation Attribute - G4VisAttributes* m_VisSquare; - G4VisAttributes* m_VisCylinder; - - // Needed for dynamic loading of the library - public: - static NPS::VDetector* Construct(); -}; -#endif diff --git a/NPSimulation/Detectors/Dali/Dali.hh.~2~ b/NPSimulation/Detectors/Dali/Dali.hh.~2~ deleted file mode 100644 index ddbb44ac30f6946bda987e15c099cce89f2a1c20..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.hh.~2~ +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef Dali_h -#define Dali_h 1 -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ header -#include <string> -#include <vector> -using namespace std; - -// G4 headers -#include "G4ThreeVector.hh" -#include "G4RotationMatrix.hh" -#include "G4LogicalVolume.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool header -#include "NPSVDetector.hh" -#include "TDaliData.h" -#include "NPInputParser.h" - -class Dali : public NPS::VDetector{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// - public: - Dali() ; - virtual ~Dali() ; - - //////////////////////////////////////////////////// - /////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// - public: - // Cartesian - void AddDetector(G4ThreeVector POS, string Shape); - // Spherical - void AddDetector(double R,double Theta,double Phi,string Shape); - - - G4LogicalVolume* BuildSquareDetector(); - G4LogicalVolume* BuildCylindricalDetector(); - - private: - G4LogicalVolume* m_SquareDetector; - G4LogicalVolume* m_SquareDetector_Can; - G4LogicalVolume* m_CylindricalDetector; - G4LogicalVolume* m_SquareDetector_CanMgO; - - //////////////////////////////////////////////////// - ////// Inherite from NPS::VDetector class ///////// - //////////////////////////////////////////////////// - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser) ; - - // Construct detector and inialise sensitive part. - // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; - - // Add Detector branch to the EventTree. - // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; - - // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; - - public: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Associated Scorer - G4MultiFunctionalDetector* m_DaliScorer ; - //////////////////////////////////////////////////// - ///////////Event class to store Data//////////////// - //////////////////////////////////////////////////// - private: - TDaliData* m_Event ; - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// - private: // Geometry - // Detector Coordinate - vector<double> m_R; - vector<double> m_Theta; - vector<double> m_Phi; - - // Shape type - vector<string> m_Shape ; - - // Visualisation Attribute - G4VisAttributes* m_VisSquare; - G4VisAttributes* m_VisCylinder; - - // Needed for dynamic loading of the library - public: - static NPS::VDetector* Construct(); -}; -#endif diff --git a/NPSimulation/Detectors/Dali/Dali.hh.~3~ b/NPSimulation/Detectors/Dali/Dali.hh.~3~ deleted file mode 100644 index 3e37e84519fd2c0c15e6a47409b7b7f97fdb166b..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.hh.~3~ +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef Dali_h -#define Dali_h 1 -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ header -#include <string> -#include <vector> -using namespace std; - -// G4 headers -#include "G4ThreeVector.hh" -#include "G4RotationMatrix.hh" -#include "G4LogicalVolume.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool header -#include "NPSVDetector.hh" -#include "TDaliData.h" -#include "NPInputParser.h" - -class Dali : public NPS::VDetector{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// - public: - Dali() ; - virtual ~Dali() ; - - //////////////////////////////////////////////////// - /////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// - public: - // Cartesian - void AddDetector(G4ThreeVector POS, string Shape); - // Spherical - void AddDetector(double R,double Theta,double Phi,string Shape); - - - G4LogicalVolume* BuildSquareDetector(); - G4LogicalVolume* BuildCylindricalDetector(); - - private: - G4LogicalVolume* m_SquareDetector; - G4LogicalVolume* m_SquareDetector_Can; - G4LogicalVolume* m_CylindricalDetector; - G4LogicalVolume* m_SquareDetector_CanMgO; - G4LogicalVolume* m_SquareDetector_Crystal; - G4LogicalVolume* Logic_ArrayDali_1; - - //////////////////////////////////////////////////// - ////// Inherite from NPS::VDetector class ///////// - //////////////////////////////////////////////////// - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser) ; - - // Construct detector and inialise sensitive part. - // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; - - // Add Detector branch to the EventTree. - // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; - - // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; - - public: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Associated Scorer - G4MultiFunctionalDetector* m_DaliScorer ; - //////////////////////////////////////////////////// - ///////////Event class to store Data//////////////// - //////////////////////////////////////////////////// - private: - TDaliData* m_Event ; - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// - private: // Geometry - // Detector Coordinate - vector<double> m_R; - vector<double> m_Theta; - vector<double> m_Phi; - - // Shape type - vector<string> m_Shape ; - - // Visualisation Attribute - G4VisAttributes* m_VisSquare; - G4VisAttributes* m_VisCylinder; - - // Needed for dynamic loading of the library - public: - static NPS::VDetector* Construct(); -}; -#endif diff --git a/NPSimulation/Detectors/Dali/Dali.hh.~4~ b/NPSimulation/Detectors/Dali/Dali.hh.~4~ deleted file mode 100644 index 3bb254f29d76ccc7639fc1c716998c230b0f6cd2..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.hh.~4~ +++ /dev/null @@ -1,122 +0,0 @@ -#ifndef Dali_h -#define Dali_h 1 -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ header -#include <string> -#include <vector> -using namespace std; - -// G4 headers -#include "G4ThreeVector.hh" -#include "G4RotationMatrix.hh" -#include "G4LogicalVolume.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool header -#include "NPSVDetector.hh" -#include "TDaliData.h" -#include "NPInputParser.h" - -class Dali : public NPS::VDetector{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// - public: - Dali() ; - virtual ~Dali() ; - - //////////////////////////////////////////////////// - /////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// - public: - // Cartesian - void AddDetector(G4ThreeVector POS, string Shape); - // Spherical - void AddDetector(double R,double Theta,double Phi,string Shape); - //Cylindrical - void AddDetector(double R,double Alpha,double Zeta,string Shape); - - G4LogicalVolume* BuildSquareDetector(); - G4LogicalVolume* BuildCylindricalDetector(); - - private: - G4LogicalVolume* m_SquareDetector; - G4LogicalVolume* m_SquareDetector_Can; - G4LogicalVolume* m_CylindricalDetector; - G4LogicalVolume* m_SquareDetector_CanMgO; - G4LogicalVolume* m_SquareDetector_Crystal; - G4LogicalVolume* Logic_ArrayDali_1; - - //////////////////////////////////////////////////// - ////// Inherite from NPS::VDetector class ///////// - //////////////////////////////////////////////////// - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser) ; - - // Construct detector and inialise sensitive part. - // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; - - // Add Detector branch to the EventTree. - // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; - - // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; - - public: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Associated Scorer - G4MultiFunctionalDetector* m_DaliScorer ; - //////////////////////////////////////////////////// - ///////////Event class to store Data//////////////// - //////////////////////////////////////////////////// - private: - TDaliData* m_Event ; - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// - private: // Geometry - // Detector Coordinate - vector<double> m_R; - vector<double> m_Zeta; - vector<double> m_Alpha; - - // Shape type - vector<string> m_Shape ; - - // Visualisation Attribute - G4VisAttributes* m_VisSquare; - G4VisAttributes* m_VisCylinder; - - // Needed for dynamic loading of the library - public: - static NPS::VDetector* Construct(); -}; -#endif diff --git a/NPSimulation/Detectors/Dali/Dali.hh.~5~ b/NPSimulation/Detectors/Dali/Dali.hh.~5~ deleted file mode 100644 index e33d910378e3b3b0ef8d92ad5a87a69404d29142..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/Dali.hh.~5~ +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef Dali_h -#define Dali_h 1 -/***************************************************************************** - * Copyright (C) 2009-2018 this file is part of the NPTool Project * - * * - * For the licensing terms see $NPTOOL/Licence/NPTool_Licence * - * For the list of contributors see $NPTOOL/Licence/Contributors * - *****************************************************************************/ - -/***************************************************************************** - * Original Author: Elidiano Tronchin contact address: elidiano.tronchin@studenti.unipd.it * - * * - * Creation Date : septembre 2018 * - * Last update : * - *---------------------------------------------------------------------------* - * Decription: * - * This class describe Dali simulation * - * * - *---------------------------------------------------------------------------* - * Comment: * - * * - *****************************************************************************/ - -// C++ header -#include <string> -#include <vector> -#include <cmath> -using namespace std; - -// G4 headers -#include "G4ThreeVector.hh" -#include "G4RotationMatrix.hh" -#include "G4LogicalVolume.hh" -#include "G4MultiFunctionalDetector.hh" - -// NPTool header -#include "NPSVDetector.hh" -#include "TDaliData.h" -#include "NPInputParser.h" - -class Dali : public NPS::VDetector{ - //////////////////////////////////////////////////// - /////// Default Constructor and Destructor ///////// - //////////////////////////////////////////////////// - public: - Dali() ; - virtual ~Dali() ; - - //////////////////////////////////////////////////// - /////// Specific Function of this Class /////////// - //////////////////////////////////////////////////// - public: - // Cartesian - void AddDetector(G4ThreeVector POS, string Shape); - // Spherical - void AddDetector(double R,double Theta,double Phi,string Shape); - //Cylindrical - void AddDetector2(double R,double Alpha,double Zeta,string Shape); - - G4LogicalVolume* BuildSquareDetector(); - G4LogicalVolume* BuildCylindricalDetector(); - - private: - G4LogicalVolume* m_SquareDetector; - G4LogicalVolume* m_SquareDetector_Can; - G4LogicalVolume* m_CylindricalDetector; - G4LogicalVolume* m_SquareDetector_CanMgO; - G4LogicalVolume* m_SquareDetector_Crystal; - G4LogicalVolume* Logic_ArrayDali_1; - - //////////////////////////////////////////////////// - ////// Inherite from NPS::VDetector class ///////// - //////////////////////////////////////////////////// - public: - // Read stream at Configfile to pick-up parameters of detector (Position,...) - // Called in DetecorConstruction::ReadDetextorConfiguration Method - void ReadConfiguration(NPL::InputParser) ; - - // Construct detector and inialise sensitive part. - // Called After DetecorConstruction::AddDetector Method - void ConstructDetector(G4LogicalVolume* world) ; - - // Add Detector branch to the EventTree. - // Called After DetecorConstruction::AddDetector Method - void InitializeRootOutput() ; - - // Read sensitive part and fill the Root tree. - // Called at in the EventAction::EndOfEventAvtion - void ReadSensitive(const G4Event* event) ; - - public: // Scorer - // Initialize all Scorer used by the MUST2Array - void InitializeScorers() ; - - // Associated Scorer - G4MultiFunctionalDetector* m_DaliScorer ; - //////////////////////////////////////////////////// - ///////////Event class to store Data//////////////// - //////////////////////////////////////////////////// - private: - TDaliData* m_Event ; - - //////////////////////////////////////////////////// - ///////////////Private intern Data////////////////// - //////////////////////////////////////////////////// - private: // Geometry - // Detector Coordinate - vector<double> m_Zeta; - vector<double> m_R; - vector<double> m_Alpha; - - // Shape type - vector<string> m_Shape ; - - // Visualisation Attribute - G4VisAttributes* m_VisSquare; - G4VisAttributes* m_VisCylinder; - - // Needed for dynamic loading of the library - public: - static NPS::VDetector* Construct(); -}; -#endif diff --git a/NPSimulation/Detectors/Dali/nomeoke.C b/NPSimulation/Detectors/Dali/nomeoke.C deleted file mode 100644 index 472031271a0da973e246a78598b2b09feaac2fcb..0000000000000000000000000000000000000000 --- a/NPSimulation/Detectors/Dali/nomeoke.C +++ /dev/null @@ -1,4 +0,0 @@ -void nomeoke() -{ - TEveManager::Create(); -}