BOSS 7.0.9
BESIII Offline Software System
Loading...
Searching...
No Matches
MucGeoGeneral Class Reference

#include <MucGeoGeneral.h>

Public Member Functions

 MucGeoGeneral ()
 Constructor.
 
MucGeoGeneraloperator= (const MucGeoGeneral &orig)
 Assignment constructor.
 
 MucGeoGeneral (const MucGeoGeneral &orig)
 Copy constructor.
 
 ~MucGeoGeneral ()
 Destructor.
 
void Init ()
 Initialize the instance of MucGeoGeneral.
 
void InitFromDatabase ()
 Initialize from database.
 
void InitFromASCII ()
 Initialize form ASCII.
 
void InitFromXML ()
 Initialize from xml.
 
void Destroy ()
 Destroy the single instance of MucGeoGeneral.
 
MucGeoGapGetGap (const int part, const int seg, const int gap) const
 Get a pointer to the gap identified by (part,seg,gap).
 
MucGeoGapGetGap (const Identifier id) const
 Get a pointer to the gap identified by Indentifier.
 
MucGeoStripGetStrip (const int part, const int seg, const int gap, const int strip) const
 Get a pointer to the strip identified by (part,seg,gap,strip).
 
MucGeoStripGetStrip (const Identifier id) const
 Get a pointer to the strip identified by Indentifier.
 
int GetStripNumInGap (const int part, const int seg, const int gap)
 
int GetStripNumTotal ()
 Get total number of strips.
 
