本文整理汇总了C++中Box::GetDY方法的典型用法代码示例。如果您正苦于以下问题:C++ Box::GetDY方法的具体用法?C++ Box::GetDY怎么用?C++ Box::GetDY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box
的用法示例。
在下文中一共展示了Box::GetDY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Build_Geom
//__________________________________________________________________________
Bool_t Build_Geom(const TGeoManager* geoManager)
{
// -------------------------------------
// BUILDING GEOMETRY
// Materials - Define the materials used. Leave the neutron properties to be defined on a run-by-run basis
Materials::BuildMaterials(geoManager);
TGeoMedium* beryllium = geoManager->GetMedium("Beryllium");
TGeoMedium* blackhole = geoManager->GetMedium("BlackHole");
TGeoMedium* heliumII = geoManager->GetMedium("HeliumII");
TGeoMedium* lithium6 = geoManager->GetMedium("Lithium6");
// -------------------------------------
// -- Making Top Volume
Box* topShape = new Box("Top",100,100,100);
BlackHole* top = new BlackHole("Top", topShape, blackhole);
geoManager->SetTopVolume(top);
top->SetVisibility(kFALSE);
// -- Make the boundary volume in which all the others sit
// -- This is what we will be reflecting off all the time
Double_t surfaceRoughness = 0.1;
Box* chamberShape = new Box("Chamber",10,10,10);
Boundary* chamber = new Boundary("Chamber", chamberShape, beryllium, surfaceRoughness);
chamber->SetLineColor(kOrange-7);
chamber->SetLineWidth(1);
chamber->SetVisibility(kFALSE);
chamber->SetTransparency(80);
// Add to geom
top->AddNode(chamber,1);
// -------------------------------------
// -- DETECTOR VALVE
// DetectorValveVol
Box *detectorValveVolShape = new Box("DetectorValveVol", detectorValveVolHalfX, detectorValveVolHalfY, detectorValveVolHalfZ);
TrackingVolume* detectorValveVol = new TrackingVolume("DetectorValveVol", detectorValveVolShape, heliumII);
detectorValveVol->SetLineColor(kRed+3);
detectorValveVol->SetLineWidth(1);
detectorValveVol->SetVisibility(kTRUE);
detectorValveVol->SetTransparency(0);
// -- Define the Valve volume back
TGeoRotation detectorValveVolRot("DetectorValveVolXPosRot",detectorValveVolPhi,detectorValveVolTheta,detectorValveVolPsi); // phi, theta, psi
TGeoTranslation detectorValveVolTra("DetectorValveVolXPosTra", detectorValveVolXPos, detectorValveVolYPos, detectorValveVolZPos);
TGeoCombiTrans detectorValveVolCom(detectorValveVolTra,detectorValveVolRot);
TGeoHMatrix detectorValveVolMat = detectorValveVolCom;
chamber->AddNode(detectorValveVol, 1, new TGeoHMatrix(detectorValveVolMat));
Double_t detectorValveVolCapacity = detectorValveVolShape->Capacity();
// -------------------------------------
// -- GUIDE SECTION
// Guide section has *probably* 4 segments.
Box *guideSegShape = new Box("GuideSeg", guideSegHalfX, guideSegHalfY, guideSegHalfZ);
TrackingVolume* guideSeg = new TrackingVolume("GuideSeg", guideSegShape, heliumII);
guideSeg->SetLineColor(kCyan-8);
guideSeg->SetLineWidth(1);
guideSeg->SetVisibility(kTRUE);
guideSeg->SetTransparency(20);
Double_t guideSegXPos = guideXPos;
Double_t guideCapacity = 0.0;
for (Int_t segNum = 1; segNum <= 3; segNum++) {
// Define Guide Seg matrix
TGeoRotation segmentRot("SegmentRot",guidePhi,guideTheta,0); // phi, theta, psi
TGeoTranslation segmentTra("SegmentTra",guideSegXPos, guideYPos, guideZPos);
TGeoCombiTrans segmentCom(segmentTra,segmentRot);
TGeoHMatrix segmentMat = segmentCom;
Char_t sourceMatrixName[20];
sprintf(sourceMatrixName, "GuideSegMatrix%d", segNum);
segmentMat.SetName(sourceMatrixName);
chamber->AddNode(guideSeg, segNum, new TGeoHMatrix(segmentMat));
// Shift next segment along by length of segment
guideSegXPos = guideSegXPos - 2.0*guideSegHalfZ;
// Calculate guide's volume
guideCapacity += guideSegShape->Capacity();
}
// -------------------------------------
// -- Close Geometry
geoManager->CloseGeometry();
// -------------------------------------
// -- Write out geometry to file
const char *fileName = "$(UCN_GEOM)/guide_section_geom.root";
cout << "Simulation Geometry Built... Writing to file: " << fileName << endl;
geoManager->Export(fileName);
double* origin = detectorValveVolMat->GetTranslation();
double start_boundary[3] = {detectorValveVolShape->GetDX(),detectorValveVolShape->GetDY(),detectorValveVolShape->GetDZ()};
cout << "Valve Vol Origin: " << origin[0] << "\t" << origin[1] << "\t" << origin[2] << endl;
cout << "Valve Vol Boundary +/-: " << start_boundary[0] << "\t" << start_boundary[1] << "\t" << start_boundary[2] << endl;
TGeoHMatrix* end_matrix = dynamic_cast<TGeoHMatrix*>(geoManager->GetListOfMatrices()->FindObject("GuideSegMatrix3"));
double* end_origin = end_matrix->GetTranslation();
double end_boundary[3] = {guideSegShape->GetDX(),guideSegShape->GetDY(),guideSegShape->GetDZ()};
cout << "Pre-Volume Origin: " << end_origin[0] << "\t" << end_origin[1] << "\t" << end_origin[2] << endl;
cout << "Pre-Volume Boundary +/-: " << end_boundary[0] << "\t" << end_boundary[1] << "\t" << end_boundary[2] << endl;
BuildFieldMap(detectorValveVolMat);
//.........这里部分代码省略.........