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

00001 /* BDSIM code for LW Calorimeter.    Version 1.0
00002    Author: John Carter, Royal Holloway, Univ. of London.
00003    Last modified 26.7.2004
00004    Copyright (c) 2004 by J.C.Carter.  ALL RIGHTS RESERVED. 
00005 */
00006 
00007 #include "BDSBeamPipe.hh"
00008 #include "BDSBeamPipeFactory.hh"
00009 #include "BDSGlobalConstants.hh" 
00010 #include "BDSLWCalorimeter.hh"
00011 #include "BDSMaterials.hh"
00012 #include "G4Box.hh"
00013 #include "G4Tubs.hh"
00014 #include "G4VisAttributes.hh"
00015 #include "G4LogicalVolume.hh"
00016 #include "G4VPhysicalVolume.hh"
00017 #include "G4PVPlacement.hh"               
00018 #include "G4UserLimits.hh"
00019 
00020 #include "BDSAcceleratorComponent.hh"
00021 
00022 #include "BDSLWCalorimeterSD.hh"
00023 #include "G4SDManager.hh"
00024 
00025 class BDSTiltOffset;
00026 
00027 BDSLWCalorimeter::BDSLWCalorimeter(G4String         name,
00028                                    G4double         length,
00029                                    BDSBeamPipeInfo* beamPipeInfoIn,
00030                                    BDSTiltOffset    tiltOffset):
00031   BDSAcceleratorComponent(name, length, 0, "lwcalorimeter", tiltOffset),
00032   itsBeampipeLogicalVolume(NULL),itsInnerBPLogicalVolume(NULL),itsPhysiInner(NULL),
00033   itsPhysiComp(NULL),itsLWCalLogicalVolume(NULL),itsBeampipeUserLimits(NULL),
00034   itsBPFieldMgr(NULL),itsBPTube(NULL),itsInnerBPTube(NULL),itsLWCal(NULL),
00035   itsPhysiLWCal(NULL)
00036 {
00037   beamPipeInfo = beamPipeInfoIn;
00038 }
00039 
00040 void BDSLWCalorimeter::Build()
00041 {
00042   BDSAcceleratorComponent::Build();
00043   BuildCal(chordLength);
00044   BuildBeampipe();
00045 }
00046 
00047 void BDSLWCalorimeter::BuildMarkerLogicalVolume()
00048 {
00049   G4double SampTransSize;
00050   SampTransSize = BDSGlobalConstants::Instance()->GetSamplerDiameter() * 0.5 * CLHEP::mm;
00051 
00052   containerSolid = new G4Box(name + "_container_solid", // name
00053                              SampTransSize,
00054                              SampTransSize,
00055                              chordLength*0.5);
00056   containerLogicalVolume = new G4LogicalVolume(containerSolid,
00057                                                emptyMaterial,
00058                                                name + "_container_lv");
00059   
00060 #ifndef NOUSERLIMITS
00061   G4UserLimits* itsOuterUserLimits =new G4UserLimits();
00062   itsOuterUserLimits->SetMaxAllowedStep(chordLength);
00063   itsOuterUserLimits->SetUserMaxTime(BDSGlobalConstants::Instance()->GetMaxTime());
00064   containerLogicalVolume->SetUserLimits(itsOuterUserLimits);
00065 #endif
00066 }
00067 
00068 void BDSLWCalorimeter::BuildCal(G4double aLength)
00069 {
00070   // build the Calorimeter
00071   itsLWCal=new G4Box(name + "_lw_cal_solid",
00072                      BDSGlobalConstants::Instance()->GetLWCalWidth()/2,
00073                      BDSGlobalConstants::Instance()->GetLWCalWidth()/2,
00074                      aLength/2);
00075   itsLWCalLogicalVolume=new G4LogicalVolume(itsLWCal,
00076                                             BDSMaterials::Instance()->GetMaterial("LeadTungstate"),
00077                                             name + "_lw_cal_lv");
00078   G4RotationMatrix* Rot=NULL;
00079   if(angle!=0)Rot=BDSGlobalConstants::Instance()->RotY90();
00080  
00081   itsPhysiLWCal = new G4PVPlacement(Rot,                     // rotation
00082                                     G4ThreeVector(BDSGlobalConstants::Instance()->GetLWCalOffset(),0.,0.),
00083                                     itsLWCalLogicalVolume,   // its logical volume
00084                                     name +"_lw_cal_pv",      // its name
00085                                     containerLogicalVolume,  // its mother  volume
00086                                     false,                   // no boolean operation
00087                                     0,
00088                                     BDSGlobalConstants::Instance()->GetCheckOverlaps()); // copy number
00089   
00090   // Sensitive Detector:
00091   G4SDManager* SDMan = G4SDManager::GetSDMpointer();
00092  
00093   BDSLWCalorimeterSD* SensDet=new BDSLWCalorimeterSD(name);
00094   SDMan->AddNewDetector(SensDet);
00095   
00096   itsLWCalLogicalVolume->SetSensitiveDetector(SensDet);    
00097 }
00098 void BDSLWCalorimeter::BuildBeampipe()
00099 {
00100   BDSBeamPipe* pipe = BDSBeamPipeFactory::Instance()->CreateBeamPipe(name,
00101                                                                      chordLength,
00102                                                                      beamPipeInfo);
00103   if(BDSGlobalConstants::Instance()->GetSensitiveBeamPipe())
00104     {RegisterSensitiveVolumes(pipe->GetAllSensitiveVolumes());}
00105   
00106 
00107   new G4PVPlacement(0,                                 // rotation
00108                     (G4ThreeVector)0,                  // position
00109                     pipe->GetContainerLogicalVolume(), // its logical volume
00110                     name +"_beampipe_pv",              // its name
00111                     containerLogicalVolume,            // its mother  volume
00112                     false,                             // no boolean operation
00113                     0,
00114                     BDSGlobalConstants::Instance()->GetCheckOverlaps()); // copy number
00115 
00116   // Set extents
00117   SetExtentX(pipe->GetExtentX());
00118   SetExtentY(pipe->GetExtentY());
00119   SetExtentZ(pipe->GetExtentZ());
00120 }
00121 
00122 BDSLWCalorimeter::~BDSLWCalorimeter()
00123 {
00124 }

Generated on 28 Jun 2015 for BDSIM by  doxygen 1.4.7