vector< IdentifierFindIntersectGaps (const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
 
vector< IdentifierFindIntersectStrips (const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
 
vector< IdentifierFindIntersectStrips (const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection, vector< int > &padID, vector< float > &intersection_x, vector< float > &intersection_y, vector< float > &intersection_z)
 
vector< HepPoint3DFindIntersections (const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
 
void FindIntersection (const int part, const int seg, const int gap, const float vx, const float vy, const float vz, const float x0, const float y0, const float z0, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x, float &y, float &z, float &sigmaX, float &sigmaY, float &sigmaZ)
 
void FindIntersectionQuadLocal (const int part, const int seg, const int gap, const float a, const float b, const float c, const int whichhalf, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX, float &sigmaY, float &sigmaZ)
 
void FindIntersection (const int part, const int seg, const int gap, const float vy, const float x0, const float y0, const float z0, const float a, const float b, const float c, const int whichhalf, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX, float &sigmaY, float &sigmaZ)
 
void FindIntersectionSurface (const int part, const int seg, const int gap, const float vx, const float vy, const float vz, const float x0, const float y0, const float z0, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX1, float &sigmaY1, float &sigmaZ1, float &sigmaX2, float &sigmaY2, float &sigmaZ2)
 
void FindIntersectionSurface (const int part, const int seg, const int gap, const float vy, const float x0, const float y0, const float z0, const float a, const float b, const float c, const int whichhalf, const float sigmaVx, const float sigmaVy, const float sigmaVz, const float sigmaX0, const float sigmaY0, const float sigmaZ0, float &x1, float &y1, float &z1, float &x2, float &y2, float &z2, float &sigmaX, float &sigmaY, float &sigmaZ)
 
void Clear ()
 Clear the fgpMucGeoGap and fgpMucGeoStrip vector containers.
 

Static Public Member Functions

static MucGeoGeneralInstance ()
 Get a pointer to the single instance of MucGeoGeneral.
 

Detailed Description

Class MucGeoGeneral contains all of the objects necessary to describe the muon chamber geometry.

Author
Zhengyun You \URL{youzy.nosp@m.@hep.nosp@m..pku..nosp@m.cn}

Definition at line 50 of file MucGeoGeneral.h.

Constructor & Destructor Documentation

◆ MucGeoGeneral() [1/2]

MucGeoGeneral::MucGeoGeneral ( )

Constructor.

Definition at line 41 of file MucGeoGeneral.cxx.

42{
43 // Default constructor.
44}

Referenced by Instance().

◆ MucGeoGeneral() [2/2]

MucGeoGeneral::MucGeoGeneral ( const MucGeoGeneral orig)

Copy constructor.

◆ ~MucGeoGeneral()

MucGeoGeneral::~MucGeoGeneral ( )

Destructor.

Definition at line 46 of file MucGeoGeneral.cxx.

47{
48 // Destructor.
49 MucGeoGap* pGap = 0;
50 while(m_gpMucGeoGap.size() > 0){
51 map<Identifier, MucGeoGap*>::iterator iter = m_gpMucGeoGap.end();
52 pGap = (*iter).second;
53 delete pGap;
54 m_gpMucGeoGap.erase(iter);
55 }
56
57 MucGeoStrip* pStrip = 0;
58 while(m_gpMucGeoStrip.size() > 0){
59 map<Identifier, MucGeoStrip*>::iterator iter = m_gpMucGeoStrip.end();
60 pStrip = (*iter).second;
61 delete pStrip;
62 m_gpMucGeoStrip.erase(iter);
63 }
64}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

Member Function Documentation

◆ Clear()

void MucGeoGeneral::Clear ( )

Clear the fgpMucGeoGap and fgpMucGeoStrip vector containers.

◆ Destroy()

void MucGeoGeneral::Destroy ( )

Destroy the single instance of MucGeoGeneral.

◆ FindIntersectGaps()

vector< Identifier > MucGeoGeneral::FindIntersectGaps ( const int  part,
const int  gap,
const HepPoint3D  gPoint,
const Hep3Vector  gDirection 
)

Find the intersect gap of a trajectory with the given part and gap. The trajectory is given by the position and direction in global coordinate.

Definition at line 507 of file MucGeoGeneral.cxx.

511{
512 // Find the intersect gap of a trajectory with the given part and gap. The trajectory is
513 // given by the position gPoint and direction gDirection in global coordinate.
514 vector<Identifier> gapList;
515
516 MucGeoGap *pGap = 0;
517 Identifier id = MucID::channel_id(0,0,0,0);
518 HepPoint3D intersection, localIntersection;
519 Hep3Vector intersectionDir;
520 double cos = -1;
521
522 for(unsigned int seg = 0; seg < MucID::getSegNum(part); seg++) {
523 id = MucID::channel_id(part, seg, gap, 0);
524 pGap = GetGap(id);
525 if( pGap ) {
526 intersection = pGap->ProjectToGap(gPoint, gDirection);
527 localIntersection = pGap->TransformToGap(intersection);
528
529 intersectionDir = ((CLHEP::Hep3Vector)intersection) - ((CLHEP::Hep3Vector)gPoint);
530 if( intersectionDir.mag() == 0 ) {
531 cos = 0.0;
532 }
533 else {
534 cos = intersectionDir.dot(gDirection) /
535 ( intersectionDir.mag() * gDirection.mag() );
536 }
537
538 if( ( cos >= 0.0 ) &&
539 ( pGap->IsInGap(localIntersection.x(),
540 localIntersection.y(),
541 localIntersection.z()) ) ) {
542 id = MucID::channel_id(part, seg, gap, 0);
543 gapList.push_back(id);
544 }
545 else {
546 }
547
548 }
549 else{
550 std::cout << "MucGeoGeneral::FindIntersectGaps(), Bad gap Pointer"
551 << " part " << part
552 << " seg " << seg
553 << " gap " << gap
554 << std::endl;
555 }
556 }
557
558 return gapList;
559}
double cos(const BesAngle a)
Definition: BesAngle.h:213
int intersection(const HepPoint3D &c1, double r1, const HepPoint3D &c2, double r2, double eps, HepPoint3D &x1, HepPoint3D &x2)
Circle utilities.
Definition: TMDCUtil.cxx:99
HepPoint3D ProjectToGap(const HepPoint3D gPoint, const Hep3Vector gVect) const
Given a line, find the intersection with the gap in the global.
Definition: MucGeoGap.cxx:379
bool IsInGap(const float x, const float y, const float z) const
Check if the point (given in gap coordinate) is within the gap boundary.
Definition: MucGeoGap.cxx:634
HepPoint3D TransformToGap(const HepPoint3D gPoint) const
Transform a point from global coordinate to gap coordinate.
Definition: MucGeoGap.cxx:627
MucGeoGap * GetGap(const int part, const int seg, const int gap) const
Get a pointer to the gap identified by (part,seg,gap).
static Identifier channel_id(int barrel_ec, int segment, int layer, int channel)
For a single crystal.
Definition: MucID.cxx:135
static value_type getSegNum(int part)
Definition: MucID.cxx:164

Referenced by FindIntersectStrips(), and main().

◆ FindIntersection() [1/2]

void MucGeoGeneral::FindIntersection ( const int  part,
const int  seg,
const int  gap,
const float  vx,
const float  vy,
const float  vz,
const float  x0,
const float  y0,
const float  z0,
const float  sigmaVx,
const float  sigmaVy,
const float  sigmaVz,
const float  sigmaX0,
const float  sigmaY0,
const float  sigmaZ0,
float &  x,
float &  y,
float &  z,
float &  sigmaX,
float &  sigmaY,
float &  sigmaZ 
)

Find the intersection position of a trajectory with the given gap. The trajectory is given by unit vector (vx,vy,vz) and intercept (x0,y0,z0) in global coordinates, such that (x-x0)/vx = (y-y0)/vy = (z-z0)/vz . If more than one seg lies along the trajectory, take the first one intersect with the trajectory.

Definition at line 783 of file MucGeoGeneral.cxx.

804{
805 x = 0.0; sigmaX = 0.0;
806 y = 0.0; sigmaY = 0.0;
807 z = 0.0; sigmaZ = 0.0;
808
809 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) {
810 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = "
811 << part << endl;
812 return;
813 }
814
815 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) {
816 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = "
817 // << gap << endl;
818 return;
819 }
820
821 // "Brute-force" algorithm.
822 // 1a. Find intersection with gap.
823 // 1b. Transform intersection position to gap coords.
824 // 2. Check intersection position against gap boundaries.
825 // Save the intersection position and gap id if within
826 // boundaries.
827
828 //bool found = false;
829 float distance = 1e30;
830
831 MucGeoGap *p = GetGap(part, seg, gap);
832 if (p) {
833
834 Hep3Vector v(vx, vy, vz);
835 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection
836
837 //Hep3Vector vSigma(sigmaVx, sigmaVy, sigmaVz);
838 //HepPoint3D r0Sigma(sigmaX0, sigmaY0, sigmaZ0);
839
840 //HepPoint3D gCross(0.0, 0.0, 0.0);
841 //HepPoint3D gCrossSigma(0.0, 0.0, 0.0);
842 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl;
843 //HepPoint3D r = p->ProjectToGapWithSigma(r0, v, r0Sigma, vSigma, gCross, gCrossSigma);
844 HepPoint3D r = p->ProjectToGap(r0, v);
845 HepPoint3D localIntersection = p->TransformToGap(r);
846 //cout << "intersect gap point " << r << " local " << localIntersection << endl;
847
848
849 distance = r.distance(r0);
850
851 x = r.x();
852 y = r.y();
853 z = r.z();
854
855 //sigmaX = gCrossSigma.x();
856 //sigmaY = gCrossSigma.y();
857 //sigmaZ = gCrossSigma.z();
858
859
860 // Should be in Gap?
861 // No, return intersection position however.
862
863 //if ( p->IsInGap(localIntersection.x(),
864 // localIntersection.y(),
865 // localIntersection.z()) ) {
866 //cout << "found project in gap" << endl;
867 // found = true;
868 //}
869 //else{
870 //cout << " not in gap" << endl;
871 //}
872
873
874 }
875
876 else {
877 cout << "FindIntersection-E103 bad panel pointer!"
878 << " Part" << part << " Seg" << seg << " Gap" << gap << endl;
879 }
880
881 // FIXME: need a calculation of the uncertainty in the intercept!
882
883 return;
884}
Double_t x[10]
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35
static value_type getPartNum()
Definition: MucID.cxx:159
static value_type getGapNum(int part)
Definition: MucID.cxx:171
double y[1000]

Referenced by MucRec2DRoad::GetSearchWindowSize(), MucRec3DRoad::Project(), MucRec2DRoad::Project(), MucRec3DRoad::ProjectNoCurrentGap(), and MucRec3DRoad::ProjectWithSigma().

◆ FindIntersection() [2/2]

void MucGeoGeneral::FindIntersection ( const int  part,
const int  seg,
const int  gap,
const float  vy,
const float  x0,
const float  y0,
const float  z0,
const float  a,
const float  b,
const float  c,
const int  whichhalf,
const float  sigmaVx,
const float  sigmaVy,
const float  sigmaVz,
const float  sigmaX0,
const float  sigmaY0,
const float  sigmaZ0,
float &  x1,
float &  y1,
float &  z1,
float &  x2,
float &  y2,
float &  z2,
float &  sigmaX,
float &  sigmaY,
float &  sigmaZ 
)

Find the intersection position of a trajectory with the given gap. The trajectory is given by a parabola and a line in global coordinates, If more than one seg lies along the trajectory, take the first one whichhalf help to judge which intersection position is better, x1,y1,z1 return the better one . now reserver x2,y2,z2 temp.

Definition at line 977 of file MucGeoGeneral.cxx.

1003{
1004 x1 = 0.0; sigmaX = 0.0; x2 = 0.0;
1005 y1 = 0.0; sigmaY = 0.0; y2 = 0.0;
1006 z1 = 0.0; sigmaZ = 0.0; z2 = 0.0;
1007
1008 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) {
1009 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = "
1010 << part << endl;
1011 return;
1012 }
1013
1014 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) {
1015 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = "
1016 // << gap << endl;
1017 return;
1018 }
1019
1020 // "Brute-force" algorithm.
1021 // 1a. Find intersection with gap.
1022 // 1b. Transform intersection position to gap coords.
1023 // 2. Check intersection position against gap boundaries.
1024 // Save the intersection position and gap id if within
1025 // boundaries.
1026
1027 //bool found = false;
1028 float distance = 1e30;
1029
1030 MucGeoGap *p = GetGap(part, seg, gap);
1031 if (p) {
1032
1033 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection
1034
1035
1036
1037 HepPoint3D cross1(0,0,0), cross2(0,0,0);
1038 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl;
1039 HepPoint3D r = p->ProjectToGap(r0, vy, y0, a, b, c,whichhalf, cross1, cross2);
1040 //cout<<"in MucGeoGeneral r_quad = "<<r<<endl;
1041 HepPoint3D localIntersection = p->TransformToGap(r);
1042 //cout << "intersect gap point " << r << " local " << localIntersection << endl;
1043
1044 distance = r.distance(r0);
1045
1046 x1 = cross1.x();
1047 y1 = cross1.y();
1048 z1 = cross1.z();
1049
1050 x2 = cross2.x();
1051 y2 = cross2.y();
1052 z2 = cross2.z();
1053
1054 // Should be in Gap?
1055 // No, return intersection position however.
1056
1057 //if ( p->IsInGap(localIntersection.x(),
1058 // localIntersection.y(),
1059 // localIntersection.z()) ) {
1060 //cout << "found project in gap" << endl;
1061 // found = true;
1062 //}
1063 //else{
1064 //cout << " not in gap" << endl;
1065 //}
1066 }
1067
1068 else {
1069 cout << "FindIntersection-E103 bad panel pointer!"
1070 << " Part" << part << " Seg" << seg << " Gap" << gap << endl;
1071 }
1072
1073 // FIXME: need a calculation of the uncertainty in the intercept!
1074
1075 return;
1076}
const double b
Definition: slope.cxx:9

