+ TCanvas *c1 = new TCanvas("c1", "CFD vs QTC C side",0,48,1280,951);
+ gStyle->SetOptStat(111111);
+ c1->Divide(4,3);
+
+ for (Int_t i=0; i<12; i++)
+ {
+ c1->cd(i+1);
+ sprintf(buf1,"T0_C_%i_CFD",i+1);
+ sprintf(buf2,"CFDvsQTC%i",i+1);
+ cout<<buf1<<" "<<buf2<<endl;
+ TH2F *qtc_cfd = (TH2F*) gFile->Get(buf2);
+ TH1F *cfd = (TH1F*) gFile->Get(buf1);
+ // cfd->Draw();
+ TSpectrum *s = new TSpectrum(2*npeaks,1);
+ Int_t nfound = s->Search(cfd,sigma," ",0.05);
+ cout<<"Found "<<nfound<<" peaks sigma "<<sigma<<endl;;
+ if(nfound!=0){
+ Float_t *xpeak = s->GetPositionX();
+ TMath::Sort(nfound, xpeak, index,down);
+ Float_t xp = xpeak[index[0]];
+ Int_t xbin = cfd->GetXaxis()->FindBin(xp);
+ Float_t yp = cfd->GetBinContent(xbin);
+ cout<<"xbin = "<<xbin<<"\txpeak = "<<xpeak[1]<<"\typeak = "<<yp<<endl;
+ Float_t hmax = xp+10*sigma;
+ Float_t hmin = xp-10*sigma;
+ cout<<hmin<< " "<<hmax<<endl;
+ // cfd->GetXaxis()->SetRange(hmin,hmax);
+ // TF1 *g1 = new TF1("g1", "gaus", hmin, hmax);
+ // cfd->Fit("g1","R");
+ qtc_cfd->GetYaxis()->SetRange(hmin,hmax);
+ qtc_cfd->Draw();
+
+ }
+
+ }
+ TCanvas *c2 = new TCanvas("c2", "CFD vs QTC A side",0,48,1280,951);
+ gStyle->SetOptStat(111111);
+ c2->Divide(4,3);
+
+ for (Int_t i=12; i<24; i++)
+ {
+ c2->cd(i+1-12);
+ sprintf(buf1,"T0_A_%i_CFD",i+1-12);
+ sprintf(buf2,"CFDvsQTC%i",i+1);
+ cout<<buf1<<" "<<buf2<<endl;
+ TH2F *qtc_cfd = (TH2F*) gFile->Get(buf2);
+ TH1F *cfd = (TH1F*) gFile->Get(buf1);
+ // cfd->Draw();
+ TSpectrum *s = new TSpectrum(2*npeaks,1);
+ Int_t nfound = s->Search(cfd,sigma," ",0.05);
+ cout<<"Found "<<nfound<<" peaks sigma "<<sigma<<endl;;
+ if(nfound!=0){
+ Float_t *xpeak = s->GetPositionX();
+ TMath::Sort(nfound, xpeak, index,down);
+ Float_t xp = xpeak[index[0]];
+ Int_t xbin = cfd->GetXaxis()->FindBin(xp);
+ Float_t yp = cfd->GetBinContent(xbin);
+ cout<<"xbin = "<<xbin<<"\txpeak = "<<xpeak[1]<<"\typeak = "<<yp<<endl;
+ Float_t hmax = xp+10*sigma;
+ Float_t hmin = xp-10*sigma;
+ cout<<hmin<< " "<<hmax<<endl;
+ // cfd->GetXaxis()->SetRange(hmin,hmax);
+ // TF1 *g1 = new TF1("g1", "gaus", hmin, hmax);
+ // cfd->Fit("g1","R");
+ qtc_cfd->GetYaxis()->SetRange(hmin,hmax);
+ qtc_cfd->Draw();
+
+ }
+
+ }
+
+
+
+}
+//------------------------------------------------------------------------
+void DrawWalk()
+{
+ Int_t npeaks = 20;
+ Int_t sigma=3.;
+ Bool_t down = false;
+
+ Int_t index[20];
+ Char_t buf1[10], buf2[10];
+