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