◆ FindIntersectionQuadLocal()

void MucGeoGeneral::FindIntersectionQuadLocal ( const int  part,
const int  seg,
const int  gap,
const float  a,
const float  b,
const float  c,
const int  whichhalf,
float &  x1,
float &  y1,
float &  z1,
float &  x2,
float &  y2,
float &  z2,
float &  sigmaX,
float &  sigmaY,
float &  sigmaZ 
)

Definition at line 887 of file MucGeoGeneral.cxx.

903{
904 x1 = 0.0; sigmaX = 0.0; x2 = 0.0;
905 y1 = 0.0; sigmaY = 0.0; y2 = 0.0;
906 z1 = 0.0; sigmaZ = 0.0; z2 = 0.0;
907
908 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) {
909 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = "
910 << part << endl;
911 return;
912 }
913
914 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) {
915 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = "
916 // << gap << endl;
917 return;
918 }
919
920
921 float distance = 1e30;
922
923 MucGeoGap *p = GetGap(part, seg, gap);
924 if (p) {
925
926 int orient = 0;
927 if(part == 1 && gap%2 == 0) orient = 1;
928 if(part != 1 && gap%2 == 1) orient = 1;
929
930 HepPoint3D cross1(0,0,0), cross2(0,0,0);
931 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl;
932 HepPoint3D r = p->ProjectToGapQuadLocal(part, orient, a, b, c,whichhalf, cross1, cross2);
933 //cout<<"in MucGeoGeneral r_quad = "<<r<<endl;
934 HepPoint3D localIntersection = p->TransformToGap(r);
935 //cout << "intersect gap point " << r << " local " << localIntersection << endl;
936
937
938 x1 = cross1.x();
939 y1 = cross1.y();
940 z1 = cross1.z();
941
942 x2 = cross2.x();
943 y2 = cross2.y();
944 z2 = cross2.z();
945
946 // Should be in Gap?
947 // No, return intersection position however.
948
949 //if ( p->IsInGap(localIntersection.x(),
950 // localIntersection.y(),
951 // localIntersection.z()) ) {
952 //cout << "found project in gap" << endl;
953 // found = true;
954 //}
955 //else{
956 //cout << " not in gap" << endl;
957 //}
958 }
959
960 else {
961 cout << "FindIntersection-E103 bad panel pointer!"
962 << " Part" << part << " Seg" << seg << " Gap" << gap << endl;
963 }
964
965 return;
966
967}
HepPoint3D ProjectToGapQuadLocal(const int part, const int orient, const float a, const float b, const float c, const int whichhalf, HepPoint3D &cross1, HepPoint3D &cross2) const
Definition: MucGeoGap.cxx:435

Referenced by MucRec3DRoad::ProjectNoCurrentGap().

◆ FindIntersections()

vector< HepPoint3D > MucGeoGeneral::FindIntersections ( const int  part,
const int  gap,
const HepPoint3D  gPoint,
const Hep3Vector  gDirection 
)

Find the intersection position of a trajectory with the given part and gap. The trajectory is given by the position and direction in global coordinate.

Definition at line 731 of file MucGeoGeneral.cxx.

735{
736 // Find the intersection position of a trajectory with the given part and gap.
737 // The trajectory is given by the position and direction in global coordinate.
738 vector<HepPoint3D> intersectionList;
739 MucGeoGap* pGap;
740
741 HepPoint3D intersection, localIntersection;
742 Hep3Vector intersectionDir;
743 double cos = -1;
744
745 for(unsigned int seg = 0; seg < MucID::getSegNum(part); seg++ ) {
746 pGap = GetGap(part, seg, gap);
747 if( pGap ) {
748 intersection = pGap->ProjectToGap(gPoint, gDirection);
749 localIntersection = pGap->TransformToGap(intersection);
750 //cout << localIntersection << endl;
751
752 intersectionDir = ((CLHEP::Hep3Vector)intersection) - ((CLHEP::Hep3Vector)gPoint);
753 if( intersectionDir.mag() == 0 ) {
754 cos = 0.0;
755 }
756 else {
757 cos = intersectionDir.dot(gDirection) /
758 ( intersectionDir.mag() * gDirection.mag() );
759 }
760
761 if( ( cos >= 0.0 ) &&
762 ( pGap->IsInGap(localIntersection.x(),
763 localIntersection.y(),
764 localIntersection.z()) ) ) {
765 intersectionList.push_back(intersection);
766 }
767 else {
768 }
769 }
770 else{
771 }
772 }
773
774 return intersectionList;
775}

Referenced by main(), and RecMucTrack::Project().

◆ FindIntersectionSurface() [1/2]

