SToGS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
SToGS_ScintillatorDF.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 //
27 
28 // G4 includes
29 #include "G4Material.hh"
30 #include "G4Box.hh"
31 #include "G4Tubs.hh"
32 #include "G4Polyhedra.hh"
33 #include "G4Sphere.hh"
34 #include "G4Polycone.hh"
35 
36 #include "G4LogicalVolume.hh"
37 #include "G4AssemblyVolume.hh"
38 
39 #include "G4PVPlacement.hh"
40 #include "G4PVParameterised.hh"
41 #include "G4UserLimits.hh"
42 #include "G4VisAttributes.hh"
43 #include "G4Colour.hh"
44 #include "G4ios.hh"
45 #include "G4SubtractionSolid.hh"
46 #include "G4PhysicalVolumeStore.hh"
47 #include "G4LogicalVolumeStore.hh"
48 #include "G4SDManager.hh"
49 #include "G4UnitsTable.hh"
50 
51 
52 // Project includes
53 #include "SToGS_ScintillatorDF.hh"
54 
55 #include "SToGS_DetectorFactory.hh"
58 
59 // list of all specific factories
60 namespace {
61  // all scintillators
62  SToGS::ScintillatorDF theScintillatorFactory("Scintillators/");
63 }
64 
66 {
67  // PARIS RELATED
68  // SToGS::DetectorFactory::theMainFactory()->Clean();
70  MakeInStore("ParisPW","2");
71  // SToGS::DetectorFactory::theMainFactory()->Clean();
73  MakeInStore("ParisPW","2-bare");
74  //
75  // SToGS::DetectorFactory::theMainFactory()->Clean();
77  MakeInStore("ParisPW","3");
78  // SToGS::DetectorFactory::theMainFactory()->Clean();
80  MakeInStore("ParisPW","3-bare");
81  //
82  // SToGS::DetectorFactory::theMainFactory()->Clean();
84  MakeInStore("CParisPW","2");
85  // SToGS::DetectorFactory::theMainFactory()->Clean();
87  MakeInStore("CParisPW","2-bare");
88 
89  // Chateau de Crystal
90  // SToGS::DetectorFactory::theMainFactory()->Clean();
92  MakeInStore("aChateau2Crystal","bare");
93  // SToGS::DetectorFactory::theMainFactory()->Clean();
95  MakeInStore("aChateau2Crystal","");
96 
97  // FATIMA
99  MakeInStore("FATIMAM","bare");
101  MakeInStore("FATIMAQ","bare");
103  MakeInStore("FATIMAM","");
105  MakeInStore("FATIMAQ","");
106 
107  // EDEN
108  // SToGS::DetectorFactory::theMainFactory()->Clean();
110  MakeInStore("EDEN","v0");
111  // SToGS::DetectorFactory::theMainFactory()->Clean();
113  MakeInStore("EDEN","bare");
114 }
115 
116 G4VPhysicalVolume * SToGS::ScintillatorDF::Make(G4String name, G4String version_string)
117 {
118  G4VPhysicalVolume *theDetector = 0x0; G4String detname;
119 
120  // PARIS RELATED
121  if ( name == "ParisPW" ) {
122 
123  detname = GetDetName("ParisPW",version_string);
124 
125  if ( version_string.contains("2") ) {
126  if ( version_string == "2" ) {
127  theDetector = MakePPW(detname,0.5*CLHEP::mm,0.0*CLHEP::mm,"");
128  }
129  if ( version_string.contains("2-bare") ) {
130  theDetector = MakePPW(detname,0.5*CLHEP::mm,0.0*CLHEP::mm,"bare");
131  }
132  }
133  if ( version_string.contains("3") ) {
134  if ( version_string == "3" ) {
135  theDetector = MakePPW(detname,1.0*CLHEP::mm,0.0*CLHEP::mm,"");
136  }
137  if ( version_string.contains("3-bare") ) {
138  theDetector = MakePPW(detname,1.0*CLHEP::mm,0.0*CLHEP::mm,"bare");
139  }
140  }
141  }
142  if ( name == "CParisPW" ) {
143  detname = GetDetName("CParisPW",version_string); // version string should be the same that ParisPW
144  theDetector = MakeCPPW(detname,version_string);
145  }
146  // Chateau de Crystal
147  if ( name == "aChateau2Crystal" ) {
148  detname = GetDetName("aChateau2Crystal",version_string);
149  theDetector = MakeCdC(detname,version_string);
150  }
151 
152  // FATIMA
153  if ( name.index("FATIMA") == 0 ) {
154  if ( name == "FATIMAM" ) {
155  detname = GetDetName("FATIMAM",version_string);
156  theDetector = MakeFATIMAM(detname,version_string);
157  }
158  if ( name == "FATIMAQ" ) {
159  detname = GetDetName("FATIMAQ",version_string);
160  theDetector = MakeFATIMAQ(detname,version_string);
161  }
162  }
163 
164  // EDEN
165  if ( name == "EDEN" ) {
166  detname = GetDetName("EDEN",version_string);
167  theDetector = MakeEDEN(detname,1.*CLHEP::mm, 10.*CLHEP::cm ,version_string);
168  }
169 
170  return theDetector;
171 }
172 
173 
174 G4VPhysicalVolume *SToGS::ScintillatorDF::MakeCdC(G4String detname, G4String opt)
175 {
176  G4VPhysicalVolume *theDetector = 0x0; G4LogicalVolume *detlogicWorld; G4Box *detWorld; G4bool do_caps = true;
177 
178  // from manifacture
179  const G4double caps_width = 0.9*CLHEP::mm, teflon_width = 0.1*CLHEP::mm, crystal_radius = 5.0*CLHEP::cm, crystal_depth = 14*CLHEP::cm;
180  const G4int numSide = 6, numZPlanes = 2;
181 
182  // for G4 radius is inner radius ==> ri = sqrt
183  G4double inner_crystal_radius = crystal_radius * ::sqrt(3) / 2.;
184  G4double
185  z[] = { caps_width + teflon_width, crystal_depth + caps_width + teflon_width },
186  rInner[] = { 0., 0. },
187  rOuter[] = { inner_crystal_radius, inner_crystal_radius },
188 
189  z_caps_front[] = { 0.0, caps_width + teflon_width },
190  rInner_caps_front[] = { 0., 0.},
191  rOuter_caps_front[] = { inner_crystal_radius, inner_crystal_radius },
192 
193  z_caps[] = { 0., crystal_depth + 2.0*(caps_width + teflon_width) },
194  rInner_caps[] = { inner_crystal_radius, inner_crystal_radius },
195  rOuter_caps[] = { inner_crystal_radius + teflon_width + caps_width, inner_crystal_radius + teflon_width + caps_width };
196 
197  // if option bare does not include the encapsulation
198  if ( opt == "bare" ) {
199  do_caps = false;
200  }
201 
202  // use a physical as a container to describe the detector
203  detWorld= new G4Box(detname,15.*CLHEP::cm,15.*CLHEP::cm,25.*CLHEP::cm);
204  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
205 
206  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
207  // Must place the World Physical volume unrotated at (0,0,0).
208  theDetector = new G4PVPlacement(0, // no rotation
209  G4ThreeVector(), // at (0,0,0)
210  detlogicWorld, // its logical volume
211  detname, // its name
212  0, // its mother volume
213  false, // no boolean operations
214  -1); // copy number
215 
216  // crystal
217  G4Polyhedra* a_solid
218  = new G4Polyhedra("ShapeC2CCrys",0.,360.1*CLHEP::deg,numSide,numZPlanes,z,rInner,rOuter);
219  //Setting a logical volume
220  G4LogicalVolume *a_log
221  = new G4LogicalVolume(a_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("BaF2"),"C2CCrysLV",0,0,0);
222 
223  G4VisAttributes *visatt = new G4VisAttributes( G4Colour(0.0, 0.6, 0.0) );
224  visatt->SetVisibility(true);
225  a_log->SetVisAttributes( visatt );
226  a_log->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
227 
228  // Rotation and translation to place each peace in the assembly
229  G4ThreeVector Ta;
230 
231  // Add crystals Inner
232  Ta.setX( 0.0 );
233  Ta.setY( 0.0 );
234  Ta.setZ( 0.0 );
235  new G4PVPlacement(0,Ta,a_log,"C2CCrys",detlogicWorld,false,0);
236 
237  // encapsulation side
238  G4VisAttributes *Capsule_visatt;
239  a_solid = new G4Polyhedra("ShapeC2CCapsSide",0.,360.*CLHEP::deg,numSide,numZPlanes,z_caps,rInner_caps,rOuter_caps);
240  if ( do_caps ) {
241  a_log
242  = new G4LogicalVolume(a_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("Al"),"C2CCapsSideLV",0,0,0);
243  // grey for all passive part
244  Capsule_visatt = new G4VisAttributes( G4Colour(0.8, 0.8, 0.8, 0.75) );
245  Capsule_visatt->SetVisibility(true);
246  a_log->SetVisAttributes( Capsule_visatt );
247  }
248  else {
249  a_log
250  = new G4LogicalVolume(a_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"),"C2CCapsSideLV",0,0,0);
251  // white for all passive part if air
252  Capsule_visatt = new G4VisAttributes( G4Colour(1, 1, 1, 0.5) );
253  Capsule_visatt->SetVisibility(true);
254  a_log->SetVisAttributes( Capsule_visatt );
255  }
256  //Setting a logical volume
257  Ta.setX( 0.0 );
258  Ta.setY( 0.0 );
259  Ta.setZ( 0.0 );
260  new G4PVPlacement(0,Ta,a_log,"C2CCapsSide",detlogicWorld,false,-1);
261 
262  // encapsulation front and back
263  a_solid = new G4Polyhedra("C2CCapsFront",0.,360.*CLHEP::deg,numSide,numZPlanes,z_caps_front,rInner_caps_front,rOuter_caps_front);
264  //Setting a logical volume
265  if ( do_caps ) {
266  a_log
267  = new G4LogicalVolume(a_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("Al"),"C2CCapsFrontLV",0,0,0);
268  // grey for all passive part
269  a_log->SetVisAttributes( Capsule_visatt );
270  }
271  else {
272  a_log
273  = new G4LogicalVolume(a_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"),"C2CCapsFrontLV",0,0,0);
274  // grey for all passive part
275  a_log->SetVisAttributes( Capsule_visatt );
276  }
277  Ta.setX( 0.0 );
278  Ta.setY( 0.0 );
279  Ta.setZ( 0.0 );
280  new G4PVPlacement(0,Ta,a_log,"C2CCapsFront",detlogicWorld,false,-1);
281  Ta.setX( 0.0 );
282  Ta.setY( 0.0 );
283  Ta.setZ( crystal_depth + caps_width + teflon_width );
284  new G4PVPlacement(0,Ta,a_log,"C2CCapsBack",detlogicWorld,false,-1);
285 
286  return theDetector;
287 }
288 
289 
290 // PARIS phoswitch - Version 0
291 // capsule = polyhedra closed at the front
292 // cristals are attached to the world
293 // this shape may be the cause of singularities when the detector is used in simulation
294 // (pathologic treatment of projectiles impacting at (x=0, y=0),
295 // namely in the case of a centered beam or a point source emitting in z direction)
296 
297 /*
298 G4VPhysicalVolume *SToGS::ScintillatorDF::MakePPW(G4String detname, G4double caps_width, G4double housing_width, G4String opt)
299 {
300  G4VPhysicalVolume *theDetector = 0x0; G4LogicalVolume *detlogicWorld; G4Box *detWorld; G4bool do_caps = false, do_housing = false;
301  G4RotationMatrix R;
302  G4ThreeVector T;
303  G4Transform3D Tr;
304 
305  // Option
306  if ( caps_width != 0.0 ) {
307  if ( opt != "bare" ) {
308  do_caps = true;
309  }
310  }
311  if ( housing_width != 0.0 ) {
312  if ( opt != "bare" ) {
313  do_housing = true;
314  }
315  }
316 
317  // use a physical as a container to describe the detector
318  detWorld= new G4Box(detname,10.*CLHEP::cm,10.*CLHEP::cm,50.*CLHEP::cm);
319  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
320 
321  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
322  // Must place the World Physical volume unrotated at (0,0,0).
323  theDetector = new G4PVPlacement(0, // no rotation
324  G4ThreeVector(), // at (0,0,0)
325  detlogicWorld, // its logical volume
326  detname, // its name
327  0, // its mother volume
328  false, // no boolean operations
329  -1); // copy number
330 
331  // material for first and second layer
332  const char *matInner = "LaBr3", *matOuter = "NaI", *matCapsule = "Al", *matHousing = "Al";
333 
334  // full lenght in X,Y,Z
335  G4double
336  InnerX = 2*2.54*CLHEP::cm, InnerY = 2*2.54*CLHEP::cm, InnerZ = 2*2.54*CLHEP::cm,
337  OuterX = 2*2.54*CLHEP::cm, OuterY = 2*2.54*CLHEP::cm, OuterZ = 6*2.54*CLHEP::cm;
338  // in case of housing longer at the back of the PW
339  G4double ExtraHousingBack = 20*CLHEP::mm, eps_caps = caps_width / 100. , eps_housing = 0.05*CLHEP::mm; // eps remove in the capsule part to avoid overlapping
340  // G4double r_caps_width = caps_width - eps_caps, r_housing_width = housing_width - eps_housing;
341 
342 
343  // Stage 0
344  G4Box *Inner_solid = new G4Box("ShapePW0", InnerX/2., InnerY/2., InnerZ/2.);
345  G4LogicalVolume *Inner_logic =
346  new G4LogicalVolume(Inner_solid, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matInner),"PWLV:0",0,0,0);
347  G4VisAttributes *Inner_visatt = new G4VisAttributes( G4Colour(0.0, 0.0, 1.0) );
348  Inner_visatt->SetVisibility(true);
349  Inner_logic->SetVisAttributes( Inner_visatt );
350  Inner_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
351 
352  T.setX( 0.0 );
353  T.setY( 0.0 );
354  T.setZ( housing_width + caps_width + InnerZ / 2. );
355 
356  new G4PVPlacement(0,T,Inner_logic,"PW:0:",detlogicWorld,false,0);
357 
358  // Stage 1
359  G4Box *Outer_solid = new G4Box("ShapePW1", OuterX/2., OuterY/2., OuterZ/2.);
360  G4LogicalVolume *Outer_logic =
361  new G4LogicalVolume(Outer_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matOuter), "PWLV:1",0,0,0);
362  G4VisAttributes *Outer_visatt = new G4VisAttributes( G4Colour(1.0, 0.0, 0.0) );
363  Outer_visatt->SetVisibility(true);
364  Outer_logic->SetVisAttributes( Outer_visatt );
365  Outer_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
366 
367  T.setX( 0.0 );
368  T.setY( 0.0 );
369  T.setZ( housing_width + caps_width + InnerZ + OuterZ / 2. );
370  new G4PVPlacement(0,T,Outer_logic,"PW:1:",detlogicWorld,false,1);
371 
372  // Encapsulation Al if on otherwise set as AIR ... useful to check overlapping
373  G4double zplane[3], rinner[3], router[3];
374 
375  zplane[0] = 0.01*CLHEP::mm; zplane[1] = caps_width - eps_caps; zplane[2] = InnerZ + OuterZ + ExtraHousingBack;
376  rinner[0] = 0.00*CLHEP::mm; rinner[1] = InnerX / 2 + eps_caps; rinner[2] = InnerX / 2 + eps_caps;
377  router[0] = InnerX / 2 + caps_width ; router[1] = InnerX / 2 + caps_width ; router[2] = InnerX / 2 + caps_width;
378 
379  //rinner[0] = rinner[1] = rinner[2] = InnerX / 2 + eps_caps;
380  //router[0] = router[1] = router[2] = InnerX / 2 + caps_width;
381 
382  G4Polyhedra *side_part =
383  new G4Polyhedra("ShapePWCaps", 0.0, 361.0*CLHEP::deg, 4, 3, zplane, rinner, router);
384 
385  G4LogicalVolume *Capsule_logic_side; G4VisAttributes *Capsule_visatt;
386  if ( do_caps ) {
387  Capsule_logic_side =
388  new G4LogicalVolume(side_part,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matCapsule),"PWCaps",0,0,0);
389 
390  Capsule_visatt = new G4VisAttributes( G4Colour(0.8, 0.8, 0.8, 0.75) );
391  Capsule_visatt->SetVisibility(true);
392  Capsule_logic_side->SetVisAttributes( Capsule_visatt );
393  }
394  else {
395  Capsule_logic_side =
396  new G4LogicalVolume(side_part,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"),"PWCaps",0,0,0);
397 
398  Capsule_visatt = new G4VisAttributes( G4Colour(1, 1, 1, 0.5) );
399  Capsule_visatt->SetVisibility(true);
400  Capsule_logic_side->SetVisAttributes( Capsule_visatt );
401  }
402 
403  T.setX( 0.0 );
404  T.setY( 0.0 );
405  T.setZ( 0.0 );
406  G4RotationMatrix *Ro = new G4RotationMatrix();
407  Ro->rotateZ(45.0*CLHEP::deg);
408  new G4PVPlacement(Ro,T,Capsule_logic_side,"PwCaps",detlogicWorld,false,-1);
409 
410  return theDetector;
411 }
412 */
413 
414 // PARIS phoswitch - Version 1
415 // capsule = box, with a box of air inside
416 // cristals are attached to the box of air inside the capsule
417 /*
418 G4VPhysicalVolume *SToGS::ScintillatorDF::MakePPW(G4String detname, G4double caps_width, G4double housing_width, G4String opt)
419 {
420 // Note : housing_width is not used in this version
421 
422  G4VPhysicalVolume *theDetector = 0x0; G4LogicalVolume *detlogicWorld; G4Box *detWorld; G4bool do_caps = false, do_housing = false;
423  G4RotationMatrix R;
424  G4ThreeVector T;
425  G4Transform3D Tr;
426 
427  // Option
428  if ( caps_width != 0.0 ) {
429  if ( opt != "bare" ) {
430  do_caps = true;
431  }
432  }
433  if ( housing_width != 0.0 ) {
434  if ( opt != "bare" ) {
435  do_housing = true;
436  }
437  }
438 
439  // use a physical as a container to describe the detector
440  detWorld= new G4Box(detname,10.*CLHEP::cm,10.*CLHEP::cm,50.*CLHEP::cm);
441  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
442 
443  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
444  // Must place the World Physical volume unrotated at (0,0,0).
445  theDetector = new G4PVPlacement(0, // no rotation
446  G4ThreeVector(), // at (0,0,0)
447  detlogicWorld, // its logical volume
448  detname, // its name
449  0, // its mother volume
450  false, // no boolean operations
451  -1); // copy number
452 
453  // material for first and second layer
454  const char *matInner = "LaBr3", *matOuter = "NaI", *matCapsule = "Al", *matHousing = "Al";
455 
456  // full lenght in X,Y,Z
457  G4double
458  InnerX = 2*2.54*CLHEP::cm, InnerY = 2*2.54*CLHEP::cm, InnerZ = 2*2.54*CLHEP::cm,
459  OuterX = 2*2.54*CLHEP::cm, OuterY = 2*2.54*CLHEP::cm, OuterZ = 6*2.54*CLHEP::cm;
460  // in case of housing longer at the back of the PW
461  G4double
462  ExtraHousingBack = 20*CLHEP::mm,
463  eps_caps = 0.1*CLHEP::mm, //caps_width / 100., eps remove in the capsule part to avoid overlapping
464  Shift = 0.01*CLHEP::mm; // the detector entrance is not just at 0
465 
466  // Encapsulation Al if on, otherwise set as AIR ... useful to check overlapping
467 
468  G4Box *Capsule_solid = new G4Box("ShapePWCaps",
469  InnerX/2.+caps_width,
470  InnerY/2.+caps_width,
471  (InnerZ+OuterZ+caps_width+ExtraHousingBack)/2.);
472 
473  G4LogicalVolume *Capsule_logic; G4VisAttributes *Capsule_visatt;
474  if ( do_caps ) {
475  Capsule_logic =
476  new G4LogicalVolume(Capsule_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matCapsule),"PWCaps",0,0,0);
477 
478  Capsule_visatt = new G4VisAttributes( G4Colour(0.8, 0.8, 0.8, 0.75) );
479  Capsule_visatt->SetVisibility(true);
480  Capsule_logic->SetVisAttributes( Capsule_visatt );
481  }
482  else {
483  Capsule_logic =
484  new G4LogicalVolume(Capsule_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"),"PWCaps",0,0,0);
485 
486  Capsule_visatt = new G4VisAttributes( G4Colour(1, 1, 1, 0.5) );
487  Capsule_visatt->SetVisibility(true);
488  Capsule_logic->SetVisAttributes( Capsule_visatt );
489  }
490 
491  T.setX( 0.0 );
492  T.setY( 0.0 );
493  T.setZ( (InnerZ+OuterZ+caps_width+ExtraHousingBack)/2. + Shift);
494  new G4PVPlacement(0,T,Capsule_logic,"PwCaps",detlogicWorld,false,-1);
495 
496  // Air box in the capsule box to make it hollow
497 
498  G4Box * Air_solid = new G4Box("ShapePWAirBox",
499  InnerX/2.+eps_caps,
500  InnerY/2.+eps_caps,
501  (InnerZ+OuterZ+eps_caps+ExtraHousingBack)/2.);
502 
503  G4LogicalVolume *Air_logic =
504  new G4LogicalVolume(Air_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"),"PWAir",0,0,0);
505 
506  G4VisAttributes *Air_visatt = new G4VisAttributes( G4Colour(1, 1, 1, 0.5) );
507  Air_visatt->SetVisibility(true);
508  Air_logic->SetVisAttributes( Air_visatt );
509 
510  T.setX( 0.0 );
511  T.setY( 0.0 );
512  T.setZ( (caps_width-eps_caps)/2. );
513  new G4PVPlacement(0,T,Air_logic,"PwAir",Capsule_logic,false,-1);
514 
515  // Stage 0
516  G4Box *Inner_solid = new G4Box("ShapePW0", InnerX/2., InnerY/2., InnerZ/2.);
517  G4LogicalVolume *Inner_logic =
518  new G4LogicalVolume(Inner_solid, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matInner),"PWLV:0",0,0,0);
519  G4VisAttributes *Inner_visatt = new G4VisAttributes( G4Colour(0.0, 0.0, 1.0) );
520  Inner_visatt->SetVisibility(true);
521  Inner_logic->SetVisAttributes( Inner_visatt );
522  Inner_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
523 
524  T.setX( 0.0 );
525  T.setY( 0.0 );
526  //T.setZ( housing_width + caps_width + InnerZ / 2. );
527  //new G4PVPlacement(0,T,Inner_logic,"PW:0:",detlogicWorld,false,0);
528  T.setZ( (eps_caps-OuterZ-ExtraHousingBack)/2. );
529  new G4PVPlacement(0,T,Inner_logic,"PW:0:",Air_logic,false,0);
530 
531  // Stage 1
532  G4Box *Outer_solid = new G4Box("ShapePW1", OuterX/2., OuterY/2., OuterZ/2.);
533  G4LogicalVolume *Outer_logic =
534  new G4LogicalVolume(Outer_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matOuter), "PWLV:1",0,0,0);
535  G4VisAttributes *Outer_visatt = new G4VisAttributes( G4Colour(1.0, 0.0, 0.0) );
536  Outer_visatt->SetVisibility(true);
537  Outer_logic->SetVisAttributes( Outer_visatt );
538  Outer_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
539 
540  T.setX( 0.0 );
541  T.setY( 0.0 );
542  //T.setZ( housing_width + caps_width + InnerZ + OuterZ / 2. );
543  //new G4PVPlacement(0,T,Outer_logic,"PW:1:",detlogicWorld,false,1);
544  T.setZ( (eps_caps+InnerZ-ExtraHousingBack)/2. );
545  new G4PVPlacement(0,T,Outer_logic,"PW:1:",Air_logic,false,1);
546 
547  return theDetector;
548 }
549 */
550 
551 // PARIS phoswitch - Version 2
552 // capsule = polyhedra with a tap (box) in front
553 // cristals are attached to the world
554 
555 G4VPhysicalVolume *SToGS::ScintillatorDF::MakePPW(G4String detname, G4double caps_width, G4double housing_width, G4String opt)
556 {
557 // Note : housing_width is not used in this version
558 
559  G4VPhysicalVolume *theDetector = 0x0; G4LogicalVolume *detlogicWorld; G4Box *detWorld; G4bool do_caps = false, do_housing = false;
560  G4RotationMatrix R;
561  G4ThreeVector T;
562  G4Transform3D Tr;
563 
564  // Option
565  if ( caps_width != 0.0 ) {
566  if ( opt != "bare" ) {
567  do_caps = true;
568  }
569  }
570  if ( housing_width != 0.0 ) {
571  if ( opt != "bare" ) {
572  do_housing = true;
573  }
574  }
575 
576  // use a physical as a container to describe the detector
577  detWorld= new G4Box(detname,10.*CLHEP::cm,10.*CLHEP::cm,50.*CLHEP::cm);
578  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
579 
580  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
581  // Must place the World Physical volume unrotated at (0,0,0).
582  theDetector = new G4PVPlacement(0, // no rotation
583  G4ThreeVector(), // at (0,0,0)
584  detlogicWorld, // its logical volume
585  detname, // its name
586  0, // its mother volume
587  false, // no boolean operations
588  -1); // copy number
589 
590  // material for first and second layer
591  const char *matInner = "LaBr3", *matOuter = "NaI", *matCapsule = "Al"; // *matHousing = "Al";
592 
593  // full lenght in X,Y,Z
594  G4double
595  InnerX = 2*2.54*CLHEP::cm, InnerY = 2*2.54*CLHEP::cm, InnerZ = 2*2.54*CLHEP::cm,
596  OuterX = 2*2.54*CLHEP::cm, OuterY = 2*2.54*CLHEP::cm, OuterZ = 6*2.54*CLHEP::cm;
597  // in case of housing longer at the back of the PW
598  G4double
599  ExtraHousingBack = 20*CLHEP::mm,
600  eps_caps = 0.1*CLHEP::mm, //caps_width / 100., eps remove in the capsule part to avoid overlapping
601  Shift = 0.01*CLHEP::mm; // the detector entrance is not just at 0
602 
603  // Encapsulation Al if on, otherwise set as AIR ... useful to check overlapping
604 
605 /* G4Box *Capsule_solid = new G4Box("ShapePWCaps",
606  InnerX/2.+caps_width,
607  InnerY/2.+caps_width,
608  (InnerZ+OuterZ+caps_width+ExtraHousingBack)/2.);
609 */
610 
611  G4double zplane[2], rinner[2], router[2];
612 
613  zplane[0] = Shift+caps_width-eps_caps;
614  zplane[1] = Shift+caps_width+InnerZ+OuterZ+ExtraHousingBack;
615  rinner[0] = InnerX / 2. + eps_caps; rinner[1] = InnerX / 2. + eps_caps;
616  router[0] = InnerX / 2. + caps_width ; router[1] = InnerX / 2. + caps_width;
617 
618  G4Polyhedra *Capsule_solid = new G4Polyhedra("ShapePWCaps",
619  45.0*CLHEP::deg,360.0*CLHEP::deg,
620  4,2,zplane,rinner,router
621  );
622  G4Box *CapsTap_solid = new G4Box("ShapeCapsTap",
623  InnerX/2.+caps_width,
624  InnerY/2.+caps_width,
625  caps_width-eps_caps);
626 
627  G4LogicalVolume *Capsule_logic;
628  G4LogicalVolume *CapsTap_logic;
629  G4VisAttributes *Capsule_visatt;
630 
631  if ( do_caps ) {
632  Capsule_logic =
633  new G4LogicalVolume(Capsule_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matCapsule),"PWCaps",0,0,0);
634 
635  CapsTap_logic =
636  new G4LogicalVolume(CapsTap_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matCapsule),"PWCapsTaps",0,0,0);
637 
638  Capsule_visatt = new G4VisAttributes( G4Colour(0.8, 0.8, 0.8, 0.75) );
639  Capsule_visatt->SetVisibility(true);
640  Capsule_logic->SetVisAttributes( Capsule_visatt );
641  CapsTap_logic->SetVisAttributes( Capsule_visatt );
642  }
643  else {
644  Capsule_logic =
645  new G4LogicalVolume(Capsule_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"),"PWCaps",0,0,0);
646 
647  CapsTap_logic =
648  new G4LogicalVolume(CapsTap_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"),"PWCapsTaps",0,0,0);
649 
650  Capsule_visatt = new G4VisAttributes( G4Colour(1, 1, 1, 0.5) );
651  Capsule_visatt->SetVisibility(true);
652  Capsule_logic->SetVisAttributes( Capsule_visatt );
653  CapsTap_logic->SetVisAttributes( Capsule_visatt );
654  }
655 
656  T.setX( 0.0 );
657  T.setY( 0.0 );
658  T.setZ( 0.0 );
659  new G4PVPlacement(0,T,Capsule_logic,"PwCaps",detlogicWorld,false,-1);
660 
661  T.setZ( Shift+(caps_width-eps_caps)/2. );
662  new G4PVPlacement(0,T,CapsTap_logic,"PwCapsTaps",detlogicWorld,false,-1);
663 
664  // Stage 0
665  G4Box *Inner_solid = new G4Box("ShapePW0", InnerX/2., InnerY/2., InnerZ/2.);
666  G4LogicalVolume *Inner_logic =
667  new G4LogicalVolume(Inner_solid, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matInner),"PWLV:0",0,0,0);
668  G4VisAttributes *Inner_visatt = new G4VisAttributes( G4Colour(0.0, 0.0, 1.0) );
669  Inner_visatt->SetVisibility(true);
670  Inner_logic->SetVisAttributes( Inner_visatt );
671  Inner_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
672 
673  T.setX( 0.0 );
674  T.setY( 0.0 );
675  T.setZ( Shift + caps_width + InnerZ/2. );
676  new G4PVPlacement(0,T,Inner_logic,"PW:0:",detlogicWorld,false,0);
677 
678  // Stage 1
679  G4Box *Outer_solid = new G4Box("ShapePW1", OuterX/2., OuterY/2., OuterZ/2.);
680  G4LogicalVolume *Outer_logic =
681  new G4LogicalVolume(Outer_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matOuter), "PWLV:1",0,0,0);
682  G4VisAttributes *Outer_visatt = new G4VisAttributes( G4Colour(1.0, 0.0, 0.0) );
683  Outer_visatt->SetVisibility(true);
684  Outer_logic->SetVisAttributes( Outer_visatt );
685  Outer_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
686 
687  T.setX( 0.0 );
688  T.setY( 0.0 );
689  T.setZ( Shift + caps_width + InnerZ + OuterZ/2. );
690  new G4PVPlacement(0,T,Outer_logic,"PW:1:",detlogicWorld,false,1);
691 
692  return theDetector;
693 }
694 
695 
696 G4VPhysicalVolume *SToGS::ScintillatorDF::MakeCPPW(G4String detname, G4String opt)
697 {
698  G4VPhysicalVolume *theDetector = 0x0; G4LogicalVolume *detlogicWorld; G4Box *detWorld; G4double caps_width = 0.5*CLHEP::mm;
699  G4RotationMatrix R;
700  G4ThreeVector T;
701  G4Transform3D Tr;
702 
703  // Should be at the beginning before def of new theDetector
704  G4String base_element = "DetectorFactory/Scintillators/ParisPW_";
705  base_element += opt;
706 
707  G4VPhysicalVolume *a_pw = DetectorFactory::theMainFactory()->Get(base_element.data());
708  G4AssemblyVolume *assembly = DetectorFactory::theMainFactory()->GetAssembly(base_element.data());
709 
710  // use a physical as a container to describe the detector
711  detWorld= new G4Box(detname,20.*CLHEP::cm,20.*CLHEP::cm,25.*CLHEP::cm);
712  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
713 
714  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
715 
716  // Must place the World Physical volume unrotated at (0,0,0).
717  theDetector = new G4PVPlacement(0, // no rotation
718  G4ThreeVector(), // at (0,0,0)
719  detlogicWorld, // its logical volume
720  detname, // its name
721  0, // its mother volume
722  false, // no boolean operations
723  -1); // copy number
724 
725  if ( opt.contains("3") ) {
726  caps_width = 1.0*CLHEP::mm; // version 3 have PW with caps of 1 mm
727  }
728 
729  const G4double HalfInnerX = 2.54*CLHEP::cm + 1.001*caps_width, HalfInnerY = 2.54*CLHEP::cm + 1.001*caps_width; //
730 
731  G4double ShiftX[9];
732  G4double ShiftY[9];
733 
734  // different order ?
735  /*
736  ShiftX[0] = -2*(HalfInnerX); ShiftX[1] = -2*(HalfInnerX); ShiftX[2] = -2*(HalfInnerX);
737  ShiftX[3] = 0*(HalfInnerX); ShiftX[4] = 0*(HalfInnerX); ShiftX[5] = 0*(HalfInnerX);
738  ShiftX[6] = 2*(HalfInnerX); ShiftX[7] = 2*(HalfInnerX); ShiftX[8] = 2*(HalfInnerX);
739 
740  ShiftY[0] = -2*(HalfInnerY); ShiftY[1] = 0*(HalfInnerY); ShiftY[2] = 2*(HalfInnerY);
741  ShiftY[3] = -2*(HalfInnerY); ShiftY[4] = 0*(HalfInnerY); ShiftY[5] = 2*(HalfInnerY);
742  ShiftY[6] = -2*(HalfInnerY); ShiftY[7] = 0*(HalfInnerY); ShiftY[8] = 2*(HalfInnerY); */
743 
744  // 0 is center. then start top, left and turn clockwise .. to be done
745  // y z
746  // | /
747  // |/
748  // x----
749  //
750  ShiftX[0] = 0*(HalfInnerX); ShiftX[1] = +2*(HalfInnerX); ShiftX[2] = 0*(HalfInnerX);
751  ShiftX[3] = -2*(HalfInnerX); ShiftX[4] = -2*(HalfInnerX); ShiftX[5] = -2*(HalfInnerX);
752  ShiftX[6] = 0*(HalfInnerX); ShiftX[7] = 2*(HalfInnerX); ShiftX[8] = 2*(HalfInnerX);
753 
754  ShiftY[0] = 0*(HalfInnerY); ShiftY[1] = +2*(HalfInnerY); ShiftY[2] = 2*(HalfInnerY);
755  ShiftY[3] = 2*(HalfInnerY); ShiftY[4] = 0*(HalfInnerY); ShiftY[5] = -2*(HalfInnerY);
756  ShiftY[6] = -2*(HalfInnerY); ShiftY[7] = -2*(HalfInnerY); ShiftY[8] = 0*(HalfInnerY);
757 
758  // Add crystals Inner
759  for (G4int i = 0; i < 9; i++) {
760  T.setX( ShiftX[i] );
761  T.setY( ShiftY[i] );
762  T.setZ( 0 );
763  assembly->MakeImprint( detlogicWorld, T, &R );
764  }
765  // remap assembly
766  DoMap(assembly,a_pw,SToGS::DetectorFactory::GetGCopyNb());
767 
768  return theDetector;
769 }
770 
771 G4VPhysicalVolume *SToGS::ScintillatorDF::MakeFATIMAM(G4String detname, G4String opt)
772 {
773  // Note : housing_width is not used in this version
774 
775  G4VPhysicalVolume *theDetector = 0x0; G4LogicalVolume *detlogicWorld; G4Box *detWorld; G4bool do_caps = true; // do_housing = false;
776  G4RotationMatrix R;
777  G4ThreeVector T;
778  G4Transform3D Tr;
779 
780  // use a physical as a container to describe the detector
781  detWorld= new G4Box(detname,10.*CLHEP::cm,10.*CLHEP::cm,50.*CLHEP::cm);
782  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
783 
784  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
785  // Must place the World Physical volume unrotated at (0,0,0).
786  theDetector = new G4PVPlacement(0, // no rotation
787  G4ThreeVector(), // at (0,0,0)
788  detlogicWorld, // its logical volume
789  detname, // its name
790  0, // its mother volume
791  false, // no boolean operations
792  -1); // copy number
793 
794  // material for first and second layer
795  G4String matPMT = "Al", matShielding = "Pb", matWindow = "SToGS_Quartz", matSD = "LaBr3";
796  if ( opt.contains("bare") ) {
797  matPMT = "AIR";
798  matShielding = "AIR";
799  matWindow = "AIR";
800 
801  do_caps = false;
802  }
803 
804  // those numbers have been extracted from the AGATA code / Geometry of FATIMA implemented by M. Labiche, re-
805  const double Labr_Length = 45.75*CLHEP::mm; //length of the crystal (+5mm = 2inch)
806  const double Labr_Rad = 19.0*CLHEP::mm; //radius of the crystal (*2 = 1.5 inch)
807  const double Window_Length = 5.0*CLHEP::mm; //quartz window length behind LaBr crystal
808 
809  // to build the Al housing and lead shielding
810  G4double zPlane1[16] =
811  {0.0*CLHEP::mm,1.0*CLHEP::mm,1.0*CLHEP::mm,1.5*CLHEP::mm,1.5*CLHEP::mm,46.0*CLHEP::mm,46.0*CLHEP::mm,56.0*CLHEP::mm,
812  56.0*CLHEP::mm,71.0*CLHEP::mm,71.0*CLHEP::mm,244.3*CLHEP::mm,244.3*CLHEP::mm,260.8*CLHEP::mm,260.8*CLHEP::mm,263.3*CLHEP::mm};
813  G4double rInner1[16] =
814  {19.0*CLHEP::mm,19.0*CLHEP::mm,0.0*CLHEP::mm,0.0*CLHEP::mm,Labr_Rad,Labr_Rad,Labr_Rad,Labr_Rad,
815  32.0*CLHEP::mm,32.0*CLHEP::mm,32.0*CLHEP::mm,32.0*CLHEP::mm,32.0*CLHEP::mm,32.0*CLHEP::mm, 0.0*CLHEP::mm,0.0*CLHEP::mm};
816  G4double rOuter1[16] =
817  {22.75*CLHEP::mm,22.75*CLHEP::mm,22.75*CLHEP::mm,22.75*CLHEP::mm,22.75*CLHEP::mm,22.75*CLHEP::mm,37.5*CLHEP::mm,37.5*CLHEP::mm,
818  37.5*CLHEP::mm,37.5*CLHEP::mm,35.0*CLHEP::mm,35.0*CLHEP::mm,37.5*CLHEP::mm,37.5*CLHEP::mm,37.5*CLHEP::mm,35.5*CLHEP::mm};
819 
820  G4Polycone *solid_PMT = new G4Polycone("ShapeFATIMAPMT", 0.0, 360.*CLHEP::deg, 16, zPlane1 ,rInner1, rOuter1);
821  G4LogicalVolume *logicPMT = new G4LogicalVolume( solid_PMT, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matPMT), "FATIMAPMTLV", 0, 0, 0 );
822 
823  // to build the Lead shielding
824  G4double zPlane2[5] = {0.0*CLHEP::mm , 2.0*CLHEP::mm, 40.0*CLHEP::mm, 40.0*CLHEP::mm, 46.0*CLHEP::mm};
825  G4double rInner2[5] = {22.8*CLHEP::mm , 22.8*CLHEP::mm, 22.8*CLHEP::mm, 22.8*CLHEP::mm, 22.8*CLHEP::mm};
826  G4double rOuter2[5] = {25.75*CLHEP::mm, 27.75*CLHEP::mm, 27.75*CLHEP::mm, 37.5*CLHEP::mm, 37.5*CLHEP::mm};
827  G4Polycone *solid_Shielding = new G4Polycone("ShapeFATIMAShielding", 0.0, 360.*CLHEP::deg, 5, zPlane2 ,rInner2, rOuter2);
828  G4LogicalVolume *logicShielding = new G4LogicalVolume( solid_Shielding, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matShielding), "FATIMAShieldingLV", 0, 0, 0 );
829 
830  //Building the LaBr3 crystal + window:
831  G4Tubs *solid_Scintillator = new G4Tubs("ShapeFATIMAScintillator", 0.0*CLHEP::mm, Labr_Rad, Labr_Length/2 ,0, 360.*CLHEP::deg);
832  G4LogicalVolume *logicScintillator = new G4LogicalVolume( solid_Scintillator, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matSD), "FATIMAScintillatorLV", 0, 0, 0 );
833 
834  G4Tubs *solid_Window = new G4Tubs("ShapeFATIMAWindow", 0.0*CLHEP::mm, Labr_Rad, Window_Length/2 ,0, 360.*CLHEP::deg);
835  G4LogicalVolume *logicWindow = new G4LogicalVolume( solid_Window, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matWindow), "FATIMAWindowLV", 0, 0, 0 );
836 
837  G4VisAttributes *visatt;
838 
839  T.setX( 0.0 );
840  T.setY( 0.0 );
841  T.setZ( 0.0 );
842  if ( do_caps ) {
843  visatt = new G4VisAttributes( G4Colour(0.0, 1.0, 1.0, 0.75) );
844  visatt->SetVisibility(true);
845  logicPMT->SetVisAttributes( visatt );
846  }
847  else {
848  visatt = new G4VisAttributes( G4Colour(1.0, 1.0, 1.0, 0.5) );
849  visatt->SetVisibility(true);
850  logicPMT->SetVisAttributes( visatt );
851  }
852  new G4PVPlacement(0,T,logicPMT,"PMT",detlogicWorld,false,-1);
853 
854  T.setX( 0.0 );
855  T.setY( 0.0 );
856  T.setZ( 0.0 );
857  if ( do_caps ) {
858  visatt = new G4VisAttributes( G4Colour(1.0, 1.0, 0.0, 0.75) );
859  visatt->SetVisibility(true);
860  logicShielding->SetVisAttributes( visatt );
861  }
862  else {
863  visatt = new G4VisAttributes( G4Colour(1.0, 1.0, 1.0, 0.5) );
864  visatt->SetVisibility(true);
865  logicShielding->SetVisAttributes( visatt );
866  }
867  new G4PVPlacement(0,T,logicShielding,"Shield",detlogicWorld,false,-1);
868 
869  T.setX( 0.0 );
870  T.setY( 0.0 );
871  T.setZ( 2.*CLHEP::mm + Labr_Length/2. );
872 
873  visatt = new G4VisAttributes( G4Colour(0.0, 1.0, 0.0, 1) );
874  visatt->SetVisibility(true);
875  logicScintillator->SetVisAttributes( visatt );
876  logicScintillator->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
877  new G4PVPlacement(0,T,logicScintillator,"Sensor",detlogicWorld,false,0);
878 
879  T.setX( 0.0 );
880  T.setY( 0.0 );
881  T.setZ( 2.*CLHEP::mm + Labr_Length + Window_Length/2. );
882  if ( do_caps ) {
883  visatt = new G4VisAttributes( G4Colour(0.0, 0.0, 1.0, 0.75) );
884  visatt->SetVisibility(true);
885  logicWindow->SetVisAttributes( visatt );
886  }
887  else {
888  visatt = new G4VisAttributes( G4Colour(1.0, 1.0, 1.0, 0.5) );
889  visatt->SetVisibility(true);
890  logicWindow->SetVisAttributes( visatt );
891  }
892  new G4PVPlacement(0,T,logicWindow,"Window",detlogicWorld,false,-1);
893 
894 
895  return theDetector;
896 }
897 
898 
899 G4VPhysicalVolume *SToGS::ScintillatorDF::MakeFATIMAQ(G4String detname, G4String opt)
900 {
901 
902  G4VPhysicalVolume *theDetector = 0x0; G4LogicalVolume *detlogicWorld; G4Box *detWorld;
903  G4RotationMatrix R;
904  G4ThreeVector T;
905 
906  // Should be at the beginning before def of new theDetector
907  G4String base_element = "DetectorFactory/Scintillators/FATIMAM";
908  if ( opt.size() ) {
909  base_element += "_";
910  base_element += opt;
911  }
912 
913  G4VPhysicalVolume *a_it = DetectorFactory::theMainFactory()->Get(base_element.data());
914  G4AssemblyVolume *assembly = DetectorFactory::theMainFactory()->GetAssembly(base_element.data());
915 
916  // use a physical as a container to describe the detector
917  detWorld= new G4Box(detname,10.*CLHEP::cm,10.*CLHEP::cm,25.*CLHEP::cm);
918  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
919 
920  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
921 
922  // Must place the World Physical volume unrotated at (0,0,0).
923  theDetector = new G4PVPlacement(0, // no rotation
924  G4ThreeVector(), // at (0,0,0)
925  detlogicWorld, // its logical volume
926  detname, // its name
927  0, // its mother volume
928  false, // no boolean operations
929  -1); // copy number
930 
931  T.setX( +37.5*CLHEP::mm );
932  T.setY( +37.5*CLHEP::mm );
933  T.setZ( 0.0 );
934  assembly->MakeImprint( detlogicWorld, T, &R);
935  T.setX( +37.5*CLHEP::mm );
936  T.setY( -37.5*CLHEP::mm );
937  T.setZ( 0.0 );
938  assembly->MakeImprint( detlogicWorld, T, &R);
939  T.setX( -37.5*CLHEP::mm );
940  T.setY( +37.5*CLHEP::mm );
941  T.setZ( 0.0 );
942  assembly->MakeImprint( detlogicWorld, T, &R);
943  T.setX( -37.5*CLHEP::mm );
944  T.setY( -37.5*CLHEP::mm );
945  T.setZ( 0.0 );
946  assembly->MakeImprint( detlogicWorld, T, &R);
947 
948  // remap assembly
949  DoMap(assembly,a_it,SToGS::DetectorFactory::GetGCopyNb());
950 
951  return theDetector;
952 }
953 
954 
955 
956 G4VPhysicalVolume *SToGS::ScintillatorDF::MakeEDEN(G4String detname, G4double caps_width, G4double extra_back, G4String opt)
957 {
958  G4VPhysicalVolume *theDetector = 0x0;
959  G4LogicalVolume *detlogicWorld;
960  G4Box *detWorld;
961  G4ThreeVector T;
962 
963  // WORLD //
964 
965  // use a physical as a container to describe the detector
966  detWorld= new G4Box(detname,10.*CLHEP::cm,10.*CLHEP::cm,50.*CLHEP::cm);
967  detlogicWorld= new G4LogicalVolume(detWorld, SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial("AIR"), detname, 0, 0, 0);
968 
969  detlogicWorld->SetVisAttributes(G4VisAttributes::Invisible); // hide the world
970  // Must place the World Physical volume unrotated at (0,0,0).
971  theDetector = new G4PVPlacement(0, // no rotation
972  G4ThreeVector(), // at (0,0,0)
973  detlogicWorld, // its logical volume
974  detname, // its name
975  0, // its mother volume
976  false, // no boolean operations
977  -1); // copy number
978 
979  // EDEN //
980 
981  // material
982  // version "v0"
983  const char
984  *matScint = "XYLENE",
985  *matCapsule = "STAINLESS-STEEL",
986  *matBack1 = "GLASS_PLATE", // Other possible options : air, vacuum, wet-air
987  *matBack2 = "AIR"; // Other possible options : vacuum, wet-air
988 
989  // Sizes given in literature and fixed arbitrary quantities
990  G4double
991  r_cell = 10.*CLHEP::cm, //[Lau93]
992  h_cell = 5.*CLHEP::cm, //[Lau93]
993  front_width = 0.2*CLHEP::mm, //[Lau93]
994  glass_width = 6.*CLHEP::mm, //[Lau93]
995  eps = 0.1*CLHEP::mm, // Fixed distance at interfaces between materials
996  Shift = 0.01*CLHEP::mm; // the detector entrance is not just at 0
997 
998  // version "v0"
999  // Scintillator = cylindre, xylene
1000  // Capsule = tube, steel
1001  // Front = cylindre, steel
1002  // Back1 = cylindre, glass
1003  // Back2 = cylindre, air
1004 
1005  //Sizes used to define the shapes
1006  G4double
1007  // scintillator
1008  r_scint = r_cell,
1009  h_scint = h_cell,
1010  // capsule tube
1011  rint_caps = r_scint + eps,
1012  rext_caps = r_scint + caps_width,
1013  h_caps = h_scint + glass_width + 2.*eps + extra_back,
1014  // capsule front
1015  r_front = rext_caps,
1016  h_front = front_width,
1017  // back
1018  r_back = r_scint,
1019  h_back1 = glass_width,
1020  h_back2 = h_caps - h_scint - h_back1 - 2.*eps;
1021 
1022  G4Tubs * Scint_solid = new G4Tubs("ShapeEDENscint",0.*CLHEP::mm,r_scint,h_scint/2.,0.*CLHEP::deg,360.*CLHEP::deg);
1023 
1024  G4Tubs * Caps_solid = new G4Tubs("ShapeEDENcaps",rint_caps,rext_caps,h_caps/2.,0.*CLHEP::deg,360.*CLHEP::deg);
1025 
1026  G4Tubs * CapsFront_solid = new G4Tubs("ShapeEDENcapsfront",0.*CLHEP::mm,r_front,h_front/2.,0.*CLHEP::deg,360.*CLHEP::deg);
1027 
1028  G4Tubs * Back1_solid = new G4Tubs("ShapeEDENback1",0.*CLHEP::mm,r_back,h_back1/2.,0.*CLHEP::deg,360.*CLHEP::deg);
1029 
1030  G4Tubs * Back2_solid = new G4Tubs("ShapeEDENback2",0.*CLHEP::mm,r_back,h_back2/2.,0.*CLHEP::deg,360.*CLHEP::deg);
1031 
1032  // Logical volumes
1033 
1034  G4LogicalVolume *Scint_logic = new G4LogicalVolume(Scint_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matScint),"EDENscint",0,0,0);
1035 
1036  G4LogicalVolume *Caps_logic = new G4LogicalVolume(Caps_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matCapsule),"EDENcaps",0,0,0);
1037 
1038  G4LogicalVolume *CapsFront_logic = new G4LogicalVolume(CapsFront_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matCapsule),"EDENcapsfront",0,0,0);
1039 
1040  G4LogicalVolume *Back1_logic = new G4LogicalVolume(Back1_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matBack1),"EDENback1",0,0,0);
1041 
1042  G4LogicalVolume *Back2_logic = new G4LogicalVolume(Back2_solid,SToGS::MaterialConsultant::theConsultant()->FindOrBuildMaterial(matBack2),"EDENback2",0,0,0);
1043 
1044 
1045  // Visual attributes
1046 
1047  G4VisAttributes *Scint_visatt = new G4VisAttributes( G4Colour(0.0, 1.0, 0.0) );
1048  Scint_visatt->SetVisibility(true);
1049  Scint_logic->SetVisAttributes( Scint_visatt );
1050 
1051  G4VisAttributes *Capsule_visatt = new G4VisAttributes( G4Colour(0.8, 0.8, 0.8, 0.75) );
1052  Capsule_visatt->SetVisibility(true);
1053  Caps_logic->SetVisAttributes( Capsule_visatt );
1054  CapsFront_logic->SetVisAttributes( Capsule_visatt );
1055 
1056  G4VisAttributes *Back1_visatt = new G4VisAttributes( G4Colour(0.0, 0.0, 1.0, 0.5) );
1057  Back1_visatt->SetVisibility(true);
1058  Back1_logic->SetVisAttributes( Back1_visatt );
1059 
1060  G4VisAttributes *Back2_visatt = new G4VisAttributes( G4Colour(0.0, 0.0, 1.0, 0.25) );
1061  Back2_visatt->SetVisibility(true);
1062  Back2_logic->SetVisAttributes( Back2_visatt );
1063 
1064 
1065  // Placements
1066 
1067  T.setX( 0.0 );
1068  T.setY( 0.0 );
1069 
1070  if(opt=="v0")
1071  {
1072  T.setZ( Shift + h_front/2. );
1073  new G4PVPlacement(0,T,CapsFront_logic,"EdenCapsFront",detlogicWorld,false,-1);
1074 
1075  T.setZ( Shift + h_front + eps + h_scint/2. );
1076  new G4PVPlacement(0,T,Scint_logic,"EdenScint",detlogicWorld,false,0);
1077 
1078  T.setZ( Shift + h_front + eps + h_scint + eps + h_back1/2.);
1079  new G4PVPlacement(0,T,Back1_logic,"EdenBack1",detlogicWorld,false,-1);
1080 
1081  T.setZ( Shift + h_front + eps + h_scint + eps + h_back1 + eps + h_back2/2.);
1082  new G4PVPlacement(0,T,Back2_logic,"EdenBack2",detlogicWorld,false,-1);
1083 
1084  T.setZ( Shift + h_front + eps + h_caps/2.);
1085  new G4PVPlacement(0,T,Caps_logic,"EdenCaps",detlogicWorld,false,-1);
1086  }
1087  else if(opt=="bare")
1088  {
1089  T.setZ( Shift + h_front + eps + h_scint/2. );
1090  new G4PVPlacement(0,T,Scint_logic,"EdenScint",detlogicWorld,false,0);
1091  }
1092 
1093  // Sensitivity
1094 
1095  // Scint_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetCopClusterSD() );
1096  Scint_logic->SetSensitiveDetector( SToGS::UserActionInitialization::GetTrackerSD() );
1097 
1098  return theDetector;
1099 }
1100 
Base classe to build scintillators.
void MakeInStore(G4String name, G4String version_string)
build in store a particular detector from its names and version. i.e. call th Make method of the sub ...
G4VPhysicalVolume * MakeCdC(G4String detname, G4String opt="bare")
virtual G4VPhysicalVolume * Get(G4String basename)
search for a detector in DetectorFactory
G4VPhysicalVolume * MakeFATIMAQ(G4String detname, G4String opt="bare")
static DetectorFactory * theMainFactory()
to get the main factory
static G4int SetGCopyNb(G4int val)
G4VPhysicalVolume * MakeCPPW(G4String detname, G4String opt="bare")
static G4VSensitiveDetector * GetCopClusterSD(G4String name="/SToGS/SD/CopCluster")
to get a general SToGS Calorimeter. In Multi-threading mode, return a new instance otherwise a global...
virtual void MakeStore()
build the default store i.e. all the scintillators detectors.
G4VPhysicalVolume * MakeFATIMAM(G4String detname, G4String opt="bare")
static G4VSensitiveDetector * GetTrackerSD(G4String name="/SToGS/SD/Tracker")
to get a general SToGS tracker. In Multi-threading mode, return a new instance otherwise a global one...
G4VPhysicalVolume * MakeEDEN(G4String detname, G4double caps_width=0.0, G4double extra_back=0.0, G4String opt="v0")
G4VPhysicalVolume * MakePPW(G4String detname, G4double caps_width=0.0, G4double housing_width=0.0, G4String opt="bare")
virtual G4VPhysicalVolume * Make(G4String, G4String)
Should be implemented in any sub factory. It built (C++) a detector and return it.
G4AssemblyVolume * GetAssembly(G4String basename)