本文整理汇总了C++中TGeoVolume::GetVoxels方法的典型用法代码示例。如果您正苦于以下问题:C++ TGeoVolume::GetVoxels方法的具体用法?C++ TGeoVolume::GetVoxels怎么用?C++ TGeoVolume::GetVoxels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TGeoVolume
的用法示例。
在下文中一共展示了TGeoVolume::GetVoxels方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteROOTVoxels
void DeleteROOTVoxels()
{
std::cout << " IN DELETE VOXEL METHOD \n";
int counter=0;
TObjArray * volist = gGeoManager->GetListOfVolumes();
std::cout << " entries " << volist->GetEntries() << "\n";
for(int i=0;i<volist->GetEntries();++i)
{
TGeoVolume *vol = (TGeoVolume *) volist->At(i);
if ( vol!=NULL && vol->GetVoxels()!=0 )
{
counter++;
delete vol->GetVoxels();
vol->SetVoxelFinder(0);
}
}
std::cout << " deleted " << counter << " Voxels \n";
}
示例2: main
int main(int argc, char * argv[])
{
// generate benchmark cases
TransformationMatrix const * identity = new TransformationMatrix(0,0,0,0,0,0);
double L = 10.;
double Lz = 10.;
const double Sqrt2 = sqrt(2.);
TGeoManager * geom = new TGeoManager("simple1", "ToyDetector");
TGeoMaterial * matVacuum = new TGeoMaterial("Vacuum",0,0,0);
TGeoMedium * vac = new TGeoMedium("Vacuum",1,matVacuum);
TGeoVolume * world = geom->MakeBox("world", vac, L, L, Lz );
geom->SetTopVolume( world );
TGeoVolume * boxlevel2 = geom->MakeBox( "boxlevel2", vac, Sqrt2*L/2./2., Sqrt2*L/2./2.,Lz);
TGeoVolume * boxlevel3 = geom->MakeBox( "boxlevel3", vac, L/2./2.,L/2./2.,Lz);
TGeoVolume * boxlevel1 = geom->MakeBox( "boxlevel1", vac, L/2.,L/2., Lz);
boxlevel2->AddNode( boxlevel3, 1, new TGeoRotation("mat1",0,0,-45));
boxlevel1->AddNode( boxlevel2, 1, new TGeoRotation("mat2",0,0,45));
world->AddNode( boxlevel1, 1, new TGeoTranslation("trans1",-L/2., 0,0 ) );
world->AddNode( boxlevel1, 2, new TGeoTranslation("trans2",L/2., 0,0 ) );
geom->CloseGeometry();
delete world->GetVoxels();
world->SetVoxelFinder(0);
// perform basic tests
TGeoNavigator * nav = geom->GetCurrentNavigator(); // new TGeoNavigator(geom);
StopWatch timer;
timer.Start();
int stepsdone=0;
for(int n=0;n<1000;n++)
{
for(int i=0;i<100000;i++)
// testing the NavigationAndStepInterface
{
int localstepsdone=0;
double distancetravelled=0.;
Vector3D p;
PhysicalVolume::samplePoint( p, L, L, Lz, 1. );
//std::cerr << p << std::endl;
//setup point in world
Vector3D d(1,0,0);
TGeoNode const * vol;
nav->SetCurrentPoint( p.x, p.y, p.z );
nav->SetCurrentDirection( d.x, d.y, d.z);
vol=nav->FindNode(p.x,p.y,p.z);
while( vol!=NULL )
{
localstepsdone++;
// do one step ( this will internally adjust the current point and so on )
vol = nav->FindNextBoundaryAndStep(Utils::kInfinity);
distancetravelled+=nav->GetStep();
//double const * p = nav->GetCurrentPoint();
//double const * pl = nav->GetLastPoint();
//double const * cd = nav->GetCurrentDirection();
//std::cerr << " proposed step: " << nav->GetStep();
//std::cerr << " current point " << p[0] << " " << p[1] << " " << p[2] << std::endl;
//std::cerr << " last point " << pl[0] << " " << pl[1] << " " << pl[2] << std::endl;
//std::cerr << " current dir " << cd[0] << " " << cd[1] << " " << cd[2] << std::endl;
}
// std::cerr << localstepsdone << " " << distancetravelled << std::endl;
stepsdone+=localstepsdone;
}
}
timer.Stop();
std::cout << " time for 100000 particles " << timer.getDeltaSecs( ) << std::endl;
std::cout << " average steps done " << stepsdone / 100000. << std::endl;
std::cout << " time per step " << timer.getDeltaSecs()/stepsdone << std::endl;
}