void MucGeoGeneral::FindIntersectionSurface ( const int  part,
const int  seg,
const int  gap,
const float  vx,
const float  vy,
const float  vz,
const float  x0,
const float  y0,
const float  z0,
const float  sigmaVx,
const float  sigmaVy,
const float  sigmaVz,
const float  sigmaX0,
const float  sigmaY0,
const float  sigmaZ0,
float &  x1,
float &  y1,
float &  z1,
float &  x2,
float &  y2,
float &  z2,
float &  sigmaX1,
float &  sigmaY1,
float &  sigmaZ1,
float &  sigmaX2,
float &  sigmaY2,
float &  sigmaZ2 
)

Definition at line 1085 of file MucGeoGeneral.cxx.

1112{
1113 x1 = 0.0; sigmaX1 = 0.0;
1114 y1 = 0.0; sigmaY1 = 0.0;
1115 z1 = 0.0; sigmaZ1 = 0.0;
1116 x2 = 0.0; sigmaX2 = 0.0;
1117 y2 = 0.0; sigmaY2 = 0.0;
1118 z2 = 0.0; sigmaZ2 = 0.0;
1119
1120 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) {
1121 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = "
1122 << part << endl;
1123 return;
1124 }
1125
1126 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) {
1127 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = "
1128 // << gap << endl;
1129 return;
1130 }
1131
1132 // "Brute-force" algorithm.
1133 // 1a. Find intersection with gap.
1134 // 1b. Transform intersection position to gap coords.
1135 // 2. Check intersection position against gap boundaries.
1136 // Save the intersection position and gap id if within
1137 // boundaries.
1138
1139 //bool found = false;
1140 float distance = 1e30;
1141
1142 MucGeoGap *p = GetGap(part, seg, gap);
1143 if (p) {
1144
1145 Hep3Vector v(vx, vy, vz);
1146 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection
1147
1148
1149 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl;
1150
1151 HepPoint3D cross1, cross2;
1152 p->ProjectToGapSurface(r0, v, cross1, cross2);
1153
1154 x1 = cross1.x();
1155 y1 = cross1.y();
1156 z1 = cross1.z();
1157 x2 = cross2.x();
1158 y2 = cross2.y();
1159 z2 = cross2.z();
1160
1161 // Should be in Gap?
1162 // No, return intersection position however.
1163
1164 //if ( p->IsInGap(localIntersection.x(),
1165 // localIntersection.y(),
1166 // localIntersection.z()) ) {
1167 //cout << "found project in gap" << endl;
1168 // found = true;
1169 //}
1170 //else{
1171 //cout << " not in gap" << endl;
1172 //}
1173 }
1174
1175 else {
1176 cout << "FindIntersection-E103 bad panel pointer!"
1177 << " Part" << part << " Seg" << seg << " Gap" << gap << endl;
1178 }
1179
1180 // FIXME: need a calculation of the uncertainty in the intercept!
1181
1182 return;
1183}
void ProjectToGapSurface(const HepPoint3D gPoint, const Hep3Vector gVect, HepPoint3D &cross1, HepPoint3D &cross2) const
Given a line, find the intersection with two surface of the gap in the global.
Definition: MucGeoGap.cxx:415

Referenced by MucRec3DRoad::Project().

◆ FindIntersectionSurface() [2/2]

void MucGeoGeneral::FindIntersectionSurface ( const int  part,
const int  seg,
const int  gap,
const float  vy,
const float  x0,
const float  y0,
const float  z0,
const float  a,
const float  b,
const float  c,
const int  whichhalf,
const float  sigmaVx,
const float  sigmaVy,
const float  sigmaVz,
const float  sigmaX0,
const float  sigmaY0,
const float  sigmaZ0,
float &  x1,
float &  y1,
float &  z1,
float &  x2,
float &  y2,
float &  z2,
float &  sigmaX,
float &  sigmaY,
float &  sigmaZ 
)

Find the intersection position of a trajectory with two surfaces of the given gap. The trajectory is given by a parabola and a line in global coordinates, If more than one seg lies along the trajectory, take the first one whichhalf help to judge which intersection position is better,and return the better one only. x1,y1,z1 is the intersection position with inner surface and x2,y2,z2 be the outer!

Definition at line 1188 of file MucGeoGeneral.cxx.

1214{
1215 x1 = 0.0; sigmaX = 0.0; x2 = 0.0;
1216 y1 = 0.0; sigmaY = 0.0; y2 = 0.0;
1217 z1 = 0.0; sigmaZ = 0.0; z2 = 0.0;
1218
1219 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) {
1220 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = "
1221 << part << endl;
1222 return;
1223 }
1224
1225 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) {
1226 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = "
1227 // << gap << endl;
1228 return;
1229 }
1230
1231 // "Brute-force" algorithm.
1232 // 1a. Find intersection with gap.
1233 // 1b. Transform intersection position to gap coords.
1234 // 2. Check intersection position against gap boundaries.
1235 // Save the intersection position and gap id if within
1236 // boundaries.
1237
1238 //bool found = false;
1239 float distance = 1e30;
1240
1241 MucGeoGap *p = GetGap(part, seg, gap);
1242 if (p) {
1243
1244 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection
1245
1246
1247
1248 HepPoint3D cross1(0,0,0), cross2(0,0,0);
1249 p->ProjectToGapSurface(r0, vy, y0, a, b, c,whichhalf, cross1, cross2);
1250
1251
1252 x1 = cross1.x();
1253 y1 = cross1.y();
1254 z1 = cross1.z();
1255
1256 x2 = cross2.x();
1257 y2 = cross2.y();
1258 z2 = cross2.z();
1259
1260 // Should be in Gap?
1261 // No, return intersection position however.
1262
1263 //if ( p->IsInGap(localIntersection.x(),
1264 // localIntersection.y(),
1265 // localIntersection.z()) ) {
1266 //cout << "found project in gap" << endl;
1267 // found = true;
1268 //}
1269 //else{
1270 //cout << " not in gap" << endl;
1271 //}
1272 }
1273
1274 else {
1275 cout << "FindIntersection-E103 bad panel pointer!"
1276 << " Part" << part << " Seg" << seg << " Gap" << gap << endl;
1277 }
1278
1279 // FIXME: need a calculation of the uncertainty in the intercept!
1280
1281 return;
1282}

◆ FindIntersectStrips() [1/2]

vector< Identifier > MucGeoGeneral::FindIntersectStrips ( const int  part,
const int  gap,
const HepPoint3D  gPoint,
const Hep3Vector  gDirection 
)

Find the intersect strip of a trajectory with the given part and gap. The trajectory is given by the position and direction in global coordinate.

Definition at line 562 of file MucGeoGeneral.cxx.

