Belle II Software development
pent_t Struct Referenceabstract

pentagon shape More...

Inheritance diagram for pent_t:
shape_t

Public Member Functions

void adjust ()
 adjust sizes to have flat sides
 
bool istrap () const override
 is trapped?
 
map< int, G4ThreeVector > make_verticies (double wrapthick) const
 create map of vertices
 
G4VSolid * get_tesselatedsolid (const string &prefix, double wrapthick, G4Translate3D &shift UNUSED) const override
 get tessellated solid
 
G4VSolid * get_extrudedsolid (const string &prefix, double wrapthick, G4Translate3D &shift UNUSED) const override
 get extruded solid
 
G4VSolid * get_trapezoid (const string &prefix, double wrapthick, G4Translate3D &shift) const override
 get trapezoid
 
G4VSolid * get_bellecrystal (const string &prefix, double wrapthick, G4Translate3D &shift UNUSED) const override
 get Belle crystal
 
G4VSolid * get_solid (const std::string &prefix, double wrapthick, G4Translate3D &shift) const
 get solid
 
virtual G4VSolid * get_tesselatedsolid (const std::string &prefix, double wrapthick, G4Translate3D &shift) const =0
 get tessellated solid
 
virtual G4VSolid * get_extrudedsolid (const std::string &prefix, double wrapthick, G4Translate3D &shift) const =0
 get extruded solid
 
virtual G4VSolid * get_bellecrystal (const std::string &prefix, double wrapthick, G4Translate3D &shift) const =0
 get Belle crystal
 

Public Attributes

union { 
 
   struct { 
 
      double   A 
 
      double   C 
 
      double   D 
 
      double   a 
 
      double   c 
 
      double   d 
 
      double   B 
 
      double   b 
 
      double   H_aA 
 
      double   H_dD 
 
      double   dg13 
 
      double   dg24 
 
      double   dg57 
 
      double   dg68 
 
      double   a1 
 
      double   a4 
 
      double   a2 
 
      double   a3 
 
      double   a9 
 
      double   Volume 
 
      double   Weight 
 
   }  
 
   double   t [21] = {} 
 
};  
 
bool _adjusted
 are sizes adjusted?
 
int nshape
 shapes
 

Detailed Description

pentagon shape

Definition at line 421 of file shapes.cc.

Constructor & Destructor Documentation

◆ pent_t()

pent_t ( )
inline

Definition at line 429 of file shapes.cc.

429: _adjusted(false) {}

◆ ~pent_t()

virtual ~pent_t ( )
inlineoverridevirtual

Definition at line 430 of file shapes.cc.

430{}

Member Function Documentation

◆ adjust()

void adjust ( )
inline

adjust sizes to have flat sides

Definition at line 433 of file shapes.cc.

434 {
435 if (!_adjusted) {
436 // adjust sizes to have flat sides
437 H_dD -= 0.00005551197484235;
438 B += 0.0011245236213532729;
439 b += -0.00044853029662963;
440 _adjusted = true;
441 }
442 }

◆ get_bellecrystal()

G4VSolid * get_bellecrystal ( const string & prefix,
double wrapthick,
G4Translate3D &shift UNUSED ) const
inlineoverride

get Belle crystal

Definition at line 613 of file shapes.cc.

614 {
615 map<int, G4ThreeVector> v = make_verticies(wrapthick);
616
617 string name(prefix);
618 name += to_string(nshape);
619
620 G4ThreeVector pt[10];
621 pt[0] = v[1];
622 pt[1] = v[2];
623 pt[2] = v[9];
624 pt[3] = v[3];
625 pt[4] = v[4];
626 pt[5] = v[5];
627 pt[6] = v[6];
628 pt[7] = v[10];
629 pt[8] = v[7];
630 pt[9] = v[8];
631
632 G4VSolid* shape = new BelleCrystal(name.c_str(), 5, pt);
633 // cout<<name<<" "<<shape->GetCubicVolume()*1e-3<<" "<<Volume<<endl;
634 // for(int i=0;i<100000;i++){
635 // G4ThreeVector a = shape->GetPointOnSurface();
636 // cout<<a.x()<<" "<<a.y()<<" "<<a.z()<<endl;
637 // }
638 // exit(0);
639 // if(prefix.find("crystal")!=string::npos){
640 // pentspeed(shape);
641 // exit(0);
642 // }
643 // if(prefix.find("wrap")!=string::npos){
644 // pentspeed2(shape);
645 // exit(0);
646 // }
647 return shape;
648 }

◆ get_extrudedsolid()

G4VSolid * get_extrudedsolid ( const string & prefix,
double wrapthick,
G4Translate3D &shift UNUSED ) const
inlineoverride

get extruded solid

Definition at line 517 of file shapes.cc.

