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 // Author: Rachid Mazini 23 // Author: Rachid Mazini 27 // Rachid.Mazini@cern.ch 24 // Rachid.Mazini@cern.ch 28 // Language: C++ 25 // Language: C++ 29 // Tested on : g++ (egcs.2.1.1, RH6. 26 // Tested on : g++ (egcs.2.1.1, RH6.1) 30 // Prerequisites: None 27 // Prerequisites: None 31 // Purpose: Source file defining 28 // Purpose: Source file defining the geometry of EMModule 0 of the 32 // FCAL. 29 // FCAL. 33 // Developped: 10-March-2000 R.M. 30 // Developped: 10-March-2000 R.M. 34 // 31 // 35 // 32 // 36 //-------------------------------------------- 33 //----------------------------------------------------------------------------- 37 34 38 #include <fstream> << 39 #include <cstdlib> << 40 << 41 #include "FCALEMModule.hh" 35 #include "FCALEMModule.hh" 42 36 43 #include "FCALMaterialConsultant.hh" 37 #include "FCALMaterialConsultant.hh" 44 38 45 #include "G4SDManager.hh" 39 #include "G4SDManager.hh" 46 #include "FCALEMModuleSD.hh" 40 #include "FCALEMModuleSD.hh" 47 41 48 #include "G4PhysicalConstants.hh" << 49 #include "G4SystemOfUnits.hh" << 50 #include "G4Box.hh" 42 #include "G4Box.hh" 51 #include "G4Tubs.hh" 43 #include "G4Tubs.hh" 52 #include "G4LogicalVolume.hh" 44 #include "G4LogicalVolume.hh" 53 #include "G4VPhysicalVolume.hh" 45 #include "G4VPhysicalVolume.hh" 54 #include "G4PVPlacement.hh" 46 #include "G4PVPlacement.hh" 55 #include "G4SubtractionSolid.hh" 47 #include "G4SubtractionSolid.hh" 56 48 57 #include "G4ThreeVector.hh" 49 #include "G4ThreeVector.hh" 58 #include "G4VisAttributes.hh" 50 #include "G4VisAttributes.hh" 59 #include "G4Colour.hh" 51 #include "G4Colour.hh" 60 52 61 FCALEMModule::FCALEMModule() : << 53 #include <fstream> 62 FcalEmModuleSD(0) << 54 #include <cstdlib> 63 { << 55 >> 56 FCALEMModule::FCALEMModule() { 64 F1LArGapID = new G4int[2400]; 57 F1LArGapID = new G4int[2400]; 65 F1LArIX = new G4int[2400]; 58 F1LArIX = new G4int[2400]; 66 F1LArJY = new G4int[2400]; 59 F1LArJY = new G4int[2400]; 67 F1LArITile = new G4int[2400]; 60 F1LArITile = new G4int[2400]; 68 F1LArGapPosX = new G4double[2400]; 61 F1LArGapPosX = new G4double[2400]; 69 F1LArGapPosY = new G4double[2400]; 62 F1LArGapPosY = new G4double[2400]; 70 } << 63 }; 71 64 72 65 73 FCALEMModule::~FCALEMModule(){ 66 FCALEMModule::~FCALEMModule(){ 74 delete [] F1LArGapID; 67 delete [] F1LArGapID; 75 delete [] F1LArGapPosX; 68 delete [] F1LArGapPosX; 76 delete [] F1LArGapPosY; 69 delete [] F1LArGapPosY; 77 delete [] F1LArIX; 70 delete [] F1LArIX; 78 delete [] F1LArJY; 71 delete [] F1LArJY; 79 delete [] F1LArITile; 72 delete [] F1LArITile; 80 } << 73 }; 81 74 82 75 83 void FCALEMModule::InitializeGeometry() { 76 void FCALEMModule::InitializeGeometry() { 84 #include "FCALEMModuleParameters.input" 77 #include "FCALEMModuleParameters.input" 85 std::ifstream File 78 std::ifstream File 86 ("geom_data/FCal1Electrodes.dat"); 79 ("geom_data/FCal1Electrodes.dat"); 87 80 88 if(!File) G4cerr << "Failed to open file FC 81 if(!File) G4cerr << "Failed to open file FCal1Electrodes data file " << G4endl; 89 File.seekg(0); 82 File.seekg(0); 90 83 91 NF1LarGap = 0; 84 NF1LarGap = 0; 92 while(!(File.eof())) { 85 while(!(File.eof())) { 93 NF1LarGap++; 86 NF1LarGap++; 94 File >> F1LArGapID[NF1LarGap] >> F1LArGapP 87 File >> F1LArGapID[NF1LarGap] >> F1LArGapPosX[NF1LarGap] >> F1LArGapPosY[NF1LarGap] 95 >> F1LArIX[NF1LarGap] >> F1LArJY[NF1LarGap 88 >> F1LArIX[NF1LarGap] >> F1LArJY[NF1LarGap] >> F1LArITile[NF1LarGap]; 96 }; 89 }; 97 G4cout << "********" << " Number of Rods in 90 G4cout << "********" << " Number of Rods in FCAL1 : " << NF1LarGap-1 << G4endl;; 98 } << 91 }; 99 92 100 93 101 94 102 G4LogicalVolume * FCALEMModule::Construct() 95 G4LogicalVolume * FCALEMModule::Construct() 103 { 96 { 104 //----------------------------- 97 //----------------------------- 105 // construction of materials 98 // construction of materials 106 //----------------------------- 99 //----------------------------- 107 FCALMaterialConsultant *FCALMaterials = << 100 FCALMaterialConsultant * FCALMaterials = new FCALMaterialConsultant(); 108 FCALMaterialConsultant::GetInstance(); << 101 FCALMaterials->construct(); 109 102 110 G4VisAttributes * ColorOfEMModule = new G4Vi 103 G4VisAttributes * ColorOfEMModule = new G4VisAttributes(G4Colour(1.,0.,0.5)); 111 // G4VisAttributes * ColorOfLArg = new G4VisA 104 // G4VisAttributes * ColorOfLArg = new G4VisAttributes(G4Colour(0.,0.,1.)); 112 105 113 //---------------------------- 106 //---------------------------- 114 // Read Parameters 107 // Read Parameters 115 //---------------------------- 108 //---------------------------- 116 InitializeGeometry(); 109 InitializeGeometry(); 117 110 118 //----------------------------------------- 111 //----------------------------------------- 119 // Logical to be returned (FCAL EM module) 112 // Logical to be returned (FCAL EM module) 120 //----------------------------------------- 113 //----------------------------------------- 121 G4Tubs * SolidEmModule = 114 G4Tubs * SolidEmModule = 122 new G4Tubs("EmModuleSold", EmModuleRMin, E 115 new G4Tubs("EmModuleSold", EmModuleRMin, EmModuleRMax, EmModuleLenght, 123 EmModuleStartPhi,EmModuleDPhi); 116 EmModuleStartPhi,EmModuleDPhi); 124 G4LogicalVolume * LogicalEmModule = 117 G4LogicalVolume * LogicalEmModule = 125 new G4LogicalVolume(SolidEmModule, FCALMat 118 new G4LogicalVolume(SolidEmModule, FCALMaterials->Material("Copper"), 126 "EmModuleLogical"); 119 "EmModuleLogical"); 127 120 128 LogicalEmModule->SetSmartless(FCALEmSmart); 121 LogicalEmModule->SetSmartless(FCALEmSmart); 129 122 130 LogicalEmModule->SetVisAttributes(ColorOfEM 123 LogicalEmModule->SetVisAttributes(ColorOfEMModule); 131 // LogicalEmModule->SetVisAttributes(G4VisA << 124 // LogicalEmModule->SetVisAttributes(G4VisAttributes::Invisible); 132 125 133 126 134 //--------------------- 127 //--------------------- 135 // FCAL Cable Troff 128 // FCAL Cable Troff 136 //--------------------- 129 //--------------------- 137 G4Tubs * SolidF1CableTroff = 130 G4Tubs * SolidF1CableTroff = 138 new G4Tubs("F1CableTroffSolid", F1CableTro 131 new G4Tubs("F1CableTroffSolid", F1CableTroffRMin, F1CableTroffRMax, 139 F1CableTroffLenght, F1CableTroffStart 132 F1CableTroffLenght, F1CableTroffStartPhi, F1CableTroffDPhi); 140 G4LogicalVolume * LogicalF1CableTroff = 133 G4LogicalVolume * LogicalF1CableTroff = 141 new G4LogicalVolume(SolidF1CableTroff, FCA 134 new G4LogicalVolume(SolidF1CableTroff, FCALMaterials->Material("FCAL1CuArKap"), 142 "F1CableTroffLogical"); 135 "F1CableTroffLogical"); 143 136 144 G4ThreeVector F1CableTroffTrans(0.,0.,0.); 137 G4ThreeVector F1CableTroffTrans(0.,0.,0.); 145 G4RotationMatrix F1CableTroffRot; 138 G4RotationMatrix F1CableTroffRot; 146 139 147 G4int i=0; 140 G4int i=0; 148 for(i=0 ; i < NCableTroff ; i++) 141 for(i=0 ; i < NCableTroff ; i++) 149 { 142 { 150 // G4VPhysicalVolume * PhysicalF1CableTro 143 // G4VPhysicalVolume * PhysicalF1CableTroff = 151 new G4PVPlacement(G4Transform3D(F1CableTroff 144 new G4PVPlacement(G4Transform3D(F1CableTroffRot,F1CableTroffTrans), 152 LogicalF1CableTroff,"F1CableTroffPhysi 145 LogicalF1CableTroff,"F1CableTroffPhysical", 153 LogicalEmModule,0,i+1); 146 LogicalEmModule,0,i+1); 154 147 155 F1CableTroffRot.rotateZ(F1CableTroffRotZ 148 F1CableTroffRot.rotateZ(F1CableTroffRotZ); 156 } 149 } 157 150 158 LogicalF1CableTroff->SetVisAttributes(ColorO 151 LogicalF1CableTroff->SetVisAttributes(ColorOfEMModule); 159 // LogicalF1CableTroff->SetVisAttributes(G4V << 152 // LogicalF1CableTroff->SetVisAttributes(G4VisAttributes::Invisible); 160 153 161 154 162 //---------------------- 155 //---------------------- 163 // LArg gaps 156 // LArg gaps 164 //---------------------- 157 //---------------------- 165 158 166 G4Tubs * SolidF1LArGap = 159 G4Tubs * SolidF1LArGap = 167 new G4Tubs("F1LArGapSolid",F1LArGapRmin, F 160 new G4Tubs("F1LArGapSolid",F1LArGapRmin, F1LArGapRmax, F1LArGapLenght, 168 F1LArGapStartPhi,F1LArGapDPhi); 161 F1LArGapStartPhi,F1LArGapDPhi); 169 162 170 G4LogicalVolume * LogicalF1LArGap = 163 G4LogicalVolume * LogicalF1LArGap = 171 new G4LogicalVolume(SolidF1LArGap, FCALMa 164 new G4LogicalVolume(SolidF1LArGap, FCALMaterials->Material("LiquidArgon"), 172 "LArg Gap"); 165 "LArg Gap"); 173 166 174 for(i=1; i < NF1LarGap; i++){ 167 for(i=1; i < NF1LarGap; i++){ 175 // G4VPhysicalVolume * PhysicalF1LArGap = 168 // G4VPhysicalVolume * PhysicalF1LArGap = 176 new G4PVPlacement(0,G4ThreeVector(F1LAr 169 new G4PVPlacement(0,G4ThreeVector(F1LArGapPosX[i]*cm,F1LArGapPosY[i]*cm,0.*cm), 177 LogicalF1LArGap,"F1LArGapPhysical", Lo 170 LogicalF1LArGap,"F1LArGapPhysical", LogicalEmModule, 0, i); 178 }; 171 }; 179 172 180 // LogicalF1LArGap->SetVisAttributes(ColorO 173 // LogicalF1LArGap->SetVisAttributes(ColorOfLArg); 181 LogicalF1LArGap->SetVisAttributes(G4VisAttr << 174 LogicalF1LArGap->SetVisAttributes(G4VisAttributes::Invisible); 182 175 183 176 184 // Sensitive Volumes 177 // Sensitive Volumes 185 G4SDManager* SDman = G4SDManager::GetSDMpoi 178 G4SDManager* SDman = G4SDManager::GetSDMpointer(); 186 179 187 if(!FcalEmModuleSD) 180 if(!FcalEmModuleSD) 188 { 181 { 189 FcalEmModuleSD = new FCALEMModuleSD("FC 182 FcalEmModuleSD = new FCALEMModuleSD("FCALTB/EmModuleSD"); 190 SDman->AddNewDetector(FcalEmModuleSD); 183 SDman->AddNewDetector(FcalEmModuleSD); 191 } 184 } 192 LogicalF1LArGap->SetSensitiveDetector(FcalE 185 LogicalF1LArGap->SetSensitiveDetector(FcalEmModuleSD); 193 186 194 187 195 188 196 return LogicalEmModule; 189 return LogicalEmModule; 197 190 198 } << 191 }; 199 192 200 193 201 G4int FCALEMModule::GetF1TileID(G4int GapID) 194 G4int FCALEMModule::GetF1TileID(G4int GapID) 202 { return F1LArITile[GapID]; } 195 { return F1LArITile[GapID]; } 203 196 204 G4double FCALEMModule::GetF1LArGapPosX(G4int G 197 G4double FCALEMModule::GetF1LArGapPosX(G4int GapID) 205 { return F1LArGapPosX[GapID]; } 198 { return F1LArGapPosX[GapID]; } 206 199 207 200 208 201