Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 ////////////////////////////////////////////// 26 /////////////////////////////////////////////////////////////////////////////// 27 // File: CCalG4Hcal.cc 27 // File: CCalG4Hcal.cc 28 // Description: CCalG4Hcal Factory class to co 28 // Description: CCalG4Hcal Factory class to construct the G4 geometry of the 29 // hadron calorimeter 29 // hadron calorimeter 30 ////////////////////////////////////////////// 30 /////////////////////////////////////////////////////////////////////////////// 31 #include <cmath> << 32 << 33 #include "CCalG4Hcal.hh" 31 #include "CCalG4Hcal.hh" 34 32 35 #include "CCalMaterialFactory.hh" 33 #include "CCalMaterialFactory.hh" 36 #include "CCalRotationMatrixFactory.hh" 34 #include "CCalRotationMatrixFactory.hh" 37 #include "CCalSensitiveDetectors.hh" 35 #include "CCalSensitiveDetectors.hh" 38 36 39 #include "CCalutils.hh" 37 #include "CCalutils.hh" >> 38 #include <cmath> 40 39 41 #include "G4SystemOfUnits.hh" << 42 #include "G4ThreeVector.hh" 40 #include "G4ThreeVector.hh" 43 #include "G4Box.hh" 41 #include "G4Box.hh" 44 42 45 #include "G4LogicalVolume.hh" 43 #include "G4LogicalVolume.hh" 46 #include "G4PVPlacement.hh" 44 #include "G4PVPlacement.hh" 47 45 48 //#define debug 46 //#define debug 49 //#define ddebug 47 //#define ddebug 50 //#define pdebug 48 //#define pdebug 51 //#define sdebug 49 //#define sdebug 52 50 >> 51 //////////////////////////////////////////////////////////////////// >> 52 // CCalG4Hcal constructor & destructor... >> 53 //////////////////////////////////////////////////////////////////// 53 54 54 CCalG4Hcal::CCalG4Hcal( const G4String &name ) << 55 CCalG4Hcal::CCalG4Hcal(const G4String &name): 55 CCalHcal(name), CCalG4Able(name), sclLog(0), << 56 CCalHcal(name), CCalG4Able(name), sclLog(0), absLog(0) {} 56 {} << 57 57 58 << 58 CCalG4Hcal::~CCalG4Hcal(){ 59 CCalG4Hcal::~CCalG4Hcal() { << 60 if (sclLog) 59 if (sclLog) 61 delete[] sclLog; 60 delete[] sclLog; 62 if (absLog) 61 if (absLog) 63 delete[] absLog; 62 delete[] absLog; 64 } 63 } 65 64 >> 65 //////////////////////////////////////////////////////////////////// >> 66 // CCalG4Hcal methods... >> 67 //////////////////////////////////////////////////////////////////// 66 68 67 G4VPhysicalVolume* CCalG4Hcal::constructIn( G4 << 69 G4VPhysicalVolume* CCalG4Hcal::constructIn(G4VPhysicalVolume* mother) { 68 G4cout << "==>> Constructing CCalG4Hcal..." 70 G4cout << "==>> Constructing CCalG4Hcal..." << G4endl; 69 71 70 //Common logical volumes between methods. 72 //Common logical volumes between methods. 71 #ifdef debug 73 #ifdef debug 72 G4cout << tab << "Common logical volumes ini 74 G4cout << tab << "Common logical volumes initialization: " 73 << getNScintillator() << " scintillaor 75 << getNScintillator() << " scintillaor and " << getNAbsorber() 74 << " absorber layers." << G4endl; 76 << " absorber layers." << G4endl; 75 #endif 77 #endif 76 G4int i = 0; 78 G4int i = 0; 77 sclLog = new ptrG4Log[getNScintillator()]; 79 sclLog = new ptrG4Log[getNScintillator()]; 78 absLog = new ptrG4Log[getNAbsorber()]; 80 absLog = new ptrG4Log[getNAbsorber()]; 79 for (i=0; i < getNScintillator(); i++) 81 for (i=0; i < getNScintillator(); i++) 80 sclLog[i] = 0; 82 sclLog[i] = 0; 81 for (i=0; i < getNAbsorber(); i++) 83 for (i=0; i < getNAbsorber(); i++) 82 absLog[i] = 0; 84 absLog[i] = 0; 83 85 84 //Pointers to the Materials 86 //Pointers to the Materials 85 CCalMaterialFactory* matfact = CCalMat 87 CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance(); 86 88 87 //Mother volume 89 //Mother volume 88 G4Material* matter = matfact->findMaterial(g 90 G4Material* matter = matfact->findMaterial(getGenMat()); 89 G4VSolid* solid = new G4Box (Name(), getD 91 G4VSolid* solid = new G4Box (Name(), getDx_2Cal()*mm, getDy_2Cal()*mm, 90 getDy_2Cal() << 92 getDy_2Cal()*mm); 91 G4LogicalVolume* logh = new G4LogicalVolume( 93 G4LogicalVolume* logh = new G4LogicalVolume(solid, matter, Name()); 92 setVisType(CCalVisualisable::PseudoVolumes,l 94 setVisType(CCalVisualisable::PseudoVolumes,logh); 93 #ifdef debug 95 #ifdef debug 94 G4cout << tab << Name() << " Box made of " 96 G4cout << tab << Name() << " Box made of " << getGenMat() 95 << " of dimension " << getDx_2Cal()*m 97 << " of dimension " << getDx_2Cal()*mm << " " << getDy_2Cal()*mm 96 << " " << getDy_2Cal()*mm << G4endl; 98 << " " << getDy_2Cal()*mm << G4endl; 97 #endif 99 #endif 98 100 99 G4PVPlacement* hcal = new G4PVPlacement(0,G4 101 G4PVPlacement* hcal = new G4PVPlacement(0,G4ThreeVector(getXposCal()*mm,0,0), 100 Name << 102 Name(), logh, mother, false, 1); 101 G4String name("Null"); 103 G4String name("Null"); 102 #ifdef pdebug 104 #ifdef pdebug 103 if (mother != 0) name = mother->GetName(); 105 if (mother != 0) name = mother->GetName(); 104 G4cout << Name() << " Number 1 positioned in 106 G4cout << Name() << " Number 1 positioned in " << name << " at (" 105 << getXposCal()*mm << ",0,0) with no ro 107 << getXposCal()*mm << ",0,0) with no rotation" << G4endl; 106 #endif 108 #endif 107 109 108 //Wall of the Boxes 110 //Wall of the Boxes 109 solid = new G4Box (name, 0.5*getWallThickBo 111 solid = new G4Box (name, 0.5*getWallThickBox()*mm, getDy_2Box()*mm, 110 getDy_2Box()*mm); << 112 getDy_2Box()*mm); 111 matter = matfact->findMaterial(getBoxMat()); 113 matter = matfact->findMaterial(getBoxMat()); 112 name = Name() + "Wall"; 114 name = Name() + "Wall"; 113 G4LogicalVolume* logw = new G4LogicalVolume( 115 G4LogicalVolume* logw = new G4LogicalVolume(solid, matter, name); 114 setVisType(CCalVisualisable::Support,logw); 116 setVisType(CCalVisualisable::Support,logw); 115 #ifdef debug 117 #ifdef debug 116 G4cout << tab << name << " Box made of " << 118 G4cout << tab << name << " Box made of " << getBoxMat() 117 << " of dimension " << 0.5*getWallThick 119 << " of dimension " << 0.5*getWallThickBox()*mm << " " 118 << getDy_2Box()*mm << " " << getDy_2Box 120 << getDy_2Box()*mm << " " << getDy_2Box()*mm << G4endl; 119 #endif 121 #endif 120 122 121 //Now the boxes 123 //Now the boxes 122 ptrG4Log* logb = new ptrG4Log[getNBox()]; 124 ptrG4Log* logb = new ptrG4Log[getNBox()]; 123 matter = matfact->findMaterial(getGenMat()); 125 matter = matfact->findMaterial(getGenMat()); 124 for (i=0; i<getNBox(); i++) { 126 for (i=0; i<getNBox(); i++) { 125 name = Name() + "Box" + i; 127 name = Name() + "Box" + i; 126 solid = new G4Box (name, getDx_2Box()*mm, 128 solid = new G4Box (name, getDx_2Box()*mm, getDy_2Box()*mm, 127 getDy_2Box()*mm); << 129 getDy_2Box()*mm); 128 logb[i]= new G4LogicalVolume(solid, matter 130 logb[i]= new G4LogicalVolume(solid, matter, name); 129 setVisType(CCalVisualisable::PseudoVolumes 131 setVisType(CCalVisualisable::PseudoVolumes,logb[i]); 130 #ifdef debug 132 #ifdef debug 131 G4cout << tab << name << " Box made of " < 133 G4cout << tab << name << " Box made of " << getGenMat() 132 << " of dimension " << getDx_2Box()*m << 134 << " of dimension " << getDx_2Box()*mm << " " << getDy_2Box()*mm 133 << " " << getDy_2Box()*mm << G4endl; 135 << " " << getDy_2Box()*mm << G4endl; 134 #endif 136 #endif 135 137 136 G4double xpos = -(getDx_2Box() - 0.5*getWa 138 G4double xpos = -(getDx_2Box() - 0.5*getWallThickBox()); 137 new G4PVPlacement (0, G4ThreeVector(xpos*m 139 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), logw, logw->GetName(), 138 logb[i], false, 1); << 140 logb[i], false, 1); 139 #ifdef pdebug 141 #ifdef pdebug 140 G4cout << logw->GetName() << " Number 1 po 142 G4cout << logw->GetName() << " Number 1 positioned in " << name 141 << " at (" << xpos*mm << ",0,0) with << 143 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 142 #endif 144 #endif 143 xpos = (getDx_2Box() - 0.5*getWallThickBox 145 xpos = (getDx_2Box() - 0.5*getWallThickBox()); 144 new G4PVPlacement (0, G4ThreeVector(xpos*m 146 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), logw, logw->GetName(), 145 logb[i], false, 2); << 147 logb[i], false, 2); 146 #ifdef pdebug 148 #ifdef pdebug 147 G4cout << logw->GetName() << " Number 2 po 149 G4cout << logw->GetName() << " Number 2 positioned in " << name 148 << " at (" << xpos*mm << ",0,0) with << 150 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 149 #endif 151 #endif 150 152 151 new G4PVPlacement (0, G4ThreeVector(getXpo 153 new G4PVPlacement (0, G4ThreeVector(getXposBox(i)*mm,0,0), logb[i], name, 152 logh, false, i+1); << 154 logh, false, i+1); 153 #ifdef pdebug 155 #ifdef pdebug 154 G4cout << name << " Number " << i+1 << " p 156 G4cout << name << " Number " << i+1 << " positioned in " << logh->GetName() 155 << " at (" << getXposBox(i)*mm << ",0 << 157 << " at (" << getXposBox(i)*mm << ",0,0) with no rotation" << G4endl; 156 #endif 158 #endif 157 } 159 } 158 160 159 //Loop over scintillator layers 161 //Loop over scintillator layers 160 for (i=0; i<getNLayerScnt(); i++) { 162 for (i=0; i<getNLayerScnt(); i++) { 161 G4int lay = getTypeScnt(i); 163 G4int lay = getTypeScnt(i); 162 if (!sclLog[lay]) 164 if (!sclLog[lay]) 163 sclLog[lay] = constructScintillatorLayer 165 sclLog[lay] = constructScintillatorLayer(lay); 164 if (getMotherScnt(i) < 0 || getMotherScnt( 166 if (getMotherScnt(i) < 0 || getMotherScnt(i) >= getNScintillator()) { 165 logw = logh; 167 logw = logh; 166 } else { 168 } else { 167 logw = logb[getMotherScnt(i)]; 169 logw = logb[getMotherScnt(i)]; 168 } 170 } 169 G4double xpos = getXposScnt(i); 171 G4double xpos = getXposScnt(i); 170 new G4PVPlacement (0, G4ThreeVector(xpos*m 172 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), sclLog[lay], 171 sclLog[lay]->GetName(), << 173 sclLog[lay]->GetName(), logw, false, i+1); 172 #ifdef pdebug 174 #ifdef pdebug 173 G4cout << sclLog[lay]->GetName() << " Numb 175 G4cout << sclLog[lay]->GetName() << " Number " << i+1 << " positioned in " 174 << logw->GetName() << " at (" << xpos << 176 << logw->GetName() << " at (" << xpos*mm << ",0,0) with no rotation" 175 << G4endl; << 177 << G4endl; 176 #endif 178 #endif 177 } 179 } 178 180 179 //Loop over absorber layers 181 //Loop over absorber layers 180 for (i=0; i<getNLayerAbs(); i++) { 182 for (i=0; i<getNLayerAbs(); i++) { 181 G4int lay = getTypeAbs(i); 183 G4int lay = getTypeAbs(i); 182 if (!absLog[lay]) 184 if (!absLog[lay]) 183 absLog[lay] = constructAbsorberLayer(lay 185 absLog[lay] = constructAbsorberLayer(lay); 184 if (getMotherAbs(i) < 0 || getMotherAbs(i) 186 if (getMotherAbs(i) < 0 || getMotherAbs(i) >= getNAbsorber()) { 185 logw = logh; 187 logw = logh; 186 } else { 188 } else { 187 logw = logb[getMotherAbs(i)]; 189 logw = logb[getMotherAbs(i)]; 188 } 190 } 189 G4double xpos = getXposAbs(i); 191 G4double xpos = getXposAbs(i); 190 new G4PVPlacement (0, G4ThreeVector(xpos*m 192 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), absLog[lay], 191 absLog[lay]->GetName(), << 193 absLog[lay]->GetName(), logw, false, i+1); 192 #ifdef pdebug 194 #ifdef pdebug 193 G4cout << absLog[lay]->GetName() << " Numb 195 G4cout << absLog[lay]->GetName() << " Number " << i+1 << " positioned in " 194 << logw->GetName() << " at (" << xpos << 196 << logw->GetName() << " at (" << xpos*mm << ",0,0) with no rotation" 195 << G4endl; << 197 << G4endl; 196 #endif 198 #endif 197 } 199 } 198 200 199 delete [] logb; 201 delete [] logb; 200 202 201 G4cout << "<<== End of CCalG4Hcal constructi 203 G4cout << "<<== End of CCalG4Hcal construction ..." << G4endl; 202 204 203 return hcal; 205 return hcal; 204 } 206 } 205 207 206 208 207 G4LogicalVolume* CCalG4Hcal::constructScintill << 209 G4LogicalVolume* CCalG4Hcal::constructScintillatorLayer(G4int lay) { 208 210 209 //Pointers to the Materials 211 //Pointers to the Materials 210 CCalMaterialFactory* matfact = CCalMat 212 CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance(); 211 213 212 //The scintillator layer 214 //The scintillator layer 213 G4Material* matter = matfact->findMaterial(g 215 G4Material* matter = matfact->findMaterial(getGenMat()); 214 G4String name = Name() + "ScntLayer" + 216 G4String name = Name() + "ScntLayer" + lay; 215 G4VSolid* solid = new G4Box (name, getDx_ 217 G4VSolid* solid = new G4Box (name, getDx_2ScntLay(lay)*mm, 216 getDy_2ScntL << 218 getDy_2ScntLay(lay)*mm, 217 getDy_2ScntL << 219 getDy_2ScntLay(lay)*mm); 218 G4LogicalVolume* log = new G4LogicalVolume(s 220 G4LogicalVolume* log = new G4LogicalVolume(solid, matter, name); 219 setVisType(CCalVisualisable::PseudoVolumes,l 221 setVisType(CCalVisualisable::PseudoVolumes,log); 220 #ifdef debug 222 #ifdef debug 221 G4cout << tab << name << " Box made of " << 223 G4cout << tab << name << " Box made of " << getGenMat() << " of dimension " 222 << getDx_2ScntLay(lay)*mm << " " << get 224 << getDx_2ScntLay(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 223 << getDy_2ScntLay(lay)*mm << G4endl; 225 << getDy_2ScntLay(lay)*mm << G4endl; 224 #endif 226 #endif 225 227 226 G4LogicalVolume* logd; 228 G4LogicalVolume* logd; 227 G4double xpos; 229 G4double xpos; 228 //Wrappers if any 230 //Wrappers if any 229 if (getDx_2Wrap(lay) > 0) { 231 if (getDx_2Wrap(lay) > 0) { 230 name = Name() + "ScntWrapper" + lay; 232 name = Name() + "ScntWrapper" + lay; 231 matter = matfact->findMaterial(getWrapMat( 233 matter = matfact->findMaterial(getWrapMat()); 232 solid = new G4Box (name, getDx_2Wrap(lay) 234 solid = new G4Box (name, getDx_2Wrap(lay)*mm, 233 getDy_2ScntLay(lay)*mm << 235 getDy_2ScntLay(lay)*mm, getDy_2ScntLay(lay)*mm); 234 logd = new G4LogicalVolume(solid, matter 236 logd = new G4LogicalVolume(solid, matter, name); 235 setVisType(CCalVisualisable::Support,logd) 237 setVisType(CCalVisualisable::Support,logd); 236 #ifdef debug 238 #ifdef debug 237 G4cout << tab << name << " Box made of " < 239 G4cout << tab << name << " Box made of " << getWrapMat() << " of dimension " 238 << getDx_2Wrap(lay)*mm << " " << getD << 240 << getDx_2Wrap(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 239 << getDy_2ScntLay(lay)*mm << G4endl; << 241 << getDy_2ScntLay(lay)*mm << G4endl; 240 #endif 242 #endif 241 xpos =-(getDx_2ScntLay(lay)-getDx_2Wrap( 243 xpos =-(getDx_2ScntLay(lay)-getDx_2Wrap(lay)); 242 new G4PVPlacement(0, G4ThreeVector(xpos*mm 244 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 243 #ifdef pdebug 245 #ifdef pdebug 244 G4cout << logd->GetName() << " Number 1 po 246 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 245 << " at (" << xpos*mm << ",0,0) with << 247 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 246 #endif 248 #endif 247 xpos = (getDx_2ScntLay(lay)-getDx_2Wrap( 249 xpos = (getDx_2ScntLay(lay)-getDx_2Wrap(lay)); 248 new G4PVPlacement(0, G4ThreeVector(xpos*mm 250 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,2); 249 #ifdef pdebug 251 #ifdef pdebug 250 G4cout << logd->GetName() << " Number 2 po 252 G4cout << logd->GetName() << " Number 2 positioned in " << log->GetName() 251 << " at (" << xpos*mm << ",0,0) with << 253 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 252 #endif 254 #endif 253 } 255 } 254 256 255 //Plastic covers 257 //Plastic covers 256 matter = matfact->findMaterial(getPlasMat()) 258 matter = matfact->findMaterial(getPlasMat()); 257 name = Name() + "FrontPlastic" + lay; 259 name = Name() + "FrontPlastic" + lay; 258 solid = new G4Box (name, getDx_2FrontP(lay) 260 solid = new G4Box (name, getDx_2FrontP(lay)*mm, getDy_2ScntLay(lay)*mm, 259 getDy_2ScntLay(lay)*mm); << 261 getDy_2ScntLay(lay)*mm); 260 logd = new G4LogicalVolume(solid, matter, 262 logd = new G4LogicalVolume(solid, matter, name); 261 setVisType(CCalVisualisable::Cable,logd); 263 setVisType(CCalVisualisable::Cable,logd); 262 #ifdef debug 264 #ifdef debug 263 G4cout << tab << name << " Box made of " << 265 G4cout << tab << name << " Box made of " << getPlasMat() << " of dimension " 264 << getDx_2FrontP(lay)*mm << " " << getD 266 << getDx_2FrontP(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 265 << getDy_2ScntLay(lay)*mm << G4endl; 267 << getDy_2ScntLay(lay)*mm << G4endl; 266 #endif 268 #endif 267 xpos =-getDx_2ScntLay(lay)+2.*getDx_2Wrap( 269 xpos =-getDx_2ScntLay(lay)+2.*getDx_2Wrap(lay)+getDx_2FrontP(lay); 268 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0 270 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 269 #ifdef pdebug 271 #ifdef pdebug 270 G4cout << logd->GetName() << " Number 1 posi 272 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 271 << " at (" << xpos*mm << ",0,0) with no 273 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 272 #endif 274 #endif 273 name = Name() + "BackPlastic" + lay; 275 name = Name() + "BackPlastic" + lay; 274 solid = new G4Box (name, getDx_2BackP(lay)* 276 solid = new G4Box (name, getDx_2BackP(lay)*mm, getDy_2ScntLay(lay)*mm, 275 getDy_2ScntLay(lay)*mm); << 277 getDy_2ScntLay(lay)*mm); 276 logd = new G4LogicalVolume(solid, matter, 278 logd = new G4LogicalVolume(solid, matter, name); 277 setVisType(CCalVisualisable::Cable,logd); 279 setVisType(CCalVisualisable::Cable,logd); 278 #ifdef debug 280 #ifdef debug 279 G4cout << tab << name << " Box made of " << 281 G4cout << tab << name << " Box made of " << getPlasMat() << " of dimension " 280 << getDx_2BackP(lay)*mm << " " << getDy 282 << getDx_2BackP(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 281 << getDy_2ScntLay(lay)*mm << G4endl; 283 << getDy_2ScntLay(lay)*mm << G4endl; 282 #endif 284 #endif 283 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap 285 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap(lay)+2.*getDx_2FrontP(lay)+ 284 2.*getDx_2Scnt(lay)+getDx_2BackP(la 286 2.*getDx_2Scnt(lay)+getDx_2BackP(lay)); 285 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0 287 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 286 #ifdef pdebug 288 #ifdef pdebug 287 G4cout << logd->GetName() << " Number 1 posi 289 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 288 << " at (" << xpos*mm << ",0,0) with no 290 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 289 #endif 291 #endif 290 292 291 //Now the scintillators 293 //Now the scintillators 292 matter = matfact->findMaterial(getScntMat()) 294 matter = matfact->findMaterial(getScntMat()); 293 name = Name() + "Scintillator" + lay; 295 name = Name() + "Scintillator" + lay; 294 solid = new G4Box (name, getDx_2Scnt(lay)*m 296 solid = new G4Box (name, getDx_2Scnt(lay)*mm, getDy_2ScntLay(lay)*mm, 295 getDy_2ScntLay(lay)*mm); << 297 getDy_2ScntLay(lay)*mm); 296 logd = new G4LogicalVolume(solid, matter, 298 logd = new G4LogicalVolume(solid, matter, name); 297 setVisType(CCalVisualisable::Sensitive,logd) 299 setVisType(CCalVisualisable::Sensitive,logd); 298 allSensitiveLogs.push_back(logd); 300 allSensitiveLogs.push_back(logd); 299 #ifdef debug 301 #ifdef debug 300 G4cout << tab << name << " Box made of " << 302 G4cout << tab << name << " Box made of " << getScntMat() << " of dimension " 301 << getDx_2Scnt(lay)*mm << " " << getDy_ 303 << getDx_2Scnt(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 302 << getDy_2ScntLay(lay)*mm << G4endl; 304 << getDy_2ScntLay(lay)*mm << G4endl; 303 #endif 305 #endif 304 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap 306 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap(lay)+2.*getDx_2FrontP(lay)+ 305 getDx_2Scnt(lay)); << 307 getDx_2Scnt(lay)); 306 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0 308 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 307 #ifdef pdebug 309 #ifdef pdebug 308 G4cout << logd->GetName() << " Number 1 posi 310 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 309 << " at (" << xpos*mm << ",0,0) with no 311 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 310 #endif 312 #endif 311 313 312 return log; 314 return log; 313 } 315 } 314 316 315 317 316 G4LogicalVolume* CCalG4Hcal::constructAbsorber << 318 G4LogicalVolume* CCalG4Hcal::constructAbsorberLayer(G4int lay) { >> 319 317 //Pointers to the Materials 320 //Pointers to the Materials 318 CCalMaterialFactory* matfact = CCalMaterialF << 321 CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance(); >> 322 319 //Now the absorber layer 323 //Now the absorber layer 320 G4Material* matter = matfact->findMaterial(g 324 G4Material* matter = matfact->findMaterial(getAbsMat()); 321 G4String name = Name() + "Absorber" + l 325 G4String name = Name() + "Absorber" + lay; 322 G4VSolid* solid = new G4Box (name, getDx_ << 326 G4VSolid* solid = new G4Box (name, getDx_2Abs(lay)*mm, getDy_2Abs()*mm, >> 327 getDy_2Abs()*mm); 323 G4LogicalVolume* log = new G4LogicalVolume(s 328 G4LogicalVolume* log = new G4LogicalVolume(solid, matter, name); 324 setVisType(CCalVisualisable::Absorber,log); 329 setVisType(CCalVisualisable::Absorber,log); 325 #ifdef debug 330 #ifdef debug 326 G4cout << tab << name << " Box made of " << 331 G4cout << tab << name << " Box made of " << getAbsMat() << " of dimension " 327 << getDx_2Abs(lay)*mm << " " << getDy_2 332 << getDx_2Abs(lay)*mm << " " << getDy_2Abs()*mm << " " 328 << getDy_2Abs()*mm << G4endl; 333 << getDy_2Abs()*mm << G4endl; 329 #endif 334 #endif >> 335 330 return log; 336 return log; 331 } 337 } 332 338 333 339 334 void CCalG4Hcal::constructDaughters() {} << 340 void CCalG4Hcal::constructSensitive(){ 335 341 336 << 337 void CCalG4Hcal::constructSensitive() { << 338 if (allSensitiveLogs.size()>0) { 342 if (allSensitiveLogs.size()>0) { 339 CCalSensitiveDetectors* sensDets = CCalSen 343 CCalSensitiveDetectors* sensDets = CCalSensitiveDetectors::getInstance(); 340 G4String SDname = Name(); 344 G4String SDname = Name(); 341 for (std::vector<ptrG4Log>::iterator iter= 345 for (std::vector<ptrG4Log>::iterator iter=allSensitiveLogs.begin(); 342 iter<allSensitiveLogs.end(); iter++) 346 iter<allSensitiveLogs.end(); iter++) { 343 sensDets->registerVolume(SDname, (*iter) 347 sensDets->registerVolume(SDname, (*iter)); 344 #ifdef sdebug 348 #ifdef sdebug 345 G4cout << "Register volume " << (*iter)- 349 G4cout << "Register volume " << (*iter)->GetName() << " for" << SDname 346 << G4endl; << 350 << G4endl; 347 #endif 351 #endif 348 } 352 } 349 } else { 353 } else { 350 G4cerr << "CCalG4Hcal ERROR: Could not con 354 G4cerr << "CCalG4Hcal ERROR: Could not construct Sensitive Detector" 351 << G4endl; << 355 << G4endl; 352 } 356 } 353 } 357 } 354 358 >> 359 void CCalG4Hcal::constructDaughters() {} 355 360