本文整理汇总了C++中TGeoManager::GetTopVolume方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoManager::GetTopVolume方法的具体用法?C++ TGeoManager::GetTopVolume怎么用?C++ TGeoManager::GetTopVolume使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGeoManager
的用法示例。
在下文中一共展示了TGeoManager::GetTopVolume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddLadder
void AddLadder()
{
SvxTGeo *geo = new SvxTGeo;
geo->ReadParFile("parfiles/svxPISA.par");
// Make an empty 100x100x100 cm^3 space in the experiment hall.
geo->MakeTopVolume(200/2, 200/2, 200/2);
// Place VTX sensors in the volume.
geo->AddSensors();
// Get handles for further manipulation
TGeoManager *mgr = geo->GeoManager();
TGeoVolume *top = mgr->GetTopVolume();
// Add a ladder with new index 20 and the same geometry as B1L9.
double xyz[3] = {0};
geo->GetSensorXYZ(1, 9, 0, xyz);
geo->AddLadder(1, 20, xyz[0], xyz[1], 0., geo->GetLadderPhiTilt(1,9));
// Now rotate B1L20 by angular difference between B1L9 and B1L8.
double dphi = geo->SensorPhiRad(1,9,0) - geo->SensorPhiRad(1,8,0);
geo->RotateLadder(1, 20, 0., 0., dphi);
// Done building model.
// Close geometry to check for problems (overlapping boundaries)
mgr->CloseGeometry();
// Press j,k to zoom; u,i to look up/down; h,l to look left, right.
TCanvas *c = new TCanvas("c", "svx model", 1400, 1000);
c->SetFillColor(kBlack);
top->Draw();
geo->WriteParFile("parfiles/svxPISA.newladders.par");
return;
}
示例2: main
//.........这里部分代码省略.........
std::cout << "Mean number of ions on plastic: "
<< sumIonsPlastic / nEvents << "\n";
std::cout << "Electron endpoints:\n";
const double fUpperMetal = sumElectronsUpperMetal / sumElectronsTotal;
const double fPlastic = sumElectronsPlastic / sumElectronsTotal;
const double fLowerMetal = sumElectronsLowerMetal / sumElectronsTotal;
const double fTransfer = sumElectronsTransfer / sumElectronsTotal;
const double fOther = sumElectronsOther / sumElectronsTotal;
std::cout << " upper metal: " << fUpperMetal * 100. << "%\n";
std::cout << " plastic: " << fPlastic * 100. << "%\n";
std::cout << " lower metal: " << fLowerMetal * 100. << "%\n";
std::cout << " transfer: " << fTransfer * 100. << "%\n";
std::cout << " other: " << fOther * 100. << "%\n";
TCanvas* cD = new TCanvas();
const bool plotGeo = true;
if (plotGeo && plotDrift) {
// Build the geometry in Root.
TGeoManager* geoman = new TGeoManager("world", "geometry");
TGeoMaterial* matVacuum = new TGeoMaterial("Vacuum", 0, 0, 0);
TGeoMedium* medVacuum = new TGeoMedium("Vacuum", 1, matVacuum);
TGeoMaterial* matKapton = new TGeoMaterial("Kapton", 12, 6, 1.42);
TGeoMedium* medKapton = new TGeoMedium("Kapton", 2, matKapton);
TGeoMaterial* matCopper = new TGeoMaterial("Copper", 63, 29, 8.94);
TGeoMedium* medCopper = new TGeoMedium("Copper", 3, matCopper);
TGeoVolume* volTop = geoman->MakeBox("TOP",
medVacuum, pitch, pitch, 0.02);
volTop->SetVisibility(0);
TGeoBBox* shpKapton = new TGeoBBox("K", pitch / 2.,
pitch / 2.,
kapton / 2.);
TGeoPcon* shpHole = new TGeoPcon("H", 0., 360., 3);
shpHole->DefineSection(0, -kapton / 2., 0., outdia / 2.);
shpHole->DefineSection(1, 0., 0., middia / 2.);
shpHole->DefineSection(2, kapton / 2., 0., outdia / 2.);
TGeoCompositeShape* shpGem = new TGeoCompositeShape("G", "K - H");
TGeoVolume* volKapton = new TGeoVolume("Kapton", shpGem, medKapton);
volKapton->SetLineColor(kGreen);
volKapton->SetTransparency(50);
TGeoBBox* shpMetal = new TGeoBBox("M", pitch / 2.,
pitch / 2.,
metal / 2.);
TGeoTube* shpTube = new TGeoTube("T", 0., outdia / 2., metal / 2.);
TGeoCompositeShape* shpElectrode = new TGeoCompositeShape("E", "M - T");
TGeoVolume* volElectrode = new TGeoVolume("Electrode",
shpElectrode, medCopper);
volElectrode->SetLineColor(kBlue);
volElectrode->SetTransparency(50);
TGeoVolumeAssembly* volGem = new TGeoVolumeAssembly("Gem");
const double shift = 0.5 * (metal + kapton);
volGem->AddNode(volKapton, 1);
volGem->AddNode(volElectrode, 2, new TGeoTranslation(0., 0., shift));
volGem->AddNode(volElectrode, 3, new TGeoTranslation(0., 0., -shift));
volTop->AddNode(volGem, 1);
volTop->AddNode(volGem, 2, new TGeoTranslation(-pitch, 0., 0.));
volTop->AddNode(volGem, 3, new TGeoTranslation(+pitch, 0., 0.));
volTop->AddNode(volGem, 4,
new TGeoTranslation(-pitch / 2., sqrt(3) * pitch / 2., 0.));
volTop->AddNode(volGem, 5,
new TGeoTranslation(+pitch / 2., sqrt(3) * pitch / 2., 0.));
volTop->AddNode(volGem, 6,
new TGeoTranslation(-pitch / 2., -sqrt(3) * pitch / 2., 0.));
volTop->AddNode(volGem, 7,
new TGeoTranslation(+pitch / 2., -sqrt(3) * pitch / 2., 0.));
geoman->SetVerboseLevel(0);
geoman->SetTopVolume(volTop);
geoman->CloseGeometry();
geoman->CheckOverlaps(0.1e-4);
geoman->SetNmeshPoints(100000);
cD->cd();
geoman->GetTopVolume()->Draw("ogl");
}
if (plotDrift) {
driftView->SetCanvas(cD);
driftView->Plot();
}
const bool plotHistogram = true;
if (plotHistogram) {
TCanvas* cH = new TCanvas("cH", "Histograms", 800, 700);
cH->Divide(2, 2);
cH->cd(1);
hElectrons->Draw();
cH->cd(2);
hIons->Draw();
cH->cd(3);
hChrgE->Draw();
cH->cd(4);
hChrgI->Draw();
}
app.Run(kTRUE);
}