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