Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // Name of file: FCALHadModule.cc 27 // Author: Mathieu Fontaine 28 // fontainerlps.umontrea 29 // Language: C++ 30 // Tested on : g++ 31 // Prerequisites: None 32 // Purpose: Source file defining 33 // FCAL. 34 // Developped: 10-March-2000 M.F. 35 // 36 //-------------------------------------------- 37 38 #include <fstream> 39 40 #include "FCALHadModule.hh" 41 42 #include "FCALMaterialConsultant.hh" 43 #include "FCALHadModuleSD.hh" 44 #include "G4SDManager.hh" 45 46 #include "G4PhysicalConstants.hh" 47 #include "G4SystemOfUnits.hh" 48 #include "G4Box.hh" 49 #include "G4Tubs.hh" 50 #include "G4LogicalVolume.hh" 51 #include "G4VPhysicalVolume.hh" 52 #include "G4PVPlacement.hh" 53 #include "G4SubtractionSolid.hh" 54 55 #include "G4ThreeVector.hh" 56 #include "G4VisAttributes.hh" 57 #include "G4Colour.hh" 58 59 #include "G4ios.hh" 60 61 62 FCALHadModule::FCALHadModule() : 63 FcalHadModuleSD(0) 64 { 65 F2LArGapID = new G4int[2600]; 66 F2LArIX = new G4int[2600]; 67 F2LArJY = new G4int[2600]; 68 F2LArITile = new G4int[2600]; 69 F2LArGapPosX = new G4double[2600]; 70 F2LArGapPosY = new G4double[2600]; 71 } 72 73 FCALHadModule::~FCALHadModule() { 74 delete [] F2LArGapID; 75 delete [] F2LArGapPosX; 76 delete [] F2LArGapPosY; 77 delete [] F2LArIX; 78 delete [] F2LArJY; 79 delete [] F2LArITile; 80 } 81 82 83 void FCALHadModule::InitializeGeometry() { 84 85 #include "FCALHadModuleParameters.input" 86 87 std::ifstream File 88 ("geom_data/FCal2Electrodes.dat"); 89 90 if(!File) G4cerr << "Failed to open file F 91 File.seekg(0); 92 93 NF2LarGap = 0; 94 while(!(File.eof())) { 95 NF2LarGap++; 96 File >> F2LArGapID[NF2LarGap] >> F2LArGap 97 >> F2LArIX[NF2LarGap] >> F2LArJY[NF2LarGa 98 }; 99 100 G4cout << "*********" << " Number of Rods i 101 } 102 103 104 G4LogicalVolume * FCALHadModule::Construct() 105 { 106 //----------------------------- 107 // construction of materials 108 //----------------------------- 109 110 FCALMaterialConsultant * FCALMaterials = 111 FCALMaterialConsultant::GetInstance(); 112 113 G4VisAttributes * ColorOfTungsten = new G4Vi 114 G4VisAttributes * ColorOfCopper =new G4VisAt 115 G4VisAttributes * ColorOfLarg = new G4VisAt 116 117 118 //---------------------------- 119 // Read Parameters 120 //---------------------------- 121 InitializeGeometry(); 122 123 124 //----------------------------------------- 125 // the logical to be returned (mother) 126 //----------------------------------------- 127 128 G4Tubs * SolidHadModule = 129 new G4Tubs("HadModuleSolid", HadModuleRMin 130 HadModuleStartPhi,HadModuleDPhi); 131 G4LogicalVolume * LogicalHadModule = 132 new G4LogicalVolume(SolidHadModule, FCALMa 133 "HadModuleLogical"); 134 135 LogicalHadModule->SetSmartless(FCAL2HadSmart 136 137 LogicalHadModule->SetVisAttributes(ColorOfCo 138 // LogicalHadModule->SetVisAttributes(G4Vis 139 140 141 //----------------------------------------- 142 // Tungsten Absorber 143 //----------------------------------------- 144 G4Tubs * SolidWAbsorber = 145 new G4Tubs("WAbsorberSolid", WAbsorberRMin 146 WAbsorberStartPhi, WAbsorberDPhi); 147 G4LogicalVolume * LogicalWAbsorber = 148 new G4LogicalVolume(SolidWAbsorber, FCALMa 149 "SolidWLogical"); 150 // G4VPhysicalVolume * PhysicalWAbsorber = 151 new G4PVPlacement(0, G4ThreeVector(), Logi 152 LogicalHadModule, 0, 0); 153 154 LogicalWAbsorber->SetVisAttributes(ColorOfTu 155 // LogicalWAbsorber->SetVisAttributes(G4VisA 156 157 158 // ----------------- 159 // Copper Plates 160 //------------------ 161 G4Tubs * SolidCuPlate = 162 new G4Tubs("CuPlateSolid",HadModuleRMin, H 163 HadModuleStartPhi, HadModuleDPhi); 164 G4LogicalVolume * LogicalCuPlate = 165 new G4LogicalVolume(SolidCuPlate, FCALMate 166 167 // G4VPhysicalVolume * PhysicalCuPlateA = 168 new G4PVPlacement(0, G4ThreeVector(0.,0.,C 169 "CuPlateAPhysical", LogicalHadModule 170 // G4VPhysicalVolume * PhysicalCuPlateB = 171 new G4PVPlacement(0, G4ThreeVector(0.,0.,C 172 "CuPlateBPhysical", LogicalHadModule 173 174 LogicalCuPlate->SetVisAttributes(ColorOfCopp 175 // LogicalCuPlate->SetVisAttributes(G4VisAt 176 177 //------------------------------------------ 178 // Had Module (F2) Main and A/B Cable Troff 179 //------------------------------------------ 180 G4Tubs * SolidF2TroffMain = 181 new G4Tubs("F2TroffMainSolid", F2TroffRmin 182 F2TroffStartPhi, F2TroffDphi); 183 G4LogicalVolume * LogicalF2TroffMain = 184 new G4LogicalVolume(SolidF2TroffMain, FCAL 185 "F2TroffMainLogical"); 186 187 G4Tubs * SolidF2TroffAB = 188 new G4Tubs("F2TroffABSolid", F2TroffRmin, 189 F2TroffStartPhi, F2TroffDphi); 190 G4LogicalVolume * LogicalF2TroffAB = 191 new G4LogicalVolume(SolidF2TroffAB, FCALMa 192 "F2TroffABLogical"); 193 194 G4ThreeVector F2TroffMainTrans(0.,0.,0.); 195 G4ThreeVector F2TroffABTrans(0.,0.,0.); 196 G4RotationMatrix F2TroffRot; 197 G4int i=0; 198 for(i=0 ; i < NCableTroff ; i++) 199 { 200 // G4VPhysicalVolume * PhysicalF2TroffMai 201 new G4PVPlacement(G4Transform3D(F2TroffRot,F 202 "F2TroffMainPhysical", LogicalWAbsorbe 203 204 // G4VPhysicalVolume * PhysicalF2TroffAB 205 new G4PVPlacement(G4Transform3D(F2TroffRot,F 206 "F2TroffAPhysical", LogicalCuPlate, 0, 207 208 F2TroffRot.rotateZ(F2TroffRotZ); 209 } 210 211 LogicalF2TroffMain->SetVisAttributes(ColorOf 212 // LogicalF2TroffMain->SetVisAttributes(G4V 213 LogicalF2TroffAB->SetVisAttributes(ColorOfCo 214 // LogicalF2TroffAB->SetVisAttributes(G4VisA 215 216 217 //---------------------- 218 // LArg Gaps + F2 Rod 219 //---------------------- 220 G4Tubs * SolidF2LArGap = 221 new G4Tubs("F2LArGapSolid", F2LArGapRmin, 222 F2LArGapStartPhi, F2LArGapDph 223 G4LogicalVolume * LogicalF2LArGap = 224 new G4LogicalVolume(SolidF2LArGap, FCALM 225 "F2LArGapLogical"); 226 227 LogicalF2LArGap->SetVisAttributes(ColorOf 228 // LogicalF2LArGap->SetVisAttributes(G4VisA 229 230 G4Tubs * SolidF2Rod = 231 new G4Tubs("F2RodSolid", F2RodRmin, F2Ro 232 G4LogicalVolume * LogicalF2Rod = 233 new G4LogicalVolume(SolidF2Rod, FCALMate 234 // G4VPhysicalVolume * PhysicalF2Rod = 235 new G4PVPlacement(0,G4ThreeVector(),Logi 236 237 LogicalF2Rod->SetVisAttributes(ColorOfTung 238 // LogicalF2Rod->SetVisAttributes(G4VisAtt 239 240 //--------------------------------- 241 // Electrod (Rod + LArg) placement 242 //--------------------------------- 243 for(i=1; i < NF2LarGap; i++){ 244 // G4VPhysicalVolume * PhysicalF2LArGap = 245 new G4PVPlacement(0,G4ThreeVector(F2LArGapPo 246 LogicalF2LArGap,"F2LArGapPhysical", 247 LogicalHadModule, 0, i); 248 }; 249 250 LogicalF2LArGap->SetVisAttributes(ColorOfL 251 // LogicalF2LArGap->SetVisAttributes(G4Vis 252 253 254 // Sensitive Volumes 255 G4SDManager* SDman = G4SDManager::GetSDMpo 256 257 if(!FcalHadModuleSD) 258 { 259 FcalHadModuleSD = new FCALHadModuleSD("FCALT 260 SDman->AddNewDetector(FcalHadModuleSD); 261 } 262 LogicalF2LArGap->SetSensitiveDetector(Fcal 263 264 265 return LogicalHadModule; 266 267 } 268 269 G4int FCALHadModule::GetF2TileID(G4int TileID) 270 { 271 return F2LArITile[TileID]; 272 } 273 274 275 276