4 #include "G4Ellipsoid.hh" 5 #include "G4IntersectionSolid.hh" 6 #include "G4NistManager.hh" 8 #include "G4Polycone.hh" 9 #include "G4Polyhedra.hh" 14 #include "G4CutTubs.hh" 15 #include "G4EllipticalTube.hh" 16 #include "G4Paraboloid.hh" 18 #include "G4Sphere.hh" 19 #include "G4GenericTrap.hh" 20 #include "G4SubtractionSolid.hh" 21 #include "G4UnionSolid.hh" 22 #include "G4IntersectionSolid.hh" 23 #include "G4PVReplica.hh" 24 #include "G4UnitsTable.hh" 25 #include "G4RotationMatrix.hh" 26 #include "G4TwoVector.hh" 37 #include "CLHEP/Units/PhysicalConstants.h" 38 using namespace CLHEP;
50 if(SolidV)
delete SolidV;
52 string hd_msg = gemcOpt.
optMap[
"LOG_MSG"].args +
" Solid: >> ";
53 double VERB = gemcOpt.
optMap[
"G4P_VERBOSITY"].arg ;
54 string catch_v = gemcOpt.
optMap[
"CATCH"].args;
56 if(type.find(
"ReplicaOf") != string::npos)
58 if(VERB>4 || name.find(catch_v) != string::npos)
59 cout << hd_msg <<
" " << name <<
" is a Replica. Solid Volume will not be built." << endl;
68 if(dimensions.size() != 3)
70 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
71 <<
" is " << dimensions.size() <<
":" << endl;
72 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
73 cout <<
" This does not match a G4Box. Exiting" << endl << endl;
78 for(
unsigned int i=0; i<dimensions.size(); i++)
79 if(dimensions[i] == 0)
80 cout <<
" !!! Warning: BOX has one side null!" << endl;
82 SolidV =
new G4Box(name,
93 if(type ==
"Parallelepiped")
95 if(dimensions.size() != 6)
97 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
98 <<
" is " << dimensions.size() <<
":" << endl;
99 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
100 cout <<
" This does not match a G4Para. Exiting" << endl << endl;
104 SolidV =
new G4Para(name,
121 if(dimensions.size() != 6)
123 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
124 <<
" is " << dimensions.size() <<
":" << endl;
125 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
126 cout <<
" This does not match a G4Sphere. Exiting." << endl << endl;
130 SolidV =
new G4Sphere(name,
145 if(type ==
"Ellipsoid")
147 if(dimensions.size() != 5)
149 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
150 <<
" is " << dimensions.size() <<
":" << endl;
151 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
152 cout <<
" This does not match a G4Ellipsoid. Exiting." << endl << endl;
156 SolidV =
new G4Ellipsoid(name,
169 if(type ==
"Paraboloid")
171 if(dimensions.size() != 3)
173 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
174 <<
" is " << dimensions.size() <<
":" << endl;
175 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
176 cout <<
" This does not match a G4Paraboloid. Exiting." << endl << endl;
180 SolidV =
new G4Paraboloid(name,
194 if(dimensions.size() != 5)
196 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
197 <<
" is " << dimensions.size() <<
":" << endl;
198 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
199 cout <<
" This does not match a G4Hype. Exiting." << endl << endl;
203 SolidV =
new G4Hype(name,
220 if(dimensions.size() != 5)
222 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
223 <<
" is " << dimensions.size() <<
":" << endl;
224 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
225 cout <<
" This does not match a G4Tubs. Exiting" << endl << endl;
229 SolidV =
new G4Tubs(name,
244 if(dimensions.size() != 11)
246 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
247 <<
" is " << dimensions.size() <<
":" << endl;
248 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
249 cout <<
" This does not match a G4CutTubs. Exiting" << endl << endl;
253 SolidV =
new G4CutTubs(name,
259 G4ThreeVector(dimensions[5], dimensions[6], dimensions[7]),
260 G4ThreeVector(dimensions[8], dimensions[9], dimensions[10]));
268 if(type ==
"EllipticalTube" || type ==
"Eltu")
270 if(dimensions.size() != 3)
272 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
273 <<
" is " << dimensions.size() <<
":" << endl;
274 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
275 cout <<
" This does not match a G4ElipticalTube. Exiting" << endl << endl;
279 SolidV =
new G4EllipticalTube(name,
294 if(dimensions.size() != 7)
296 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
297 <<
" is " << dimensions.size() <<
":" << endl;
298 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
299 cout <<
" This does not match a G4Cons. Exiting" << endl << endl;
303 SolidV =
new G4Cons(name,
320 if(dimensions.size() != 5)
322 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
323 <<
" is " << dimensions.size() <<
":" << endl;
324 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
325 cout <<
" This does not match a G4Torus. Exiting" << endl << endl;
328 SolidV =
new G4Torus(name,
345 if(dimensions.size() != 5)
347 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
348 <<
" is " << dimensions.size() <<
":" << endl;
349 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
350 cout <<
" This does not match a G4Trd. Exiting" << endl << endl;
353 SolidV =
new G4Trd(name,
368 if(dimensions.size() != 7)
370 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
371 <<
" is " << dimensions.size() <<
":" << endl;
372 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
373 cout <<
" This does not match a ITrd. Exiting" << endl << endl;
377 double alph_xz = dimensions[5];
378 double alph_yz = dimensions[6];
379 double x = tan(alph_xz);
380 double y = tan(alph_yz);
381 double r = sqrt(x*x + y*y);
384 double pDz = dimensions[4];
385 double pTheta = atan2(r, 1);
386 double pPhi = atan2(y, x);
387 double pDy1 = dimensions[2];
388 double pDx1 = dimensions[0];
391 double pDy2 = dimensions[3];
392 double pDx3 = dimensions[1];
396 SolidV =
new G4Trap(name,
418 if(dimensions.size() != 11)
420 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
421 <<
" is " << dimensions.size() <<
":" << endl;
422 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
423 cout <<
" This does not match a G4Trd. Exiting" << endl << endl;
426 SolidV =
new G4Trap(name,
444 if(type ==
"G4GenericTrap")
447 int nz = (dimensions.size() -1 ) / 2;
448 double dz = dimensions[0];
449 vector<G4TwoVector> vertices;
451 for(
int v=0; v<nz; v++)
452 vertices.push_back(G4TwoVector(dimensions[2*v+1], dimensions[2*v+2]));
454 SolidV =
new G4GenericTrap(name,
463 if(type ==
"G4TrapC")
465 if(dimensions.size() != 24)
467 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
468 <<
" is " << dimensions.size() <<
":" << endl;
469 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
470 cout <<
" This does not match a G4Trd. Exiting" << endl << endl;
474 G4ThreeVector points[8];
475 for(
int v=0; v<8; v++)
477 points[v].setX(dimensions[v*3+0]/cm * cm);
478 points[v].setY(dimensions[v*3+1]/cm * cm);
479 points[v].setZ(dimensions[v*3+2]/cm * cm);
482 SolidV =
new G4Trap(name,
499 if(dimensions.size() < 8)
501 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
502 <<
" is " << dimensions.size() <<
":" << endl;
503 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
504 cout <<
" This does not match a G4Polyhedra. Exiting" << endl << endl;
507 int nsides = (int) dimensions[2];
508 int zplanes = (int) dimensions[3];
511 cout << hd_msg <<
" Fatal Error: no sides for " << name
512 <<
"... should be a G4Polyhedra. Exiting" << endl << endl;
515 double* zPlane =
new double[zplanes];
516 double* rInner =
new double[zplanes];
517 double* rOuter =
new double[zplanes];
519 for(
int zpl=0; zpl<zplanes; zpl++)
521 rInner[zpl] = dimensions[4 + 0*zplanes + zpl] ;
522 rOuter[zpl] = dimensions[4 + 1*zplanes + zpl] ;
523 zPlane[zpl] = dimensions[4 + 2*zplanes + zpl] ;
525 SolidV =
new G4Polyhedra(name,
541 if(type ==
"Polycone")
543 if(dimensions.size() < 7)
545 cout << hd_msg <<
" Fatal Error: the number of dimensions for " << name
546 <<
" is " << dimensions.size() <<
":" << endl;
547 for(
unsigned int i=0; i<dimensions.size(); i++) cout <<
" dimension " << i + 1 <<
": " << dimensions[i] << endl;
548 cout <<
" This does not match a G4Polycone. Exiting" << endl << endl;
551 int zplanes = (int) dimensions[2];
553 double* zPlane =
new double[zplanes];
554 double* rInner =
new double[zplanes];
555 double* rOuter =
new double[zplanes];
557 for(
int zpl=0; zpl<zplanes; zpl++)
562 rInner[zpl] = dimensions[3 + 0*zplanes + zpl] ;
563 rOuter[zpl] = dimensions[3 + 1*zplanes + zpl] ;
564 zPlane[zpl] = dimensions[3 + 2*zplanes + zpl] ;
566 SolidV =
new G4Polycone(name,
581 if(type.find(
"CopyOf") != string::npos && type.find(
"CopyOf") == 0)
583 hd_msg = gemcOpt.
optMap[
"LOG_MSG"].args +
" Copy: >> ";
584 string original(type, 6, 190);
587 map<string, detector>::iterator it = (*Map).find(
TrimSpaces(original));
588 if(it == (*Map).end())
590 cout << hd_msg <<
" <" << original <<
"> not found. Exiting." << endl << endl;
595 if(VERB>4 || name.find(catch_v) != string::npos)
597 cout << hd_msg <<
" " << name <<
" is a copy of <" <<
TrimSpaces(original) <<
">. Pointing to its logical volume." << endl;
599 SetLogical(it->second.GetLogical());
608 if(type.find(
"Operation:") != string::npos && type.find(
"Operation:") == 0)
610 hd_msg = gemcOpt.
optMap[
"LOG_MSG"].args +
" Operation: >> ";
612 bool translationFirst =
false;
615 size_t posTld = type.find(
"~");
616 if( posTld != string::npos )
618 translationFirst =
true;
619 type.replace( posTld, 1,
" " );
623 bool absolutecoordinates =
false;
627 size_t pos_at = type.find(
"@");
628 if( pos_at != string::npos )
630 absolutecoordinates =
true;
631 type.replace( pos_at, 1,
" " );
641 string operation(type, 10, 190);
642 posp = operation.find(
"+");
643 posm = operation.find(
"-");
644 post = operation.find(
"*");
645 if (posp != string::npos) pos = posp;
646 else if(posm != string::npos) pos = posm;
647 else if(post != string::npos) pos = post;
648 if(!posp && !posm && !post)
650 cout << hd_msg <<
" Operation " << operation <<
" for " << name <<
" not recognized. Exiting." << endl;
655 string solid1, solid2;
656 string tsolid1, tsolid2;
657 solid1.assign(operation, 0, pos);
658 solid2.assign(operation, pos+1, operation.size());
663 map<string, detector>::iterator it1 = (*Map).find(tsolid1);
664 map<string, detector>::iterator it2 = (*Map).find(tsolid2);
665 if(it1 == (*Map).end())
667 cout << hd_msg <<
" " << tsolid1 <<
" Not found. Exiting." << endl << endl;
670 if(it2 == (*Map).end())
672 cout << hd_msg <<
" " << tsolid2 <<
" Not found. Exiting." << endl << endl;
677 G4RotationMatrix rotate = it2->second.rot ;
678 G4ThreeVector translate = it2->second.pos;
679 G4RotationMatrix invRot = rotate.invert() ;
680 G4Transform3D transf1( invRot, G4ThreeVector( 0, 0, 0 ) );
681 G4Transform3D transf2( G4RotationMatrix(), translate );
682 G4Transform3D transform = transf2 * transf1 ;
688 G4RotationMatrix invrot1 = (it1->second.rot).inverse();
689 G4RotationMatrix rotate2 = it2->second.rot;
691 G4ThreeVector net_translation = it2->second.pos - it1->second.pos;
696 G4RotationMatrix invnet_rotation = (rotate2 * invrot1).invert();
702 net_translation *= it1->second.rot;
703 transform = G4Transform3D( invnet_rotation, net_translation );
705 translationFirst =
false;
712 if( translationFirst )
714 transform = transf1 * transf2 ;
717 if(posp != string::npos)
719 SolidV =
new G4UnionSolid( name, it1->second.GetSolid(), it2->second.GetSolid(), transform );
721 if(posm != string::npos)
723 SolidV =
new G4SubtractionSolid( name, it1->second.GetSolid(), it2->second.GetSolid(), transform );
725 if(post != string::npos)
727 SolidV =
new G4IntersectionSolid(name, it1->second.GetSolid(), it2->second.GetSolid(), transform );
730 if(VERB>4 || name.find(catch_v) != string::npos)
732 cout << hd_msg <<
" " << name <<
" is the " << (pos==posp ?
" sum " :
" difference ") <<
" of " << tsolid1 <<
" and " << tsolid2 << endl;;
740 if(VERB>4 || name.find(catch_v) != string::npos)
742 cout << hd_msg <<
" " << name <<
" solid " << type <<
" built." << endl;
748 cout << hd_msg <<
" " << name <<
" solid >" << type <<
"< not recognized. Exiting." << endl;
757 string hd_msg = gemcOpt.
optMap[
"LOG_MSG"].args +
" Logical: >> ";
758 double VERB = gemcOpt.
optMap[
"G4P_VERBOSITY"].arg ;
759 string catch_v = gemcOpt.
optMap[
"CATCH"].args;
760 string defmat = gemcOpt.
optMap[
"DEFAULT_MATERIAL"].args;
765 if(VERB>4 || name.find(catch_v) != string::npos)
766 cout << hd_msg <<
" " << name <<
" is a Solid Component or a Replicant. Logical Volume will not be built." << endl;
771 map<string, G4Material*>::iterator i = MMats->find(
material);
774 if(i == MMats->end() && LogicV == 0)
776 G4NistManager* matman = G4NistManager::Instance();
782 if(i == MMats->end() && LogicV == 0)
786 cout << hd_msg <<
" Warning: material >" <<
material <<
"< is not defined. Exiting" << endl;
787 cout << hd_msg <<
" You can set the DEFAULT_MATERIAL flag to replace an undefined material. " << endl;
793 if(MMats->find(
material)== MMats->end())
795 cout << hd_msg <<
" Warning: " << defmat <<
" set with DEFAULT_MATERIAL is not found. Exiting" << endl;
805 LogicV =
new G4LogicalVolume(SolidV, (*MMats)[
material], name, 0, 0, 0,
true);
807 if(name ==
"root") LogicV->SetVisAttributes(G4VisAttributes::GetInvisible());
808 else LogicV->SetVisAttributes(VAtts);
810 if(VERB>4 || name.find(catch_v) != string::npos)
812 cout << hd_msg <<
" " << name <<
" Logical Volume built." << endl;
821 string hd_msg = gemcOpt.
optMap[
"LOG_MSG"].args +
" Physical: >> ";
822 double VERB = gemcOpt.
optMap[
"G4P_VERBOSITY"].arg ;
823 bool OVERL = gemcOpt.
optMap[
"CHECK_OVERLAPS"].arg > 0 ;
824 string catch_v = gemcOpt.
optMap[
"CATCH"].args;
825 if(PhysicalV)
delete PhysicalV;
831 if(VERB>4 || name.find(catch_v) != string::npos)
832 cout << hd_msg <<
" " << name <<
" is a Solid Component or a Replicant. Physical Volume will not be built, or replicas will be built instead." << endl;
838 PhysicalV =
new G4PVPlacement(0,
847 PhysicalV =
new G4PVPlacement(&rot,
856 if(VERB>4 || name.find(catch_v) != string::npos)
859 cout << hd_msg <<
" " << name <<
" Physical Volume(s) built inside " << mamma->GetName() <<
"." << endl;
867 string hd_msg = gemcOpt.
optMap[
"LOG_MSG"].args +
" Physical: >> ";
868 double VERB = gemcOpt.
optMap[
"G4P_VERBOSITY"].arg ;
869 string catch_v = gemcOpt.
optMap[
"CATCH"].args;
872 if(replicant.PhysicalV)
delete replicant.PhysicalV;
875 if(PhysicalV)
delete PhysicalV;
878 if(type.find(
"ReplicaOf:") == 0)
880 if(dimensions.size() != 4)
882 cout << hd_msg <<
" Fatal Error: the number of parameters for " << name
883 <<
" is " << dimensions.size() <<
":" << endl;
884 for(
unsigned int i=0; i<dimensions.size(); i++)
885 cout <<
" parameter " << i + 1 <<
": " << dimensions[i] << endl;
886 cout <<
" This does not match a G4Replicas (4). Exiting" << endl << endl;
891 if(dimensions[0] == 1) pAxis = kXAxis;
892 if(dimensions[0] == 2) pAxis = kYAxis;
893 if(dimensions[0] == 3) pAxis = kZAxis;
900 PhysicalV =
new G4PVReplica(name,
910 if(VERB>4 || name.find(catch_v) != string::npos)
913 cout << hd_msg <<
" " << name <<
" Physical Volume(s) built inside " << mamma->GetName() <<
"." << endl;
924 vector< vector<string> > dtypes;
928 if(solidtype ==
"Box")
930 dt[0] =
"half length in X";
932 dtypes.push_back(dt);
933 dt[0] =
"half length in Y";
934 dtypes.push_back(dt);
935 dt[0] =
"half length in Z";
936 dtypes.push_back(dt);
939 if(solidtype ==
"Sphere")
942 dt[0] =
"Inner radius";
943 dtypes.push_back(dt);
944 dt[0] =
"Outer radius";
945 dtypes.push_back(dt);
947 dt[0] =
"Starting Phi angle of the segment";
948 dtypes.push_back(dt);
949 dt[0] =
"Delta Phi angle of the segment";
950 dtypes.push_back(dt);
951 dt[0] =
"Starting Theta angle of the segment";
952 dtypes.push_back(dt);
953 dt[0] =
"Delta Theta angle of the segment";
954 dtypes.push_back(dt);
956 if(solidtype ==
"Tube")
959 dt[0] =
"Inner radius";
960 dtypes.push_back(dt);
961 dt[0] =
"Outer radius";
962 dtypes.push_back(dt);
963 dt[0] =
"Half length in z";
964 dtypes.push_back(dt);
966 dt[0] =
"Starting Phi angle";
967 dtypes.push_back(dt);
968 dt[0] =
"Delta Phi angle";
969 dtypes.push_back(dt);
971 if(solidtype ==
"Trd")
974 dt[0] =
"Half-length along x at the surface at -dz";
975 dtypes.push_back(dt);
976 dt[0] =
"Half-length along x at the surface at +dz";
977 dtypes.push_back(dt);
978 dt[0] =
"Half-length along y at the surface at -dz";
979 dtypes.push_back(dt);
980 dt[0] =
"Half-length along y at the surface at +dz";
981 dtypes.push_back(dt);
982 dt[0] =
"dz: Half-length along z axis";
983 dtypes.push_back(dt);
985 if(solidtype ==
"Cons")
988 dt[0] =
"Inner radius at start";
989 dtypes.push_back(dt);
990 dt[0] =
"Outer radius at start";
991 dtypes.push_back(dt);
992 dt[0] =
"Inner radius at end";
993 dtypes.push_back(dt);
994 dt[0] =
"Outer radius at end";
995 dtypes.push_back(dt);
996 dt[0] =
"Half length in z";
997 dtypes.push_back(dt);
999 dt[0] =
"Starting Phi angle";
1000 dtypes.push_back(dt);
1001 dt[0] =
"Delta Phi angle";
1002 dtypes.push_back(dt);
1004 if(solidtype ==
"G4Trap")
1007 dt[0] =
"Half z length ";
1008 dtypes.push_back(dt);
1010 dt[0] =
"Polar angle of the line joining the centres of the faces";
1011 dtypes.push_back(dt);
1012 dt[0] =
"Azimuthal angle of the line joining the centre of the face";
1013 dtypes.push_back(dt);
1015 dt[0] =
"Half y length at -pDz";
1016 dtypes.push_back(dt);
1017 dt[0] =
"Half x length of the side at y=-pDy1, -pDz";
1018 dtypes.push_back(dt);
1019 dt[0] =
"Half x length of the side at y=+pDy1, -pDz";
1020 dtypes.push_back(dt);
1022 dt[0] =
"Angle to the y axis from the centre (lower endcap) ";
1023 dtypes.push_back(dt);
1025 dt[0] =
"Half y length at +pDz";
1026 dtypes.push_back(dt);
1027 dt[0] =
"Half x length of the side at y=-pDy2, +pDz";
1028 dtypes.push_back(dt);
1029 dt[0] =
"Half x length of the side at y=+pDy2, +pDz";
1030 dtypes.push_back(dt);
1032 dt[0] =
"Angle to the y axis from the centre (upper endcap) ";
1033 dtypes.push_back(dt);
1036 if(solidtype ==
"G4EllipticalTube")
1039 dt[0]=
"Half length x";
1040 dtypes.push_back(dt);
1042 dt[0]=
"Half length y";
1043 dtypes.push_back(dt);
1045 dt[0]=
"Half length z";
1046 dtypes.push_back(dt);
1049 if(solidtype ==
"Hype")
1052 dt[0]=
"Inner radius";
1053 dtypes.push_back(dt);
1054 dt[0] =
"Outer radius";
1055 dtypes.push_back(dt);
1057 dt[0] =
"Inner stereo angle";
1058 dtypes.push_back(dt);
1059 dt[0] =
"Outer stereo angle";
1060 dtypes.push_back(dt);
1062 dt[0] =
"Half length in z";
1063 dtypes.push_back(dt);
1066 if(solidtype ==
"Parallelepiped")
1069 dt[0]=
"Half length in x";
1070 dtypes.push_back(dt);
1071 dt[0] =
"Half length in y";
1072 dtypes.push_back(dt);
1073 dt[0] =
"Half length in z";
1074 dtypes.push_back(dt);
1076 dt[0] =
"Angle formed by the y axis and the plane joining the centre of the faces parallel to the z-x plane at -dy and +dy" ;
1077 dtypes.push_back(dt);
1078 dt[0] =
"Polar angle of the line joining the centres of the faces at -dz and +dz in z ";
1079 dtypes.push_back(dt);
1080 dt[0] =
"Azimuthal angle of the line joining the centres of the faces at -dz and +dz in z ";
1081 dtypes.push_back(dt);
1084 if(solidtype ==
"Torus")
1087 dt[0]=
"Inner radius";
1088 dtypes.push_back(dt);
1089 dt[0] =
"Outer radius";
1090 dtypes.push_back(dt);
1091 dt[0] =
"Swept radius of torus";
1092 dtypes.push_back(dt);
1094 dt[0] =
"Starting Phi angle";
1095 dtypes.push_back(dt);
1096 dt[0] =
"Outer stereo angle";
1097 dtypes.push_back(dt);
1100 if(solidtype ==
"Ellipsoid")
1103 dt[0]=
"Semiaxis in X";
1104 dtypes.push_back(dt);
1105 dt[0] =
"Semiaxis in Y ";
1106 dtypes.push_back(dt);
1107 dt[0] =
"Semiaxis in Z ";
1108 dtypes.push_back(dt);
1109 dt[0] =
"lower cut plane level, z";
1110 dtypes.push_back(dt);
1111 dt[0] =
"upper cut plane level, z";
1112 dtypes.push_back(dt);
1122 cout <<
" Detector name: " << Detector.
name <<
" - " << Detector.
description << endl;
1123 cout <<
" Mother: " << Detector.
mother << endl;
1124 cout <<
" Position (cm): " << Detector.
pos/cm << endl;
1125 cout <<
" Rotation: " << Detector.
rot << endl;
1126 cout <<
" Color: " << Detector.
VAtts.GetColour() << endl;
1127 cout <<
" Type: " << Detector.
type << endl;
1130 if(dtypes.size() != Detector.
dimensions.size() && Detector.
type.find(
"CopyOf") != 0)
1132 for(
unsigned int i=0; i<Detector.
dimensions.size(); i++)
1133 cout <<
" Size " << i + 1 <<
": " << Detector.
dimensions[i] << endl;
1135 if(dtypes.size() == Detector.
dimensions.size() && Detector.
type.find(
"CopyOf") != 0)
1136 for(
unsigned int i=0; i<dtypes.size(); i++)
1137 cout <<
" " << dtypes[i][0] <<
": " << G4BestUnit(Detector.
dimensions[i], dtypes[i][1]) << endl;
1139 cout <<
" Material: " << Detector.
material << endl;
1140 cout <<
" Magnetic Field: " << Detector.
magfield << endl;
1141 cout <<
" Copy Number: " << Detector.
ncopy << endl;
1142 cout <<
" Activated: " << ( Detector.
exist==1 ?
"yes" :
"no" ) << endl;
1143 cout <<
" Visible: " << ( Detector.
visible==1 ?
"yes" :
"no" ) << endl;
1144 cout <<
" Style: " << ( Detector.
style==1 ?
"solid" :
"wireframe" ) << endl;
1145 cout <<
" Sensitivity: " << Detector.
sensitivity << endl;
1147 cout <<
" hitType: " << Detector.
hitType << endl;
1160 if(D.
name == this->name)
int create_logical_volume(map< string, G4Material * > *, goptions)
Creates the Logical Volume.
string sensitivity
Defines the Sensitive Detector. possible choices: "no" "hits collection name".
string mother
Mother Volume name.
ostream & operator<<(ostream &stream, detector Detector)
G4ThreeVector pos
Position relative to the mother volume, as G4ThreeVector.
int create_physical_volumes(goptions, G4LogicalVolume *)
Creates the Physical Volume.
bool operator==(const detector &D) const
Overloaded "==" operator for detector class.
G4VisAttributes VAtts
Visual Attributes: color, transparency, style (wireframe, solid), visibility.
double get_number(string v, int warn_no_unit)
Returns number with dimension from string, i.e. 100*cm.
int create_solid(goptions, map< string, detector > *)
Creates the Solid. If it's a Copy Placement, retrieve and assigns LogicV.
vector< vector< string > > dimensionstype(string solidtype)
Returns dimensions nomenclature for different solid type.
string name
Name of the volume. Since this is the key of the STL map, it has to be unique.
map< string, aopt > optMap
Options map.
string material
Volume Material name.
int visible
visibility of the detector: 0=invisible 1=visible
int style
Visual style: 0=wireframe 1=solid.
string hitType
Hit Process routine name. A Hit Process HitProcess derived class must exists with this name...
vector< identifier > identity
Vector of identifiers. Example: superlayer manual 1 type manual 2 segment manual 3 strip manual 4...
string magfield
Magnetic Field. The string "no" means that the field is inherited from the mother volume...
G4RotationMatrix rot
Rotation Matrix, defined by rotations along x,y,z axis relative to the mother volume.
int exist
detector ON/OFF switch
string type
solid type. This follows the GEANT4 definitions
vector< double > dimensions
vector of dimensions. Size, units depends on solid type
string TrimSpaces(string in)
Removes leading and trailing spaces.
int create_replicas(goptions, G4LogicalVolume *, detector)
Creates the Replica Volumes.
string description
Volume Description for documentation.