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 9.6.p4)


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