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