Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
Par01DetectorConstruction Class Reference

#include <Par01DetectorConstruction.hh>

Inheritance diagram for Par01DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 Par01DetectorConstruction ()
 
virtual ~Par01DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
virtual void ConstructSDandField ()
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserDetectorConstruction
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Detailed Description

Definition at line 38 of file Par01DetectorConstruction.hh.

Constructor & Destructor Documentation

Par01DetectorConstruction::Par01DetectorConstruction ( )

Definition at line 52 of file Par01DetectorConstruction.cc.

53 {;}
Par01DetectorConstruction::~Par01DetectorConstruction ( )
virtual

Definition at line 55 of file Par01DetectorConstruction.cc.

56 {;}

Member Function Documentation

G4VPhysicalVolume * Par01DetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 58 of file Par01DetectorConstruction.cc.

References G4Region::AddRootLogicalVolume(), python.hepunit::cm, G4NistManager::FindOrBuildMaterial(), G4cout, G4endl, G4Region::GetProductionCuts(), G4NistManager::Instance(), G4VisAttributes::Invisible, python.hepunit::mm, G4VisAttributes::SetForceWireframe(), G4ProductionCuts::SetProductionCuts(), G4Region::SetProductionCuts(), and G4LogicalVolume::SetVisAttributes().

59 {
60  G4cout << "\nPar01DetectorConstruction....\n" << G4endl;
61 
62  //--------- Material definition ---------
63  // Get nist material manager
64  G4NistManager* nistManager = G4NistManager::Instance();
65 
66  // Build materials
67  G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
68  G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
69  G4Material* helium = nistManager->FindOrBuildMaterial("G4_He");
70  G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
71 
72 
73  //--------- G4VSolid, G4LogicalVolume, G4VPhysicalVolume ---------
74 
75  //--------------
76  // World:
77  //--------------
78  G4Box *WorldBox= new G4Box("WorldBox",400*cm, 400*cm, 400*cm);
79  G4LogicalVolume *WorldLog=new G4LogicalVolume(WorldBox,air,
80  "WorldLogical", 0, 0, 0);
81  G4PVPlacement *WorldPhys=new G4PVPlacement(0,G4ThreeVector(),
82  "WorldPhysical",
83  WorldLog,
84  0,false,0);
85  // Size of detectors:
86  G4double detectSize = 125*cm;
87 
88  //-----------------------------
89  // "Drift Chamber":
90  // Not used in parameterisation.
91  //-----------------------------
92  // -- Logical volume:
93  G4Box *driftChamberBox
94  = new G4Box("DriftChamberSolid", detectSize, detectSize, 40*cm);
95  G4LogicalVolume *driftChamberLog
96  = new G4LogicalVolume(driftChamberBox,helium,
97  "DriftChamberLogical", 0, 0, 0);
98  // -- Placement:
99  // G4PVPlacement *driftChamberPhys =
100  new G4PVPlacement(0,G4ThreeVector(0., 0., 50*cm),
101  "DriftChamberPhysical",
102  driftChamberLog,
103  WorldPhys,false,0);
104 
105  //--------------------------
106  // "Calorimeter": used in
107  // parameterisation below
108  //--------------------------
109  // -- Logical volume:
110  G4Box *calorimeterBox
111  = new G4Box("CalorimeterSolid", detectSize, detectSize, 20*cm);
112  G4LogicalVolume *calorimeterLog = new G4LogicalVolume(calorimeterBox,air,
113  "CalorimeterLogical", 0, 0, 0);
114  // -- Placement:
115  G4PVPlacement *calorimeterPhys = new G4PVPlacement(0,G4ThreeVector(0., 0., 120*cm),
116  "CalorimeterPhysical",
117  calorimeterLog,
118  WorldPhys,false,0);
119 
120  //--------------------------------------
121  // The calorimeter is filled with
122  // crystals:
123  //--------------------------------------
124  // -- Logical volume:
125  G4double CrystalX = 2.5*cm;
126  G4double CrystalY = CrystalX;
127  G4double CrystalZ = 20*cm;
128  G4Box *CrystalSolid = new G4Box("CrystalSolid", CrystalX, CrystalY, CrystalZ);
129  fCrystalLog = new G4LogicalVolume(CrystalSolid,csi,
130  "CrystalLogical", 0, 0, 0);
131 
132  G4String tName1("Crystal"); // Allow all target physicals to share
133  // same name (delayed copy)
134 
135  // -- and placements inside the calorimeter:
136  G4int copyNo=0;
137  G4double xTlate, yTlate;
138  fnX = 48;
139  fnY = 48;
140  for (G4int j = 0; j < fnY; j++)
141  {
142  yTlate = -detectSize + 3*CrystalY + j*2*CrystalY;
143  for (G4int i = 0; i < fnX; i++)
144  {
145  xTlate = -detectSize + 3*CrystalX + i*2*CrystalX;
146  new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
147  tName1,
148  fCrystalLog,
149  calorimeterPhys,false,copyNo++);
150  }
151  }
152 
153 
154  //--------------------------
155  // "Hadron Calorimeter": used
156  // in parameterisation with
157  // a parallel geometry
158  //--------------------------
159  // -- Logical volume:
160  G4Box *hadCaloBox
161  = new G4Box("HadCaloSolid", detectSize, detectSize, 50*cm);
162  G4LogicalVolume *hadCaloLog = new G4LogicalVolume(hadCaloBox,air,
163  "HadCaloLogical", 0, 0, 0);
164  // -- Placement:
165  G4PVPlacement *hadCaloPhys = new G4PVPlacement(0,G4ThreeVector(0., 0., 200*cm),
166  "HadCaloPhysical",
167  hadCaloLog,
168  WorldPhys,false,0);
169 
170  //--------------------------------------
171  // The calorimeter is filled with
172  // towers:
173  //--------------------------------------
174  // -- Logical volume:
175  G4double TowerX = 5*cm;
176  G4double TowerY = TowerX;
177  G4double TowerZ = 45*cm;
178  G4Box *TowerSolid = new G4Box("TowerSolid", TowerX, TowerY, TowerZ);
179  fTowerLog = new G4LogicalVolume(TowerSolid,iron,
180  "TowerLogical", 0, 0, 0);
181 
182  G4String tName2("Tower");
183 
184  // -- and placements inside the calorimeter:
185  copyNo=0;
186  fnXhad = 23;
187  fnYhad = 23;
188  for (G4int jj = 0; jj < fnYhad; jj++)
189  {
190  yTlate = -detectSize + 3*TowerY + jj*2*TowerY;
191  for (G4int i = 0; i < fnXhad; i++)
192  {
193  xTlate = -detectSize + 3*TowerX + i*2*TowerX;
194  new G4PVPlacement(0,G4ThreeVector(xTlate,yTlate,0*cm),
195  tName2,
196  fTowerLog,
197  hadCaloPhys,false,copyNo++);
198  }
199  }
200 
201 
202 
203 
204  // -- Makes the calorimeterLog volume becoming a G4Region:
205  G4Region* caloRegion = new G4Region("EM_calo_region");
206  caloRegion->AddRootLogicalVolume(calorimeterLog);
207  std::vector<double> cuts;
208  cuts.push_back(1.0*mm);cuts.push_back(1.0*mm);cuts.push_back(1.0*mm);cuts.push_back(1.0*mm);
209  caloRegion->SetProductionCuts(new G4ProductionCuts());
210  caloRegion->GetProductionCuts()->SetProductionCuts(cuts);
211 
212  // Makes had. calo a region to:
213  G4Region* hadRegion = new G4Region("HAD_calo_region");
214  hadRegion->AddRootLogicalVolume(hadCaloLog);
215  cuts.clear();
216  cuts.push_back(1.0*cm);cuts.push_back(1.0*cm);cuts.push_back(1.0*cm);cuts.push_back(1.0*cm);
217  hadRegion->SetProductionCuts(new G4ProductionCuts());
218  hadRegion->GetProductionCuts()->SetProductionCuts(cuts);
219 
220  //--------- Visualization attributes -------------------------------
222 
223  G4VisAttributes * driftchamberTubeVisAtt
224  = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
225  driftchamberTubeVisAtt->SetForceWireframe(true);
226  driftChamberLog->SetVisAttributes(driftchamberTubeVisAtt);
227 
228  G4VisAttributes * calorimeterBoxVisAtt
229  = new G4VisAttributes(G4Colour(0.0,0.0,1.0));
230  calorimeterBoxVisAtt->SetForceWireframe(true);
231  calorimeterLog->SetVisAttributes(calorimeterBoxVisAtt);
232 
233  G4VisAttributes * crystalVisAtt
234  = new G4VisAttributes(G4Colour(1.0,0.0,0.0));
235  crystalVisAtt->SetForceWireframe(true);
236  fCrystalLog->SetVisAttributes(crystalVisAtt);
237 
238  G4VisAttributes * hadCaloBoxVisAtt
239  = new G4VisAttributes(G4Colour(1.0,0.0,1.0));
240  hadCaloBoxVisAtt->SetForceWireframe(true);
241  hadCaloLog->SetVisAttributes(hadCaloBoxVisAtt);
242 
243  G4VisAttributes * towerVisAtt
244  = new G4VisAttributes(G4Colour(0.5,0.0,1.0));
245  towerVisAtt->SetForceWireframe(true);
246  fTowerLog->SetVisAttributes(towerVisAtt);
247 
248  //------------------------------------------------------------------
249 
250 
251  //-----------------------
252  // Returns the pointer to
253  // the physical world:
254  //-----------------------
255  return WorldPhys;
256 }
G4ProductionCuts * GetProductionCuts() const
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
void SetForceWireframe(G4bool)
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
Definition: G4Box.hh:63
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
G4GLOB_DLL std::ostream G4cout
static const G4VisAttributes Invisible
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
double G4double
Definition: G4Types.hh:76
void SetVisAttributes(const G4VisAttributes *pVA)
void SetProductionCuts(std::vector< G4double > &)
void Par01DetectorConstruction::ConstructSDandField ( )
virtual

