#include <MucGeoGeneral.h>
Public Member Functions | |
MucGeoGeneral () | |
Constructor. | |
MucGeoGeneral & | operator= (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. | |
MucGeoGap * | GetGap (const int part, const int seg, const int gap) const |
Get a pointer to the gap identified by (part,seg,gap). | |
MucGeoGap * | GetGap (const Identifier id) const |
Get a pointer to the gap identified by Indentifier. | |
MucGeoStrip * | 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). | |
MucGeoStrip * | GetStrip (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< Identifier > | FindIntersectGaps (const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection) |
vector< Identifier > | FindIntersectStrips (const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection) |
vector< Identifier > | 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) |
vector< HepPoint3D > | FindIntersections (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 MucGeoGeneral * | Instance () |
Get a pointer to the single instance of MucGeoGeneral. | |
Private Attributes | |
int | m_StripNumInGap [m_kPartNum][m_kSegMax][m_kGapMax] |
Static Private Attributes | |
static int | m_gGeometryInit = 0 |
static MucGeoGeneral * | m_gpMucGeoGeneral = 0L |
static map< Identifier, MucGeoGap * > | m_gpMucGeoGap = map<Identifier, MucGeoGap*>() |
static map< Identifier, MucGeoStrip * > | m_gpMucGeoStrip = map<Identifier, MucGeoStrip*>() |
static const int | m_kPartNum = 3 |
static const int | m_kSegMax = 8 |
static const int | m_kGapMax = 9 |
static const int | m_kStripMax = 112 |
Definition at line 50 of file MucGeoGeneral.h.
MucGeoGeneral::MucGeoGeneral | ( | ) |
MucGeoGeneral::MucGeoGeneral | ( | const MucGeoGeneral & | orig | ) |
Copy constructor.
MucGeoGeneral::~MucGeoGeneral | ( | ) |
Destructor.
Definition at line 46 of file MucGeoGeneral.cxx.
References iter(), m_gpMucGeoGap, and m_gpMucGeoStrip.
00047 { 00048 // Destructor. 00049 MucGeoGap* pGap = 0; 00050 while(m_gpMucGeoGap.size() > 0){ 00051 map<Identifier, MucGeoGap*>::iterator iter = m_gpMucGeoGap.end(); 00052 pGap = (*iter).second; 00053 delete pGap; 00054 m_gpMucGeoGap.erase(iter); 00055 } 00056 00057 MucGeoStrip* pStrip = 0; 00058 while(m_gpMucGeoStrip.size() > 0){ 00059 map<Identifier, MucGeoStrip*>::iterator iter = m_gpMucGeoStrip.end(); 00060 pStrip = (*iter).second; 00061 delete pStrip; 00062 m_gpMucGeoStrip.erase(iter); 00063 } 00064 }
void MucGeoGeneral::Clear | ( | ) |
Clear the fgpMucGeoGap and fgpMucGeoStrip vector containers.
void MucGeoGeneral::Destroy | ( | ) |
Destroy the single instance of MucGeoGeneral.
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.
References MucID::channel_id(), cos(), GetGap(), MucID::getSegNum(), intersection(), MucGeoGap::IsInGap(), MucGeoGap::ProjectToGap(), and MucGeoGap::TransformToGap().
Referenced by FindIntersectStrips(), and main().
00511 { 00512 // Find the intersect gap of a trajectory with the given part and gap. The trajectory is 00513 // given by the position gPoint and direction gDirection in global coordinate. 00514 vector<Identifier> gapList; 00515 00516 MucGeoGap *pGap = 0; 00517 Identifier id = MucID::channel_id(0,0,0,0); 00518 HepPoint3D intersection, localIntersection; 00519 Hep3Vector intersectionDir; 00520 double cos = -1; 00521 00522 for(unsigned int seg = 0; seg < MucID::getSegNum(part); seg++) { 00523 id = MucID::channel_id(part, seg, gap, 0); 00524 pGap = GetGap(id); 00525 if( pGap ) { 00526 intersection = pGap->ProjectToGap(gPoint, gDirection); 00527 localIntersection = pGap->TransformToGap(intersection); 00528 00529 intersectionDir = ((CLHEP::Hep3Vector)intersection) - ((CLHEP::Hep3Vector)gPoint); 00530 if( intersectionDir.mag() == 0 ) { 00531 cos = 0.0; 00532 } 00533 else { 00534 cos = intersectionDir.dot(gDirection) / 00535 ( intersectionDir.mag() * gDirection.mag() ); 00536 } 00537 00538 if( ( cos >= 0.0 ) && 00539 ( pGap->IsInGap(localIntersection.x(), 00540 localIntersection.y(), 00541 localIntersection.z()) ) ) { 00542 id = MucID::channel_id(part, seg, gap, 0); 00543 gapList.push_back(id); 00544 } 00545 else { 00546 } 00547 00548 } 00549 else{ 00550 std::cout << "MucGeoGeneral::FindIntersectGaps(), Bad gap Pointer" 00551 << " part " << part 00552 << " seg " << seg 00553 << " gap " << gap 00554 << std::endl; 00555 } 00556 } 00557 00558 return gapList; 00559 }
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.
References GetGap(), MucID::getGapNum(), MucID::getPartNum(), MucGeoGap::ProjectToGap(), and MucGeoGap::TransformToGap().
01003 { 01004 x1 = 0.0; sigmaX = 0.0; x2 = 0.0; 01005 y1 = 0.0; sigmaY = 0.0; y2 = 0.0; 01006 z1 = 0.0; sigmaZ = 0.0; z2 = 0.0; 01007 01008 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) { 01009 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = " 01010 << part << endl; 01011 return; 01012 } 01013 01014 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) { 01015 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = " 01016 // << gap << endl; 01017 return; 01018 } 01019 01020 // "Brute-force" algorithm. 01021 // 1a. Find intersection with gap. 01022 // 1b. Transform intersection position to gap coords. 01023 // 2. Check intersection position against gap boundaries. 01024 // Save the intersection position and gap id if within 01025 // boundaries. 01026 01027 //bool found = false; 01028 float distance = 1e30; 01029 01030 MucGeoGap *p = GetGap(part, seg, gap); 01031 if (p) { 01032 01033 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection 01034 01035 01036 01037 HepPoint3D cross1(0,0,0), cross2(0,0,0); 01038 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl; 01039 HepPoint3D r = p->ProjectToGap(r0, vy, y0, a, b, c,whichhalf, cross1, cross2); 01040 //cout<<"in MucGeoGeneral r_quad = "<<r<<endl; 01041 HepPoint3D localIntersection = p->TransformToGap(r); 01042 //cout << "intersect gap point " << r << " local " << localIntersection << endl; 01043 01044 distance = r.distance(r0); 01045 01046 x1 = cross1.x(); 01047 y1 = cross1.y(); 01048 z1 = cross1.z(); 01049 01050 x2 = cross2.x(); 01051 y2 = cross2.y(); 01052 z2 = cross2.z(); 01053 01054 // Should be in Gap? 01055 // No, return intersection position however. 01056 01057 //if ( p->IsInGap(localIntersection.x(), 01058 // localIntersection.y(), 01059 // localIntersection.z()) ) { 01060 //cout << "found project in gap" << endl; 01061 // found = true; 01062 //} 01063 //else{ 01064 //cout << " not in gap" << endl; 01065 //} 01066 } 01067 01068 else { 01069 cout << "FindIntersection-E103 bad panel pointer!" 01070 << " Part" << part << " Seg" << seg << " Gap" << gap << endl; 01071 } 01072 01073 // FIXME: need a calculation of the uncertainty in the intercept! 01074 01075 return; 01076 }
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.
References GetGap(), MucID::getGapNum(), MucID::getPartNum(), MucGeoGap::ProjectToGap(), MucGeoGap::TransformToGap(), and v.
Referenced by MucRec2DRoad::GetSearchWindowSize(), MucRec3DRoad::Project(), MucRec2DRoad::Project(), MucRec3DRoad::ProjectNoCurrentGap(), and MucRec3DRoad::ProjectWithSigma().
00804 { 00805 x = 0.0; sigmaX = 0.0; 00806 y = 0.0; sigmaY = 0.0; 00807 z = 0.0; sigmaZ = 0.0; 00808 00809 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) { 00810 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = " 00811 << part << endl; 00812 return; 00813 } 00814 00815 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) { 00816 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = " 00817 // << gap << endl; 00818 return; 00819 } 00820 00821 // "Brute-force" algorithm. 00822 // 1a. Find intersection with gap. 00823 // 1b. Transform intersection position to gap coords. 00824 // 2. Check intersection position against gap boundaries. 00825 // Save the intersection position and gap id if within 00826 // boundaries. 00827 00828 //bool found = false; 00829 float distance = 1e30; 00830 00831 MucGeoGap *p = GetGap(part, seg, gap); 00832 if (p) { 00833 00834 Hep3Vector v(vx, vy, vz); 00835 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection 00836 00837 //Hep3Vector vSigma(sigmaVx, sigmaVy, sigmaVz); 00838 //HepPoint3D r0Sigma(sigmaX0, sigmaY0, sigmaZ0); 00839 00840 //HepPoint3D gCross(0.0, 0.0, 0.0); 00841 //HepPoint3D gCrossSigma(0.0, 0.0, 0.0); 00842 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl; 00843 //HepPoint3D r = p->ProjectToGapWithSigma(r0, v, r0Sigma, vSigma, gCross, gCrossSigma); 00844 HepPoint3D r = p->ProjectToGap(r0, v); 00845 HepPoint3D localIntersection = p->TransformToGap(r); 00846 //cout << "intersect gap point " << r << " local " << localIntersection << endl; 00847 00848 00849 distance = r.distance(r0); 00850 00851 x = r.x(); 00852 y = r.y(); 00853 z = r.z(); 00854 00855 //sigmaX = gCrossSigma.x(); 00856 //sigmaY = gCrossSigma.y(); 00857 //sigmaZ = gCrossSigma.z(); 00858 00859 00860 // Should be in Gap? 00861 // No, return intersection position however. 00862 00863 //if ( p->IsInGap(localIntersection.x(), 00864 // localIntersection.y(), 00865 // localIntersection.z()) ) { 00866 //cout << "found project in gap" << endl; 00867 // found = true; 00868 //} 00869 //else{ 00870 //cout << " not in gap" << endl; 00871 //} 00872 00873 00874 } 00875 00876 else { 00877 cout << "FindIntersection-E103 bad panel pointer!" 00878 << " Part" << part << " Seg" << seg << " Gap" << gap << endl; 00879 } 00880 00881 // FIXME: need a calculation of the uncertainty in the intercept! 00882 00883 return; 00884 }
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.
References GetGap(), MucID::getGapNum(), MucID::getPartNum(), MucGeoGap::ProjectToGapQuadLocal(), and MucGeoGap::TransformToGap().
Referenced by MucRec3DRoad::ProjectNoCurrentGap().
00903 { 00904 x1 = 0.0; sigmaX = 0.0; x2 = 0.0; 00905 y1 = 0.0; sigmaY = 0.0; y2 = 0.0; 00906 z1 = 0.0; sigmaZ = 0.0; z2 = 0.0; 00907 00908 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) { 00909 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = " 00910 << part << endl; 00911 return; 00912 } 00913 00914 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) { 00915 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = " 00916 // << gap << endl; 00917 return; 00918 } 00919 00920 00921 float distance = 1e30; 00922 00923 MucGeoGap *p = GetGap(part, seg, gap); 00924 if (p) { 00925 00926 int orient = 0; 00927 if(part == 1 && gap%2 == 0) orient = 1; 00928 if(part != 1 && gap%2 == 1) orient = 1; 00929 00930 HepPoint3D cross1(0,0,0), cross2(0,0,0); 00931 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl; 00932 HepPoint3D r = p->ProjectToGapQuadLocal(part, orient, a, b, c,whichhalf, cross1, cross2); 00933 //cout<<"in MucGeoGeneral r_quad = "<<r<<endl; 00934 HepPoint3D localIntersection = p->TransformToGap(r); 00935 //cout << "intersect gap point " << r << " local " << localIntersection << endl; 00936 00937 00938 x1 = cross1.x(); 00939 y1 = cross1.y(); 00940 z1 = cross1.z(); 00941 00942 x2 = cross2.x(); 00943 y2 = cross2.y(); 00944 z2 = cross2.z(); 00945 00946 // Should be in Gap? 00947 // No, return intersection position however. 00948 00949 //if ( p->IsInGap(localIntersection.x(), 00950 // localIntersection.y(), 00951 // localIntersection.z()) ) { 00952 //cout << "found project in gap" << endl; 00953 // found = true; 00954 //} 00955 //else{ 00956 //cout << " not in gap" << endl; 00957 //} 00958 } 00959 00960 else { 00961 cout << "FindIntersection-E103 bad panel pointer!" 00962 << " Part" << part << " Seg" << seg << " Gap" << gap << endl; 00963 } 00964 00965 return; 00966 00967 }
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.
References cos(), GetGap(), MucID::getSegNum(), intersection(), MucGeoGap::IsInGap(), MucGeoGap::ProjectToGap(), and MucGeoGap::TransformToGap().
Referenced by main(), and RecMucTrack::Project().
00735 { 00736 // Find the intersection position of a trajectory with the given part and gap. 00737 // The trajectory is given by the position and direction in global coordinate. 00738 vector<HepPoint3D> intersectionList; 00739 MucGeoGap* pGap; 00740 00741 HepPoint3D intersection, localIntersection; 00742 Hep3Vector intersectionDir; 00743 double cos = -1; 00744 00745 for(unsigned int seg = 0; seg < MucID::getSegNum(part); seg++ ) { 00746 pGap = GetGap(part, seg, gap); 00747 if( pGap ) { 00748 intersection = pGap->ProjectToGap(gPoint, gDirection); 00749 localIntersection = pGap->TransformToGap(intersection); 00750 //cout << localIntersection << endl; 00751 00752 intersectionDir = ((CLHEP::Hep3Vector)intersection) - ((CLHEP::Hep3Vector)gPoint); 00753 if( intersectionDir.mag() == 0 ) { 00754 cos = 0.0; 00755 } 00756 else { 00757 cos = intersectionDir.dot(gDirection) / 00758 ( intersectionDir.mag() * gDirection.mag() ); 00759 } 00760 00761 if( ( cos >= 0.0 ) && 00762 ( pGap->IsInGap(localIntersection.x(), 00763 localIntersection.y(), 00764 localIntersection.z()) ) ) { 00765 intersectionList.push_back(intersection); 00766 } 00767 else { 00768 } 00769 } 00770 else{ 00771 } 00772 } 00773 00774 return intersectionList; 00775 }
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.
References GetGap(), MucID::getGapNum(), MucID::getPartNum(), and MucGeoGap::ProjectToGapSurface().
01214 { 01215 x1 = 0.0; sigmaX = 0.0; x2 = 0.0; 01216 y1 = 0.0; sigmaY = 0.0; y2 = 0.0; 01217 z1 = 0.0; sigmaZ = 0.0; z2 = 0.0; 01218 01219 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) { 01220 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = " 01221 << part << endl; 01222 return; 01223 } 01224 01225 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) { 01226 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = " 01227 // << gap << endl; 01228 return; 01229 } 01230 01231 // "Brute-force" algorithm. 01232 // 1a. Find intersection with gap. 01233 // 1b. Transform intersection position to gap coords. 01234 // 2. Check intersection position against gap boundaries. 01235 // Save the intersection position and gap id if within 01236 // boundaries. 01237 01238 //bool found = false; 01239 float distance = 1e30; 01240 01241 MucGeoGap *p = GetGap(part, seg, gap); 01242 if (p) { 01243 01244 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection 01245 01246 01247 01248 HepPoint3D cross1(0,0,0), cross2(0,0,0); 01249 p->ProjectToGapSurface(r0, vy, y0, a, b, c,whichhalf, cross1, cross2); 01250 01251 01252 x1 = cross1.x(); 01253 y1 = cross1.y(); 01254 z1 = cross1.z(); 01255 01256 x2 = cross2.x(); 01257 y2 = cross2.y(); 01258 z2 = cross2.z(); 01259 01260 // Should be in Gap? 01261 // No, return intersection position however. 01262 01263 //if ( p->IsInGap(localIntersection.x(), 01264 // localIntersection.y(), 01265 // localIntersection.z()) ) { 01266 //cout << "found project in gap" << endl; 01267 // found = true; 01268 //} 01269 //else{ 01270 //cout << " not in gap" << endl; 01271 //} 01272 } 01273 01274 else { 01275 cout << "FindIntersection-E103 bad panel pointer!" 01276 << " Part" << part << " Seg" << seg << " Gap" << gap << endl; 01277 } 01278 01279 // FIXME: need a calculation of the uncertainty in the intercept! 01280 01281 return; 01282 }
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.
References GetGap(), MucID::getGapNum(), MucID::getPartNum(), MucGeoGap::ProjectToGapSurface(), and v.
Referenced by MucRec3DRoad::Project().
01112 { 01113 x1 = 0.0; sigmaX1 = 0.0; 01114 y1 = 0.0; sigmaY1 = 0.0; 01115 z1 = 0.0; sigmaZ1 = 0.0; 01116 x2 = 0.0; sigmaX2 = 0.0; 01117 y2 = 0.0; sigmaY2 = 0.0; 01118 z2 = 0.0; sigmaZ2 = 0.0; 01119 01120 if ( (part < 0) || (part >= (int)MucID::getPartNum()) ) { 01121 cout << "MucGeoGeneral::FindIntersection-E101 invalid part = " 01122 << part << endl; 01123 return; 01124 } 01125 01126 if ( (gap < 0) || (gap >= (int)MucID::getGapNum(part)) ) { 01127 //cout << "MucGeoGeneral::FindIntersection-E102 invalid gap = " 01128 // << gap << endl; 01129 return; 01130 } 01131 01132 // "Brute-force" algorithm. 01133 // 1a. Find intersection with gap. 01134 // 1b. Transform intersection position to gap coords. 01135 // 2. Check intersection position against gap boundaries. 01136 // Save the intersection position and gap id if within 01137 // boundaries. 01138 01139 //bool found = false; 01140 float distance = 1e30; 01141 01142 MucGeoGap *p = GetGap(part, seg, gap); 01143 if (p) { 01144 01145 Hep3Vector v(vx, vy, vz); 01146 HepPoint3D r0(x0, y0, z0); // MucGeoGeneral::FindIntersection 01147 01148 01149 //cout <<"in MucGeoGeneral v ro"<< v << r0 << endl; 01150 01151 HepPoint3D cross1, cross2; 01152 p->ProjectToGapSurface(r0, v, cross1, cross2); 01153 01154 x1 = cross1.x(); 01155 y1 = cross1.y(); 01156 z1 = cross1.z(); 01157 x2 = cross2.x(); 01158 y2 = cross2.y(); 01159 z2 = cross2.z(); 01160 01161 // Should be in Gap? 01162 // No, return intersection position however. 01163 01164 //if ( p->IsInGap(localIntersection.x(), 01165 // localIntersection.y(), 01166 // localIntersection.z()) ) { 01167 //cout << "found project in gap" << endl; 01168 // found = true; 01169 //} 01170 //else{ 01171 //cout << " not in gap" << endl; 01172 //} 01173 } 01174 01175 else { 01176 cout << "FindIntersection-E103 bad panel pointer!" 01177 << " Part" << part << " Seg" << seg << " Gap" << gap << endl; 01178 } 01179 01180 // FIXME: need a calculation of the uncertainty in the intercept! 01181 01182 return; 01183 }
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.
References MucID::channel_id(), MucGeoStrip::CrossGasChamber(), FindIntersectGaps(), MucGeoStrip::GetCenterPos(), GetGap(), MucGeoGap::GetStrip(), MucGeoGap::GetStripNum(), MucGeoStrip::GetXmax(), MucGeoStrip::GetXmin(), MucGeoStrip::GetYmax(), MucGeoStrip::GetYmin(), MucGeoGap::GuessStrip(), genRecEmupikp::i, intersection(), ganga-rec::j, max, min, MucGeoGap::Orient(), MucGeoGap::ProjectToGap(), MucGeoGap::RotateToGap(), MucID::seg(), and MucGeoGap::TransformToGap().
00637 { 00638 // Find the intersect strip of a trajectory with the given part and gap. The trajectory is 00639 // given by the position gPoint and direction gDirection in global coordinate. 00640 vector<Identifier> gapList; 00641 vector<Identifier> stripList; 00642 00643 MucGeoGap *pGap; 00644 MucGeoStrip *pStrip; 00645 00646 int seg, iStripGuess, nStripMax; 00647 Identifier id; 00648 HepPoint3D intersection, localIntersection; 00649 Hep3Vector localDirection; 00650 00651 gapList = FindIntersectGaps(part, gap, gPoint, gDirection); 00652 00653 for(unsigned int i = 0; i < gapList.size(); i++) { 00654 // Get the gap data ... 00655 seg = MucID::seg(gapList[i]); 00656 pGap = GetGap(part, seg, gap); 00657 if(!pGap) { 00658 cout << "FindIntersectStrips : bad gap pointer!" << endl; 00659 return stripList; 00660 } 00661 00662 intersection = pGap->ProjectToGap(gPoint, gDirection); 00663 localIntersection = pGap->TransformToGap(intersection); 00664 localDirection = pGap->RotateToGap(gDirection); 00665 00666 // Search through gap to find the intersect strips. 00667 nStripMax = pGap->GetStripNum() - 1; 00668 iStripGuess = pGap->GuessStrip(localIntersection.x(), 00669 localIntersection.y(), 00670 localIntersection.z()); 00671 //cout << "guess " << iStripGuess << endl; 00672 00673 int iStripLow = iStripGuess - 2; 00674 int iStripHigh = iStripGuess + 2; 00675 iStripLow = max(0, iStripLow); 00676 iStripHigh = min(nStripMax, iStripHigh); 00677 00678 iStripLow = 0; 00679 iStripHigh = nStripMax; 00680 00681 //cout << "intersection : " << intersection << endl 00682 // << "localIntersection : " << localIntersection << endl 00683 // << "localDirection : " << localDirection << endl; 00684 00685 for(int j = iStripLow; j < iStripHigh; j++) { 00686 pStrip = pGap->GetStrip(j); 00687 00688 if(pStrip->CrossGasChamber(localIntersection, localDirection)) { 00689 //get id of intersect strip, now calc pad id! 00690 /* 00691 cout<<"Strip: ("<<part<<", "<<seg<<", "<<gap<<", "<<j<<")"<<endl; 00692 cout<<"xmin: "<<pStrip->GetXmin()<<" xmax: "<<pStrip->GetXmax()<<endl; 00693 cout<<"ymin: "<<pStrip->GetYmin()<<" ymax: "<<pStrip->GetYmax()<<endl; 00694 cout<<"zmin: "<<pStrip->GetZmin()<<" zmax: "<<pStrip->GetZmax()<<endl; 00695 */ 00696 float posx,posy,posz; 00697 pStrip->GetCenterPos(posx,posy,posz); 00698 /* 00699 cout<<"orient: "<<pGap->Orient()<<endl; 00700 cout<<"center pos: "<<posx<<" "<<posy<<" "<<posz<<endl; 00701 cout<<"inter pos: "<<localIntersection<<endl; 00702 */ 00703 int padid = -1; 00704 if(pGap->Orient() == 1) 00705 padid = (localIntersection.y() - pStrip->GetYmin())/(pStrip->GetXmax() - pStrip->GetXmin()); 00706 else 00707 padid = (localIntersection.x() - pStrip->GetXmin())/(pStrip->GetYmax() - pStrip->GetYmin()); 00708 00709 //cout<<"padID: "<<padid<<endl; 00710 padID.push_back(padid); 00711 intersection_x.push_back(localIntersection.x()); 00712 intersection_y.push_back(localIntersection.y()); 00713 intersection_z.push_back(localIntersection.z()); 00714 00715 id = MucID::channel_id(part, seg, gap, j); 00716 stripList.push_back(id); 00717 } 00718 } 00719 00720 } 00721 00722 return stripList; 00723 }
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.
References MucID::channel_id(), MucGeoStrip::CrossGasChamber(), FindIntersectGaps(), GetGap(), MucGeoGap::GetStrip(), MucGeoGap::GetStripNum(), MucGeoGap::GuessStrip(), genRecEmupikp::i, intersection(), ganga-rec::j, max, min, MucGeoGap::ProjectToGap(), MucGeoGap::RotateToGap(), MucID::seg(), and MucGeoGap::TransformToGap().
Referenced by main(), and MucRec3DRoad::ProjectToStrip().
00566 { 00567 // Find the intersect strip of a trajectory with the given part and gap. The trajectory is 00568 // given by the position gPoint and direction gDirection in global coordinate. 00569 vector<Identifier> gapList; 00570 vector<Identifier> stripList; 00571 00572 MucGeoGap *pGap; 00573 MucGeoStrip *pStrip; 00574 00575 int seg, iStripGuess, nStripMax; 00576 Identifier id; 00577 HepPoint3D intersection, localIntersection; 00578 Hep3Vector localDirection; 00579 00580 gapList = FindIntersectGaps(part, gap, gPoint, gDirection); 00581 00582 for(unsigned int i = 0; i < gapList.size(); i++) { 00583 // Get the gap data ... 00584 seg = MucID::seg(gapList[i]); 00585 pGap = GetGap(part, seg, gap); 00586 if(!pGap) { 00587 cout << "FindIntersectStrips : bad gap pointer!" << endl; 00588 return stripList; 00589 } 00590 00591 intersection = pGap->ProjectToGap(gPoint, gDirection); 00592 localIntersection = pGap->TransformToGap(intersection); 00593 localDirection = pGap->RotateToGap(gDirection); 00594 00595 // Search through gap to find the intersect strips. 00596 nStripMax = pGap->GetStripNum() - 1; 00597 iStripGuess = pGap->GuessStrip(localIntersection.x(), 00598 localIntersection.y(), 00599 localIntersection.z()); 00600 //cout << "guess " << iStripGuess << endl; 00601 00602 int iStripLow = iStripGuess - 2; 00603 int iStripHigh = iStripGuess + 2; 00604 iStripLow = max(0, iStripLow); 00605 iStripHigh = min(nStripMax, iStripHigh); 00606 00607 iStripLow = 0; 00608 iStripHigh = nStripMax; 00609 00610 //cout << "intersection : " << intersection << endl 00611 // << "localIntersection : " << localIntersection << endl 00612 // << "localDirection : " << localDirection << endl; 00613 00614 for(int j = iStripLow; j < iStripHigh; j++) { 00615 pStrip = pGap->GetStrip(j); 00616 00617 if(pStrip->CrossGasChamber(localIntersection, localDirection)) { 00618 id = MucID::channel_id(part, seg, gap, j); 00619 stripList.push_back(id); 00620 } 00621 } 00622 00623 } 00624 00625 return stripList; 00626 }
MucGeoGap * MucGeoGeneral::GetGap | ( | const Identifier | id | ) | const |
Get a pointer to the gap identified by Indentifier.
Definition at line 461 of file MucGeoGeneral.cxx.
References MucID::channel_id(), MucID::gap(), m_gpMucGeoGap, MucID::part(), and MucID::seg().
00462 { 00463 // Get a pointer to the gap identified by Identifier. 00464 Identifier gapID = MucID::channel_id(MucID::part(id), 00465 MucID::seg(id), 00466 MucID::gap(id), 00467 0); 00468 00469 return m_gpMucGeoGap[gapID]; 00470 }
MucGeoGap * MucGeoGeneral::GetGap | ( | const int | part, | |
const int | seg, | |||
const int | gap | |||
) | const |
Get a pointer to the gap identified by (part,seg,gap).
Definition at line 450 of file MucGeoGeneral.cxx.
References MucID::channel_id(), and m_gpMucGeoGap.
Referenced by RecMucTrack::CalculateInsct(), RecMucTrack::ComputeDepth(), RecMucTrack::ComputeDistanceMatch(), MucRecTrkExt::execute(), FindIntersectGaps(), FindIntersection(), FindIntersectionQuadLocal(), FindIntersections(), FindIntersectionSurface(), FindIntersectStrips(), MucGeomSvc::GetGap(), MucRecLineFit::LineFit(), ExtMucKal::MucKalIniti(), MucRecHit::MucRecHit(), MucRecTrkExt::TrackFinding(), MucRecRoadFinder::TrackFinding(), and ExtSteppingAction::UserSteppingAction().
00453 { 00454 // Get a pointer to the gap identified by (part,seg,gap). 00455 Identifier gapID = MucID::channel_id(part, seg, gap, 0); 00456 00457 return m_gpMucGeoGap[gapID]; 00458 }
MucGeoStrip * MucGeoGeneral::GetStrip | ( | const Identifier | id | ) | const |
Get a pointer to the strip identified by Indentifier.
Definition at line 485 of file MucGeoGeneral.cxx.
References m_gpMucGeoStrip.
00486 { 00487 // Get a pointer to the strip identified Identifier. 00488 return m_gpMucGeoStrip[id]; 00489 }
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.
References MucID::channel_id(), and m_gpMucGeoStrip.
Referenced by MucGeomSvc::GetStrip(), main(), and MucRecHit::MucRecHit().
00477 { 00478 // Get a pointer to the strip identified by (part, seg, gap, strip). 00479 Identifier id = MucID::channel_id(part, seg, gap, strip); 00480 00481 return m_gpMucGeoStrip[id]; 00482 }
int MucGeoGeneral::GetStripNumInGap | ( | const int | part, | |
const int | seg, | |||
const int | gap | |||
) | [inline] |
Definition at line 96 of file MucGeoGeneral.h.
References m_StripNumInGap.
Referenced by GetStripNumTotal().
00097 { return m_StripNumInGap[part][seg][gap]; }
int MucGeoGeneral::GetStripNumTotal | ( | ) |
Get total number of strips.
Definition at line 492 of file MucGeoGeneral.cxx.
References MucID::getGapNum(), MucID::getPartNum(), MucID::getSegNum(), and GetStripNumInGap().
Referenced by MucGeomSvc::Dump().
00493 { 00494 int nStripTotal = 0; 00495 for(unsigned int part = 0; part < MucID::getPartNum(); part++) { 00496 for(unsigned int seg = 0; seg < MucID::getSegNum(part); seg++) { 00497 for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) { 00498 nStripTotal += GetStripNumInGap(part, seg, gap); 00499 } 00500 } 00501 } 00502 00503 return nStripTotal; 00504 }
void MucGeoGeneral::Init | ( | ) |
Initialize the instance of MucGeoGeneral.
Definition at line 80 of file MucGeoGeneral.cxx.
References MucID::getGapMax(), MucID::getPartNum(), MucID::getSegMax(), and m_StripNumInGap.
Referenced by MucGeomSvc::Fill(), and main().
00081 { 00082 for(unsigned int part = 0; part < MucID::getPartNum(); part++) { 00083 for(unsigned int seg = 0; seg < MucID::getSegMax(); seg++) { 00084 for(unsigned int gap = 0; gap < MucID::getGapMax(); gap++) { 00085 m_StripNumInGap[part][seg][gap] = 0; 00086 } 00087 } 00088 } 00089 }
void MucGeoGeneral::InitFromASCII | ( | ) |
Initialize form ASCII.
Definition at line 162 of file MucGeoGeneral.cxx.
References MucID::channel_id(), m_gGeometryInit, m_gpMucGeoGap, m_gpMucGeoStrip, m_kGapMax, m_kPartNum, m_kSegMax, m_kStripMax, m_StripNumInGap, MucGeoStrip::SetStrip(), and deljobs::string.
00163 { 00164 // Initialize Bes MUC Geometry for ASCII files. 00165 string gapSizeFile = "muc-gap-size.dat"; 00166 string gapGeomFile = "muc-gap-geom.dat"; 00167 string stripSizeFile = "muc-strip-size.dat"; 00168 string stripGeomFile = "muc-strip-geom.dat"; 00169 00170 static const int bufSize=512; 00171 char lineBuf[bufSize]; 00172 00173 // 00174 // File gapSizeFile contains the gap sizes. 00175 // 00176 00177 ifstream ifGapSize(gapSizeFile.c_str()); 00178 if(!ifGapSize) { 00179 cout << "error opening gap size data file : " 00180 << gapSizeFile 00181 << endl; 00182 return; 00183 } 00184 00185 int part, seg, gap, strip, orient, panel; 00186 float xGapTemp, yGapTemp, zGapTemp; 00187 float xGapSize[m_kPartNum][m_kSegMax][m_kGapMax]; 00188 float yGapSize[m_kPartNum][m_kSegMax][m_kGapMax]; 00189 float zGapSize[m_kPartNum][m_kSegMax][m_kGapMax];; 00190 00191 // Read the data line by line until we reach EOF. 00192 00193 while ( ifGapSize.getline(lineBuf,bufSize,'\n')) { 00194 if (ifGapSize.gcount() > bufSize) { 00195 cout << "input buffer too small! gcount = " << ifGapSize.gcount() 00196 << endl; 00197 return; 00198 } 00199 00200 istrstream stringBuf(lineBuf,strlen(lineBuf)); 00201 00202 if (stringBuf >> part >> seg >> gap >> xGapTemp >> yGapTemp >> zGapTemp) { 00203 xGapSize[part][seg][gap] = xGapTemp; 00204 yGapSize[part][seg][gap] = yGapTemp; 00205 zGapSize[part][seg][gap] = zGapTemp; 00206 00207 //cout << part << " " << seg << " " << gap << " " 00208 // << " x " << xGapSize[part][seg][gap] 00209 // << " y " << yGapSize[part][seg][gap] 00210 // << " z " << zGapSize[part][seg][gap] 00211 // << endl; 00212 } 00213 else { 00214 // Skip any header or comment lines. 00215 // cout << "read comment line" << endl; 00216 } 00217 } 00218 00219 ifGapSize.close(); 00220 00221 // 00222 // File stripSizeFile contains the strip sizes. 00223 // 00224 00225 ifstream ifStripSize(stripSizeFile.c_str()); 00226 if (!ifStripSize) { 00227 cout << "error opening strip size data file : " 00228 << stripSizeFile 00229 << endl; 00230 return; 00231 } 00232 00233 float xStripTemp, yStripTemp, zStripTemp; 00234 float xStripSize[m_kPartNum][m_kSegMax][m_kGapMax][m_kStripMax]; 00235 float yStripSize[m_kPartNum][m_kSegMax][m_kGapMax][m_kStripMax]; 00236 float zStripSize[m_kPartNum][m_kSegMax][m_kGapMax][m_kStripMax]; 00237 00238 // Read the data line by line until we reach EOF. 00239 00240 while (ifStripSize.getline(lineBuf,bufSize,'\n')) { 00241 00242 if (ifStripSize.gcount() > bufSize) { 00243 cout << "input buffer too small! gcount = " << ifStripSize.gcount() 00244 << endl; 00245 return; 00246 } 00247 00248 istrstream stringBuf(lineBuf,strlen(lineBuf)); 00249 00250 if (stringBuf >> part >> seg >> gap >> strip >> xStripTemp >> yStripTemp >> zStripTemp) { 00251 xStripSize[part][seg][gap][strip] = xStripTemp; 00252 yStripSize[part][seg][gap][strip] = yStripTemp; 00253 zStripSize[part][seg][gap][strip] = zStripTemp; 00254 00255 m_StripNumInGap[part][seg][gap]++; 00256 //cout << part << " " << seg << " " << gap << " " 00257 // << strip << " " 00258 // << " x " << xStripSize[part][seg][gap][strip] 00259 // << " y " << yStripSize[part][seg][gap][strip] 00260 // << " z " << zStripSize[part][seg][gap][strip] 00261 // << endl; 00262 } 00263 else { 00264 // Skip any header or comment lines. 00265 // cout << "read comment line" << endl; 00266 } 00267 } 00268 00269 ifStripSize.close(); 00270 00271 //for(int part = 0; part < MucSoftID::m_kPart; part++) { 00272 //for(int seg = 0; seg < MucSoftID::m_kSegInPartMax; seg++) { 00273 // for(int gap = 0; gap < MucSoftID::m_kGapInSegMax; gap++) { 00274 //cout << "nStrips In part " << part << " seg " << seg << " gap " << gap << " is " 00275 // << m_NStripInGap[part][seg][gap] << endl; 00276 // } 00277 //} 00278 //} 00279 00280 // 00281 // File gapGeomFile contains the gap positions, etc. 00282 // 00283 00284 ifstream ifGapGeom(gapGeomFile.c_str()); 00285 if (!ifGapGeom) { 00286 cout << "error opening gap geometry data file : " 00287 << gapGeomFile 00288 << endl; 00289 return; 00290 } 00291 00292 float xGapTarg1, yGapTarg1, zGapTarg1; 00293 float xGapTarg2, yGapTarg2, zGapTarg2; 00294 float xGapTarg3, yGapTarg3, zGapTarg3; 00295 float dzHighEdge; 00296 00297 float dzFarFrontGas, dzNearFrontGas; 00298 float dzFarBackGas, dzNearBackGas; 00299 00300 float dxTarget1ToFiducial, dyTarget1ToFiducial; 00301 float dxFiducialToCenter, dyFiducialToCenter; 00302 00303 Identifier gapID = MucID::channel_id(0,0,0,0); 00304 Identifier stripID = MucID::channel_id(0,0,0,0); 00305 00306 // Read the gap geometry data line by line until we reach EOF. 00307 00308 while (ifGapGeom.getline(lineBuf,bufSize,'\n')) { 00309 00310 if ( ifGapGeom.gcount() > bufSize ) { 00311 cout << "input buffer too small! gcount = " << ifGapGeom.gcount() 00312 << endl; 00313 return; 00314 } 00315 00316 istrstream stringBuf(lineBuf,strlen(lineBuf)); 00317 00318 if ( stringBuf >> part >> seg >> gap >> orient 00319 >> xGapTarg1 >> yGapTarg1 >> zGapTarg1 00320 >> xGapTarg2 >> yGapTarg2 >> zGapTarg2 00321 >> xGapTarg3 >> yGapTarg3 >> zGapTarg3 00322 >> dzHighEdge 00323 >> dzFarFrontGas >> dzNearFrontGas 00324 >> dzNearBackGas >> dzFarBackGas 00325 >> dxTarget1ToFiducial 00326 >> dyTarget1ToFiducial 00327 >> dxFiducialToCenter 00328 >> dyFiducialToCenter ) { 00329 00330 //cout << " " << part << " " << seg << " " << gap 00331 // << " " << xGapTarg1 << " " << yGapTarg1 << " " << zGapTarg1 00332 // << " " << xGapTarg2 << " " << yGapTarg2 << " " << zGapTarg2 00333 // << " " << xGapTarg3 << " " << yGapTarg3 << " " << zGapTarg3 00334 // << " " << dzHighEdge 00335 // << " " << dzFarFrontGas << " " << dzNearFrontGas 00336 // << " " << dzFarBackGas << " " << dzNearBackGas 00337 // << " " << dxTarget1ToFiducial << " " << dyTarget1ToFiducial 00338 // << " " << dxFiducialToCenter << " " << dyFiducialToCenter 00339 // << endl; 00340 00341 gapID = MucID::channel_id(part,seg,gap,0); 00342 00343 MucGeoGap *pGap = new MucGeoGap(part, seg, gap, 00344 orient, 0, 00345 xGapSize[part][seg][gap], 00346 yGapSize[part][seg][gap], 00347 zGapSize[part][seg][gap], 00348 xGapTarg1, yGapTarg1, zGapTarg1, 00349 xGapTarg2, yGapTarg2, zGapTarg2, 00350 xGapTarg3, yGapTarg3, zGapTarg3, 00351 dzHighEdge, 00352 dzFarFrontGas, dzNearFrontGas, 00353 dzNearBackGas, dzFarBackGas, 00354 dxTarget1ToFiducial, 00355 dyTarget1ToFiducial, 00356 dxFiducialToCenter, 00357 dyFiducialToCenter); 00358 m_gpMucGeoGap[gapID] = pGap; 00359 } 00360 else { 00361 // Skip any header or comment lines. 00362 // cout << "read comment line" << endl; 00363 } 00364 00365 } 00366 00367 ifGapGeom.close(); 00368 00369 // 00370 // File stripGeomFile contains the strip positions, etc. 00371 // 00372 00373 ifstream ifStripGeom(stripGeomFile.c_str()); 00374 if (!ifStripGeom) { 00375 cout << "error opening strip geometry data file" 00376 << stripGeomFile 00377 << endl; 00378 return; 00379 } 00380 00381 // Read the strip geometry data line by line until we reach EOF. 00382 00383 float xStripTarg1, yStripTarg1, xStripTarg2, yStripTarg2; 00384 00385 while (ifStripGeom.getline(lineBuf,bufSize,'\n')) { 00386 00387 if (ifStripGeom.gcount() > bufSize) { 00388 cout << "input buffer too small! gcount = " << ifStripGeom.gcount() 00389 << endl; 00390 return; 00391 } 00392 00393 istrstream stringBuf(lineBuf,strlen(lineBuf)); 00394 00395 if (stringBuf >> part >> seg >> gap >> strip >> panel 00396 >> xStripTarg1 >> xStripTarg2 00397 >> yStripTarg1 >> yStripTarg2) { 00398 00399 // cout << part << " " << seg << " " << gap << " " 00400 // << strip << " " << panel << " " << orient << " " 00401 // << xStripTarg1 << " " << xStripTarg2 << " " 00402 // << yStripTarg1 << " " << yStripTarg2 00403 // << endl; 00404 00405 MucGeoStrip* pStrip = 0; 00406 stripID = MucID::channel_id(part,seg,gap,strip); 00407 gapID = MucID::channel_id(part,seg,gap,0); 00408 00409 if (!m_gpMucGeoStrip[stripID]) { 00410 if (m_gpMucGeoGap[gapID]) { 00411 pStrip = m_gpMucGeoGap[gapID]->AddStrip(strip); 00412 pStrip->SetStrip(xStripTarg1, xStripTarg2, 00413 yStripTarg1, yStripTarg2, 00414 xStripSize[part][seg][gap][strip], 00415 yStripSize[part][seg][gap][strip], 00416 zStripSize[part][seg][gap][strip]); 00417 m_gpMucGeoStrip[stripID] = pStrip; 00418 } 00419 else { 00420 cout << "missing gap" << gapID << endl; 00421 continue; 00422 } 00423 } 00424 00425 } 00426 else { 00427 // Skip any header or comment lines. 00428 // cout << "read comment line" << endl; 00429 } 00430 00431 } 00432 00433 ifStripGeom.close(); 00434 00435 m_gGeometryInit = 1; 00436 }
void MucGeoGeneral::InitFromDatabase | ( | ) |
Initialize from database.
void MucGeoGeneral::InitFromXML | ( | ) |
Initialize from xml.
Definition at line 92 of file MucGeoGeneral.cxx.
References MucID::channel_id(), MucROOTGeo::GetAbsorberThickness(), MucROOTGeo::GetGapNum(), MucROOTGeo::GetPartNum(), MucROOTGeo::GetPhysicalGap(), MucROOTGeo::GetPhysicalStrip(), MucROOTGeo::GetSegNum(), MucROOTGeo::GetStripNum(), MucROOTGeo::GetVolumeMuc(), m_gGeometryInit, m_gpMucGeoGap, m_gpMucGeoStrip, SubDetectorROOTGeo::SetChildNo(), MucROOTGeo::SetPhysicalNode(), and MucGeoStrip::SetStrip().
Referenced by MucGeomSvc::Fill().
00093 { 00094 //new TRint("ROOT GDML converter", 0, 0); 00095 00096 // Initialize Bes Muc Geometry for XML files. 00097 bool geomanager = true; 00098 if (!gGeoManager) { 00099 gGeoManager = new TGeoManager("BesGeo", "Bes geometry"); 00100 geomanager = false; 00101 } 00102 //gGeoManager->SetVisOption(0); // to show all visible volumes. 00103 //gGeoManager->SetVisLevel(5); 00104 00105 MucROOTGeo *m_MucROOTGeo = new MucROOTGeo(); 00106 00107 TGeoVolume *volMuc = m_MucROOTGeo->GetVolumeMuc(); 00108 if(volMuc) std::cout << "Construct Muc from Muc.gdml" << std::endl; 00109 else std::cout << "volume Muc not found " << std::endl; 00110 00111 float m_BesR = 5200; 00112 float m_BesZ = 5680; 00113 TGeoIdentity *identity = new TGeoIdentity(); 00114 00115 TGeoMaterial *mat = new TGeoMaterial("VOID",0,0,0); 00116 TGeoMedium *med = new TGeoMedium("MED",1,mat); 00117 TGeoVolume *m_Bes = gGeoManager->MakeBox("volBes", med, 0.5*m_BesR, 0.5*m_BesR, 0.5*m_BesZ); 00118 gGeoManager->SetTopVolume(m_Bes); 00119 m_Bes->AddNode(volMuc, 0, identity); 00120 m_MucROOTGeo->SetChildNo(m_Bes->GetNdaughters()-1); 00121 00122 gGeoManager->SetDrawExtraPaths(); // draw physical node or not; 00123 if(!geomanager)gGeoManager->CloseGeometry(); 00124 gGeoManager->SetNsegments(20); 00125 00126 m_MucROOTGeo->SetPhysicalNode(); 00127 00128 for (int part = 0; part < m_MucROOTGeo->GetPartNum(); part++) { 00129 for (int seg = 0; seg < m_MucROOTGeo->GetSegNum(part); seg++) { 00130 for (int gap = 0; gap < m_MucROOTGeo->GetGapNum(part); gap++) { 00131 Identifier gapID = MucID::channel_id(part,seg,gap,0); 00132 00133 float ironThickness = 0.0; 00134 if (part == 1) { 00135 if (gap > 0) ironThickness = m_MucROOTGeo->GetAbsorberThickness(part, seg, gap-1); 00136 } 00137 else { 00138 ironThickness = m_MucROOTGeo->GetAbsorberThickness(part, seg, gap); 00139 } 00140 //std::cout << "part " << part << " seg " << seg << " gap " << gap << " thick " << ironThickness << std::endl; 00141 00142 int orient = 0; 00143 if ( (part == 1 && gap % 2 == 0) || (part != 1 && gap % 2 == 1) ) orient = 1; 00144 MucGeoGap *pGap = new MucGeoGap(part, seg, gap, orient, 0, m_MucROOTGeo->GetPhysicalGap(part, seg, gap), ironThickness); 00145 m_gpMucGeoGap[gapID] = pGap; 00146 00147 for (int strip = 0; strip < m_MucROOTGeo->GetStripNum(part, seg, gap); strip++) { 00148 Identifier stripID = MucID::channel_id(part,seg,gap,strip); 00149 00150 MucGeoStrip* pStrip = m_gpMucGeoGap[gapID]->AddStrip(strip); 00151 pStrip->SetStrip(m_MucROOTGeo->GetPhysicalStrip(part, seg, gap, strip)); 00152 m_gpMucGeoStrip[stripID] = pStrip; 00153 } 00154 } 00155 } 00156 } 00157 00158 m_gGeometryInit = 1; 00159 }
MucGeoGeneral * MucGeoGeneral::Instance | ( | ) | [static] |
Get a pointer to the single instance of MucGeoGeneral.
Definition at line 439 of file MucGeoGeneral.cxx.
References m_gpMucGeoGeneral.
Referenced by RecMucTrack::CalculateInsct(), RecMucTrack::ComputeDepth(), RecMucTrack::ComputeDistanceMatch(), MucRecTrkExt::execute(), MucGeomSvc::Fill(), MucRec2DRoad::GetSearchWindowSize(), MucRecLineFit::LineFit(), main(), ExtMucKal::MucKalIniti(), MucRecHit::MucRecHit(), RecMucTrack::Project(), MucRec3DRoad::Project(), MucRec2DRoad::Project(), MucRec3DRoad::ProjectNoCurrentGap(), MucRec3DRoad::ProjectToStrip(), MucRec3DRoad::ProjectWithSigma(), MucRecTrkExt::TrackFinding(), MucRecRoadFinder::TrackFinding(), and ExtSteppingAction::UserSteppingAction().
00440 { 00441 // Get a pointer to the single instance of MucGeoGeneral. 00442 if(!m_gpMucGeoGeneral) { 00443 m_gpMucGeoGeneral = new MucGeoGeneral; 00444 } 00445 00446 return m_gpMucGeoGeneral; 00447 }
MucGeoGeneral & MucGeoGeneral::operator= | ( | const MucGeoGeneral & | orig | ) |
Assignment constructor.
Definition at line 67 of file MucGeoGeneral.cxx.
References m_gpMucGeoGap, m_gpMucGeoGeneral, and m_gpMucGeoStrip.
00068 { 00069 // Assignment operator. 00070 if ( this != &orig ) { // Watch out for self-assignment! 00071 m_gpMucGeoGeneral = orig.m_gpMucGeoGeneral; 00072 m_gpMucGeoGap = orig.m_gpMucGeoGap; 00073 m_gpMucGeoStrip = orig.m_gpMucGeoStrip; 00074 } 00075 return *this; 00076 }
int MucGeoGeneral::m_gGeometryInit = 0 [static, private] |
map< Identifier, MucGeoGap * > MucGeoGeneral::m_gpMucGeoGap = map<Identifier, MucGeoGap*>() [static, private] |
Definition at line 201 of file MucGeoGeneral.h.
Referenced by GetGap(), InitFromASCII(), InitFromXML(), operator=(), and ~MucGeoGeneral().
MucGeoGeneral * MucGeoGeneral::m_gpMucGeoGeneral = 0L [static, private] |
map< Identifier, MucGeoStrip * > MucGeoGeneral::m_gpMucGeoStrip = map<Identifier, MucGeoStrip*>() [static, private] |
Definition at line 203 of file MucGeoGeneral.h.
Referenced by GetStrip(), InitFromASCII(), InitFromXML(), operator=(), and ~MucGeoGeneral().
const int MucGeoGeneral::m_kGapMax = 9 [static, private] |
const int MucGeoGeneral::m_kPartNum = 3 [static, private] |
const int MucGeoGeneral::m_kSegMax = 8 [static, private] |
const int MucGeoGeneral::m_kStripMax = 112 [static, private] |
int MucGeoGeneral::m_StripNumInGap[m_kPartNum][m_kSegMax][m_kGapMax] [private] |
Definition at line 212 of file MucGeoGeneral.h.
Referenced by GetStripNumInGap(), Init(), and InitFromASCII().