Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/extended/optical/wls/src/WLSDetectorConstruction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/extended/optical/wls/src/WLSDetectorConstruction.cc (Version 11.3.0) and /examples/extended/optical/wls/src/WLSDetectorConstruction.cc (Version 10.3)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
                                                   >>  26 // $Id: WLSDetectorConstruction.cc 101671 2016-11-21 09:18:37Z gcosmo $
 26 //                                                 27 //
 27 /// \file optical/wls/src/WLSDetectorConstruct     28 /// \file optical/wls/src/WLSDetectorConstruction.cc
 28 /// \brief Implementation of the WLSDetectorCo     29 /// \brief Implementation of the WLSDetectorConstruction class
 29 //                                                 30 //
 30 //                                                 31 //
 31                                                <<  32 #include "G4ios.hh"
 32 #include "WLSDetectorConstruction.hh"          <<  33 #include "globals.hh"
 33                                                << 
 34 #include "WLSDetectorMessenger.hh"             << 
 35 #include "WLSMaterials.hh"                     << 
 36 #include "WLSPhotonDetSD.hh"                   << 
 37                                                    34 
 38 #include "G4Box.hh"                                35 #include "G4Box.hh"
 39 #include "G4Colour.hh"                         <<  36 #include "G4Tubs.hh"
 40 #include "G4EllipticalTube.hh"                     37 #include "G4EllipticalTube.hh"
 41 #include "G4GeometryManager.hh"                <<  38 
 42 #include "G4LogicalBorderSurface.hh"           << 
 43 #include "G4LogicalSkinSurface.hh"             << 
 44 #include "G4LogicalVolume.hh"                      39 #include "G4LogicalVolume.hh"
 45 #include "G4LogicalVolumeStore.hh"             <<  40 #include "G4PVPlacement.hh"
                                                   >>  41 
                                                   >>  42 #include "G4OpBoundaryProcess.hh"
                                                   >>  43 #include "G4LogicalSkinSurface.hh"
                                                   >>  44 #include "G4LogicalBorderSurface.hh"
                                                   >>  45 
 46 #include "G4Material.hh"                           46 #include "G4Material.hh"
 47 #include "G4NistManager.hh"                        47 #include "G4NistManager.hh"
 48 #include "G4OpticalSurface.hh"                 <<  48 
 49 #include "G4PVPlacement.hh"                    <<  49 #include "G4GeometryManager.hh"
 50 #include "G4PhysicalConstants.hh"              <<  50 #include "G4SolidStore.hh"
                                                   >>  51 #include "G4LogicalVolumeStore.hh"
 51 #include "G4PhysicalVolumeStore.hh"                52 #include "G4PhysicalVolumeStore.hh"
                                                   >>  53 
 52 #include "G4RunManager.hh"                         54 #include "G4RunManager.hh"
                                                   >>  55 
 53 #include "G4SDManager.hh"                          56 #include "G4SDManager.hh"
 54 #include "G4SolidStore.hh"                     <<  57 #include "WLSDetectorConstruction.hh"
 55 #include "G4SystemOfUnits.hh"                  <<  58 #include "WLSDetectorMessenger.hh"
 56 #include "G4Tubs.hh"                           <<  59 #include "WLSMaterials.hh"
                                                   >>  60 #include "WLSPhotonDetSD.hh"
                                                   >>  61 
 57 #include "G4UserLimits.hh"                         62 #include "G4UserLimits.hh"
 58 #include "G4VisAttributes.hh"                  <<  63 #include "G4PhysicalConstants.hh"
 59 #include "G4ios.hh"                            <<  64 #include "G4SystemOfUnits.hh"
 60 #include "globals.hh"                          << 
 61                                                    65 
 62 //....oooOO0OOooo........oooOO0OOooo........oo     66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 63                                                    67 
 64 WLSDetectorConstruction::WLSDetectorConstructi <<  68 WLSDetectorConstruction::WLSDetectorConstruction()
                                                   >>  69   : fMaterials(NULL), fLogicHole(NULL), fLogicWorld(NULL),
                                                   >>  70     fPhysiWorld(NULL), fPhysiHole(NULL)
 65 {                                                  71 {
 66   fDetectorMessenger = new WLSDetectorMessenge     72   fDetectorMessenger = new WLSDetectorMessenger(this);
 67                                                    73 
                                                   >>  74   fNumOfCladLayers = 0;
                                                   >>  75  
                                                   >>  76   fSurfaceRoughness = 1;
                                                   >>  77  
                                                   >>  78   fMirrorToggle = true;
                                                   >>  79   fMirrorPolish = 1.;
                                                   >>  80   fMirrorReflectivity = 1.;
                                                   >>  81 
                                                   >>  82   fMPPCPolish = 1.;
                                                   >>  83   fMPPCReflectivity = 0.;
                                                   >>  84 
                                                   >>  85   fExtrusionPolish = 1.;
                                                   >>  86   fExtrusionReflectivity = 1.;
                                                   >>  87  
                                                   >>  88   fXYRatio = 1.0;
                                                   >>  89 
                                                   >>  90   fWLSfiberZ     = 1.*m;
                                                   >>  91   fWLSfiberRY  = 0.5*mm;
                                                   >>  92   fWLSfiberOrigin = 0.0;
                                                   >>  93  
                                                   >>  94   fMPPCShape = "Circle";
 68   fMPPCHalfL = fWLSfiberRY;                        95   fMPPCHalfL = fWLSfiberRY;
 69   fClrfiberZ = fMPPCZ + 10. * nm;              <<  96   fMPPCDist  = 0.00*mm;
 70   fHoleLength = fBarLength;                    <<  97   fMPPCTheta = 0.0*deg;
                                                   >>  98   fMPPCZ     = 0.05*mm;
                                                   >>  99  
                                                   >> 100   fClrfiberZ  = fMPPCZ + 10.*nm;
                                                   >> 101   fMirrorZ    = 0.1*mm;
                                                   >> 102 
                                                   >> 103   fBarLength        = 1.*m;
                                                   >> 104   fBarBase          = 9.6*mm;
                                                   >> 105   fHoleRadius       = 0.9*mm;
                                                   >> 106   fHoleLength       = fBarLength;
                                                   >> 107   fCoatingThickness = 0.25*mm;
                                                   >> 108   fCoatingRadius    = 1.875*mm;
 71 }                                                 109 }
 72                                                   110 
 73 //....oooOO0OOooo........oooOO0OOooo........oo    111 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 74                                                   112 
 75 WLSDetectorConstruction::~WLSDetectorConstruct    113 WLSDetectorConstruction::~WLSDetectorConstruction()
 76 {                                                 114 {
 77   delete fDetectorMessenger;                   << 115   if (fDetectorMessenger) delete fDetectorMessenger;
 78   delete fMaterials;                           << 116   if (fMaterials)         delete fMaterials;
 79   for (auto visAttributes : fVisAttributes) {  << 
 80     delete visAttributes;                      << 
 81   }                                            << 
 82 }                                                 117 }
 83                                                   118 
 84 //....oooOO0OOooo........oooOO0OOooo........oo    119 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 85                                                   120 
 86 G4VPhysicalVolume* WLSDetectorConstruction::Co    121 G4VPhysicalVolume* WLSDetectorConstruction::Construct()
 87 {                                                 122 {
 88   if (fPhysiWorld) {                              123   if (fPhysiWorld) {
 89     G4GeometryManager::GetInstance()->OpenGeom << 124      G4GeometryManager::GetInstance()->OpenGeometry();
 90     G4PhysicalVolumeStore::GetInstance()->Clea << 125      G4PhysicalVolumeStore::GetInstance()->Clean();
 91     G4LogicalVolumeStore::GetInstance()->Clean << 126      G4LogicalVolumeStore::GetInstance()->Clean();
 92     G4SolidStore::GetInstance()->Clean();      << 127      G4SolidStore::GetInstance()->Clean();
 93     G4LogicalSkinSurface::CleanSurfaceTable(); << 128      G4LogicalSkinSurface::CleanSurfaceTable();
 94     G4LogicalBorderSurface::CleanSurfaceTable( << 129      G4LogicalBorderSurface::CleanSurfaceTable();
 95   }                                               130   }
 96                                                   131 
 97   fMaterials = WLSMaterials::GetInstance();       132   fMaterials = WLSMaterials::GetInstance();
                                                   >> 133 
 98   UpdateGeometryParameters();                     134   UpdateGeometryParameters();
 99                                                   135 
100   return ConstructDetector();                     136   return ConstructDetector();
101 }                                                 137 }
102                                                   138 
103 //....oooOO0OOooo........oooOO0OOooo........oo    139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104                                                   140 
105 G4VPhysicalVolume* WLSDetectorConstruction::Co    141 G4VPhysicalVolume* WLSDetectorConstruction::ConstructDetector()
106 {                                                 142 {
107   auto air = FindMaterial("G4_AIR");           << 
108   // G4cout << "\nMaterial Properties Table fo << 
109   // air->GetMaterialPropertiesTable()->DumpTa << 
110                                                << 
111   //------------------------------------------    143   //--------------------------------------------------
112   // World                                        144   // World
113   //------------------------------------------    145   //--------------------------------------------------
114                                                   146 
115   G4VSolid* solidWorld = new G4Box("World", fW << 147   G4VSolid* solidWorld =
                                                   >> 148                     new G4Box("World", fWorldSizeX, fWorldSizeY, fWorldSizeZ);
116                                                   149 
117   fLogicWorld = new G4LogicalVolume(solidWorld << 150   fLogicWorld = new G4LogicalVolume(solidWorld,
118                                                << 151                                    FindMaterial("G4_AIR"),
119   fPhysiWorld =                                << 152                                    "World");
120     new G4PVPlacement(nullptr, G4ThreeVector() << 153 
                                                   >> 154   fPhysiWorld = new G4PVPlacement(0,
                                                   >> 155                                   G4ThreeVector(),
                                                   >> 156                                   fLogicWorld,
                                                   >> 157                                   "World",
                                                   >> 158                                   0,
                                                   >> 159                                   false,
                                                   >> 160                                   0);
121                                                   161 
122   //------------------------------------------    162   //--------------------------------------------------
123   // Extrusion                                    163   // Extrusion
124   //------------------------------------------    164   //--------------------------------------------------
125                                                   165 
126   auto coating = FindMaterial("Coating");      << 
127                                                << 
128   G4VSolid* solidExtrusion =                      166   G4VSolid* solidExtrusion =
129     new G4Box("Extrusion", GetBarBase() / 2.,  << 167         new G4Box("Extrusion",GetBarBase()/2,GetBarBase()/2,GetBarLength()/2);
130                                                << 
131   auto logicExtrusion = new G4LogicalVolume(so << 
132                                                << 
133   auto TiO2Surface =                           << 
134     new G4OpticalSurface("TiO2Surface", glisur << 
135                                                << 
136   auto TiO2SurfaceProperty = new G4MaterialPro << 
137                                                << 
138   std::vector<G4double> p_TiO2 = {2.00 * eV, 3 << 
139                                                   168 
140   std::vector<G4double> refl_TiO2 = {fExtrusio << 169   G4LogicalVolume* logicExtrusion =
141   std::vector<G4double> effi_TiO2 = {0., 0.};  << 170                       new G4LogicalVolume(solidExtrusion,
                                                   >> 171                                           FindMaterial("Coating"),
                                                   >> 172                                           "Extrusion");
                                                   >> 173 
                                                   >> 174   G4OpticalSurface* TiO2Surface = new G4OpticalSurface("TiO2Surface",
                                                   >> 175                                                        glisur,
                                                   >> 176                                                        ground,
                                                   >> 177                                                        dielectric_metal,
                                                   >> 178                                                        fExtrusionPolish);
                                                   >> 179 
                                                   >> 180   G4MaterialPropertiesTable* TiO2SurfaceProperty =
                                                   >> 181                                              new G4MaterialPropertiesTable();
                                                   >> 182 
                                                   >> 183   G4double p_TiO2[] = {2.00*eV, 3.47*eV};
                                                   >> 184   const G4int nbins = sizeof(p_TiO2)/sizeof(G4double);
                                                   >> 185 
                                                   >> 186   G4double refl_TiO2[] = {fExtrusionReflectivity,fExtrusionReflectivity};
                                                   >> 187   assert(sizeof(refl_TiO2) == sizeof(p_TiO2));
                                                   >> 188   G4double effi_TiO2[] = {0, 0};
                                                   >> 189   assert(sizeof(effi_TiO2) == sizeof(p_TiO2));
                                                   >> 190 
                                                   >> 191   TiO2SurfaceProperty -> AddProperty("REFLECTIVITY",p_TiO2,refl_TiO2,nbins);
                                                   >> 192   TiO2SurfaceProperty -> AddProperty("EFFICIENCY",p_TiO2,effi_TiO2,nbins);
                                                   >> 193 
                                                   >> 194   TiO2Surface -> SetMaterialPropertiesTable(TiO2SurfaceProperty);
                                                   >> 195 
                                                   >> 196   new G4PVPlacement(0,
                                                   >> 197                     G4ThreeVector(),
                                                   >> 198                     logicExtrusion,
                                                   >> 199                     "Extrusion",
                                                   >> 200                     fLogicWorld,
                                                   >> 201                     false,
                                                   >> 202                     0);
142                                                   203 
143   TiO2SurfaceProperty->AddProperty("REFLECTIVI << 204   new G4LogicalSkinSurface("TiO2Surface",logicExtrusion,TiO2Surface);
144   TiO2SurfaceProperty->AddProperty("EFFICIENCY << 
145                                                << 
146   TiO2Surface->SetMaterialPropertiesTable(TiO2 << 
147                                                << 
148   new G4PVPlacement(nullptr, G4ThreeVector(),  << 
149                                                << 
150   new G4LogicalSkinSurface("TiO2Surface", logi << 
151                                                   205 
152   //------------------------------------------    206   //--------------------------------------------------
153   // Scintillator                                 207   // Scintillator
154   //------------------------------------------    208   //--------------------------------------------------
155                                                   209 
156   auto polystyrene = FindMaterial("Polystyrene << 210   G4VSolid* solidScintillator = new G4Box("Scintillator",
157   // G4cout << "\nMaterial Properties Table fo << 211                                 GetBarBase()/2-GetCoatingThickness()
158   // polystyrene->GetMaterialPropertiesTable() << 212                                            -GetCoatingRadius(),
159                                                << 213                                 GetBarBase()/2-GetCoatingThickness()
160   G4VSolid* solidScintillator =                << 214                                            -GetCoatingRadius(),
161     new G4Box("Scintillator", GetBarBase() / 2 << 215                                 GetBarLength()/2);
162               GetBarBase() / 2. - GetCoatingTh << 216 
163                                                << 217   G4LogicalVolume* logicScintillator =
164   auto logicScintillator = new G4LogicalVolume << 218                              new G4LogicalVolume(solidScintillator,
165                                                << 219                                                  FindMaterial("Polystyrene"),
166   new G4PVPlacement(nullptr, G4ThreeVector(),  << 220                                                  "Scintillator");
167                     false, 0);                 << 221 
168                                                << 222   new G4PVPlacement(0,
169   G4LogicalVolume* logicScintSide = nullptr;   << 223                     G4ThreeVector(),
170   G4LogicalVolume* logicScintCrnr = nullptr;   << 224                     logicScintillator,
171   if (GetCoatingRadius() > 0.) {               << 225                     "Scintillator",
172     G4VSolid* solidScintside =                 << 226                     logicExtrusion,
173       new G4Box("SideOfBar", GetBarBase() / 2. << 227                     false,
174                 GetCoatingRadius() / 2., GetBa << 228                     0);
175                                                << 229 
176     G4VSolid* solidScintcrnr = new G4Tubs("Crn << 230   if (GetCoatingRadius() > 0.*mm) {
177                                           GetB << 231      G4VSolid* solidScintside = new G4Box("SideOfBar",
178                                                << 232                                 GetBarBase()/2-GetCoatingThickness()
179     logicScintSide = new G4LogicalVolume(solid << 233                                            -GetCoatingRadius(),
180                                                << 234                                 GetCoatingRadius()/2,
181     logicScintCrnr = new G4LogicalVolume(solid << 235                                 GetBarLength()/2);
182                                                << 236      G4VSolid* solidScintcrnr = new G4Tubs("CrnrOfBar",
183     G4double pos = GetBarBase() / 2. - GetCoat << 237                                  0.0*cm,
184                                                << 238                                  GetCoatingRadius(),
185     new G4PVPlacement(nullptr, G4ThreeVector(0 << 239                                  GetBarLength()/2,
186                       logicExtrusion, false, 0 << 240                                  0.*deg,
187                                                << 241                                  90.*deg);
188     new G4PVPlacement(nullptr, G4ThreeVector(0 << 242      G4LogicalVolume* logicScintSide =
189                       logicExtrusion, false, 1 << 243                              new G4LogicalVolume(solidScintside,
190                                                << 244                                                  FindMaterial("Polystyrene"),
191     auto rot1 = new G4RotationMatrix();        << 245                                                  "SideOfBar");
192     rot1->rotateZ(-90. * deg);                 << 246 
193                                                << 247      G4LogicalVolume* logicScintCrnr =
194     new G4PVPlacement(rot1, G4ThreeVector(pos, << 248                              new G4LogicalVolume(solidScintcrnr,
195                       false, 2);               << 249                                                  FindMaterial("Polystyrene"),
                                                   >> 250                                                  "CrnrOfBar");
                                                   >> 251 
                                                   >> 252      G4double x = GetBarBase()/2-GetCoatingThickness()-GetCoatingRadius()/2;
                                                   >> 253      G4double y = GetBarBase()/2-GetCoatingThickness()-GetCoatingRadius()/2;
                                                   >> 254 
                                                   >> 255      new G4PVPlacement(0,
                                                   >> 256                        G4ThreeVector(0,-y,0),
                                                   >> 257                        logicScintSide,
                                                   >> 258                        "SideOfBar",
                                                   >> 259                        logicExtrusion,
                                                   >> 260                        false,
                                                   >> 261                        0);
                                                   >> 262      new G4PVPlacement(0,
                                                   >> 263                        G4ThreeVector(0, y,0),
                                                   >> 264                        logicScintSide,
                                                   >> 265                        "SideOfBar",
                                                   >> 266                        logicExtrusion,
                                                   >> 267                        false,
                                                   >> 268                        1);
                                                   >> 269 
                                                   >> 270      G4RotationMatrix* g4rot = new G4RotationMatrix();
                                                   >> 271      *g4rot = StringToRotationMatrix("Z90");
                                                   >> 272      *g4rot = g4rot->inverse();
                                                   >> 273      if (*g4rot == G4RotationMatrix()) g4rot = NULL;
                                                   >> 274 
                                                   >> 275      new G4PVPlacement(g4rot,
                                                   >> 276                        G4ThreeVector(x,0,0),
                                                   >> 277                        logicScintSide,
                                                   >> 278                        "SideOfBar",
                                                   >> 279                        logicExtrusion,
                                                   >> 280                        false,
                                                   >> 281                        2);
                                                   >> 282      new G4PVPlacement(g4rot,
                                                   >> 283                        G4ThreeVector(-x,0,0),
                                                   >> 284                        logicScintSide,
                                                   >> 285                        "SideOfBar",
                                                   >> 286                        logicExtrusion,
                                                   >> 287                        false,
                                                   >> 288                        3);
                                                   >> 289 
                                                   >> 290      x = GetBarBase()/2-GetCoatingThickness()-GetCoatingRadius();
                                                   >> 291      y = GetBarBase()/2-GetCoatingThickness()-GetCoatingRadius();
                                                   >> 292 
                                                   >> 293      new G4PVPlacement(0,
                                                   >> 294                        G4ThreeVector(x,y,0),
                                                   >> 295                        logicScintCrnr,
                                                   >> 296                        "CrnrOfBar",
                                                   >> 297                        logicExtrusion,
                                                   >> 298                        false,
                                                   >> 299                        0);
                                                   >> 300 
                                                   >> 301      new G4PVPlacement(g4rot,
                                                   >> 302                        G4ThreeVector(-x,y,0),
                                                   >> 303                        logicScintCrnr,
                                                   >> 304                        "CrnrOfBar",
                                                   >> 305                        logicExtrusion,
                                                   >> 306                        false,
                                                   >> 307                        1);
                                                   >> 308 
                                                   >> 309      g4rot = new G4RotationMatrix();
                                                   >> 310      *g4rot = StringToRotationMatrix("Z180");
                                                   >> 311      *g4rot = g4rot->inverse();
                                                   >> 312      if (*g4rot == G4RotationMatrix()) g4rot = NULL;
                                                   >> 313 
                                                   >> 314      new G4PVPlacement(g4rot,
                                                   >> 315                        G4ThreeVector(-x,-y,0),
                                                   >> 316                        logicScintCrnr,
                                                   >> 317                        "CrnrOfBar",
                                                   >> 318                        logicExtrusion,
                                                   >> 319                        false,
                                                   >> 320                        2);
                                                   >> 321 
                                                   >> 322      g4rot = new G4RotationMatrix();
                                                   >> 323      *g4rot = StringToRotationMatrix("Z270");
                                                   >> 324      *g4rot = g4rot->inverse();
                                                   >> 325      if (*g4rot == G4RotationMatrix()) g4rot = NULL;
                                                   >> 326 
                                                   >> 327      new G4PVPlacement(g4rot,
                                                   >> 328                        G4ThreeVector(x,-y,0),
                                                   >> 329                        logicScintCrnr,
                                                   >> 330                        "CrnrOfBar",
                                                   >> 331                        logicExtrusion,
                                                   >> 332                        false,
                                                   >> 333                        3);
196                                                   334 
197     new G4PVPlacement(rot1, G4ThreeVector(-pos << 
198                       logicExtrusion, false, 3 << 
199                                                << 
200     pos = GetBarBase() / 2. - GetCoatingThickn << 
201                                                << 
202     new G4PVPlacement(nullptr, G4ThreeVector(p << 
203                       logicExtrusion, false, 0 << 
204                                                << 
205     new G4PVPlacement(rot1, G4ThreeVector(-pos << 
206                       logicExtrusion, false, 1 << 
207                                                << 
208     auto rot2 = new G4RotationMatrix();        << 
209     rot2->rotateZ(-180. * deg);                << 
210                                                << 
211     new G4PVPlacement(rot2, G4ThreeVector(-pos << 
212                       logicExtrusion, false, 2 << 
213                                                << 
214     auto rot3 = new G4RotationMatrix();        << 
215     rot3->rotateZ(-270. * deg);                << 
216                                                << 
217     new G4PVPlacement(rot3, G4ThreeVector(pos, << 
218                       logicExtrusion, false, 3 << 
219   }                                               335   }
220                                                   336 
221   if (GetFiberRadius() < GetHoleRadius()) {    << 337   if (GetFiberRadius()<GetHoleRadius()) {
222     G4VSolid* solidHole =                      << 
223       new G4Tubs("Hole", 0., GetHoleRadius(),  << 
224                                                << 
225     fLogicHole = new G4LogicalVolume(solidHole << 
226                                                   338 
227     fPhysiHole =                               << 339         G4VSolid* solidHole = new G4Tubs("Hole",
228       new G4PVPlacement(nullptr, G4ThreeVector << 340                                          0.0*cm,
                                                   >> 341                                          GetHoleRadius(),
                                                   >> 342                                          GetHoleLength()/2,
                                                   >> 343                                          0.*deg,
                                                   >> 344                                          360.*deg);
                                                   >> 345         fLogicHole = new G4LogicalVolume(solidHole,
                                                   >> 346                                          FindMaterial("G4_AIR"),
                                                   >> 347                                          "Hole");
                                                   >> 348 
                                                   >> 349         fPhysiHole = new G4PVPlacement(0,
                                                   >> 350                                        G4ThreeVector(),
                                                   >> 351                                        fLogicHole,
                                                   >> 352                                        "Hole",
                                                   >> 353                                        logicScintillator,
                                                   >> 354                                        false,
                                                   >> 355                                        0);
229   }                                               356   }
230                                                   357 
231   //------------------------------------------    358   //--------------------------------------------------
232   // Fiber                                        359   // Fiber
233   //------------------------------------------    360   //--------------------------------------------------
234                                                   361 
235   if (!(fLogicHole) || !(fPhysiHole)) {        << 362   ConstructFiber();
236     G4ExceptionDescription ed;                 << 363 
237     ed << "The Fiber Hole has not been constru << 364   //--------------------------------------------------
238     G4Exception("WLSDetectorConstruction", "wl << 365   // End of Construction
                                                   >> 366   //--------------------------------------------------
                                                   >> 367 
                                                   >> 368   return fPhysiWorld;
                                                   >> 369 }
                                                   >> 370 
                                                   >> 371 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 372 
                                                   >> 373 void WLSDetectorConstruction::ConstructFiber()
                                                   >> 374 {
                                                   >> 375   if (!(fLogicHole) || !(fPhysiHole) ) {
                                                   >> 376      std::ostringstream o;
                                                   >> 377      o << "The Fiber Hole has not been constructed";
                                                   >> 378      G4Exception("WLSDetectorConstruction::ConstructFiber","",
                                                   >> 379                   FatalException,o.str().c_str());
239   }                                               380   }
240                                                   381 
241   // Pointers to the most recently constructed    382   // Pointers to the most recently constructed volume
242   G4LogicalVolume* logicPlacement = fLogicHole    383   G4LogicalVolume* logicPlacement = fLogicHole;
243   G4VPhysicalVolume* physiPlacement = fPhysiHo    384   G4VPhysicalVolume* physiPlacement = fPhysiHole;
244                                                   385 
245   //------------------------------------------    386   //--------------------------------------------------
246   // Fiber Construction                           387   // Fiber Construction
247   //------------------------------------------ << 388   //-------------------------------------------------- 
248                                                   389 
249   // Boundary Surface Properties                  390   // Boundary Surface Properties
250   G4OpticalSurface* opSurface = nullptr;       << 391   G4OpticalSurface* opSurface = NULL;
251                                                << 392  
252   if (fSurfaceRoughness < 1.)                     393   if (fSurfaceRoughness < 1.)
253     opSurface = new G4OpticalSurface("RoughSur << 394      opSurface = new G4OpticalSurface("RoughSurface",          // Surface Name
254                                      fSurfaceR << 395                                       glisur,                  // SetModel
                                                   >> 396                                       ground,                  // SetFinish
                                                   >> 397                                       dielectric_dielectric,   // SetType
                                                   >> 398                                       fSurfaceRoughness);      // SetPolish
255                                                   399 
256   G4LogicalVolume* logicWLSfiber = nullptr;    << 400   G4LogicalVolume   *logicClad1, *logicClad2;
257   G4LogicalVolume* logicClad1 = nullptr;       << 401   G4VPhysicalVolume *physiClad1, *physiClad2;
258   G4LogicalVolume* logicClad2 = nullptr;       << 
259   G4VPhysicalVolume* physiClad1 = nullptr;     << 
260   G4VPhysicalVolume* physiClad2 = nullptr;     << 
261                                                << 
262   auto fpethylene = FindMaterial("FPethylene") << 
263   auto pethylene = FindMaterial("Pethylene");  << 
264   auto pmma = FindMaterial("PMMA");            << 
265                                                   402 
266   // Determine the number of cladding layers t    403   // Determine the number of cladding layers to be built
267   switch (fNumOfCladLayers) {                  << 404   switch ( fNumOfCladLayers ) {
                                                   >> 405  
268     case 2:                                       406     case 2:
269                                                   407 
270       //-------------------------------------- << 408      //--------------------------------------------------
271       // Cladding 2                            << 409      // Cladding 2
272       //-------------------------------------- << 410      //--------------------------------------------------
273                                                << 411 
274       // G4cout << "\nMaterial Properties Tabl << 412      G4VSolid* solidClad2;
275       // fpethylene->GetMaterialPropertiesTabl << 413  
276                                                << 414      if (fXYRatio == 1.)
277       G4VSolid* solidClad2;                    << 415        solidClad2 = new G4Tubs("Clad2",0.,fClad2RX,fClad2Z,0.0*rad,twopi*rad);
278                                                << 416      else
279       if (fXYRatio == 1.)                      << 417        solidClad2 = new G4EllipticalTube("Clad2",fClad2RX,fClad2RY,fClad2Z);
280         solidClad2 = new G4Tubs("Clad2", 0., f << 418 
281       else                                     << 419      logicClad2  = new G4LogicalVolume(solidClad2,
282         solidClad2 = new G4EllipticalTube("Cla << 420                                        FindMaterial("FPethylene"),
283                                                << 421                                        "Clad2");
284       logicClad2 = new G4LogicalVolume(solidCl << 422 
285                                                << 423      physiClad2 = new G4PVPlacement(0,
286       physiClad2 = new G4PVPlacement(nullptr,  << 424                                     G4ThreeVector(0.0,0.0,fWLSfiberOrigin),
287                                      "Clad2",  << 425                                     logicClad2,
288                                                << 426                                     "Clad2",
289       // Place the rough surface only if neede << 427                                     logicPlacement,
290       if (opSurface) {                         << 428                                     false,
291         new G4LogicalBorderSurface("surfaceCla << 429                                     0);
292         new G4LogicalBorderSurface("surfaceCla << 430 
293       }                                        << 431      // Place the rough surface only if needed
294                                                << 432      if (opSurface) {
295       logicPlacement = logicClad2;             << 433        new G4LogicalBorderSurface("surfaceClad2Out",
296       physiPlacement = physiClad2;             << 434                                   physiClad2,
297       [[fallthrough]];                         << 435                                   physiPlacement,
298                                                << 436                                   opSurface);
299     case 1:                                    << 437        new G4LogicalBorderSurface("surfaceClad2In",
300                                                << 438                                   physiPlacement,
301       //-------------------------------------- << 439                                   physiClad2,
302       // Cladding 1                            << 440                                   opSurface);
303       //-------------------------------------- << 441      }
304                                                << 
305       // G4cout << "\nMaterial Properties Tabl << 
306       // pethylene->GetMaterialPropertiesTable << 
307                                                << 
308       G4VSolid* solidClad1;                    << 
309                                                << 
310       if (fXYRatio == 1.)                      << 
311         solidClad1 = new G4Tubs("Clad1", 0., f << 
312       else                                     << 
313         solidClad1 = new G4EllipticalTube("Cla << 
314                                                << 
315       logicClad1 = new G4LogicalVolume(solidCl << 
316                                                   442 
317       physiClad1 = new G4PVPlacement(nullptr,  << 443      logicPlacement = logicClad2;
318                                      "Clad1",  << 444      physiPlacement = physiClad2;
319                                                   445 
320       // Place the rough surface only if neede << 446     case 1:
321       if (opSurface) {                         << 
322         new G4LogicalBorderSurface("surfaceCla << 
323                                                   447 
324         new G4LogicalBorderSurface("surfaceCla << 448      //--------------------------------------------------
325       }                                        << 449      // Cladding 1
                                                   >> 450      //--------------------------------------------------
                                                   >> 451 
                                                   >> 452      G4VSolid* solidClad1;
                                                   >> 453 
                                                   >> 454      if (fXYRatio == 1.)
                                                   >> 455        solidClad1 = new G4Tubs("Clad1",0.,fClad1RX,fClad1Z,0.0*rad,twopi*rad);
                                                   >> 456      else
                                                   >> 457        solidClad1 = new G4EllipticalTube("Clad1",fClad1RX,fClad1RY,fClad1Z);
                                                   >> 458 
                                                   >> 459      logicClad1 = new G4LogicalVolume(solidClad1,
                                                   >> 460                                       FindMaterial("Pethylene"),
                                                   >> 461                                       "Clad1");
                                                   >> 462 
                                                   >> 463      physiClad1 = new G4PVPlacement(0,
                                                   >> 464                                     G4ThreeVector(0.0,0.0,fWLSfiberOrigin),
                                                   >> 465                                     logicClad1,
                                                   >> 466                                     "Clad1",
                                                   >> 467                                     logicPlacement,
                                                   >> 468                                     false,
                                                   >> 469                                     0);
                                                   >> 470 
                                                   >> 471      // Place the rough surface only if needed
                                                   >> 472      if (opSurface) {
                                                   >> 473        new G4LogicalBorderSurface("surfaceClad1Out",
                                                   >> 474                                   physiClad1,
                                                   >> 475                                   physiPlacement,
                                                   >> 476                                   opSurface);
                                                   >> 477        new G4LogicalBorderSurface("surfaceClad1In",
                                                   >> 478                                   physiPlacement,
                                                   >> 479                                   physiClad1,
                                                   >> 480                                   opSurface);
                                                   >> 481      }
326                                                   482 
327       logicPlacement = logicClad1;             << 483      logicPlacement = logicClad1;
328       physiPlacement = physiClad1;             << 484      physiPlacement = physiClad1;
329       [[fallthrough]];                         << 
330                                                   485 
331     default:                                      486     default:
332                                                   487 
333       //-------------------------------------- << 488      //--------------------------------------------------
334       // WLS Fiber                             << 489      // WLS Fiber
335       //-------------------------------------- << 490      //--------------------------------------------------
336                                                << 491 
337       // G4cout << "\nMaterial Properties Tabl << 492      G4VSolid* solidWLSfiber;
338       // pmma->GetMaterialPropertiesTable()->D << 493 
339                                                << 494      if (fXYRatio == 1.)
340       G4VSolid* solidWLSfiber;                 << 495        solidWLSfiber =
341                                                << 496            new G4Tubs("WLSFiber",0.,fWLSfiberRX,fWLSfiberZ,0.0*rad,twopi*rad);
342       if (fXYRatio == 1.) {                    << 497      else
343         solidWLSfiber = new G4Tubs("WLSFiber", << 498        solidWLSfiber =
344       }                                        << 499            new G4EllipticalTube("WLSFiber",fWLSfiberRX,fWLSfiberRY,fWLSfiberZ);
345       else {                                   << 500 
346         solidWLSfiber = new G4EllipticalTube(" << 501      G4LogicalVolume*   logicWLSfiber =
347       }                                        << 502                                      new G4LogicalVolume(solidWLSfiber,
348                                                << 503                                                          FindMaterial("PMMA"),
349       logicWLSfiber = new G4LogicalVolume(soli << 504                                                          "WLSFiber");
350                                                << 505 
351       logicWLSfiber->SetUserLimits(new G4UserL << 506      logicWLSfiber->SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,10*ms));
352                                                << 507 
353       G4VPhysicalVolume* physiWLSfiber =       << 508      G4VPhysicalVolume* physiWLSfiber = new G4PVPlacement(0,
354         new G4PVPlacement(nullptr, G4ThreeVect << 509                                        G4ThreeVector(0.0,0.0,fWLSfiberOrigin),
355                           "WLSFiber", logicPla << 510                                        logicWLSfiber,
356                                                << 511                                        "WLSFiber",
357       // Place the rough surface only if neede << 512                                        logicPlacement,
358       if (opSurface) {                         << 513                                        false,
359         new G4LogicalBorderSurface("surfaceWLS << 514                                        0);
360                                                << 515 
361         new G4LogicalBorderSurface("surfaceWLS << 516      // Place the rough surface only if needed
362       }                                        << 517      if (opSurface) {
                                                   >> 518        new G4LogicalBorderSurface("surfaceWLSOut",
                                                   >> 519                                   physiWLSfiber,
                                                   >> 520                                   physiPlacement,
                                                   >> 521                                   opSurface);
                                                   >> 522        new G4LogicalBorderSurface("surfaceWLSIn",
                                                   >> 523                                   physiPlacement,
                                                   >> 524                                   physiWLSfiber,
                                                   >> 525                                   opSurface);
                                                   >> 526      }
363   }                                               527   }
364                                                   528 
365   //------------------------------------------    529   //--------------------------------------------------
366   // Mirror for reflection at one of the end      530   // Mirror for reflection at one of the end
367   //------------------------------------------    531   //--------------------------------------------------
368                                                   532 
369   // Place the mirror only if the user wants t    533   // Place the mirror only if the user wants the mirror
370   G4LogicalVolume* logicMirror = nullptr;      << 534   if (fMirrorToggle) {  
371                                                << 
372   auto aluminum = FindMaterial("G4_Al");       << 
373                                                << 
374   if (fMirrorToggle) {                         << 
375     G4VSolid* solidMirror = new G4Box("Mirror" << 
376                                                << 
377     logicMirror = new G4LogicalVolume(solidMir << 
378                                                << 
379     auto mirrorSurface =                       << 
380       new G4OpticalSurface("MirrorSurface", gl << 
381                                                << 
382     auto mirrorSurfaceProperty = new G4Materia << 
383                                                << 
384     std::vector<G4double> p_mirror = {2.00 * e << 
385     std::vector<G4double> refl_mirror = {fMirr << 
386     std::vector<G4double> effi_mirror = {0., 0 << 
387                                                   535 
388     mirrorSurfaceProperty->AddProperty("REFLEC << 536      G4VSolid* solidMirror = new G4Box("Mirror",
389     mirrorSurfaceProperty->AddProperty("EFFICI << 537                                        fMirrorRmax,
                                                   >> 538                                        fMirrorRmax,
                                                   >> 539                                        fMirrorZ);
                                                   >> 540  
                                                   >> 541      G4LogicalVolume* logicMirror = new G4LogicalVolume(solidMirror,
                                                   >> 542                                                         FindMaterial("G4_Al"),
                                                   >> 543                                                         "Mirror");
                                                   >> 544 
                                                   >> 545      G4OpticalSurface* mirrorSurface = new G4OpticalSurface("MirrorSurface",
                                                   >> 546                                                              glisur,
                                                   >> 547                                                              ground,
                                                   >> 548                                                              dielectric_metal,
                                                   >> 549                                                              fMirrorPolish);
                                                   >> 550 
                                                   >> 551      G4MaterialPropertiesTable* mirrorSurfaceProperty =
                                                   >> 552                                               new G4MaterialPropertiesTable();
                                                   >> 553 
                                                   >> 554      G4double p_mirror[] = {2.00*eV, 3.47*eV};
                                                   >> 555      const G4int nbins = sizeof(p_mirror)/sizeof(G4double);
                                                   >> 556      G4double refl_mirror[] = {fMirrorReflectivity,fMirrorReflectivity};
                                                   >> 557      assert(sizeof(refl_mirror) == sizeof(p_mirror));
                                                   >> 558      G4double effi_mirror[] = {0, 0};
                                                   >> 559      assert(sizeof(effi_mirror) == sizeof(effi_mirror));
                                                   >> 560 
                                                   >> 561      mirrorSurfaceProperty->
                                                   >> 562                        AddProperty("REFLECTIVITY",p_mirror,refl_mirror,nbins);
                                                   >> 563      mirrorSurfaceProperty->
                                                   >> 564                        AddProperty("EFFICIENCY",p_mirror,effi_mirror,nbins);
                                                   >> 565 
                                                   >> 566      mirrorSurface -> SetMaterialPropertiesTable(mirrorSurfaceProperty);
                                                   >> 567 
                                                   >> 568      new G4PVPlacement(0,
                                                   >> 569                        G4ThreeVector(0.0,0.0,fMirrorOrigin),
                                                   >> 570                        logicMirror,
                                                   >> 571                        "Mirror",
                                                   >> 572                        fLogicWorld,
                                                   >> 573                        false,
                                                   >> 574                        0);
390                                                   575 
391     mirrorSurface->SetMaterialPropertiesTable( << 576      new G4LogicalSkinSurface("MirrorSurface",logicMirror,mirrorSurface);
392                                                << 
393     new G4PVPlacement(nullptr, G4ThreeVector(0 << 
394                       fLogicWorld, false, 0);  << 
395                                                << 
396     new G4LogicalSkinSurface("MirrorSurface",  << 
397   }                                               577   }
398                                                   578 
399   //------------------------------------------    579   //--------------------------------------------------
400   // Coupling at the read-out end                 580   // Coupling at the read-out end
401   //------------------------------------------    581   //--------------------------------------------------
402                                                   582 
403   // Clear Fiber (Coupling Layer)                 583   // Clear Fiber (Coupling Layer)
404   G4VSolid* solidCouple = new G4Box("Couple",  << 584   G4VSolid* solidCouple = new G4Box("Couple",fCoupleRX,fCoupleRY,fCoupleZ);
405                                                << 
406   auto logicCouple = new G4LogicalVolume(solid << 
407                                                   585 
408   new G4PVPlacement(nullptr, G4ThreeVector(0., << 586   G4LogicalVolume*   logicCouple = new G4LogicalVolume(solidCouple,
409                     fLogicWorld, false, 0);    << 587                                                        FindMaterial("G4_AIR"),
                                                   >> 588                                                        "Couple");
                                                   >> 589 
                                                   >> 590   new G4PVPlacement(0,
                                                   >> 591                     G4ThreeVector(0.0,0.0,fCoupleOrigin),
                                                   >> 592                     logicCouple,
                                                   >> 593                     "Couple",
                                                   >> 594                     fLogicWorld,
                                                   >> 595                     false,
                                                   >> 596                     0);
410                                                   597 
411   //------------------------------------------    598   //--------------------------------------------------
412   // A logical layer in front of PhotonDet        599   // A logical layer in front of PhotonDet
413   //------------------------------------------    600   //--------------------------------------------------
414                                                   601 
415   // Purpose: Preventing direct dielectric to     602   // Purpose: Preventing direct dielectric to metal contact
416                                                   603 
417   // Check for valid placement of PhotonDet       604   // Check for valid placement of PhotonDet
418   if (fMPPCTheta > std::atan(fMPPCDist / fMPPC    605   if (fMPPCTheta > std::atan(fMPPCDist / fMPPCHalfL)) {
419     fMPPCTheta = 0.;                           << 
420     fMPPCOriginX = std::sin(fMPPCTheta) * (fMP << 
421     fMPPCOriginZ = -fCoupleZ + std::cos(fMPPCT << 
422     G4ExceptionDescription ed;                 << 
423     ed << "Invalid alignment.  Alignment reset << 
424     G4Exception("WLSDetectorConstruction", "wl << 
425   }                                            << 
426                                                   606 
                                                   >> 607      fMPPCTheta = 0;
                                                   >> 608      fMPPCOriginX  = std::sin(fMPPCTheta) * (fMPPCDist + fClrfiberZ);
                                                   >> 609      fMPPCOriginZ  = -fCoupleZ+std::cos(fMPPCTheta)*(fMPPCDist+fClrfiberZ);
                                                   >> 610      G4cerr << "Invalid alignment.  Alignment Reset to 0" << G4endl;
                                                   >> 611   }
                                                   >> 612  
427   // Clear Fiber (Coupling Layer)                 613   // Clear Fiber (Coupling Layer)
428   G4VSolid* solidClrfiber;                        614   G4VSolid* solidClrfiber;
                                                   >> 615  
                                                   >> 616   if ( fMPPCShape == "Square" )
                                                   >> 617     solidClrfiber =
                                                   >> 618        new G4Box("ClearFiber",fClrfiberHalfL,fClrfiberHalfL,fClrfiberZ);
                                                   >> 619   else
                                                   >> 620     solidClrfiber =
                                                   >> 621        new G4Tubs("ClearFiber",0.,fClrfiberHalfL,fClrfiberZ,0.0*rad,twopi*rad);
429                                                   622 
430   if (fMPPCShape == "Square") {                << 623   G4LogicalVolume*   logicClrfiber =
431     solidClrfiber = new G4Box("ClearFiber", fC << 624                                    new G4LogicalVolume(solidClrfiber,
432   }                                            << 625                                                        FindMaterial("G4_AIR"),
433   else {                                       << 626                                                        "ClearFiber");
434     solidClrfiber = new G4Tubs("ClearFiber", 0 << 
435   }                                            << 
436                                                << 
437   auto logicClrfiber = new G4LogicalVolume(sol << 
438                                                   627 
439   new G4PVPlacement(new G4RotationMatrix(CLHEP    628   new G4PVPlacement(new G4RotationMatrix(CLHEP::HepRotationY(-fMPPCTheta)),
440                     G4ThreeVector(fMPPCOriginX << 629                     G4ThreeVector(fMPPCOriginX,0.0,fMPPCOriginZ),
441                     logicCouple, false, 0);    << 630                     logicClrfiber,
                                                   >> 631                     "ClearFiber",
                                                   >> 632                     logicCouple,
                                                   >> 633                     false,
                                                   >> 634                     0);
442                                                   635 
443   //------------------------------------------    636   //--------------------------------------------------
444   // PhotonDet (Sensitive Detector)               637   // PhotonDet (Sensitive Detector)
445   //------------------------------------------ << 638   //--------------------------------------------------  
446                                                   639 
447   // Physical Construction                        640   // Physical Construction
448   G4VSolid* solidPhotonDet = nullptr;          << 641   G4VSolid* solidPhotonDet;
449                                                   642 
450   if (fMPPCShape == "Square")                  << 643   if ( fMPPCShape == "Square" )
451     solidPhotonDet = new G4Box("PhotonDet", fM << 644     solidPhotonDet = new G4Box("PhotonDet",fMPPCHalfL,fMPPCHalfL,fMPPCZ);
452   else                                            645   else
453     solidPhotonDet = new G4Tubs("PhotonDet", 0 << 646     solidPhotonDet =
454                                                << 647                new G4Tubs("PhotonDet",0.,fMPPCHalfL,fMPPCZ,0.0*rad,twopi*rad);
455   auto logicPhotonDet = new G4LogicalVolume(so << 
456                                                   648 
457   new G4PVPlacement(nullptr, G4ThreeVector(0., << 649   G4LogicalVolume*   logicPhotonDet =
458                     false, 0);                 << 650                                     new G4LogicalVolume(solidPhotonDet,
                                                   >> 651                                                         FindMaterial("G4_Al"),
                                                   >> 652                                                         "PhotonDet_LV");
                                                   >> 653 
                                                   >> 654   new G4PVPlacement(0,
                                                   >> 655                     G4ThreeVector(0.0,0.0,0.0),
                                                   >> 656                     logicPhotonDet,
                                                   >> 657                     "PhotonDet",
                                                   >> 658                     logicClrfiber,
                                                   >> 659                     false,
                                                   >> 660                     0);
459                                                   661 
460   // PhotonDet Surface Properties                 662   // PhotonDet Surface Properties
461   auto photonDetSurface =                      << 663   G4OpticalSurface* photonDetSurface = new G4OpticalSurface("PhotonDetSurface",
462     new G4OpticalSurface("PhotonDetSurface", g << 664                                                        glisur,
463                                                << 665                                                        ground,
464   auto photonDetSurfaceProperty = new G4Materi << 666                                                        dielectric_metal,
465                                                << 667                                                        fMPPCPolish);
466   std::vector<G4double> p_mppc = {2.00 * eV, 3 << 668 
467   std::vector<G4double> refl_mppc = {fMPPCRefl << 669   G4MaterialPropertiesTable* photonDetSurfaceProperty =
468   std::vector<G4double> effi_mppc = {1., 1.};  << 670                                                new G4MaterialPropertiesTable();
469                                                << 671 
470   photonDetSurfaceProperty->AddProperty("REFLE << 672   G4double p_mppc[] = {2.00*eV, 3.47*eV};
471   photonDetSurfaceProperty->AddProperty("EFFIC << 673   const G4int nbins = sizeof(p_mppc)/sizeof(G4double);
                                                   >> 674   G4double refl_mppc[] = {fMPPCReflectivity,fMPPCReflectivity};
                                                   >> 675   assert(sizeof(refl_mppc) == sizeof(p_mppc));
                                                   >> 676   G4double effi_mppc[] = {1, 1};
                                                   >> 677   assert(sizeof(effi_mppc) == sizeof(p_mppc));
                                                   >> 678  
                                                   >> 679   photonDetSurfaceProperty->AddProperty("REFLECTIVITY",p_mppc,refl_mppc,nbins);
                                                   >> 680   photonDetSurfaceProperty->AddProperty("EFFICIENCY",p_mppc,effi_mppc,nbins);
472                                                   681 
473   photonDetSurface->SetMaterialPropertiesTable    682   photonDetSurface->SetMaterialPropertiesTable(photonDetSurfaceProperty);
474                                                   683 
475   new G4LogicalSkinSurface("PhotonDetSurface", << 684   new G4LogicalSkinSurface("PhotonDetSurface",logicPhotonDet,photonDetSurface);
476                                                << 
477   // visualization attributes ---------------- << 
478                                                << 
479   auto visAttributes = new G4VisAttributes(G4C << 
480   visAttributes->SetVisibility(false);         << 
481   fLogicWorld->SetVisAttributes(visAttributes) << 
482   fVisAttributes.push_back(visAttributes);     << 
483                                                << 
484   visAttributes = new G4VisAttributes(G4Colour << 
485   visAttributes->SetVisibility(true);          << 
486   logicExtrusion->SetVisAttributes(visAttribut << 
487   fVisAttributes.push_back(visAttributes);     << 
488                                                << 
489   visAttributes = new G4VisAttributes(G4Colour << 
490   visAttributes->SetVisibility(true);          << 
491   logicScintillator->SetVisAttributes(visAttri << 
492   fVisAttributes.push_back(visAttributes);     << 
493                                                << 
494   visAttributes = new G4VisAttributes(G4Colour << 
495   visAttributes->SetVisibility(true);          << 
496   logicScintSide->SetVisAttributes(visAttribut << 
497   fVisAttributes.push_back(visAttributes);     << 
498                                                << 
499   visAttributes = new G4VisAttributes(G4Colour << 
500   visAttributes->SetVisibility(true);          << 
501   logicScintCrnr->SetVisAttributes(visAttribut << 
502   fVisAttributes.push_back(visAttributes);     << 
503                                                << 
504   visAttributes = new G4VisAttributes(G4Colour << 
505   visAttributes->SetVisibility(true);          << 
506   fLogicHole->SetVisAttributes(visAttributes); << 
507   fVisAttributes.push_back(visAttributes);     << 
508                                                << 
509   if (logicClad1 != nullptr) {                 << 
510     visAttributes = new G4VisAttributes(G4Colo << 
511     visAttributes->SetVisibility(true);        << 
512     logicClad1->SetVisAttributes(visAttributes << 
513     fVisAttributes.push_back(visAttributes);   << 
514   }                                            << 
515                                                << 
516   if (logicClad2 != nullptr) {                 << 
517     visAttributes = new G4VisAttributes(G4Colo << 
518     visAttributes->SetVisibility(true);        << 
519     logicClad2->SetVisAttributes(visAttributes << 
520     fVisAttributes.push_back(visAttributes);   << 
521   }                                            << 
522                                                << 
523   visAttributes = new G4VisAttributes(G4Colour << 
524   visAttributes->SetVisibility(true);          << 
525   logicWLSfiber->SetVisAttributes(visAttribute << 
526   fVisAttributes.push_back(visAttributes);     << 
527                                                << 
528   if (fMirrorToggle == true) {                 << 
529     visAttributes = new G4VisAttributes(G4Colo << 
530     visAttributes->SetVisibility(true);        << 
531     logicMirror->SetVisAttributes(visAttribute << 
532     fVisAttributes.push_back(visAttributes);   << 
533   }                                            << 
534                                                << 
535   visAttributes = new G4VisAttributes(G4Colour << 
536   visAttributes->SetVisibility(true);          << 
537   logicCouple->SetVisAttributes(visAttributes) << 
538   fVisAttributes.push_back(visAttributes);     << 
539                                                << 
540   visAttributes = new G4VisAttributes(G4Colour << 
541   visAttributes->SetVisibility(true);          << 
542   logicClrfiber->SetVisAttributes(visAttribute << 
543   fVisAttributes.push_back(visAttributes);     << 
544                                                << 
545   visAttributes = new G4VisAttributes(G4Colour << 
546   visAttributes->SetVisibility(true);          << 
547   logicPhotonDet->SetVisAttributes(visAttribut << 
548   fVisAttributes.push_back(visAttributes);     << 
549                                                << 
550   return fPhysiWorld;                          << 
551 }                                                 685 }
552                                                   686 
553 //....oooOO0OOooo........oooOO0OOooo........oo    687 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
554                                                   688 
555 void WLSDetectorConstruction::ConstructSDandFi    689 void WLSDetectorConstruction::ConstructSDandField()
556 {                                                 690 {
557   if (!fmppcSD.Get()) {                           691   if (!fmppcSD.Get()) {
558     G4String mppcSDName = "WLS/PhotonDet";     << 692      G4String mppcSDName = "WLS/PhotonDet";
559     auto mppcSD = new WLSPhotonDetSD(mppcSDNam << 693      WLSPhotonDetSD* mppcSD = new WLSPhotonDetSD(mppcSDName);
560     G4SDManager::GetSDMpointer()->AddNewDetect << 694      G4SDManager::GetSDMpointer()->AddNewDetector(mppcSD);
561     fmppcSD.Put(mppcSD);                       << 695      fmppcSD.Put(mppcSD);
562   }                                               696   }
563   SetSensitiveDetector("PhotonDet_LV", fmppcSD    697   SetSensitiveDetector("PhotonDet_LV", fmppcSD.Get(), true);
564 }                                                 698 }
565                                                   699 
566 //....oooOO0OOooo........oooOO0OOooo........oo    700 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
567                                                   701 
568 void WLSDetectorConstruction::UpdateGeometryPa    702 void WLSDetectorConstruction::UpdateGeometryParameters()
569 {                                                 703 {
570   fWLSfiberRX = fXYRatio * fWLSfiberRY;        << 704   fWLSfiberRX  = fXYRatio * fWLSfiberRY;
571                                                << 
572   fClad1RX = fWLSfiberRX + 0.03 * fWLSfiberRX; << 
573   fClad1RY = fWLSfiberRY + 0.03 * fWLSfiberRY; << 
574   fClad1Z = fWLSfiberZ;                        << 
575                                                << 
576   fClad2RX = fClad1RX + 0.03 * fWLSfiberRX;    << 
577   fClad2RY = fClad1RY + 0.03 * fWLSfiberRY;    << 
578   fClad2Z = fWLSfiberZ;                        << 
579                                                << 
580   fWorldSizeX = fClad2RX + fMPPCDist + fMPPCHa << 
581   fWorldSizeY = fClad2RY + fMPPCDist + fMPPCHa << 
582   fWorldSizeZ = fWLSfiberZ + fMPPCDist + fMPPC << 
583                                                   705 
                                                   >> 706   fClad1RX = fWLSfiberRX + 0.03*fWLSfiberRX;
                                                   >> 707   fClad1RY = fWLSfiberRY + 0.03*fWLSfiberRY;
                                                   >> 708   fClad1Z  = fWLSfiberZ;
                                                   >> 709 
                                                   >> 710   fClad2RX = fClad1RX + 0.03*fWLSfiberRX;
                                                   >> 711   fClad2RY = fClad1RY + 0.03*fWLSfiberRY;
                                                   >> 712   fClad2Z  = fWLSfiberZ;
                                                   >> 713 
                                                   >> 714   fWorldSizeX = fClad2RX   + fMPPCDist + fMPPCHalfL + 1.*cm;
                                                   >> 715   fWorldSizeY = fClad2RY   + fMPPCDist + fMPPCHalfL + 1.*cm;
                                                   >> 716   fWorldSizeZ = fWLSfiberZ + fMPPCDist + fMPPCHalfL + 1.*cm;
                                                   >> 717  
584   fCoupleRX = fWorldSizeX;                        718   fCoupleRX = fWorldSizeX;
585   fCoupleRY = fWorldSizeY;                        719   fCoupleRY = fWorldSizeY;
586   fCoupleZ = (fWorldSizeZ - fWLSfiberZ) / 2.;  << 720   fCoupleZ  = (fWorldSizeZ - fWLSfiberZ) / 2;
587                                                << 721  
588   fClrfiberHalfL = fMPPCHalfL;                    722   fClrfiberHalfL = fMPPCHalfL;
589                                                << 723  
590   fMirrorRmax = fClad2RY;                         724   fMirrorRmax = fClad2RY;
591                                                << 725  
592   fCoupleOrigin = fWLSfiberOrigin + fWLSfiberZ    726   fCoupleOrigin = fWLSfiberOrigin + fWLSfiberZ + fCoupleZ;
593   fMirrorOrigin = fWLSfiberOrigin - fWLSfiberZ    727   fMirrorOrigin = fWLSfiberOrigin - fWLSfiberZ - fMirrorZ;
594   fMPPCOriginX = std::sin(fMPPCTheta) * (fMPPC << 728   fMPPCOriginX  = std::sin(fMPPCTheta) * (fMPPCDist + fClrfiberZ);
595   fMPPCOriginZ = -fCoupleZ + std::cos(fMPPCThe << 729   fMPPCOriginZ  = -fCoupleZ + std::cos(fMPPCTheta) * (fMPPCDist + fClrfiberZ);
                                                   >> 730 }
                                                   >> 731 
                                                   >> 732 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >> 733 
                                                   >> 734 G4RotationMatrix
                                                   >> 735             WLSDetectorConstruction::StringToRotationMatrix(G4String rotation)
                                                   >> 736 {
                                                   >> 737   // We apply successive rotations OF THE OBJECT around the FIXED
                                                   >> 738   // axes of the parent's local coordinates; rotations are applied
                                                   >> 739   // left-to-right (rotation="r1,r2,r3" => r1 then r2 then r3).
                                                   >> 740 
                                                   >> 741   G4RotationMatrix rot;
                                                   >> 742 
                                                   >> 743   unsigned int place = 0;
                                                   >> 744 
                                                   >> 745   while (place < rotation.size()) {
                                                   >> 746 
                                                   >> 747         G4double angle;
                                                   >> 748         char* p;
                                                   >> 749 
                                                   >> 750         const G4String tmpstring=rotation.substr(place+1);
                                                   >> 751 
                                                   >> 752         angle = strtod(tmpstring.c_str(),&p) * deg;
                                                   >> 753  
                                                   >> 754         if (!p || (*p != (char)',' && *p != (char)'\0')) {
                                                   >> 755            G4cerr << "Invalid rotation specification: " <<
                                                   >> 756                                                   rotation.c_str() << G4endl;
                                                   >> 757            return rot;
                                                   >> 758         }
                                                   >> 759 
                                                   >> 760         G4RotationMatrix thisRotation;
                                                   >> 761 
                                                   >> 762         switch(rotation.substr(place,1).c_str()[0]) {
                                                   >> 763               case 'X': case 'x':
                                                   >> 764                 thisRotation = G4RotationMatrix(CLHEP::HepRotationX(angle));
                                                   >> 765                 break;
                                                   >> 766               case 'Y': case 'y':
                                                   >> 767                 thisRotation = G4RotationMatrix(CLHEP::HepRotationY(angle));
                                                   >> 768                 break;
                                                   >> 769               case 'Z': case 'z':
                                                   >> 770                 thisRotation = G4RotationMatrix(CLHEP::HepRotationZ(angle));
                                                   >> 771                 break;
                                                   >> 772               default:
                                                   >> 773                 G4cerr << " Invalid rotation specification: "
                                                   >> 774                        << rotation << G4endl;
                                                   >> 775                 return rot;
                                                   >> 776         }
                                                   >> 777 
                                                   >> 778        rot = thisRotation * rot;
                                                   >> 779        place = rotation.find(',',place);
                                                   >> 780        if (place > rotation.size()) break;
                                                   >> 781        ++place;
                                                   >> 782   }
                                                   >> 783 
                                                   >> 784   return rot;
                                                   >> 785 
596 }                                                 786 }
597                                                   787 
598 //....oooOO0OOooo........oooOO0OOooo........oo    788 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
599                                                   789 
600 void WLSDetectorConstruction::SetPhotonDetGeom << 790 void WLSDetectorConstruction::SetPhotonDetGeometry (G4String shape)
601 // Set the Geometry of the PhotonDet detector     791 // Set the Geometry of the PhotonDet detector
602 // Pre:  shape must be either "Circle" and "Sq    792 // Pre:  shape must be either "Circle" and "Square"
603 {                                                 793 {
604   if (shape == "Circle" || shape == "Square")  << 794   if (shape == "Circle" || shape == "Square" ) fMPPCShape = shape;
605   G4RunManager::GetRunManager()->GeometryHasBe << 795   G4RunManager::GetRunManager()->ReinitializeGeometry();
606 }                                                 796 }
607                                                   797 
608 //....oooOO0OOooo........oooOO0OOooo........oo    798 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
609                                                   799 
610 void WLSDetectorConstruction::SetNumberOfCladd    800 void WLSDetectorConstruction::SetNumberOfCladding(G4int num)
611 // Set the number of claddings                    801 // Set the number of claddings
612 // Pre: 0 <= num <= 2                             802 // Pre: 0 <= num <= 2
613 {                                                 803 {
614   fNumOfCladLayers = num;                         804   fNumOfCladLayers = num;
615   G4RunManager::GetRunManager()->GeometryHasBe << 805   G4RunManager::GetRunManager()->ReinitializeGeometry();
616 }                                                 806 }
617                                                   807 
618 //....oooOO0OOooo........oooOO0OOooo........oo    808 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
619                                                   809 
620 void WLSDetectorConstruction::SetWLSLength(G4d << 810 void WLSDetectorConstruction::SetWLSLength (G4double length)
621 // Set the TOTAL length of the WLS fiber          811 // Set the TOTAL length of the WLS fiber
622 {                                                 812 {
623   fWLSfiberZ = length;                            813   fWLSfiberZ = length;
624   G4RunManager::GetRunManager()->GeometryHasBe << 814   G4RunManager::GetRunManager()->ReinitializeGeometry();
625 }                                                 815 }
626                                                   816 
627 //....oooOO0OOooo........oooOO0OOooo........oo    817 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
628                                                   818 
629 void WLSDetectorConstruction::SetWLSRadius(G4d << 819 void WLSDetectorConstruction::SetWLSRadius (G4double radius)
630 // Set the Y radius of WLS fiber                  820 // Set the Y radius of WLS fiber
631 {                                                 821 {
632   fWLSfiberRY = radius;                           822   fWLSfiberRY = radius;
633   G4RunManager::GetRunManager()->GeometryHasBe << 823   G4RunManager::GetRunManager()->ReinitializeGeometry();
634 }                                                 824 }
635                                                   825 
636 //....oooOO0OOooo........oooOO0OOooo........oo    826 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
637                                                   827 
638 void WLSDetectorConstruction::SetClad1Radius(G << 828 void WLSDetectorConstruction::SetClad1Radius (G4double radius)
639 // Set the Y radius of Cladding 1                 829 // Set the Y radius of Cladding 1
640 {                                                 830 {
641   fClad1RY = radius;                              831   fClad1RY = radius;
642   G4RunManager::GetRunManager()->GeometryHasBe << 832   G4RunManager::GetRunManager()->ReinitializeGeometry();
643 }                                                 833 }
644                                                   834 
645 //....oooOO0OOooo........oooOO0OOooo........oo    835 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
646                                                   836 
647 void WLSDetectorConstruction::SetClad2Radius(G << 837 void WLSDetectorConstruction::SetClad2Radius (G4double radius)
648 // Set the Y radius of Cladding 2                 838 // Set the Y radius of Cladding 2
649 {                                                 839 {
650   fClad2RY = radius;                              840   fClad2RY = radius;
651   G4RunManager::GetRunManager()->GeometryHasBe << 841   G4RunManager::GetRunManager()->ReinitializeGeometry();
652 }                                                 842 }
653                                                   843 
654 //....oooOO0OOooo........oooOO0OOooo........oo    844 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
655                                                   845 
656 void WLSDetectorConstruction::SetPhotonDetHalf    846 void WLSDetectorConstruction::SetPhotonDetHalfLength(G4double halfL)
657 // Set the half length of the PhotonDet detect    847 // Set the half length of the PhotonDet detector
658 // The half length will be the radius if Photo    848 // The half length will be the radius if PhotonDet is circular
659 {                                                 849 {
660   fMPPCHalfL = halfL;                             850   fMPPCHalfL = halfL;
661   G4RunManager::GetRunManager()->GeometryHasBe << 851   G4RunManager::GetRunManager()->ReinitializeGeometry();
662 }                                                 852 }
663                                                   853 
664 //....oooOO0OOooo........oooOO0OOooo........oo    854 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
665                                                   855 
666 void WLSDetectorConstruction::SetGap(G4double  << 856 void WLSDetectorConstruction::SetGap (G4double gap)
667 // Set the distance between fiber end and Phot    857 // Set the distance between fiber end and PhotonDet
668 {                                              << 858 { 
669   fMPPCDist = gap;                                859   fMPPCDist = gap;
670   G4RunManager::GetRunManager()->GeometryHasBe << 860   G4RunManager::GetRunManager()->ReinitializeGeometry();
671 }                                                 861 }
672                                                   862 
673 //....oooOO0OOooo........oooOO0OOooo........oo    863 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
674                                                   864 
675 void WLSDetectorConstruction::SetPhotonDetAlig    865 void WLSDetectorConstruction::SetPhotonDetAlignment(G4double theta)
676 // Set the Aligment of PhotonDet with respect     866 // Set the Aligment of PhotonDet with respect to the z axis
677 // If theta is 0 deg, then the detector is per    867 // If theta is 0 deg, then the detector is perfectly aligned
678 // PhotonDet will be deviated by theta from z     868 // PhotonDet will be deviated by theta from z axis
679 // facing towards the center of the fiber         869 // facing towards the center of the fiber
680 {                                                 870 {
681   fMPPCTheta = theta;                             871   fMPPCTheta = theta;
682   G4RunManager::GetRunManager()->GeometryHasBe << 872   G4RunManager::GetRunManager()->ReinitializeGeometry();
683 }                                                 873 }
684                                                   874 
685 //....oooOO0OOooo........oooOO0OOooo........oo    875 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
686                                                   876 
687 void WLSDetectorConstruction::SetSurfaceRoughn    877 void WLSDetectorConstruction::SetSurfaceRoughness(G4double roughness)
688 // Set the Surface Roughness between Cladding     878 // Set the Surface Roughness between Cladding 1 and WLS fiber
689 // Pre: 0 < roughness <= 1                        879 // Pre: 0 < roughness <= 1
690 {                                                 880 {
691   fSurfaceRoughness = roughness;                  881   fSurfaceRoughness = roughness;
692   G4RunManager::GetRunManager()->GeometryHasBe << 882   G4RunManager::GetRunManager()->ReinitializeGeometry();
693 }                                                 883 }
694                                                   884 
695 //....oooOO0OOooo........oooOO0OOooo........oo    885 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
696                                                   886 
697 void WLSDetectorConstruction::SetMirrorPolish(    887 void WLSDetectorConstruction::SetMirrorPolish(G4double polish)
698 // Set the Polish of the mirror, polish of 1 i    888 // Set the Polish of the mirror, polish of 1 is a perfect mirror surface
699 // Pre: 0 < polish <= 1                           889 // Pre: 0 < polish <= 1
700 {                                                 890 {
701   fMirrorPolish = polish;                         891   fMirrorPolish = polish;
702   G4RunManager::GetRunManager()->GeometryHasBe << 892   G4RunManager::GetRunManager()->ReinitializeGeometry();
703 }                                                 893 }
704                                                   894 
705 //....oooOO0OOooo........oooOO0OOooo........oo    895 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
706                                                   896 
707 void WLSDetectorConstruction::SetMirrorReflect    897 void WLSDetectorConstruction::SetMirrorReflectivity(G4double reflectivity)
708 // Set the Reflectivity of the mirror, reflect    898 // Set the Reflectivity of the mirror, reflectivity of 1 is a perfect mirror
709 // Pre: 0 < reflectivity <= 1                     899 // Pre: 0 < reflectivity <= 1
710 {                                                 900 {
711   fMirrorReflectivity = reflectivity;             901   fMirrorReflectivity = reflectivity;
712   G4RunManager::GetRunManager()->GeometryHasBe << 902   G4RunManager::GetRunManager()->ReinitializeGeometry();
713 }                                                 903 }
714                                                   904 
715 //....oooOO0OOooo........oooOO0OOooo........oo    905 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
716                                                   906 
717 void WLSDetectorConstruction::SetPhotonDetPoli    907 void WLSDetectorConstruction::SetPhotonDetPolish(G4double polish)
718 // Set the Polish of the PhotonDet, polish of     908 // Set the Polish of the PhotonDet, polish of 1 is a perfect mirror surface
719 // Pre: 0 < polish <= 1                           909 // Pre: 0 < polish <= 1
720 {                                                 910 {
721   fMPPCPolish = polish;                           911   fMPPCPolish = polish;
722   G4RunManager::GetRunManager()->GeometryHasBe << 912   G4RunManager::GetRunManager()->ReinitializeGeometry();
723 }                                                 913 }
724                                                   914 
725 //....oooOO0OOooo........oooOO0OOooo........oo    915 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
726                                                   916 
727 void WLSDetectorConstruction::SetPhotonDetRefl    917 void WLSDetectorConstruction::SetPhotonDetReflectivity(G4double reflectivity)
728 // Set the Reflectivity of the PhotonDet, refl    918 // Set the Reflectivity of the PhotonDet, reflectivity of 1 is a perfect mirror
729 // Pre: 0 < reflectivity <= 1                     919 // Pre: 0 < reflectivity <= 1
730 {                                                 920 {
731   fMPPCReflectivity = reflectivity;               921   fMPPCReflectivity = reflectivity;
732   G4RunManager::GetRunManager()->GeometryHasBe << 922   G4RunManager::GetRunManager()->ReinitializeGeometry();
733 }                                                 923 }
734                                                   924 
735 //....oooOO0OOooo........oooOO0OOooo........oo    925 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
736                                                   926 
737 void WLSDetectorConstruction::SetMirror(G4bool    927 void WLSDetectorConstruction::SetMirror(G4bool flag)
738 // Toggle to place the mirror or not at one en    928 // Toggle to place the mirror or not at one end (-z end) of the fiber
739 // True means place the mirror, false means ot    929 // True means place the mirror, false means otherwise
740 {                                                 930 {
741   fMirrorToggle = flag;                           931   fMirrorToggle = flag;
742   G4RunManager::GetRunManager()->GeometryHasBe << 932   G4RunManager::GetRunManager()->ReinitializeGeometry();
743 }                                                 933 }
744                                                   934 
745 //....oooOO0OOooo........oooOO0OOooo........oo    935 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
746                                                   936 
747 void WLSDetectorConstruction::SetXYRatio(G4dou    937 void WLSDetectorConstruction::SetXYRatio(G4double r)
748 // Set the ratio of the x and y radius of the     938 // Set the ratio of the x and y radius of the ellipse (x/y)
749 // a ratio of 1 would produce a circle            939 // a ratio of 1 would produce a circle
750 {                                                 940 {
751   fXYRatio = r;                                   941   fXYRatio = r;
752   G4RunManager::GetRunManager()->GeometryHasBe << 942   G4RunManager::GetRunManager()->ReinitializeGeometry();
753 }                                                 943 }
754                                                   944 
755 //....oooOO0OOooo........oooOO0OOooo........oo    945 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
756                                                   946 
757 void WLSDetectorConstruction::SetBarLength(G4d << 947 void WLSDetectorConstruction::SetBarLength (G4double length)
758 // Set the length of the scintillator bar         948 // Set the length of the scintillator bar
759 {                                                 949 {
760   fBarLength = length;                            950   fBarLength = length;
761   G4RunManager::GetRunManager()->GeometryHasBe << 951   G4RunManager::GetRunManager()->ReinitializeGeometry();
762 }                                                 952 }
763                                                   953 
764 //....oooOO0OOooo........oooOO0OOooo........oo    954 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
765                                                   955 
766 void WLSDetectorConstruction::SetBarBase(G4dou << 956 void WLSDetectorConstruction::SetBarBase (G4double side)
767 // Set the side of the scintillator bar           957 // Set the side of the scintillator bar
768 {                                                 958 {
769   fBarBase = side;                                959   fBarBase = side;
770   G4RunManager::GetRunManager()->GeometryHasBe << 960   G4RunManager::GetRunManager()->ReinitializeGeometry();
771 }                                                 961 }
772                                                   962 
773 //....oooOO0OOooo........oooOO0OOooo........oo    963 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
774                                                   964 
775 void WLSDetectorConstruction::SetHoleRadius(G4 << 965 void WLSDetectorConstruction::SetHoleRadius (G4double radius)
776 // Set the radius of the fiber hole               966 // Set the radius of the fiber hole
777 {                                                 967 {
778   fHoleRadius = radius;                           968   fHoleRadius = radius;
779   G4RunManager::GetRunManager()->GeometryHasBe << 969   G4RunManager::GetRunManager()->ReinitializeGeometry();
780 }                                                 970 }
781                                                   971 
782 //....oooOO0OOooo........oooOO0OOooo........oo    972 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
783                                                   973 
784 void WLSDetectorConstruction::SetCoatingThickn << 974 void WLSDetectorConstruction::SetCoatingThickness (G4double thick)
785 // Set thickness of the coating on the bars       975 // Set thickness of the coating on the bars
786 {                                                 976 {
787   fCoatingThickness = thick;                      977   fCoatingThickness = thick;
788   G4RunManager::GetRunManager()->GeometryHasBe << 978   G4RunManager::GetRunManager()->ReinitializeGeometry();
789 }                                                 979 }
790                                                   980 
791 //....oooOO0OOooo........oooOO0OOooo........oo    981 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
792                                                   982 
793 void WLSDetectorConstruction::SetCoatingRadius << 983 void WLSDetectorConstruction::SetCoatingRadius (G4double radius)
794 // Set inner radius of the corner bar coating     984 // Set inner radius of the corner bar coating
795 {                                                 985 {
796   fCoatingRadius = radius;                        986   fCoatingRadius = radius;
797   G4RunManager::GetRunManager()->GeometryHasBe << 987   G4RunManager::GetRunManager()->ReinitializeGeometry();
798 }                                                 988 }
799                                                   989 
800 //....oooOO0OOooo........oooOO0OOooo........oo    990 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
801                                                   991 
802 G4double WLSDetectorConstruction::GetWLSFiberL << 992 G4double WLSDetectorConstruction::GetWLSFiberLength() { return fWLSfiberZ; }
803 {                                              << 
804   return fWLSfiberZ;                           << 
805 }                                              << 
806                                                   993 
807 //....oooOO0OOooo........oooOO0OOooo........oo    994 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
808                                                   995 
809 G4double WLSDetectorConstruction::GetBarLength << 996 G4double WLSDetectorConstruction::GetBarLength() { return fBarLength; }
810 {                                              << 
811   return fBarLength;                           << 
812 }                                              << 
813                                                   997 
814 //....oooOO0OOooo........oooOO0OOooo........oo    998 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
815                                                   999 
816 G4double WLSDetectorConstruction::GetBarBase() << 1000 G4double WLSDetectorConstruction::GetBarBase() { return fBarBase; }
817 {                                              << 
818   return fBarBase;                             << 
819 }                                              << 
820                                                   1001 
821 //....oooOO0OOooo........oooOO0OOooo........oo    1002 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
822                                                   1003 
823 G4double WLSDetectorConstruction::GetHoleRadiu << 1004 G4double WLSDetectorConstruction::GetHoleRadius() { return fHoleRadius; }
824 {                                              << 
825   return fHoleRadius;                          << 
826 }                                              << 
827                                                   1005 
828 //....oooOO0OOooo........oooOO0OOooo........oo    1006 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
829                                                   1007 
830 G4double WLSDetectorConstruction::GetHoleLengt << 1008 G4double WLSDetectorConstruction::GetHoleLength() { return fHoleLength; }
831 {                                              << 
832   return fHoleLength;                          << 
833 }                                              << 
834                                                   1009 
835 //....oooOO0OOooo........oooOO0OOooo........oo    1010 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
836                                                   1011 
837 G4double WLSDetectorConstruction::GetFiberRadi << 1012 G4double WLSDetectorConstruction::GetFiberRadius() { return GetWLSFiberRMax(); }
838 {                                              << 
839   return GetWLSFiberRMax();                    << 
840 }                                              << 
841                                                   1013 
842 //....oooOO0OOooo........oooOO0OOooo........oo    1014 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
843                                                   1015 
844 G4double WLSDetectorConstruction::GetCoatingTh    1016 G4double WLSDetectorConstruction::GetCoatingThickness()
845 {                                              << 1017                                                    { return fCoatingThickness; }
846   return fCoatingThickness;                    << 
847 }                                              << 
848                                                   1018 
849 //....oooOO0OOooo........oooOO0OOooo........oo    1019 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
850                                                   1020 
851 G4double WLSDetectorConstruction::GetCoatingRa << 1021 G4double WLSDetectorConstruction::GetCoatingRadius() { return fCoatingRadius; }
852 {                                              << 
853   return fCoatingRadius;                       << 
854 }                                              << 
855                                                   1022 
856 //....oooOO0OOooo........oooOO0OOooo........oo    1023 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
857                                                   1024 
858 G4double WLSDetectorConstruction::GetWLSFiberE    1025 G4double WLSDetectorConstruction::GetWLSFiberEnd()
859 {                                                 1026 {
860   return fWLSfiberOrigin + fWLSfiberZ;            1027   return fWLSfiberOrigin + fWLSfiberZ;
861 }                                                 1028 }
862                                                   1029 
863 //....oooOO0OOooo........oooOO0OOooo........oo    1030 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
864                                                   1031 
865 G4double WLSDetectorConstruction::GetWLSFiberR    1032 G4double WLSDetectorConstruction::GetWLSFiberRMax()
866 {                                                 1033 {
867   if (fNumOfCladLayers == 2) return fClad2RY;     1034   if (fNumOfCladLayers == 2) return fClad2RY;
868   if (fNumOfCladLayers == 1) return fClad1RY;     1035   if (fNumOfCladLayers == 1) return fClad1RY;
869   return fWLSfiberRY;                             1036   return fWLSfiberRY;
870 }                                                 1037 }
871                                                   1038 
872 //....oooOO0OOooo........oooOO0OOooo........oo    1039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
873                                                   1040 
874 G4double WLSDetectorConstruction::GetSurfaceRo    1041 G4double WLSDetectorConstruction::GetSurfaceRoughness()
875 {                                                 1042 {
876   return fSurfaceRoughness;                       1043   return fSurfaceRoughness;
877 }                                                 1044 }
878                                                   1045 
879 //....oooOO0OOooo........oooOO0OOooo........oo    1046 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
880                                                   1047 
881 // Return True if the fiber construction is id    1048 // Return True if the fiber construction is ideal
882 G4bool WLSDetectorConstruction::IsPerfectFiber    1049 G4bool WLSDetectorConstruction::IsPerfectFiber()
883 {                                                 1050 {
884   return fSurfaceRoughness == 1. && fXYRatio = << 1051   return     fSurfaceRoughness == 1. && fXYRatio == 1.
885          && (!fMirrorToggle || (fMirrorPolish  << 1052              && (!fMirrorToggle    ||
                                                   >> 1053              (fMirrorPolish    == 1. && fMirrorReflectivity == 1.));
886 }                                                 1054 }
887                                                   1055 
888 //....oooOO0OOooo........oooOO0OOooo........oo    1056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
889                                                   1057 
890 G4Material* WLSDetectorConstruction::FindMater << 1058 G4Material* WLSDetectorConstruction::FindMaterial(G4String name) {
891 {                                              << 1059     G4Material* material = G4Material::GetMaterial(name,true);
892   G4Material* material = G4Material::GetMateri << 1060     return material;
893   return material;                             << 
894 }                                                 1061 }
895                                                   1062