Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:16:57

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //   Name of file:       FCALHadModule.cc
0027 //   Author:             Mathieu Fontaine           Rachid Mazini
0028 //                       fontainerlps.umontreal.ca  Rachid.Mazinircern.ch
0029 //   Language:           C++
0030 //   Tested on :         g++
0031 //   Prerequisites:      None
0032 //   Purpose:            Source file defining the geometry of HadModule 0 of the
0033 //                       FCAL.
0034 //   Developped:         10-March-2000   M.F.
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   // construction of materials
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   //   Read Parameters
0120   //----------------------------
0121   InitializeGeometry();
0122 
0123 
0124   //-----------------------------------------
0125   // the logical to be returned (mother)
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   //  LogicalHadModule->SetVisAttributes(G4VisAttributes::GetInvisible());
0139 
0140 
0141   //-----------------------------------------
0142   //  Tungsten Absorber
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 //  G4VPhysicalVolume * PhysicalWAbsorber =
0151     new G4PVPlacement(0, G4ThreeVector(), LogicalWAbsorber, "WAbsorberPhysical",
0152               LogicalHadModule, 0, 0);
0153 
0154   LogicalWAbsorber->SetVisAttributes(ColorOfTungsten);
0155   // LogicalWAbsorber->SetVisAttributes(G4VisAttributes::GetInvisible());
0156 
0157 
0158   // -----------------
0159   //  Copper Plates
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 //  G4VPhysicalVolume * PhysicalCuPlateA =
0168     new G4PVPlacement(0, G4ThreeVector(0.,0.,CuPlateAPosZ), LogicalCuPlate, 
0169               "CuPlateAPhysical", LogicalHadModule, 0, 0);
0170 //  G4VPhysicalVolume * PhysicalCuPlateB =
0171     new G4PVPlacement(0, G4ThreeVector(0.,0.,CuPlateBPosZ), LogicalCuPlate, 
0172               "CuPlateBPhysical", LogicalHadModule, 0, 0);
0173 
0174   LogicalCuPlate->SetVisAttributes(ColorOfCopper);
0175   //  LogicalCuPlate->SetVisAttributes(G4VisAttributes::GetInvisible());
0176 
0177   //------------------------------------------
0178   // Had Module (F2)  Main and A/B Cable Troff 
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 //      G4VPhysicalVolume * PhysicalF2TroffMain =
0201     new G4PVPlacement(G4Transform3D(F2TroffRot,F2TroffMainTrans), LogicalF2TroffMain,
0202               "F2TroffMainPhysical", LogicalWAbsorber,0,i+1);
0203       
0204 //      G4VPhysicalVolume * PhysicalF2TroffAB = 
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   //  LogicalF2TroffMain->SetVisAttributes(G4VisAttributes::GetInvisible());
0213   LogicalF2TroffAB->SetVisAttributes(ColorOfCopper);
0214   // LogicalF2TroffAB->SetVisAttributes(G4VisAttributes::GetInvisible());
0215 
0216 
0217    //----------------------
0218    //  LArg Gaps  + F2 Rod
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    // LogicalF2LArGap->SetVisAttributes(G4VisAttributes::GetInvisible());
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 //    G4VPhysicalVolume * PhysicalF2Rod = 
0235       new G4PVPlacement(0,G4ThreeVector(),LogicalF2Rod,"F2RodPhysical",LogicalF2LArGap,0, 0);
0236 
0237     LogicalF2Rod->SetVisAttributes(ColorOfTungsten);
0238     // LogicalF2Rod->SetVisAttributes(G4VisAttributes::GetInvisible());
0239 
0240     //---------------------------------
0241     // Electrod (Rod + LArg) placement
0242     //---------------------------------
0243     for(i=1; i < NF2LarGap; i++){ 
0244 //      G4VPhysicalVolume * PhysicalF2LArGap =
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     // LogicalF2LArGap->SetVisAttributes(G4VisAttributes::GetInvisible());
0252 
0253 
0254     // Sensitive Volumes
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