Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 ////////////////////////////////////////////// 27 // File: CCalHcal.cc 28 // Description: CCalHcal Geometry factory clas 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( 39 xposLayerScnt(0),typeLayerAbs(0),mothLayerAb 40 dx_2Absorber(0),dy_2ScntLayer(0),dx_2ScntLay 41 dx_2FrontPlastic(0),dx_2BackPlastic(0),dx_2S 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() << 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: " << gen 93 << ", " << dx_2Cal << " Position " << x 94 #endif 95 96 // Boxes 97 readName(is,boxMaterial); 98 is >> nBox >> dy_2Box >> dx_2Box >> wallThic 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: " << boxMate 105 << ", " << dx_2Box << " Wall Thickness 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] 121 #ifdef debug 122 G4cout << tab << nLayerScnt << " Layers of s 123 << "position" << G4endl; 124 for (i=0; i<nLayerScnt; i++) 125 G4cout << tab << i << " " << typeLayerScnt 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] > 137 #ifdef debug 138 G4cout << tab << nLayerAbs << " Layers of ab 139 << "position" << G4endl; 140 for (i=0; i<nLayerAbs; i++) 141 G4cout << tab << i << " " << typeLayerAbs[ 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 " << absMateria 153 << " types and size " << dy_2Absorber; 154 for (i=0; i<nAbsorber; i++) 155 G4cout << " " << i << " " << dx_2Absorber 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[nScintillato 165 dx_2ScntLayer = new G4double[nScintillato 166 dx_2Wrapper = new G4double[nScintillato 167 dx_2FrontPlastic = new G4double[nScintillato 168 dx_2BackPlastic = new G4double[nScintillato 169 dx_2Scintillator = new G4double[nScintillato 170 for (i=0; i<nScintillator; i++) 171 is >> dy_2ScntLayer[i] >> dx_2ScntLayer[i] 172 >> dx_2FrontPlastic[i] >> dx_2BackPlast 173 #ifdef debug 174 G4cout << tab << nScintillator << " Scintill 175 << scntMaterial << " " << wrapMaterial 176 << " of sizes " << G4endl; 177 for (i=0; i<nScintillator; i++) 178 G4cout << tab << i << " " << dy_2ScntLayer 179 << " " << dx_2Wrapper[i] << " " << dx 180 << dx_2BackPlastic[i] << " " << dx_2S 181 #endif 182 183 //////////////////////////////////////////// 184 // Close the file 185 G4cout << " ==> Closing file " << File() << 186 is.close(); 187 188 return 1; 189 190 } 191 192 void CCalHcal::constructDaughters() { 193 } 194