518 {
519 map<int, G4ThreeVector> v = make_verticies(wrapthick);
520
521 string name(prefix);
522 name += to_string(nshape);
523
524 std::vector<G4TwoVector> p1, p2;
525 p1.push_back(G4TwoVector(v[1].x(), v[1].y()));
526 p1.push_back(G4TwoVector(v[2].x(), v[2].y()));
527 p1.push_back(G4TwoVector(v[9].x(), v[9].y()));
528 p1.push_back(G4TwoVector(v[3].x(), v[3].y()));
529 p1.push_back(G4TwoVector(v[4].x(), v[4].y()));
530
531 p2.push_back(G4TwoVector(v[1 + 4].x(), v[1 + 4].y()));
532 p2.push_back(G4TwoVector(v[2 + 4].x(), v[2 + 4].y()));
533 p2.push_back(G4TwoVector(v[ 10].x(), v[ 10].y()));
534 p2.push_back(G4TwoVector(v[3 + 4].x(), v[3 + 4].y()));
535 p2.push_back(G4TwoVector(v[4 + 4].x(), v[4 + 4].y()));
536
537 double sum = 0, smin = 1e9, smax = -1e9;
538 int count = 0;
539 for (int i = 0; i < 5; i++) {
540 for (int j = i + 1; j < 5; j++) {
541 double s2 = (p2[j] - p2[i]).mag2() / (p1[j] - p1[i]).mag2();
542 double s = sqrt(s2);
543 sum += s;
544 if (s > smax) smax = s;
545 if (s < smin) smin = s;
546 count++;
547 }
548 }
549 double ave = sum / count;
550
551 double scale = ave;
552 G4TwoVector off1(0, 0), off2(scale * p1[0].x() - p2[0].x(), scale * p1[0].y() - p2[0].y());
553
554 return new G4ExtrudedSolid(name, p1, abs(v[1].z()), off1, 1, -off2, scale);
555 }
double sqrt(double a)
sqrt for double
Definition beamHelpers.h:28

◆ get_solid()

G4VSolid * get_solid ( const std::string & prefix,
double wrapthick,
G4Translate3D & shift ) const
inherited

get solid

Definition at line 78 of file shapes.cc.

79 {
80 return get_bellecrystal(prefix, wrapthick, shift);
81 }

◆ get_tesselatedsolid()

G4VSolid * get_tesselatedsolid ( const string & prefix,
double wrapthick,
G4Translate3D &shift UNUSED ) const
inlineoverride

get tessellated solid

Definition at line 485 of file shapes.cc.

486 {
487 if (nshape != 36) return nullptr; // only one crystal has pentagon shape
488
489 map<int, G4ThreeVector> v = make_verticies(wrapthick);
490
491 string name(prefix);
492 name += to_string(nshape);
493 G4TessellatedSolid* s = new G4TessellatedSolid(name.c_str());
494
495 // Now add the facets to the solid
496 // top plane
497 s->AddFacet(new G4QuadrangularFacet(v[1], v[4], v[3], v[2], ABSOLUTE));
498 s->AddFacet(new G4TriangularFacet(v[2], v[3], v[9], ABSOLUTE));
499
500 //bottom plane
501 s->AddFacet(new G4QuadrangularFacet(v[5], v[6], v[7], v[8], ABSOLUTE));
502 s->AddFacet(new G4TriangularFacet(v[6], v[10], v[7], ABSOLUTE));
503
504 //sides
505 s->AddFacet(new G4QuadrangularFacet(v[1], v[2], v[6], v[5], ABSOLUTE));
506 s->AddFacet(new G4QuadrangularFacet(v[2], v[9], v[10], v[6], ABSOLUTE));
507 s->AddFacet(new G4QuadrangularFacet(v[9], v[3], v[7], v[10], ABSOLUTE));
508 s->AddFacet(new G4QuadrangularFacet(v[3], v[4], v[8], v[7], ABSOLUTE));
509 s->AddFacet(new G4QuadrangularFacet(v[4], v[1], v[5], v[8], ABSOLUTE));
510
511 // Finally declare the solid is complete
512 s->SetSolidClosed(true);
513 return s;
514 }

◆ get_trapezoid()

G4VSolid * get_trapezoid ( const string & prefix,
double wrapthick,
G4Translate3D & shift ) const
inlineoverridevirtual

get trapezoid

Implements shape_t.

Definition at line 558 of file shapes.cc.

559 {
560 if (nshape != 36) return nullptr; // only one crystal has pentagon shape
561
562 map<int, G4ThreeVector> v = make_verticies(wrapthick);
563
564 string name(prefix);
565 name += to_string(nshape);
566
567 G4ThreeVector pt[8];
568 pt[0] = v[4];
569 pt[1] = v[1];
570 pt[2] = v[3];
571 pt[3] = v[2];
572 pt[4] = v[8];
573 pt[5] = v[5];
574 pt[6] = v[7];
575 pt[7] = v[6];
576
577 auto alignz = [&](int i, int j) {pt[j].setZ(pt[i].z());};
578 auto aligny = [&](int i, int j) {pt[j].setY(pt[i].y());};
579
580 alignz(0, 1);
581 alignz(0, 2);
582 alignz(0, 3);
583
584 alignz(4, 1 + 4);
585 alignz(4, 2 + 4);
586 alignz(4, 3 + 4);
587
588 aligny(0, 1);
589 aligny(2, 3);
590
591 aligny(4, 5);
592 aligny(6, 7);
593
594
595 double dx = pt[0].x() + pt[1].x() + pt[4].x() + pt[5].x() + pt[2].x() + pt[3].x() + pt[6].x() + pt[7].x();
596 dx /= 8;
597 double dy = pt[0].y() + pt[2].y() + pt[4].y() + pt[6].y();
598 dy /= 4;
599 for (int j = 0; j < 8; j++) {
600 pt[j].setX(pt[j].x() - dx);
601 pt[j].setY(pt[j].y() - dy);
602 }
603 shift = G4Translate3D(dx, dy, 0);
604
605 // cout<<name<<" "<<dx<<" "<<dy<<endl;
606
607 G4VSolid* shape = new G4Trap(name.c_str(), pt);
608 // G4VSolid *shape = new BelleCrystal(name.c_str(), 4, pt);
609 return shape;
610 }

