25 #include "TRootEmbeddedCanvas.h"
33 #include "TSpectrum.h"
34 #include "TLinearFitter.h"
35 #include "TPolyMarker.h"
72 if (plane != NULL )plane->
print();
83 for(Int_t i = 0; i<20; i++){
109 for(Int_t i = 0; i<2; i++){
110 for(Int_t j = 0; j<10; j++){
111 for(Int_t k = 0; k<3; k++){
119 Int_t nV2 = vArray->GetEntries();
121 for(Int_t plane = 0; plane<2;plane++)
125 for(Int_t iV = 0; iV<nV2; iV++){
135 TH2F* hProj2DV_1 = (TH2F*)
fHistProj2D[iV]->Clone(
"hProj2D_1");
138 for(Int_t i=0;i<
NADC;i++){
139 for(Int_t j=0;j<
NCHAN;j++){
140 Double_t q =
fHistMap[iV]->GetBinContent(i+1,j+1);
142 Double_t xTmp = j - xV, zTmp = i - zV;
143 Double_t rho = TMath::Sqrt(xTmp*xTmp+zTmp*zTmp);
144 Double_t theta = TMath::ATan2(xTmp,zTmp);
145 hProj2DV_1->Fill(rho,theta,q);
149 for(Int_t bin = 1; bin<=
fNbins; bin++){
150 Int_t k = Int_t(0.5/TMath::Pi()*
fNbinsTheta/hProj2DV_1->GetXaxis()->GetBinCenter(bin));
152 Double_t q = hProj2DV_1->GetBinContent(bin,i+1)/(2*k+1.);
155 for(Int_t j = -k; j<=k; j++){
158 if(biny<1) biny = fNbinsTheta + biny;
159 if(biny>fNbinsTheta) biny = -fNbinsTheta + biny;
164 hProj2DV_1->Delete();
173 for(Int_t bin = 2; bin<=
fNbins; bin++){
191 fHistMean[iV]->SetBinContent(fNbinsTheta/2+i+1,qTot);
194 fHistMean[iV]->SetBinContent( fNbinsTheta+fNbinsTheta/2+i+1,qTot);
196 fHistMean[iV]->SetBinContent(-fNbinsTheta+fNbinsTheta/2+i+1,qTot);
203 TSpectrum *s =
new TSpectrum(8);
204 Int_t nfound = s->Search(
fHistMean[iV],2,
"",0.01);
206 Info(
"process",
"%d peaks found",nfound);
207 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
208 Double_t *xpeaks = s->GetPositionX();
209 Double_t *ypeaks = s->GetPositionY();
211 Float_t *xpeaks = s->GetPositionX();
212 Float_t *ypeaks = s->GetPositionY();
214 Double_t peaks[nfound];
216 Int_t* index =
new Int_t[nfound];
218 TMath::Sort(nfound,ypeaks,index,kTRUE);
219 for(Int_t i = 0; i<nfound; i++){
221 if(xpeaks[index[i]]<-TMath::Pi())
continue;
222 if(xpeaks[index[i]]>TMath::Pi())
continue;
223 peaks[npeaks] = xpeaks[index[i]];
225 Info(
"process",
"%d %g",npeaks,peaks[npeaks]);
231 for(Int_t i = 0; i<nfound; i++){
232 for(Int_t j = i+1; j<nfound; j++){
233 if(TMath::Abs(peaks[i]-peaks[j])>2 &&
234 TMath::Abs(peaks[i]-peaks[j]+TMath::Pi()*2)>2 &&
235 TMath::Abs(peaks[i]-peaks[j]-TMath::Pi()*2)>2){
240 if(TMath::Abs(peaks[i]-peaks[j])<0.05)
241 peaks[i] = (peaks[i]+peaks[j])/2.;
242 if(TMath::Abs(peaks[i]-peaks[j]+TMath::Pi()*2)<0.05)
243 peaks[i] = (peaks[i]+peaks[j])/2.+TMath::Pi();
244 if(TMath::Abs(peaks[i]-peaks[j]-TMath::Pi()*2)<0.05)
245 peaks[i] = (peaks[i]+peaks[j])/2.+TMath::Pi();
249 for(Int_t i = 0; i<nfound; i++){
250 if(peaks[i]<-10)
continue;
251 peaks[npeaks] = peaks[i];
255 if(npeaks>2) npeaks = 2;
261 Double_t peaks[20], ypeaks[20];
262 for(Int_t i = 0; i<10; i++){
263 if(arr->At(3*i) == -1000)
break;
265 peaks[i] = arr->At(3*i);
266 ypeaks[i] = arr->At(3*i+2)/10;
269 (TPolyMarker*)
fHistMean[iV]->GetListOfFunctions()->FindObject(
"TPolyMarker");
271 fHistMean[iV]->GetListOfFunctions()->Remove(pm);
274 pm =
new TPolyMarker(npeaks, peaks, ypeaks);
275 fHistMean[iV]->GetListOfFunctions()->Add(pm);
276 pm->SetMarkerStyle(23);
277 pm->SetMarkerColor(kRed);
278 pm->SetMarkerSize(1.3);
282 Info(
"process",
"%d peaks confirmed",npeaks);
293 vertex->
SetPxVertex(TMath::Sin(0.5*(peaks[0]+peaks[1])));
294 vertex->
SetPzVertex(TMath::Cos(0.5*(peaks[0]+peaks[1])));
295 Double_t theta = TMath::Abs(peaks[0]-peaks[1]);
296 if(theta>2*TMath::Pi()) theta -= 2*TMath::Pi();
297 if(theta>TMath::Pi()) theta = 2*TMath::Pi() - theta;
310 Int_t nV2 = vArray->GetEntries();
312 for(Int_t plane = 0; plane<2;plane++)
315 for(Int_t iV = 0; iV<nV2; iV++){
324 Double_t meanX = 0, meanZ = 0, qTot = 0;
327 if(ch<0 || ch>=
NCHAN || tb<0 || tb>=
NADC)
continue;
328 Double_t q = m[plane]->
GetData(ch,tb);
335 if(qTot<=0)
continue;
357 Int_t nCl = clArray->GetEntries();
359 Double_t x[2][nCl], z[2][nCl], px[2][nCl], pz[2][nCl], theta[2][nCl];
363 for(Int_t i = 0; i<nCl; i++){
365 Double_t q = cl->
GetQ();
366 if(q<
fQmin)
continue;
368 Double_t xTmp = cl->
GetX();
369 Double_t zTmp = cl->
GetZ();
371 Double_t frac =
GetFraction(plane,xTmp,zTmp,phi0,phi1);
373 px[plane][nV[plane]] = -TMath::Cos(0.5*(phi0 + phi1));
374 pz[plane][nV[plane]] = -TMath::Sin(0.5*(phi0 + phi1));
375 theta[plane][nV[plane]] = TMath::Abs(2*TMath::Pi() - phi1 + phi0);
376 if(theta[plane][nV[plane]] > +2*TMath::Pi())
377 theta[plane][nV[plane]] -= 2*TMath::Pi();
378 x[plane][nV[plane]] = xTmp;
379 z[plane][nV[plane]] = zTmp;
381 Info(
"FindVertex",
"%d %d %g %g %g %g %g",plane,nV[plane],zTmp, xTmp, pz[plane][nV[plane]], px[plane][nV[plane]], theta[plane][nV[plane]]);
385 for(Int_t plane = 0; plane<2; plane++){
386 Int_t used[nV[plane]];
387 for(Int_t i = 0; i<nV[plane]; i++)
389 for(Int_t i = 0; i<nV[plane]; i++){
390 if(used[i])
continue;
395 for(Int_t j = 0; j<nV[plane]; j++){
396 if(used[j])
continue;
397 if(TMath::Abs(x[plane][i]-x[plane][j])<
fRadiusX && TMath::Abs(z[plane][i]-z[plane][j])<
fRadiusZ){
399 if(TMath::Abs(theta[plane][j])<TMath::Abs(theta[plane][i])){
404 HarpoRecoVertex* vertex =
new HarpoRecoVertex(plane,z[plane][jmin], x[plane][jmin], pz[plane][jmin], px[plane][jmin], theta[plane][jmin], chi2, -1, -1);
436 TGraph* g =
GetGraph(h,3,xV,zV,pxV,pzV);
447 Int_t nbinsx = h->GetYaxis()->GetNbins();
448 Int_t nbinsz = h->GetXaxis()->GetNbins();
450 TGraph* g =
new TGraph();
453 for(Int_t i = 0; i<nbinsz; i+=n){
454 for(Int_t j = 0; j<nbinsx; j+=n){
455 Double_t x = 0, z = 0, q = 0;
456 for(Int_t i2 = 0; i2<n; i2++){
457 for(Int_t j2 = 0; j2<n; j2++){
458 Double_t val = h->GetBinContent(i+i2+1,j+j2+1);
470 if(dx*dx + dz*dz<0.5)
continue;
473 g->SetPoint(nP,(x-x0)*px + (z-z0)*pz,-(z-z0)*px+(x-x0)*pz);
486 Int_t nP = g->GetN();
487 Double_t* x = g->GetX();
488 Double_t* y = g->GetY();
493 for(Int_t j = 0; j<nFit; j++)
495 TArrayD* par =
new TArrayD(2*nFit);
500 for(Int_t j = 0; j<nFit; j++){
502 par->AddAt(-1 + 2*j*1./(nFit-1),2*j+1);
506 for(Int_t k = 0; k<5; k++){
508 Double_t w[nFit][nP];
509 for(Int_t i = 0; i<nP; i++){
511 for(Int_t j = 0; j<nFit; j++){
512 Double_t d = y[i] - x[i]*par->At(2*j+1) - par->At(2*j);
513 w[j][i] = p[j]*TMath::Gaus(d,0,1);
516 for(Int_t j = 0; j<nFit; j++)
520 for(Int_t j=0; j<nFit; j++){
522 Double_t xTmp[nP], yTmp[nP];
524 for(Int_t i = 0; i<nP; i++){
526 for(Int_t J = 0; J<nFit; J++){
539 Info(
"FitGraph",
"Too many fits %d",nFit);
545 TLinearFitter* fFitCh =
new TLinearFitter(1,
"pol1",
"D");
546 fFitCh->AssignData(nTmp, 1, xTmp, yTmp);
549 par->AddAt(fFitCh->GetParameter(0),2*j);
550 par->AddAt(fFitCh->GetParameter(1),2*j+1);
552 Info(
"FitGraph",
"Iteration %d, Fit %d, chi2 = %g",k,j,fFitCh->GetChisquare());
567 TArrayD* arr =
new TArrayD(30);
568 for(Int_t k = 0; k<30; k++)
570 Int_t nbins = h->GetXaxis()->GetNbins();
572 Double_t noise = 1000;
573 Double_t th = 0, q = 0, sig = 0, qold = 0;
576 for(Int_t i = 1; i<=nbins; i++){
577 Double_t val = h->GetBinContent(i);
583 Info(
"GetPeaks2",
"istart = %d",istart);
585 for(Int_t i = istart; i<=nbins+istart; i++){
588 val = h->GetBinContent(i);
589 x = h->GetXaxis()->GetBinCenter(i);
591 val = h->GetBinContent(i-nbins);
592 x = h->GetXaxis()->GetBinCenter(i-nbins);
594 if(up == 0 && val<noise)
continue;
595 if((up == 2 && val>qold+noise) || val<100){
598 Info(
"GetPeaks2",
"End cluster %g: mu = %g, sig = %g, q = %g, qold = %g",x,th/q,TMath::Sqrt(sig/q-th/q*th/q),q,qold);
599 arr->AddAt(th/q,3*nCl);
600 arr->AddAt(TMath::Sqrt(sig/q-th/q*th/q),3*nCl+1);
601 arr->AddAt(q,3*nCl+2);
604 th = 0; q = 0; sig = 0;
607 if(up == 0) Info(
"GetPeaks2",
"Start cluster %g (%g %g)",x,val, qold);
611 if(up == 1) Info(
"GetPeaks2",
"Peak %g (%g %g)",x,val, qold);
618 th = 0; q = 0; sig = 0; up = 0;
620 if(TMath::Abs(val-qold)>noise)
632 TArrayD* arr =
new TArrayD(30);
633 for(Int_t k = 0; k<30; k++)
642 Double_t qTot = 0, qTot2 = 0;
643 for(Int_t j = 0; j<n; j++){
645 Double_t dist = TMath::Abs(x[j]-mu);
646 if(TMath::Abs(x[j]-mu-2*TMath::Pi())<dist) dist = TMath::Abs(x[j]-mu-2*TMath::Pi());
647 if(TMath::Abs(x[j]-mu+2*TMath::Pi())<dist) dist = TMath::Abs(x[j]-mu+2*TMath::Pi());
648 Double_t frac = dist < 3*sig;
649 if(frac<0.01) frac = 0;
657 Info(
"GetPeaks",
"loop %d, qTot = %g, qTot2 = %g, q = %g",loop,qTot,qTot2, q);
658 Info(
"GetPeaks",
"mu = %g, sig = %g, q = %g, nLeft = %d",mu,sig,q,nLeft);
660 if(sig<0.2 && q > 1000){
670 if(nLeft==nLeftOld)
break;
686 Double_t xCenter = 0.;
687 Double_t xWidth = 6.5;
689 Int_t nloop = 0, maxLoops = 5;
690 while(nloop < maxLoops){
692 Info(
"FindPairNew",
"loop == %d",nloop);
694 TH1F* h =
new TH1F(
"h",
"",fNbinr,xCenter - xWidth, xCenter + xWidth);
695 TH1F* hB =
new TH1F(
"hB",
"",fNbinr,xCenter - xWidth, xCenter + xWidth);
696 TH1F* hW =
new TH1F(
"hW",
"",fNbinr,xCenter - xWidth, xCenter + xWidth);
697 TH1F* h1 =
new TH1F(
"h1",
"",fNbinr,xCenter - xWidth, xCenter + xWidth);
698 TH1F* h2 =
new TH1F(
"h2",
"",fNbinr,xCenter - xWidth, xCenter + xWidth);
699 TH1F* h3 =
new TH1F(
"h3",
"",fNbinr,xCenter - xWidth, xCenter + xWidth);
700 TH1F* h4 =
new TH1F(
"h4",
"",fNbinr,xCenter - xWidth, xCenter + xWidth);
702 for(Int_t i=0;i<nElem;i++){
703 if(x[i]<-10)
continue;
704 if(w[i]<10)
continue;
705 Double_t theta = x[i];
706 Double_t weight= w[i];
708 hW->Fill(theta, weight);
709 h1->Fill(theta, theta*weight);
710 h2->Fill(theta, theta*theta*weight);
711 h3->Fill(theta, theta*theta*theta*weight);
712 h4->Fill(theta, theta*theta*theta*theta*weight);
714 if(theta>0) theta = theta - 2*TMath::Pi();
715 else theta = theta + 2*TMath::Pi();
717 hW->Fill(theta, weight);
718 h1->Fill(theta, theta*weight);
719 h2->Fill(theta, theta*theta*weight);
720 h3->Fill(theta, theta*theta*theta*weight);
721 h4->Fill(theta, theta*theta*theta*theta*weight);
724 if(h->GetEntries()<3) {
738 fHist[plane][v][nloop] = (TH1F*)h->Clone(Form(
"h%d_%d_%d",plane,v,nloop));
741 for (Int_t ir=1;ir<=fNbinr;ir++){
742 Double_t n = h->GetBinContent(ir);
743 Double_t weight = hW->GetBinContent(ir);
745 if(weight<=0)
continue;
746 Double_t m1Tmp = h1->GetBinContent(ir)/weight;
747 Double_t m2Tmp = h2->GetBinContent(ir)/weight;
748 Double_t m3Tmp = h3->GetBinContent(ir)/weight;
749 Double_t m4Tmp = h4->GetBinContent(ir)/weight;
750 m4Tmp = m4Tmp - 4*m1Tmp*m3Tmp + 6*m1Tmp*m1Tmp*m2Tmp - 3*m1Tmp*m1Tmp*m1Tmp*m1Tmp;
751 m2Tmp = m2Tmp - m1Tmp*m1Tmp;
757 hB->SetBinContent(ir,n);
763 fHist2[plane][v][nloop] = (TH1F*)h->Clone(Form(
"hB%d_%d_%d",plane,v,nloop));
766 hB->GetXaxis()->SetRangeUser(-TMath::Pi(),TMath::Pi());
767 Int_t imax = hB->GetMaximumBin();
768 Double_t max = hB->GetXaxis()->GetBinLowEdge(imax);
771 Double_t muPeak = h1->GetBinContent(imax)/hW->GetBinContent(imax);
772 Double_t sigmaPeak = TMath::Sqrt(h2->GetBinContent(imax)/hW->GetBinContent(imax) - muPeak*muPeak);
776 Double_t fSigmaMaxRebin = 0.25, fCutoffHough = 6, kfFacHough = 3;
778 if(sigmaPeak<fSigmaMaxRebin*h->GetXaxis()->GetBinWidth(1) && nloop < maxLoops - 1 && h->GetBinContent(imax)>fMinPairs){
780 xWidth /= kfFacHough;
792 Int_t ioMax = h->GetXaxis()->GetNbins()/2;
794 for(Int_t io=1;io<=ioMax;io++){
795 Double_t n = hW->Integral(imax-io,imax+io);
796 Double_t mu=h1->Integral(imax-io,imax+io)/n;
797 Double_t sig=h2->Integral(imax-io,imax+io)/n - mu*mu;
799 if(sig>0) sig = TMath::Sqrt(sig);
804 if(sig>0) rapr = (io) * h->GetXaxis()->GetBinWidth(1) / sig;
807 if(io==ioMax || (rapr>fCutoffHough && rapr0<fCutoffHough) ){
809 if(muOut>TMath::Pi()) muOut -= 2*TMath::Pi();
810 if(muOut<-TMath::Pi()) muOut += 2*TMath::Pi();
842 Int_t l = 0, start = 1000;
843 Bool_t empty = kFALSE;
844 Double_t phiStart = 0;
845 phi0 = -1; phi1 = -2;
846 for(Int_t i=0;i<1000;i++){
848 Double_t phi = i*4*TMath::Pi()/1000;
849 Double_t xTmp = x +
fRadiusX*TMath::Cos(phi);
850 Double_t zTmp = z +
fRadiusZ*TMath::Sin(phi);
852 Int_t channel = Int_t(xTmp);
853 Int_t timebin = Int_t(zTmp);
854 if(channel<0 || channel>=
NCHAN)
continue;
855 if(timebin<0 || timebin>=
NADC)
continue;
856 Int_t q = m->
GetData(channel,timebin);
858 if(channel>0) q+= TMath::Max(m->
GetData(channel-1,timebin),0.);
859 if(channel<
NCHAN-1) q+= TMath::Max(m->
GetData(channel+1,timebin),0.);
860 if(timebin>0) q+= TMath::Max(m->
GetData(channel,timebin-1),0.);
861 if(timebin<
NADC-1) q+= TMath::Max(m->
GetData(channel,timebin+1),0.);
882 return 1 - l*2./1000;
893 if(i<0 || j<0 || i>=
NADC || j>=
NCHAN)
return;
894 if(h->GetBinContent(i+1,j+1)>0)
return;
910 h->SetBinContent(i+1,j+1,q);
923 TCanvas* c = ecTab->GetCanvas();
924 c->GetPad(1)->Delete();
925 c->GetPad(2)->Delete();
931 Int_t nV = vArray->GetEntries();
933 for(Int_t plane = 0; plane<2;plane++)
942 TH2F* hProj2DV[2][nV];
943 TH2F* hMap2DV[2][nV];
945 TH1F* hMean2V[2][nV];
946 TH1F* hMean3V[2][nV];
947 TH1F* hMean4V[2][nV];
951 Double_t xMin = 0, xMax = 400;
952 for(Int_t i = 0; i<nV; i++){
961 iV[plane][nVp[plane]] = i;
963 hProjV[plane][nVp[plane]] =
new TH1F(Form(
"hProj%d_%d",nVp[plane],plane),
"",
fNbins,xMin,xMax);
966 TH2F* hProj2DVtmp =
new TH2F(
"hProj2Dtmp",
"",
fNbins,xMin,xMax,
fNbinsTheta,-TMath::Pi(),TMath::Pi());
967 hProj2DV[plane][nVp[plane]] =
new TH2F(Form(
"hProj2D%d_%d",nVp[plane],plane),
"",
fNbins,xMin,xMax,
fNbinsTheta,-TMath::Pi(),TMath::Pi());
968 hMap2DV[plane][nVp[plane]] =
new TH2F(Form(
"hMap2D%d_%d",nVp[plane],plane),
"",512,0,512,288,0,288);
969 GetConnex(Int_t(zV),Int_t(xV),3,3,m[plane],hMap2DV[plane][nVp[plane]]);
971 hMeanV[plane][nVp[plane]] =
new TH1F(Form(
"hMean%d_%d",nVp[plane],plane),
"",
fNbinsTheta,-TMath::Pi(),TMath::Pi());
972 hMean2V[plane][nVp[plane]] =
new TH1F(Form(
"hMean2%d_%d",nVp[plane],plane),
"",
fNbins,xMin,xMax);
973 hMean3V[plane][nVp[plane]] =
new TH1F(Form(
"hMean3%d_%d",nVp[plane],plane),
"",
fNbins,xMin,xMax);
974 hMean4V[plane][nVp[plane]] =
new TH1F(Form(
"hMean4%d_%d",nVp[plane],plane),
"",
fNbins,xMin,xMax);
976 hProjV[plane][nVp[plane]]->SetLineColor(kRed);
977 hMeanV[plane][nVp[plane]]->SetLineColor(kBlack);
978 hMean2V[plane][nVp[plane]]->SetLineColor(kBlue);
979 hMean4V[plane][nVp[plane]]->SetLineColor(kGreen);
980 for(Int_t i=0;i<
NADC;i++){
981 for(Int_t j=0;j<
NCHAN;j++){
983 Double_t q = hMap2DV[plane][nVp[plane]]->GetBinContent(i+1,j+1);
985 Double_t xTmp = j - xV, zTmp = i - zV;
986 Double_t a = xTmp*pzV - zTmp*pxV;
987 Double_t b = zTmp*pzV+xTmp*pxV;
988 Double_t rho = TMath::Sqrt(xTmp*xTmp+zTmp*zTmp);
989 Double_t theta = TMath::ATan2(xTmp,zTmp);
993 hProj2DVtmp->Fill(b,a,q);
996 hProjV[plane][nVp[plane]]->Fill(b,q);
998 hMean2V[plane][nVp[plane]]->Fill(b,q*a*a);
999 hMean3V[plane][nVp[plane]]->Fill(b,q*a*a*a);
1000 hMean4V[plane][nVp[plane]]->Fill(b,q*a*a*a*a);
1003 for(Int_t bin = 1; bin<=
fNbins; bin++){
1004 Int_t k = Int_t(0.5/TMath::Pi()*
fNbinsTheta/hProj2DV[plane][nVp[plane]]->GetXaxis()->GetBinCenter(bin));
1007 Double_t q = hProj2DVtmp->GetBinContent(bin,i+1);
1009 for(Int_t j = -k; j<=k; j++)
1010 hProj2DV[plane][nVp[plane]]->SetBinContent(bin,i+1+j,hProj2DV[plane][nVp[plane]]->GetBinContent(bin,i+1+j)+q);
1013 hProj2DVtmp->Delete();
1016 for(Int_t bin = 1; bin<=
fNbins; bin++){
1018 Double_t q = hProj2DV[plane][nVp[plane]]->GetBinContent(bin,i+1);
1020 hProj2DV[plane][nVp[plane]]->SetBinContent(bin,i+1,0);
1028 hProjV[plane][nVp[plane]]->SetMinimum(1);
1029 hProjV[plane][nVp[plane]]->GetXaxis()->SetRangeUser(-10,10);
1030 Double_t max = hProjV[plane][nVp[plane]]->GetMaximum();
1031 hProjV[plane][nVp[plane]]->GetXaxis()->SetRangeUser(xMin,xMax);
1033 Bool_t foundV = kFALSE;
1034 for(Int_t bin = 1; bin<=
fNbins; bin++){
1035 Double_t q = hProjV[plane][nVp[plane]]->GetBinContent(bin);
1039 Double_t mean2 = hMean2V[plane][nVp[plane]]->GetBinContent(bin)/q;
1040 Double_t sig2 = mean2-mean*mean;
1041 Double_t mean3 = hMean3V[plane][nVp[plane]]->GetBinContent(bin)/q;
1042 Double_t mean4 = hMean4V[plane][nVp[plane]]->GetBinContent(bin)/q;
1043 Double_t kurt = mean4 - 4*mean*mean3+6*mean*mean*mean2-3*mean*mean*mean*mean;
1047 hMean2V[plane][nVp[plane]]->SetBinContent(bin,sig2);
1048 hMean4V[plane][nVp[plane]]->SetBinContent(bin,kurt);
1049 if(q>max*0.5 && !foundV){
1050 Double_t qTmp = hProjV[plane][nVp[plane]]->GetBinContent(bin-1);
1051 bV = q*hProjV[plane][nVp[plane]]->GetXaxis()->GetBinCenter(bin)
1052 + qTmp*hProjV[plane][nVp[plane]]->GetXaxis()->GetBinCenter(bin-1);
1064 for(Int_t plane = 0; plane<2;plane++){
1065 TVirtualPad* cP = c->GetPad(plane+1);
1066 cP->Divide(3,nVp[plane]+1);
1067 for(Int_t i = 0; i<nVp[plane]; i++){
1075 Double_t phi0 = 0.0, phi1 = 0.0;
1077 TEllipse* eStart =
new TEllipse(zV,xV,
fRadiusZ,
fRadiusX,-phi0*180/TMath::Pi()+90,-phi1*180/TMath::Pi()+90);
1078 eStart->SetLineColor(kGray);
1079 eStart->SetLineWidth(3);
1080 eStart->SetFillStyle(0);
1086 Info(
"",
"Draw(fHistMean[%d])",iV[plane][i]);
1089 hMeanV[plane][i]->Delete();
1117 UInt_t ysize = 9*ysize2;
1118 TGTransientFrame*
main =
new TGTransientFrame(gClient->GetRoot(), fMain, xsize, ysize);
1119 main->Connect(
"CloseWindow()",
"HarpoRecoMonitorGui", main,
"CloseWindow()");
1120 main->DontCallClose();
1123 main->SetCleanup(kDeepCleanup);
1125 TGVerticalFrame* f213 =
new TGVerticalFrame(main,xsize,ysize,kVerticalFrame);
1126 TGLabel* fLabel =
new TGLabel(f213,
"Vertexing");
1129 TGHorizontalFrame* RadiusXFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
1130 TGLabel* RadiusXLabel =
new TGLabel(RadiusXFrame,
"Radius X");
1134 TGHorizontalFrame* RadiusZFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
1135 TGLabel* RadiusZLabel =
new TGLabel(RadiusZFrame,
"Radius Z");
1139 TGHorizontalFrame* MinFracFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
1140 TGLabel* MinFracLabel =
new TGLabel(MinFracFrame,
"Min Fraction");
1144 TGHorizontalFrame* SeparationFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
1145 TGLabel* SeparationLabel =
new TGLabel(SeparationFrame,
"Min Fraction");
1149 TGHorizontalFrame* QminFrame =
new TGHorizontalFrame(f213,xsize,ysize2,kHorizontalFrame);
1150 TGLabel* QminLabel =
new TGLabel(QminFrame,
"Min Fraction");
1160 TGTextButton* setConf =
new TGTextButton(f213,
"Save Config",
id);
1161 setConf->Associate(fMain);
1163 TGLayoutHints* fLayout1 =
new TGLayoutHints(kLHintsLeft ,5,5,5,5);
1164 TGLayoutHints* fLayout2 =
new TGLayoutHints(kLHintsRight ,5,5,5,5);
1165 TGLayoutHints* fLayout3 =
new TGLayoutHints(kLHintsTop | kLHintsExpandX ,5,5,5,5);
1166 TGLayoutHints* fLayout4 =
new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,5,5,5,5);
1168 main->AddFrame(f213,fLayout4);
1169 f213->AddFrame(fLabel,fLayout3);
1171 f213->AddFrame(RadiusXFrame,fLayout3);
1172 RadiusXFrame->AddFrame(RadiusXLabel,fLayout1);
1175 f213->AddFrame(RadiusZFrame,fLayout3);
1176 RadiusZFrame->AddFrame(RadiusZLabel,fLayout1);
1179 f213->AddFrame(MinFracFrame,fLayout3);
1180 MinFracFrame->AddFrame(MinFracLabel,fLayout1);
1183 f213->AddFrame(SeparationFrame,fLayout3);
1184 SeparationFrame->AddFrame(SeparationLabel,fLayout1);
1187 f213->AddFrame(QminFrame,fLayout3);
1188 QminFrame->AddFrame(QminLabel,fLayout1);
1195 f213->AddFrame(setConf,fLayout3);
1198 main->MapSubwindows();
1231 Double_t xMin = 0, xMax = 400;
1233 for(Int_t i = 0; i<20; i++){
1238 fHistMap[i] =
new TH2F(Form(
"fHistMap%d",i),
"",512,0,512,288,0,288);
TGNumberEntry * fChooseSeparation
TArrayD * FitGraph(TGraph *g, const Int_t nFit)
void SetChi2Vertex(Double_t val)
HarpoRecoEvent * GetRecoEvent()
void FitVertex(TH2F *h, HarpoRecoVertex *vertex)
TArrayD * GetPeaks(Int_t n, Double_t *x, Double_t *w, Int_t plane, Int_t v)
void SetPxVertex(Double_t val)
TH2F * fHistProj2Draw[20]
TGNumberEntry * fChooseRadiusZ
TArrayD * GetPeaks2(TH1F *h)
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
TGraph * GetGraph(TH2F *h, Int_t n, Double_t x0, Double_t z0, Double_t px, Double_t pz)
int main(int argc, char **argv)
void GetPeak(Int_t n, Double_t *x, Double_t *w, Double_t &muOut, Double_t &sigOut, Int_t plane, Int_t v)
void AddVertex(HarpoRecoVertex *val)
Object containing the reconstruction information for one event (with array of HarpoRecoClusters Harpo...
2D vertex object, containing position, angle and associated track numbers, and quality info ...
void DisplayAnalysis(TRootEmbeddedCanvas *ecTab, TGListBox *infobox)
Double_t GetFraction(Int_t ndet, Double_t x, Double_t z, Double_t &phi0, Double_t &phi1)
Redefine empty default.
void SetZvertex(Double_t val)
TClonesArray * GetVertexArray()
Cluster object, containing position, charge and quality information.
TFile * OpenHistFile(const char *ananame)
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
TVirtualPad * MakeNiceHisto(TH1 *hist, TVirtualPad *c1, const char *opt, Bool_t copy)
void SetThetaVertex(Double_t val)
void SetXvertex(Double_t val)
Dummy analysis to run as test and example. Give basic histograms of the data.
TGNumberEntry * fChooseMinFrac
HarpoEventHeader * GetHeader()
void ConfigFrame(TGMainFrame *fMain, Int_t id)
void RefineVertexPosition()
void print()
Overloaded method which do all job.
const ULong_t gkNDetectors
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
TGNumberEntry * fChooseRadiusX
void Save(char *mode=NULL)
void GetConnex(Int_t i, Int_t j, Int_t n, Int_t n0, HarpoDccMap *m, TH2F *h)
TClonesArray * GetClustersArray()
void SetPzVertex(Double_t val)
TGNumberEntry * fChooseQmin