566{
567 // Find the intersect strip of a trajectory with the given part and gap. The trajectory is
568 // given by the position gPoint and direction gDirection in global coordinate.
569 vector<Identifier> gapList;
570 vector<Identifier> stripList;
571
572 MucGeoGap *pGap;
573 MucGeoStrip *pStrip;
574
575 int seg, iStripGuess, nStripMax;
576 Identifier id;
577 HepPoint3D intersection, localIntersection;
578 Hep3Vector localDirection;
579
580 gapList = FindIntersectGaps(part, gap, gPoint, gDirection);
581
582 for(unsigned int i = 0; i < gapList.size(); i++) {
583 // Get the gap data ...
584 seg = MucID::seg(gapList[i]);
585 pGap = GetGap(part, seg, gap);
586 if(!pGap) {
587 cout << "FindIntersectStrips : bad gap pointer!" << endl;
588 return stripList;
589 }
590
591 intersection = pGap->ProjectToGap(gPoint, gDirection);
592 localIntersection = pGap->TransformToGap(intersection);
593 localDirection = pGap->RotateToGap(gDirection);
594
595 // Search through gap to find the intersect strips.
596 nStripMax = pGap->GetStripNum() - 1;
597 iStripGuess = pGap->GuessStrip(localIntersection.x(),
598 localIntersection.y(),
599 localIntersection.z());
600 //cout << "guess " << iStripGuess << endl;
601
602 int iStripLow = iStripGuess - 2;
603 int iStripHigh = iStripGuess + 2;
604 iStripLow = max(0, iStripLow);
605 iStripHigh = min(nStripMax, iStripHigh);
606
607 iStripLow = 0;
608 iStripHigh = nStripMax;
609
610 //cout << "intersection : " << intersection << endl
611 // << "localIntersection : " << localIntersection << endl
612 // << "localDirection : " << localDirection << endl;
613
614 for(int j = iStripLow; j < iStripHigh; j++) {
615 pStrip = pGap->GetStrip(j);
616
617 if(pStrip->CrossGasChamber(localIntersection, localDirection)) {
618 id = MucID::channel_id(part, seg, gap, j);
619 stripList.push_back(id);
620 }
621 }
622
623 }
624
625 return stripList;
626}
Hep3Vector RotateToGap(const Hep3Vector gVect) const
Rotate a vector from global coordinate to gap coordinate.
Definition: MucGeoGap.cxx:613
int GetStripNum() const
Get SoftID.
Definition: MucGeoGap.h:114
int GuessStrip(const float x, const float y, const float z) const
Definition: MucGeoGap.cxx:346
MucGeoStrip * GetStrip(const int strip) const
Point to a strip within this gap.
Definition: MucGeoGap.cxx:294
vector< Identifier > FindIntersectGaps(const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
bool CrossGasChamber(const HepPoint3D linePoint, const Hep3Vector lineDir) const
Does the line cross this strip?
static int seg(const Identifier &id)
Definition: MucID.cxx:56

Referenced by main(), and MucRec3DRoad::ProjectToStrip().

◆ FindIntersectStrips() [2/2]

vector< Identifier > MucGeoGeneral::FindIntersectStrips ( const int  part,
const int  gap,
const HepPoint3D  gPoint,
const Hep3Vector  gDirection,
vector< int > &  padID,
vector< float > &  intersection_x,
vector< float > &  intersection_y,
vector< float > &  intersection_z 
)

Definition at line 631 of file MucGeoGeneral.cxx.

637{
638 // Find the intersect strip of a trajectory with the given part and gap. The trajectory is
639 // given by the position gPoint and direction gDirection in global coordinate.
640 vector<Identifier> gapList;
641 vector<Identifier> stripList;
642
643 MucGeoGap *pGap;
644 MucGeoStrip *pStrip;
645
646 int seg, iStripGuess, nStripMax;
647 Identifier id;
648 HepPoint3D intersection, localIntersection;
649 Hep3Vector localDirection;
650
651 gapList = FindIntersectGaps(part, gap, gPoint, gDirection);
652
653 for(unsigned int i = 0; i < gapList.size(); i++) {
654 // Get the gap data ...
655 seg = MucID::seg(gapList[i]);
656 pGap = GetGap(part, seg, gap);
657 if(!pGap) {
658 cout << "FindIntersectStrips : bad gap pointer!" << endl;
659 return stripList;
660 }
661
662 intersection = pGap->ProjectToGap(gPoint, gDirection);
663 localIntersection = pGap->TransformToGap(intersection);
664 localDirection = pGap->RotateToGap(gDirection);
665
666 // Search through gap to find the intersect strips.
667 nStripMax = pGap->GetStripNum() - 1;
668 iStripGuess = pGap->GuessStrip(localIntersection.x(),
669 localIntersection.y(),
670 localIntersection.z());
671 //cout << "guess " << iStripGuess << endl;
672
673 int iStripLow = iStripGuess - 2;
674 int iStripHigh = iStripGuess + 2;
675 iStripLow = max(0, iStripLow);
676 iStripHigh = min(nStripMax, iStripHigh);
677
678 iStripLow = 0;
679 iStripHigh = nStripMax;
680
681 //cout << "intersection : " << intersection << endl
682 // << "localIntersection : " << localIntersection << endl
683 // << "localDirection : " << localDirection << endl;
684
685 for(int j = iStripLow; j < iStripHigh; j++) {
686 pStrip = pGap->GetStrip(j);
687
688 if(pStrip->CrossGasChamber(localIntersection, localDirection)) {
689 //get id of intersect strip, now calc pad id!
690 /*
691 cout<<"Strip: ("<<part<<", "<<seg<<", "<<gap<<", "<<j<<")"<<endl;
692 cout<<"xmin: "<<pStrip->GetXmin()<<" xmax: "<<pStrip->GetXmax()<<endl;
693 cout<<"ymin: "<<pStrip->GetYmin()<<" ymax: "<<pStrip->GetYmax()<<endl;
694 cout<<"zmin: "<<pStrip->GetZmin()<<" zmax: "<<pStrip->GetZmax()<<endl;
695 */
696 float posx,posy,posz;
697 pStrip->GetCenterPos(posx,posy,posz);
698 /*
699 cout<<"orient: "<<pGap->Orient()<<endl;
700 cout<<"center pos: "<<posx<<" "<<posy<<" "<<posz<<endl;
701 cout<<"inter pos: "<<localIntersection<<endl;
702 */
703 int padid = -1;
704 if(pGap->Orient() == 1)
705 padid = (localIntersection.y() - pStrip->GetYmin())/(pStrip->GetXmax() - pStrip->GetXmin());
706 else
707 padid = (localIntersection.x() - pStrip->GetXmin())/(pStrip->GetYmax() - pStrip->GetYmin());
708
709 //cout<<"padID: "<<padid<<endl;
710 padID.push_back(padid);
711 intersection_x.push_back(localIntersection.x());
712 intersection_y.push_back(localIntersection.y());
713 intersection_z.push_back(localIntersection.z());
714
715 id = MucID::channel_id(part, seg, gap, j);
716 stripList.push_back(id);
717 }
718 }
719
720 }
721
722 return stripList;
723}
int Orient() const
Definition: MucGeoGap.h:108
float GetYmin() const
Get position of low-Y edge in the gap coordinate system.
Definition: MucGeoStrip.h:80
float GetXmax() const
Get position of high-X edge in the gap coordinate system.
Definition: MucGeoStrip.h:77
float GetXmin() const
Get position of low-X edge in the gap coordinate system.
Definition: MucGeoStrip.h:74
float GetYmax() const
Get position of high-Y edge in the gap coordinate system.
Definition: MucGeoStrip.h:83
void GetCenterPos(float &x, float &y, float &z) const
Get center position of this strip (in the gap coordinate system).
Definition: MucGeoStrip.cxx:40

◆ GetGap() [1/2]

MucGeoGap * MucGeoGeneral::GetGap ( const Identifier  id) const

Get a pointer to the gap identified by Indentifier.

Definition at line 461 of file MucGeoGeneral.cxx.

462{
463 // Get a pointer to the gap identified by Identifier.
465 MucID::seg(id),
466 MucID::gap(id),
467 0);
468
469 return m_gpMucGeoGap[gapID];
470}
static int part(const Identifier &id)
Definition: MucID.cxx:46
static int gap(const Identifier &id)
Definition: MucID.cxx:66

