20 #include "TApplication.h"
27 #include "TLinearFitter.h"
48 if (plane != NULL )plane->
print();
55 std::cout <<
" Processing Event " <<
nEvents<< std::endl;
61 TCanvas *c = (TCanvas *)gROOT->GetListOfCanvases()->FindObject(
"cHarpo");
63 c =
new TCanvas(
"cHarpo",
"Traces",0,0,1000,800);
68 TCanvas *c2 = (TCanvas *)gROOT->GetListOfCanvases()->FindObject(
"cHarpo2");
70 c2 =
new TCanvas(
"cHarpo2",
"Parameters",0,0,1000,800);
75 gStyle->SetOptStat(0);
80 hTev[0] =
new TH1F(
"hTev_X",
"",511,0,511);
83 hTev[1] =
new TH1F(
"hTev_Y",
"",511,0,511);
92 hQtotTev[0] =
new TH1F(
"hQtotTev_X",
"",nbins,0,Qmax);
95 hQtotTev[1] =
new TH1F(
"hQtotTev_Y",
"",nbins,0,Qmax);
97 hTev[0]->SetLineColor(kBlue);
98 hTev[1]->SetLineColor(kRed);
99 hQtotTev[0]->SetLineColor(kBlue);
100 hQtotTev[1]->SetLineColor(kRed);
111 std::cout <<
"Event " <<
nEvents <<
", detector " << ndet <<
" " << m << std::endl;
115 TH2F* hFull =
new TH2F(
"hFull",
";time [25ns];channel [1mm]",511,0,511,304,0,304);
116 TH2F* hMinusTB =
new TH2F(
"hMinusTB",
";time [25ns];channel [1mm]",511,0,511,304,0,304);
117 TH2F* hMinusCh =
new TH2F(
"hMinusCh",
";time [25ns];channel [1mm]",511,0,511,304,0,304);
118 TH2F* hMinusAll =
new TH2F(
"hMinusAll",
";time [25ns];channel [1mm]",511,0,511,304,0,304);
120 TH1F* hPar0 =
new TH1F(
"hPar0",
";par0",1000,-100,100);
121 TH1F* hPar1 =
new TH1F(
"hPar1",
";par1",1000,-1,1);
122 TH1F* hPar2 =
new TH1F(
"hPar2",
";par2",1000,-0.01,0.01);
123 TH1F*
hQ =
new TH1F(
"hQ",
";rms",1000,0,50);
124 TH1F* hQcut =
new TH1F(
"hQcut",
";rms",1000,0,50);
125 TH1F* hNoiseTB =
new TH1F(
"hNoiseTB",
";noiseTB",1000,0,1000);
132 for(Int_t i=0;i<
NADC;i++){
134 TArrayD* valuesTB =
new TArrayD(
NALL);
135 for(Int_t j=0;j<
NALL;j++){
139 q = m->
GetData(2*Int_t(j/2)+1-j%2,i);
140 hFull->SetBinContent(i+1,j+1,q);
141 valuesTB->AddAt(q,j);
146 Double_t noiseTB =
TruncMean(valuesTB,0.16,0.84);
147 hNoiseTB->Fill(noiseTB);
148 TGraph* gMinusCh =
new TGraph();
149 for(Int_t j=0;j<
NALL;j++){
153 q = m->
GetData(2*Int_t(j/2)+1-j%2,i);
155 hMinusTB->SetBinContent(i+1,j+1,q);
156 gMinusCh->SetPoint(gMinusCh->GetN(),j,q);
163 TLinearFitter* fFitCh =
new TLinearFitter(1,
"pol2",
"D");
164 fFitCh->AssignData(gMinusCh->GetN(), 1, gMinusCh->GetX(), gMinusCh->GetY());
169 Double_t mean = 0, rms = 0;
171 for(Int_t j=0;j<
NALL;j++){
174 q = m->
GetData(2*Int_t(j/2)+1-j%2,i);
176 q -= fFitCh->GetParameter(0) + j*fFitCh->GetParameter(1) + j*j*fFitCh->GetParameter(2);
177 hMinusCh->SetBinContent(i+1,j+1,q);
184 rms = TMath::Sqrt(rms/nnoise - mean*mean/nnoise/nnoise);
185 for(Int_t j=0;j<
NALL;j++){
186 Double_t q = hMinusCh->GetBinContent(i+1,j+1);
190 hMinusAll->SetBinContent(i+1,j+1,q);
192 hMinusAll->SetBinContent(i+1,j+1,0);
197 hPar0->Fill(fFitCh->GetParameter(0));
198 hPar1->Fill(fFitCh->GetParameter(1));
199 hPar2->Fill(fFitCh->GetParameter(2));
230 hQtot[ndet]->Fill(qTot);
234 hFull->DrawCopy(
"colz");
236 hMinusTB->DrawCopy(
"colz");
238 hMinusCh->DrawCopy(
"colz");
240 hMinusAll->DrawCopy(
"colz");
244 hNoiseTB->DrawCopy();
253 hQcut->SetLineColor(kRed);
254 hQcut->DrawCopy(
"same");
268 std::cout <<
"No Data Map for plane "<< ndet << std::endl;
362 printf(
"Event %ld done. Waiting for input to continue: ",
nEvents);
363 if(scanf(
"%d",&iscan) == 1)
364 std::cout <<
"Advance to next event" << std::endl;
366 std::cout <<
"Scan all events" << std::endl;
375 hT[0] =
new TH1F(
"hT_X",
";time [tb]",511,0,511);
376 hT[1] =
new TH1F(
"hT_Y",
";time [tb]",511,0,511);
378 hCh[0] =
new TH1F(
"hCh_X",
";channel",304,0,304);
379 hCh[1] =
new TH1F(
"hCh_Y",
";channel",304,0,304);
381 hQ[0] =
new TH1F(
"hQ_X",
";Q_{pixel} [ADC]",4096,0,4096);
382 hQ[1] =
new TH1F(
"hQ_Y",
";Q_{pixel} [ADC]",4096,0,4096);
385 const Int_t nbins = 500;
386 const Int_t nbins2 = 500;
388 Double_t xmin2 = 1e4;
390 Double_t xmax2 = 1e8;
391 Double_t logxmin = TMath::Log(xmin);
392 Double_t logxmin2 = TMath::Log(xmin2);
393 Double_t logxmax = TMath::Log(xmax);
394 Double_t logxmax2 = TMath::Log(xmax2);
395 Double_t binwidth = (logxmax-logxmin)/nbins;
396 Double_t binwidth2 = (logxmax2-logxmin2)/nbins2;
397 Double_t xbins[nbins+1];
398 Double_t xbins2[nbins+1];
401 for (Int_t i=1;i<=nbins;i++)
402 xbins[i] = xmin + TMath::Exp(logxmin+i*binwidth);
403 for (Int_t i=1;i<=nbins2;i++)
404 xbins2[i] = xmin2 + TMath::Exp(logxmin2+i*binwidth2);
406 hQtotT[0] =
new TH1F(
"hQtotT_X",
";Q_{cluster} [ADC]",nbins,xbins);
407 hQtotT[1] =
new TH1F(
"hQtotT_Y",
";Q_{cluster} [ADC]",nbins,xbins);
410 hQtot[0] =
new TH1F(
"hQtot_X",
"Q_{event} [ADC]",nbins2,xbins2);
411 hQtot[1] =
new TH1F(
"hQtot_Y",
"Q_{event} [ADC]",nbins2,xbins2);
413 hCh[0]->SetLineColor(kBlue);
414 hT[0]->SetLineColor(kBlue);
415 hQtotT[0]->SetLineColor(kBlue);
416 hQtot[0]->SetLineColor(kBlue);
417 hQ[0]->SetLineColor(kBlue);
418 hCh[1]->SetLineColor(kRed);
419 hT[1]->SetLineColor(kRed);
420 hQtotT[1]->SetLineColor(kRed);
421 hQtot[1]->SetLineColor(kRed);
422 hQ[1]->SetLineColor(kRed);
455 Int_t size = vect->GetSize();
456 Double_t truncMean = 0;
457 Int_t* index =
new Int_t[size];
458 TMath::Sort(size,vect->GetArray(),index,kFALSE);
459 Int_t t = 0, tLow, tHigh;
462 while(vect->At(index[t])<10&&t<size-1) t++;
463 tLow = TMath::FloorNint(t + (size - t)*tl);
464 tHigh = TMath::FloorNint(t + (size - t)*th);
466 for(Int_t tind = tLow; tind<tHigh; tind++) truncMean += vect->At(index[tind]);
468 return truncMean/(tHigh-tLow);
Monitor noise in non-zerosuppressed data.
Double_t GetData(Int_t i, Int_t j)
Set/Get Data Cell.
Bool_t isExist(ULong_t det)
Detecror date exist //! Number of Real Detectors.
unpacked dcc data The class contains the data map for DCC or Feminos The data is stored as a 2D TMatr...
void Save(char *mode=NULL)
Double_t TruncMean(TArrayD *vect, Double_t tl, Double_t th)
Redefine empty default.
const ULong_t gkNDetectors
HarpoDccMap * GetDccMap(Long_t plane=XDCC)
R__EXTERN HarpoDetSet * gHDetSet