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