Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/eFLASH_radiotherapy/src/FlashApplicator.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  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 // This is the first version of Flash, a Geant4-based application
 27 //
 28 //
 29 //////////////////////////////////////////////////////////////////////////////////////////////
 30 
 31 #include "FlashApplicator.hh"
 32 #include "FlashDetectorConstruction.hh"
 33 #include "G4Box.hh"
 34 #include "G4Colour.hh"
 35 #include "G4Cons.hh"
 36 #include "G4LogicalVolume.hh"
 37 #include "G4NistElementBuilder.hh"
 38 #include "G4NistManager.hh"
 39 #include "G4PVPlacement.hh"
 40 #include "G4RotationMatrix.hh"
 41 #include "G4RunManager.hh"
 42 #include "G4SubtractionSolid.hh"
 43 #include "G4SystemOfUnits.hh"
 44 #include "G4Tubs.hh"
 45 #include "G4VisAttributes.hh"
 46 #include "globals.hh"
 47 
 48 FlashApplicator::FlashApplicator(G4VPhysicalVolume *physicalTreatmentRoom)
 49     : fMotherPhys(physicalTreatmentRoom),
 50 
 51       
 52       solidFTFlash(0), physiFTFlash(0) {
 53   ConstructCollimator(fMotherPhys);
 54 
 55 
 56   
 57 }
 58 
 59 FlashApplicator::~FlashApplicator() {}
 60 
 61 void FlashApplicator::ConstructCollimator(G4VPhysicalVolume *) {
 62   // Sets default geometry and materials
 63   SetDefaultDimensions();
 64    SetOuterRadius(55*mm);
 65    SetApplicatorLength(365*mm);
 66   // Construct the whole Applicator Beam Line
 67   ConstructApplicator();
 68 }
 69 
 70 void FlashApplicator::SetDefaultDimensions() {
 71 
 72   white = new G4VisAttributes(G4Colour());
 73   white->SetVisibility(true);
 74 
 75   blue = new G4VisAttributes(G4Colour(0., 0., 1.));
 76   blue->SetVisibility(true);
 77 
 78   gray = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5));
 79   gray->SetVisibility(true);
 80 
 81   red = new G4VisAttributes(G4Colour(1., 0., 0.));
 82   red->SetVisibility(true);
 83 
 84   yellow = new G4VisAttributes(G4Colour(1., 1., 0.));
 85   yellow->SetVisibility(true);
 86 
 87   green = new G4VisAttributes(G4Colour(25 / 255., 255 / 255., 25 / 255.));
 88   green->SetVisibility(true);
 89 
 90   darkGreen = new G4VisAttributes(G4Colour(0 / 255., 100 / 255., 0 / 255.));
 91   darkGreen->SetVisibility(true);
 92 
 93   darkOrange3 =
 94       new G4VisAttributes(G4Colour(205 / 255., 102 / 255., 000 / 255.));
 95   darkOrange3->SetVisibility(true);
 96 
 97   skyBlue = new G4VisAttributes(G4Colour(135 / 255., 206 / 255., 235 / 255.));
 98   skyBlue->SetVisibility(true);
 99 
