BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcUtilitySvc.h
Go to the documentation of this file.
1#ifndef MDCUTILITYSVC_H
2#define MDCUTILITYSVC_H
3
4#include "CLHEP/Geometry/Point3D.h"
5#include "CLHEP/Geometry/Vector3D.h"
6#include "CLHEP/Matrix/SymMatrix.h"
7#include "CLHEP/Matrix/Vector.h"
8#include "GaudiKernel/IDataProviderSvc.h"
9#include "GaudiKernel/IInterface.h"
10#include "GaudiKernel/Kernel.h"
11#include "GaudiKernel/Service.h"
12
13#include "Identifier/MdcID.h"
14#include "MagneticFieldSvc/IBesMagFieldSvc.h"
15#include "McTruth/McParticle.h"
16#include "McTruth/MdcMcHit.h"
17#include "MdcGeomSvc/IMdcGeomSvc.h"
18#include "MdcRawEvent/MdcDigi.h"
19#include "MdcRecEvent/RecMdcTrack.h"
20#include "MdcUtilitySvc/IMdcUtilitySvc.h"
21#include "RawDataProviderSvc/IRawDataProviderSvc.h"
22#include "RawDataProviderSvc/MdcRawDataProvider.h"
23#include "TrackUtil/Helix.h"
24
25#include <map>
26#include <vector>
27
28// class MdcDigi;
29
30#ifndef ENABLE_BACKWARDS_COMPATIBILITY
31// backwards compatibility will be enabled ONLY in CLHEP 1.9
32typedef HepGeom::Point3D<double> HepPoint3D;
33#endif
34
35#ifndef ENABLE_BACKWARDS_COMPATIBILITY
36// backwards compatibility will be enabled ONLY in CLHEP 1.9
37typedef HepGeom::Vector3D<double> HepVector3D;
38#endif
39
40class MdcUtilitySvc : public extends<Service, IMdcUtilitySvc> {
41 // class MdcUtilitySvc: public Service, virtual public IMdcUtilitySvc{
42public:
43 MdcUtilitySvc( const std::string& name, ISvcLocator* svcloc );
45
46 virtual StatusCode initialize();
47 virtual StatusCode finalize();
48 // StatusCode queryInterface(const InterfaceID& riid, void** ppvUnknown);
49
50 int nLayerTrackPassed( const HepVector helix ) const;
51 int nLayerTrackPassed( const double helix[5] ) const;
52
53 HepVector patPar2BesPar( const HepVector& helixPar ) const;
54 HepSymMatrix patErr2BesErr( const HepSymMatrix& err ) const;
55 HepVector besPar2PatPar( const HepVector& helixPar ) const;
56 HepSymMatrix besErr2PatErr( const HepSymMatrix& err ) const;
57
58 double doca( int layer, int cell, const HepVector helix, const HepSymMatrix errMat,
59 bool passCellRequired = true, bool doSag = true ) const;
60 double doca( int layer, int cell, HepPoint3D eastP, HepPoint3D westP,
61 const HepVector helixBes, const HepSymMatrix errMatBes,
62 bool passCellRequired = true, bool doSag = true ) const;
63 double doca( int layer, int cell, const MdcSWire* sWire, const HepVector helixPat,
64 const HepSymMatrix errMatPat, bool passCellRequired = true ) const;
65 double docaPatPar( int layer, int cell, const HepVector helixPat,
66 const HepSymMatrix errMatPat, bool passCellRequired = true,
67 bool doSag = true ) const;
68 double docaPatPar( int layer, int cell, HepPoint3D eastP, HepPoint3D westP,
69 const HepVector helixBes, const HepSymMatrix errMatBes,
70 bool passCellRequired = true, bool doSag = true ) const;
71 double docaPatPar( int layer, int cell, const MdcSWire* sWire, const HepVector helixPat,
72 const HepSymMatrix errMatPat, bool passCellRequired = true ) const;
73
74 HepPoint3D pointOnHelix( const HepVector helixPar, int lay, int innerOrOuter ) const;
75 HepPoint3D pointOnHelixPatPar( const HepVector helixPat, int lay, int innerOrOuter ) const;
76 bool cellTrackPassedByPhi( const HepVector helix, int layer, int& cellId_in,
77 int& cellId_out ) const;
78 bool cellTrackPassedByPhiPatPar( const HepVector helix, int layer, int& cellId_in,
79 int& cellId_out ) const;
80 bool cellTrackPassed( const HepVector helix, int layer, int& cellId_in,
81 int& cellId_out ) const;
82 bool cellTrackPassedPatPar( const HepVector helix, int layer, int& cellId_in,
83 int& cellId_out ) const;
84
85 HepPoint3D Hel( HepPoint3D piv, double dr, double phi0, double Alpha_L, double kappa,
86 double dz, double dphi, double tanl ) const;
87 double p_cms( HepVector helix, int runNo, double mass ) const;
88 Hep3Vector momentum( const RecMdcTrack* trk ) const;
89 double probab( const int& ndof, const double& chisq ) const;
90 // std::vector<MdcDigi*> getMdcDigiVec() const;
92 // vector<vector<MdcDigi*> > ConnectionHitsGroup(int SameLRange = 1,int DiffLRange = 1)
93 // const; vector<vector<MdcDigi*> > ConnectionHitsGroup(vector<MdcDigi*> &MdcHits,int
94 // SameLRange = 1,int DiffLRange = 1) const;
95
96 void getHelixOfMcParticle( const Event::McParticle* mcParticle, Helix& helix );
97 float getChargeOfMcParticle( const Event::McParticle* mcParticle );
98 void getMomPosOfMcParticle( const Event::McParticle* mcParticle, HepVector3D& pos,
99 HepVector3D& mom );
101 int trackIndex,
102 const std::map<int, std::map<MdcDigi*, Event::MdcMcHit*>> mdcMCAssociation,
103 MdcDigiVec& mdcDigiInput, MdcDigiVec& mdcDigiAssociated );
104 /// Get association of MdcDigi and MdcMcHit according to track id
106 int trackIndex, const std::vector<MdcDigi*> mdcDigiVecInput,
107 std::map<int, std::map<MdcDigi*, Event::MdcMcHit*>>& mdcMCAssociation );
108
109private:
110 double Bz() const { return m_pIMF->getReferField() * 1000.; }
111 int myNWire[43];
112 int myOuterWire[43][288][2];
113 int myInnerWire[43][288][2];
114 double myWirePhi[43][288];
115 double dPhi( double phi1, double phi2 );
116 IRawDataProviderSvc* m_RawDataProviderSvc;
117 IMdcGeomSvc* m_mdcGeomSvc;
118 IBesMagFieldSvc* m_pIMF;
119 int m_debug;
120 bool m_doSag;
121};
122#endif /* MDCUTILITYSVC_H*/
HepGeom::Vector3D< double > HepVector3D
**********INTEGER nmxhep !maximum number of particles DOUBLE PRECISION vhep INTEGER jdahep COMMON hepevt $ !serial number $ !number of particles $ !status code $ !particle ident KF $ !parent particles $ !childreen particles $ !four momentum
double mass
HepGeom::Point3D< double > HepPoint3D
int runNo
Definition DQA_TO_DB.cxx:13
Double_t phi2
Double_t phi1
HepGeom::Point3D< double > HepPoint3D
HepGeom::Vector3D< double > HepVector3D
MdcUtilitySvc(const std::string &name, ISvcLocator *svcloc)
HepVector besPar2PatPar(const HepVector &helixPar) const
bool cellTrackPassedByPhi(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
virtual StatusCode initialize()
HepSymMatrix patErr2BesErr(const HepSymMatrix &err) const
HepPoint3D Hel(HepPoint3D piv, double dr, double phi0, double Alpha_L, double kappa, double dz, double dphi, double tanl) const
MdcDigiVec getMdcDigiVec() const
HepSymMatrix besErr2PatErr(const HepSymMatrix &err) const
float getChargeOfMcParticle(const Event::McParticle *mcParticle)
void getMdcMCAssoiciation(int trackIndex, const std::vector< MdcDigi * > mdcDigiVecInput, std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > &mdcMCAssociation)
Get association of MdcDigi and MdcMcHit according to track id.
bool cellTrackPassedByPhiPatPar(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
HepVector patPar2BesPar(const HepVector &helixPar) const
void getHelixOfMcParticle(const Event::McParticle *mcParticle, Helix &helix)
virtual StatusCode finalize()
void getMomPosOfMcParticle(const Event::McParticle *mcParticle, HepVector3D &pos, HepVector3D &mom)
double probab(const int &ndof, const double &chisq) const
double doca(int layer, int cell, const HepVector helix, const HepSymMatrix errMat, bool passCellRequired=true, bool doSag=true) const
int nLayerTrackPassed(const HepVector helix) const
bool cellTrackPassed(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const
void getMdcDigiOnMcParticle(int trackIndex, const std::map< int, std::map< MdcDigi *, Event::MdcMcHit * > > mdcMCAssociation, MdcDigiVec &mdcDigiInput, MdcDigiVec &mdcDigiAssociated)
double p_cms(HepVector helix, int runNo, double mass) const
double docaPatPar(int layer, int cell, const HepVector helixPat, const HepSymMatrix errMatPat, bool passCellRequired=true, bool doSag=true) const
HepPoint3D pointOnHelixPatPar(const HepVector helixPat, int lay, int innerOrOuter) const
HepPoint3D pointOnHelix(const HepVector helixPar, int lay, int innerOrOuter) const
bool cellTrackPassedPatPar(const HepVector helix, int layer, int &cellId_in, int &cellId_out) const