![]() |
![]() |
#include <DetectorDescription/Parser/src/DDDividedPolyhedra.h>
Public Member Functions | |
virtual void | checkParametersValidity () |
DDDividedPolyhedraZ (const DDDivision &div) | |
virtual double | getMaxParameter () const |
virtual DDLogicalPart | makeDDLogicalPart (const int copyNo) const |
virtual DDRotation | makeDDRotation (const int copyNo) const |
virtual DDTranslation | makeDDTranslation (const int copyNo) const |
virtual | ~DDDividedPolyhedraZ () |
Definition at line 64 of file DDDividedPolyhedra.h.
DDDividedPolyhedraZ::DDDividedPolyhedraZ | ( | const DDDivision & | div | ) |
Definition at line 315 of file DDDividedPolyhedra.cc.
References DDDividedGeometryObject::calculateNDiv(), DDDividedGeometryObject::calculateWidth(), checkParametersValidity(), DDDividedGeometryObject::compNDiv_, DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDDividedGeometryObject::divisionType_, DivNDIV, DivWIDTH, DDDivision::nReplicas(), DDDivision::offset(), DDDivision::parent(), DDDividedGeometryObject::setType(), DDLogicalPart::solid(), DDDivision::width(), and DDPolyhedra::zVec().
00316 : DDDividedGeometryObject ( div ) 00317 { 00318 checkParametersValidity(); 00319 setType( "DivisionPolyhedraZ" ); 00320 00321 DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid()); 00322 //G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 00323 std::vector<double> zvec = msol.zVec(); 00324 00325 if ( divisionType_ == DivWIDTH ) 00326 { 00327 compNDiv_ = 00328 calculateNDiv( zvec[zvec.size() - 1] - zvec[0], div_.width(), div_.offset() ); 00329 } 00330 else if( divisionType_ == DivNDIV ) 00331 { 00332 compWidth_ = calculateWidth( zvec[zvec.size() - 1] - zvec[0] 00333 , div_.nReplicas() 00334 , div_.offset()); 00335 // ?what? CalculateNDiv( zvec[zvec.size() - 1] - zvec[0], origparamMother->Z_values[origparamMother->Num_z_planes-1] 00336 // - origparamMother->Z_values[0] , nDiv, offset ); 00337 00338 } 00339 00340 DCOUT_V ('P', " DDDividedPolyhedraZ - # divisions " << compNDiv_ << " = " << div_.nReplicas() << "\n Offset " << " = " << div_.offset() << "\n Width " << compWidth_ << " = " << div_.width()); 00341 00342 }
DDDividedPolyhedraZ::~DDDividedPolyhedraZ | ( | ) | [virtual] |
void DDDividedPolyhedraZ::checkParametersValidity | ( | ) | [virtual] |
Reimplemented from DDDividedGeometryObject.
Definition at line 361 of file DDDividedPolyhedra.cc.
References DDDividedGeometryObject::checkParametersValidity(), DDDividedGeometryObject::compNDiv_, GenMuonPlsPt100GeV_cfg::cout, DDDividedGeometryObject::div_, DDDividedGeometryObject::divisionType_, DivNDIVandWIDTH, DivWIDTH, lat::endl(), DDDivision::offset(), DDDivision::parent(), s, DDLogicalPart::solid(), and DDPolyhedra::zVec().
Referenced by DDDividedPolyhedraZ().
00362 { 00363 DDDividedGeometryObject::checkParametersValidity(); 00364 00365 DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid()); 00366 00367 if( divisionType_ == DivNDIVandWIDTH || divisionType_ == DivWIDTH ) 00368 { 00369 std::cout << "WARNING - " 00370 << "DDDividedPolyhedraZ::checkParametersValidity()" 00371 << std::endl 00372 << " Solid " << msol << std::endl 00373 << " Division along Z will be done splitting " 00374 << "in the defined z_planes." << std::endl 00375 << " WIDTH will not be used !" << std::endl; 00376 } 00377 00378 if( div_.offset() != 0. ) 00379 { 00380 std::cout << "WARNING - " 00381 << "DDDividedPolyhedraZ::checkParametersValidity()" 00382 << std::endl 00383 << " Solid " << msol << std::endl 00384 << " Division along Z will be done splitting " 00385 << "in the defined z_planes." << std::endl 00386 << " OFFSET will not be used !" << std::endl; 00387 } 00388 00389 // G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 00390 00391 std::vector<double> zvec = msol.zVec(); 00392 00393 if ( zvec.size() - 1 != size_t(compNDiv_) ) 00394 { 00395 std::cout << "ERROR - " 00396 << "DDDividedPolyhedraZ::checkParametersValidity()" 00397 << std::endl 00398 << " Division along Z can only be done by splitting in the defined" 00399 << std::endl 00400 << " z_planes, i.e, the number of division would be :" 00401 << " " << zvec.size() - 1 00402 << " instead of " << compNDiv_ << " !" 00403 << std::endl; 00404 std::string s = "DDDividedPolyhedraZ::checkParametersValidity()"; 00405 s += "Illegal Construct. Not a supported configuration."; 00406 throw DDException (s); 00407 } 00408 }
double DDDividedPolyhedraZ::getMaxParameter | ( | ) | const [virtual] |
Reimplemented from DDDividedGeometryObject.
Definition at line 350 of file DDDividedPolyhedra.cc.
References DDDividedGeometryObject::div_, DDDivision::parent(), DDLogicalPart::solid(), and DDPolyhedra::zVec().
00351 { 00352 DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid()); 00353 //G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 00354 std::vector<double> zvec = msol.zVec(); 00355 return (zvec[zvec.size() - 1] - zvec[0]); 00356 //origparamMother->Z_values[origparamMother->Num_z_planes-1] 00357 // -origparamMother->Z_values[0]); 00358 }
DDLogicalPart DDDividedPolyhedraZ::makeDDLogicalPart | ( | const int | copyNo | ) | const [virtual] |
Reimplemented from DDDividedGeometryObject.
Definition at line 440 of file DDDividedPolyhedra.cc.
References DCOUT_V, DDBase< N, C >::ddname(), DDPolyhedra::deltaPhi(), DDDividedGeometryObject::div_, DDXMLElement::itostr(), lp, DDLogicalPart::material(), DDName::name(), DDName::ns(), DDDivision::parent(), DDSolidFactory::polyhedra(), DDPolyhedra::rMaxVec(), DDPolyhedra::rMinVec(), DDPolyhedra::sides(), DDLogicalPart::solid(), DDPolyhedra::startPhi(), and DDPolyhedra::zVec().
00441 { 00442 // only for mother number of planes = 2!! 00443 // mec: what? why? comment above and = 2 below straight from G4 impl. 00444 DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid()); 00445 DDMaterial usemat = div_.parent().material(); 00446 // G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 00447 // G4PolyhedraHistorical origparam( *origparamMother ); 00448 std::vector<double> zvec = msol.zVec(); 00449 std::vector<double> rminvec = msol.rMinVec(); 00450 std::vector<double> rmaxvec = msol.rMaxVec(); 00451 00452 double posi = (zvec[copyNo] + zvec[copyNo+1])/2; 00453 00454 // origparam.Num_z_planes = 2; 00455 // origparam.Z_values[0] = origparamMother->Z_values[copyNo] - posi; 00456 // origparam.Z_values[1] = origparamMother->Z_values[copyNo+1] - posi; 00457 // origparam.Rmin[0] = origparamMother->Rmin[copyNo]; 00458 // origparam.Rmin[1] = origparamMother->Rmin[copyNo+1]; 00459 // origparam.Rmax[0] = origparamMother->Rmax[copyNo]; 00460 // origparam.Rmax[1] = origparamMother->Rmax[copyNo+1]; 00461 DDName solname(div_.parent().ddname().name() + "_DIVCHILD" 00462 + DDXMLElement::itostr(copyNo) 00463 , div_.parent().ddname().ns()); 00464 std::vector<double> newRmin, newRmax, newZ; 00465 newZ.push_back(zvec[copyNo] - posi); 00466 newZ.push_back(zvec[copyNo+1] - posi); 00467 newRmin.push_back(rminvec[copyNo]); 00468 newRmin.push_back(rminvec[copyNo+1]); 00469 newRmax.push_back(rmaxvec[copyNo]); 00470 newRmax.push_back(rmaxvec[copyNo+1]); 00471 00472 DDSolid dsol = DDSolidFactory::polyhedra(solname 00473 , msol.sides() 00474 , msol.startPhi() 00475 , msol.deltaPhi() 00476 , newZ 00477 , newRmin 00478 , newRmax); 00479 DDLogicalPart lp(solname, usemat, dsol); 00480 00481 // phedra.SetOriginalParameters(&origparam); // copy values & transfer pointers 00482 // phedra.Reset(); // reset to new solid parameters 00483 00484 DCOUT_V ('P', "DDDividedPolyhedraZ::makeDDLogicalPart" << "\n-- Parametrised phedra copy-number: " << copyNo << "\n-- DDLogicalPart " << lp ); 00485 return lp; 00486 00487 }
DDRotation DDDividedPolyhedraZ::makeDDRotation | ( | const int | copyNo | ) | const [virtual] |
Reimplemented from DDDividedGeometryObject.
Definition at line 434 of file DDDividedPolyhedra.cc.
00435 { 00436 return DDRotation(); 00437 }
DDTranslation DDDividedPolyhedraZ::makeDDTranslation | ( | const int | copyNo | ) | const [virtual] |
Reimplemented from DDDividedGeometryObject.
Definition at line 411 of file DDDividedPolyhedra.cc.
References DDDividedGeometryObject::compWidth_, DCOUT_V, DDDividedGeometryObject::div_, DDDivision::offset(), DDDivision::parent(), DDLogicalPart::solid(), and DDPolyhedra::zVec().
00412 { 00413 DDPolyhedra msol = (DDPolyhedra)(div_.parent().solid()); 00414 std::vector<double> zvec = msol.zVec(); 00415 00416 //----- set translation: along Z axis 00417 // G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters(); 00418 // double posi = (origparamMother->Z_values[copyNo] 00419 // + origparamMother->Z_values[copyNo+1])/2; 00420 00421 double posi = (zvec[copyNo] + zvec[copyNo+1])/2; 00422 00423 //G4ThreeVector origin(0.,0.,posi); 00424 // physVol->SetTranslation( origin ); 00425 00426 DDTranslation tr(0,0,posi); 00427 //----- calculate rotation matrix: unit 00428 00429 DCOUT_V ('P', " DDDividedPolyhedraZ - position: " << posi << "\n copyNo: " << copyNo << " - offset: " << div_.offset()/deg << " - compWidth_: " << compWidth_/deg << " translation = " << tr); 00430 return tr; 00431 }