100   magenta = new G4VisAttributes(G4Colour(255 / 255., 0 / 255., 255 / 255.));
101   magenta->SetVisibility(true);
102 
103   
104   fInitial_pos = -113*cm; //set the same position in FlashPrimaryGeneratorAction.cc
105   // Geometry  APPLICATOR DEFAULTS
106 
107  
108 
109   G4double defaultinnerRadiusFirstApplicatorFlash =
110       fOuterRadiusFirstApplicatorFlash - 5. * mm;
111    fInnerRadiusFirstApplicatorFlash = defaultinnerRadiusFirstApplicatorFlash;
112 
113   // DEFAULT DEFINITION OF THE MATERIALS
114 
115   // ELEMENTS
116   G4double density;
117   G4int ncomponents;
118   G4bool isotopes = false;
119   aluminumNist =
120       G4NistManager::Instance()->FindOrBuildMaterial("G4_Al", isotopes);
121 
122 
123   Fe = G4NistManager::Instance()->FindOrBuildMaterial("G4_Fe");
124     
125   PVDF = new G4Material("PVDF",  density=1780 *kg/m3,  ncomponents=3);
126   
127   
128   
129   PVDF->AddElement(G4NistManager::Instance()->FindOrBuildElement("C"), 34 * perCent);
130   PVDF->AddElement(G4NistManager::Instance()->FindOrBuildElement("H"), 33 * perCent);
131   PVDF->AddElement(G4NistManager::Instance()->FindOrBuildElement("F"), 33 * perCent);
132 
133   
134   
135   FILM= new G4Material("FILM", density=1430 *kg/m3, ncomponents = 4);
136   
137   FILM->AddElement(G4NistManager::Instance()->FindOrBuildElement("C"), 69 * perCent);
138   FILM->AddElement(G4NistManager::Instance()->FindOrBuildElement("H"), 3 * perCent);
139   FILM->AddElement(G4NistManager::Instance()->FindOrBuildElement("N"), 7 * perCent);
140   FILM->AddElement(G4NistManager::Instance()->FindOrBuildElement("O"), 21 * perCent);
141   
142 
143 
144 
145   G4Material *galacticNist =
146       G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic", isotopes);
147   PMMA =
148       G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS", isotopes);
149 
150   G4Material *titanioNist =
151       G4NistManager::Instance()->FindOrBuildMaterial("G4_Ti", isotopes);
152 
153 
154   // MATERIAL ASSIGNMENT
155 
156   // Material of the APPLICATOR Flash
157   fFirstApplicatorMaterialFlash = PMMA;
158  
159   // Titanium window
160   FTFlashMaterialFlash = titanioNist;
161 
162   // Vacuum Source
163   VSFlashMaterialFlash = galacticNist;
164 }
165 
166 void FlashApplicator::ConstructApplicator() {
167 
168   // Components of the Applicator
169 
170   FlashBeamLineVacuumSource();
171   FlashBeamLineTitaniumWindows();
172   FlashVWAlcover();
173   FlashAlCover2();
174   FlashExitBit();
175   FlashToroid();
176   OverCover();
177 
178   MonitorChamber();
179   Flash_connector();
180   Bigconnector();
181   Bigconnector2();
182   FlashBeamLineApplicator();//modify this function for applicator lenght
183 
184 
185  
186 }
187 
188 void FlashApplicator::FlashBeamLineVacuumSource() {
189   // ---------------------------------------------------------------//
190   //                     Vacuum Source                             //
191   // ---------------------------------------------------------------//
192 
193   G4double phi1 = 90. * deg;
194 
195   G4RotationMatrix rm1;
196   rm1.rotateY(phi1);
197 
198   fOutRadiusVSFlash = 20 * mm;
199   const G4double innRadiusVSFlash = 0. * mm;
200    fHightVSFlash = 8 * mm;
201   const G4double startAngleVSFlash = 0. * deg;
202   const G4double spanningAngleVSFlash = 360. * deg;
203   fXPositionVSFlash = fInitial_pos-fHightVSFlash-0.055/2*mm; //0.055 is titanium window
204 
205   solidVSFlash =
206       new G4Tubs("VSFlash", innRadiusVSFlash, fOutRadiusVSFlash, fHightVSFlash,
207                  startAngleVSFlash, spanningAngleVSFlash);
208 
209   G4LogicalVolume *logVSFlash = new G4LogicalVolume(
210       solidVSFlash, VSFlashMaterialFlash, "VSFlash", 0, 0, 0);
211 
212   physiVSFlash = new G4PVPlacement(
213       G4Transform3D(rm1, G4ThreeVector((fXPositionVSFlash), 0., 0.)), "VSFlash",
214       logVSFlash, fMotherPhys, false, 0);
215 
216   logVSFlash->SetVisAttributes(green);
217 }
218 
219 void FlashApplicator::FlashBeamLineTitaniumWindows() {
220   // ---------------------------------------------------------------//
221   //                     Titanium Window                        //
222   // ---------------------------------------------------------------//
223   // with just this piece ssd=1.6cm
224   G4double phi2 = 90. * deg;
225 
226   G4RotationMatrix rm2;
227   rm2.rotateY(phi2);
228 
229    fOutRadiusFTFlash = fOutRadiusVSFlash;
230   const G4double innRadiusFTFlash = 19 * mm;
231    fHightFTFlash = 0.055/2 * mm;
232   const G4double startAngleFTFlash = 0. * deg;
233   const G4double spanningAngleFTFlash = 360. * deg;
234   const G4double XPositionFTFlash = fInitial_pos ;
235 
236   solidFTFlash =
237       new G4Tubs("FTFlash", innRadiusFTFlash, fOutRadiusFTFlash, fHightFTFlash,
238                  startAngleFTFlash, spanningAngleFTFlash);
239 
240   G4LogicalVolume *logFTFlash = new G4LogicalVolume(
241       solidFTFlash, FTFlashMaterialFlash, "FTFlash", 0, 0, 0);
242 
243   physiFTFlash = new G4PVPlacement(
244       G4Transform3D(rm2, G4ThreeVector((XPositionFTFlash), 0., 0.)), "FTFlash",
245       logFTFlash, fMotherPhys, false, 0);
246 
247   logFTFlash->SetVisAttributes(yellow);
248 }
249 void FlashApplicator::FlashVWAlcover(){
250 
251  G4double phi2 = 90. * deg;
252 
253   G4RotationMatrix rm2;
254   rm2.rotateY(phi2);
255 
256 
257   const G4double innRadius = fOutRadiusVSFlash;
258     fOutRadius = innRadius+8*mm;
259   const G4double hight = fHightVSFlash;
260   const G4double startAngle = 0. * deg;
261   const G4double spanningAngle = 360. * deg;
262   const G4double XPosition = fXPositionVSFlash ;
263 
264    G4VSolid * solid =
265       new G4Tubs("cover1", innRadius, fOutRadius, hight,
266                  startAngle, spanningAngle);
267 
268   G4LogicalVolume *log = new G4LogicalVolume(
269       solid, aluminumNist, "cover1log", 0, 0, 0);
270 
271  new G4PVPlacement(
272       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "cover1phys",
273       log, fMotherPhys, false, 0);
274 
275   log->SetVisAttributes(white);
276 
277 
278 }
279 void FlashApplicator::FlashAlCover2(){
280 
281 G4double phi2 = 90. * deg;
282 
283   G4RotationMatrix rm2;
284   rm2.rotateY(phi2);
285 
286   
287   const G4double innRadius = fOutRadiusVSFlash;
288 
289   const G4double hight = fHightVSFlash+fHightFTFlash;
290   const G4double startAngle = 0. * deg;
291   const G4double spanningAngle = 360. * deg;
292   const G4double XPosition = fInitial_pos+hight+fHightFTFlash;
293 
294    G4VSolid * solid =
295       new G4Tubs("cover1", innRadius, fOutRadius, hight,
296                  startAngle, spanningAngle);
297 
298   G4LogicalVolume *log = new G4LogicalVolume(
299       solid, aluminumNist, "cover1log", 0, 0, 0);
300 
301 new G4PVPlacement(
302       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "cover1phys",
303       log, fMotherPhys, false, 0);
304 
305   log->SetVisAttributes(red);
306   
307   fInitial_pos=fInitial_pos + fHightFTFlash;
308 }
309 void FlashApplicator::FlashExitBit(){
310 
311 G4double phi2 = 90. * deg;
312 
313   G4RotationMatrix rm2;
314   rm2.rotateY(phi2);
315 
316   
317   const G4double innRadius = 0*mm;
318   fOutRadius = fOutRadiusVSFlash;
319   const G4double hight = 16/2*mm;
320   const G4double startAngle = 0. * deg;
321   const G4double spanningAngle = 360. * deg;
322   const G4double XPosition = fInitial_pos+hight;
323 
324 
325     G4VSolid *t1 = new G4Tubs("t1", innRadius, fOutRadius, hight,
326                  startAngle, spanningAngle);
327                              
328     G4VSolid *t2 = new G4Cons("t2", 0*mm,13/2*mm, 0*mm,38/2*mm,16.1/2*mm, startAngle,spanningAngle);
329     
330     G4RotationMatrix rotm_t2 = G4RotationMatrix();
331     rotm_t2.rotateX(0 * deg);
332     G4ThreeVector zTrans(0, 0, 0);
333 
334     G4SubtractionSolid *hollowcover =
335         new G4SubtractionSolid("hollowcover_log", t1, t2, 0, zTrans);
336 
337     
338     G4LogicalVolume *logic =
339         new G4LogicalVolume(hollowcover, aluminumNist, "hollowcover", 0, 0, 0);
340         
341     new G4PVPlacement(
342       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "cover1phys",
343       logic, fMotherPhys, false, 0);
344 
345   logic->SetVisAttributes(darkOrange3);
346 fInitial_pos=XPosition+hight;
347 }
348 void FlashApplicator::FlashToroid(){
349 
350 G4double phi2 = 90. * deg;
351 
352   G4RotationMatrix rm2;
353   rm2.rotateY(phi2);
354 
355   
356   const G4double innRadius = 50.8/2*mm;
357  fToroid_outRadius = innRadius + 45*mm;
358   fToroid_hight = 50.8/2*mm;
359   const G4double startAngle = 0. * deg;
360   const G4double spanningAngle = 360. * deg;
361   fToroid_XPosition = fInitial_pos+fToroid_hight + 8*mm;
362 
363    G4VSolid * solid =
364       new G4Tubs("toroid", innRadius, fToroid_outRadius, fToroid_hight,
365                  startAngle, spanningAngle);
366 
367   G4LogicalVolume *log = new G4LogicalVolume(
368       solid, Fe, "toroidlog", 0, 0, 0);
369 
370   new G4PVPlacement(
371       G4Transform3D(rm2, G4ThreeVector((fToroid_XPosition), 0., 0.)), "toroidphys",
372       log, fMotherPhys, false, 0);
373 
374   log->SetVisAttributes(blue);
375 
376 fInitial_pos=fToroid_XPosition+fToroid_hight;
377 }
378 void FlashApplicator::OverCover(){
379 
380 G4double phi2 = 90. * deg;
381 
382   G4RotationMatrix rm2;
383   rm2.rotateY(phi2);
384 
385   
386   const G4double innRadius = fOutRadius;
387   const G4double out_Radius = 5*fOutRadius ;
388   fBigcover_hight = 7.5*mm;
389   const G4double startAngle = 0. * deg;
390   const G4double spanningAngle = 360. * deg;
391    fBigcover_XPosition = fXPositionVSFlash - fHightVSFlash+fBigcover_hight;
392 
393    G4VSolid * solid =
394       new G4Tubs("coverbig", innRadius, out_Radius, fBigcover_hight,
395                  startAngle, spanningAngle);
396 
397   G4LogicalVolume *log = new G4LogicalVolume(
398       solid, aluminumNist, "coverbig_log", 0, 0, 0);
399 
400   new G4PVPlacement(
401       G4Transform3D(rm2, G4ThreeVector((fBigcover_XPosition), 0., 0.)), "coverbig_phys",
402       log, fMotherPhys, false, 0);
403 
404   log->SetVisAttributes(skyBlue);
405   
406   
407   const G4double innRadius_2 = fToroid_outRadius;
408   const G4double out_Radius_2 = innRadius_2 + 1.2*cm ;
409   const G4double fBigcover_hight_2 = 30*mm;
410   const G4double startAngle_2 = 0. * deg;
411   const G4double spanningAngle_2 = 360. * deg;
412    const double fBigcover_XPosition_2 = fBigcover_XPosition+fBigcover_hight_2+fBigcover_hight;
413 
414    G4VSolid * solid_2 =
415       new G4Tubs("coverbig_2", innRadius_2, out_Radius_2, fBigcover_hight_2,
416                  startAngle_2, spanningAngle_2);
417 
418   G4LogicalVolume *log_2 = new G4LogicalVolume(
419       solid_2, aluminumNist, "coverbig_log", 0, 0, 0);
420 
421   new G4PVPlacement(
422       G4Transform3D(rm2, G4ThreeVector((fBigcover_XPosition_2), 0., 0.)), "coverbig_phys",
423       log_2, fMotherPhys, false, 0);
424 
425   log_2->SetVisAttributes(green);
426   
427   
428 }
429 
430 void FlashApplicator::OverCover2() {
431 
432 G4double phi2 = 90. * deg;
433 
434   G4RotationMatrix rm2;
435   rm2.rotateY(phi2);
436 
437   
438   const G4double innRadius = fToroid_outRadius;
439   const G4double out_Radius = innRadius+40*mm ;
440   const G4double hight = 34*mm;
441   const G4double startAngle = 0. * deg;
442   const G4double spanningAngle = 360. * deg;
443   const G4double XPosition = fBigcover_XPosition+fBigcover_hight+hight;
444 
445    G4VSolid * solid =
446       new G4Tubs("coverbig", innRadius, out_Radius, hight,
447                  startAngle, spanningAngle);
448 
449   G4LogicalVolume *log = new G4LogicalVolume(
450       solid, aluminumNist, "coverbig_log", 0, 0, 0);
451 
452 new G4PVPlacement(
453       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "coverbig_phys",
454       log, fMotherPhys, false, 0);
455 
456   log->SetVisAttributes(yellow);
457 
458 }
459 
460 void FlashApplicator::MonitorChamber(){
461 
462 G4double phi2 = 90. * deg;
463 
464   G4RotationMatrix rm2;
465   rm2.rotateY(phi2);
466 
467   
468   const G4double innRadius = 20*mm;
469   const G4double out_Radius = innRadius+1.7*mm ;
470   const G4double hight = 3*mm;
471   const G4double startAngle = 0. * deg;
472   const G4double spanningAngle = 360. * deg;
473    G4double XPosition = fInitial_pos+hight;
474 
475    G4VSolid * solid =
476       new G4Tubs("first", innRadius, out_Radius, hight,
477                  startAngle, spanningAngle);
478 
479 
480 
481 G4LogicalVolume *log = new G4LogicalVolume(
482       solid, PVDF, "chamberfirst_log", 0, 0, 0);
483 
484   new G4PVPlacement(
485       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "coverbig_phys",
486       log, fMotherPhys, false, 0);
487 
488   log->SetVisAttributes(red);
489   
490   G4VSolid * solid_pvdf=
491       new G4Tubs("s_pvdf", innRadius, out_Radius, 0.5*mm,
492                  startAngle, spanningAngle);
493     
494       
495       G4LogicalVolume *log_pvdf= new G4LogicalVolume(
496       solid_pvdf, PVDF, "pvdf_log", 0, 0, 0);
497                  
498   G4VSolid * solid_film =
499       new G4Tubs("s_film", innRadius, out_Radius, 0.05/2*mm,
500                  startAngle, spanningAngle);
501    G4LogicalVolume *log_film = new G4LogicalVolume(
502       solid_film, FILM, "ka_log", 0, 0, 0);
503       
504   G4VSolid * solid_al =
505       new G4Tubs("s_al", innRadius, out_Radius, 0.005/2*mm,
506                  startAngle, spanningAngle);          
507   
508   G4LogicalVolume *log_al = new G4LogicalVolume(
509       solid_al, aluminumNist, "al_log", 0, 0, 0);
510   XPosition=XPosition+hight;
511 
512   G4int j=0;
513   for(G4int i = 0;i<3;i++){
514   XPosition=XPosition+(i+1)*0.05/2*mm;
515   new G4PVPlacement(
516       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "ka_phys",
517       log_film, fMotherPhys, false, j);
518   XPosition=XPosition+(i+1)*0.005/2*mm;
519   new G4PVPlacement(
520       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "al_phys",
521       log_al, fMotherPhys, false, j);
522       
523   XPosition=XPosition+(i+1)*1/2*mm;
524   new G4PVPlacement(
525       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "pvdf_phys",
526       log_pvdf, fMotherPhys, false, j);
527   
528   
529   
530   }
531   fChamberpos = XPosition +1/2*mm;
532   log_film->SetVisAttributes(green);
533     log_al->SetVisAttributes(blue);
534       log_pvdf->SetVisAttributes(yellow);
535 
536 
537 }
538 
539 void FlashApplicator::Flash_connector(){
540 
541 G4double phi2 = 90. * deg;
542 
543   G4RotationMatrix rm2;
544   rm2.rotateY(phi2);
545 
546   
547   const G4double innRadius = 10*cm;
548   const G4double out_Radius = innRadius+2.5*cm ;
549   const G4double hight = 15*mm;
550   const G4double startAngle = 0. * deg;
551   const G4double spanningAngle = 360. * deg;
552   const G4double XPosition = fChamberpos+hight;
553   
554   G4VSolid * solid =
555       new G4Tubs("cover", innRadius, out_Radius, hight,
556                  startAngle, spanningAngle);
557 
558   G4LogicalVolume *log = new G4LogicalVolume(
559       solid, aluminumNist, "coverbig_log", 0, 0, 0);
560 
561  new G4PVPlacement(
562       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "coverbig_phys",
563       log, fMotherPhys, false, 0);
564 
565   log->SetVisAttributes(magenta);
566   
567   
568   G4VSolid * solid_ =
569       new G4Tubs("littlecover", 22*mm, innRadius, 0.2*mm,
570                  startAngle, spanningAngle);
571   G4LogicalVolume *log_ = new G4LogicalVolume(
572       solid_, aluminumNist, "covers_log", 0, 0, 0);
573       
574     new G4PVPlacement(
575       G4Transform3D(rm2, G4ThreeVector((fChamberpos+0.2*mm), 0., 0.)), "coverl_phys",
576       log_, fMotherPhys, false, 0);  
577 log_->SetVisAttributes(green);
578 
579 fInitial_pos=XPosition+hight;
580 }
581 
582 void FlashApplicator::Bigconnector() {
583 
584 G4double phi2 = 90. * deg;
585 
586   G4RotationMatrix rm2;
587   rm2.rotateY(phi2);
588 
589   
590   const G4double innRadius = 10*cm;
591   const G4double out_Radius = innRadius+30*mm ;
592   const G4double hight = 7.05*cm + 0.0075/2*mm;
593   const G4double startAngle = 0. * deg;
594   const G4double spanningAngle = 360. * deg;
595   const G4double XPosition = fInitial_pos+hight;
596 
597    G4VSolid * solid =
598       new G4Tubs("coverbig", innRadius, out_Radius, hight,
599                  startAngle, spanningAngle);
600 
601   G4LogicalVolume *log = new G4LogicalVolume(
602       solid, aluminumNist, "coverbig_log", 0, 0, 0);
603 
604  new G4PVPlacement(
605       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "coverbig_phys",
606       log, fMotherPhys, false, 0);
607 
608   log->SetVisAttributes(red);
609 fInitial_pos=XPosition+hight;
610 }
611 void FlashApplicator::Bigconnector2() {
612 
613 G4double phi2 = 90. * deg;
614 
615   G4RotationMatrix rm2;
616   rm2.rotateY(phi2);
617 
618   
619   const G4double innRadius = 6*cm;
620   const G4double out_Radius = innRadius+70*mm ;
621   const G4double hight = 4.4*cm-12/4*mm;
622   const G4double startAngle = 0. * deg;
623   const G4double spanningAngle = 360. * deg;
624   const G4double XPosition = fInitial_pos+hight;
625 
626    G4VSolid * solid =
627       new G4Tubs("coverbig", innRadius, out_Radius, hight,
628                  startAngle, spanningAngle);
629 
630 
631 
632       
633       G4LogicalVolume *log = new G4LogicalVolume(
634       solid, PVDF, "coverbig_log", 0, 0, 0);
635 
636  new G4PVPlacement(
637       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "coverbig_phys",
638       log, fMotherPhys, false, 0);
639 
640   log->SetVisAttributes(blue);
641 fInitial_pos=XPosition+hight;
642 }
643 
644 void FlashApplicator::Bigconnector3() {//this is a piece of the applicator that connects the tube to the optics
645 
646 G4double phi2 = 90. * deg;
647 
648   G4RotationMatrix rm2;
649   rm2.rotateY(phi2);
650 
651   
652   const G4double innRadius = 6*cm;
653   const G4double out_Radius = innRadius+60*mm ;
654   const G4double hight = 3.4*cm-11/4*mm;
655   const G4double startAngle = 0. * deg;
656   const G4double spanningAngle = 360. * deg;
657   const G4double XPosition = fInitial_pos+hight;
658 
659 
660                  
661   G4VSolid *t1 = new G4Tubs("t1_", 0*mm, out_Radius, hight,
662                  startAngle, spanningAngle);
663                              
664     G4VSolid *t2 = new G4Cons("t2_", 0*mm,60*mm, 0*mm,fInnerRadiusFirstApplicatorFlash,hight +0.1*mm, startAngle,spanningAngle);
665     
666    
667     G4ThreeVector zTrans(0, 0, 0);
668 
669     G4SubtractionSolid *hollowcover =
670         new G4SubtractionSolid("hollowcover_log_", t1, t2, 0, zTrans);
671 
672   G4LogicalVolume *log = new G4LogicalVolume(
673       hollowcover, PMMA, "coverbig_log_", 0, 0, 0);
674 
675  new G4PVPlacement(
676       G4Transform3D(rm2, G4ThreeVector((XPosition), 0., 0.)), "coverbig_phys_",
677       log, fMotherPhys, false, 0);
678 
679   log->SetVisAttributes(yellow);
680 fInitial_pos=XPosition+hight;
681 }
682 
683 void FlashApplicator::FlashBeamLineApplicator() {
684 
685   
686 
687 
688   // hightFinalApplicatorFlash = 300 * mm;//modify this for length of applicator
689    if (fHightFinalApplicatorFlash != 0*mm){//set to zero if you do not want the applicator
690      Bigconnector3(); //comment this line to remove the applicator piece
691   const G4double startAngleFirstApplicatorFlash = 0. * deg;
692   const G4double spanningAngleFirstApplicatorFlash = 360. * deg;
693    fFinalApplicatorXPositionFlash = fInitial_pos+fHightFinalApplicatorFlash;
694 
695   G4double phi6 = 90. * deg;
696 
697   G4RotationMatrix rm6;
698   rm6.rotateY(phi6);
699 
700   fSolidFirstApplicatorFlash = new G4Tubs(
701       "FirstApplicatorFlash", fInnerRadiusFirstApplicatorFlash,
702       fOuterRadiusFirstApplicatorFlash, fHightFinalApplicatorFlash,
703       startAngleFirstApplicatorFlash, spanningAngleFirstApplicatorFlash);
704 
705   G4LogicalVolume *logFirstApplicatorFlash = new G4LogicalVolume(
706       fSolidFirstApplicatorFlash, fFirstApplicatorMaterialFlash,
707       "FirstApplicatorFlash", 0, 0, 0);
708 
709   fPhysiFirstApplicatorFlash = new G4PVPlacement(
710       G4Transform3D(rm6,
711                     G4ThreeVector((fFinalApplicatorXPositionFlash), 0., 0.)),
712       "FirstApplicatorFlash", logFirstApplicatorFlash, fMotherPhys, false, 0);
713 
714   logFirstApplicatorFlash->SetVisAttributes(magenta); } else{fFinalApplicatorXPositionFlash = fInitial_pos+3*cm;}
715 } 
716 
717 
718 void FlashApplicator::SetOuterRadius(G4double radius)
719 {
720  
721   fOuterRadiusFirstApplicatorFlash=radius;
722   fInnerRadiusFirstApplicatorFlash= fOuterRadiusFirstApplicatorFlash-5*mm;
723   
724 }
725 
726 void FlashApplicator::SetApplicatorLength(G4double length)
727 {
728   fHightFinalApplicatorFlash=length;
729   
730 }
731 
732 
733 
734 
735 
736