12#include "RKTrackRep.h"
14#include "FieldManager.h"
15#include "TGeoMaterialInterface.h"
16#include "MaterialEffects.h"
27 FitStatus* fitStatus = track->getFitStatus();
34 for (
auto i = 0; i < track->getNumPoints(); i++ )
36 auto state = track->getFittedState(i);
38 fRawMeasDetID.push_back(track->getPointWithMeasurement(i)->getRawMeasurement()->getDetId());
42 start = state.getPos();
44 if (i == track->getNumPoints()-1)
45 stop = state.getPos();
68 MuFilter *MuFilterDet =
dynamic_cast<MuFilter*
> (gROOT->GetListOfGlobals()->FindObject(
"MuFilter") );
69 Scifi *ScifiDet =
dynamic_cast<Scifi*
> (gROOT->GetListOfGlobals()->FindObject(
"Scifi") );
70 double resol{}, resol_0{};
72 TMatrixD Tres1(size-1,1), Tres2(size-1,1);
73 TMatrixD Sigma(size-1, size-1);
78 else resol_0 = MuFilterDet->
GetConfParF(
"MuFilter/timeResol");
80 for (
int i = 0; i < size-1; i++){
81 Tres1[i][0] = corr_times[i+1] - corr_times[0]
83 Tres2[i][0] = corr_times[0] - corr_times[i+1]
89 for (
int j = 0; j < size-1; j++){
94 else resol = MuFilterDet->
GetConfParF(
"MuFilter/timeResol");
95 Sigma[i][j] = pow(resol_0,2)+pow(resol,2);
97 else Sigma[i][j] = pow(resol_0,2);
100 TMatrixD SigmaInv(TMatrixD::kInverted,Sigma);
101 TMatrixD Tres1_T(TMatrixD::kTransposed,Tres1);
104 TMatrixD Tres2_T(TMatrixD::kTransposed,Tres2);
105 TMatrixT<double> LambdaB1 = Tres1_T*SigmaInv*Tres1;
106 TMatrixT<double> LambdaB2 = Tres2_T*SigmaInv*Tres2;
112 if (LambdaB2[0][0]-LambdaB1[0][0] >= 0)
113 return make_pair(1, TMath::Prob(LambdaB1[0][0], size-1));
114 else return make_pair(-1, TMath::Prob(LambdaB2[0][0], size-1));
126 MuFilter *MuFilterDet =
dynamic_cast<MuFilter*
> (gROOT->GetListOfGlobals()->FindObject(
"MuFilter") );
127 Scifi *ScifiDet =
dynamic_cast<Scifi*
> (gROOT->GetListOfGlobals()->FindObject(
"Scifi") );
129 double resol{}, delta_T{};
134 else resol = MuFilterDet->
GetConfParF(
"MuFilter/timeResol");
135 delta_T = corr_times[i]-corr_times[0];
137 if (fabs(delta_T) < resol*sqrt(2))
continue;
140 TF1 line(
"line",
"pol1");
143 return make_pair(9999.,999.);
145 gr.Fit(
"line",
"SQ");
147 return make_pair(1./line.GetParameter(1),line.GetParError(1)/pow(line.GetParameter(1),2));
162 double dist{}, delta_T{};
164 double firstScifi_z = 300*ShipUnit::cm;
167 double lam = (firstScifi_z - pos.z())/mom.z();
169 TVector3 pos1(pos.x()+lam*mom.x(), pos.y()+lam*mom.y(), firstScifi_z);
173 gr.AddPoint(dist, corr_times[i] - dist/ShipUnit::c_light);
175 TF1 line(
"line",
"pol1");
176 gr.Fit(
"line",
"SQ");
177 return make_tuple(line.GetParameter(1),
178 line.GetParameter(1)/(line.GetParError(1)+1E-13), line.GetParameter(0));
183 TVector3 NewPosition = TVector3(0., 0., z);
186 TVector3 parallelToZ = TVector3(0., 0., 1.);
193 if ( fabs(zMin -
fTrackPoints[i].Z()) < zMin ) index = i;
205 vector<float> corr_times{};
206 MuFilter *MuFilterDet =
dynamic_cast<MuFilter*
> (gROOT->GetListOfGlobals()->FindObject(
"MuFilter") );
207 Scifi *ScifiDet =
dynamic_cast<Scifi*
> (gROOT->GetListOfGlobals()->FindObject(
"Scifi") );
210 float mean{}, fastest=999.;
215 scintVel = ScifiDet->
GetConfParF(
"Scifi/signalSpeed");
221 L = MuFilterDet->
GetConfParF(
"MuFilter/DownstreamBarX");
222 scintVel = MuFilterDet->
GetConfParF(
"MuFilter/DsPropSpeed");
225 else scintVel = MuFilterDet->
GetConfParF(
"MuFilter/VandUpPropSpeed");
240 for (
int ch = 0, N_channels =
fRawMeasTimes[i].size(); ch <N_channels; ch++ ){
244 if ( N_channels==1 ){
250 if (ch == N_channels-1) corr_times.push_back(mean/N_channels- L/scintVel/2.);
256 if (ch == N_channels-1) corr_times.push_back(fastest - X.Mag()/scintVel);
void GetPosition(Int_t id, TVector3 &vLeft, TVector3 &vRight)
Float_t GetCorrectedTime(Int_t id, Int_t c, Double_t t, Double_t L)
Float_t GetConfParF(TString name)
void GetSiPMPosition(Int_t SiPMChan, TVector3 &A, TVector3 &B)
Float_t GetConfParF(TString name)
Double_t GetCorrectedTime(Int_t fDetectorID, Double_t rawTime, Double_t L)
Class where important numbers and properties of a fit can be stored.
double getNdf() const
Get the degrees of freedom of the fit.
bool isFitConverged(bool inAllPoints=true) const
Did the fit converge (in all Points or only partially)?
double getChi2() const
Get chi^2 of the fit.
AbsTrackRep with 5D track parameterization in plane coordinates: (q/p, u', v', u, v)
virtual void setPosMom(StateOnPlane &state, const TVector3 &pos, const TVector3 &mom) const
Set position and momentum of state.
virtual double extrapolateToPlane(StateOnPlane &state, const SharedPlanePtr &plane, bool stopAtBoundary=false, bool calcJacobianNoise=false) const
Extrapolates the state to plane, and returns the extrapolation length and, via reference,...
A state with arbitrary dimension defined in a DetPlane.
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
std::vector< TVector3 > fTrackPoints
std::vector< float > getCorrTimes()
std::vector< int > fRawMeasDetID
TVector3 extrapolateToPlaneAtZ(float z)
std::vector< std::vector< float > > fRawMeasTimes
std::tuple< float, float, float > trackDir()
std::pair< int, float > TrackDirection()
std::pair< float, float > Velocity()