From 1ff7bd44a7d01e3d158d1436875d58a7a12d5c1b Mon Sep 17 00:00:00 2001
From: adrien-matta <a.matta@surrey.ac.uk>
Date: Sun, 19 Jul 2015 15:10:32 +0100
Subject: [PATCH] * Adding Spice detector skeleton

---
 NPSimulation/Spice/CMakeLists.txt |   2 +
 NPSimulation/Spice/Spice.cc       | 132 ++++++++++++++++++++++++++++++
 NPSimulation/Spice/Spice.hh       |  99 ++++++++++++++++++++++
 3 files changed, 233 insertions(+)
 create mode 100644 NPSimulation/Spice/CMakeLists.txt
 create mode 100644 NPSimulation/Spice/Spice.cc
 create mode 100644 NPSimulation/Spice/Spice.hh

diff --git a/NPSimulation/Spice/CMakeLists.txt b/NPSimulation/Spice/CMakeLists.txt
new file mode 100644
index 000000000..f0899f832
--- /dev/null
+++ b/NPSimulation/Spice/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(NPSSpice SHARED  Spice.cc)
+target_link_libraries(NPSSpice NPSCore ${ROOT_LIBRARIES} ${Geant4_LIBRARIES} ${NPLib_LIBRARIES} )
diff --git a/NPSimulation/Spice/Spice.cc b/NPSimulation/Spice/Spice.cc
new file mode 100644
index 000000000..792a93c00
--- /dev/null
+++ b/NPSimulation/Spice/Spice.cc
@@ -0,0 +1,132 @@
+/*****************************************************************************
+ * Copyright (C) 2009-2013   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: N. de Sereville  contact address: deserevi@ipno.in2p3.fr *
+ *                                                                           *
+ * Creation Date  : 21/07/09                                                 *
+ * Last update    : 16/10/09                                                 *
+ *---------------------------------------------------------------------------*
+ * Decription: Define the S1 detector from Micron                            *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *  + 11/10/09: Change scorer philosophy, one scorer for the detector number *
+ *              added (N. de Sereville)                                      *
+ *                                                                           *
+ *****************************************************************************/
+
+// C++ headers
+#include <sstream>
+#include <string>
+#include <cmath>
+
+// Geant4 
+#include "G4Box.hh"
+#include "G4Tubs.hh"
+#include "G4Material.hh"
+#include "G4VisAttributes.hh"
+#include "G4Colour.hh"
+#include "G4RotationMatrix.hh"
+#include "G4Transform3D.hh"
+#include "G4PVPlacement.hh"
+#include "G4PVDivision.hh"
+#include "G4ExtrudedSolid.hh"
+#include "G4SubtractionSolid.hh"
+#include "G4SDManager.hh"
+#include "G4MultiFunctionalDetector.hh"
+
+// NPTool headers
+#include "Spice.hh"
+#include "MaterialManager.hh"
+#include "NPSDetectorFactory.hh"
+#include "SiliconScorers.hh"
+#include "RootOutput.h"
+
+// CLHEP
+#include "CLHEP/Random/RandGauss.h"
+
+using namespace std;
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+Spice::Spice(){
+  m_LogicalDetector=0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+Spice::~Spice(){
+
+}
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+G4LogicalVolume* Spice::ConstructVolume(){
+  if(!m_LogicalDetector){
+    //do something
+  }
+  return m_LogicalDetector;
+
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+// Virtual Method of NPS::VDetector class
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+// Read stream at Configfile to pick-up parameters of detector (Position,...)
+// Called in DetecorConstruction::ReadDetextorConfiguration Method
+void Spice::ReadConfiguration(string Path){
+  Path ="";
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+// Construct detector and inialise sensitive part.
+// Called After DetecorConstruction::AddDetector Method
+void Spice::ConstructDetector(G4LogicalVolume* world){
+  world = 0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+// Connect the GaspardTrackingData class to the output TTree
+// of the simulation
+void Spice::InitializeRootOutput(){
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+// Read sensitive part and fill the Root tree.
+// Called at in the EventAction::EndOfEventAvtion
+void Spice::ReadSensitive(const G4Event* event){
+  event = 0;
+}
+
+//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
+// Initilize the Scorer use to read out the sensitive volume 
+void Spice::InitializeScorers(){
+  m_Scorer = 0;
+}
+////////////////////////////////////////////////////////////////////////////////
+//            Construct Method to be pass to the DetectorFactory              //
+////////////////////////////////////////////////////////////////////////////////
+NPS::VDetector* Spice::Construct(){
+  return (NPS::VDetector*) new Spice();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//            Registering the construct method to the factory                 //
+////////////////////////////////////////////////////////////////////////////////
+extern "C"{
+class proxy{
+  public:
+    proxy(){
+      NPS::DetectorFactory::getInstance()->AddToken("Spice","Spice");
+      NPS::DetectorFactory::getInstance()->AddDetector("Spice",Spice::Construct);
+    }
+};
+
+proxy p;
+}
+
+
diff --git a/NPSimulation/Spice/Spice.hh b/NPSimulation/Spice/Spice.hh
new file mode 100644
index 000000000..eca13dee9
--- /dev/null
+++ b/NPSimulation/Spice/Spice.hh
@@ -0,0 +1,99 @@
+#ifndef Spice_h
+#define Spice_h 1
+/*****************************************************************************
+ * Copyright (C) 2009-2013   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: A. Matta  contact address: a.matta@surrey.ac.uk          *
+ *                                                                           *
+ * Creation Date  : 19/07/2015                                               *
+ * Last update    :                                                          *
+ *---------------------------------------------------------------------------*
+ * Decription: Define the Spice electron spectrometer                        *
+ *                                                                           *
+ *---------------------------------------------------------------------------*
+ * Comment:                                                                  *
+ *   Use GMDL geometry from Triumf (M. Moukhaddam)                           *
+ *                                                                           *
+ *                                                                           *
+ *****************************************************************************/
+
+// C++ headers
+#include <vector>
+using namespace std;
+using namespace CLHEP;
+
+// NPTool header
+#include "NPSVDetector.hh"
+
+// Geant4
+#include "G4MultiFunctionalDetector.hh"
+#include "G4LogicalVolume.hh"
+#include "G4GDMLParser.hh"
+
+class Spice : public NPS::VDetector{
+  ////////////////////////////////////////////////////
+  /////// Default Constructor and Destructor /////////
+  ////////////////////////////////////////////////////
+  public:
+    Spice();
+    virtual ~Spice();
+
+    ////////////////////////////////////////////////////
+    //////// Specific Function of this Class ///////////
+    ////////////////////////////////////////////////////
+  public:
+    // Produce the logical volume of the detector
+    G4LogicalVolume* ConstructVolume();
+
+  private:
+    G4LogicalVolume* m_LogicalDetector;
+    G4GDMLParser m_gdmlparser;
+    ////////////////////////////////////////////////////
+    ////  Inherite from GaspardTrackerModule class /////
+    ////////////////////////////////////////////////////
+  public:
+    // Read stream at Configfile to pick-up parameters of detector (Position,...)
+    // Called in DetecorConstruction::ReadDetextorConfiguration Method
+    void ReadConfiguration(string Path);
+
+    // 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();
+
+    // Initialize all scorers necessary for the detector
+    void InitializeScorers();
+
+    // Read sensitive part and fill the Root tree.
+    // Called at in the EventAction::EndOfEventAvtion
+    void ReadSensitive(const G4Event* event);
+
+
+    ////////////////////////////////////////////////////
+    ///////////Event class to store Data////////////////
+    ////////////////////////////////////////////////////
+  private:
+
+  private:
+    // Scorer
+    G4MultiFunctionalDetector* m_Scorer;
+
+
+    ////////////////////////////////////////////////////
+    ///////////////Private intern Data//////////////////
+    ////////////////////////////////////////////////////
+  private:
+
+  public:
+    static NPS::VDetector* Construct();
+};
+
+#endif
-- 
GitLab