예제 #1
0
int main(int argc, char* argv[]) {
  OPTION_INT(npoints,1024);
  OPTION_INT(nrep,1024);
  OPTION_DOUBLE(dx1,3.);
  OPTION_DOUBLE(dx2,4.);
  OPTION_DOUBLE(dy1,5.);
  OPTION_DOUBLE(dy2,6.);
  OPTION_DOUBLE(dz,7.);

  UnplacedBox worldUnplaced = UnplacedBox(dmax(dx1, dx2)*4, dmax(dy1, dy2)*4, dz*4);
  UnplacedTrd trdUnplaced = UnplacedTrd(dx1, dx2, dy1, dy2, dz);

  LogicalVolume world = LogicalVolume("world", &worldUnplaced);
  LogicalVolume trd = LogicalVolume("trdLogicalVolume", &trdUnplaced);
  Transformation3D placement(5., 5., 5.);
  world.PlaceDaughter("trdPlaced", &trd, &placement);


  VPlacedVolume *worldPlaced = world.Place();

  GeoManager::Instance().SetWorld(worldPlaced);

  Benchmarker tester(GeoManager::Instance().GetWorld());
  tester.SetVerbosity(3);
  tester.SetRepetitions(nrep);
  tester.SetPointCount(npoints);
  tester.SetPoolMultiplier(1);
  tester.RunBenchmark();
}
예제 #2
0
int main(int argc, char* argv[]) {
  OPTION_INT(npoints,1024);
  OPTION_INT(nrep,1024);
  OPTION_DOUBLE(dx,20.);
  OPTION_DOUBLE(dy,30.);
  OPTION_DOUBLE(dz,40.);
  OPTION_DOUBLE(alpha,30./180.*kPi);
  OPTION_DOUBLE(theta,15./180.*kPi);
  OPTION_DOUBLE(phi,30./180.*kPi);

  UnplacedBox worldUnplaced = UnplacedBox(dx*4, dy*4, dz*4);
  UnplacedParallelepiped paraUnplaced(dx, dy, dz, alpha, theta, phi);
  // UnplacedParallelepiped paraUnplaced(3., 3., 3., 14.9, 39, 3.22);
  LogicalVolume world = LogicalVolume("w0rld", &worldUnplaced);
  LogicalVolume para = LogicalVolume("p4r4", &paraUnplaced);
  Transformation3D placement = Transformation3D(5, 5, 5);
  world.PlaceDaughter(&para, &placement);

  VPlacedVolume *worldPlaced = world.Place();

  GeoManager::Instance().SetWorld(worldPlaced);

  Benchmarker tester(GeoManager::Instance().GetWorld());
  tester.SetVerbosity(3);
  tester.SetRepetitions(nrep);
  tester.SetPointCount(npoints);
  tester.RunBenchmark();

  return 0;
}
int main(int argc, char* argv[]) {
    OPTION_INT(npoints,1024);
    OPTION_INT(nrep,1024);
    OPTION_DOUBLE(rlo,3.);
    OPTION_DOUBLE(rhi,5.);
    OPTION_DOUBLE(dz,7.);
    
    std::cout<<"Paraboloid Benchmark\n";
    //UnplacedBox worldUnplaced = UnplacedBox(10., 10., 10.);
    // UnplacedParaboloid paraboloidUnplaced = UnplacedParaboloid(3., 5., 7.); //rlo=3. - rhi=5. dz=7
    UnplacedBox worldUnplaced = UnplacedBox(rhi*4, rhi*4, dz * 4);
    UnplacedParaboloid paraboloidUnplaced = UnplacedParaboloid(rlo, rhi, dz); //rlo=3. - rhi=5. dz=7
    std::cout<<"Paraboloid created\n";
    LogicalVolume world = LogicalVolume("MBworld", &worldUnplaced);
    LogicalVolume paraboloid = LogicalVolume("paraboloid", &paraboloidUnplaced);
    world.PlaceDaughter(&paraboloid, &Transformation3D::kIdentity);
    VPlacedVolume *worldPlaced = world.Place();
    GeoManager::Instance().SetWorld(worldPlaced);
    std::cout<<"World set\n";
    
    
    Benchmarker tester(GeoManager::Instance().GetWorld());
    tester.SetVerbosity(3);
    tester.SetPointCount(npoints);
    tester.SetRepetitions(nrep);
    std::cout<<"Prepared to run benchmarker\n";
    tester.RunBenchmark();
    
    return 0;
}
예제 #4
0
int main()
{
    UnplacedBox worldUnplaced(10.,10.,10.);
    LogicalVolume world = LogicalVolume("world", &worldUnplaced);

    // components for boolean solid
    UnplacedBox motherbox(5.,5.,5.);
    UnplacedBox subtractedbox(2.,2.,2);
    // translation for boolean solid right shape
    Transformation3D translation(-2.5,0,0);


    VPlacedVolume *worldPlaced = world.Place();
    GeoManager::Instance().SetWorld(worldPlaced);


    // now create a specialized box by hand (instead of the factory)
    // we know that it is only translated
    typedef SpecializedBox<translation::kIdentity, rotation::kIdentity> OriginBox_t;
    typedef SpecializedBox<translation::kGeneric, rotation::kIdentity> TranslatedBox_t;

    TranslatedBox_t const * placedsubtractedbox = new TranslatedBox_t(new LogicalVolume("",&subtractedbox), &translation);

    // now create a specialized box by hand (instead of the factory)
    // we know that it is only translated
    OriginBox_t const * placedmotherbox = new OriginBox_t(new LogicalVolume("",&motherbox), &Transformation3D::kIdentity);

    // now make the unplaced boolean solid
    BoxMinusBox_t booleansolid(placedmotherbox, placedsubtractedbox);
    LogicalVolume booleanlogical("booleanL",&booleansolid);
    // placement of boolean solid
    Transformation3D placement(5, 5, 5);

    // make a special solid by hand ( need to sort out factory later )
    SpecializedVol_t * sp = new SpecializedVol_t("booleanspecialized", &booleanlogical, &placement );
    //booleansolid.CreateSpecializedVolume()
    //world.PlaceDaughter("boolean", &booleanlogical, &placement);

    // add this boolean solid to the world
    world.PlaceDaughter( sp );

    Benchmarker tester(GeoManager::Instance().GetWorld());
    tester.SetVerbosity(3);
    tester.SetPoolMultiplier(1);
    tester.SetRepetitions(1024);
    tester.SetPointCount(1<<10);
    tester.RunInsideBenchmark();
    tester.RunToOutBenchmark();

    return 0;

}
예제 #5
0
int main() {

  // Vector3D<Precision> vec1(5, 3, 1);
  // Vector3D<Precision> vec2(2, 8, 0);
  // std::cout << (vec1 < vec2) << "\n";

  UnplacedBox world_params = UnplacedBox(4., 4., 4.);
  UnplacedBox largebox_params = UnplacedBox(1.5, 1.5, 1.5);
  UnplacedBox smallbox_params = UnplacedBox(0.5, 0.5, 0.5);

  LogicalVolume worldl = LogicalVolume(&world_params);

  LogicalVolume largebox = LogicalVolume("Large box", &largebox_params);
  LogicalVolume smallbox = LogicalVolume("Small box", &smallbox_params);

  Transformation3D origin = Transformation3D();
  Transformation3D placement1 = Transformation3D( 2,  2,  2);
  Transformation3D placement2 = Transformation3D(-2,  2,  2);
  Transformation3D placement3 = Transformation3D( 2, -2,  2);
  Transformation3D placement4 = Transformation3D( 2,  2, -2);
  Transformation3D placement5 = Transformation3D(-2, -2,  2);
  Transformation3D placement6 = Transformation3D(-2,  2, -2);
  Transformation3D placement7 = Transformation3D( 2, -2, -2);
  Transformation3D placement8 = Transformation3D(-2, -2, -2);

  largebox.PlaceDaughter(&smallbox, &origin);
  worldl.PlaceDaughter(&largebox, &placement1);
  worldl.PlaceDaughter(&largebox, &placement2);
  worldl.PlaceDaughter(&largebox, &placement3);
  worldl.PlaceDaughter(&largebox, &placement4);
  worldl.PlaceDaughter("Hello the world!", &largebox, &placement5);
  worldl.PlaceDaughter(&largebox, &placement6);
  worldl.PlaceDaughter(&largebox, &placement7);
  worldl.PlaceDaughter(&largebox, &placement8);

  VPlacedVolume *world_placed = worldl.Place();

  std::cerr << "Printing world content:\n";
  world_placed->PrintContent();

  SimpleNavigator nav;
  Vector3D<Precision> point(2, 2, 2);
  NavigationState * path = NavigationState::MakeInstance(4);
  nav.LocatePoint(world_placed, point, *path, true);
  path->Print();

  GeoManager::Instance().FindLogicalVolume("Large box");
  GeoManager::Instance().FindPlacedVolume("Large box");

  return 0;
}
예제 #6
0
VPlacedVolume *SetupGeometry()
{

  UnplacedBox *worldUnplaced      = new UnplacedBox(10, 10, 10);
  UnplacedTrapezoid *trapUnplaced = new UnplacedTrapezoid(4, 0, 0, 4, 4, 4, 0, 4, 4, 4, 0);
  UnplacedBox *boxUnplaced        = new UnplacedBox(2.5, 2.5, 2.5);
  UnplacedOrb *orbUnplaced        = new UnplacedOrb(2.8);

  LogicalVolume *world = new LogicalVolume("world", worldUnplaced);
  LogicalVolume *trap  = new LogicalVolume("trap", trapUnplaced);
  LogicalVolume *box   = new LogicalVolume("box", boxUnplaced);
  LogicalVolume *orb   = new LogicalVolume("orb", orbUnplaced);

  Transformation3D *ident = new Transformation3D(0, 0, 0, 0, 0, 0);
  orb->PlaceDaughter("orb1", box, ident);
  trap->PlaceDaughter("box1", orb, ident);

  Transformation3D *placement1 = new Transformation3D(5, 5, 5, 0, 0, 0);
  Transformation3D *placement2 = new Transformation3D(-5, 5, 5, 0, 0, 0);   // 45,  0,  0);
  Transformation3D *placement3 = new Transformation3D(5, -5, 5, 0, 0, 0);   // 0, 45,  0);
  Transformation3D *placement4 = new Transformation3D(5, 5, -5, 0, 0, 0);   // 0,  0, 45);
  Transformation3D *placement5 = new Transformation3D(-5, -5, 5, 0, 0, 0);  // 45, 45,  0);
  Transformation3D *placement6 = new Transformation3D(-5, 5, -5, 0, 0, 0);  // 45,  0, 45);
  Transformation3D *placement7 = new Transformation3D(5, -5, -5, 0, 0, 0);  // 0, 45, 45);
  Transformation3D *placement8 = new Transformation3D(-5, -5, -5, 0, 0, 0); // 45, 45, 45);

  world->PlaceDaughter("trap1", trap, placement1);
  world->PlaceDaughter("trap2", trap, placement2);
  world->PlaceDaughter("trap3", trap, placement3);
  world->PlaceDaughter("trap4", trap, placement4);
  world->PlaceDaughter("trap5", trap, placement5);
  world->PlaceDaughter("trap6", trap, placement6);
  world->PlaceDaughter("trap7", trap, placement7);
  world->PlaceDaughter("trap8", trap, placement8);

  VPlacedVolume *w = world->Place();
  GeoManager::Instance().SetWorld(w);
  GeoManager::Instance().CloseGeometry();
  return w;
}