/scratch0/jsnuveri/BDSIM/BDSIMgit/bdsim/src/BDSSpoiler.cc

00001 /* BDSIM code.    Version 1.0
00002    Author: Grahame A. Blair, Royal Holloway, Univ. of London.
00003    Last modified 24.7.2002
00004    Copyright (c) 2002 by G.A.Blair.  ALL RIGHTS RESERVED. 
00005 */
00006 #include "BDSGlobalConstants.hh" 
00007 #include "BDSSpoiler.hh"
00008 #include "BDSMaterials.hh"
00009 
00010 #include "G4Box.hh"
00011 #include "G4VisAttributes.hh"
00012 #include "G4LogicalVolume.hh"
00013 #include "G4VPhysicalVolume.hh"
00014 #include "G4PVPlacement.hh"               
00015 #include "G4UserLimits.hh"
00016 
00017 class BDSTiltOffset;
00018 
00019 BDSSpoiler::BDSSpoiler(G4String      name,
00020                        G4double      length,
00021                        G4double      xAperIn,
00022                        G4double      yAperIn,
00023                        G4Material*   SpoilerMaterial,
00024                        BDSTiltOffset tiltOffset):
00025   BDSAcceleratorComponent(name, length, 0, "spoiler", tiltOffset),
00026   itsPhysiComp(NULL), itsPhysiComp2(NULL), itsSolidLogVol(NULL), 
00027   itsInnerLogVol(NULL), itsSpoilerMaterial(SpoilerMaterial),
00028   xAper(xAperIn),
00029   yAper(yAperIn)
00030 {
00031 }
00032 
00033 void BDSSpoiler::Build()
00034 {
00035   BDSAcceleratorComponent::Build();
00036   BuildInnerSpoiler();
00037 }
00038 
00039 void BDSSpoiler::BuildMarkerLogicalVolume()
00040 {
00041   containerSolid = new G4Box(name,
00042                              BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00043                              BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00044                              chordLength/2);
00045   containerLogicalVolume = new G4LogicalVolume(containerSolid,
00046                                                emptyMaterial,
00047                                                name + "_container_lv");
00048 }
00049 
00050 void BDSSpoiler::BuildInnerSpoiler()
00051 {
00052   itsSolidLogVol=
00053     new G4LogicalVolume(new G4Box(name+"_solid",
00054                                   BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00055                                   BDSGlobalConstants::Instance()->GetComponentBoxSize()/2,
00056                                   chordLength/2),
00057                         itsSpoilerMaterial,
00058                         name+"_solid");
00059 
00060   itsInnerLogVol=
00061     new G4LogicalVolume(new G4Box(name+"_inner",
00062                                   xAper,
00063                                   yAper,
00064                                   chordLength/2),
00065                         BDSMaterials::Instance()->GetMaterial(BDSGlobalConstants::Instance()->GetVacuumMaterial()),
00066                         name+"_inner");
00067   
00068   itsPhysiComp2 = 
00069     new G4PVPlacement(
00070                       (G4RotationMatrix*)0,                // no rotation
00071                       (G4ThreeVector)0,                   // its position
00072                       itsInnerLogVol,      // its logical volume
00073                       name+"_combined", // its name
00074                       itsSolidLogVol,      // its mother  volume
00075                       false,               // no boolean operation
00076                       0, BDSGlobalConstants::Instance()->GetCheckOverlaps());  // copy number 
00077 
00078   if(BDSGlobalConstants::Instance()->GetSensitiveComponents())
00079     {RegisterSensitiveVolume(itsSolidLogVol);}
00080 
00081 #ifndef NOUSERLIMITS
00082   itsSolidLogVol->
00083     SetUserLimits(new G4UserLimits(DBL_MAX,DBL_MAX,BDSGlobalConstants::Instance()->GetMaxTime(),
00084                                    BDSGlobalConstants::Instance()-> GetThresholdCutCharged()));
00085 #endif
00086   itsPhysiComp = 
00087     new G4PVPlacement(
00088                       (G4RotationMatrix*)0,                  // no rotation
00089                       (G4ThreeVector)0,                     // its position
00090                       itsSolidLogVol,    // its logical volume
00091                       name+"_solid",         // its name
00092                       containerLogicalVolume, // its mother  volume
00093                       false,                 // no boolean operation
00094                       0, BDSGlobalConstants::Instance()->GetCheckOverlaps());                // copy number  
00095 }
00096 
00097 
00098 BDSSpoiler::~BDSSpoiler()
00099 {
00100 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7