File indexing completed on 2025-01-18 09:16:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038 #include <fstream>
0039
0040 #include "FCALHadModule.hh"
0041
0042 #include "FCALMaterialConsultant.hh"
0043 #include "FCALHadModuleSD.hh"
0044 #include "G4SDManager.hh"
0045
0046 #include "G4PhysicalConstants.hh"
0047 #include "G4SystemOfUnits.hh"
0048 #include "G4Box.hh"
0049 #include "G4Tubs.hh"
0050 #include "G4LogicalVolume.hh"
0051 #include "G4VPhysicalVolume.hh"
0052 #include "G4PVPlacement.hh"
0053 #include "G4SubtractionSolid.hh"
0054
0055 #include "G4ThreeVector.hh"
0056 #include "G4VisAttributes.hh"
0057 #include "G4Colour.hh"
0058
0059 #include "G4ios.hh"
0060
0061
0062 FCALHadModule::FCALHadModule() :
0063 FcalHadModuleSD(0)
0064 {
0065 F2LArGapID = new G4int[2600];
0066 F2LArIX = new G4int[2600];
0067 F2LArJY = new G4int[2600];
0068 F2LArITile = new G4int[2600];
0069 F2LArGapPosX = new G4double[2600];
0070 F2LArGapPosY = new G4double[2600];
0071 }
0072
0073 FCALHadModule::~FCALHadModule() {
0074 delete [] F2LArGapID;
0075 delete [] F2LArGapPosX;
0076 delete [] F2LArGapPosY;
0077 delete [] F2LArIX;
0078 delete [] F2LArJY;
0079 delete [] F2LArITile;
0080 }
0081
0082
0083 void FCALHadModule::InitializeGeometry() {
0084
0085 #include "FCALHadModuleParameters.input"
0086
0087 std::ifstream File
0088 ("geom_data/FCal2Electrodes.dat");
0089
0090 if(!File) G4cerr << "Failed to open file FCal2Electrode data file" << G4endl;
0091 File.seekg(0);
0092
0093 NF2LarGap = 0;
0094 while(!(File.eof())) {
0095 NF2LarGap++;
0096 File >> F2LArGapID[NF2LarGap] >> F2LArGapPosX[NF2LarGap] >> F2LArGapPosY[NF2LarGap]
0097 >> F2LArIX[NF2LarGap] >> F2LArJY[NF2LarGap] >> F2LArITile[NF2LarGap];
0098 };
0099
0100 G4cout << "*********" << " Number of Rods in FCAL2 : " << NF2LarGap-1 << G4endl;
0101 }
0102
0103
0104 G4LogicalVolume * FCALHadModule::Construct()
0105 {
0106
0107
0108
0109
0110 FCALMaterialConsultant * FCALMaterials =
0111 FCALMaterialConsultant::GetInstance();
0112
0113 G4VisAttributes * ColorOfTungsten = new G4VisAttributes(G4Colour(.5,.5,.5));
0114 G4VisAttributes * ColorOfCopper =new G4VisAttributes(G4Colour(0.58,0.15,0.05));
0115 G4VisAttributes * ColorOfLarg = new G4VisAttributes(G4Colour(0.,0.,1.));
0116
0117
0118
0119
0120
0121 InitializeGeometry();
0122
0123
0124
0125
0126
0127
0128 G4Tubs * SolidHadModule =
0129 new G4Tubs("HadModuleSolid", HadModuleRMin, HadModuleRMax, HadModuleLenght,
0130 HadModuleStartPhi,HadModuleDPhi);
0131 G4LogicalVolume * LogicalHadModule =
0132 new G4LogicalVolume(SolidHadModule, FCALMaterials->Material("Copper"),
0133 "HadModuleLogical");
0134
0135 LogicalHadModule->SetSmartless(FCAL2HadSmart);
0136
0137 LogicalHadModule->SetVisAttributes(ColorOfCopper);
0138
0139
0140
0141
0142
0143
0144 G4Tubs * SolidWAbsorber =
0145 new G4Tubs("WAbsorberSolid", WAbsorberRMin, WAbsorberRMax, WAbsorberLenght,
0146 WAbsorberStartPhi, WAbsorberDPhi);
0147 G4LogicalVolume * LogicalWAbsorber =
0148 new G4LogicalVolume(SolidWAbsorber, FCALMaterials->Material("FCAL2WFeNi"),
0149 "SolidWLogical");
0150
0151 new G4PVPlacement(0, G4ThreeVector(), LogicalWAbsorber, "WAbsorberPhysical",
0152 LogicalHadModule, 0, 0);
0153
0154 LogicalWAbsorber->SetVisAttributes(ColorOfTungsten);
0155
0156
0157
0158
0159
0160
0161 G4Tubs * SolidCuPlate =
0162 new G4Tubs("CuPlateSolid",HadModuleRMin, HadModuleRMax, CuPlateLenght,
0163 HadModuleStartPhi, HadModuleDPhi);
0164 G4LogicalVolume * LogicalCuPlate =
0165 new G4LogicalVolume(SolidCuPlate, FCALMaterials->Material("Copper"), "CuPlateLogical");
0166
0167
0168 new G4PVPlacement(0, G4ThreeVector(0.,0.,CuPlateAPosZ), LogicalCuPlate,
0169 "CuPlateAPhysical", LogicalHadModule, 0, 0);
0170
0171 new G4PVPlacement(0, G4ThreeVector(0.,0.,CuPlateBPosZ), LogicalCuPlate,
0172 "CuPlateBPhysical", LogicalHadModule, 0, 0);
0173
0174 LogicalCuPlate->SetVisAttributes(ColorOfCopper);
0175
0176
0177
0178
0179
0180 G4Tubs * SolidF2TroffMain =
0181 new G4Tubs("F2TroffMainSolid", F2TroffRmin, F2TroffRmax, F2TroffMainLenght,
0182 F2TroffStartPhi, F2TroffDphi);
0183 G4LogicalVolume * LogicalF2TroffMain =
0184 new G4LogicalVolume(SolidF2TroffMain, FCALMaterials->Material("FCAL2CuArKap"),
0185 "F2TroffMainLogical");
0186
0187 G4Tubs * SolidF2TroffAB =
0188 new G4Tubs("F2TroffABSolid", F2TroffRmin, F2TroffRmax, F2TroffABLenght,
0189 F2TroffStartPhi, F2TroffDphi);
0190 G4LogicalVolume * LogicalF2TroffAB =
0191 new G4LogicalVolume(SolidF2TroffAB, FCALMaterials->Material("FCAL2CuArKap"),
0192 "F2TroffABLogical");
0193
0194 G4ThreeVector F2TroffMainTrans(0.,0.,0.);
0195 G4ThreeVector F2TroffABTrans(0.,0.,0.);
0196 G4RotationMatrix F2TroffRot;
0197 G4int i=0;
0198 for(i=0 ; i < NCableTroff ; i++)
0199 {
0200
0201 new G4PVPlacement(G4Transform3D(F2TroffRot,F2TroffMainTrans), LogicalF2TroffMain,
0202 "F2TroffMainPhysical", LogicalWAbsorber,0,i+1);
0203
0204
0205 new G4PVPlacement(G4Transform3D(F2TroffRot,F2TroffABTrans), LogicalF2TroffAB,
0206 "F2TroffAPhysical", LogicalCuPlate, 0, i+1);
0207
0208 F2TroffRot.rotateZ(F2TroffRotZ);
0209 }
0210
0211 LogicalF2TroffMain->SetVisAttributes(ColorOfCopper);
0212
0213 LogicalF2TroffAB->SetVisAttributes(ColorOfCopper);
0214
0215
0216
0217
0218
0219
0220 G4Tubs * SolidF2LArGap =
0221 new G4Tubs("F2LArGapSolid", F2LArGapRmin, F2LArGapRmax, F2LArGapLenght,
0222 F2LArGapStartPhi, F2LArGapDphi);
0223 G4LogicalVolume * LogicalF2LArGap =
0224 new G4LogicalVolume(SolidF2LArGap, FCALMaterials->Material("LiquidArgon"),
0225 "F2LArGapLogical");
0226
0227 LogicalF2LArGap->SetVisAttributes(ColorOfLarg);
0228
0229
0230 G4Tubs * SolidF2Rod =
0231 new G4Tubs("F2RodSolid", F2RodRmin, F2RodRmax, F2RodLenght, F2RodStartPhi, F2RodDphi);
0232 G4LogicalVolume * LogicalF2Rod =
0233 new G4LogicalVolume(SolidF2Rod, FCALMaterials->Material("Tungsten"),"F2RodLogical");
0234
0235 new G4PVPlacement(0,G4ThreeVector(),LogicalF2Rod,"F2RodPhysical",LogicalF2LArGap,0, 0);
0236
0237 LogicalF2Rod->SetVisAttributes(ColorOfTungsten);
0238
0239
0240
0241
0242
0243 for(i=1; i < NF2LarGap; i++){
0244
0245 new G4PVPlacement(0,G4ThreeVector(F2LArGapPosX[i]*cm,F2LArGapPosY[i]*cm,0.*cm),
0246 LogicalF2LArGap,"F2LArGapPhysical",
0247 LogicalHadModule, 0, i);
0248 };
0249
0250 LogicalF2LArGap->SetVisAttributes(ColorOfLarg);
0251
0252
0253
0254
0255 G4SDManager* SDman = G4SDManager::GetSDMpointer();
0256
0257 if(!FcalHadModuleSD)
0258 {
0259 FcalHadModuleSD = new FCALHadModuleSD("FCALTB/HadModuleSD");
0260 SDman->AddNewDetector(FcalHadModuleSD);
0261 }
0262 LogicalF2LArGap->SetSensitiveDetector(FcalHadModuleSD);
0263
0264
0265 return LogicalHadModule;
0266
0267 }
0268
0269 G4int FCALHadModule::GetF2TileID(G4int TileID)
0270 {
0271 return F2LArITile[TileID];
0272 }
0273
0274
0275