◆ GetGap() [2/2]

MucGeoGap * MucGeoGeneral::GetGap ( const int  part,
const int  seg,
const int  gap 
) const

◆ GetStrip() [1/2]

MucGeoStrip * MucGeoGeneral::GetStrip ( const Identifier  id) const

Get a pointer to the strip identified by Indentifier.

Definition at line 485 of file MucGeoGeneral.cxx.

486{
487 // Get a pointer to the strip identified Identifier.
488 return m_gpMucGeoStrip[id];
489}

◆ GetStrip() [2/2]

MucGeoStrip * MucGeoGeneral::GetStrip ( const int  part,
const int  seg,
const int  gap,
const int  strip 
) const

Get a pointer to the strip identified by (part,seg,gap,strip).

Definition at line 473 of file MucGeoGeneral.cxx.

477{
478 // Get a pointer to the strip identified by (part, seg, gap, strip).
479 Identifier id = MucID::channel_id(part, seg, gap, strip);
480
481 return m_gpMucGeoStrip[id];
482}

Referenced by MucGeomSvc::GetStrip(), main(), and MucRecHit::MucRecHit().

◆ GetStripNumInGap()

int MucGeoGeneral::GetStripNumInGap ( const int  part,
const int  seg,
const int  gap 
)
inline

Definition at line 96 of file MucGeoGeneral.h.

97 { return m_StripNumInGap[part][seg][gap]; }

Referenced by GetStripNumTotal().

◆ GetStripNumTotal()

int MucGeoGeneral::GetStripNumTotal ( )

Get total number of strips.

Definition at line 492 of file MucGeoGeneral.cxx.

493{
494 int nStripTotal = 0;
495 for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
496 for(unsigned int seg = 0; seg < MucID::getSegNum(part); seg++) {
497 for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) {
498 nStripTotal += GetStripNumInGap(part, seg, gap);
499 }
500 }
501 }
502
503 return nStripTotal;
504}
int GetStripNumInGap(const int part, const int seg, const int gap)
Definition: MucGeoGeneral.h:96

Referenced by MucGeomSvc::Dump().

◆ Init()

void MucGeoGeneral::Init ( )

Initialize the instance of MucGeoGeneral.

Definition at line 80 of file MucGeoGeneral.cxx.

81{
82 for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
83 for(unsigned int seg = 0; seg < MucID::getSegMax(); seg++) {
84 for(unsigned int gap = 0; gap < MucID::getGapMax(); gap++) {
85 m_StripNumInGap[part][seg][gap] = 0;
86 }
87 }
88 }
89}
static value_type getGapMax()
Definition: MucID.cxx:195
static value_type getSegMax()
Definition: MucID.cxx:188

Referenced by main().

◆ InitFromASCII()

void MucGeoGeneral::InitFromASCII ( )

Initialize form ASCII.

Definition at line 162 of file MucGeoGeneral.cxx.

