/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Muc/MucGeomSvc/MucGeomSvc-00-02-25/test/MucGeoTest1.cxx

Go to the documentation of this file.
00001 //$id$
00002 //
00003 //$log$
00004 
00005 /*
00006  *    2003/09/06   Zhengyun You      Peking University
00007  * 
00008  *    2004/09/09   Zhengyun You     Peking University
00009  *                 transplanted to Gaudi framework
00010  */
00011 
00012 using namespace std;
00013 
00014 #include <vector>
00015 #include <iostream>
00016 #include <iomanip>
00017 #include <string>
00018 //#include "TRint.h"
00019 //#include <TGeoManager.h>
00020 
00021 #include "MucGeomSvc/MucGeoGeneral.h"
00022 
00023 int
00024 main()
00025 {
00026   //new TRint("ROOT GDML converter", 0, 0);
00027   //if (gGeoManager) delete gGeoManager;
00028   //new TGeoManager("BesGeo", "Bes geometry");
00029 
00030   cout << endl << "****** Initialize MucGeoGeneral! ******" << endl << endl;
00031   MucGeoGeneral::Instance()->Init();
00032 
00033         
00034   std::cout<<"================================ begin event " << std::endl;
00035 
00036   HepPoint3D gPoint(0,0,0);
00037   Hep3Vector gVect(-1,0.8,-1.4);
00038 
00039   cout << "********************" << endl << endl ;
00040   cout << " Origin    of the track : " << gPoint << endl;
00041   cout << " Direction of the track : " << gVect  << endl;
00042 
00043   vector<Identifier> idGap, idGapTemp;
00044   for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
00045     for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) {
00046       idGapTemp = MucGeoGeneral::Instance()->FindIntersectGaps(part, gap, gPoint, gVect);
00047       
00048       for( vector<Identifier>::iterator iter  = idGapTemp.begin(); 
00049            iter != idGapTemp.end(); ++iter) {
00050         idGap.push_back(*iter);
00051       }
00052     }
00053   }
00054   
00055   cout << endl << "********************" << endl << endl;
00056   cout << " Number of intersect gaps : " << idGap.size() << endl << endl;
00057   
00058   for( unsigned int i = 0; i< idGap.size(); i++){
00059     cout << idGap[i] << endl;
00060   }
00061   
00062   vector<Identifier> idStrip, idStripTemp;
00063   for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
00064     for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) {
00065       idStripTemp = MucGeoGeneral::Instance()->FindIntersectStrips(part, gap, gPoint, gVect);
00066       
00067       for( vector<Identifier>::iterator iter  = idStripTemp.begin(); 
00068            iter != idStripTemp.end(); ++iter) {
00069         idStrip.push_back(*iter);
00070       }
00071     }
00072   }
00073 
00074   cout << endl << "********************" << endl << endl;
00075   cout << " Number of intersect strips : " << idStrip.size() << endl << endl;
00076   
00077   float stripCenterX, stripCenterY, stripCenterZ;
00078   HepPoint3D localStripCenter, stripCenter;
00079   MucGeoStrip* pStrip;
00080   MucGeoGap*   pGap;
00081 
00082 
00083   for( unsigned int i = 0; i < idStrip.size(); i++) {
00084     pStrip = MucGeoGeneral::Instance()->GetStrip(MucID::part(idStrip[i]),
00085                                                  MucID::seg(idStrip[i]),
00086                                                  MucID::gap(idStrip[i]),
00087                                                  MucID::strip(idStrip[i]));
00088     pGap = pStrip->GetGap();
00089 
00090     pStrip->GetCenterPos(stripCenterX, 
00091                          stripCenterY, 
00092                          stripCenterZ);
00093     
00094     localStripCenter.setX(stripCenterX);
00095     localStripCenter.setY(stripCenterY);
00096     localStripCenter.setZ(stripCenterZ);
00097 
00098     stripCenter = pGap->TransformToGlobal(localStripCenter);
00099 
00100     cout << idStrip[i] << "   center : "  << stripCenter << endl;
00101   }
00102 
00103   vector<HepPoint3D> intersection, intersectionTemp;
00104   HepPoint3D origin(0,0,0);
00105 
00106   for(unsigned int part = 0; part < MucID::getPartNum(); part++) {
00107     for(unsigned int gap = 0; gap < MucID::getGapNum(part); gap++) {
00108       intersectionTemp =  MucGeoGeneral::Instance()->FindIntersections(part, gap, gPoint, gVect);
00109       
00110       for( vector<HepPoint3D>::iterator iter  = intersectionTemp.begin(); 
00111            iter != intersectionTemp.end(); ++iter) {
00112         intersection.push_back(*iter);
00113       }
00114     }
00115   }
00116 
00117   cout << endl << "********************" << endl << endl;
00118   cout << " Number of intersections : " << intersection.size() << endl << endl;
00119 
00120 
00121   for( unsigned int i = 0; i < intersection.size(); i++) {
00122     cout << intersection[i] << endl;
00123   }
00124 
00125   cout << endl << "********************" << endl << endl;
00126 
00127   cout << " MucGeoTest1:: Execute  Successfully!!"
00128        << endl;
00129 }
00130 
00131 
00132 
00133 
00134   
00135 
00136 
00137 //HepPoint3D intersection[9];
00138 //  intersection[i] = pmuc->GetIntersection(0, i, gPoint, gVect);

Generated on Tue Nov 29 23:12:57 2016 for BOSS_7.0.2 by  doxygen 1.4.7