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