00001 // 00002 //File: ExtSteppingAction.hh 00003 //data: 2005.3.16 00004 //Author: L.L.Wang 00005 // 00006 //Description: 00007 // 00008 00009 00010 #ifndef EXTSTEPPINGACTION 00011 #define EXTSTEPPINGACTION 1 00012 00013 #include "G4UserSteppingAction.hh" 00014 #include "G4Material.hh" 00015 00016 #include "TrkExtAlg/Ext_xp_err.h" 00017 #include "CLHEP/Matrix/SymMatrix.h" 00018 #include "ExtEvent/RecExtTrack.h" 00019 #include "MucRawEvent/MucDigi.h" 00020 #include "McTruth/MucMcHit.h" 00021 #include "G4LogicalVolume.hh" 00022 #include "G4VPhysicalVolume.hh" 00023 using namespace CLHEP; 00024 00025 class ExtSteppingAction: public G4UserSteppingAction 00026 { 00027 public: 00028 // Constructor and destructors 00029 ExtSteppingAction(); 00030 ~ExtSteppingAction(); 00031 00032 void Reset(); 00033 void MucReset(); 00034 void UserSteppingAction(const G4Step* currentStep); 00035 00036 void SetInitialPath(double aPath) {initialPath = aPath;}; 00037 void SetInitialTof(double aTof) {initialTof = aTof;}; 00038 void SetBetaInMDC(double aBeta) {myBetaInMDC = aBeta;}; 00039 void SetXpErrPointer(Ext_xp_err* xpErr) {extXpErr = xpErr;}; 00040 00041 void SetMsgFlag(bool aMsgFalg) {msgFlag = aMsgFalg;}; 00042 void SetMucKalFlag(bool aMucKalFlag){myUseMucKalFlag=aMucKalFlag;}; 00043 void SetMucWindow(int aMucWindow){myMucWindow=aMucWindow;}; 00044 void SetExtTrackPointer(RecExtTrack *aExtTrack) {myExtTrack = aExtTrack;}; 00045 // inline void SetMsFlag(bool value){msFlag=value}; 00046 void CalculateEmcEndThetaPhi(int npart, int sector, int nb, int &ntheta, int &nphi); 00047 int CalculateEmcEndPhiNb(int num); 00048 int CalculateEmcEndCopyNb(int num); 00049 00050 void Set_which_tof_version(int version){m_which_tof_version=version;} 00051 int Get_which_tof_version(void){return m_which_tof_version;} 00052 00053 void InfmodMuc(Hep3Vector &pos,Hep3Vector &mom,HepSymMatrix &err); 00054 Hep3Vector GetGapID(G4String vol); 00055 bool TrackStop(){return m_trackstop;} 00056 void SetMucDigiColPointer(MucDigiCol* rawdigicol){ m_mucdigicol = rawdigicol;} 00057 private: 00058 //Calculate chicc 00059 void CalculateChicc(G4Material* currentMaterial); 00060 00061 double chicc;//a const about the materimal 00062 double initialPath;//particle path in MDC 00063 double initialTof;//particle TOF in MDC 00064 double myBetaInMDC;//particle velocity/C in MDC 00065 00066 double myPathIntoCrystal; 00067 double myPathOutCrystal; 00068 double myPathInCrystal; 00069 00070 double myPathIntoTof1; 00071 double myPathOutTof1; 00072 vector<double> myPathInTof1; 00073 00074 double myPathIntoTof2; 00075 double myPathOutTof2; 00076 vector<double> myPathInTof2; 00077 int myMucWindow; 00078 // bool msFlag; //Caculation of multiple scattering error switch flag 00079 00080 Ext_xp_err* extXpErr; 00081 00082 //units mm,MeV --> cm,GeV 00083 HepSymMatrix myOutputSM; 00084 HepSymMatrix & myOutputSymMatrix(const HepSymMatrix &); 00085 00086 MucDigiCol* m_mucdigicol; 00087 bool myUseMucKalFlag; 00088 Hep3Vector RememberID; 00089 bool m_trackstop; 00090 int myMucnfit_; 00091 double myMucchisq_; 00092 double myMucdepth_; 00093 int myMucbrLastLay_; 00094 int myMucecLastLay_; 00095 int myMucnhits_; 00096 HepSymMatrix m_err_mod; 00097 Hep3Vector m_pos_mod; 00098 Hep3Vector m_mom_mod; 00099 00100 Hep3Vector RemPositon; 00101 Hep3Vector RemMomentum; 00102 HepSymMatrix RemXpErr; 00103 int RemStep; 00104 double RemDist; 00105 double RemDepth; 00106 Hep3Vector RemID; 00107 G4String RemVol; 00108 00109 //Ext data 00110 RecExtTrack *myExtTrack; 00111 00112 bool msgFlag;//Message on/off 00113 bool myTofFlag;//when enter "physicalTof",this flag will be ture. 00114 bool myTof1Flag;//If we get Tof1 data,the flag will be true. 00115 bool myTof2Flag; 00116 bool myInTof1; 00117 bool myOutTof1; 00118 bool myInTof2; 00119 bool myOutTof2; 00120 bool myPhyEmcFlag;//when enter "BSC",this flag will be ture. 00121 bool myEmcFlag; 00122 bool myEmcPathFlag; 00123 bool myMucFlag; 00124 00125 double myTof1R; 00126 double myTof1Z; 00127 double myTof2R; 00128 00129 double myEmcR1; 00130 double myEmcR2; 00131 double myEmcZ; 00132 00133 double myMucR; 00134 double myMucZ; 00135 00136 int m_which_tof_version; 00137 }; 00138 00139 #endif