◆ istrap()

bool istrap ( ) const
inlineoverridevirtual

is trapped?

Implements shape_t.

Definition at line 445 of file shapes.cc.

445{ return false;}

◆ make_verticies()

map< int, G4ThreeVector > make_verticies ( double wrapthick) const
inline

create map of vertices

Definition at line 448 of file shapes.cc.

449 {
450 assert(_adjusted);
451
452 double h2 = cosd(a1 - 90) * D / 2;
453 map<int, G4ThreeVector> v;
454 v[5] = G4ThreeVector(-A / 2, -h2, -150);
455 v[6] = v[5] + moveto(D, a1);
456 v[10] = v[6] + moveto(B, a1 + a2 - 180);
457 v[8] = G4ThreeVector(A / 2, -h2, -150);
458 v[7] = v[8] + moveto(D, 180 - a1);
459
460 v[1] = v[5] + G4ThreeVector((H_aA * cosd(a1) + H_dD) / sind(a1), H_aA, 300);
461 v[2] = v[1] + moveto(d, a1);
462 v[9] = v[2] + moveto(b, a1 + a2 - 180);
463 v[4] = v[1] + moveto(a, 0);
464 v[3] = v[4] + moveto(d, 180 - a1);
465
466 for (int j = 1; j <= 10; j++) v[j] = G4ThreeVector(v[j].x(), -v[j].y(), -v[j].z());
467 if (wrapthick != 0) {
468 map<int, G4ThreeVector> nv;
469 nv[ 1] = newvertex(wrapthick, v[1], v[5], v[2], v[4]);
470 nv[ 2] = newvertex(wrapthick, v[2], v[6], v[9], v[1]);
471 nv[ 9] = newvertex(wrapthick, v[9], v[10], v[3], v[2]);
472 nv[ 3] = newvertex(wrapthick, v[3], v[7], v[4], v[9]);
473 nv[ 4] = newvertex(wrapthick, v[4], v[8], v[1], v[3]);
474 nv[ 5] = newvertex(wrapthick, v[5], v[1], v[8], v[6]);
475 nv[ 6] = newvertex(wrapthick, v[6], v[2], v[5], v[10]);
476 nv[10] = newvertex(wrapthick, v[10], v[9], v[6], v[7]);
477 nv[ 7] = newvertex(wrapthick, v[7], v[3], v[10], v[8]);
478 nv[ 8] = newvertex(wrapthick, v[8], v[4], v[7], v[5]);
479 std::swap(nv, v);
480 }
481 return v;
482 }

Member Data Documentation

◆ _adjusted

bool _adjusted

are sizes adjusted?

Definition at line 428 of file shapes.cc.

◆ A

double A

Definition at line 424 of file shapes.cc.

◆ a

double a

Definition at line 424 of file shapes.cc.

◆ a1

double a1

Definition at line 424 of file shapes.cc.

◆ a2

double a2

Definition at line 424 of file shapes.cc.

◆ a3

double a3

Definition at line 424 of file shapes.cc.

◆ a4

double a4

Definition at line 424 of file shapes.cc.

◆ a9

double a9

Definition at line 424 of file shapes.cc.

◆ B

double B

Definition at line 424 of file shapes.cc.

◆ b

double b

Definition at line 424 of file shapes.cc.

◆ C

double C

Definition at line 424 of file shapes.cc.

◆ c

double c

Definition at line 424 of file shapes.cc.

◆ D

double D

Definition at line 424 of file shapes.cc.

◆ d

double d

Definition at line 424 of file shapes.cc.

◆ dg13

double dg13

Definition at line 424 of file shapes.cc.

◆ dg24

double dg24

Definition at line 424 of file shapes.cc.

◆ dg57

double dg57

Definition at line 424 of file shapes.cc.

◆ dg68

double dg68

Definition at line 424 of file shapes.cc.

◆ H_aA

double H_aA

Definition at line 424 of file shapes.cc.

◆ H_dD

double H_dD

Definition at line 424 of file shapes.cc.

◆ nshape

int nshape
inherited

shapes

Definition at line 30 of file shapes.h.

◆ t

double t[21] = {}

Definition at line 426 of file shapes.cc.

426{};

◆ Volume

double Volume

Definition at line 424 of file shapes.cc.

◆ Weight

double Weight

Definition at line 424 of file shapes.cc.


The documentation for this struct was generated from the following file: