12 #include "FairRootManager.h"
13 #include "TClonesArray.h"
16 #include "../../../pnddata/TrackData/PndTrackCand.h"
17 #include "../../../pnddata/SdsData/PndSdsHit.h"
18 #include "../../../pnddata/MvdData/PndMvdHit.h"
19 #include "../../../pnddata/TrackData/PndTrackCandHit.h"
22 #include "TGeoTrack.h"
23 #include "TGeoManager.h"
24 #include "TLorentzVector.h"
34 #include <TVirtualFitter.h>
35 #include <TPolyLine3D.h>
36 #include <Math/Vector3D.h>
37 #include <TGraphErrors.h>
42 using namespace ROOT::Math;
46 : FairTask(
"3D-Straight-Line-Fit")
60 FairRootManager* ioman= FairRootManager::Instance();
64 Error(
"TtLinFitTask::Init",
"RootManager not instantiated!");
74 Error(
"TtLinFitTask::Init",
"trackcand-array not found!");
80 ioman->Register(
"TTFit",
"PndMvd",
fTrackArray, kTRUE);
82 std::cout <<
"-I- TtLinFitTask: Initialisation successfull" << std::endl;
97 for (Int_t qq = 0 ; qq < 6 ; qq++)
110 std::map<Double_t,Int_t> SensorsPos;
114 if(
fTrackArray==0) Fatal(
"TtLinFitTask::Exec",
"No TrackArray");
119 for(Int_t itr=0;itr<ntcand;++itr){
125 if (SensorsPos.size() < 6) SensorsPos[theHit->GetZ()] =
name;
129 const Int_t sizeMap = SensorsPos.size();
131 Int_t DetNames[sizeMap];
135 if (SensorsPos.size()>=6)
138 for (std::map<Double_t,Int_t>::iterator it=SensorsPos.begin();it!=SensorsPos.end();++it)
142 DetNames[
jj] = it->second;
143 Pos[
jj] = it -> first;
155 for (Int_t l = 0 ; l < sizeMap ; l++)
161 if (SensorsPos.size()==6)
184 for (Int_t it1 = 0 ; it1 < ntcand ; it1++)
191 x[0] = theHit->GetX();
192 y[0] = theHit->GetY();
193 z[0] = theHit->GetZ();
194 Erx[0] = theHit->GetDx();
195 Ery[0] = theHit->GetDy();
196 Erz[0] = theHit->GetDz();
202 x[1] = theHit->GetX();
203 y[1] = theHit->GetY();
204 z[1] = theHit->GetZ();
205 Erx[1] = theHit->GetDx();
206 Ery[1] = theHit->GetDy();
207 Erz[1] = theHit->GetDz();
212 x[2] = theHit->GetX();
213 y[2] = theHit->GetY();
214 z[2] = theHit->GetZ();
215 Erx[2] = theHit->GetDx();
216 Ery[2] = theHit->GetDy();
217 Erz[2] = theHit->GetDz();
223 x[3] = theHit->GetX();
224 y[3] = theHit->GetY();
225 z[3] = theHit->GetZ();
226 Erx[3] = theHit->GetDx();
227 Ery[3] = theHit->GetDy();
228 Erz[3] = theHit->GetDz();
233 x[4] = theHit->GetX();
234 y[4] = theHit->GetY();
235 z[4] = theHit->GetZ();
236 Erx[4] = theHit->GetDx();
237 Ery[4] = theHit->GetDy();
238 Erz[4] = theHit->GetDz();
244 x[5] = theHit->GetX();
245 y[5] = theHit->GetY();
246 z[5] = theHit->GetZ();
247 Erx[5] = theHit->GetDx();
248 Ery[5] = theHit->GetDy();
249 Erz[5] = theHit->GetDz();
262 for (Int_t ww = 0 ; ww < 6 ; ww++)
265 if (
TMath::Abs(Erx[ww]) > 0.5) Erx[ww] = 1000000;
266 if (
TMath::Abs(Ery[ww]) > 0.5) Ery[ww] = 1000000;
278 MyFit(x,y,z,Erx,Ery,Erz,parFit, chiX, chiY);
308 for (Int_t j = 0 ; j < 6 ; j++)
314 grX.SetPoint(ix,z[j],x[j]);
322 grY.SetPoint(iy,z[j],y[j]);
352 chiX = (grX.GetFunction(
"pol1"))->GetChisquare();
354 chiY = (grY.GetFunction(
"pol1"))->GetChisquare();
virtual void Exec(Option_t *opt)
TClonesArray * fTrackArray
TClonesArray * fTCandArray
cout<< "ifile "<< ifile<< endl;cout<< " momentum sampled over "<< nsteps<< " with step width "<< 1.5/nsteps<< endl;cout<< endl;cout<< "MEAN DEDX PARAMETRIZATION"<< endl;cout<< "mom limits "<< mean_inf<< " "<< mean_sup<< endl;cout<< "mu: ";for(int param=0;param< npardedx;param++) cout<< fdedx-> GetParameter(param)<< "
Double_t GetEloss() const
void MyFit(Double_t *x, Double_t *y, Double_t *z, Double_t *Erx, Double_t *Ery, Double_t *Erz, Double_t *par, Double_t &chiX, Double_t &chiY)
virtual InitStatus Init()
Int_t GetSensorID() const