00001
00002 #ifndef MDCGEOMSVC_H
00003 #define MDCGEOMSVC_H
00004
00005 #include <CLHEP/Units/PhysicalConstants.h>
00006 #include <CLHEP/Geometry/Point3D.h>
00007 #include <vector>
00008 #include <iostream>
00009 #include "GaudiKernel/Algorithm.h"
00010
00011 #include "MdcGeomSvc/MdcGeoWire.h"
00012 #include "MdcGeomSvc/MdcGeoLayer.h"
00013 #include "MdcGeomSvc/MdcGeoGeneral.h"
00014 #include "MdcGeomSvc/MdcGeoSuper.h"
00015 #include "MdcGeomSvc/MdcGeoMisc.h"
00016 #include "MdcGeomSvc/MdcGeoEnd.h"
00017 #include "GaudiKernel/IIncidentListener.h"
00018 #include "GaudiKernel/Service.h"
00019 #include "GaudiKernel/IInterface.h"
00020 #include "MdcGeomSvc/IMdcGeomSvc.h"
00021 #include "GaudiKernel/IDataProviderSvc.h"
00022 #include "GaudiKernel/IIncidentListener.h"
00023
00024
00025 class MdcGeomSvc : public Service, virtual public IMdcGeomSvc, virtual public IIncidentListener
00026 {
00027 public:
00028
00029 MdcGeomSvc( const std::string& name, ISvcLocator* svcloc );
00030 ~MdcGeomSvc();
00031
00032 virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvUnknown);
00033 virtual StatusCode initialize ( );
00034 virtual StatusCode finalize ( );
00035 void handle(const Incident& inc);
00036
00037
00038 const MdcGeoWire * const Wire(unsigned id);
00039 const MdcGeoWire * const Wire(unsigned lyrid,unsigned wirid);
00040 const MdcGeoLayer * const Layer(unsigned id);
00041 const MdcGeoSuper * const SuperLayer(unsigned id);
00042 const MdcGeoGeneral * const GeneralLayer(unsigned id);
00043 const MdcGeoMisc * const Misc(void);
00044 const MdcGeoEnd * const End(unsigned id);
00045 const int getWireSize();
00046 const int getLayerSize();
00047 const int getSuperLayerSize();
00048 const int getGeneralLayerSize();
00049 const int getSegmentNo();
00050 void Dump();
00051 static bool getSagFlag(void);
00052
00053 public:
00054 static bool m_doSag;
00055 static bool m_readAlignParDataBase;
00056 static bool m_nomcalignment;
00057
00058
00059 private:
00060 void clean();
00061 void ReadFilePar();
00062 void ReadTensionDataBase(std::vector<double> & wireTensionVec);
00063 void ReadWirePosDataBase(std::vector<vector<double> > & wirePosVec);
00064 void ReadAliParDataBase(vector<double>& Sx, vector<double>& Sy, vector<double>& Sz,
00065 vector<double>& Rx, vector<double>& Ry, vector<double>& Rz);
00066 void Fill();
00067 const int getAlignParIndexEast(int lyr) const;
00068 const int getAlignParIndexWest(int lyr) const;
00069
00070
00071
00072
00073 private:
00074 double m_wholeShiftX;
00075 double m_wholeShiftY;
00076 double m_wholeShiftZ;
00077 double m_wholeRotatX;
00078 double m_wholeRotatY;
00079 double m_wholeRotatZ;
00080 int m_mindex;
00081 std::string m_alignFilePath;
00082 std::string m_wirePosFilePath;
00083 std::string m_wireTensionFilePath;
00084 bool m_updataalign;
00085
00086 vector <MdcGeoWire*> fWires;
00087 vector <MdcGeoGeneral> fGenerals;
00088 vector <MdcGeoLayer*> fLayers;
00089 vector <MdcGeoSuper*> fSupers;
00090 MdcGeoMisc fMisc;
00091 vector <MdcGeoEnd*> fEnd;
00092 IDataProviderSvc* m_pCalibDataSvc;
00093
00094 };
00095
00096
00097 #endif
00098
00099