2#include "CLHEP/Matrix/SymMatrix.h"
3#include "EventModel/Event.h"
4#include "GaudiKernel/Algorithm.h"
5#include "GaudiKernel/Bootstrap.h"
6#include "GaudiKernel/IDataProviderSvc.h"
7#include "GaudiKernel/ISvcLocator.h"
8#include "GaudiKernel/MsgStream.h"
9#include "GaudiKernel/SmartDataPtr.h"
10#include "Identifier/Identifier.h"
11#include "Identifier/MdcID.h"
12#include "KalFitAlg/KalFitTrack.h"
13#include "KalFitAlg/KalFitWire.h"
14#include "MagneticFieldSvc/IBesMagFieldSvc.h"
15#include "MdcRawEvent/MdcDigi.h"
16#include "RawEvent/RawDataUtil.h"
18double KalFitTrack::EventT0_ = 0.;
19HepSymMatrix KalFitTrack::initMatrix_( 5, 0 );
42 EventT0_ = eventstart;
44 { std::cout <<
"in function KalFitTrack::setT0(...), EventT0_ = " << EventT0_ << std::endl; }
51 { std::cout <<
"in function KalFitTrack::getT0 ( ), EventT0_ = " << EventT0_ << std::endl; }
63 const double vinner = 220.0e8;
64 const double vouter = 240.0e8;
67 double zhit = ( hitmdc.
rechitptr() )->getZhit();
73 double wireLen = ( fPoint - bPoint ).
x() * ( fPoint - bPoint ).
x() +
74 ( fPoint - bPoint ).y() * ( fPoint - bPoint ).y() +
75 ( fPoint - bPoint ).z() * ( fPoint - bPoint ).z();
76 wireLen = sqrt( wireLen );
77 double wireZLen = fabs( fPoint.z() - bPoint.z() );
81 if ( 0 == layerid % 2 )
84 if ( layerid < 8 ) { vp = vinner; }
86 tp = wireLen * fabs( zhit - bPoint.z() ) / wireZLen / vp;
90 if ( 1 == layerid % 2 )
93 if ( layerid < 8 ) { vp = vinner; }
95 tp = wireLen * fabs( zhit - fPoint.z() ) / wireZLen / vp;
101 if ( 0 ==
tprop_ ) tp = 0.;
106 double drifttime1( 0. );
107 double drifttime2( 0. );
108 double drifttime3( 0. );
110 MdcDigiCol::iterator
iter = mdcDigiCol_->begin();
111 for ( ;
iter != mdcDigiCol_->end();
iter++ )
113 if ( ( *iter )->identify() == ( hitmdc.
rechitptr() )->getMdcId() )
break;
121 double timewalk = CalibFunSvc_->getTimeWalk( layerid, Q );
124 { std::cout <<
"CalibFunSvc_->getTimeWalk, timewalk =" << timewalk << std::endl; }
126 double timeoffset = CalibFunSvc_->getT0( wireid );
128 { std::cout <<
"CalibFunSvc_->getT0, timeoffset =" << timeoffset << std::endl; }
130 double eventt0 =
getT0();
134 std::cout <<
"the Event T0 we get in the function getDriftTime(...) is " << eventt0
139 double tdctime1 = hitmdc.
tdc();
140 double tdctime2( 0. );
141 double tdctime3( 0. );
143 if (
debug_ == 4 ) { std::cout <<
"tdctime1 be here is .." << tdctime1 << std::endl; }
159 std::cout <<
"the time channel be here is .." << ( *iter )->getTimeChannel() << std::endl;
163 drifttime1 = tdctime1 - eventt0 - toftime - timewalk - timeoffset - tp;
164 drifttime2 = tdctime2 - eventt0 - toftime - timewalk - timeoffset - tp;
165 drifttime3 = tdctime3 - eventt0 - toftime - timewalk - timeoffset - tp;
168 std::cout <<
"we now compare the three kind of tdc , the tdc get from timeChannel() is "
169 << tdctime2 <<
" the tdc get from KalFitHitMdc is " << tdctime1
170 <<
" the tdc from MdcRecHit is " << tdctime3 <<
" the drifttime1 is ..."
171 << drifttime1 <<
" the drifttime 2 is ..." << drifttime2
172 <<
" the drifttime3 is ..." << drifttime3 << std::endl;
181 std::cerr << __FILE__ <<
":" << __LINE__ <<
": should not reach here" << std::endl;
189 if (
debug_ == 4 ) { std::cout <<
"the cellid is .." << cellid << std::endl; }
194 return CalibFunSvc_->driftTimeToDist( drifttime, layerid, cellid, lr, entrangle );
199 double dist )
const {
209 double temp = CalibFunSvc_->getSigma( layerid, lr, dist, entrangle, tanlam, z, Q );
215 CalibFunSvc_ = calibsvc;
225 if ( MFSvc_ == 0 ) cout <<
"KalFitTrack2:: Could not load MagneticFieldSvc!" << endl;
HepGeom::Point3D< double > HepPoint3D
ObjectVector< MdcDigi > MdcDigiCol
Description of a Hit in Mdc.
RecMdcHit * rechitptr(void)
const KalFitWire & wire(void) const
const int layerId(void) const
returns layer ID
static void setMdcDigiCol(MdcDigiCol *digicol)
double getDriftTime(KalFitHitMdc &hitmdc, double toftime) const
static int debug_
for debug
HepSymMatrix getInitMatrix(void) const
static void setInitMatrix(HepSymMatrix m)
double getSigma(int layerId, double driftDist) const
static int drifttime_choice_
the drifttime choice
static int tprop_
for signal propagation correction
static void setMdcCalibFunSvc(const IMdcCalibFunSvc *calibsvc)
double getDriftDist(KalFitHitMdc &hitmdc, double drifttime, int lr) const
static void setT0(double t0)
static void setMagneticFieldSvc(IBesMagFieldSvc *)
static void setIMdcGeomSvc(IMdcGeomSvc *igeomsvc)
Description of a Wire class.
unsigned int geoID(void) const
HepPoint3D bck(void) const
HepPoint3D fwd(void) const
Geometry :
const KalFitLayer_Mdc & layer(void) const
static int wire(const Identifier &id)
static double MdcTime(int timeChannel)
static double MdcCharge(int chargeChannel)
const double getZhit(void) const
const double getAdc(void) const
const Identifier getMdcId(void) const
const double getTdc(void) const
const double getDriftT(void) const
const double getEntra(void) const