163{
164 // Initialize Bes MUC Geometry for ASCII files.
165 string gapSizeFile = "muc-gap-size.dat";
166 string gapGeomFile = "muc-gap-geom.dat";
167 string stripSizeFile = "muc-strip-size.dat";
168 string stripGeomFile = "muc-strip-geom.dat";
169
170 static const int bufSize=512;
171 char lineBuf[bufSize];
172
173 //
174 // File gapSizeFile contains the gap sizes.
175 //
176
177 ifstream ifGapSize(gapSizeFile.c_str());
178 if(!ifGapSize) {
179 cout << "error opening gap size data file : "
180 << gapSizeFile
181 << endl;
182 return;
183 }
184
185 int part, seg, gap, strip, orient, panel;
186 float xGapTemp, yGapTemp, zGapTemp;
187 float xGapSize[m_kPartNum][m_kSegMax][m_kGapMax];
188 float yGapSize[m_kPartNum][m_kSegMax][m_kGapMax];
189 float zGapSize[m_kPartNum][m_kSegMax][m_kGapMax];;
190
191 // Read the data line by line until we reach EOF.
192
193 while ( ifGapSize.getline(lineBuf,bufSize,'\n')) {
194 if (ifGapSize.gcount() > bufSize) {
195 cout << "input buffer too small! gcount = " << ifGapSize.gcount()
196 << endl;
197 return;
198 }
199
200 istrstream stringBuf(lineBuf,strlen(lineBuf));
201
202 if (stringBuf >> part >> seg >> gap >> xGapTemp >> yGapTemp >> zGapTemp) {
203 xGapSize[part][seg][gap] = xGapTemp;
204 yGapSize[part][seg][gap] = yGapTemp;
205 zGapSize[part][seg][gap] = zGapTemp;
206
207 //cout << part << " " << seg << " " << gap << " "
208 // << " x " << xGapSize[part][seg][gap]
209 // << " y " << yGapSize[part][seg][gap]
210 // << " z " << zGapSize[part][seg][gap]
211 // << endl;
212 }
213 else {
214 // Skip any header or comment lines.
215 // cout << "read comment line" << endl;
216 }
217 }
218
219 ifGapSize.close();
220
221 //
222 // File stripSizeFile contains the strip sizes.
223 //
224
225 ifstream ifStripSize(stripSizeFile.c_str());
226 if (!ifStripSize) {
227 cout << "error opening strip size data file : "
228 << stripSizeFile
229 << endl;
230 return;
231 }
232
233 float xStripTemp, yStripTemp, zStripTemp;
234 float xStripSize[m_kPartNum][m_kSegMax][m_kGapMax][m_kStripMax];
235 float yStripSize[m_kPartNum][m_kSegMax][m_kGapMax][m_kStripMax];
236 float zStripSize[m_kPartNum][m_kSegMax][m_kGapMax][m_kStripMax];
237
238 // Read the data line by line until we reach EOF.
239
240 while (ifStripSize.getline(lineBuf,bufSize,'\n')) {
241
242 if (ifStripSize.gcount() > bufSize) {
243 cout << "input buffer too small! gcount = " << ifStripSize.gcount()
244 << endl;
245 return;
246 }
247
248 istrstream stringBuf(lineBuf,strlen(lineBuf));
249
250 if (stringBuf >> part >> seg >> gap >> strip >> xStripTemp >> yStripTemp >> zStripTemp) {
251 xStripSize[part][seg][gap][strip] = xStripTemp;
252 yStripSize[part][seg][gap][strip] = yStripTemp;
253 zStripSize[part][seg][gap][strip] = zStripTemp;
254
255 m_StripNumInGap[part][seg][gap]++;
256 //cout << part << " " << seg << " " << gap << " "
257 // << strip << " "
258 // << " x " << xStripSize[part][seg][gap][strip]
259 // << " y " << yStripSize[part][seg][gap][strip]
260 // << " z " << zStripSize[part][seg][gap][strip]
261 // << endl;
262 }
263 else {
264 // Skip any header or comment lines.
265 // cout << "read comment line" << endl;
266 }
267 }
268
269 ifStripSize.close();
270
271 //for(int part = 0; part < MucSoftID::m_kPart; part++) {
272 //for(int seg = 0; seg < MucSoftID::m_kSegInPartMax; seg++) {
273 // for(int gap = 0; gap < MucSoftID::m_kGapInSegMax; gap++) {
274 //cout << "nStrips In part " << part << " seg " << seg << " gap " << gap << " is "
275 // << m_NStripInGap[part][seg][gap] << endl;
276 // }
277 //}
278 //}
279
280 //
281 // File gapGeomFile contains the gap positions, etc.
282 //
283
284 ifstream ifGapGeom(gapGeomFile.c_str());
285 if (!ifGapGeom) {
286 cout << "error opening gap geometry data file : "
287 << gapGeomFile
288 << endl;
289 return;
290 }
291
292 float xGapTarg1, yGapTarg1, zGapTarg1;
293 float xGapTarg2, yGapTarg2, zGapTarg2;
294 float xGapTarg3, yGapTarg3, zGapTarg3;
295 float dzHighEdge;
296
297 float dzFarFrontGas, dzNearFrontGas;
298 float dzFarBackGas, dzNearBackGas;
299
300 float dxTarget1ToFiducial, dyTarget1ToFiducial;
301 float dxFiducialToCenter, dyFiducialToCenter;
302
303 Identifier gapID = MucID::channel_id(0,0,0,0);
304 Identifier stripID = MucID::channel_id(0,0,0,0);
305
306 // Read the gap geometry data line by line until we reach EOF.
307
308 while (ifGapGeom.getline(lineBuf,bufSize,'\n')) {
309
310 if ( ifGapGeom.gcount() > bufSize ) {
311 cout << "input buffer too small! gcount = " << ifGapGeom.gcount()
312 << endl;
313 return;
314 }
315
316 istrstream stringBuf(lineBuf,strlen(lineBuf));
317
318 if ( stringBuf >> part >> seg >> gap >> orient
319 >> xGapTarg1 >> yGapTarg1 >> zGapTarg1
320 >> xGapTarg2 >> yGapTarg2 >> zGapTarg2
321 >> xGapTarg3 >> yGapTarg3 >> zGapTarg3
322 >> dzHighEdge
323 >> dzFarFrontGas >> dzNearFrontGas
324 >> dzNearBackGas >> dzFarBackGas
325 >> dxTarget1ToFiducial
326 >> dyTarget1ToFiducial
327 >> dxFiducialToCenter
328 >> dyFiducialToCenter ) {
329
330 //cout << " " << part << " " << seg << " " << gap
331 // << " " << xGapTarg1 << " " << yGapTarg1 << " " << zGapTarg1
332 // << " " << xGapTarg2 << " " << yGapTarg2 << " " << zGapTarg2
333 // << " " << xGapTarg3 << " " << yGapTarg3 << " " << zGapTarg3
334 // << " " << dzHighEdge
335 // << " " << dzFarFrontGas << " " << dzNearFrontGas
336 // << " " << dzFarBackGas << " " << dzNearBackGas
337 // << " " << dxTarget1ToFiducial << " " << dyTarget1ToFiducial
338 // << " " << dxFiducialToCenter << " " << dyFiducialToCenter
339 // << endl;
340
341 gapID = MucID::channel_id(part,seg,gap,0);
342
343 MucGeoGap *pGap = new MucGeoGap(part, seg, gap,
344 orient, 0,
345 xGapSize[part][seg][gap],
346 yGapSize[part][seg][gap],
347 zGapSize[part][seg][gap],
348 xGapTarg1, yGapTarg1, zGapTarg1,
349 xGapTarg2, yGapTarg2, zGapTarg2,
350 xGapTarg3, yGapTarg3, zGapTarg3,
351 dzHighEdge,
352 dzFarFrontGas, dzNearFrontGas,
353 dzNearBackGas, dzFarBackGas,
354 dxTarget1ToFiducial,
355 dyTarget1ToFiducial,
356 dxFiducialToCenter,
357 dyFiducialToCenter);
358 m_gpMucGeoGap[gapID] = pGap;
359 }
360 else {
361 // Skip any header or comment lines.
362 // cout << "read comment line" << endl;
363 }
364
365 }
366
367 ifGapGeom.close();
368
369 //
370 // File stripGeomFile contains the strip positions, etc.
371 //
372
373 ifstream ifStripGeom(stripGeomFile.c_str());
374 if (!ifStripGeom) {
375 cout << "error opening strip geometry data file"
376 << stripGeomFile
377 << endl;
378 return;
379 }
380
381 // Read the strip geometry data line by line until we reach EOF.
382
383 float xStripTarg1, yStripTarg1, xStripTarg2, yStripTarg2;
384
385 while (ifStripGeom.getline(lineBuf,bufSize,'\n')) {
386
387 if (ifStripGeom.gcount() > bufSize) {
388 cout << "input buffer too small! gcount = " << ifStripGeom.gcount()
389 << endl;
390 return;
391 }
392
393 istrstream stringBuf(lineBuf,strlen(lineBuf));
394
395 if (stringBuf >> part >> seg >> gap >> strip >> panel
396 >> xStripTarg1 >> xStripTarg2
397 >> yStripTarg1 >> yStripTarg2) {
398
399 // cout << part << " " << seg << " " << gap << " "
400 // << strip << " " << panel << " " << orient << " "
401 // << xStripTarg1 << " " << xStripTarg2 << " "
402 // << yStripTarg1 << " " << yStripTarg2
403 // << endl;
404
405 MucGeoStrip* pStrip = 0;
406 stripID = MucID::channel_id(part,seg,gap,strip);
407 gapID = MucID::channel_id(part,seg,gap,0);
408
409 if (!m_gpMucGeoStrip[stripID]) {
410 if (m_gpMucGeoGap[gapID]) {
411 pStrip = m_gpMucGeoGap[gapID]->AddStrip(strip);
412 pStrip->SetStrip(xStripTarg1, xStripTarg2,
413 yStripTarg1, yStripTarg2,
414 xStripSize[part][seg][gap][strip],
415 yStripSize[part][seg][gap][strip],
416 zStripSize[part][seg][gap][strip]);
417 m_gpMucGeoStrip[stripID] = pStrip;
418 }
419 else {
420 cout << "missing gap" << gapID << endl;
421 continue;
422 }
423 }
424
425 }
426 else {
427 // Skip any header or comment lines.
428 // cout << "read comment line" << endl;
429 }
430
431 }
432
433 ifStripGeom.close();
434
435 m_gGeometryInit = 1;
436}
void SetStrip(const float x1, const float x2, const float y1, const float y2, const float xSize, const float ySize, const float zSize)
Set the edge, center and sigma of the strip (in the gap coordinate system).
Definition: MucGeoStrip.cxx:62
std::ifstream ifstream
Definition: bpkt_streams.h:44

