BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MucGeoTest1.cxx File Reference
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#include "MucGeomSvc/MucGeoGeneral.h"

Go to the source code of this file.

Functions

int main ()

Function Documentation

◆ main()

int main ( )

Definition at line 23 of file MucGeoTest1.cxx.

23 {
24 // new TRint("ROOT GDML converter", 0, 0);
25 // if (gGeoManager) delete gGeoManager;
26 // new TGeoManager("BesGeo", "Bes geometry");
27
28 cout << endl << "****** Initialize MucGeoGeneral! ******" << endl << endl;
30
31 std::cout << "================================ begin event " << std::endl;
32
33 HepPoint3D gPoint( 0, 0, 0 );
34 Hep3Vector gVect( -1, 0.8, -1.4 );
35
36 cout << "********************" << endl << endl;
37 cout << " Origin of the track : " << gPoint << endl;
38 cout << " Direction of the track : " << gVect << endl;
39
40 vector<Identifier> idGap, idGapTemp;
41 for ( unsigned int part = 0; part < MucID::getPartNum(); part++ )
42 {
43 for ( unsigned int gap = 0; gap < MucID::getGapNum( part ); gap++ )
44 {
45 idGapTemp = MucGeoGeneral::Instance()->FindIntersectGaps( part, gap, gPoint, gVect );
46
47 for ( vector<Identifier>::iterator iter = idGapTemp.begin(); iter != idGapTemp.end();
48 ++iter )
49 { idGap.push_back( *iter ); }
50 }
51 }
52
53 cout << endl << "********************" << endl << endl;
54 cout << " Number of intersect gaps : " << idGap.size() << endl << endl;
55
56 for ( unsigned int i = 0; i < idGap.size(); i++ ) { cout << idGap[i] << endl; }
57
58 vector<Identifier> idStrip, idStripTemp;
59 for ( unsigned int part = 0; part < MucID::getPartNum(); part++ )
60 {
61 for ( unsigned int gap = 0; gap < MucID::getGapNum( part ); gap++ )
62 {
63 idStripTemp = MucGeoGeneral::Instance()->FindIntersectStrips( part, gap, gPoint, gVect );
64
65 for ( vector<Identifier>::iterator iter = idStripTemp.begin(); iter != idStripTemp.end();
66 ++iter )
67 { idStrip.push_back( *iter ); }
68 }
69 }
70
71 cout << endl << "********************" << endl << endl;
72 cout << " Number of intersect strips : " << idStrip.size() << endl << endl;
73
74 float stripCenterX, stripCenterY, stripCenterZ;
75 HepPoint3D localStripCenter, stripCenter;
76 MucGeoStrip* pStrip;
77 MucGeoGap* pGap;
78
79 for ( unsigned int i = 0; i < idStrip.size(); i++ )
80 {
82 MucID::part( idStrip[i] ), MucID::seg( idStrip[i] ), MucID::gap( idStrip[i] ),
83 MucID::strip( idStrip[i] ) );
84 pGap = pStrip->GetGap();
85
86 pStrip->GetCenterPos( stripCenterX, stripCenterY, stripCenterZ );
87
88 localStripCenter.setX( stripCenterX );
89 localStripCenter.setY( stripCenterY );
90 localStripCenter.setZ( stripCenterZ );
91
92 stripCenter = pGap->TransformToGlobal( localStripCenter );
93
94 cout << idStrip[i] << " center : " << stripCenter << endl;
95 }
96
97 vector<HepPoint3D> intersection, intersectionTemp;
98 HepPoint3D origin( 0, 0, 0 );
99
100 for ( unsigned int part = 0; part < MucID::getPartNum(); part++ )
101 {
102 for ( unsigned int gap = 0; gap < MucID::getGapNum( part ); gap++ )
103 {
104 intersectionTemp =
105 MucGeoGeneral::Instance()->FindIntersections( part, gap, gPoint, gVect );
106
107 for ( vector<HepPoint3D>::iterator iter = intersectionTemp.begin();
108 iter != intersectionTemp.end(); ++iter )
109 { intersection.push_back( *iter ); }
110 }
111 }
112
113 cout << endl << "********************" << endl << endl;
114 cout << " Number of intersections : " << intersection.size() << endl << endl;
115
116 for ( unsigned int i = 0; i < intersection.size(); i++ ) { cout << intersection[i] << endl; }
117
118 cout << endl << "********************" << endl << endl;
119
120 cout << " MucGeoTest1:: Execute Successfully!!" << endl;
121}
HepGeom::Point3D< double > HepPoint3D
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
const DifPoint origin
int intersection(const HepPoint3D &c1, double r1, const HepPoint3D &c2, double r2, double eps, HepPoint3D &x1, HepPoint3D &x2)
Circle utilities.
Definition TMDCUtil.cxx:93
HepPoint3D TransformToGlobal(const HepPoint3D pPoint) const
Transform a point from gap coordinate to global coordinate.
void Init()
Initialize the instance of MucGeoGeneral.
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).
vector< HepPoint3D > FindIntersections(const int part, const int gap, const HepPoint3D gPoint, const Hep3Vector gDirection)
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)
static MucGeoGeneral * Instance()
Get a pointer to the single instance of MucGeoGeneral.
MucGeoGap * GetGap() const
Get the pointer to the gap that contains the strip.
void GetCenterPos(float &x, float &y, float &z) const
Get center position of this strip (in the gap coordinate system).
static int part(const Identifier &id)
Definition MucID.cxx:43
static value_type getPartNum()
Definition MucID.cxx:131
static int gap(const Identifier &id)
Definition MucID.cxx:63
static int seg(const Identifier &id)
Definition MucID.cxx:53
static int strip(const Identifier &id)
Definition MucID.cxx:73
static value_type getGapNum(int part)
Definition MucID.cxx:141