本文整理汇总了C++中TGeoManager::CheckOverlaps方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoManager::CheckOverlaps方法的具体用法?C++ TGeoManager::CheckOverlaps怎么用?C++ TGeoManager::CheckOverlaps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGeoManager
的用法示例。
在下文中一共展示了TGeoManager::CheckOverlaps方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: create_bpipe_geometry_v13e
//.........这里部分代码省略.........
pipe->AddNode(pipe3, 0);
TGeoVolume* pipevac2 = MakeVacuum(2, nSects02, z02, rin02, rout02, vacuum, &infoFile);
pipevac2->SetLineColor(kCyan);
pipe->AddNode(pipevac2, 0);
//*/
// define some rotation & translation for pipe4-pipe7 & pipevac3-pipevac5
// Initial phi (Euler rotation angle about Z)
// Initial theta (Euler rotation angle about new X)
// Initial psi (Euler rotation angle about new Z)
cout<<endl<<"Rotation angle (@[0;0;1800]mm)="<< rotangle <<"deg";
TGeoRotation *r1 = new TGeoRotation("r1", 90., rotangle, 0.); // deg - Euler angles
r1->RegisterYourself();
Double_t shift = rotangle/10.+0.1; // cm - volume boolean operation correction - TODO
Double_t dx=0., dy=0., dz=1800.-10.*shift; // mm
TGeoCombiTrans *c1 = new TGeoCombiTrans("c1", dx/10., dy/10., dz/10., r1); // mm->cm
c1->RegisterYourself();
TGeoTranslation *t1 = new TGeoTranslation("t1", 0., 0., 180.-shift); // cm
t1->RegisterYourself();
Double_t phi, theta, psi;
c1->GetRotation()->GetAngles(phi, theta, psi);
infoFile << endl << "Beam pipe section: " << pipe4name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
// create shape components for pipe4
TGeoPcon* p4 = MakeShape(nSects4, "p4", z4, rin4, rout4, &infoFile);
TGeoBBox* b = new TGeoBBox("b", 7., 7., shift); // cm 0.13
// create a composite for pipe4
//*
TGeoCompositeShape *cs1 = new TGeoCompositeShape("cs1", "p4:r1-b");
TGeoVolume *pipe4 = new TGeoVolume("pipe4",cs1, pipeMedium);
pipe4->SetLineColor(kGreen+2);
pipe->AddNode(pipe4, 0, t1);
//*/
// create shape components for pipevac3
TGeoPcon* p03 = MakeShape(nSects03, "p03", z03, rin03, rout03, &infoFileEmpty);
// create a composite for pipevac3
TGeoCompositeShape *cs2 = new TGeoCompositeShape("cs2", "p03:r1-b");
TGeoVolume *pipevac3 = new TGeoVolume("pipevac3",cs2, vacuum);
pipevac3->SetLineColor(kCyan);
pipe->AddNode(pipevac3, 0, t1);
//*
infoFile << endl << "Beam pipe section: " << pipe5name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
TGeoVolume* pipe5 = MakePipe (5, nSects5, z5, rin5, rout5, pipeMedium, &infoFile);
pipe5->SetLineColor(kGreen);
pipe->AddNode(pipe5, 0, c1);
TGeoVolume* pipevac4 = MakeVacuum(4, nSects04, z04, rin04, rout04, vacuum, &infoFile);
pipevac4->SetLineColor(kCyan);
pipe->AddNode(pipevac4, 0, c1);
infoFile << endl << "Beam pipe section: " << pipe6name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
TGeoVolume* pipe6 = MakePipe (6, nSects6, z6, rin6, rout6, pipeMedium, &infoFile);
pipe6->SetLineColor(kBlue);
pipe->AddNode(pipe6, 0, c1);
infoFile << endl << "Beam pipe section: " << pipe7name << endl;
infoFile << "Traslation(dx,dy,dz): "<< dx <<" "<< dy <<" "<< dz <<" mm" << endl;
infoFile << "Rotation(phi,theta,psi): " << phi <<" "<< theta <<" "<< psi <<" deg"<< endl;
infoFile << setw(2) << "i" << setw(10) << "Z,mm" << setw(10) << "Rin,mm" << setw(10) << "Rout,mm" << setw(10) << "h,mm" << endl;
TGeoVolume* pipe7 = MakePipe (7, nSects7, z7, rin7, rout7, pipeMedium, &infoFile);
pipe7->SetLineColor(kGreen);
pipe->AddNode(pipe7, 0, c1);
TGeoVolume* pipevac5 = MakeVacuum(5, nSects05, z05, rin05, rout05, vacuum, &infoFile);
pipevac5->SetLineColor(kCyan);
pipe->AddNode(pipevac5, 0, c1);
//*/
// ----- End --------------------------------------------------
// --------------- Finish -----------------------------------------------
top->AddNode(pipe, 1);
cout << endl << endl;
gGeoMan->CloseGeometry();
gGeoMan->CheckOverlaps(0.001);
gGeoMan->PrintOverlaps();
gGeoMan->Test();
// visualize it with ray tracing, OGL/X3D viewer
//top->Raytrace();
top->Draw("ogl");
//top->Draw("x3d");
TFile* rootFile = new TFile(rootFileName, "RECREATE");
top->Write();
cout << endl;
cout << "Geometry " << top->GetName() << " written to "
<< rootFileName << endl;
rootFile->Close();
infoFile.close();
}
示例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);
}