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> 31 #include <cmath> 32 32 33 #include "CCalG4Hcal.hh" 33 #include "CCalG4Hcal.hh" 34 34 35 #include "CCalMaterialFactory.hh" 35 #include "CCalMaterialFactory.hh" 36 #include "CCalRotationMatrixFactory.hh" 36 #include "CCalRotationMatrixFactory.hh" 37 #include "CCalSensitiveDetectors.hh" 37 #include "CCalSensitiveDetectors.hh" 38 38 39 #include "CCalutils.hh" 39 #include "CCalutils.hh" 40 40 41 #include "G4SystemOfUnits.hh" 41 #include "G4SystemOfUnits.hh" 42 #include "G4ThreeVector.hh" 42 #include "G4ThreeVector.hh" 43 #include "G4Box.hh" 43 #include "G4Box.hh" 44 44 45 #include "G4LogicalVolume.hh" 45 #include "G4LogicalVolume.hh" 46 #include "G4PVPlacement.hh" 46 #include "G4PVPlacement.hh" 47 47 48 //#define debug 48 //#define debug 49 //#define ddebug 49 //#define ddebug 50 //#define pdebug 50 //#define pdebug 51 //#define sdebug 51 //#define sdebug 52 52 53 53 54 CCalG4Hcal::CCalG4Hcal( const G4String &name ) 54 CCalG4Hcal::CCalG4Hcal( const G4String &name ) : 55 CCalHcal(name), CCalG4Able(name), sclLog(0), 55 CCalHcal(name), CCalG4Able(name), sclLog(0), absLog(0) 56 {} 56 {} 57 57 58 58 59 CCalG4Hcal::~CCalG4Hcal() { 59 CCalG4Hcal::~CCalG4Hcal() { 60 if (sclLog) 60 if (sclLog) 61 delete[] sclLog; 61 delete[] sclLog; 62 if (absLog) 62 if (absLog) 63 delete[] absLog; 63 delete[] absLog; 64 } 64 } 65 65 66 66 67 G4VPhysicalVolume* CCalG4Hcal::constructIn( G4 67 G4VPhysicalVolume* CCalG4Hcal::constructIn( G4VPhysicalVolume* mother ) { 68 G4cout << "==>> Constructing CCalG4Hcal..." 68 G4cout << "==>> Constructing CCalG4Hcal..." << G4endl; 69 69 70 //Common logical volumes between methods. 70 //Common logical volumes between methods. 71 #ifdef debug 71 #ifdef debug 72 G4cout << tab << "Common logical volumes ini 72 G4cout << tab << "Common logical volumes initialization: " 73 << getNScintillator() << " scintillaor 73 << getNScintillator() << " scintillaor and " << getNAbsorber() 74 << " absorber layers." << G4endl; 74 << " absorber layers." << G4endl; 75 #endif 75 #endif 76 G4int i = 0; 76 G4int i = 0; 77 sclLog = new ptrG4Log[getNScintillator()]; 77 sclLog = new ptrG4Log[getNScintillator()]; 78 absLog = new ptrG4Log[getNAbsorber()]; 78 absLog = new ptrG4Log[getNAbsorber()]; 79 for (i=0; i < getNScintillator(); i++) 79 for (i=0; i < getNScintillator(); i++) 80 sclLog[i] = 0; 80 sclLog[i] = 0; 81 for (i=0; i < getNAbsorber(); i++) 81 for (i=0; i < getNAbsorber(); i++) 82 absLog[i] = 0; 82 absLog[i] = 0; 83 83 84 //Pointers to the Materials 84 //Pointers to the Materials 85 CCalMaterialFactory* matfact = CCalMat 85 CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance(); 86 86 87 //Mother volume 87 //Mother volume 88 G4Material* matter = matfact->findMaterial(g 88 G4Material* matter = matfact->findMaterial(getGenMat()); 89 G4VSolid* solid = new G4Box (Name(), getD 89 G4VSolid* solid = new G4Box (Name(), getDx_2Cal()*mm, getDy_2Cal()*mm, 90 getDy_2Cal() 90 getDy_2Cal()*mm); 91 G4LogicalVolume* logh = new G4LogicalVolume( 91 G4LogicalVolume* logh = new G4LogicalVolume(solid, matter, Name()); 92 setVisType(CCalVisualisable::PseudoVolumes,l 92 setVisType(CCalVisualisable::PseudoVolumes,logh); 93 #ifdef debug 93 #ifdef debug 94 G4cout << tab << Name() << " Box made of " 94 G4cout << tab << Name() << " Box made of " << getGenMat() 95 << " of dimension " << getDx_2Cal()*m 95 << " of dimension " << getDx_2Cal()*mm << " " << getDy_2Cal()*mm 96 << " " << getDy_2Cal()*mm << G4endl; 96 << " " << getDy_2Cal()*mm << G4endl; 97 #endif 97 #endif 98 98 99 G4PVPlacement* hcal = new G4PVPlacement(0,G4 99 G4PVPlacement* hcal = new G4PVPlacement(0,G4ThreeVector(getXposCal()*mm,0,0), 100 Name 100 Name(), logh, mother, false, 1); 101 G4String name("Null"); 101 G4String name("Null"); 102 #ifdef pdebug 102 #ifdef pdebug 103 if (mother != 0) name = mother->GetName(); 103 if (mother != 0) name = mother->GetName(); 104 G4cout << Name() << " Number 1 positioned in 104 G4cout << Name() << " Number 1 positioned in " << name << " at (" 105 << getXposCal()*mm << ",0,0) with no ro 105 << getXposCal()*mm << ",0,0) with no rotation" << G4endl; 106 #endif 106 #endif 107 107 108 //Wall of the Boxes 108 //Wall of the Boxes 109 solid = new G4Box (name, 0.5*getWallThickBo 109 solid = new G4Box (name, 0.5*getWallThickBox()*mm, getDy_2Box()*mm, 110 getDy_2Box()*mm); 110 getDy_2Box()*mm); 111 matter = matfact->findMaterial(getBoxMat()); 111 matter = matfact->findMaterial(getBoxMat()); 112 name = Name() + "Wall"; 112 name = Name() + "Wall"; 113 G4LogicalVolume* logw = new G4LogicalVolume( 113 G4LogicalVolume* logw = new G4LogicalVolume(solid, matter, name); 114 setVisType(CCalVisualisable::Support,logw); 114 setVisType(CCalVisualisable::Support,logw); 115 #ifdef debug 115 #ifdef debug 116 G4cout << tab << name << " Box made of " << 116 G4cout << tab << name << " Box made of " << getBoxMat() 117 << " of dimension " << 0.5*getWallThick 117 << " of dimension " << 0.5*getWallThickBox()*mm << " " 118 << getDy_2Box()*mm << " " << getDy_2Box 118 << getDy_2Box()*mm << " " << getDy_2Box()*mm << G4endl; 119 #endif 119 #endif 120 120 121 //Now the boxes 121 //Now the boxes 122 ptrG4Log* logb = new ptrG4Log[getNBox()]; 122 ptrG4Log* logb = new ptrG4Log[getNBox()]; 123 matter = matfact->findMaterial(getGenMat()); 123 matter = matfact->findMaterial(getGenMat()); 124 for (i=0; i<getNBox(); i++) { 124 for (i=0; i<getNBox(); i++) { 125 name = Name() + "Box" + i; 125 name = Name() + "Box" + i; 126 solid = new G4Box (name, getDx_2Box()*mm, 126 solid = new G4Box (name, getDx_2Box()*mm, getDy_2Box()*mm, 127 getDy_2Box()*mm); 127 getDy_2Box()*mm); 128 logb[i]= new G4LogicalVolume(solid, matter 128 logb[i]= new G4LogicalVolume(solid, matter, name); 129 setVisType(CCalVisualisable::PseudoVolumes 129 setVisType(CCalVisualisable::PseudoVolumes,logb[i]); 130 #ifdef debug 130 #ifdef debug 131 G4cout << tab << name << " Box made of " < 131 G4cout << tab << name << " Box made of " << getGenMat() 132 << " of dimension " << getDx_2Box()*m 132 << " of dimension " << getDx_2Box()*mm << " " << getDy_2Box()*mm 133 << " " << getDy_2Box()*mm << G4endl; 133 << " " << getDy_2Box()*mm << G4endl; 134 #endif 134 #endif 135 135 136 G4double xpos = -(getDx_2Box() - 0.5*getWa 136 G4double xpos = -(getDx_2Box() - 0.5*getWallThickBox()); 137 new G4PVPlacement (0, G4ThreeVector(xpos*m 137 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), logw, logw->GetName(), 138 logb[i], false, 1); 138 logb[i], false, 1); 139 #ifdef pdebug 139 #ifdef pdebug 140 G4cout << logw->GetName() << " Number 1 po 140 G4cout << logw->GetName() << " Number 1 positioned in " << name 141 << " at (" << xpos*mm << ",0,0) with 141 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 142 #endif 142 #endif 143 xpos = (getDx_2Box() - 0.5*getWallThickBox 143 xpos = (getDx_2Box() - 0.5*getWallThickBox()); 144 new G4PVPlacement (0, G4ThreeVector(xpos*m 144 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), logw, logw->GetName(), 145 logb[i], false, 2); 145 logb[i], false, 2); 146 #ifdef pdebug 146 #ifdef pdebug 147 G4cout << logw->GetName() << " Number 2 po 147 G4cout << logw->GetName() << " Number 2 positioned in " << name 148 << " at (" << xpos*mm << ",0,0) with 148 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 149 #endif 149 #endif 150 150 151 new G4PVPlacement (0, G4ThreeVector(getXpo 151 new G4PVPlacement (0, G4ThreeVector(getXposBox(i)*mm,0,0), logb[i], name, 152 logh, false, i+1); 152 logh, false, i+1); 153 #ifdef pdebug 153 #ifdef pdebug 154 G4cout << name << " Number " << i+1 << " p 154 G4cout << name << " Number " << i+1 << " positioned in " << logh->GetName() 155 << " at (" << getXposBox(i)*mm << ",0 155 << " at (" << getXposBox(i)*mm << ",0,0) with no rotation" << G4endl; 156 #endif 156 #endif 157 } 157 } 158 158 159 //Loop over scintillator layers 159 //Loop over scintillator layers 160 for (i=0; i<getNLayerScnt(); i++) { 160 for (i=0; i<getNLayerScnt(); i++) { 161 G4int lay = getTypeScnt(i); 161 G4int lay = getTypeScnt(i); 162 if (!sclLog[lay]) 162 if (!sclLog[lay]) 163 sclLog[lay] = constructScintillatorLayer 163 sclLog[lay] = constructScintillatorLayer(lay); 164 if (getMotherScnt(i) < 0 || getMotherScnt( 164 if (getMotherScnt(i) < 0 || getMotherScnt(i) >= getNScintillator()) { 165 logw = logh; 165 logw = logh; 166 } else { 166 } else { 167 logw = logb[getMotherScnt(i)]; 167 logw = logb[getMotherScnt(i)]; 168 } 168 } 169 G4double xpos = getXposScnt(i); 169 G4double xpos = getXposScnt(i); 170 new G4PVPlacement (0, G4ThreeVector(xpos*m 170 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), sclLog[lay], 171 sclLog[lay]->GetName(), 171 sclLog[lay]->GetName(), logw, false, i+1); 172 #ifdef pdebug 172 #ifdef pdebug 173 G4cout << sclLog[lay]->GetName() << " Numb 173 G4cout << sclLog[lay]->GetName() << " Number " << i+1 << " positioned in " 174 << logw->GetName() << " at (" << xpos 174 << logw->GetName() << " at (" << xpos*mm << ",0,0) with no rotation" 175 << G4endl; 175 << G4endl; 176 #endif 176 #endif 177 } 177 } 178 178 179 //Loop over absorber layers 179 //Loop over absorber layers 180 for (i=0; i<getNLayerAbs(); i++) { 180 for (i=0; i<getNLayerAbs(); i++) { 181 G4int lay = getTypeAbs(i); 181 G4int lay = getTypeAbs(i); 182 if (!absLog[lay]) 182 if (!absLog[lay]) 183 absLog[lay] = constructAbsorberLayer(lay 183 absLog[lay] = constructAbsorberLayer(lay); 184 if (getMotherAbs(i) < 0 || getMotherAbs(i) 184 if (getMotherAbs(i) < 0 || getMotherAbs(i) >= getNAbsorber()) { 185 logw = logh; 185 logw = logh; 186 } else { 186 } else { 187 logw = logb[getMotherAbs(i)]; 187 logw = logb[getMotherAbs(i)]; 188 } 188 } 189 G4double xpos = getXposAbs(i); 189 G4double xpos = getXposAbs(i); 190 new G4PVPlacement (0, G4ThreeVector(xpos*m 190 new G4PVPlacement (0, G4ThreeVector(xpos*mm,0,0), absLog[lay], 191 absLog[lay]->GetName(), 191 absLog[lay]->GetName(), logw, false, i+1); 192 #ifdef pdebug 192 #ifdef pdebug 193 G4cout << absLog[lay]->GetName() << " Numb 193 G4cout << absLog[lay]->GetName() << " Number " << i+1 << " positioned in " 194 << logw->GetName() << " at (" << xpos 194 << logw->GetName() << " at (" << xpos*mm << ",0,0) with no rotation" 195 << G4endl; 195 << G4endl; 196 #endif 196 #endif 197 } 197 } 198 198 199 delete [] logb; 199 delete [] logb; 200 200 201 G4cout << "<<== End of CCalG4Hcal constructi 201 G4cout << "<<== End of CCalG4Hcal construction ..." << G4endl; 202 202 203 return hcal; 203 return hcal; 204 } 204 } 205 205 206 206 207 G4LogicalVolume* CCalG4Hcal::constructScintill 207 G4LogicalVolume* CCalG4Hcal::constructScintillatorLayer( G4int lay ) { 208 208 209 //Pointers to the Materials 209 //Pointers to the Materials 210 CCalMaterialFactory* matfact = CCalMat 210 CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance(); 211 211 212 //The scintillator layer 212 //The scintillator layer 213 G4Material* matter = matfact->findMaterial(g 213 G4Material* matter = matfact->findMaterial(getGenMat()); 214 G4String name = Name() + "ScntLayer" + 214 G4String name = Name() + "ScntLayer" + lay; 215 G4VSolid* solid = new G4Box (name, getDx_ 215 G4VSolid* solid = new G4Box (name, getDx_2ScntLay(lay)*mm, 216 getDy_2ScntL 216 getDy_2ScntLay(lay)*mm, 217 getDy_2ScntL 217 getDy_2ScntLay(lay)*mm); 218 G4LogicalVolume* log = new G4LogicalVolume(s 218 G4LogicalVolume* log = new G4LogicalVolume(solid, matter, name); 219 setVisType(CCalVisualisable::PseudoVolumes,l 219 setVisType(CCalVisualisable::PseudoVolumes,log); 220 #ifdef debug 220 #ifdef debug 221 G4cout << tab << name << " Box made of " << 221 G4cout << tab << name << " Box made of " << getGenMat() << " of dimension " 222 << getDx_2ScntLay(lay)*mm << " " << get 222 << getDx_2ScntLay(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 223 << getDy_2ScntLay(lay)*mm << G4endl; 223 << getDy_2ScntLay(lay)*mm << G4endl; 224 #endif 224 #endif 225 225 226 G4LogicalVolume* logd; 226 G4LogicalVolume* logd; 227 G4double xpos; 227 G4double xpos; 228 //Wrappers if any 228 //Wrappers if any 229 if (getDx_2Wrap(lay) > 0) { 229 if (getDx_2Wrap(lay) > 0) { 230 name = Name() + "ScntWrapper" + lay; 230 name = Name() + "ScntWrapper" + lay; 231 matter = matfact->findMaterial(getWrapMat( 231 matter = matfact->findMaterial(getWrapMat()); 232 solid = new G4Box (name, getDx_2Wrap(lay) 232 solid = new G4Box (name, getDx_2Wrap(lay)*mm, 233 getDy_2ScntLay(lay)*mm 233 getDy_2ScntLay(lay)*mm, getDy_2ScntLay(lay)*mm); 234 logd = new G4LogicalVolume(solid, matter 234 logd = new G4LogicalVolume(solid, matter, name); 235 setVisType(CCalVisualisable::Support,logd) 235 setVisType(CCalVisualisable::Support,logd); 236 #ifdef debug 236 #ifdef debug 237 G4cout << tab << name << " Box made of " < 237 G4cout << tab << name << " Box made of " << getWrapMat() << " of dimension " 238 << getDx_2Wrap(lay)*mm << " " << getD 238 << getDx_2Wrap(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 239 << getDy_2ScntLay(lay)*mm << G4endl; 239 << getDy_2ScntLay(lay)*mm << G4endl; 240 #endif 240 #endif 241 xpos =-(getDx_2ScntLay(lay)-getDx_2Wrap( 241 xpos =-(getDx_2ScntLay(lay)-getDx_2Wrap(lay)); 242 new G4PVPlacement(0, G4ThreeVector(xpos*mm 242 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 243 #ifdef pdebug 243 #ifdef pdebug 244 G4cout << logd->GetName() << " Number 1 po 244 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 245 << " at (" << xpos*mm << ",0,0) with 245 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 246 #endif 246 #endif 247 xpos = (getDx_2ScntLay(lay)-getDx_2Wrap( 247 xpos = (getDx_2ScntLay(lay)-getDx_2Wrap(lay)); 248 new G4PVPlacement(0, G4ThreeVector(xpos*mm 248 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,2); 249 #ifdef pdebug 249 #ifdef pdebug 250 G4cout << logd->GetName() << " Number 2 po 250 G4cout << logd->GetName() << " Number 2 positioned in " << log->GetName() 251 << " at (" << xpos*mm << ",0,0) with 251 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 252 #endif 252 #endif 253 } 253 } 254 254 255 //Plastic covers 255 //Plastic covers 256 matter = matfact->findMaterial(getPlasMat()) 256 matter = matfact->findMaterial(getPlasMat()); 257 name = Name() + "FrontPlastic" + lay; 257 name = Name() + "FrontPlastic" + lay; 258 solid = new G4Box (name, getDx_2FrontP(lay) 258 solid = new G4Box (name, getDx_2FrontP(lay)*mm, getDy_2ScntLay(lay)*mm, 259 getDy_2ScntLay(lay)*mm); 259 getDy_2ScntLay(lay)*mm); 260 logd = new G4LogicalVolume(solid, matter, 260 logd = new G4LogicalVolume(solid, matter, name); 261 setVisType(CCalVisualisable::Cable,logd); 261 setVisType(CCalVisualisable::Cable,logd); 262 #ifdef debug 262 #ifdef debug 263 G4cout << tab << name << " Box made of " << 263 G4cout << tab << name << " Box made of " << getPlasMat() << " of dimension " 264 << getDx_2FrontP(lay)*mm << " " << getD 264 << getDx_2FrontP(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 265 << getDy_2ScntLay(lay)*mm << G4endl; 265 << getDy_2ScntLay(lay)*mm << G4endl; 266 #endif 266 #endif 267 xpos =-getDx_2ScntLay(lay)+2.*getDx_2Wrap( 267 xpos =-getDx_2ScntLay(lay)+2.*getDx_2Wrap(lay)+getDx_2FrontP(lay); 268 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0 268 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 269 #ifdef pdebug 269 #ifdef pdebug 270 G4cout << logd->GetName() << " Number 1 posi 270 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 271 << " at (" << xpos*mm << ",0,0) with no 271 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 272 #endif 272 #endif 273 name = Name() + "BackPlastic" + lay; 273 name = Name() + "BackPlastic" + lay; 274 solid = new G4Box (name, getDx_2BackP(lay)* 274 solid = new G4Box (name, getDx_2BackP(lay)*mm, getDy_2ScntLay(lay)*mm, 275 getDy_2ScntLay(lay)*mm); 275 getDy_2ScntLay(lay)*mm); 276 logd = new G4LogicalVolume(solid, matter, 276 logd = new G4LogicalVolume(solid, matter, name); 277 setVisType(CCalVisualisable::Cable,logd); 277 setVisType(CCalVisualisable::Cable,logd); 278 #ifdef debug 278 #ifdef debug 279 G4cout << tab << name << " Box made of " << 279 G4cout << tab << name << " Box made of " << getPlasMat() << " of dimension " 280 << getDx_2BackP(lay)*mm << " " << getDy 280 << getDx_2BackP(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 281 << getDy_2ScntLay(lay)*mm << G4endl; 281 << getDy_2ScntLay(lay)*mm << G4endl; 282 #endif 282 #endif 283 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap 283 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap(lay)+2.*getDx_2FrontP(lay)+ 284 2.*getDx_2Scnt(lay)+getDx_2BackP(la 284 2.*getDx_2Scnt(lay)+getDx_2BackP(lay)); 285 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0 285 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 286 #ifdef pdebug 286 #ifdef pdebug 287 G4cout << logd->GetName() << " Number 1 posi 287 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 288 << " at (" << xpos*mm << ",0,0) with no 288 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 289 #endif 289 #endif 290 290 291 //Now the scintillators 291 //Now the scintillators 292 matter = matfact->findMaterial(getScntMat()) 292 matter = matfact->findMaterial(getScntMat()); 293 name = Name() + "Scintillator" + lay; 293 name = Name() + "Scintillator" + lay; 294 solid = new G4Box (name, getDx_2Scnt(lay)*m 294 solid = new G4Box (name, getDx_2Scnt(lay)*mm, getDy_2ScntLay(lay)*mm, 295 getDy_2ScntLay(lay)*mm); 295 getDy_2ScntLay(lay)*mm); 296 logd = new G4LogicalVolume(solid, matter, 296 logd = new G4LogicalVolume(solid, matter, name); 297 setVisType(CCalVisualisable::Sensitive,logd) 297 setVisType(CCalVisualisable::Sensitive,logd); 298 allSensitiveLogs.push_back(logd); 298 allSensitiveLogs.push_back(logd); 299 #ifdef debug 299 #ifdef debug 300 G4cout << tab << name << " Box made of " << 300 G4cout << tab << name << " Box made of " << getScntMat() << " of dimension " 301 << getDx_2Scnt(lay)*mm << " " << getDy_ 301 << getDx_2Scnt(lay)*mm << " " << getDy_2ScntLay(lay)*mm << " " 302 << getDy_2ScntLay(lay)*mm << G4endl; 302 << getDy_2ScntLay(lay)*mm << G4endl; 303 #endif 303 #endif 304 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap 304 xpos =(-getDx_2ScntLay(lay)+2.*getDx_2Wrap(lay)+2.*getDx_2FrontP(lay)+ 305 getDx_2Scnt(lay)); 305 getDx_2Scnt(lay)); 306 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0 306 new G4PVPlacement(0, G4ThreeVector(xpos*mm,0,0), logd, name, log, false,1); 307 #ifdef pdebug 307 #ifdef pdebug 308 G4cout << logd->GetName() << " Number 1 posi 308 G4cout << logd->GetName() << " Number 1 positioned in " << log->GetName() 309 << " at (" << xpos*mm << ",0,0) with no 309 << " at (" << xpos*mm << ",0,0) with no rotation" << G4endl; 310 #endif 310 #endif 311 311 312 return log; 312 return log; 313 } 313 } 314 314 315 315 316 G4LogicalVolume* CCalG4Hcal::constructAbsorber 316 G4LogicalVolume* CCalG4Hcal::constructAbsorberLayer( G4int lay ) { 317 //Pointers to the Materials 317 //Pointers to the Materials 318 CCalMaterialFactory* matfact = CCalMaterialF 318 CCalMaterialFactory* matfact = CCalMaterialFactory::getInstance(); 319 //Now the absorber layer 319 //Now the absorber layer 320 G4Material* matter = matfact->findMaterial(g 320 G4Material* matter = matfact->findMaterial(getAbsMat()); 321 G4String name = Name() + "Absorber" + l 321 G4String name = Name() + "Absorber" + lay; 322 G4VSolid* solid = new G4Box (name, getDx_ 322 G4VSolid* solid = new G4Box (name, getDx_2Abs(lay)*mm, getDy_2Abs()*mm, getDy_2Abs()*mm); 323 G4LogicalVolume* log = new G4LogicalVolume(s 323 G4LogicalVolume* log = new G4LogicalVolume(solid, matter, name); 324 setVisType(CCalVisualisable::Absorber,log); 324 setVisType(CCalVisualisable::Absorber,log); 325 #ifdef debug 325 #ifdef debug 326 G4cout << tab << name << " Box made of " << 326 G4cout << tab << name << " Box made of " << getAbsMat() << " of dimension " 327 << getDx_2Abs(lay)*mm << " " << getDy_2 327 << getDx_2Abs(lay)*mm << " " << getDy_2Abs()*mm << " " 328 << getDy_2Abs()*mm << G4endl; 328 << getDy_2Abs()*mm << G4endl; 329 #endif 329 #endif 330 return log; 330 return log; 331 } 331 } 332 332 333 333 334 void CCalG4Hcal::constructDaughters() {} 334 void CCalG4Hcal::constructDaughters() {} 335 335 336 336 337 void CCalG4Hcal::constructSensitive() { 337 void CCalG4Hcal::constructSensitive() { 338 if (allSensitiveLogs.size()>0) { 338 if (allSensitiveLogs.size()>0) { 339 CCalSensitiveDetectors* sensDets = CCalSen 339 CCalSensitiveDetectors* sensDets = CCalSensitiveDetectors::getInstance(); 340 G4String SDname = Name(); 340 G4String SDname = Name(); 341 for (std::vector<ptrG4Log>::iterator iter= 341 for (std::vector<ptrG4Log>::iterator iter=allSensitiveLogs.begin(); 342 iter<allSensitiveLogs.end(); iter++) 342 iter<allSensitiveLogs.end(); iter++) { 343 sensDets->registerVolume(SDname, (*iter) 343 sensDets->registerVolume(SDname, (*iter)); 344 #ifdef sdebug 344 #ifdef sdebug 345 G4cout << "Register volume " << (*iter)- 345 G4cout << "Register volume " << (*iter)->GetName() << " for" << SDname 346 << G4endl; 346 << G4endl; 347 #endif 347 #endif 348 } 348 } 349 } else { 349 } else { 350 G4cerr << "CCalG4Hcal ERROR: Could not con 350 G4cerr << "CCalG4Hcal ERROR: Could not construct Sensitive Detector" 351 << G4endl; 351 << G4endl; 352 } 352 } 353 } 353 } 354 354 355 355