◆ InitFromDatabase()

void MucGeoGeneral::InitFromDatabase ( )

Initialize from database.

◆ InitFromXML()

void MucGeoGeneral::InitFromXML ( )

Initialize from xml.

Definition at line 92 of file MucGeoGeneral.cxx.

93{
94 //new TRint("ROOT GDML converter", 0, 0);
95
96 // Initialize Bes Muc Geometry for XML files.
97 bool geomanager = true;
98 if (!gGeoManager) {
99 gGeoManager = new TGeoManager("BesGeo", "Bes geometry");
100 geomanager = false;
101 }
102 //gGeoManager->SetVisOption(0); // to show all visible volumes.
103 //gGeoManager->SetVisLevel(5);
104
105 MucROOTGeo *m_MucROOTGeo = new MucROOTGeo();
106
107 TGeoVolume *volMuc = m_MucROOTGeo->GetVolumeMuc();
108 if(volMuc) std::cout << "Construct Muc from Muc.gdml" << std::endl;
109 else std::cout << "volume Muc not found " << std::endl;
110
111 float m_BesR = 5200;
112 float m_BesZ = 5680;
113 TGeoIdentity *identity = new TGeoIdentity();
114
115 TGeoMaterial *mat = new TGeoMaterial("VOID",0,0,0);
116 TGeoMedium *med = new TGeoMedium("MED",1,mat);
117 TGeoVolume *m_Bes = gGeoManager->MakeBox("volBes", med, 0.5*m_BesR, 0.5*m_BesR, 0.5*m_BesZ);
118 gGeoManager->SetTopVolume(m_Bes);
119 m_Bes->AddNode(volMuc, 0, identity);
120 m_MucROOTGeo->SetChildNo(m_Bes->GetNdaughters()-1);
121
122 gGeoManager->SetDrawExtraPaths(); // draw physical node or not;
123 if(!geomanager)gGeoManager->CloseGeometry();
124 gGeoManager->SetNsegments(20);
125
126 m_MucROOTGeo->SetPhysicalNode();
127
128 for (int part = 0; part < m_MucROOTGeo->GetPartNum(); part++) {
129 for (int seg = 0; seg < m_MucROOTGeo->GetSegNum(part); seg++) {
130 for (int gap = 0; gap < m_MucROOTGeo->GetGapNum(part); gap++) {
131 Identifier gapID = MucID::channel_id(part,seg,gap,0);
132
133 float ironThickness = 0.0;
134 if (part == 1) {
135 if (gap > 0) ironThickness = m_MucROOTGeo->GetAbsorberThickness(part, seg, gap-1);
136 }
137 else {
138 ironThickness = m_MucROOTGeo->GetAbsorberThickness(part, seg, gap);
139 }
140 //std::cout << "part " << part << " seg " << seg << " gap " << gap << " thick " << ironThickness << std::endl;
141
142 int orient = 0;
143 if ( (part == 1 && gap % 2 == 0) || (part != 1 && gap % 2 == 1) ) orient = 1;
144 MucGeoGap *pGap = new MucGeoGap(part, seg, gap, orient, 0, m_MucROOTGeo->GetPhysicalGap(part, seg, gap), ironThickness);
145 m_gpMucGeoGap[gapID] = pGap;
146
147 for (int strip = 0; strip < m_MucROOTGeo->GetStripNum(part, seg, gap); strip++) {
148 Identifier stripID = MucID::channel_id(part,seg,gap,strip);
149
150 MucGeoStrip* pStrip = m_gpMucGeoGap[gapID]->AddStrip(strip);
151 pStrip->SetStrip(m_MucROOTGeo->GetPhysicalStrip(part, seg, gap, strip));
152 m_gpMucGeoStrip[stripID] = pStrip;
153 }
154 }
155 }
156 }
157
158 m_gGeometryInit = 1;
159}
void SetPhysicalNode()
Set the pointers to the physical nodes;.
float GetAbsorberThickness(int part, int seg, int absorber)
Get thickness of an absorber;.
TGeoPhysicalNode * GetPhysicalStrip(int part, int seg, int gap, int strip)
Get strip physical node;.
int GetSegNum(int part)
Get number of segment on part;.
TGeoPhysicalNode * GetPhysicalGap(int part, int seg, int gap)
Get rpc gas chamber node;
int GetStripNum(int part, int seg, int gap)
Get number of strip on gap;.
int GetGapNum(int part)
Get number of gap on part;.

◆ Instance()

◆ operator=()

MucGeoGeneral & MucGeoGeneral::operator= ( const MucGeoGeneral orig)

Assignment constructor.

Definition at line 67 of file MucGeoGeneral.cxx.

68{
69 // Assignment operator.
70 if ( this != &orig ) { // Watch out for self-assignment!
71 m_gpMucGeoGeneral = orig.m_gpMucGeoGeneral;
72 m_gpMucGeoGap = orig.m_gpMucGeoGap;
73 m_gpMucGeoStrip = orig.m_gpMucGeoStrip;
74 }
75 return *this;
76}

The documentation for this class was generated from the following files: