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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 ///////////////////////////////////////////////////////////////////////////////
 27 // File: CCalHcal.cc
 28 // Description: CCalHcal Geometry factory class for the hadron calorimeter
 29 ///////////////////////////////////////////////////////////////////////////////
 30 #include "CCalHcal.hh"
 31 
 32 #include <fstream>
 33 #include "CCalutils.hh"
 34 
 35 //#define debug
 36 
 37 CCalHcal::CCalHcal(const G4String &name):
 38   CCalDetector(name),xposBox(0),typeLayerScnt(0),mothLayerScnt(0),
 39   xposLayerScnt(0),typeLayerAbs(0),mothLayerAbs(0),xposLayerAbs(0),
 40   dx_2Absorber(0),dy_2ScntLayer(0),dx_2ScntLayer(0),dx_2Wrapper(0),
 41   dx_2FrontPlastic(0),dx_2BackPlastic(0),dx_2Scintillator(0) {}
 42 
 43 CCalHcal::~CCalHcal() {
 44   if (xposBox)
 45     delete[] xposBox;
 46   if (typeLayerScnt)
 47     delete[] typeLayerScnt;
 48   if (mothLayerScnt)
 49     delete[] mothLayerScnt;
 50   if (xposLayerScnt)
 51     delete[] xposLayerScnt;
 52   if (typeLayerAbs)
 53     delete[] typeLayerAbs;
 54   if (mothLayerAbs)
 55     delete[] mothLayerAbs;
 56   if (xposLayerAbs)
 57     delete[] xposLayerAbs;
 58   if (dx_2Absorber)
 59     delete[] dx_2Absorber;
 60   if (dy_2ScntLayer)
 61     delete[] dy_2ScntLayer;
 62   if (dx_2ScntLayer)
 63     delete[] dx_2ScntLayer;
 64   if (dx_2Wrapper)
 65     delete[] dx_2Wrapper;
 66   if (dx_2FrontPlastic)
 67     delete[] dx_2FrontPlastic;
 68   if (dx_2BackPlastic)
 69     delete[] dx_2BackPlastic;
 70   if (dx_2Scintillator)
 71     delete[] dx_2Scintillator;
 72 }
 73 
 74 G4int CCalHcal::readFile() {
 75   ///////////////////////////////////////////////////////////////
 76   //Let's open the file
 77   G4cout << " ==> Opening file " << File() << " to read elements..."
 78        << G4endl;
 79 
 80   std::ifstream is;
 81   bool ok = openGeomFile(is, pathName, File());
 82   if (!ok)
 83     return 0;
 84 
 85   // Find *DO HCal
 86   findDO(is, G4String("HCal"));
 87 
 88   // Calorimeter boundaries
 89   readName(is,genMaterial);
 90   is >> dy_2Cal >> dx_2Cal >> xposCal >> jump;
 91 #ifdef debug
 92   G4cout << tab << "General material: " << genMaterial  << " Size " << dy_2Cal
 93        << ", " << dx_2Cal << " Position " << xposCal << G4endl;
 94 #endif
 95 
 96   // Boxes
 97   readName(is,boxMaterial);
 98   is >> nBox >> dy_2Box >> dx_2Box >> wallThickBox;
 99   G4int i = 0;
100   xposBox = new G4double[nBox];
101   for (i=0; i<nBox; i++)
102     is >> xposBox[i];
103 #ifdef debug
104   G4cout << tab << "Box material: " << boxMaterial  << " Size " << dy_2Box
105        << ", " << dx_2Box << " Wall Thickness " << wallThickBox << " number "
106        << nBox << " position ";
107   for (i=0; i<nBox; i++)
108     G4cout << i << " " << xposBox[i] << " ";
109   G4cout << G4endl;
110 #endif
111 
112   // Layers of scintillators
113   G4String rubbish;
114   readName(is,rubbish);
115   is >> nLayerScnt;
116   typeLayerScnt = new G4int[nLayerScnt];
117   mothLayerScnt = new G4int[nLayerScnt];
118   xposLayerScnt = new G4double[nLayerScnt];
119   for (i=0; i<nLayerScnt; i++)
120     is >> typeLayerScnt[i] >> mothLayerScnt[i] >> xposLayerScnt[i];
121 #ifdef debug
122   G4cout << tab << nLayerScnt << " Layers of scintillators of type/mother box/"
123        << "position" << G4endl;
124   for (i=0; i<nLayerScnt; i++)
125     G4cout << tab << i << " " << typeLayerScnt[i] << " " << mothLayerScnt[i] 
126          << " " << xposLayerScnt[i] << G4endl;
127 #endif
128 
129   // Layers of absorbers
130   readName(is,rubbish);
131   is >> nLayerAbs;
132   typeLayerAbs = new G4int[nLayerAbs];
133   mothLayerAbs = new G4int[nLayerAbs];
134   xposLayerAbs = new G4double[nLayerAbs];
135   for (i=0; i<nLayerAbs; i++)
136     is >> typeLayerAbs[i] >> mothLayerAbs[i] >> xposLayerAbs[i];
137 #ifdef debug
138   G4cout << tab << nLayerAbs << " Layers of absorbers of type/mother box/"
139        << "position" << G4endl;
140   for (i=0; i<nLayerAbs; i++)
141     G4cout << tab << i << " " << typeLayerAbs[i] << " " << mothLayerAbs[i] 
142          << " " << xposLayerAbs[i] << G4endl;
143 #endif
144 
145   // Absorber parameters
146   readName(is,absMaterial);
147   is >> nAbsorber >> dy_2Absorber;
148   dx_2Absorber = new G4double[nAbsorber];
149   for (i=0; i<nAbsorber; i++)
150     is >> dx_2Absorber[i];
151 #ifdef debug
152   G4cout << "\tAbsorber mad of " << absMaterial << " with " << nAbsorber
153        << " types and size " << dy_2Absorber;
154   for (i=0;  i<nAbsorber; i++)
155     G4cout << "  " << i << " " << dx_2Absorber[i];
156   G4cout << G4endl;
157 #endif
158 
159   // Scintillator parameters
160   readName(is,scntMaterial);
161   readName(is,wrapMaterial);
162   readName(is,plasMaterial);
163   is >> nScintillator;
164   dy_2ScntLayer    = new G4double[nScintillator];
165   dx_2ScntLayer    = new G4double[nScintillator];
166   dx_2Wrapper      = new G4double[nScintillator];
167   dx_2FrontPlastic = new G4double[nScintillator];
168   dx_2BackPlastic  = new G4double[nScintillator];
169   dx_2Scintillator = new G4double[nScintillator];
170   for (i=0; i<nScintillator; i++)
171     is >> dy_2ScntLayer[i] >> dx_2ScntLayer[i] >> dx_2Wrapper[i]
172        >> dx_2FrontPlastic[i] >> dx_2BackPlastic[i] >> dx_2Scintillator[i];
173 #ifdef debug
174   G4cout << tab << nScintillator << " Scintillator layers made of " 
175        << scntMaterial << " " << wrapMaterial << " and " << plasMaterial 
176        << " of sizes " << G4endl;
177   for (i=0; i<nScintillator; i++)
178     G4cout << tab << i << " " << dy_2ScntLayer[i] << " " << dx_2ScntLayer[i] 
179          << " " << dx_2Wrapper[i] << " " << dx_2FrontPlastic[i] << " " 
180          << dx_2BackPlastic[i] << " " << dx_2Scintillator[i] << G4endl;
181 #endif
182   
183   ///////////////////////////////////////////////////////////////
184   // Close the file
185   G4cout << " ==> Closing file " << File() << G4endl;
186   is.close();
187 
188   return 1;
189 
190 }
191 
192 void CCalHcal::constructDaughters() {
193 }
194