#include <BesMucConstruction.hh>
Inheritance diagram for BesMucConstruction:
Public Member Functions | |
BesMucConstruction () | |
virtual | ~BesMucConstruction () |
void | Construct (G4LogicalVolume *logicBes) |
G4VPhysicalVolume * | GetPhysicalMuc () |
G4LogicalVolume * | FindLogicalVolume (const G4String &vn) |
Protected Attributes | |
SAXProcessor | m_sxp |
ProcessingConfigurator | m_config |
Private Attributes | |
G4VPhysicalVolume * | physicalMuc |
G4LogicalVolume * | logicalMuc |
Definition at line 20 of file BesMucConstruction.hh.
BesMucConstruction::BesMucConstruction | ( | ) |
BesMucConstruction::~BesMucConstruction | ( | ) | [virtual] |
void BesMucConstruction::Construct | ( | G4LogicalVolume * | logicBes | ) | [virtual] |
Implements BesSubdetector.
Definition at line 41 of file BesMucConstruction.cc.
References BesSubdetector::FindLogicalVolume(), SubDetectorG4Geo::GetTopVolume(), logicalMuc, and physicalMuc.
Referenced by BesDetectorConstruction::Construct().
00042 { 00043 //construct Muc 00044 00045 //Dengzy for boostroot environment 00046 // ReadBoostRoot* boostroot=new ReadBoostRoot(); 00047 // G4String GeometryPath = boostroot->GetBoostRoot(); 00048 // delete boostroot; 00049 00050 // if(!GeometryPath){ 00051 // G4Exception("BOOST environment not set!"); 00052 // } 00053 // GeometryPath += "/dat/Muc.gdml"; 00054 00055 // m_config.SetURI(GeometryPath); 00056 // m_config.SetSetupName( "Muc" ); 00057 // m_config.SetSetupVersion( "1.0" ); 00058 // m_config.SetType( "G4" ); 00059 // m_sxp.Configure(&m_config); 00060 // m_sxp.Initialize(); 00061 // m_sxp.Run(); 00062 00063 // G4cout << "Construct Muc from" << GeometryPath << G4endl; 00064 // G4LogicalVolume* logicalMuc = FindLogicalVolume("logicalMuc"); 00065 00066 // init geo from MucGeoSvc 2006.11.23 00067 00068 MucG4Geo *aMucG4Geo = new MucG4Geo(); 00069 G4LogicalVolume* logicalMuc = aMucG4Geo->GetTopVolume(); 00070 //G4LogicalVolume* logicalMuc = MucG4Geo::Instance()->GetTopVolume(); 00071 00072 if(!logicalMuc) { 00073 G4cout << "BesMucConstruction::Construct() 1, logicalMuc not found!" << G4endl; 00074 } 00075 else { 00076 //G4cout << "Muc" exist" << G4endl; 00077 physicalMuc = new G4PVPlacement(0, 00078 G4ThreeVector(0,0,0), 00079 logicalMuc, 00080 "PhysicalMuc", 00081 logicBes, 00082 false, 00083 0); 00084 logicalMuc->SetVisAttributes (G4VisAttributes::Invisible); 00085 } 00086 00087 //sensitive detectors 00088 G4SDManager* aSDman = G4SDManager::GetSDMpointer(); 00089 BesMucSD* aMucSD = new BesMucSD("BesMucSD", this); 00090 aSDman->AddNewDetector(aMucSD); 00091 00092 G4LogicalVolume* lv = 0; 00093 00094 G4int partMax = 3; 00095 //G4int segMax = 8, absorberMax = 9, gapMax = 9, panelMax = 4; 00096 G4int stripMax = 96, bakeliteMax = 4, gasChamberMax = 2; 00097 G4int segOnPart[3] = {4, 8, 4}; 00098 G4int absorberOnPart[3] = {9, 9, 9}; 00099 G4int gapOnPart[3] = {8, 9, 8}; 00100 G4int panelOnPart[3] = {3, 4, 3}; 00101 G4int part, seg, absorber, panel, gap, bakelite, gasChamber, strip; 00102 00103 for(part = 0; part < partMax; part++) { 00104 //for(seg = 0; seg < 1; seg++) { 00105 for(seg = 0; seg < segOnPart[part]; seg++) { 00106 if(seg==0||part==1&&seg==2){ 00107 for(gap = 0; gap < gapOnPart[part]; gap++) { 00108 for(gasChamber = 0; gasChamber < gasChamberMax; gasChamber++) { 00109 int seg_shift = 0; if(part==1&&seg==2) seg_shift = 1; 00110 for(panel = 0; panel < panelOnPart[part] + seg_shift; panel++) { 00111 std::ostrstream sf; 00112 sf << "l" << "Muc" 00113 << "P" << part 00114 << "S" << seg 00115 << "G" << gap 00116 << "R" << gasChamber 00117 << "Pn" << panel 00118 << "C" 00119 << std::ends; 00120 00121 // sf << "logical" << "Muc" 00122 // << "Part" << part 00123 // << "Seg" << seg 00124 // << "Gap" << gap 00125 // << "RpcUpDown" << gasChamber 00126 // << "Panel" << panel 00127 // << "GasChamber" 00128 // << std::ends; 00129 00130 lv = FindLogicalVolume(sf.str()); 00131 if(!lv) { 00132 G4cout << "BesMucConstruction::Construct(), " << sf.str() << " not found!" << G4endl; 00133 } 00134 else { 00135 lv->SetSensitiveDetector(aMucSD); 00136 } 00137 } 00138 } 00139 } 00140 } 00141 } 00142 } 00143 00144 //visulizatioin attibutes 00145 G4VisAttributes* mucVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0, 0.05)); 00146 G4VisAttributes* absorberVisAtt = new G4VisAttributes(G4Colour(1.0, 0.3, 0.0, 1.0)); 00147 G4VisAttributes* gapVisAtt = new G4VisAttributes(G4Colour(0.5, 0.5, 0.5, 1.0)); 00148 G4VisAttributes* stripVisAtt = new G4VisAttributes(G4Colour(1.0, 0.0, 1.0, 1.0)); 00149 G4VisAttributes* bakeliteVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 0.0, 1.0)); 00150 G4VisAttributes* gasChamberVisAtt = new G4VisAttributes(G4Colour(0.6, 0.8, 1.0, 1.0)); 00151 00152 lv = FindLogicalVolume("logicalMuc"); 00153 if(!lv) { 00154 G4cout << "BesMucConstruction::Construct() 2, logicMuc not found!" << G4endl; 00155 } 00156 else { 00157 lv->SetVisAttributes(mucVisAtt); 00158 lv->SetVisAttributes (G4VisAttributes::Invisible); 00159 } 00160 00161 for(part = 0; part < partMax; part++) { 00162 for(seg = 0; seg < segOnPart[part]; seg++) { 00163 for(absorber = 0; absorber < absorberOnPart[part]; absorber++) { 00164 std::ostrstream sf; 00165 sf << "logical" << "Muc" 00166 << "Part" << part 00167 << "Seg" << seg 00168 << "Absorber" << absorber 00169 << std::ends; 00170 00171 lv = FindLogicalVolume(sf.str()); 00172 if(lv) { 00173 lv->SetVisAttributes(absorberVisAtt); 00174 //if(part == 1 || seg == 0 || seg == 1 || seg == 2) { 00175 if(part != 1) { 00176 lv->SetVisAttributes (G4VisAttributes::Invisible); 00177 } 00178 } 00179 } 00180 } 00181 } 00182 00183 // for(part = 0; part < partMax; part++) { 00184 // for(seg = 0; seg < segOnPart[part]; seg++) { 00185 // for(absorber = 0; absorber < absorberOnPart[part]; absorber++) { 00186 // for(panel = 0; panel < panelOnPart[part]; panel++) { 00187 // std::ostrstream sf; 00188 // sf << "logical" 00189 // << "MucPart" << part 00190 // << "Seg" << seg 00191 // << "Absorber" << absorber 00192 // << "Panel" << panel 00193 // << std::ends; 00194 00195 // lv = FindLogicalVolume(sf.str()); 00196 // if(lv) { 00197 // lv->SetVisAttributes(absorberVisAtt); 00198 // if(part != 1) { 00199 // lv->SetVisAttributes (G4VisAttributes::Invisible); 00200 // } 00201 // //lv->SetVisAttributes (G4VisAttributes::Invisible); 00202 // } 00203 // } 00204 // } 00205 // } 00206 // } 00207 00208 for(part = 0; part < partMax; part++) { 00209 for(seg = 0; seg < segOnPart[part]; seg++) { 00210 for(gap = 0; gap < gapOnPart[part]; gap++) { 00211 std::ostrstream sf; 00212 sf << "logical" << "Muc" 00213 << "Part" << part 00214 << "Seg" << seg 00215 << "Gap" << gap 00216 << std::ends; 00217 00218 lv = FindLogicalVolume(sf.str()); 00219 if(lv) { 00220 lv->SetVisAttributes(gapVisAtt); 00221 lv->SetVisAttributes(G4VisAttributes::Invisible); 00222 } 00223 } 00224 } 00225 } 00226 00227 for(part = 0; part < partMax; part++) { 00228 for(seg = 0; seg < 1; seg++) { 00229 // for(seg = 0; seg < segOnPart[part]; seg++) { 00230 for(gap = 0; gap < gapOnPart[part]; gap++) { 00231 std::ostrstream sf; 00232 sf << "logical" << "Muc" 00233 << "Part" << part 00234 << "Seg" << seg 00235 << "Gap" << gap 00236 << "StripPlane" 00237 << std::ends; 00238 00239 lv = FindLogicalVolume(sf.str()); 00240 if(lv) { 00241 lv->SetVisAttributes(gapVisAtt); 00242 lv->SetVisAttributes(G4VisAttributes::Invisible); 00243 } 00244 } 00245 } 00246 } 00247 00248 for(part = 0; part < partMax; part++) { 00249 for(seg = 0; seg < 1; seg++) { 00250 //for(seg = 0; seg < segOnPart[part]; seg++) { 00251 for(gap = 0; gap < gapOnPart[part]; gap++) { 00252 for(strip = 0; strip < stripMax; strip++) { 00253 std::ostrstream sf; 00254 if(strip >= 0 && strip < 10) { 00255 sf << "logical" << "Muc" 00256 << "Part" << part 00257 << "Seg" << seg 00258 << "Gap" << gap 00259 << "Strip0" << strip 00260 << std::ends; 00261 } 00262 else if(strip >= 10 && strip < 100) { 00263 sf << "logical" << "Muc" 00264 << "Part" << part 00265 << "Seg" << seg 00266 << "Gap" << gap 00267 << "Strip" << strip 00268 << std::ends; 00269 } 00270 else { 00271 G4cout << "BesMucConstruction::Construct(), strip=" << strip << " error!" << G4endl; 00272 } 00273 00274 lv = FindLogicalVolume(sf.str()); 00275 if(lv) { 00276 lv->SetVisAttributes(stripVisAtt); 00277 lv->SetVisAttributes(G4VisAttributes::Invisible); 00278 } 00279 } 00280 } 00281 } 00282 } 00283 00284 for(part = 0; part < partMax; part++) { 00285 for(seg = 0; seg < 1; seg++) { 00286 // for(seg = 0; seg < segOnPart[part]; seg++) { 00287 for(gap = 0; gap < gapOnPart[part]; gap++) { 00288 for(panel = 0; panel < panelOnPart[part]; panel++) { 00289 for(bakelite = 0; bakelite < bakeliteMax; bakelite++) { 00290 std::ostrstream sf; 00291 sf << "logical" << "Muc" 00292 << "Part" << part 00293 << "Seg" << seg 00294 << "Gap" << gap 00295 << "Panel" << panel 00296 << "Bakelite" << bakelite 00297 << std::ends; 00298 00299 lv = FindLogicalVolume(sf.str()); 00300 if(lv) { 00301 lv->SetVisAttributes(bakeliteVisAtt); 00302 lv->SetVisAttributes(G4VisAttributes::Invisible); 00303 } 00304 } 00305 } 00306 } 00307 } 00308 } 00309 00310 00311 for(part = 0; part < partMax; part++) { 00312 for(seg = 0; seg < 1; seg++) { 00313 // for(seg = 0; seg < segOnPart[part]; seg++) { 00314 for(gap = 0; gap < gapOnPart[part]; gap++) { 00315 for(panel = 0; panel < panelOnPart[part]; panel++) { 00316 for(gasChamber = 0; gasChamber < gasChamberMax; gasChamber++) { 00317 std::ostrstream sf; 00318 sf << "logical" << "Muc" 00319 << "Part" << part 00320 << "Seg" << seg 00321 << "Gap" << gap 00322 << "Panel" << panel 00323 << "GasChamber" << gasChamber 00324 << std::ends; 00325 00326 lv = FindLogicalVolume(sf.str()); 00327 if(lv) { 00328 lv->SetVisAttributes(gasChamberVisAtt); 00329 //if( (part == 1 && (seg == 0 || seg == 1 || seg == 3 || seg == 4) ) 00330 // || (part == 0 && (seg == 0 || seg == 1 || seg ==2) ) ) { 00331 //lv->SetVisAttributes (G4VisAttributes::Invisible); 00332 //} 00333 if(part != 1) { 00334 lv->SetVisAttributes(G4VisAttributes::Invisible); 00335 } 00336 } 00337 } 00338 } 00339 } 00340 } 00341 } 00342 //m_sxp.Finalize(); 00343 delete aMucG4Geo; 00344 }
G4LogicalVolume * BesSubdetector::FindLogicalVolume | ( | const G4String & | vn | ) | [inline, inherited] |
Definition at line 38 of file BesSubdetector.hh.
Referenced by BesTofConstruction::Construct(), Construct(), and BesEmcConstruction::GetLogicalVolume().
00038 { 00039 return const_cast<G4LogicalVolume*>( GDMLProcessor::GetInstance()->GetLogicalVolume(vn) ); 00040 }
G4VPhysicalVolume* BesMucConstruction::GetPhysicalMuc | ( | ) | [inline] |
Definition at line 29 of file BesMucConstruction.hh.
Referenced by BesMucSD::BesMucSD().
00029 {return physicalMuc;};
G4LogicalVolume* BesMucConstruction::logicalMuc [private] |
ProcessingConfigurator BesSubdetector::m_config [protected, inherited] |
Definition at line 33 of file BesSubdetector.hh.
SAXProcessor BesSubdetector::m_sxp [protected, inherited] |
Definition at line 32 of file BesSubdetector.hh.
G4VPhysicalVolume* BesMucConstruction::physicalMuc [private] |