BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
MucGeoTest1.cxx
Go to the documentation of this file.
1//$id$
2//
3//$log$
4
5/*
6 * 2003/09/06 Zhengyun You Peking University
7 *
8 * 2004/09/09 Zhengyun You Peking University
9 * transplanted to Gaudi framework
10 */
11
12using namespace std;
13
14#include <vector>
15#include <iostream>
16#include <iomanip>
17#include <string>
18//#include "TRint.h"
19//#include <TGeoManager.h>
20
22
23int
25{
26 //new TRint("ROOT GDML converter", 0, 0);
27 //if (gGeoManager) delete gGeoManager;
28 //new TGeoManager("BesGeo", "Bes geometry");
29
30 cout << endl << "****** Initialize MucGeoGeneral! ******" << endl << endl;
32
33
34 std::cout<<"================================ begin event " << std::endl;
35
36 HepPoint3D gPoint(0,0,0);
37 Hep3Vector gVect(-1,0.8,-1.4);
38
39 cout << "********************" << endl << endl ;
40 cout << " Origin of the track : " << gPoint << endl;
41 cout << " Direction of the track : " << gVect << endl;
42
43 vector<Identifier> idGap, idGapTemp;
44 for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
45 for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) {
46 idGapTemp = MucGeoGeneral::Instance()->FindIntersectGaps(part, gap, gPoint, gVect);
47
48 for( vector<Identifier>::iterator iter = idGapTemp.begin();
49 iter != idGapTemp.end(); ++iter) {
50 idGap.push_back(*iter);
51 }
52 }
53 }
54
55 cout << endl << "********************" << endl << endl;
56 cout << " Number of intersect gaps : " << idGap.size() << endl << endl;
57
58 for( unsigned int i = 0; i< idGap.size(); i++){
59 cout << idGap[i] << endl;
60 }
61
62 vector<Identifier> idStrip, idStripTemp;
63 for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
64 for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) {
65 idStripTemp = MucGeoGeneral::Instance()->FindIntersectStrips(part, gap, gPoint, gVect);
66
67 for( vector<Identifier>::iterator iter = idStripTemp.begin();
68 iter != idStripTemp.end(); ++iter) {
69 idStrip.push_back(*iter);
70 }
71 }
72 }
73
74 cout << endl << "********************" << endl << endl;
75 cout << " Number of intersect strips : " << idStrip.size() << endl << endl;
76
77 float stripCenterX, stripCenterY, stripCenterZ;
78 HepPoint3D localStripCenter, stripCenter;
79 MucGeoStrip* pStrip;
80 MucGeoGap* pGap;
81
82
83 for( unsigned int i = 0; i < idStrip.size(); i++) {
84 pStrip = MucGeoGeneral::Instance()->GetStrip(MucID::part(idStrip[i]),
85 MucID::seg(idStrip[i]),
86 MucID::gap(idStrip[i]),
87 MucID::strip(idStrip[i]));
88 pGap = pStrip->GetGap();
89
90 pStrip->GetCenterPos(stripCenterX,
91 stripCenterY,
92 stripCenterZ);
93
94 localStripCenter.setX(stripCenterX);
95 localStripCenter.setY(stripCenterY);
96 localStripCenter.setZ(stripCenterZ);
97
98 stripCenter = pGap->TransformToGlobal(localStripCenter);
99
100 cout << idStrip[i] << " center : " << stripCenter << endl;
101 }
102
103 vector<HepPoint3D> intersection, intersectionTemp;
104 HepPoint3D origin(0,0,0);
105
106 for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
107 for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) {
108 intersectionTemp = MucGeoGeneral::Instance()->FindIntersections(part, gap, gPoint, gVect);
109
110 for( vector<HepPoint3D>::iterator iter = intersectionTemp.begin();
111 iter != intersectionTemp.end(); ++iter) {
112 intersection.push_back(*iter);
113 }
114 }
115 }
116
117 cout << endl << "********************" << endl << endl;
118 cout << " Number of intersections : " << intersection.size() << endl << endl;
119
120
121 for( unsigned int i = 0; i < intersection.size(); i++) {
122 cout << intersection[i] << endl;
123 }
124
125 cout << endl << "********************" << endl << endl;
126
127 cout << " MucGeoTest1:: Execute Successfully!!"
128 << endl;
129}
130
131
132
133
134
135
136
137//HepPoint3D intersection[9];
138// intersection[i] = pmuc->GetIntersection(0, i, gPoint, gVect);
const DifPoint origin
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)
int main()
Definition: MucGeoTest1.cxx:24
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 TransformToGlobal(const HepPoint3D pPoint) const
Transform a point from gap coordinate to global coordinate.
Definition: MucGeoGap.cxx:620
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.
Definition: MucGeoStrip.h:65
void GetCenterPos(float &x, float &y, float &z) const
Get center position of this strip (in the gap coordinate system).
Definition: MucGeoStrip.cxx:40
static int part(const Identifier &id)
Definition: MucID.cxx:46
static value_type getPartNum()
Definition: MucID.cxx:159
static int gap(const Identifier &id)
Definition: MucID.cxx:66
static int seg(const Identifier &id)
Definition: MucID.cxx:56
static int strip(const Identifier &id)
Definition: MucID.cxx:76
static value_type getGapNum(int part)
Definition: MucID.cxx:171