00001 #ifndef MDCUTILITYSVC_H
00002 #define MDCUTILITYSVC_H
00003
00004 #include "GaudiKernel/IInterface.h"
00005 #include "GaudiKernel/Kernel.h"
00006 #include "GaudiKernel/Service.h"
00007 #include "GaudiKernel/IDataProviderSvc.h"
00008 #include "CLHEP/Matrix/Vector.h"
00009 #include "CLHEP/Matrix/SymMatrix.h"
00010
00011 #include "MdcRecEvent/RecMdcTrack.h"
00012 #include "MdcGeomSvc/MdcGeomSvc.h"
00013 #include "MagneticField/IMagneticFieldSvc.h"
00014 #include "MdcUtilitySvc/IMdcUtilitySvc.h"
00015
00016 #include <vector>
00017
00018
00019 class MdcUtilitySvc: public Service, virtual public IMdcUtilitySvc{
00020 public:
00021 MdcUtilitySvc( const std::string& name, ISvcLocator* svcloc );
00022 ~MdcUtilitySvc();
00023
00024 virtual StatusCode initialize();
00025 virtual StatusCode finalize();
00026 StatusCode queryInterface(const InterfaceID& riid, void** ppvUnknown);
00027
00028 int nLayerTrackPassed(const HepVector helix) const;
00029 int nLayerTrackPassed(const double helix[5]) const;
00030
00031 HepVector patPar2BesPar(const HepVector& helixPar) const;
00032 HepSymMatrix patErr2BesErr(const HepSymMatrix& err) const;
00033 HepVector besPar2PatPar(const HepVector& helixPar) const;
00034 HepSymMatrix besErr2PatErr(const HepSymMatrix& err) const;
00035
00036 double doca(int layer, int cell, const HepVector helix, const HepSymMatrix errMat, bool passCellRequired = true, bool doSag = true) const;
00037 double doca(int layer, int cell, HepPoint3D eastP, HepPoint3D westP, const HepVector helixBes,const HepSymMatrix errMatBes, bool passCellRequired = true, bool doSag = true) const;
00038 double doca(int layer, int cell, const MdcSWire* sWire, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired = true) const;
00039 double docaPatPar(int layer, int cell, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired = true, bool doSag = true) const;
00040 double docaPatPar(int layer, int cell, HepPoint3D eastP, HepPoint3D westP, const HepVector helixBes,const HepSymMatrix errMatBes, bool passCellRequired = true, bool doSag = true) const;
00041 double docaPatPar(int layer, int cell, const MdcSWire* sWire, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired = true) const;
00042
00043 HepPoint3D pointOnHelix(const HepVector helixPar, int lay, int innerOrOuter) const;
00044 HepPoint3D pointOnHelixPatPar(const HepVector helixPat, int lay, int innerOrOuter) const;
00045 bool cellTrackPassedByPhi(const HepVector helix,int layer, int& cellId_in, int& cellId_out) const;
00046 bool cellTrackPassedByPhiPatPar(const HepVector helix,int layer, int& cellId_in, int& cellId_out) const;
00047 bool cellTrackPassed(const HepVector helix,int layer, int& cellId_in, int& cellId_out) const;
00048 bool cellTrackPassedPatPar(const HepVector helix,int layer,int& cellId_in,int& cellId_out) const;
00049
00050 HepPoint3D Hel(HepPoint3D piv, double dr,double phi0,double Alpha_L,double kappa,double dz,double dphi,double tanl) const;
00051 double p_cms(HepVector helix, int runNo, double mass) const;
00052 Hep3Vector momentum(const RecMdcTrack* trk) const;
00053 double probab(const int& ndof, const double& chisq) const;
00054
00055 private:
00056
00057 double Bz() const { return m_pIMF->getReferField()*1000.; };
00058
00059 IMdcGeomSvc* m_mdcGeomSvc;
00060 IMagneticFieldSvc* m_pIMF;
00061 int m_debug;
00062 bool m_doSag;
00063
00064 };
00065 #endif