200 for (Int_t qq = 0 ; qq < 6 ; qq++)
214 std::map<Double_t,Int_t> SensorsPos;
216 std::cout <<
"Event: " <<
fEvent << std::endl;
217 std::cout <<
"Initial map size: " << SensorsPos.size() << std::endl;
221 if(
fTrackArray==0) Fatal(
"TtCracowTask::Exec",
"No TrackArray");
226 for(Int_t itr=0;itr<ntcand;++itr){
232 if (SensorsPos.size() < 6) SensorsPos[theHit->GetZ()] =
name;
236 const Int_t sizeMap = (Int_t) SensorsPos.size();
238 Int_t DetNames[sizeMap];
244 if (SensorsPos.size()>=6)
247 std::cout <<
"Map size after looping: " << SensorsPos.size() << std::endl;
249 for (std::map<Double_t,Int_t>::iterator it=SensorsPos.begin();it!=SensorsPos.end();++it)
252 std::cout <<
"position: " << it->first <<
" name: " << (it->second) << std::endl;
254 DetNames[
jj] = it->second;
267 for (Int_t l = 0 ; l < sizeMap ; l++)
273 if (SensorsPos.size()==6)
296 TGraph2DErrors * gr =
new TGraph2DErrors();
298 for (Int_t it1 = 0 ; it1 < ntcand ; it1++)
305 x[0] = theHit->GetX();
306 y[0] = theHit->GetY();
307 z[0] = theHit->GetZ();
308 Erx[0] = theHit->GetDx();
309 Ery[0] = theHit->GetDy();
317 x[1] = theHit->GetX();
318 y[1] = theHit->GetY();
319 z[1] = theHit->GetZ();
320 Erx[1] = theHit->GetDx();
321 Ery[1] = theHit->GetDy();
328 x[2] = theHit->GetX();
329 y[2] = theHit->GetY();
330 z[2] = theHit->GetZ();
331 Erx[2] = theHit->GetDx();
332 Ery[2] = theHit->GetDy();
340 x[3] = theHit->GetX();
341 y[3] = theHit->GetY();
342 z[3] = theHit->GetZ();
343 Erx[3] = theHit->GetDx();
344 Ery[3] = theHit->GetDy();
351 x[4] = theHit->GetX();
352 y[4] = theHit->GetY();
353 z[4] = theHit->GetZ();
354 Erx[4] = theHit->GetDx();
355 Ery[4] = theHit->GetDy();
363 x[5] = theHit->GetX();
364 y[5] = theHit->GetY();
365 z[5] = theHit->GetZ();
366 Erx[5] = theHit->GetDx();
367 Ery[5] = theHit->GetDy();
382 for (Int_t ww = 0 ; ww < 6 ; ww++)
385 if (
TMath::Abs(Erx[ww]) > 0.5) Erx[ww] = 10000.;
386 if (
TMath::Abs(Ery[ww]) > 0.5) Ery[ww] = 10000.;
397 if (s0 && s1 && s2 && s3 && s4 && s5)
399 for (Int_t ss = 0 ; ss < 6 ; ss++)
401 gr->SetPoint(ss,x[ss],y[ss],z[ss]);
402 gr->SetPointError(ss,x[ss],y[ss],z[ss]);
406 Int_t Npoint = gr->GetN();
413 dir.SetXYZ(xx[Npoint-1]-xx[0],yy[Npoint-1]-yy[0],zz[Npoint-1]-zz[0]);
415 TVirtualFitter::SetDefaultFitter(
"Minuit");
416 TVirtualFitter *
min = TVirtualFitter::Fitter(0,4);
417 min->SetObjectFit(gr);
423 min->ExecuteCommand(
"SET NOWarnings",arglist,1);
425 min->ExecuteCommand(
"SET PRINT",arglist,1);
435 min->SetParameter(0,
"y0",0,1,0,0);
436 min->SetParameter(1,
"A",0,1,0,0);
437 min->SetParameter(2,
"z0",0,1,0,0);
438 min->SetParameter(3,
"B",0,1,0,0);
442 min->ExecuteCommand(
"MIGRAD", arglist ,2);
445 double amin,edm, errdef;
446 min->GetStats(amin,edm,errdef,nvpar,nparx);
447 if(
fVerbose>1) min->PrintResults(1,amin);
456 for (Int_t gg = 0 ; gg < 6 ; gg++) SumEn +=
fEloss[gg];
458 std::cout <<
"Scrivo" << endl;
459 new ((*fTrackArray)[0])
TtFitRes(min->GetParameter(0), min->GetParameter(1), min->GetParameter(2), min->GetParameter(3), SumEn, chi2, chi2, Npoint) ;
Double_t GetEloss() const
TClonesArray * fTrackArray
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
static void SumDistance2(int &, double *, double &sum, double *par, int)
TClonesArray * fTCandArray
Int_t GetSensorID() const