ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WLSDetectorConstruction.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file WLSDetectorConstruction.cc
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 //
29 //
30 //
31 #include "G4ios.hh"
32 #include "globals.hh"
33 
34 #include "G4Box.hh"
35 #include "G4Tubs.hh"
36 #include "G4EllipticalTube.hh"
37 
38 #include "G4LogicalVolume.hh"
39 #include "G4PVPlacement.hh"
40 
41 #include "G4OpticalSurface.hh"
42 #include "G4LogicalSkinSurface.hh"
44 
45 #include "G4Material.hh"
46 #include "G4NistManager.hh"
47 
48 #include "G4GeometryManager.hh"
49 #include "G4SolidStore.hh"
50 #include "G4LogicalVolumeStore.hh"
51 #include "G4PhysicalVolumeStore.hh"
52 
53 #include "G4RunManager.hh"
54 
55 #include "G4SDManager.hh"
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 {
72 
73  fNumOfCladLayers = 0;
74 
76 
77  fMirrorToggle = true;
78  fMirrorPolish = 1.;
80 
81  fMPPCPolish = 1.;
82  fMPPCReflectivity = 0.;
83 
84  fExtrusionPolish = 1.;
86 
87  fXYRatio = 1.0;
88 
89  fWLSfiberZ = 1.*m;
90  fWLSfiberRY = 0.5*mm;
91  fWLSfiberOrigin = 0.0;
92 
93  fMPPCShape = "Circle";
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;
106  fCoatingThickness = 0.25*mm;
107  fCoatingRadius = 1.875*mm;
108 }
109 
110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
111 
113 {
115  if (fMaterials) delete fMaterials;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119 
121 {
122  if (fPhysiWorld) {
129  }
130 
132 
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,
178 
179  G4MaterialPropertiesTable* TiO2SurfaceProperty =
181 
182  G4double p_TiO2[] = {2.00*eV, 3.47*eV};
183  const G4int nbins = sizeof(p_TiO2)/sizeof(G4double);
184 
186  assert(sizeof(refl_TiO2) == sizeof(p_TiO2));
187  G4double effi_TiO2[] = {0, 0};
188  assert(sizeof(effi_TiO2) == sizeof(p_TiO2));
189 
190  TiO2SurfaceProperty -> AddProperty("REFLECTIVITY",p_TiO2,refl_TiO2,nbins);
191  TiO2SurfaceProperty -> AddProperty("EFFICIENCY",p_TiO2,effi_TiO2,nbins);
192 
193  TiO2Surface -> SetMaterialPropertiesTable(TiO2SurfaceProperty);
194 
195  new G4PVPlacement(0,
196  G4ThreeVector(),
197  logicExtrusion,
198  "Extrusion",
199  fLogicWorld,
200  false,
201  0);
202 
203  new G4LogicalSkinSurface("TiO2Surface",logicExtrusion,TiO2Surface);
204 
205  //--------------------------------------------------
206  // Scintillator
207  //--------------------------------------------------
208 
209  G4VSolid* solidScintillator = new G4Box("Scintillator",
211  -GetCoatingRadius(),
213  -GetCoatingRadius(),
214  GetBarLength()/2);
215 
216  G4LogicalVolume* logicScintillator =
217  new G4LogicalVolume(solidScintillator,
218  FindMaterial("Polystyrene"),
219  "Scintillator");
220 
221  new G4PVPlacement(0,
222  G4ThreeVector(),
223  logicScintillator,
224  "Scintillator",
225  logicExtrusion,
226  false,
227  0);
228 
229  if (GetCoatingRadius() > 0.*mm) {
230  G4VSolid* solidScintside = new G4Box("SideOfBar",
232  -GetCoatingRadius(),
233  GetCoatingRadius()/2,
234  GetBarLength()/2);
235  G4VSolid* solidScintcrnr = new G4Tubs("CrnrOfBar",
236  0.0*cm,
238  GetBarLength()/2,
239  0.*deg,
240  90.*deg);
241  G4LogicalVolume* logicScintSide =
242  new G4LogicalVolume(solidScintside,
243  FindMaterial("Polystyrene"),
244  "SideOfBar");
245 
246  G4LogicalVolume* logicScintCrnr =
247  new G4LogicalVolume(solidScintcrnr,
248  FindMaterial("Polystyrene"),
249  "CrnrOfBar");
250 
253 
254  new G4PVPlacement(0,
255  G4ThreeVector(0,-y,0),
256  logicScintSide,
257  "SideOfBar",
258  logicExtrusion,
259  false,
260  0);
261  new G4PVPlacement(0,
262  G4ThreeVector(0, y,0),
263  logicScintSide,
264  "SideOfBar",
265  logicExtrusion,
266  false,
267  1);
268 
269  G4RotationMatrix* g4rot = new G4RotationMatrix();
270  *g4rot = StringToRotationMatrix("Z90");
271  *g4rot = g4rot->inverse();
272  if (*g4rot == G4RotationMatrix()) g4rot = NULL;
273 
274  new G4PVPlacement(g4rot,
275  G4ThreeVector(x,0,0),
276  logicScintSide,
277  "SideOfBar",
278  logicExtrusion,
279  false,
280  2);
281  new G4PVPlacement(g4rot,
282  G4ThreeVector(-x,0,0),
283  logicScintSide,
284  "SideOfBar",
285  logicExtrusion,
286  false,
287  3);
288 
291 
292  new G4PVPlacement(0,
293  G4ThreeVector(x,y,0),
294  logicScintCrnr,
295  "CrnrOfBar",
296  logicExtrusion,
297  false,
298  0);
299 
300  new G4PVPlacement(g4rot,
301  G4ThreeVector(-x,y,0),
302  logicScintCrnr,
303  "CrnrOfBar",
304  logicExtrusion,
305  false,
306  1);
307 
308  g4rot = new G4RotationMatrix();
309  *g4rot = StringToRotationMatrix("Z180");
310  *g4rot = g4rot->inverse();
311  if (*g4rot == G4RotationMatrix()) g4rot = NULL;
312 
313  new G4PVPlacement(g4rot,
314  G4ThreeVector(-x,-y,0),
315  logicScintCrnr,
316  "CrnrOfBar",
317  logicExtrusion,
318  false,
319  2);
320 
321  g4rot = new G4RotationMatrix();
322  *g4rot = StringToRotationMatrix("Z270");
323  *g4rot = g4rot->inverse();
324  if (*g4rot == G4RotationMatrix()) g4rot = NULL;
325 
326  new G4PVPlacement(g4rot,
327  G4ThreeVector(x,-y,0),
328  logicScintCrnr,
329  "CrnrOfBar",
330  logicExtrusion,
331  false,
332  3);
333 
334  }
335 
336  if (GetFiberRadius()<GetHoleRadius()) {
337 
338  G4VSolid* solidHole = new G4Tubs("Hole",
339  0.0*cm,
340  GetHoleRadius(),
341  GetHoleLength()/2,
342  0.*deg,
343  360.*deg);
344  fLogicHole = new G4LogicalVolume(solidHole,
345  FindMaterial("G4_AIR"),
346  "Hole");
347 
348  fPhysiHole = new G4PVPlacement(0,
349  G4ThreeVector(),
350  fLogicHole,
351  "Hole",
352  logicScintillator,
353  false,
354  0);
355  }
356 
357  //--------------------------------------------------
358  // Fiber
359  //--------------------------------------------------
360 
361  ConstructFiber();
362 
363  //--------------------------------------------------
364  // End of Construction
365  //--------------------------------------------------
366 
367  return fPhysiWorld;
368 }
369 
370 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
371 
373 {
374  if (!(fLogicHole) || !(fPhysiHole) ) {
375  std::ostringstream o;
376  o << "The Fiber Hole has not been constructed";
377  G4Exception("WLSDetectorConstruction::ConstructFiber","",
378  FatalException,o.str().c_str());
379  }
380 
381  // Pointers to the most recently constructed volume
382  G4LogicalVolume* logicPlacement = fLogicHole;
383  G4VPhysicalVolume* physiPlacement = fPhysiHole;
384 
385  //--------------------------------------------------
386  // Fiber Construction
387  //--------------------------------------------------
388 
389  // Boundary Surface Properties
390  G4OpticalSurface* opSurface = NULL;
391 
392  if (fSurfaceRoughness < 1.)
393  opSurface = new G4OpticalSurface("RoughSurface", // Surface Name
394  glisur, // SetModel
395  ground, // SetFinish
396  dielectric_dielectric, // SetType
397  fSurfaceRoughness); // SetPolish
398 
399  G4LogicalVolume *logicClad1, *logicClad2;
400  G4VPhysicalVolume *physiClad1, *physiClad2;
401 
402  // Determine the number of cladding layers to be built
403  switch ( fNumOfCladLayers ) {
404 
405  case 2:
406 
407  //--------------------------------------------------
408  // Cladding 2
409  //--------------------------------------------------
410 
411  G4VSolid* solidClad2;
412 
413  if (fXYRatio == 1.)
414  solidClad2 = new G4Tubs("Clad2",0.,fClad2RX,fClad2Z,0.0*rad,twopi*rad);
415  else
416  solidClad2 = new G4EllipticalTube("Clad2",fClad2RX,fClad2RY,fClad2Z);
417 
418  logicClad2 = new G4LogicalVolume(solidClad2,
419  FindMaterial("FPethylene"),
420  "Clad2");
421 
422  physiClad2 = new G4PVPlacement(0,
424  logicClad2,
425  "Clad2",
426  logicPlacement,
427  false,
428  0);
429 
430  // Place the rough surface only if needed
431  if (opSurface) {
432  new G4LogicalBorderSurface("surfaceClad2Out",
433  physiClad2,
434  physiPlacement,
435  opSurface);
436  new G4LogicalBorderSurface("surfaceClad2In",
437  physiPlacement,
438  physiClad2,
439  opSurface);
440  }
441 
442  logicPlacement = logicClad2;
443  physiPlacement = physiClad2;
444  break;
445 
446  case 1:
447 
448  //--------------------------------------------------
449  // Cladding 1
450  //--------------------------------------------------
451 
452  G4VSolid* solidClad1;
453 
454  if (fXYRatio == 1.)
455  solidClad1 = new G4Tubs("Clad1",0.,fClad1RX,fClad1Z,0.0*rad,twopi*rad);
456  else
457  solidClad1 = new G4EllipticalTube("Clad1",fClad1RX,fClad1RY,fClad1Z);
458 
459  logicClad1 = new G4LogicalVolume(solidClad1,
460  FindMaterial("Pethylene"),
461  "Clad1");
462 
463  physiClad1 = new G4PVPlacement(0,
465  logicClad1,
466  "Clad1",
467  logicPlacement,
468  false,
469  0);
470 
471  // Place the rough surface only if needed
472  if (opSurface) {
473  new G4LogicalBorderSurface("surfaceClad1Out",
474  physiClad1,
475  physiPlacement,
476  opSurface);
477  new G4LogicalBorderSurface("surfaceClad1In",
478  physiPlacement,
479  physiClad1,
480  opSurface);
481  }
482 
483  logicPlacement = logicClad1;
484  physiPlacement = physiClad1;
485  break;
486 
487  default:
488 
489  //--------------------------------------------------
490  // WLS Fiber
491  //--------------------------------------------------
492 
493  G4VSolid* solidWLSfiber;
494 
495  if (fXYRatio == 1.)
496  solidWLSfiber =
497  new G4Tubs("WLSFiber",0.,fWLSfiberRX,fWLSfiberZ,0.0*rad,twopi*rad);
498  else
499  solidWLSfiber =
501 
502  G4LogicalVolume* logicWLSfiber =
503  new G4LogicalVolume(solidWLSfiber,
504  FindMaterial("PMMA"),
505  "WLSFiber");
506 
507  logicWLSfiber->SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,10*ms));
508 
509  G4VPhysicalVolume* physiWLSfiber = new G4PVPlacement(0,
511  logicWLSfiber,
512  "WLSFiber",
513  logicPlacement,
514  false,
515  0);
516 
517  // Place the rough surface only if needed
518  if (opSurface) {
519  new G4LogicalBorderSurface("surfaceWLSOut",
520  physiWLSfiber,
521  physiPlacement,
522  opSurface);
523  new G4LogicalBorderSurface("surfaceWLSIn",
524  physiPlacement,
525  physiWLSfiber,
526  opSurface);
527  }
528  }
529 
530  //--------------------------------------------------
531  // Mirror for reflection at one of the end
532  //--------------------------------------------------
533 
534  // Place the mirror only if the user wants the mirror
535  if (fMirrorToggle) {
536 
537  G4VSolid* solidMirror = new G4Box("Mirror",
538  fMirrorRmax,
539  fMirrorRmax,
540  fMirrorZ);
541 
542  G4LogicalVolume* logicMirror = new G4LogicalVolume(solidMirror,
543  FindMaterial("G4_Al"),
544  "Mirror");
545 
546  G4OpticalSurface* mirrorSurface = new G4OpticalSurface("MirrorSurface",
547  glisur,
548  ground,
550  fMirrorPolish);
551 
552  G4MaterialPropertiesTable* mirrorSurfaceProperty =
554 
555  G4double p_mirror[] = {2.00*eV, 3.47*eV};
556  const G4int nbins = sizeof(p_mirror)/sizeof(G4double);
558  assert(sizeof(refl_mirror) == sizeof(p_mirror));
559  G4double effi_mirror[] = {0, 0};
560  assert(sizeof(effi_mirror) == sizeof(effi_mirror));
561 
562  mirrorSurfaceProperty->
563  AddProperty("REFLECTIVITY",p_mirror,refl_mirror,nbins);
564  mirrorSurfaceProperty->
565  AddProperty("EFFICIENCY",p_mirror,effi_mirror,nbins);
566 
567  mirrorSurface -> SetMaterialPropertiesTable(mirrorSurfaceProperty);
568 
569  new G4PVPlacement(0,
570  G4ThreeVector(0.0,0.0,fMirrorOrigin),
571  logicMirror,
572  "Mirror",
573  fLogicWorld,
574  false,
575  0);
576 
577  new G4LogicalSkinSurface("MirrorSurface",logicMirror,mirrorSurface);
578  }
579 
580  //--------------------------------------------------
581  // Coupling at the read-out end
582  //--------------------------------------------------
583 
584  // Clear Fiber (Coupling Layer)
585  G4VSolid* solidCouple = new G4Box("Couple",fCoupleRX,fCoupleRY,fCoupleZ);
586 
587  G4LogicalVolume* logicCouple = new G4LogicalVolume(solidCouple,
588  FindMaterial("G4_AIR"),
589  "Couple");
590 
591  new G4PVPlacement(0,
592  G4ThreeVector(0.0,0.0,fCoupleOrigin),
593  logicCouple,
594  "Couple",
595  fLogicWorld,
596  false,
597  0);
598 
599  //--------------------------------------------------
600  // A logical layer in front of PhotonDet
601  //--------------------------------------------------
602 
603  // Purpose: Preventing direct dielectric to metal contact
604 
605  // Check for valid placement of PhotonDet
606  if (fMPPCTheta > std::atan(fMPPCDist / fMPPCHalfL)) {
607 
608  fMPPCTheta = 0;
609  fMPPCOriginX = std::sin(fMPPCTheta) * (fMPPCDist + fClrfiberZ);
611  G4cerr << "Invalid alignment. Alignment Reset to 0" << G4endl;
612  }
613 
614  // Clear Fiber (Coupling Layer)
615  G4VSolid* solidClrfiber;
616 
617  if ( fMPPCShape == "Square" )
618  solidClrfiber =
619  new G4Box("ClearFiber",fClrfiberHalfL,fClrfiberHalfL,fClrfiberZ);
620  else
621  solidClrfiber =
622  new G4Tubs("ClearFiber",0.,fClrfiberHalfL,fClrfiberZ,0.0*rad,twopi*rad);
623 
624  G4LogicalVolume* logicClrfiber =
625  new G4LogicalVolume(solidClrfiber,
626  FindMaterial("G4_AIR"),
627  "ClearFiber");
628 
631  logicClrfiber,
632  "ClearFiber",
633  logicCouple,
634  false,
635  0);
636 
637  //--------------------------------------------------
638  // PhotonDet (Sensitive Detector)
639  //--------------------------------------------------
640 
641  // Physical Construction
642  G4VSolid* solidPhotonDet;
643 
644  if ( fMPPCShape == "Square" )
645  solidPhotonDet = new G4Box("PhotonDet",fMPPCHalfL,fMPPCHalfL,fMPPCZ);
646  else
647  solidPhotonDet =
648  new G4Tubs("PhotonDet",0.,fMPPCHalfL,fMPPCZ,0.0*rad,twopi*rad);
649 
650  G4LogicalVolume* logicPhotonDet =
651  new G4LogicalVolume(solidPhotonDet,
652  FindMaterial("G4_Al"),
653  "PhotonDet_LV");
654 
655  new G4PVPlacement(0,
656  G4ThreeVector(0.0,0.0,0.0),
657  logicPhotonDet,
658  "PhotonDet",
659  logicClrfiber,
660  false,
661  0);
662 
663  // PhotonDet Surface Properties
664  G4OpticalSurface* photonDetSurface = new G4OpticalSurface("PhotonDetSurface",
665  glisur,
666  ground,
668  fMPPCPolish);
669 
670  G4MaterialPropertiesTable* photonDetSurfaceProperty =
672 
673  G4double p_mppc[] = {2.00*eV, 3.47*eV};
674  const G4int nbins = sizeof(p_mppc)/sizeof(G4double);
676  assert(sizeof(refl_mppc) == sizeof(p_mppc));
677  G4double effi_mppc[] = {1, 1};
678  assert(sizeof(effi_mppc) == sizeof(p_mppc));
679 
680  photonDetSurfaceProperty->AddProperty("REFLECTIVITY",p_mppc,refl_mppc,nbins);
681  photonDetSurfaceProperty->AddProperty("EFFICIENCY",p_mppc,effi_mppc,nbins);
682 
683  photonDetSurface->SetMaterialPropertiesTable(photonDetSurfaceProperty);
684 
685  new G4LogicalSkinSurface("PhotonDetSurface",logicPhotonDet,photonDetSurface);
686 }
687 
688 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
689 
691 {
692  if (!fmppcSD.Get()) {
693  G4String mppcSDName = "WLS/PhotonDet";
694  WLSPhotonDetSD* mppcSD = new WLSPhotonDetSD(mppcSDName);
696  fmppcSD.Put(mppcSD);
697  }
698  SetSensitiveDetector("PhotonDet_LV", fmppcSD.Get(), true);
699 }
700 
701 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
702 
704 {
706 
708  fClad1RY = fWLSfiberRY + 0.03*fWLSfiberRY;
710 
711  fClad2RX = fClad1RX + 0.03*fWLSfiberRX;
712  fClad2RY = fClad1RY + 0.03*fWLSfiberRY;
714 
718 
721  fCoupleZ = (fWorldSizeZ - fWLSfiberZ) / 2;
722 
724 
726 
729  fMPPCOriginX = std::sin(fMPPCTheta) * (fMPPCDist + fClrfiberZ);
730  fMPPCOriginZ = -fCoupleZ + std::cos(fMPPCTheta) * (fMPPCDist + fClrfiberZ);
731 }
732 
733 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
734 
737 {
738  // We apply successive rotations OF THE OBJECT around the FIXED
739  // axes of the parent's local coordinates; rotations are applied
740  // left-to-right (rotation="r1,r2,r3" => r1 then r2 then r3).
741 
742  G4RotationMatrix rot;
743 
744  unsigned int place = 0;
745 
746  while (place < rotation.size()) {
747 
748  G4double angle;
749  char* p;
750 
751  const G4String tmpstring=rotation.substr(place+1);
752 
753  angle = strtod(tmpstring.c_str(),&p) * deg;
754 
755  if (!p || (*p != (char)',' && *p != (char)'\0')) {
756  G4cerr << "Invalid rotation specification: " <<
757  rotation.c_str() << G4endl;
758  return rot;
759  }
760 
761  G4RotationMatrix thisRotation;
762 
763  switch(rotation.substr(place,1).c_str()[0]) {
764  case 'X': case 'x':
765  thisRotation = G4RotationMatrix(CLHEP::HepRotationX(angle));
766  break;
767  case 'Y': case 'y':
768  thisRotation = G4RotationMatrix(CLHEP::HepRotationY(angle));
769  break;
770  case 'Z': case 'z':
771  thisRotation = G4RotationMatrix(CLHEP::HepRotationZ(angle));
772  break;
773  default:
774  G4cerr << " Invalid rotation specification: "
775  << rotation << G4endl;
776  return rot;
777  }
778 
779  rot = thisRotation * rot;
780  place = rotation.find(',',place);
781  if (place > rotation.size()) break;
782  ++place;
783  }
784 
785  return rot;
786 
787 }
788 
789 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
790 
792 // Set the Geometry of the PhotonDet detector
793 // Pre: shape must be either "Circle" and "Square"
794 {
795  if (shape == "Circle" || shape == "Square" ) fMPPCShape = shape;
797 }
798 
799 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
800 
802 // Set the number of claddings
803 // Pre: 0 <= num <= 2
804 {
807 }
808 
809 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
810 
812 // Set the TOTAL length of the WLS fiber
813 {
814  fWLSfiberZ = length;
816 }
817 
818 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
819 
821 // Set the Y radius of WLS fiber
822 {
825 }
826 
827 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
828 
830 // Set the Y radius of Cladding 1
831 {
832  fClad1RY = radius;
834 }
835 
836 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
837 
839 // Set the Y radius of Cladding 2
840 {
841  fClad2RY = radius;
843 }
844 
845 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
846 
848 // Set the half length of the PhotonDet detector
849 // The half length will be the radius if PhotonDet is circular
850 {
851  fMPPCHalfL = halfL;
853 }
854 
855 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
856 
858 // Set the distance between fiber end and PhotonDet
859 {
860  fMPPCDist = gap;
862 }
863 
864 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
865 
867 // Set the Aligment of PhotonDet with respect to the z axis
868 // If theta is 0 deg, then the detector is perfectly aligned
869 // PhotonDet will be deviated by theta from z axis
870 // facing towards the center of the fiber
871 {
872  fMPPCTheta = theta;
874 }
875 
876 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
877 
879 // Set the Surface Roughness between Cladding 1 and WLS fiber
880 // Pre: 0 < roughness <= 1
881 {
882  fSurfaceRoughness = roughness;
884 }
885 
886 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
887 
889 // Set the Polish of the mirror, polish of 1 is a perfect mirror surface
890 // Pre: 0 < polish <= 1
891 {
892  fMirrorPolish = polish;
894 }
895 
896 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
897 
899 // Set the Reflectivity of the mirror, reflectivity of 1 is a perfect mirror
900 // Pre: 0 < reflectivity <= 1
901 {
902  fMirrorReflectivity = reflectivity;
904 }
905 
906 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
907 
909 // Set the Polish of the PhotonDet, polish of 1 is a perfect mirror surface
910 // Pre: 0 < polish <= 1
911 {
912  fMPPCPolish = polish;
914 }
915 
916 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
917 
919 // Set the Reflectivity of the PhotonDet, reflectivity of 1 is a perfect mirror
920 // Pre: 0 < reflectivity <= 1
921 {
922  fMPPCReflectivity = reflectivity;
924 }
925 
926 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
927 
929 // Toggle to place the mirror or not at one end (-z end) of the fiber
930 // True means place the mirror, false means otherwise
931 {
932  fMirrorToggle = flag;
934 }
935 
936 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
937 
939 // Set the ratio of the x and y radius of the ellipse (x/y)
940 // a ratio of 1 would produce a circle
941 {
942  fXYRatio = r;
944 }
945 
946 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
947 
949 // Set the length of the scintillator bar
950 {
951  fBarLength = length;
953 }
954 
955 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
956 
958 // Set the side of the scintillator bar
959 {
960  fBarBase = side;
962 }
963 
964 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
965 
967 // Set the radius of the fiber hole
968 {
971 }
972 
973 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
974 
976 // Set thickness of the coating on the bars
977 {
980 }
981 
982 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
983 
985 // Set inner radius of the corner bar coating
986 {
989 }
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 
1007 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1008 
1010 
1011 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1012 
1014 
1015 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1016 
1018  { return fCoatingThickness; }
1019 
1020 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1021 
1023 
1024 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1025 
1027 {
1028  return fWLSfiberOrigin + fWLSfiberZ;
1029 }
1030 
1031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1032 
1034 {
1035  if (fNumOfCladLayers == 2) return fClad2RY;
1036  if (fNumOfCladLayers == 1) return fClad1RY;
1037  return fWLSfiberRY;
1038 }
1039 
1040 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1041 
1043 {
1044  return fSurfaceRoughness;
1045 }
1046 
1047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1048 
1049 // Return True if the fiber construction is ideal
1051 {
1052  return fSurfaceRoughness == 1. && fXYRatio == 1.
1053  && (!fMirrorToggle ||
1054  (fMirrorPolish == 1. && fMirrorReflectivity == 1.));
1055 }
1056 
1057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
1058 
1061  return material;
1062 }