00001 #include "MdcCalibAlg/MdcCalRecHit.h" 00002 00003 #include "GaudiKernel/MsgStream.h" 00004 #include "GaudiKernel/IMessageSvc.h" 00005 #include "GaudiKernel/StatusCode.h" 00006 #include "GaudiKernel/ISvcLocator.h" 00007 #include "GaudiKernel/Bootstrap.h" 00008 #include "GaudiKernel/SmartDataPtr.h" 00009 #include "GaudiKernel/IDataProviderSvc.h" 00010 00011 #include <iostream> 00012 00013 const double MdcCalRecHit::m_df = 10.0; 00014 const double MdcCalRecHit::m_qf = 1.0; 00015 00016 void MdcCalRecHit::setRecHit(HitRefVec::iterator it_hit){ 00017 IMessageSvc *msgSvc; 00018 Gaudi::svcLocator()->service("MessageSvc", msgSvc); 00019 MsgStream log(msgSvc, "MdcCalRecHit"); 00020 log << MSG::DEBUG << "MdcCalRecHit::setRecHit()" << endreq; 00021 00022 Identifier identifier; 00023 MdcID mdcid; 00024 00025 // log << MSG::DEBUG << "hit Id: " << (*it_hit)->getId() 00026 // << " hits drift time " << (*it_hit)->getDriftT() 00027 // << " hits doca " << (*it_hit)->getDoca() 00028 // << endreq; 00029 00030 identifier = (*it_hit)->getMdcId(); 00031 m_layid = mdcid.layer(identifier); 00032 m_cellid = mdcid.wire(identifier); 00033 m_lr = (*it_hit) -> getFlagLR(); 00034 m_stat = (*it_hit) -> getStat(); 00035 00036 m_docaInc = (*it_hit) -> getDoca(); 00037 m_docaExc = m_docaInc; 00038 00039 if( 0 == m_lr ){ 00040 m_dmeas = (*it_hit) -> getDriftDistLeft(); 00041 m_errdmeas = (*it_hit) -> getErrDriftDistLeft(); 00042 }else{ 00043 m_dmeas = (*it_hit) -> getDriftDistRight(); 00044 m_errdmeas = (*it_hit) -> getErrDriftDistRight(); 00045 } 00046 00047 m_tdc = (*it_hit) -> getTdc(); 00048 m_tdrift = (*it_hit) -> getDriftT(); 00049 00050 m_qhit = (*it_hit) -> getAdc(); 00051 m_zhit = (*it_hit) -> getZhit(); 00052 m_entra = (*it_hit) -> getEntra(); 00053 m_chisqadd = (*it_hit) -> getChisqAdd(); 00054 00055 double flen = (*it_hit) -> getFltLen(); // cm 00056 m_tof = flen / 30.0; 00057 00058 // the following is for cm to mm 00059 m_docaInc *= m_df; 00060 m_docaExc *= m_df; 00061 m_dmeas *= m_df; 00062 m_errdmeas *= m_df; 00063 m_zhit *= m_df; 00064 m_qhit *= m_qf; 00065 00066 m_resiInc = fabs(m_dmeas) - fabs(m_docaInc); 00067 if( 0 == m_lr ) m_resilrInc = -1.0 * m_resiInc; 00068 else m_resilrInc = m_resiInc; 00069 00070 m_resiExc = fabs(m_dmeas) - fabs(m_docaExc); 00071 if( 0 == m_lr ) m_resilrExc = -1.0 * m_resiExc; 00072 else m_resilrExc = m_resiExc; 00073 } 00074 00075 void MdcCalRecHit::setKalHit(HelixSegRefVec::iterator it_hit){ 00076 IMessageSvc *msgSvc; 00077 Gaudi::svcLocator()->service("MessageSvc", msgSvc); 00078 MsgStream log(msgSvc, "MdcCalRecHit"); 00079 log << MSG::DEBUG << "MdcCalRecHit::setKalHit()" << endreq; 00080 00081 Identifier identifier; 00082 MdcID mdcid; 00083 00084 identifier = (*it_hit) -> getMdcId(); 00085 m_layid = mdcid.layer(identifier); 00086 m_cellid = mdcid.wire(identifier); 00087 m_stat = 1; 00088 00089 m_lr = (*it_hit) -> getFlagLR(); 00090 if(-1 == m_lr) m_lr = 0; // definition not same as MdcRecHit 00091 00092 m_docaInc = (*it_hit) -> getDocaIncl(); 00093 m_docaExc = (*it_hit) -> getDocaExcl(); 00094 if(1 == m_lr){ 00095 m_docaInc *= -1.0; 00096 m_docaExc *= -1.0; 00097 } 00098 00099 m_dmeas = (*it_hit) -> getDD(); 00100 m_errdmeas = 0.013; 00101 00102 m_tdc = (*it_hit) -> getTdc(); 00103 m_tdrift = (*it_hit) -> getDT(); 00104 00105 m_qhit = (*it_hit) -> getAdc(); 00106 m_zhit = (*it_hit) -> getZhit(); 00107 m_entra = (*it_hit) -> getEntra(); 00108 m_chisqadd = 0.0; 00109 m_tof = (*it_hit) -> getTof(); 00110 00111 m_Dr = (*it_hit) -> getDrExcl(); 00112 m_Fi0 = (*it_hit) -> getFi0Excl(); 00113 m_Cpa = (*it_hit) -> getCpaExcl(); 00114 m_Dz = (*it_hit) -> getDzExcl(); 00115 m_Tanl = (*it_hit) -> getTanlExcl(); 00116 m_helix = (*it_hit)->getHelixExcl(); 00117 m_helixerr = (*it_hit)->getErrorExcl(); 00118 00119 // the following is for cm to mm 00120 m_docaInc *= m_df; 00121 m_docaExc *= m_df; 00122 m_dmeas *= m_df; 00123 m_errdmeas *= m_df; 00124 m_zhit *= m_df; 00125 m_qhit *= m_qf; 00126 00127 m_resiInc = fabs(m_dmeas) - fabs(m_docaInc); 00128 if( 0 == m_lr ) m_resilrInc = -1.0 * m_resiInc; 00129 else m_resilrInc = m_resiInc; 00130 00131 m_resiExc = fabs(m_dmeas) - fabs(m_docaExc); 00132 if( 0 == m_lr ) m_resilrExc = -1.0 * m_resiExc; 00133 else m_resilrExc = m_resiExc; 00134 00135 } 00136