本文整理汇总了C++中TGeoManager::GetMedium方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoManager::GetMedium方法的具体用法?C++ TGeoManager::GetMedium怎么用?C++ TGeoManager::GetMedium使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGeoManager
的用法示例。
在下文中一共展示了TGeoManager::GetMedium方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rotSensor
/*
* CreateLambdaGeometry.C
*
* Created on: Mar 21, 2013
* Author: stockman
*/
startdetector1()
{
//-----------------------------
Double_t positionOfDisk1inZ = 40.0; //in cm
//Double_t positionOfDisk2inZ = 53.0; //in cm
//--------------------------------------------------------------------
gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
// Load this libraries
gSystem->Load("libGeoBase");
gSystem->Load("libParBase");
gSystem->Load("libBase");
gSystem->Load("libPndData");
gSystem->Load("libPassive");
TString outfile= "../../geometry/startdetector.root";
TFile* fi = new TFile(outfile,"RECREATE");
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
FairGeoInterface *geoFace = geoLoad->getGeoInterface();
geoFace->setMediaFile("../../geometry/media_pnd.geo");
geoFace->readMedia();
geoFace->print();
FairGeoMedia *Media = geoFace->getMedia();
FairGeoBuilder *geobuild=geoLoad->getGeoBuilder();
FairGeoMedium *CbmMediumHYPdiamond = Media->getMedium("HYPdiamond");
FairGeoMedium *CbmMediumCarbon = Media->getMedium("carbon");
FairGeoMedium *CbmMediumCarbonFoam = Media->getMedium("carbonfoam");
FairGeoMedium *CbmMediumAluminium = Media->getMedium("aluminium");
Int_t nmed=geobuild->createMedium(CbmMediumHYPdiamond);
nmed=geobuild->createMedium(CbmMediumCarbon);
nmed=geobuild->createMedium(CbmMediumCarbonFoam);
nmed=geobuild->createMedium(CbmMediumAluminium);
TGeoManager* gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
TGeoVolume *top = new TGeoVolumeAssembly("top");
gGeoMan->SetTopVolume(top);
TGeoVolume *combinedLambdaDisks = new TGeoVolumeAssembly("CombinedLambdaDisks");
TGeoVolumeAssembly* lambdaDisk = new TGeoVolumeAssembly("LambdaDisk");
TGeoVolumeAssembly* largeRing = new TGeoVolumeAssembly("LargeRing");
TGeoVolumeAssembly* smallRing = new TGeoVolumeAssembly("SmallRing");
// lambdaDisk->AddNode(largeSensorVolume,0,trc1);
// TGeoShape* largeSensorShape = new TGeoTrd1("StripSensorActiveLargeShape", 3.4593/2, 1.9936/2,0.03/2, 5.5665/2);
Double_t points [16];
points[0] = -1.7297; points[1] = 2.7833;
points[2] = 1.7297; points[3] = 2.7833;
points[4] = 0.9968; points[5] = -2.7833;
points[6] = -0.9968; points[7] = -2.7833;
points[8] = -1.7297; points[9] = 2.7833;
points[10] = 1.7297; points[11] = 2.7833;
points[12] = 0.9968; points[13] = -2.7833;
points[14] = -0.9968; points[15] = -2.7833;
TGeoShape* largeSensorShape = new TGeoArb8("StripSensorActiveLargeShape", 0.03/2, points);
TGeoVolume* largeSensorVolume = new TGeoVolume("StripSensorActiveLargeTrap",largeSensorShape,gGeoMan->GetMedium("HYPdiamond"));
// TGeoRotation rotSensor("rotSensor",0,90,0);
TGeoRotation rotSensor("rotSensor",0,0,0);
TGeoTranslation transLargeSensor(0,(14.8669 + 5.5665)/2,0);
TGeoCombiTrans combined1(transLargeSensor, rotSensor);
for (int i = 0; i < 12; i++){
TString rotName("rotLargeSens");
rotName.Append(i+1);
TGeoRotation rotSens(rotName.Data(), 0,0, i*2 * 360/24);
TGeoHMatrix sens = rotSens * combined1;
largeRing->AddNode(largeSensorVolume, i, new TGeoHMatrix(sens));
}
Double_t pointsSmall [16];
pointsSmall[0] = -1.9579/2; pointsSmall[1] = 5.3358/2;
pointsSmall[2] = 1.9579/2; pointsSmall[3] = 5.3358/2;
pointsSmall[4] = 0.5529/2; pointsSmall[5] = -5.3358/2;
pointsSmall[6] = -0.5529/2; pointsSmall[7] = -5.3358/2;
pointsSmall[8] = -1.9579/2; pointsSmall[9] = 5.3358/2;
pointsSmall[10] = 1.9579/2; pointsSmall[11] = 5.3358/2;
pointsSmall[12] = 0.5529/2; pointsSmall[13] = -5.3358/2;
pointsSmall[14] = -0.5529/2; pointsSmall[15] = -5.3358/2;
// TGeoShape* smallSensorShape = new TGeoTrd1("StripSensorActiveSmallShape", 1.9579/2, 0.5529/2, 0.03/2, 5.3358/2);
TGeoShape* smallSensorShape = new TGeoArb8("StripSensorActiveSmallShape", 0.03/2, pointsSmall);
TGeoVolume* smallSensorVolume = new TGeoVolume("StripSensorActiveSmallTrap", smallSensorShape, gGeoMan->GetMedium("HYPdiamond"));
TGeoTranslation transSmallSensor(0,5.3358/2+2.1,0);
//.........这里部分代码省略.........
示例2: create_bpipe_geometry_v13e
//.........这里部分代码省略.........
infoFile << " windows: first one @ 220mm with R600mm and 0.7mm thickness, second one @ " << endl;
infoFile << " 6000mm with R800mm and 3mm thickness. The last three sections (and second " << endl;
infoFile << " window @ 6000mm) of beam pipe (1800-7990mm) are rotated by an angle of " << endl;
infoFile << " " << Form("%.2f",rotangle) <<
" degrees relative to point (0,0,1800) mm and the OY axis, following the " << endl;
infoFile << " bend of the ions in the magnetic field (field_v12b was used)." << endl << endl;
infoFile << "Material: " << pipeMediumName << endl;
infoFile << "Thickness: 0.017*D(z) mm" << endl << endl;
// --------------------------------------------------------------------------
// ------- Load media from media file -----------------------------------
FairGeoLoader* geoLoad = new FairGeoLoader("TGeo","FairGeoLoader");
FairGeoInterface* geoFace = geoLoad->getGeoInterface();
TString geoPath = gSystem->Getenv("VMCWORKDIR");
TString medFile = geoPath + "/geometry/media.geo";
geoFace->setMediaFile(medFile);
geoFace->readMedia();
TGeoManager* gGeoMan = gGeoManager;
// --------------------------------------------------------------------------
// ----------------- Get and create the required media -----------------
FairGeoMedia* geoMedia = geoFace->getMedia();
FairGeoBuilder* geoBuild = geoLoad->getGeoBuilder();
// ---> pipe medium
FairGeoMedium* fPipeMedium = geoMedia->getMedium(pipeMediumName.Data());
TString fairError = "FairMedium " + pipeMediumName + " not found";
if ( ! fPipeMedium ) Fatal("Main", fairError.Data());
geoBuild->createMedium(fPipeMedium);
TGeoMedium* pipeMedium = gGeoMan->GetMedium(pipeMediumName.Data());
TString geoError = "Medium " + pipeMediumName + " not found";
if ( ! pipeMedium ) Fatal("Main", geoError.Data());
// ---> vacuum
FairGeoMedium* mVacuum = geoMedia->getMedium("vacuum");
if ( ! mVacuum ) Fatal("Main", "FairMedium vacuum not found");
geoBuild->createMedium(mVacuum);
TGeoMedium* vacuum = gGeoMan->GetMedium("vacuum");
if ( ! vacuum ) Fatal("Main", "Medium vacuum not found");
// --------------------------------------------------------------------------
// -------------- Create geometry and top volume -------------------------
gGeoMan = (TGeoManager*)gROOT->FindObject("FAIRGeom");
gGeoMan->SetName("PIPEgeom");
TGeoVolume* top = new TGeoVolumeAssembly("TOP");
gGeoMan->SetTopVolume(top);
TGeoVolume* pipe = new TGeoVolumeAssembly(pipeName.Data());
// --------------------------------------------------------------------------
// ----- Create sections -------------------------------------------------
infoFile << endl << "Beam pipe section: " << pipe1name << endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
//*
TGeoVolume* pipe1 = MakePipe (1, nSects1, z1, rin1, rout1, pipeMedium, &infoFile);
pipe1->SetLineColor(kGray);
pipe->AddNode(pipe1, 0);
infoFile << endl << "Beam pipe section: " << pipe2name << endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
TGeoVolume* pipe2 = MakePipe (2, nSects2, z2, rin2, rout2, pipeMedium, &infoFile);