Reimplemented from G4VUserDetectorConstruction.

Definition at line 258 of file Par01DetectorConstruction.cc.

References G4SDManager::AddNewDetector(), G4RegionStore::GetInstance(), G4RegionStore::GetRegion(), G4SDManager::GetSDMpointer(), and G4LogicalVolume::SetSensitiveDetector().

259 {
260  //--------- Sensitive detector -------------------------------------
262  G4String calorimeterSDname = "Par01/Calorimeter";
263  Par01CalorimeterSD* CalorimeterSD = new Par01CalorimeterSD( calorimeterSDname,
264  fnX*fnY,
265  "CalCollection" );
266  SDman->AddNewDetector( CalorimeterSD );
267  fCrystalLog->SetSensitiveDetector(CalorimeterSD);
268 
269  G4String hadCalorimeterSDname = "Par01/HadronCalorimeter";
270  Par01CalorimeterSD* HadCalorimeterSD = new Par01CalorimeterSD( hadCalorimeterSDname,
271  fnXhad*fnYhad,
272  "HadCollection" );
273  SDman->AddNewDetector( HadCalorimeterSD );
274  fTowerLog->SetSensitiveDetector(HadCalorimeterSD);
275 
276  // --------------- fast simulation ----------------------------
277  G4RegionStore* regionStore = G4RegionStore::GetInstance();
278 
279  G4Region* caloRegion = regionStore->GetRegion("EM_calo_region");
280  // builds a model and sets it to the envelope of the calorimeter:
281  new Par01EMShowerModel("emShowerModel",caloRegion);
282 }
G4Region * GetRegion(const G4String &name, G4bool verbose=true) const
static G4RegionStore * GetInstance()
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:67
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)

The documentation for this class was generated from the following files: