| /sipmScan/d2r.ini |
|---|
| File deleted |
| /sipmScan/src/analysisThreshold.cpp |
|---|
| 93,7 → 93,7 |
| int analysisThreshold(char* dfile0="test", int dbg=0, double tdcCut=5.0) |
| { |
| const double c_tdcOffset = 1; // ns |
| const double c_tdcOffset = 368*TDC_BIN; // ns |
| printf(" Data to root conversion program\nUsage:\nd2r(input file name <without.dat>, debug on/off, TDC cut +-[ns])\n\n"); |
| 230,7 → 230,7 |
| h_correctedTDC = (TH3F*) gROOT->FindObject("h_correctedTDC"); |
| if (h_correctedTDC) delete h_correctedTDC; |
| nSteps = (run.thUp - run.thLow)/double(run.thStep) + 1; |
| if (dbg) printf("nSteps %d\n", nSteps); |
| if (dbg) printf("nSteps %f\n", nSteps); |
| h_correctedTDC = new TH3F("h_correctedTDC",";SiPM channel; ASD threshold [V]; t [ns]", |
| NCH, |
| -0.5, |
| 238,9 → 238,9 |
| nSteps, |
| (run.thLow - 0.5*run.thStep)/1000.0, |
| (run.thUp + 0.5*run.thStep)/1000.0, |
| 2*tdcCut*TDC_BIN, |
| -tdcCut*TDC_BIN, |
| tdcCut*TDC_BIN); |
| 2*tdcCut+1, |
| (-tdcCut - 0.5)*TDC_BIN, |
| (tdcCut + 0.5)*TDC_BIN); |
| //TH1F* gsumV673A[NCH/16] = new TH1F(hn,hname,256,-0.5,255.5); |
| for(int i=0; i<NCH; i++) { |
| /* |
| /sipmScan/src/analysisBias.cpp |
|---|
| 103,7 → 103,7 |
| int analysisBias(char* dfile0="test", int dbg=0, double tdcCut=5.0) |
| { |
| const double c_tdcOffset = 1; // ns |
| const double c_tdcOffset = 368*TDC_BIN; // ns |
| printf(" Data to root conversion program\nUsage:\nd2r(input file name <without.dat>, debug on/off, TDC cut +-[ns])\n\n"); |
| 240,20 → 240,7 |
| //htdc = (TH2F*) gROOT->FindObject(hname); |
| //if (htdc) delete htdc; |
| //htdc = new TH2F("htdc",";TDC channel;SiPM channel",512,0,512,NCH,0,NCH); |
| h_correctedTDC = (TH3F*) gROOT->FindObject("h_correctedTDC"); |
| if (h_correctedTDC) delete h_correctedTDC; |
| nSteps = (run.thUp - run.thLow)/double(run.thStep) + 1; |
| if (dbg) printf("nSteps %d\n", nSteps); |
| h_correctedTDC = new TH3F("h_correctedTDC",";SiPM channel; ASD threshold [V]; t [ns]", |
| NCH, |
| -0.5, |
| NCH-0.5, |
| nSteps, |
| (run.thLow - 0.5*run.thStep)/1000.0, |
| (run.thUp + 0.5*run.thStep)/1000.0, |
| 2*tdcCut*TDC_BIN, |
| -tdcCut*TDC_BIN, |
| tdcCut*TDC_BIN); |
| //TH1F* gsumV673A[NCH/16] = new TH1F(hn,hname,256,-0.5,255.5); |
| for(int i=0; i<NCH; i++) { |
| /* |
| 296,6 → 283,22 |
| } |
| nBiasSteps = (run.biasUp - run.biasLow)/double(run.biasStep) + 1; |
| h_correctedTDC = (TH3F*) gROOT->FindObject("h_correctedTDC"); |
| if (h_correctedTDC) delete h_correctedTDC; |
| nSteps = (run.thUp - run.thLow)/double(run.thStep) + 1; |
| if (dbg) printf("nSteps %d\n", nSteps); |
| h_correctedTDC = new TH3F("h_correctedTDC",";SiPM channel; ASD threshold [V]; t [ns]", |
| NCH, |
| -0.5, |
| NCH-0.5, |
| nBiasSteps, |
| (run.biasLow - 0.5*run.biasStep)/1000.0, |
| (run.biasUp + 0.5*run.biasStep)/1000.0, |
| 2*tdcCut+1, |
| -tdcCut*TDC_BIN - 0.5*TDC_BIN, |
| tdcCut*TDC_BIN + 0.5*TDC_BIN); |
| h_bias = (TH2F*) gROOT->FindObject("h_bias"); |
| if (h_bias) delete h_bias; |
| h_bias = new TH2F("h_bias",";Channel; Bias [V]", 64, -0.5, 63.5, |
| 392,7 → 395,7 |
| double tdcmax = tdcOffset[channel] + tdcCut; |
| double time = data*TDC_BIN - tdcOffset[channel]; |
| if(time >= -tdcCut and time <= tdcCut) { |
| h_correctedTDC->Fill(channel, thr.threshold/1000.0, time); |
| h_correctedTDC->Fill(channel, bias.bias/1000.0, time); |
| hnhitsx[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN); |
| hnhitsy[channel]->Fill((pos.yset - OFFSETY) * MIKRO_BIN); |
| h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN); |
| 497,7 → 500,7 |
| int position(int x, int y, int channel) |
| { |
| int flag = 0; |
| if ( (x > (padCenter[channel][0] - 5000)) and (x < (padCenter[channel][0] + 5000)) and |
| (y > (padCenter[channel][1] - 5000)) and (y < (padCenter[channel][1] + 5000)) ) flag = 1; |
| if ( (x > (padCenter[channel][0] - 5040)) and (x < (padCenter[channel][0] + 5040)) and |
| (y > (padCenter[channel][1] - 5040)) and (y < (padCenter[channel][1] + 5040)) ) flag = 1; |
| return flag; |
| } |
| /sipmScan/src/RTUtil.cpp |
|---|
| 1,4 → 1,6 |
| //########################################################################################## |
| #include "TGaxis.h" |
| void RTSetStyle(TStyle *style) |
| { |
| style->SetStatBorderSize(1); |
| 14,16 → 16,20 |
| style->SetMarkerStyle(kFullDotLarge); |
| //style->SetMarkerSize(7); |
| style->SetOptStat("e"); |
| style->SetOptFit(1); |
| style->SetPadTopMargin(0.15); |
| style->SetPadBottomMargin(0.15); |
| style->SetPadLeftMargin(0.15); |
| style->SetPadRightMargin(0.15); |
| style->SetPadTopMargin(0.12); |
| style->SetPadBottomMargin(0.12); |
| style->SetPadLeftMargin(0.12); |
| style->SetPadRightMargin(0.12); |
| style->SetTitleOffset(1.3, "y"); |
| gStyle->SetPalette(1, 0); |
| style->SetPalette(1, 0); |
| //gStyle->SetPaperSize(TStyle::kA4); |
| style->SetPaperSize(TStyle::kA4); |
| TGaxis::SetMaxDigits(4); |
| } |
| //########################################################################################## |
| RTCanvas::RTCanvas() |
| /sipmScan/src/analysisScan.cpp |
|---|
| 30,8 → 30,8 |
| #define NCH 64 |
| #define TDC_BIN 1.0416 // 1 TDC bin in ns |
| #define MIKRO_BIN 0.49609/1000. //1 mikro step in mm; stage MM3MF |
| #define OFFSETX 4800 // Right edge of SiPM+Lightguide |
| #define OFFSETY 3400 // Lower edge of SiPM+Lightguide |
| #define OFFSETX 15400 // Right edge of SiPM+Lightguide |
| #define OFFSETY 6400 // Lower edge of SiPM+Lightguide |
| #define RUNREC_ID 1 |
| #define ENDREC_ID 2 |
| 103,7 → 103,7 |
| //Chanel information |
| double tdcOffset[NCH]; |
| sprintf(fullname, "d2r.ini"); |
| sprintf(fullname, "sipmScan.ini"); |
| if( (fp=fopen(fullname, "rt")) == NULL ) |
| printf("Cannot open pad centers file %s !!!\n", fullname); |
| else { |
| 374,9 → 374,9 |
| hnhitsx[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN); |
| hnhitsy[channel]->Fill((pos.yset - OFFSETY) * MIKRO_BIN); |
| //h_threshold->Fill(channel, thr.threshold); |
| if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) { |
| //if (position(pos.xset-OFFSETX, pos.yset-OFFSETY, channel)) { |
| h2d[channel]->Fill((pos.xset - OFFSETX) * MIKRO_BIN, (pos.yset - OFFSETY) * MIKRO_BIN); |
| } |
| //} |
| } |
| //gV673A->Fill(data,channel); |
| //gsumV673A[channel/16]->Fill(data); |
| /sipmScan/sipmScan.ini |
|---|
| 0,0 → 1,72 |
| # ch pad_center_x pad_center_y tdc_offset # sipm4, tdc modified 9/4/14 pos added 20/2/14 threshold scan |
| 0 75600 5040 0 |
| 1 55440 5040 0 |
| 2 75600 15120 0 |
| 3 55440 15120 0 |
| 4 45360 25200 0 |
| 5 65520 25200 0 |
| 6 45360 35280 0 |
| 7 65520 35280 0 |
| 8 75600 45360 0 |
| 9 55440 45360 -1 |
| 10 75600 55440 -1 |
| 11 55440 55440 -1 |
| 12 45360 65520 -1 |
| 13 65520 65520 -1 |
| 14 45360 75600 -1 |
| 15 65520 75600 -1 |
| 16 65520 5040 1 |
| 17 45360 5040 1 |
| 18 65520 15120 1 |
| 19 45360 15120 1 |
| 20 55440 25200 1 |
| 21 75600 25200 1 |
| 22 55440 35280 1 |
| 23 75600 35280 0 |
| 24 65520 45360 0 |
| 25 45360 45360 0 |
| 26 65520 55440 0 |
| 27 45360 55440 0 |
| 28 55440 65520 0 |
| 29 75600 65520 0 |
| 30 55440 75600 0 |
| 31 75600 75600 3 |
| 32 5040 5040 0 |
| 33 25200 5040 0 |
| 34 5040 15120 0 |
| 35 25200 15120 0 |
| 36 35280 25200 0 |
| 37 15120 25200 0 |
| 38 35280 35280 1 |
| 39 15120 35280 1 |
| 40 5040 45360 1 |
| 41 25200 45360 1 |
| 42 5040 55440 1 |
| 43 25200 55440 1 |
| 44 35280 65520 1 |
| 45 15120 65520 1 |
| 46 35280 75600 1 |
| 47 15120 75600 1 |
| 48 15120 5040 1 |
| 49 35280 5040 1 |
| 50 15120 15120 1 |
| 51 35280 15120 1 |
| 52 25200 25200 0 |
| 53 5040 25200 -1 |
| 54 25200 35280 -1 |
| 55 5040 35280 -1 |
| 56 15120 45360 -1 |
| 57 35280 45360 -1 |
| 58 15120 55440 -1 |
| 59 35280 55440 -1 |
| 60 25200 65520 -1 |
| 61 5040 65520 -1 |
| 62 25200 75600 -1 |
| 63 5040 75600 -1 |
| /sipmScan/examples/thresholdScan.C |
|---|
| 60,11 → 60,12 |
| TCanvas* canvas2 = new TCanvas("canvas2","",1600,800); |
| //canvas2->Divide(2); |
| TH1D* h_projection1 = h_threshold->ProjectionY("Ch 37",38,38); |
| int channel = map[chXstart][chXend]; |
| TH1D* h_projection1 = h_threshold->ProjectionY("",channel+1,channel+1); |
| canvas2->cd(); |
| //h_projection1->GetYaxis()->SetRangeUser(0,1000); |
| //gPad->SetLogy(); |
| h_projection1->SetTitle("Channel 37;Threshold [V]; Events"); |
| h_projection1->SetTitle(";Threshold [V]; Events"); |
| h_projection1->Draw(); |
| /* |
| TH1D* h_projection2 = h_threshold->ProjectionY("Ch 38",39,39); |
| /sipmScan/examples/sipm.C |
|---|
| 372,9 → 372,10 |
| h_corrected->Fill(x + c_xOffset, y + c_yOffset, eta); |
| } |
| } |
| //h_corrected->SetTitle("n_pe = - ln P(0);x[mm];y[mm]"); |
| h_corrected->SetTitle(";x[mm];y[mm]"); |
| h_corrected->GetZaxis()->SetRangeUser(-0.01,0.5); |
| h_corrected->SetTitle("n_pe = - ln P(0);x[mm];y[mm]"); |
| //h_corrected->SetTitle(";x[mm];y[mm]"); |
| gStyle->SetPalette(52,0); |
| h_corrected->GetZaxis()->SetRangeUser(-0.05,0.7); |
| h_corrected->SetContour(50); |
| h_corrected->Draw("colz"); |
| /sipmScan/examples/tdc.C |
|---|
| 75,19 → 75,22 |
| h_correctedTDC->Draw("colz"); |
| TCanvas* canvas3 = new TCanvas("canvas3","canvas3",800,800); |
| canvas2->cd(2); |
| TH1D* h_allTDCbins = h_correctedTDC->ProjectionX("", 1, 64); |
| h_allTDCbins->Draw(); |
| /* |
| int binY = map[chX][chY]; |
| TH1D* channelY = h_correctedTDC->ProjectionX("",binY+1,binY+1); |
| //channelY->SetStats(0); |
| channelY->SetStats(0); |
| char title[256]; |
| sprintf(title,"Channel %d;t [ns];Events", binY); |
| channelY->SetTitle(title); |
| channelY->GetYaxis()->SetTitleOffset(1.7); |
| //TAxis* xAxis = h_correctedTDC->GetXaxis(); |
| //int range = xAxis->GetBinUpEdge(xAxis->GetLast()+1); |
| //channelY->GetXaxis()->SetRangeUser(-range, range); |
| TAxis* xAxis = h_correctedTDC->GetXaxis(); |
| int range = xAxis->GetBinUpEdge(xAxis->GetLast()+1); |
| channelY->GetXaxis()->SetRangeUser(-range, range); |
| channelY->Draw(); |
| /* |
| TF1* f_gaus1 = new TF1("f_gaus1","[0] + gaus(1)", rangeLeft,rangeRight); |
| TF1* f_gaus2 = new TF1("f_gaus2","[0] + gaus(1) + gaus(4)",-8,8); |
| f_gaus1->SetParNames("Linear","Norm","#mu","#sigma"); |
| /sipmScan/examples/biasScan.C |
|---|
| 12,16 → 12,17 |
| #include "TSpectrum.h" |
| #include "stdio.h" |
| #include "THStack.h" |
| #include "TPaveText.h" |
| #include "include/RTUtil.h" |
| double getNoise(TH2F*, int, int); |
| int biasScan(char filename[256] = "test", char plopt[256]="th", int chXstart=0, int chXend=7, int chYstart=0, int chYend=7, bool debug = false) |
| int biasScan(char filename[256] = "test", char plopt[256]="th", int chXstart=0, int chXend=7, double par1=0.0, double par2=0.0, bool debug = false) |
| { |
| const int c_nChannels = 64; |
| const double c_xOffset = 1; // mm |
| const double c_yOffset = 0.7; |
| const double c_xOffset = 0; // mm |
| const double c_yOffset = 0; |
| int map[8][8]={{32,34,53,55,40,42,61,63}, |
| {48,50,37,39,56,58,45,47}, |
| 74,7 → 75,7 |
| TH2D* h_correctedTDC = (TH2D*) h0->Project3D("xz"); |
| //h0->GetZaxis()->SetRangeUser(-5,5); |
| //h0->Project3D("xzo")->Draw("colz"); |
| h_correctedTDC->SetTitle("; t [ns]; Channel"); |
| //h_correctedTDC->SetTitle("; t [ns]; Channel"); |
| h_correctedTDC->Draw("colz"); |
| /* |
| TH1F* tdc1 = new TH1F("tdc1",";TDC [ns];Events",binsZ, minZ, maxZ); |
| 89,7 → 90,7 |
| TH2D* h_timeWalk = (TH2D*) h0->Project3D("zy"); |
| canvas21->cd(2); |
| h_timeWalk->SetTitle(";Threshold [V]; t [ns]"); |
| //h_timeWalk->SetTitle(";Threshold [V]; t [ns]"); |
| h_timeWalk->Draw("colz"); |
| } |
| 137,10 → 138,10 |
| main->cd(); |
| main->Divide(4,4); |
| for(int i=chXstart; i<chXend; i++) { |
| for(int j=chYstart; j<chYend; j++) { |
| for(int j=(int)par1; j<(int)par2; j++) { |
| int channel = map[i][j]; |
| TH1D* h_projection = h_threshold->ProjectionY("",channel+1,channel+1); |
| int canvasPosition = i-chXend+4*(chYend-j)+1; |
| int canvasPosition = i-chXend+4*((int)par2-j)+1; |
| printf(" %d ", canvasPosition); |
| main->cd(canvasPosition); |
| gPad->SetMargin(0.08, 0.08, 0.08, 0.08); |
| 181,7 → 182,28 |
| h_projection->SetMarkerStyle(kFullDotMedium); |
| //h_projection->SetMarkerSize(8); |
| gPad->SetMargin(0.1,0.1,0.1,0.1); |
| TF1* f_linear = new TF1("f_linear", "[0] + [1]*x", par1, par2); |
| f_linear->SetParameter(0, -1); |
| f_linear->SetParameter(1, 0.1); |
| f_linear->SetParNames("p0", "p1"); |
| h_projection->Fit(f_linear,"q"); |
| h_projection->Fit(f_linear,"r"); |
| h_projection->Draw("pe1x0"); |
| double p0 = f_linear->GetParameter(0); |
| double p1 = f_linear->GetParameter(1); |
| printf("p0 %f p1 %f V_b = %f [V]\n", p0, p1, -p0/p1); |
| TPaveText *text = new TPaveText(0.15,0.5,0.35,0.56); |
| text->SetFillColor(0); |
| text->SetBorderSize(0.1); |
| text->SetTextSize(0.030); |
| char string[128]; |
| sprintf(string, "V_b = %2.2f", -p0/p1); |
| text->AddText(string); |
| text->Draw("same"); |
| text->Paint(); |
| } |
| if( strstr(plopt, "all") != NULL ) { |
| 223,167 → 245,8 |
| h_hitsy = (TH1F*)rootfile->Get(hname); |
| h_hitsy->Draw(); |
| } |
| if( strstr(plopt, "share") != NULL ) { |
| /*TCanvas *canvas4 = new TCanvas("canvas1","canvas1",1000,1000); |
| int nChannels = chYend-chYstart+1; |
| int ncols = nChannels/2; |
| printf("nch %d nch\\2 %d\n", nChannels, ncols); |
| canvas4->Divide(2,ncols); |
| TH1F* h_hitsy; |
| for(int i=chYstart; i<=chYend; i++){ |
| canvas4->cd(i-chYstart+1); |
| char hname[128]; |
| int chPosition = map[0][i]; |
| sprintf(hname, "hnhitsy%d", chPosition); |
| h_hitsy = (TH1F*)rootfile->Get(hname); |
| h_hitsy->Draw(); |
| }*/ |
| TCanvas *canvas4 = new TCanvas("canvas4","canvas4",500,500); |
| canvas4->cd(); |
| for(int i=chXstart; i<=chXend; i++) { |
| TH1F* h_hitsx; |
| char hname[128]; |
| int chPosition = map[i][chYstart]; |
| sprintf(hname, "hnhitsx%d", chPosition); |
| h_hitsx = (TH1F*)rootfile->Get(hname); |
| h_hitsx->SetTitle("Scan X;x [mm]; Entries"); |
| h_hitsx->GetYaxis()->SetTitleOffset(1.3); |
| h_hitsx->SetStats(0); |
| if (i == chXstart) |
| h_hitsx->Draw(); |
| else { |
| h_hitsx->SetLineColor(i+1); |
| h_hitsx->Draw("same"); |
| } |
| } |
| //sprintf(fullname, "ps/%s_Yshare.eps", filename); |
| //canvas4->SaveAs(fullname); |
| TCanvas *canvas5 = new TCanvas("canvas5","canvas5",500,500); |
| canvas5->cd(); |
| for(int i=chYstart; i<=chYend; i++) { |
| TH1F* h_hitsy; |
| char hname[128]; |
| int chPosition = map[chXstart][i]; |
| sprintf(hname, "hnhitsy%d", chPosition); |
| h_hitsy = (TH1F*)rootfile->Get(hname); |
| h_hitsy->SetTitle("Scan Y;y [mm]; Entries"); |
| h_hitsy->GetYaxis()->SetTitleOffset(1.3); |
| h_hitsy->SetStats(0); |
| if (i == chYstart) |
| h_hitsy->Draw(); |
| else { |
| h_hitsy->SetLineColor(i+1); |
| h_hitsy->Draw("same"); |
| } |
| } |
| //sprintf(fullname, "ps/%s_Yshare.eps", filename); |
| //canvas5->SaveAs(fullname); |
| } |
| /** Draws the signal from 8 channels in x-row |
| * for one specific y bin, so the background and cross-talk |
| * can be estimated. |
| * Draws also a 2d scan of these channels. |
| */ |
| if (strstr(plopt, "line") != NULL) { |
| TCanvas* canvas6 = new TCanvas("canvas6","canvas6",500,500); |
| canvas6->cd(0); |
| gStyle->SetOptStat(0); |
| TH2F* h0 = (TH2F*) rootfile->Get("h2d0"); |
| Int_t binsX = h0->GetXaxis()->GetNbins(); |
| Int_t minX = h0->GetXaxis()->GetFirst(); |
| Int_t maxX = h0->GetXaxis()->GetLast()+1; |
| Int_t binsY = h0->GetYaxis()->GetNbins(); |
| Int_t minY = h0->GetYaxis()->GetFirst(); |
| Int_t maxY = h0->GetYaxis()->GetLast()+1; |
| Double_t xLowUser = h0->GetXaxis()->GetBinLowEdge(minX); |
| Double_t xUpUser = h0->GetXaxis()->GetBinUpEdge(maxX); |
| Double_t yLowUser = h0->GetYaxis()->GetBinLowEdge(minY); |
| Double_t yUpUser = h0->GetYaxis()->GetBinUpEdge(maxY); |
| if (debug) printf("xLow %f xUp %f\n",xLowUser,xUpUser); |
| //! 1-dimension position in x vs. hits |
| TH2F* h[8]; |
| TH1F* h_line[8]; |
| for(int j=0; j<8; j++) { |
| h_line[j] = new TH1F("h_line", "h_line", binsX, xLowUser, xUpUser); |
| } |
| for(int j=chXstart; j<=chXend; j++) { |
| int chPosition = map[j][chYstart]; |
| char hname[128]; |
| sprintf(hname, "h2d%d", chPosition); |
| int histogram = j; |
| h[histogram] = (TH2F *) rootfile->Get(hname); |
| int noise = getNoise(h[histogram], 1, 160); |
| for(int k=minX; k<=maxX; k++) { |
| int l=chYstart*20+12; |
| //for(int l=12; l<=16; l++) { |
| double signal = h[histogram]->GetBinContent(k,l); |
| //signal -= noise; |
| //signal /= 5*10000.0; |
| double eta = -log(1 - signal); |
| double x = k*(xUpUser-xLowUser)/double(binsX); |
| //double y = l*(yUpUser-yLowUser)/double(binsY); |
| h_line[j]->Fill(x-c_xOffset, signal); |
| //} |
| } |
| if (j == chXstart) { |
| h_line[j]->SetTitle("SiPM#2 w/o noise subtraction;x[mm];Hits"); |
| //h_line[j]->GetYaxis()->SetRangeUser(-0.05, 0.3); |
| //h_line[j]->GetYaxis()->SetRangeUser(-50, 2500); |
| h_line[j]->Draw(""); |
| } |
| else { |
| h_line[j]->SetLineColor(j+1); |
| h_line[j]->Draw("same"); |
| } |
| } |
| //! 2d scan |
| TCanvas* canvas61 = new TCanvas("canvas61","canvas61",8*200,300); |
| canvas61->cd(); |
| TH2F* h_corrected = new TH2F("h_corrected","h_corrected",binsX,xLowUser,xUpUser, binsY,yLowUser,yUpUser); |
| for(int i=chXstart; i<=chXend; i++) { |
| //int canvasPosition = nX*(i-chYstart)+(j-chXstart)+1; |
| //int canvasPosition = nX*(chYend-i)+chXstart+1; |
| //if (debug) printf("canvas %d\n",canvasPosition); |
| int chPosition = map[i][chYstart]; |
| char hname[128]; |
| sprintf(hname, "h2d%d", chPosition); |
| int histogram = i; |
| h[histogram] = (TH2F *) rootfile->Get(hname); |
| int noise = getNoise(h[histogram], 1, 100); |
| for(int k=minX; k<=maxX; k++) { |
| for(int l=minY; l<=maxY; l++) { |
| int signal = h[histogram]->GetBinContent(k,l); // detected |
| //p /= 10000.; |
| //double p0 = 1.0 - p; // events with zero photons |
| //double eta = (-log(p0) * p0 ) / (1-p0-0.00001); |
| //double eta = -log(p0); |
| //printf("p=%f p0=%f log(p0)=%f eta=%f\n",p,p0,log(p0),eta); |
| //double signal = ((p - noise) > 0.1) ? (p-noise) : 0.1; |
| double p = signal - noise; |
| p /= 10000.0; |
| double eta = -log(1 - p); |
| double x = k*(xUpUser-xLowUser)/double(binsX); |
| double y = l*(yUpUser-yLowUser)/double(binsY); |
| h_corrected->Fill(x-c_xOffset, y-c_yOffset, eta); |
| } |
| } |
| } |
| h_corrected->SetTitle("SiPM#2 n_pe = - ln(P0);x[mm];y[mm]"); |
| h_corrected->GetZaxis()->SetRangeUser(-0.05,0.30); |
| h_corrected->Draw("colz"); |
| } |
| /** Draws the sum of the channels |
| * Each channel is a 2d plot |
| * Intended for the study of 1 channel |
| 391,14 → 254,14 |
| if (strstr(plopt, "2d") != NULL) { |
| int nX = chXend - chXstart + 1; |
| int nY = chYend - chYstart + 1; |
| int nY = (int)par2 - (int)par1 + 1; |
| TCanvas* canvas7 = new TCanvas("canvas7","canvas7", nX*400,nY*400); |
| printf("nx %d ny %d\n",nX,nY); |
| canvas7->Divide(nX,nY); |
| for(int i=chYstart; i<=chYend; i++) { |
| for(int i=(int)par1; i<=(int)par2; i++) { |
| for(int j=chXstart; j<=chXend; j++) { |
| //int canvasPosition = nX*(i-chYstart)+(j-chXstart)+1; |
| int canvasPosition = nX*(chYend-i)+(j-chXstart)+1; |
| int canvasPosition = nX*((int)par2-i)+(j-chXstart)+1; |
| if (debug) printf("canvas %d\n",canvasPosition); |
| canvas7->cd(canvasPosition); |
| char hname[128]; |
| 471,8 → 334,8 |
| * Suitable for 8x8 chs scan |
| */ |
| if( strstr(plopt, "sum") != NULL ) { |
| int nX = chXend - chXstart + 1; |
| int nY = chYend - chYstart + 1; |
| int nX = 7 - 0 + 1; |
| int nY = 7 - 0 + 1; |
| TCanvas* canvas12 = new TCanvas("canvas12","c2",8*200, 8*200); |
| canvas12->cd(); |
| gStyle->SetOptStat(0); |
| 494,12 → 357,12 |
| TH2F* h[9]; |
| // 2d histogram noise subtraction and poisson scaling |
| for(int i=chYstart; i<=chYend; i++) { |
| for(int i=0; i<=7; i++) { |
| for(int j=chXstart; j<=chXend; j++) { |
| int chPosition = map[j][i]; |
| char hname[128]; |
| sprintf(hname, "h2d%d", chPosition); |
| int histogram = nX*(i-chYstart)+(j-chXstart); |
| int histogram = nX*(i-0)+(j-chXstart); |
| h[histogram] = (TH2F *) rootfile->Get(hname); |
| int noise = getNoise(h[histogram], 1, 170); |
| if (debug) printf("noise: %d\n",noise); |