Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:19:39

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 ///////////////////////////////////////////////////////////////////////////////
0027 // File: CCalHcal.cc
0028 // Description: CCalHcal Geometry factory class for the hadron calorimeter
0029 ///////////////////////////////////////////////////////////////////////////////
0030 #include "CCalHcal.hh"
0031 
0032 #include <fstream>
0033 #include "CCalutils.hh"
0034 
0035 //#define debug
0036 
0037 CCalHcal::CCalHcal(const G4String &name):
0038   CCalDetector(name),xposBox(0),typeLayerScnt(0),mothLayerScnt(0),
0039   xposLayerScnt(0),typeLayerAbs(0),mothLayerAbs(0),xposLayerAbs(0),
0040   dx_2Absorber(0),dy_2ScntLayer(0),dx_2ScntLayer(0),dx_2Wrapper(0),
0041   dx_2FrontPlastic(0),dx_2BackPlastic(0),dx_2Scintillator(0) {}
0042 
0043 CCalHcal::~CCalHcal() {
0044   if (xposBox)
0045     delete[] xposBox;
0046   if (typeLayerScnt)
0047     delete[] typeLayerScnt;
0048   if (mothLayerScnt)
0049     delete[] mothLayerScnt;
0050   if (xposLayerScnt)
0051     delete[] xposLayerScnt;
0052   if (typeLayerAbs)
0053     delete[] typeLayerAbs;
0054   if (mothLayerAbs)
0055     delete[] mothLayerAbs;
0056   if (xposLayerAbs)
0057     delete[] xposLayerAbs;
0058   if (dx_2Absorber)
0059     delete[] dx_2Absorber;
0060   if (dy_2ScntLayer)
0061     delete[] dy_2ScntLayer;
0062   if (dx_2ScntLayer)
0063     delete[] dx_2ScntLayer;
0064   if (dx_2Wrapper)
0065     delete[] dx_2Wrapper;
0066   if (dx_2FrontPlastic)
0067     delete[] dx_2FrontPlastic;
0068   if (dx_2BackPlastic)
0069     delete[] dx_2BackPlastic;
0070   if (dx_2Scintillator)
0071     delete[] dx_2Scintillator;
0072 }
0073 
0074 G4int CCalHcal::readFile() {
0075   ///////////////////////////////////////////////////////////////
0076   //Let's open the file
0077   G4cout << " ==> Opening file " << File() << " to read elements..."
0078        << G4endl;
0079 
0080   std::ifstream is;
0081   bool ok = openGeomFile(is, pathName, File());
0082   if (!ok)
0083     return 0;
0084 
0085   // Find *DO HCal
0086   findDO(is, G4String("HCal"));
0087 
0088   // Calorimeter boundaries
0089   readName(is,genMaterial);
0090   is >> dy_2Cal >> dx_2Cal >> xposCal >> jump;
0091 #ifdef debug
0092   G4cout << tab << "General material: " << genMaterial  << " Size " << dy_2Cal
0093        << ", " << dx_2Cal << " Position " << xposCal << G4endl;
0094 #endif
0095 
0096   // Boxes
0097   readName(is,boxMaterial);
0098   is >> nBox >> dy_2Box >> dx_2Box >> wallThickBox;
0099   G4int i = 0;
0100   xposBox = new G4double[nBox];
0101   for (i=0; i<nBox; i++)
0102     is >> xposBox[i];
0103 #ifdef debug
0104   G4cout << tab << "Box material: " << boxMaterial  << " Size " << dy_2Box
0105        << ", " << dx_2Box << " Wall Thickness " << wallThickBox << " number "
0106        << nBox << " position ";
0107   for (i=0; i<nBox; i++)
0108     G4cout << i << " " << xposBox[i] << " ";
0109   G4cout << G4endl;
0110 #endif
0111 
0112   // Layers of scintillators
0113   G4String rubbish;
0114   readName(is,rubbish);
0115   is >> nLayerScnt;
0116   typeLayerScnt = new G4int[nLayerScnt];
0117   mothLayerScnt = new G4int[nLayerScnt];
0118   xposLayerScnt = new G4double[nLayerScnt];
0119   for (i=0; i<nLayerScnt; i++)
0120     is >> typeLayerScnt[i] >> mothLayerScnt[i] >> xposLayerScnt[i];
0121 #ifdef debug
0122   G4cout << tab << nLayerScnt << " Layers of scintillators of type/mother box/"
0123        << "position" << G4endl;
0124   for (i=0; i<nLayerScnt; i++)
0125     G4cout << tab << i << " " << typeLayerScnt[i] << " " << mothLayerScnt[i] 
0126          << " " << xposLayerScnt[i] << G4endl;
0127 #endif
0128 
0129   // Layers of absorbers
0130   readName(is,rubbish);
0131   is >> nLayerAbs;
0132   typeLayerAbs = new G4int[nLayerAbs];
0133   mothLayerAbs = new G4int[nLayerAbs];
0134   xposLayerAbs = new G4double[nLayerAbs];
0135   for (i=0; i<nLayerAbs; i++)
0136     is >> typeLayerAbs[i] >> mothLayerAbs[i] >> xposLayerAbs[i];
0137 #ifdef debug
0138   G4cout << tab << nLayerAbs << " Layers of absorbers of type/mother box/"
0139        << "position" << G4endl;
0140   for (i=0; i<nLayerAbs; i++)
0141     G4cout << tab << i << " " << typeLayerAbs[i] << " " << mothLayerAbs[i] 
0142          << " " << xposLayerAbs[i] << G4endl;
0143 #endif
0144 
0145   // Absorber parameters
0146   readName(is,absMaterial);
0147   is >> nAbsorber >> dy_2Absorber;
0148   dx_2Absorber = new G4double[nAbsorber];
0149   for (i=0; i<nAbsorber; i++)
0150     is >> dx_2Absorber[i];
0151 #ifdef debug
0152   G4cout << "\tAbsorber mad of " << absMaterial << " with " << nAbsorber
0153        << " types and size " << dy_2Absorber;
0154   for (i=0;  i<nAbsorber; i++)
0155     G4cout << "  " << i << " " << dx_2Absorber[i];
0156   G4cout << G4endl;
0157 #endif
0158 
0159   // Scintillator parameters
0160   readName(is,scntMaterial);
0161   readName(is,wrapMaterial);
0162   readName(is,plasMaterial);
0163   is >> nScintillator;
0164   dy_2ScntLayer    = new G4double[nScintillator];
0165   dx_2ScntLayer    = new G4double[nScintillator];
0166   dx_2Wrapper      = new G4double[nScintillator];
0167   dx_2FrontPlastic = new G4double[nScintillator];
0168   dx_2BackPlastic  = new G4double[nScintillator];
0169   dx_2Scintillator = new G4double[nScintillator];
0170   for (i=0; i<nScintillator; i++)
0171     is >> dy_2ScntLayer[i] >> dx_2ScntLayer[i] >> dx_2Wrapper[i]
0172        >> dx_2FrontPlastic[i] >> dx_2BackPlastic[i] >> dx_2Scintillator[i];
0173 #ifdef debug
0174   G4cout << tab << nScintillator << " Scintillator layers made of " 
0175        << scntMaterial << " " << wrapMaterial << " and " << plasMaterial 
0176        << " of sizes " << G4endl;
0177   for (i=0; i<nScintillator; i++)
0178     G4cout << tab << i << " " << dy_2ScntLayer[i] << " " << dx_2ScntLayer[i] 
0179          << " " << dx_2Wrapper[i] << " " << dx_2FrontPlastic[i] << " " 
0180          << dx_2BackPlastic[i] << " " << dx_2Scintillator[i] << G4endl;
0181 #endif
0182   
0183   ///////////////////////////////////////////////////////////////
0184   // Close the file
0185   G4cout << " ==> Closing file " << File() << G4endl;
0186   is.close();
0187 
0188   return 1;
0189 
0190 }
0191 
0192 void CCalHcal::constructDaughters() {
0193 }