25 #include "TRootEmbeddedCanvas.h"
29 #include "TLinearFitter.h"
57 if (plane != NULL )plane->
print();
65 Info(
"process",
"Process event %ld",nEvents);
67 if(fEvt->GetRecoEvent()->GetTracksArray()->GetEntries()>0){
68 Info(
"process",
"Reset existing tracking %ld",nEvents);
69 fEvt->GetRecoEvent()->ResetTracksArray();
70 TClonesArray* clArray = fEvt->GetRecoEvent()->GetClustersArray();
71 Int_t nCl = clArray->GetEntries();
72 for(Int_t i=0;i<nCl;i++){
77 fEvt->GetRecoEvent()->SetTrackType(
HOUGH);
79 hSigmaRhoEvent->Reset();
80 hSigmaThetaEvent->Reset();
91 for(Int_t ndet=0;ndet<2;ndet++) {
114 double pi=TMath::Pi();
121 Double_t xCenter = 0.;
122 Double_t yCenter = 0.;
123 Double_t xWidth = kfWidthRho;
124 Double_t yWidth = kfWidthTheta;
127 while(goodbinning==1 && nloop < maxLoops){
131 Info(
"FindPairNew",
"loop == %d",nloop);
133 TH2F* h =
new TH2F(
"h",
";#rho [mm];#theta",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
134 TH2F* hPair =
new TH2F(
"hPair",
";#rho [mm];#theta",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
135 TH2F* hPairW =
new TH2F(
"hPairW",
";#rho [mm];#theta",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
136 TH2F* hPairRho =
new TH2F(
"hPairRho",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
137 TH2F* hPairRho2 =
new TH2F(
"hPairRho2",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
138 TH2F* hPairRho3 =
new TH2F(
"hPairRho3",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
139 TH2F* hPairRho4 =
new TH2F(
"hPairRho4",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
140 TH2F* hPairTheta =
new TH2F(
"hPairTheta",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
141 TH2F* hPairTheta2 =
new TH2F(
"hPairTheta2",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
142 TH2F* hPairTheta3 =
new TH2F(
"hPairTheta3",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
143 TH2F* hPairTheta4 =
new TH2F(
"hPairTheta4",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
144 TH2F* hPairRhoTheta =
new TH2F(
"hPairRhoTheta",
"",fNbinr,xCenter - xWidth, xCenter + xWidth,fNbint,yCenter - yWidth, yCenter + yWidth);
149 Int_t nCl = clArray->GetEntries();
150 for(Int_t i=0;i<nCl;i++){
155 Double_t q1 = cl1->
GetQ();
158 if(cl1->
GetPlane()!=plane)
continue;
159 if(iclusttrack[i]>=0)
continue;
160 if(cl1->
GetQ()<=fQmin[type1])
continue;
161 if(cl1->
GetWidth()>=fWmax[type1])
continue;
162 if(cl1->
GetWidth()<=fWmin[type1])
continue;
165 Double_t t1 = 0, c1 = 0;
176 for(Int_t j=i+1;j<nCl;j++){
181 Double_t q2 = cl2->
GetQ();
182 if(cl2->
GetPlane()!=plane)
continue;
183 if(iclusttrack[j]>=0)
continue;
184 if(cl2->
GetQ()<=fQmin[type2])
continue;
185 if(cl2->
GetWidth()>=fWmax[type2])
continue;
186 if(cl2->
GetWidth()<=fWmin[type2])
continue;
188 Double_t t2 = 0, c2 = 0;
199 Double_t dt = t2 - t1;
200 Double_t dc = c2 - c1;
201 Double_t dist = sqrt(dt*dt + dc*dc);
203 if (dist<=fDistMin)
continue;
204 Double_t theta = pi/2;
205 if(dt) theta = -TMath::ATan(dc/dt);
206 Double_t cross = c1*t2 - c2*t1;
207 Double_t rho = TMath::Abs(cross/dist);
208 if((t2-t1)*cross<0) rho = -rho;
209 if(type1 ==
CCLUSTER && type2 ==
CCLUSTER && TMath::Abs(TMath::Cos(theta)) < 0.5)
continue;
210 if(type1 ==
TCLUSTER && type2 ==
TCLUSTER && TMath::Abs(TMath::Sin(theta)) < 0.5)
continue;
212 if(q1>0 && q2>0) weight = TMath::Sqrt(q1*q2);
214 hPair->Fill(rho, theta);
215 hPairW->Fill(rho, theta,weight);
216 hPairRho->Fill(rho, theta, rho*weight);
217 hPairRho2->Fill(rho, theta, rho*rho*weight);
218 hPairTheta->Fill(rho, theta, theta*weight);
219 hPairTheta2->Fill(rho, theta, theta*theta*weight);
220 hPairRhoTheta->Fill(rho, theta, rho*theta*weight);
224 if(theta>0) theta = theta - TMath::Pi();
225 else theta = theta + TMath::Pi();
226 hPair->Fill(rho, theta);
227 hPairW->Fill(rho, theta,weight);
228 hPairRho->Fill(rho, theta, rho*weight);
229 hPairRho2->Fill(rho, theta, rho*rho*weight);
230 hPairRho3->Fill(rho, theta, rho*rho*rho*weight);
231 hPairRho4->Fill(rho, theta, rho*rho*rho*rho*weight);
232 hPairTheta->Fill(rho, theta, theta*weight);
233 hPairTheta2->Fill(rho, theta, theta*theta*weight);
234 hPairTheta3->Fill(rho, theta, theta*theta*theta*weight);
235 hPairTheta4->Fill(rho, theta, theta*theta*theta*theta*weight);
236 hPairRhoTheta->Fill(rho, theta, rho*theta*weight);
242 if(hPair->GetEntries()<10) {
250 hPairTheta->Delete();
251 hPairTheta2->Delete();
252 hPairTheta3->Delete();
253 hPairTheta4->Delete();
254 hPairRhoTheta->Delete();
260 for (Int_t ir=1;ir<=fNbinr;ir++){
261 for (Int_t it=1;it<=fNbint;it++){
262 Int_t n = hPair->GetBinContent(ir,it);
263 Double_t weight = hPairW->GetBinContent(ir,it);
265 if(weight<=0)
continue;
266 Double_t muRhoTmp = hPairRho->GetBinContent(ir,it)/weight;
267 Double_t m3RhoTmp = hPairRho3->GetBinContent(ir,it)/weight;
268 Double_t m4RhoTmp = hPairRho4->GetBinContent(ir,it)/weight;
269 Double_t sigmaRhoTmp = hPairRho2->GetBinContent(ir,it)/weight - muRhoTmp*muRhoTmp;
270 m4RhoTmp = m4RhoTmp - 4*muRhoTmp*m3RhoTmp + 6*muRhoTmp*muRhoTmp*sigmaRhoTmp - 3*muRhoTmp*muRhoTmp*muRhoTmp*muRhoTmp;
271 Double_t muThetaTmp = hPairTheta->GetBinContent(ir,it)/weight;
272 Double_t m3ThetaTmp = hPairTheta3->GetBinContent(ir,it)/weight;
273 Double_t m4ThetaTmp = hPairTheta4->GetBinContent(ir,it)/weight;
275 m4ThetaTmp = m4ThetaTmp - 4*muThetaTmp*m3ThetaTmp + 6*muThetaTmp*muThetaTmp*sigmaRhoTmp - 3*muThetaTmp*muThetaTmp*muThetaTmp*muThetaTmp;
276 if(sigmaRhoTmp > sRmax) sRmax = sigmaRhoTmp;
285 h->SetBinContent(ir,it,n);
293 Int_t ix = 0, iy = 0, iz = 0;
294 h->GetYaxis()->SetRangeUser(-TMath::Pi()/2,TMath::Pi()/2);
295 h->GetMaximumBin(ix, iy, iz);
296 Double_t rhoMax = hPair->GetXaxis()->GetBinLowEdge(ix);
297 Double_t thetaMax = hPair->GetYaxis()->GetBinLowEdge(iy);
301 Info(
"",
"%g %g %g",hPairRho2->GetBinContent(ix,iy),hPairTheta2->GetBinContent(ix,iy),hPair->GetBinContent(ix,iy));
303 Double_t muRhoPeak = hPairRho->GetBinContent(ix,iy)/hPairW->GetBinContent(ix,iy);
304 Double_t sigmaRhoPeak = TMath::Sqrt(hPairRho2->GetBinContent(ix,iy)/hPairW->GetBinContent(ix,iy) - muRhoPeak*muRhoPeak)/hPair->GetXaxis()->GetBinWidth(1);
305 Double_t muThetaPeak = hPairTheta->GetBinContent(ix,iy)/hPairW->GetBinContent(ix,iy);
306 Double_t sigmaThetaPeak = TMath::Sqrt(hPairTheta2->GetBinContent(ix,iy)/hPairW->GetBinContent(ix,iy) - muThetaPeak*muThetaPeak)/hPair->GetYaxis()->GetBinWidth(1);
322 Info(
"FindPairNew",
"###################### %d %d %d (%d)",plane,trackId,nloop,fDisplay);
324 if(fDisplay && trackId<5 && nloop<5){
325 Info(
"FindPairNew",
"%d %d %d => %g %g %g",plane,trackId,nloop,sigmaRhoPeak,sigmaThetaPeak,hPair->GetBinContent(ix,iy));
326 fHist[plane][trackId][nloop] = (TH2F*)h->Clone(Form(
"h%d_%d_%d",plane,trackId,nloop));
327 if(nloop>fNloopMax) fNloopMax = nloop;
328 if(trackId>fTrackIdMax) fTrackIdMax = trackId;
329 fSigmaRhoPeak[plane][trackId][nloop] = sigmaRhoPeak;
330 fSigmaThetaPeak[plane][trackId][nloop] = sigmaThetaPeak;
331 fNpairsPeak[plane][trackId][nloop] = hPair->GetBinContent(ix,iy);
334 hSigmaRho->Fill(sigmaRhoPeak);
335 hSigmaTheta->Fill(sigmaThetaPeak);
336 hSigmaRhoEvent->Fill(sigmaRhoPeak);
337 hSigmaThetaEvent->Fill(sigmaThetaPeak);
339 Info(
"FindPairNew",
"sigmaRhoPeak = %g, sigmaThetaPeak = %g, hPair = %g",sigmaRhoPeak,sigmaThetaPeak,hPair->GetXaxis()->GetBinWidth(1));
340 if((sigmaRhoPeak<fSigmaMaxRebin || sigmaThetaPeak<fSigmaMaxRebin) && nloop < maxLoops - 1 && hPair->GetBinContent(ix,iy)>fMinPairs){
346 xWidth /= kfFacHough;
347 yWidth /= kfFacHough;
356 hPairTheta->Delete();
357 hPairTheta2->Delete();
358 hPairTheta3->Delete();
359 hPairTheta4->Delete();
360 hPairRhoTheta->Delete();
377 TH1F* h1D =
new TH1F(
"h1D",
"",fNbinr,0,fNbinr);
378 TH1F* h1DRho =
new TH1F(
"h1DRho",
"",fNbinr,0,fNbinr);
379 TH1F* h1DRho2 =
new TH1F(
"h1DRho2",
"",fNbinr,0,fNbinr);
380 TH1F* h1DTheta =
new TH1F(
"h1DTheta",
"",fNbinr,0,fNbinr);
381 TH1F* h1DTheta2 =
new TH1F(
"h1DTheta2",
"",fNbinr,0,fNbinr);
382 TH1F* h1DRhoTheta =
new TH1F(
"h1DRhoTheta",
"",fNbinr,0,fNbinr);
383 for (Int_t ir=1;ir<=fNbinr;ir++){
384 for (Int_t it=1;it<=fNbint;it++){
385 Int_t idx=TMath::Abs(ir-ix);
386 Int_t idy=TMath::Abs(it-iy);
387 Double_t idd = idx + idy + 0.5;
389 h1D->Fill(idd,hPairW->GetBinContent(ir,it));
390 h1DRho->Fill(idd,hPairRho->GetBinContent(ir,it));
391 h1DRho2->Fill(idd,hPairRho2->GetBinContent(ir,it));
392 h1DTheta->Fill(idd,hPairTheta->GetBinContent(ir,it));
393 h1DTheta2->Fill(idd,hPairTheta2->GetBinContent(ir,it));
394 h1DRhoTheta->Fill(idd,hPairRhoTheta->GetBinContent(ir,it));
410 Int_t ioMax = h1D->GetXaxis()->GetNbins();
411 for(Int_t io=2;io<=ioMax;io++){
412 Int_t n = h1D->Integral(1,io);
413 Double_t muRho=h1DRho->Integral(1,io)/n;
414 Double_t sigRho=h1DRho2->Integral(1,io)/n - muRho*muRho;
416 if(sigRho>0) sigRho = TMath::Sqrt(sigRho);
419 Double_t muTheta=h1DTheta->Integral(1,io)/n;
421 Double_t sigTheta=h1DTheta2->Integral(1,io)/n - muTheta*muTheta;
422 if(sigTheta>0) sigTheta = sqrt(sigTheta);
431 if(sigRho>0) rapr = (io-1) * hPair->GetXaxis()->GetBinWidth(1) / sigRho;
432 if(sigTheta>0) rapt = (io-1) * hPair->GetYaxis()->GetBinWidth(1) / sigTheta;
436 Info(
"FindPairNew",
"io = %d, rapr = %g, rapr0 = %g, rapt = %g, rapt0 = %g", io,rapr,rapr0,rapt,rapt0);
437 if(io==ioMax || (((rapr>fCutoffHough && rapr0<fCutoffHough)||(rapt>fCutoffHough && rapt0<fCutoffHough))&&io>2)){
441 muThetaOut = muTheta;
442 sigThetaOut = sigTheta;
445 Info(
"FindPairNew",
"theta = %.3g +- %.3g rho = %.3g +- %.3g",muThetaOut, sigThetaOut, muRhoOut, sigRhoOut);
454 hPairTheta->Delete();
455 hPairTheta2->Delete();
456 hPairTheta3->Delete();
457 hPairTheta4->Delete();
458 hPairRhoTheta->Delete();
464 h1DRhoTheta->Delete();
479 hPairTheta->Delete();
480 hPairTheta2->Delete();
481 hPairTheta3->Delete();
482 hPairTheta4->Delete();
483 hPairRhoTheta->Delete();
489 h1DRhoTheta->Delete();
508 if(
gHarpoDebug>1) Info(
"FindTrack",
"Plane %d",plane);
511 Int_t nCl = clArray->GetEntries();
517 Int_t nClLeftOld = -1;
522 Double_t rho = -1000, theta = -1000,sigRho = -1, sigTheta = -1;
523 FindPairNew(plane, trackId,rho,theta,sigRho,sigTheta);
524 if(theta == -1000)
break;
525 if(sigTheta<1e-3) sigTheta = 0.001;
526 if(sigRho<1e-3) sigRho = 0.001;
527 Double_t stheta = cos(theta);
528 Double_t ctheta = sin(theta);
532 Int_t typeTrack = -1;
533 Int_t nClOnly = 0, nClLeft = 0;
534 for (ic=0;ic<nCl;ic++){
537 if(type ==
CCLUSTER && TMath::Abs(ctheta) < 0.5)
continue;
538 if(type ==
TCLUSTER && TMath::Abs(stheta) < 0.5)
continue;
541 if(planeCl!=plane)
continue;
543 if(cl->
GetQ()<=fQmin[
type])
continue;
547 Info(
"FindTrack",
"cluster %d, Plane= %d", ic, plane);
549 Double_t x0 = cl->
GetZ();
550 Double_t y0 = cl->
GetX();
553 Double_t rlambda = stheta*(x0 -
NADC/2) - ctheta*(y0 -
NCHAN/2) ;
554 Double_t x = rho*ctheta + rlambda*stheta +
NADC/2;
555 Double_t y = rho*stheta - rlambda*ctheta +
NCHAN/2;
557 Double_t dist = (x - x0)*ctheta + (y - y0)*stheta ;
558 Double_t sigtrans = sigRho;
560 if(cl->
GetNtr()<1) nClLeft++;
561 if(TMath::Abs(dist)< RouteHoughLoose*sigtrans){
563 if(cl->
GetNtr()<1) nClOnly++;
565 if(TMath::Abs(dist)< RouteHoughTight*sigtrans)
571 Info(
"FindTrack",
"Ncluster = %d/%d/%d, Plane= %d",nClOnly, Ncluster,nClLeft, plane);
573 if ( nClLeft == nClLeftOld)
break;
574 nClLeftOld = nClLeft;
576 if(nClOnly<5)
continue;
578 if( Ncluster<=fNclMin)
584 TGraph* gTrack =
new TGraph();
586 Double_t lambdaMin = 1e8, lambdaMax = -1e8;
587 Double_t xStart = 0, zStart = 0, xEnd = 0, zEnd = 0;
588 for (ic=0;ic<nCl;ic++){
593 Double_t q = cl->
GetQ();
599 if(cl->
GetQ()<=fQmin[
type])
continue;
603 Double_t x0 = cl->
GetZ();
604 Double_t y0 = cl->
GetX();
606 Double_t rlambda = stheta*(x0 -
NADC/2) - ctheta*(y0 -
NCHAN/2) ;
607 Double_t x = rho*ctheta + rlambda*stheta +
NADC/2;
608 Double_t y = rho*stheta - rlambda*ctheta +
NCHAN/2;
610 Double_t dist = (x - x0)*ctheta + (y - y0)*stheta ;
611 Double_t sigtrans = sigRho;
614 if(TMath::Abs(dist)< RouteHoughTight*sigtrans)
616 if(TMath::Abs(dist)< RouteHoughLoose*sigtrans){
626 gTrack->SetPoint(gTrack->GetN(),x0,y0);
628 if(rlambda < lambdaMin){
633 if(rlambda > lambdaMax){
641 Double_t slope = -1000, x0 = -1000;
643 slope=-ctheta/stheta;
658 Double_t AngleTrack = 0.0;
662 Info(
"FindTrack",
"%g / %g = %g",ctheta,stheta,AngleTrack);
663 Int_t IdTrackMatching=-1;
665 HarpoRecoHoughTracks* tr =
new HarpoRecoHoughTracks(mtrack,theta,rho,sigTheta,sigRho,Qtrack,AngleTrack,x0,typeTrack,IdTrackMatching,Ncluster,plane,xStart,zStart,xEnd,zEnd);
667 fEvt->GetRecoEvent()->AddTracks(tr);
670 Info(
"FindTrack",
"Found track %d",mtrack);
684 for(Int_t plane = 0; plane<2; plane++){
685 for(Int_t track = 0; track<5; track++){
686 for(Int_t loop = 0; loop<5; loop++){
687 fHist[plane][track][loop] = 0;
696 for(Int_t itr = 0; itr<
NTRACK; itr++){
698 fGraphRoute[itr]->Delete();
699 fGraphRoute[itr] =
new TGraph();
708 Info(
"Init",
"initializing tracking");
711 for(Int_t itr = 0; itr<
NTRACK; itr++){
712 fGraphRoute[itr] = 0;
713 fGraphRoute[itr] = 0;
730 fSigmaMaxRebin = 0.25;
733 RouteHoughTight = 3.;
734 RouteHoughLoose = 6.;
752 Info(
"Constructor",
"Use default fWminT %d",fWmin[
TCLUSTER]);
757 Info(
"Constructor",
"Use default fWminC %d",fWmin[
CCLUSTER]);
763 Info(
"Constructor",
"Use default fWmaxT %d",fWmax[TCLUSTER]);
768 Info(
"Constructor",
"Use default fWmaxC %d",fWmax[CCLUSTER]);
774 Info(
"Constructor",
"Use default fQminT %d",fQmin[TCLUSTER]);
779 Info(
"Constructor",
"Use default fQminC %d",fQmin[CCLUSTER]);
784 Info(
"Constructor",
"Use default fQminBloc %d",fQmin[
BLOCCLUSTER]);
788 Long64_t MinPairs = 50;
790 Info(
"Constructor",
"Use default fMinPairs %d",fMinPairs);
792 fMinPairs = MinPairs;
795 Double_t cutoffhough = 6., routehoughTight = 3., routehoughLoose = 6.;
797 Info(
"Constructor",
"Use default CutoffHough %g",fCutoffHough);
799 fCutoffHough = cutoffhough;
801 Info(
"Constructor",
"Use default RouteHoughTight %g",RouteHoughTight);
803 RouteHoughTight = routehoughTight;
805 Info(
"Constructor",
"Use default RouteHoughLoose %g",RouteHoughLoose);
807 RouteHoughLoose = routehoughLoose;
808 Double_t sigmaMaxRebin = 0.25;
810 Info(
"Constructor",
"Use default SigmaMaxRebin %g",fSigmaMaxRebin);
812 fSigmaMaxRebin = sigmaMaxRebin;
822 Long64_t Nbinr=32, Nbint=80;
824 Info(
"Constructor",
"Use default fNbinr %d",fNbinr);
829 Info(
"Constructor",
"Use default fNbint %d",fNbint);
834 hSigmaRho =
new TH1F(
"hSigmaRho",
"",100,0,1);
835 hSigmaRho->SetLineColor(kRed);
836 hSigmaTheta =
new TH1F(
"hSigmaTheta",
"",100,0,1);
837 hSigmaTheta->SetLineColor(kRed);
838 hSigmaRhoEvent =
new TH1F(
"hSigmaRhoEvent",
"",100,0,1);
839 hSigmaThetaEvent =
new TH1F(
"hSigmaThetaEvent",
"",100,0,1);
840 hSigmaTheta->SetLineColor(kRed);
868 UInt_t ysize = 9*ysize2;
869 TGTransientFrame*
main =
new TGTransientFrame(gClient->GetRoot(), fMain, xsize, ysize);
870 main->Connect(
"CloseWindow()",
"HarpoRecoMonitorGui", main,
"CloseWindow()");
871 main->DontCallClose();
874 main->SetCleanup(kDeepCleanup);
876 TGVerticalFrame* f213 =
new TGVerticalFrame(main,xsize,ysize,kVerticalFrame);
877 TGLabel* fTrackingLabel =
new TGLabel(f213,
"Hough Tracking");
879 TGHorizontalFrame* wMinFrameC =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
880 TGLabel* wMinLabelC =
new TGLabel(wMinFrameC,
"WminCl");
881 fChooseWminC =
new TGNumberEntry(wMinFrameC);
882 fChooseWminC->SetNumber(fWmin[
CCLUSTER]);
884 TGHorizontalFrame* wMaxFrameC =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
885 TGLabel* wMaxLabelC =
new TGLabel(wMaxFrameC,
"WmaxCl");
886 fChooseWmaxC =
new TGNumberEntry(wMaxFrameC);
887 fChooseWmaxC->SetNumber(fWmax[CCLUSTER]);
889 TGHorizontalFrame* qMinFrameC =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
890 TGLabel* qMinLabelC =
new TGLabel(qMinFrameC,
"QminCl");
891 fChooseQminC =
new TGNumberEntry(qMinFrameC);
892 fChooseQminC->SetNumber(fQmin[CCLUSTER]);
895 TGHorizontalFrame* wMinFrameT =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
896 TGLabel* wMinLabelT =
new TGLabel(wMinFrameT,
"WminCl");
897 fChooseWminT =
new TGNumberEntry(wMinFrameT);
898 fChooseWminT->SetNumber(fWmin[
TCLUSTER]);
900 TGHorizontalFrame* wMaxFrameT =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
901 TGLabel* wMaxLabelT =
new TGLabel(wMaxFrameT,
"WmaxCl");
902 fChooseWmaxT =
new TGNumberEntry(wMaxFrameT);
903 fChooseWmaxT->SetNumber(fWmax[TCLUSTER]);
905 TGHorizontalFrame* qMinFrameT =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
906 TGLabel* qMinLabelT =
new TGLabel(qMinFrameT,
"QminCl");
907 fChooseQminT =
new TGNumberEntry(qMinFrameT);
908 fChooseQminT->SetNumber(fQmin[TCLUSTER]);
912 TGHorizontalFrame* nMinPairsFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
913 TGLabel* nMinPairsLabel =
new TGLabel(nMinPairsFrame,
"min pairs");
914 fChooseNminPairs =
new TGNumberEntry(nMinPairsFrame);
915 fChooseNminPairs->SetNumber(fMinPairs);
917 TGHorizontalFrame* CutoffHoughFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
918 TGLabel* CutoffHoughLabel =
new TGLabel(CutoffHoughFrame,
"Cutoff");
919 fChooseCutoffHough =
new TGNumberEntry(CutoffHoughFrame);
920 fChooseCutoffHough->SetNumber(fCutoffHough);
922 TGHorizontalFrame* RouteHoughTightFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
923 TGLabel* RouteHoughTightLabel =
new TGLabel(RouteHoughTightFrame,
"Tight Route");
924 fChooseRouteHoughTight =
new TGNumberEntry(RouteHoughTightFrame);
925 fChooseRouteHoughTight->SetNumber(RouteHoughTight);
927 TGHorizontalFrame* RouteHoughLooseFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
928 TGLabel* RouteHoughLooseLabel =
new TGLabel(RouteHoughLooseFrame,
"Loose Route");
929 fChooseRouteHoughLoose =
new TGNumberEntry(RouteHoughLooseFrame);
930 fChooseRouteHoughLoose->SetNumber(RouteHoughLoose);
932 TGHorizontalFrame* SigmaMaxRebinFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
933 TGLabel* SigmaMaxRebinLabel =
new TGLabel(SigmaMaxRebinFrame,
"#sigma_{rebin}");
934 fChooseSigmaMaxRebin =
new TGNumberEntry(SigmaMaxRebinFrame);
935 fChooseSigmaMaxRebin->SetNumber(fSigmaMaxRebin);
937 TGHorizontalFrame* DistMinFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
938 TGLabel* DistMinLabel =
new TGLabel(DistMinFrame,
"min distance");
939 fChooseDistMin =
new TGNumberEntry(DistMinFrame);
940 fChooseDistMin->SetNumber(fDistMin);
942 TGHorizontalFrame* NclMinFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
943 TGLabel* NclMinLabel =
new TGLabel(NclMinFrame,
"min N_{cl}");
944 fChooseNclMin =
new TGNumberEntry(NclMinFrame);
945 fChooseNclMin->SetNumber(fNclMin);
947 TGHorizontalFrame* SaveFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
948 TGLabel* SaveLabel =
new TGLabel(SaveFrame,
"Save hist");
949 fCheckSave =
new TGCheckButton(SaveFrame);
953 TGTextButton* setConf =
new TGTextButton(f213,
"Save Config",
id);
954 setConf->Associate(fMain);
957 TGLayoutHints* fLayout1 =
new TGLayoutHints(kLHintsLeft ,5,5,5,5);
958 TGLayoutHints* fLayout2 =
new TGLayoutHints(kLHintsRight ,5,5,5,5);
959 TGLayoutHints* fLayout3 =
new TGLayoutHints(kLHintsTop | kLHintsExpandX ,5,5,5,5);
960 TGLayoutHints* fLayout4 =
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5);
962 main->AddFrame(f213,fLayout4);
963 f213->AddFrame(fTrackingLabel,fLayout3);
965 f213->AddFrame(wMinFrameC,fLayout3);
966 wMinFrameC->AddFrame(wMinLabelC,fLayout1);
967 wMinFrameC->AddFrame(fChooseWminC,fLayout2);
968 f213->AddFrame(wMaxFrameC,fLayout3);
969 wMaxFrameC->AddFrame(wMaxLabelC,fLayout1);
970 wMaxFrameC->AddFrame(fChooseWmaxC,fLayout2);
971 f213->AddFrame(qMinFrameC,fLayout3);
972 qMinFrameC->AddFrame(qMinLabelC,fLayout1);
973 qMinFrameC->AddFrame(fChooseQminC,fLayout2);
975 f213->AddFrame(wMinFrameT,fLayout3);
976 wMinFrameT->AddFrame(wMinLabelT,fLayout1);
977 wMinFrameT->AddFrame(fChooseWminT,fLayout2);
978 f213->AddFrame(wMaxFrameT,fLayout3);
979 wMaxFrameT->AddFrame(wMaxLabelT,fLayout1);
980 wMaxFrameT->AddFrame(fChooseWmaxT,fLayout2);
981 f213->AddFrame(qMinFrameT,fLayout3);
982 qMinFrameT->AddFrame(qMinLabelT,fLayout1);
983 qMinFrameT->AddFrame(fChooseQminT,fLayout2);
985 f213->AddFrame(nMinPairsFrame,fLayout3);
986 nMinPairsFrame->AddFrame(nMinPairsLabel,fLayout1);
987 nMinPairsFrame->AddFrame(fChooseNminPairs,fLayout2);
989 f213->AddFrame(CutoffHoughFrame,fLayout3);
990 CutoffHoughFrame->AddFrame(CutoffHoughLabel,fLayout1);
991 CutoffHoughFrame->AddFrame(fChooseCutoffHough,fLayout2);
992 f213->AddFrame(RouteHoughTightFrame,fLayout3);
993 RouteHoughTightFrame->AddFrame(RouteHoughTightLabel,fLayout1);
994 RouteHoughTightFrame->AddFrame(fChooseRouteHoughTight,fLayout2);
995 f213->AddFrame(RouteHoughLooseFrame,fLayout3);
996 RouteHoughLooseFrame->AddFrame(RouteHoughLooseLabel,fLayout1);
997 RouteHoughLooseFrame->AddFrame(fChooseRouteHoughLoose,fLayout2);
998 f213->AddFrame(DistMinFrame,fLayout3);
999 DistMinFrame->AddFrame(DistMinLabel,fLayout1);
1000 DistMinFrame->AddFrame(fChooseDistMin,fLayout2);
1001 f213->AddFrame(NclMinFrame,fLayout3);
1002 NclMinFrame->AddFrame(NclMinLabel,fLayout1);
1003 NclMinFrame->AddFrame(fChooseNclMin,fLayout2);
1004 f213->AddFrame(SigmaMaxRebinFrame,fLayout3);
1005 SigmaMaxRebinFrame->AddFrame(SigmaMaxRebinLabel,fLayout1);
1006 SigmaMaxRebinFrame->AddFrame(fChooseSigmaMaxRebin,fLayout2);
1007 f213->AddFrame(SaveFrame,fLayout3);
1008 SaveFrame->AddFrame(SaveLabel,fLayout1);
1009 SaveFrame->AddFrame(fCheckSave,fLayout2);
1011 f213->AddFrame(setConf,fLayout3);
1014 main->MapSubwindows();
1025 TFile* savefile = NULL;
1028 Char_t filename[256];
1029 sprintf(filename,
"plots/tracking/run%d_evt%ld.root",fEvt->GetRunHeader()->GetRun(),fEvt->GetHeader()->GetEvtNo());
1030 if(fSave) savefile =
new TFile(filename,
"recreate");
1032 Info(
"DisplayAnalysis",
"%d %d",fNloopMax, fTrackIdMax);
1033 if(fNloopMax<0)
return;
1034 if(fTrackIdMax<0)
return;
1036 TCanvas* fCanvas = ecTab->GetCanvas();
1037 fCanvas->GetPad(1)->Delete();
1038 fCanvas->GetPad(2)->Delete();
1040 fCanvas->GetPad(1)->Divide(fNloopMax+1,fTrackIdMax+2);
1041 fCanvas->GetPad(2)->Divide(fNloopMax+1,fTrackIdMax+2);
1042 TLatex* latex =
new TLatex();
1043 latex->SetTextFont(132);
1044 latex->SetTextAlign(12);
1045 latex->SetTextSize(0.08);
1047 for(Int_t plane = 0; plane<2; plane++){
1048 for(Int_t track = 0; track<=fTrackIdMax; track++){
1049 for(Int_t loop = 0; loop<=fNloopMax; loop++){
1050 Info(
"DisplayAnalysis",
"%d %d %d",plane,track,loop);
1051 if(fHist[plane][track][loop] != 0){
1052 if(fSave) fHist[plane][track][loop]->Write(Form(
"h_%d_%d_%d",plane,track,loop));
1053 MakeNiceHisto(fHist[plane][track][loop],fCanvas->GetPad(plane+1)->GetPad(track*(fNloopMax+1)+loop+1),
"col");
1054 Double_t xmin = fHist[plane][track][loop]->GetXaxis()->GetXmin();
1055 Double_t xmax = fHist[plane][track][loop]->GetXaxis()->GetXmax();
1056 Double_t ymin = fHist[plane][track][loop]->GetYaxis()->GetXmin();
1057 if(ymin<-1.6) ymin = -TMath::Pi()/2;
1058 Double_t ymax = fHist[plane][track][loop]->GetYaxis()->GetXmax();
1059 if(ymax>1.6) ymax = TMath::Pi()/2;
1060 fHist[plane][track][loop]->Delete();
1061 latex->DrawLatex(xmin + 0.1*(xmax-xmin),ymin + 0.9*(ymax-ymin),Form(
"#sigma_{#rho} = %g",fSigmaRhoPeak[plane][track][loop]));
1062 latex->DrawLatex(xmin + 0.1*(xmax-xmin),ymin + 0.8*(ymax-ymin),Form(
"#sigma_{#theta} = %g",fSigmaThetaPeak[plane][track][loop]));
1063 latex->DrawLatex(xmin + 0.1*(xmax-xmin),ymin + 0.7*(ymax-ymin),Form(
"N_{pairs} = %g",fNpairsPeak[plane][track][loop]));
1068 if(fSave) savefile->Close();
1069 fCanvas->GetPad(1)->cd((fNloopMax+1)*(fTrackIdMax+2));
1070 MakeNiceHisto(hSigmaRho,fCanvas->GetPad(1)->GetPad((fNloopMax+1)*(fTrackIdMax+2)));
1071 hSigmaRhoEvent->Scale(hSigmaRho->GetEntries()*1./hSigmaRhoEvent->GetEntries());
1072 hSigmaRhoEvent->DrawCopy(
"same");
1073 MakeNiceHisto(hSigmaTheta,fCanvas->GetPad(2)->GetPad((fNloopMax+1)*(fTrackIdMax+2)));
1074 hSigmaThetaEvent->Scale(hSigmaTheta->GetEntries()*1./hSigmaThetaEvent->GetEntries());
1075 hSigmaThetaEvent->Draw(
"same");
1083 Info(
"SetConfig",
"Renewing configuration");
1086 Info(
"SetConfig",
"###################### (%d)",fDisplay);
1088 if(!fChooseQminC)
return;
1090 fQmin[
CCLUSTER] = fChooseQminC->GetNumber();
1091 fQmin[
TCLUSTER] = fChooseQminT->GetNumber();
1093 fWmin[
CCLUSTER] = fChooseWminC->GetNumber();
1094 fWmax[
TCLUSTER] = fChooseWmaxT->GetNumber();
1095 fWmin[
CCLUSTER] = fChooseWminC->GetNumber();
1096 fWmax[
TCLUSTER] = fChooseWmaxT->GetNumber();
1097 fMinPairs = fChooseNminPairs->GetNumber();
1098 fSave = fCheckSave->IsOn();
1101 fCutoffHough = fChooseCutoffHough->GetNumber();
1102 RouteHoughLoose = fChooseRouteHoughLoose->GetNumber();
1103 RouteHoughTight = fChooseRouteHoughTight->GetNumber();
1104 fSigmaMaxRebin = fChooseSigmaMaxRebin->GetNumber();
1105 fDistMin = fChooseDistMin->GetNumber();
1106 fNclMin = fChooseNclMin->GetNumber();
static const Double_t kfWidthTheta
static const Double_t kfWidthRho
void FindPairNew(Int_t Plan, Int_t trackId, Double_t &rho, Double_t &theta, Double_t &sigRho, Double_t &sigTheta)
Ovreloaded medod whic do all job.
void AddIdClusterTrack(Int_t val)
int main(int argc, char **argv)
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
Object containing the reconstruction information for one event (with array of HarpoRecoClusters Harpo...
void DisplayAnalysis(TRootEmbeddedCanvas *ecTab, TGListBox *info)
void RemoveAllClusterTrack()
Cluster object, containing position, charge and quality information.
void Save(char *mode=NULL)
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
void FindTrack(Int_t plane)
static const Double_t kfFacHough
TVirtualPad * MakeNiceHisto(TH1 *hist, TVirtualPad *c1, const char *opt, Bool_t copy)
void ConfigFrame(TGMainFrame *fMain, Int_t id)
Bool_t Lookup(const char *path, Bool_t &val)
Lookup function for scalar values.
A virtual class which define intrafece between HARPO Reader and Event Analysis code.
const ULong_t gkNDetectors
HarpoRecoTracks object, obtained with Hough tracking method.
TClonesArray * GetClustersArray()
R__EXTERN HarpoDetSet * gHDetSet