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 "FCALTestbeamSetup.hh"
0039 #include "FCALTestbeamSetupSD.hh"
0040
0041 #include "FCALMaterialConsultant.hh"
0042 #include "FCALCryostatVolumes.hh"
0043
0044 #include "FCALTestbeamSetupSD.hh"
0045
0046 #include "G4PhysicalConstants.hh"
0047 #include "G4SystemOfUnits.hh"
0048 #include "G4Box.hh"
0049 #include "G4Tubs.hh"
0050 #include "G4SubtractionSolid.hh"
0051 #include "G4Material.hh"
0052 #include "G4LogicalVolume.hh"
0053 #include "G4VPhysicalVolume.hh"
0054 #include "G4PVPlacement.hh"
0055 #include "G4ThreeVector.hh"
0056 #include "G4RotationMatrix.hh"
0057
0058 #include "G4SDManager.hh"
0059 #include "G4RunManager.hh"
0060
0061 #include "G4VisAttributes.hh"
0062 #include "G4Colour.hh"
0063
0064 #include "G4ios.hh"
0065 #include "G4Threading.hh"
0066
0067 FCALTestbeamSetup::FCALTestbeamSetup() {
0068 #include "FCALTestbeamSetupParameters.input"
0069 }
0070
0071 FCALTestbeamSetup::~FCALTestbeamSetup() {}
0072
0073 G4VPhysicalVolume * FCALTestbeamSetup::Construct()
0074 {
0075 G4int i=0;
0076
0077
0078
0079
0080 G4cout << "Constructing materials...";
0081 FCALMaterialConsultant*
0082 FCALMaterials = FCALMaterialConsultant::GetInstance();
0083 G4cout << "... done" << G4endl;
0084
0085
0086
0087
0088 G4Box * SolidMother = new G4Box("Mother",MotherSizeX,MotherSizeY,MotherSizeZ);
0089 G4LogicalVolume * LogicalMother =
0090 new G4LogicalVolume(SolidMother,FCALMaterials->Material("Air"),"Mother");
0091 G4VPhysicalVolume * PhysicalMother =
0092 new G4PVPlacement(0, G4ThreeVector(),"Mother", LogicalMother, NULL, 0,0);
0093
0094 LogicalMother->SetVisAttributes(G4VisAttributes::GetInvisible());
0095
0096
0097
0098
0099
0100 G4Box * SolidScintS1andS3 =
0101 new G4Box("ScintS1andS3Solid",ScintS1andS3SizeX, ScintS1andS3SizeY, ScintS1andS3SizeZ);
0102 G4Box * SolidScintS2 =
0103 new G4Box("ScintS2Solid", ScintS2SizeX, ScintS2SizeY, ScintS2SizeZ);
0104
0105 G4LogicalVolume * LogicalScintS1andS3 =
0106 new G4LogicalVolume(SolidScintS1andS3,FCALMaterials->Material("Polystyrene"),
0107 "ScintS1andS3Logical");
0108 G4LogicalVolume * LogicalScintS2 =
0109 new G4LogicalVolume(SolidScintS2, FCALMaterials->Material("Polystyrene"),
0110 "ScintS2Logical");
0111
0112
0113 new G4PVPlacement(0, G4ThreeVector(ScintS1_S3PosX, ScintS1_S3PosY, ScintS1PosZ),
0114 "ScintS1Physical",LogicalScintS1andS3,PhysicalMother,0,0);
0115
0116 new G4PVPlacement(0, G4ThreeVector(ScintS1_S3PosX, ScintS1_S3PosY, ScintS3PosZ),
0117 "ScintS3Physical",LogicalScintS1andS3,PhysicalMother,0,0);
0118
0119 new G4PVPlacement(0, G4ThreeVector(ScintS1_S3PosX, ScintS1_S3PosY, ScintS2PosZ),
0120 "ScintS2Physical", LogicalScintS2, PhysicalMother,0,0);
0121
0122 G4VisAttributes * ColorOfScintillator = new G4VisAttributes(G4Colour(0.,0.8,0.));
0123 LogicalScintS1andS3->SetVisAttributes(ColorOfScintillator);
0124 LogicalScintS2->SetVisAttributes(ColorOfScintillator);
0125
0126
0127
0128
0129
0130 G4Box* SolidMWPC = new G4Box("MWPCSolid",MWPCSizeX,MWPCSizeY,MWPCSizeZ);
0131 G4LogicalVolume * LogicalMWPC =
0132 new G4LogicalVolume(SolidMWPC,FCALMaterials->Material("MWPCArCO2"),"MWPCLogical");
0133 for(i=0; i<5; i++)
0134 {
0135
0136 new G4PVPlacement(0,G4ThreeVector(MWPCPosX,MWPCPosY,MWPCPosZ[i]),
0137 "MWPCPhysical", LogicalMWPC, PhysicalMother,0,i+1);
0138 }
0139 G4VisAttributes * ColorOfMWPC = new G4VisAttributes(G4Colour(0.,0.,0.5));
0140 LogicalMWPC->SetVisAttributes(ColorOfMWPC);
0141
0142
0143
0144
0145
0146 G4Box * SolidHoleCntrScint =
0147 new G4Box("ScintSolid", HoleCntrSizeX, HoleCntrSizeY, HoleCntrScintSizeZ);
0148 G4LogicalVolume * LogicalHoleCntrScint =
0149 new G4LogicalVolume(SolidHoleCntrScint, FCALMaterials->Material("Polystyrene"),
0150 "HoleCntrScintLogical");
0151
0152 G4Tubs * SolidHole =
0153 new G4Tubs("HoleSolid", ScintHoleRmin, ScintHoleRmax, ScintHoleLenght,
0154 HoleStartPhi, HoleDPhi);
0155 G4LogicalVolume * LogicalHole =
0156 new G4LogicalVolume(SolidHole, FCALMaterials->Material("Air"), "HoleLogical");
0157
0158 new G4PVPlacement(0, G4ThreeVector(HolePosX, HolePosY, HolePosZ), LogicalHole,
0159 "HolePhysicalScint", LogicalHoleCntrScint, 0, 0);
0160
0161
0162 new G4PVPlacement(0,
0163 G4ThreeVector(HoleCntrScintPosX, HoleCntrScintPosY, HoleCntrScintPosZ),
0164 "HoleCntrScintPhysical", LogicalHoleCntrScint, PhysicalMother, 0, 0);
0165
0166
0167 G4Box * SolidHoleCntrAbsrb =
0168 new G4Box("AbsrbSolid", HoleCntrSizeX, HoleCntrSizeY, HoleCntrAbsrbSizeZ);
0169 G4LogicalVolume * LogicalHoleCntrPb =
0170 new G4LogicalVolume(SolidHoleCntrAbsrb, FCALMaterials->Material("Lead"),
0171 "HoleCntrPbLoghical");
0172
0173
0174 G4Tubs * SolidHoleAbs =
0175 new G4Tubs("HoleSolidAbs", AbsrbHoleRmin, AbsrbHoleRmax, AbsrbHoleLenght,
0176 HoleStartPhi, HoleDPhi);
0177 G4LogicalVolume * LogicalHoleAbs =
0178 new G4LogicalVolume(SolidHoleAbs, FCALMaterials->Material("Air"),"HoleAbsLogical");
0179
0180 new G4PVPlacement(0, G4ThreeVector(HolePosX, HolePosY, HolePosZ), LogicalHoleAbs,
0181 "HolePbPhysical", LogicalHoleCntrPb, 0, 0);
0182
0183
0184
0185 new G4PVPlacement(0, G4ThreeVector(HoleCntrPbPosX, HoleCntrPbPosY, HoleCntrPbPosZ),
0186 "HoleCntrPbPhysical", LogicalHoleCntrPb, PhysicalMother, 0, 0);
0187
0188
0189 G4LogicalVolume * LogicalHoleCntrAl =
0190 new G4LogicalVolume(SolidHoleCntrAbsrb, FCALMaterials->Material("Aluminium"),
0191 "HoleCntrAlLogical");
0192
0193 new G4PVPlacement(0, G4ThreeVector(HolePosX, HolePosY, HolePosZ), LogicalHoleAbs,
0194 "HoleAlPhysical", LogicalHoleCntrAl, 0, 0);
0195
0196 new G4PVPlacement(0, G4ThreeVector(HoleCntrAlPosX, HoleCntrAlPosY, HoleCntrAlPosZ),
0197 "HoleCntrAlPhysical", LogicalHoleCntrAl, PhysicalMother, 0, 0);
0198
0199 LogicalHoleCntrScint->SetVisAttributes(ColorOfScintillator);
0200
0201 G4VisAttributes * ColorOfLead = new G4VisAttributes(G4Colour(0.5,0.5,0.8));
0202 G4VisAttributes * ColorOfAlu = new G4VisAttributes(G4Colour(0.5,0.5,0.3));
0203 LogicalHoleCntrPb->SetVisAttributes(ColorOfLead);
0204 LogicalHoleCntrAl->SetVisAttributes(ColorOfAlu);
0205
0206 G4VisAttributes * ColorOfAir = new G4VisAttributes(G4Colour(1.,1.,1.));
0207 LogicalHole->SetVisAttributes(ColorOfAir);
0208 LogicalHoleAbs->SetVisAttributes(ColorOfAir);
0209
0210
0211
0212
0213
0214 G4Box * SolidLeadWall =
0215 new G4Box("LeadWallSolid", LeadWallSizeX, LeadWallSizeY, LeadWallSizeZ);
0216 G4LogicalVolume * LogicalLeadWall =
0217 new G4LogicalVolume(SolidLeadWall, FCALMaterials->Material("Lead"),
0218 "LeadWallLogical");
0219
0220 G4Box * SolidSlitPb = new G4Box("SlitPb", LeadWallSlitSizeX, LeadWallSlitSizeY,
0221 LeadWallSlitSizeZ);
0222 G4LogicalVolume * LogicalSlitPb =
0223 new G4LogicalVolume(SolidSlitPb, FCALMaterials->Material("Air"), "SlitPbLogical");
0224
0225 new G4PVPlacement(0, G4ThreeVector(), LogicalSlitPb, "SlitPbPhysical", LogicalLeadWall, 0, 0);
0226
0227
0228 new G4PVPlacement(0, G4ThreeVector(LeadWallPosX,LeadWallPosY,LeadWallPosZ),
0229 "LeadWallPhysical", LogicalLeadWall, PhysicalMother, 0, 0);
0230
0231 LogicalLeadWall->SetVisAttributes(ColorOfLead);
0232 LogicalSlitPb->SetVisAttributes(ColorOfAir);
0233
0234
0235
0236
0237
0238 G4Box * SolidIronWall =
0239 new G4Box("IronWallSolid", IronWallSizeX, IronWallSizeY, IronWallSizeZ);
0240 G4LogicalVolume * LogicalIronWall =
0241 new G4LogicalVolume(SolidIronWall, FCALMaterials->Material("Iron"),
0242 "IronWallLogical");
0243
0244 G4Box * SolidSlitFe = new G4Box("SlitFe", IronWallSlitSizeX, IronWallSlitSizeY,
0245 IronWallSlitSizeZ);
0246 G4LogicalVolume * LogicalSlitFe =
0247 new G4LogicalVolume(SolidSlitFe, FCALMaterials->Material("Air"), "SlitFeLogical");
0248
0249 new G4PVPlacement(0, G4ThreeVector(), LogicalSlitFe, "SlitFePhysical", LogicalIronWall, 0, 0);
0250
0251
0252 new G4PVPlacement(0, G4ThreeVector(IronWallPosX,IronWallPosY,IronWallPosZ),
0253 "IronWallPhysical", LogicalIronWall, PhysicalMother, 0, 0);
0254
0255 G4VisAttributes * ColorOfIron = new G4VisAttributes(G4Colour(0.2,0.2,0.2));
0256 LogicalIronWall->SetVisAttributes(ColorOfIron);
0257 LogicalSlitFe->SetVisAttributes(ColorOfAir);
0258
0259
0260
0261
0262 G4Box * SolidBigScint =
0263 new G4Box("BigSolidScint",BigScintSizeX, BigScintSizeY, ScintSizeZ);
0264 G4LogicalVolume * LogicalBigScint =
0265 new G4LogicalVolume(SolidBigScint, FCALMaterials->Material("Polystyrene"),
0266 "BigScintLogical");
0267
0268 G4Box * SolidSmallScint =
0269 new G4Box("SmallSolidScint",SmallScintSizeX, SmallScintSizeY, ScintSizeZ);
0270 G4LogicalVolume * LogicalSmallScint =
0271 new G4LogicalVolume(SolidSmallScint, FCALMaterials->Material("Polystyrene"),
0272 "SmallScintLogical");
0273
0274 for( i=0; i<(NBigScint+NSmallScint); i++)
0275 {
0276 if(i<NBigScint)
0277 {
0278 new G4PVPlacement(0, G4ThreeVector(ScintPosX, ScintPosY, ScintPosZ[i]),
0279 "BigScintPhysical", LogicalBigScint, PhysicalMother,
0280 0, i+1);
0281 }
0282 else
0283 {
0284 new G4PVPlacement(0, G4ThreeVector(ScintPosX, ScintPosY, ScintPosZ[i]),
0285 "SmallScintPhysical", LogicalSmallScint, PhysicalMother,
0286 0, i+1);
0287 }
0288 }
0289 LogicalBigScint->SetVisAttributes(ColorOfScintillator);
0290 LogicalSmallScint->SetVisAttributes(ColorOfScintillator);
0291
0292
0293 G4Box * SolidBigIron =
0294 new G4Box("BigSolidIron",BigIronSizeX, BigIronSizeY, IronSizeZ);
0295 G4LogicalVolume * LogicalBigIron =
0296 new G4LogicalVolume(SolidBigIron, FCALMaterials->Material("Polystyrene"),
0297 "BigIronLogical");
0298
0299 G4Box * SolidSmallIron =
0300 new G4Box("SmallSolidIron",SmallIronSizeX, SmallIronSizeY, IronSizeZ);
0301 G4LogicalVolume * LogicalSmallIron =
0302 new G4LogicalVolume(SolidSmallIron, FCALMaterials->Material("Iron"),
0303 "SmallIronLogical");
0304
0305 for( i=0; i<(NBigIron+NSmallIron); i++)
0306 {
0307 if(i<NBigIron)
0308 {
0309 new G4PVPlacement(0, G4ThreeVector(IronPosX, IronPosY, IronPosZ[i]),
0310 "BigIronPhysical", LogicalBigIron, PhysicalMother,
0311 0, i+1);
0312 }
0313 else
0314 {
0315 new G4PVPlacement(0, G4ThreeVector(IronPosX, IronPosY, IronPosZ[i]),
0316 "SmallIronPhysical", LogicalSmallIron, PhysicalMother,
0317 0, i+1);
0318 }
0319 }
0320 LogicalBigIron->SetVisAttributes(ColorOfIron);
0321 LogicalSmallIron->SetVisAttributes(ColorOfIron);
0322
0323
0324
0325
0326 G4Box * SolidConcWall =
0327 new G4Box("ConcWallSolid", ConcWallSizeX, ConcWallSizeY, ConcWallSizeZ);
0328 G4LogicalVolume * LogicalConcWallA =
0329 new G4LogicalVolume(SolidConcWall, FCALMaterials->Material("ShieldingConcrete"),
0330 "ConcWallALogical");
0331 G4VPhysicalVolume * PhysicalConcWallA =
0332 new G4PVPlacement(0, G4ThreeVector(ConcWallPosX, ConcWallPosY, ConcWallAPosZ),
0333 "ConcWallAPhysical", LogicalConcWallA, PhysicalMother, 0, 0);
0334
0335 G4LogicalVolume * LogicalConcWallB =
0336 new G4LogicalVolume(SolidConcWall, FCALMaterials->Material("ShieldingConcrete"),
0337 "ConcWallBLogical");
0338
0339 new G4PVPlacement(0, G4ThreeVector(ConcWallPosX, ConcWallPosY, ConcWallBPosZ),
0340 "ConcWallBPhysical", LogicalConcWallB, PhysicalMother, 0, 0);
0341
0342 G4Box * SolidConcWallIns =
0343 new G4Box("ConcWallInsSolid", ConcWallInsSizeX,ConcWallInsSizeY,ConcWallInsSizeZ);
0344 G4LogicalVolume * LogicalConcWallIns =
0345 new G4LogicalVolume(SolidConcWallIns, FCALMaterials->Material("Iron"),
0346 "LogicalConcWallIns");
0347
0348 new G4PVPlacement(0, G4ThreeVector(), "ConcWallInsPhysical", LogicalConcWallIns, PhysicalConcWallA, 0, 0);
0349
0350 G4VisAttributes * ColorOfConcrete = new G4VisAttributes(G4Colour(0.,0.,0.));
0351 LogicalConcWallA->SetVisAttributes(ColorOfConcrete);
0352 LogicalConcWallB->SetVisAttributes(ColorOfConcrete);
0353 LogicalConcWallIns->SetVisAttributes(ColorOfIron);
0354
0355
0356
0357
0358 G4Box * SolidMuContr =
0359 new G4Box("MuContrSolid", MuCntrSIzeX, MuCntrSIzeY, MuCntrSIzeZ);
0360 G4LogicalVolume * LogicalMuContr =
0361 new G4LogicalVolume(SolidMuContr, FCALMaterials->Material("Polystyrene"),
0362 "MuContrLogical");
0363
0364 new G4PVPlacement(0, G4ThreeVector(MuCntrPosX, MuCntrPosY, MuCntrPosZ),
0365 "MuContrPhyiscal", LogicalMuContr, PhysicalMother, 0, 0);
0366
0367 LogicalMuContr->SetVisAttributes(ColorOfScintillator);
0368
0369
0370
0371
0372
0373
0374 G4RotationMatrix* CryostatRotationMatrix =
0375 new G4RotationMatrix();
0376
0377
0378
0379
0380
0381
0382
0383
0384
0385
0386
0387
0388 CryostatRotationMatrix->rotateX(90*deg);
0389
0390 FCALCryostatVolumes * CryostatVolumes = new FCALCryostatVolumes();
0391
0392 G4LogicalVolume * theCryostatVolumes = CryostatVolumes->Construct();
0393
0394
0395 new G4PVPlacement(CryostatRotationMatrix,
0396 G4ThreeVector(CryostatPosX,CryostatPosY,CryostatPosZ),"CryostatVolumes"
0397 , theCryostatVolumes, PhysicalMother, 0,0);
0398
0399
0400 return PhysicalMother;
0401
0402 }
0403
0404 void FCALTestbeamSetup::ConstructSDandField()
0405 {
0406
0407
0408
0409 G4SDManager* SDman = G4SDManager::GetSDMpointer();
0410 const G4String detName = "FCALTB/TBSetupSD";
0411 FCALTestbeamSetupSD* FCALTBSetupSD = static_cast<FCALTestbeamSetupSD*>(SDman->FindSensitiveDetector(detName));
0412 if(!FCALTBSetupSD)
0413 {
0414 FCALTBSetupSD = new FCALTestbeamSetupSD(detName);
0415 SDman->AddNewDetector(FCALTBSetupSD);
0416 }
0417 SetSensitiveDetector("ScintS1andS3Logical",FCALTBSetupSD);
0418 SetSensitiveDetector("ScintS2Logical",FCALTBSetupSD);
0419 SetSensitiveDetector("MWPCLogical",FCALTBSetupSD);
0420 SetSensitiveDetector("HoleCntrScintLogical",FCALTBSetupSD);
0421 SetSensitiveDetector("HoleCntrPbLoghical",FCALTBSetupSD);
0422 SetSensitiveDetector("HoleCntrAlLogical",FCALTBSetupSD);
0423
0424 SetSensitiveDetector("LeadWallLogical",FCALTBSetupSD);
0425 SetSensitiveDetector("IronWallLogical",FCALTBSetupSD);
0426 SetSensitiveDetector("BigScintLogical",FCALTBSetupSD);
0427 SetSensitiveDetector("SmallScintLogical",FCALTBSetupSD);
0428
0429 SetSensitiveDetector("BigIronLogical",FCALTBSetupSD);
0430 SetSensitiveDetector("SmallIronLogical",FCALTBSetupSD);
0431 SetSensitiveDetector("ConcWallALogical",FCALTBSetupSD);
0432 SetSensitiveDetector("ConcWallBLogical",FCALTBSetupSD);
0433 SetSensitiveDetector("LogicalConcWallIns",FCALTBSetupSD);
0434 SetSensitiveDetector("MuContrLogical",FCALTBSetupSD);
0435 }
0436