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 //   Author:             Rachid Mazini
0027 //                       Rachid.Mazini@cern.ch
0028 //   Language:           C++
0029 //   Tested on :         g++ (egcs.2.1.1, RH6.1)
0030 //   Prerequisites:      None
0031 //   Purpose:            Source file defining the geometry of EMModule 0 of the
0032 //                       FCAL.
0033 //   Developped:         10-March-2000   R.M.
0034 //   
0035 //
0036 //-----------------------------------------------------------------------------
0037 
0038 #include <fstream>
0039 #include <cstdlib>
0040 
0041 #include "FCALEMModule.hh"
0042 
0043 #include "FCALMaterialConsultant.hh"
0044 
0045 #include "G4SDManager.hh"
0046 #include "FCALEMModuleSD.hh"
0047 
0048 #include "G4PhysicalConstants.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4Box.hh"
0051 #include "G4Tubs.hh"
0052 #include "G4LogicalVolume.hh"
0053 #include "G4VPhysicalVolume.hh"
0054 #include "G4PVPlacement.hh"
0055 #include "G4SubtractionSolid.hh"
0056 
0057 #include "G4ThreeVector.hh"
0058 #include "G4VisAttributes.hh"
0059 #include "G4Colour.hh"
0060 
0061 FCALEMModule::FCALEMModule() : 
0062   FcalEmModuleSD(0)
0063  {
0064   F1LArGapID   = new G4int[2400];
0065   F1LArIX      = new G4int[2400];
0066   F1LArJY      = new G4int[2400];
0067   F1LArITile   = new G4int[2400];
0068   F1LArGapPosX = new G4double[2400];
0069   F1LArGapPosY = new G4double[2400];
0070 }
0071 
0072 
0073 FCALEMModule::~FCALEMModule(){
0074   delete [] F1LArGapID;
0075   delete [] F1LArGapPosX;
0076   delete [] F1LArGapPosY;
0077   delete [] F1LArIX;
0078   delete [] F1LArJY;
0079   delete [] F1LArITile;
0080 }
0081 
0082 
0083 void FCALEMModule::InitializeGeometry() {
0084 #include "FCALEMModuleParameters.input"  
0085   std::ifstream File
0086     ("geom_data/FCal1Electrodes.dat");
0087   
0088   if(!File)  G4cerr << "Failed to open file FCal1Electrodes data file  " << G4endl;
0089   File.seekg(0);
0090   
0091   NF1LarGap = 0;
0092   while(!(File.eof())) {
0093     NF1LarGap++;
0094     File >> F1LArGapID[NF1LarGap] >> F1LArGapPosX[NF1LarGap] >> F1LArGapPosY[NF1LarGap]
0095      >> F1LArIX[NF1LarGap] >>  F1LArJY[NF1LarGap] >> F1LArITile[NF1LarGap];
0096   };   
0097   G4cout << "********" << " Number of Rods in FCAL1 : " << NF1LarGap-1 << G4endl;;
0098 }
0099 
0100 
0101 
0102 G4LogicalVolume * FCALEMModule::Construct()
0103 {
0104   //-----------------------------
0105   // construction of materials
0106   //----------------------------- 
0107   FCALMaterialConsultant *FCALMaterials = 
0108     FCALMaterialConsultant::GetInstance();
0109 
0110   G4VisAttributes * ColorOfEMModule = new G4VisAttributes(G4Colour(1.,0.,0.5));
0111 //  G4VisAttributes * ColorOfLArg = new G4VisAttributes(G4Colour(0.,0.,1.));
0112 
0113   //----------------------------
0114   //      Read Parameters
0115   //----------------------------
0116   InitializeGeometry();
0117 
0118 //-----------------------------------------
0119 // Logical to be returned (FCAL EM module)
0120 //-----------------------------------------
0121   G4Tubs * SolidEmModule =
0122     new G4Tubs("EmModuleSold", EmModuleRMin, EmModuleRMax, EmModuleLenght,
0123            EmModuleStartPhi,EmModuleDPhi);
0124   G4LogicalVolume * LogicalEmModule = 
0125     new G4LogicalVolume(SolidEmModule, FCALMaterials->Material("Copper"),
0126             "EmModuleLogical");
0127  
0128   LogicalEmModule->SetSmartless(FCALEmSmart);
0129 
0130    LogicalEmModule->SetVisAttributes(ColorOfEMModule);
0131   //  LogicalEmModule->SetVisAttributes(G4VisAttributes::GetInvisible());
0132 
0133 
0134 //---------------------
0135 //  FCAL Cable Troff  
0136 //---------------------
0137   G4Tubs * SolidF1CableTroff =
0138     new G4Tubs("F1CableTroffSolid", F1CableTroffRMin, F1CableTroffRMax,
0139            F1CableTroffLenght, F1CableTroffStartPhi, F1CableTroffDPhi);
0140   G4LogicalVolume * LogicalF1CableTroff =
0141     new G4LogicalVolume(SolidF1CableTroff, FCALMaterials->Material("FCAL1CuArKap"),
0142             "F1CableTroffLogical");
0143 
0144   G4ThreeVector F1CableTroffTrans(0.,0.,0.);
0145   G4RotationMatrix F1CableTroffRot;
0146 
0147   G4int i=0;
0148   for(i=0 ; i < NCableTroff ; i++)
0149     {
0150 //      G4VPhysicalVolume * PhysicalF1CableTroff =
0151     new G4PVPlacement(G4Transform3D(F1CableTroffRot,F1CableTroffTrans),
0152               LogicalF1CableTroff,"F1CableTroffPhysical",
0153               LogicalEmModule,0,i+1);
0154 
0155       F1CableTroffRot.rotateZ(F1CableTroffRotZ);
0156     }
0157 
0158   LogicalF1CableTroff->SetVisAttributes(ColorOfEMModule);
0159   // LogicalF1CableTroff->SetVisAttributes(G4VisAttributes::GetInvisible());
0160 
0161 
0162    //----------------------
0163    //    LArg gaps
0164    //----------------------
0165 
0166   G4Tubs * SolidF1LArGap = 
0167     new G4Tubs("F1LArGapSolid",F1LArGapRmin, F1LArGapRmax, F1LArGapLenght, 
0168            F1LArGapStartPhi,F1LArGapDPhi);
0169     
0170    G4LogicalVolume * LogicalF1LArGap = 
0171      new G4LogicalVolume(SolidF1LArGap, FCALMaterials->Material("LiquidArgon"),
0172              "LArg Gap");
0173   
0174    for(i=1; i < NF1LarGap; i++){
0175 //     G4VPhysicalVolume * PhysicalF1LArGap =
0176        new G4PVPlacement(0,G4ThreeVector(F1LArGapPosX[i]*cm,F1LArGapPosY[i]*cm,0.*cm),
0177               LogicalF1LArGap,"F1LArGapPhysical", LogicalEmModule, 0, i); 
0178    };
0179 
0180    // LogicalF1LArGap->SetVisAttributes(ColorOfLArg);
0181    LogicalF1LArGap->SetVisAttributes(G4VisAttributes::GetInvisible());
0182    
0183 
0184     // Sensitive Volumes
0185    G4SDManager* SDman = G4SDManager::GetSDMpointer();
0186   
0187    if(!FcalEmModuleSD)
0188      {
0189        FcalEmModuleSD = new FCALEMModuleSD("FCALTB/EmModuleSD");
0190        SDman->AddNewDetector(FcalEmModuleSD);
0191      }
0192    LogicalF1LArGap->SetSensitiveDetector(FcalEmModuleSD);
0193 
0194    
0195 
0196    return LogicalEmModule;
0197 
0198 }
0199 
0200 
0201 G4int FCALEMModule::GetF1TileID(G4int GapID) 
0202 { return F1LArITile[GapID]; }
0203 
0204 G4double FCALEMModule::GetF1LArGapPosX(G4int GapID)
0205 { return F1LArGapPosX[GapID]; }
0206 
0207