source: trunk/examples/advanced/lAr_calorimeter/src/FCALHadModule.cc@ 1329

Last change on this file since 1329 was 807, checked in by garnier, 17 years ago

update

File size: 9.6 KB
RevLine 
[807]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// Name of file: FCALHadModule.cc
27// Author: Mathieu Fontaine Rachid Mazini
28// fontainerlps.umontreal.ca Rachid.Mazinircern.ch
29// Language: C++
30// Tested on : g++
31// Prerequisites: None
32// Purpose: Source file defining the geometry of HadModule 0 of the
33// FCAL.
34// Developped: 10-March-2000 M.F.
35//
36//-----------------------------------------------------------------------------
37
38#include "FCALHadModule.hh"
39
40#include "FCALMaterialConsultant.hh"
41#include "FCALHadModuleSD.hh"
42#include "G4SDManager.hh"
43
44
45#include "G4Box.hh"
46#include "G4Tubs.hh"
47#include "G4LogicalVolume.hh"
48#include "G4VPhysicalVolume.hh"
49#include "G4PVPlacement.hh"
50#include "G4SubtractionSolid.hh"
51
52#include "G4ThreeVector.hh"
53#include "G4VisAttributes.hh"
54#include "G4Colour.hh"
55
56#include <fstream>
57#include "G4ios.hh"
58
59
60FCALHadModule::FCALHadModule() :
61 FcalHadModuleSD(0)
62{
63 F2LArGapID = new G4int[2600];
64 F2LArIX = new G4int[2600];
65 F2LArJY = new G4int[2600];
66 F2LArITile = new G4int[2600];
67 F2LArGapPosX = new G4double[2600];
68 F2LArGapPosY = new G4double[2600];
69}
70
71FCALHadModule::~FCALHadModule() {
72 delete [] F2LArGapID;
73 delete [] F2LArGapPosX;
74 delete [] F2LArGapPosY;
75 delete [] F2LArIX;
76 delete [] F2LArJY;
77 delete [] F2LArITile;
78}
79
80
81void FCALHadModule::InitializeGeometry() {
82
83#include "FCALHadModuleParameters.input"
84
85 std::ifstream File
86 ("geom_data/FCal2Electrodes.dat");
87
88 if(!File) G4cerr << "Failed to open file FCal2Electrode data file" << G4endl;
89 File.seekg(0);
90
91 NF2LarGap = 0;
92 while(!(File.eof())) {
93 NF2LarGap++;
94 File >> F2LArGapID[NF2LarGap] >> F2LArGapPosX[NF2LarGap] >> F2LArGapPosY[NF2LarGap]
95 >> F2LArIX[NF2LarGap] >> F2LArJY[NF2LarGap] >> F2LArITile[NF2LarGap];
96 };
97
98 G4cout << "*********" << " Number of Rods in FCAL2 : " << NF2LarGap-1 << G4endl;
99}
100
101
102G4LogicalVolume * FCALHadModule::Construct()
103{
104 //-----------------------------
105 // construction of materials
106 //-----------------------------
107
108 FCALMaterialConsultant * FCALMaterials = new FCALMaterialConsultant();
109 FCALMaterials->construct();
110
111 G4VisAttributes * ColorOfTungsten = new G4VisAttributes(G4Colour(.5,.5,.5));
112 G4VisAttributes * ColorOfCopper =new G4VisAttributes(G4Colour(0.58,0.15,0.05));
113 G4VisAttributes * ColorOfLarg = new G4VisAttributes(G4Colour(0.,0.,1.));
114
115
116 //----------------------------
117 // Read Parameters
118 //----------------------------
119 InitializeGeometry();
120
121
122 //-----------------------------------------
123 // the logical to be returned (mother)
124 //-----------------------------------------
125
126 G4Tubs * SolidHadModule =
127 new G4Tubs("HadModuleSolid", HadModuleRMin, HadModuleRMax, HadModuleLenght,
128 HadModuleStartPhi,HadModuleDPhi);
129 G4LogicalVolume * LogicalHadModule =
130 new G4LogicalVolume(SolidHadModule, FCALMaterials->Material("Copper"),
131 "HadModuleLogical");
132
133 LogicalHadModule->SetSmartless(FCAL2HadSmart);
134
135 LogicalHadModule->SetVisAttributes(ColorOfCopper);
136 // LogicalHadModule->SetVisAttributes(G4VisAttributes::Invisible);
137
138
139 //-----------------------------------------
140 // Tungsten Absorber
141 //-----------------------------------------
142 G4Tubs * SolidWAbsorber =
143 new G4Tubs("WAbsorberSolid", WAbsorberRMin, WAbsorberRMax, WAbsorberLenght,
144 WAbsorberStartPhi, WAbsorberDPhi);
145 G4LogicalVolume * LogicalWAbsorber =
146 new G4LogicalVolume(SolidWAbsorber, FCALMaterials->Material("FCAL2WFeNi"),
147 "SolidWLogical");
148// G4VPhysicalVolume * PhysicalWAbsorber =
149 new G4PVPlacement(0, G4ThreeVector(), LogicalWAbsorber, "WAbsorberPhysical",
150 LogicalHadModule, 0, 0);
151
152 LogicalWAbsorber->SetVisAttributes(ColorOfTungsten);
153 // LogicalWAbsorber->SetVisAttributes(G4VisAttributes::Invisible);
154
155
156 // -----------------
157 // Copper Plates
158 //------------------
159 G4Tubs * SolidCuPlate =
160 new G4Tubs("CuPlateSolid",HadModuleRMin, HadModuleRMax, CuPlateLenght,
161 HadModuleStartPhi, HadModuleDPhi);
162 G4LogicalVolume * LogicalCuPlate =
163 new G4LogicalVolume(SolidCuPlate, FCALMaterials->Material("Copper"), "CuPlateLogical");
164
165// G4VPhysicalVolume * PhysicalCuPlateA =
166 new G4PVPlacement(0, G4ThreeVector(0.,0.,CuPlateAPosZ), LogicalCuPlate,
167 "CuPlateAPhysical", LogicalHadModule, 0, 0);
168// G4VPhysicalVolume * PhysicalCuPlateB =
169 new G4PVPlacement(0, G4ThreeVector(0.,0.,CuPlateBPosZ), LogicalCuPlate,
170 "CuPlateBPhysical", LogicalHadModule, 0, 0);
171
172 LogicalCuPlate->SetVisAttributes(ColorOfCopper);
173 // LogicalCuPlate->SetVisAttributes(G4VisAttributes::Invisible);
174
175 //------------------------------------------
176 // Had Module (F2) Main and A/B Cable Troff
177 //------------------------------------------
178 G4Tubs * SolidF2TroffMain =
179 new G4Tubs("F2TroffMainSolid", F2TroffRmin, F2TroffRmax, F2TroffMainLenght,
180 F2TroffStartPhi, F2TroffDphi);
181 G4LogicalVolume * LogicalF2TroffMain =
182 new G4LogicalVolume(SolidF2TroffMain, FCALMaterials->Material("FCAL2CuArKap"),
183 "F2TroffMainLogical");
184
185 G4Tubs * SolidF2TroffAB =
186 new G4Tubs("F2TroffABSolid", F2TroffRmin, F2TroffRmax, F2TroffABLenght,
187 F2TroffStartPhi, F2TroffDphi);
188 G4LogicalVolume * LogicalF2TroffAB =
189 new G4LogicalVolume(SolidF2TroffAB, FCALMaterials->Material("FCAL2CuArKap"),
190 "F2TroffABLogical");
191
192 G4ThreeVector F2TroffMainTrans(0.,0.,0.);
193 G4ThreeVector F2TroffABTrans(0.,0.,0.);
194 G4RotationMatrix F2TroffRot;
195 G4int i=0;
196 for(i=0 ; i < NCableTroff ; i++)
197 {
198// G4VPhysicalVolume * PhysicalF2TroffMain =
199 new G4PVPlacement(G4Transform3D(F2TroffRot,F2TroffMainTrans), LogicalF2TroffMain,
200 "F2TroffMainPhysical", LogicalWAbsorber,0,i+1);
201
202// G4VPhysicalVolume * PhysicalF2TroffAB =
203 new G4PVPlacement(G4Transform3D(F2TroffRot,F2TroffABTrans), LogicalF2TroffAB,
204 "F2TroffAPhysical", LogicalCuPlate, 0, i+1);
205
206 F2TroffRot.rotateZ(F2TroffRotZ);
207 }
208
209 LogicalF2TroffMain->SetVisAttributes(ColorOfCopper);
210 // LogicalF2TroffMain->SetVisAttributes(G4VisAttributes::Invisible);
211 LogicalF2TroffAB->SetVisAttributes(ColorOfCopper);
212 // LogicalF2TroffAB->SetVisAttributes(G4VisAttributes::Invisible);
213
214
215 //----------------------
216 // LArg Gaps + F2 Rod
217 //----------------------
218 G4Tubs * SolidF2LArGap =
219 new G4Tubs("F2LArGapSolid", F2LArGapRmin, F2LArGapRmax, F2LArGapLenght,
220 F2LArGapStartPhi, F2LArGapDphi);
221 G4LogicalVolume * LogicalF2LArGap =
222 new G4LogicalVolume(SolidF2LArGap, FCALMaterials->Material("LiquidArgon"),
223 "F2LArGapLogical");
224
225 LogicalF2LArGap->SetVisAttributes(ColorOfLarg);
226 // LogicalF2LArGap->SetVisAttributes(G4VisAttributes::Invisible);
227
228 G4Tubs * SolidF2Rod =
229 new G4Tubs("F2RodSolid", F2RodRmin, F2RodRmax, F2RodLenght, F2RodStartPhi, F2RodDphi);
230 G4LogicalVolume * LogicalF2Rod =
231 new G4LogicalVolume(SolidF2Rod, FCALMaterials->Material("Tungsten"),"F2RodLogical");
232// G4VPhysicalVolume * PhysicalF2Rod =
233 new G4PVPlacement(0,G4ThreeVector(),LogicalF2Rod,"F2RodPhysical",LogicalF2LArGap,0, 0);
234
235 LogicalF2Rod->SetVisAttributes(ColorOfTungsten);
236 // LogicalF2Rod->SetVisAttributes(G4VisAttributes::Invisible);
237
238 //---------------------------------
239 // Electrod (Rod + LArg) placement
240 //---------------------------------
241 for(i=1; i < NF2LarGap; i++){
242// G4VPhysicalVolume * PhysicalF2LArGap =
243 new G4PVPlacement(0,G4ThreeVector(F2LArGapPosX[i]*cm,F2LArGapPosY[i]*cm,0.*cm),
244 LogicalF2LArGap,"F2LArGapPhysical",
245 LogicalHadModule, 0, i);
246 };
247
248 LogicalF2LArGap->SetVisAttributes(ColorOfLarg);
249 // LogicalF2LArGap->SetVisAttributes(G4VisAttributes::Invisible);
250
251
252 // Sensitive Volumes
253 G4SDManager* SDman = G4SDManager::GetSDMpointer();
254
255 if(!FcalHadModuleSD)
256 {
257 FcalHadModuleSD = new FCALHadModuleSD("FCALTB/HadModuleSD");
258 SDman->AddNewDetector(FcalHadModuleSD);
259 }
260 LogicalF2LArGap->SetSensitiveDetector(FcalHadModuleSD);
261
262
263 return LogicalHadModule;
264
265}
266
267G4int FCALHadModule::GetF2TileID(G4int TileID)
268{
269 return F2LArITile[TileID];
270}
271
272
273
Note: See TracBrowser for help on using the repository browser.