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