/sipmScan/src/analysisBias.cpp |
---|
103,7 → 103,7 |
int analysisBias(char* dfile0="test", int dbg=0, double tdcCut=5.0) |
{ |
const double c_tdcOffset = 368*TDC_BIN; // ns |
const double c_tdcOffset = 372*TDC_BIN; // ns, SiPM4 |
printf(" Data to root conversion program\nUsage:\nd2r(input file name <without.dat>, debug on/off, TDC cut +-[ns])\n\n"); |
/sipmScan/src/RTUtil.cpp |
---|
1,5 → 1,6 |
//########################################################################################## |
#include "TGaxis.h" |
#include "TColor.h" |
void RTSetStyle(TStyle *style) |
{ |
19,12 → 20,12 |
style->SetOptStat("e"); |
style->SetOptFit(1); |
style->SetPadTopMargin(0.12); |
style->SetPadTopMargin(0.10); |
style->SetPadBottomMargin(0.12); |
style->SetPadLeftMargin(0.12); |
style->SetPadRightMargin(0.12); |
style->SetPadRightMargin(0.15); |
style->SetTitleOffset(1.3, "y"); |
style->SetTitleOffset(1.5, "y"); |
style->SetPalette(1, 0); |
style->SetPaperSize(TStyle::kA4); |
87,6 → 88,17 |
{ |
can->Update(); |
} |
void SetGS() |
{ |
const Int_t Number = 2; |
Double_t Red[Number] = {1.0, 0.0}; |
Double_t Green[Number] = {1.0, 0.0}; |
Double_t Blue[Number] = {1.0, 0.0}; |
Double_t Stops[Number] = {0.0, 1.0}; |
Int_t nb = 50; |
TColor::CreateGradientColorTable(Number, Stops, Red, Green, Blue, nb); |
} |
//########################################################################################## |
/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 15400 // Right edge of SiPM+Lightguide |
#define OFFSETY 6400 // Lower edge of SiPM+Lightguide |
#define OFFSETX 5220 // Right edge of SiPM+Lightguide |
#define OFFSETY 5860 // Lower edge of SiPM+Lightguide |
#define RUNREC_ID 1 |
#define ENDREC_ID 2 |
91,8 → 91,7 |
int analysisScan(char* dfile0="test", int dbg=0, double tdcCut=5.0) |
{ |
const double c_tdcOffset = +368*TDC_BIN; // ns |
const double c_tdcOffset = +96*TDC_BIN; // ns, SiPM4 |
printf(" Data to root conversion program\nUsage:\nd2r(input file name <without .dat>, debug on/off, TDC cut +-[ns])\n\n"); |
printf(" OFFSETS: \n x: %d\n y: %d\n t:%f\n", OFFSETX, OFFSETY, c_tdcOffset); |
/sipmScan/examples/plot_tdc_C.dll |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes: |
Deleted: svn:mime-type |
## -1 +0,0 ## |
-application/octet-stream |
\ No newline at end of property |
Index: examples/plot_tdc_C.rootmap |
=================================================================== |
--- examples/plot_tdc_C.rootmap (revision 46) |
+++ examples/plot_tdc_C.rootmap (nonexistent) |
@@ -1 +0,0 @@ |
-Library.plot_tdc_C: plot_tdc_C libCore.dll libMathCore.dll libRIO.dll libGpad.dll libGraf.dll libHist.dll libHist.dll libMatrix.dll libMathCore.dll libGraf.dll libHist.dll libMatrix.dll libMathCore.dll libRIO.dll libSpectrum.dll libHist.dll libMatrix.dll |
Index: examples/plot_tdc_C.d |
=================================================================== |
--- examples/plot_tdc_C.d (revision 46) |
+++ examples/plot_tdc_C.d (nonexistent) |
@@ -1,76 +0,0 @@ |
-# |
-# DO NOT DELETE |
- |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TROOT.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TDirectory.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TNamed.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TObject.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/Rtypes.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/RConfig.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/RVersion.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/DllImport.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/Rtypeinfo.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TGenericClassInfo.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TSchemaHelper.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TStorage.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TVersionCheck.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/Riosfwd.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TBuffer.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TString.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TRefCnt.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TMathBase.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TList.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TSeqCollection.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TCollection.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TIterator.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TDatime.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TUUID.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TFile.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TDirectoryFile.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TUrl.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TBenchmark.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TStopwatch.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TH1F.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TH1.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAxis.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAttAxis.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TArrayD.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TArray.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAttLine.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAttFill.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAttMarker.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TArrayC.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TArrayS.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TArrayI.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TArrayF.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/Foption.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TVectorFfwd.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TVectorDfwd.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TH2F.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TH2.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TMatrixFBasefwd.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TMatrixDBasefwd.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TCanvas.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TPad.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TVirtualPad.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAttPad.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TVirtualX.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAttText.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/GuiTypes.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/Buttons.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TQObject.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TAttCanvas.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TCanvasImp.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TStyle.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TF1.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TFormula.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TBits.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TObjArray.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TFormulaPrimitive.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/Math/ParamFunctor.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TGraph.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TSpectrum.h RTUtil.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TPaveLabel.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TPave.h |
-C:\HOME\dino\l2d\plot_tdc.o: /cygdrive/C\root/include/TBox.h RTUtil.cpp |
-C:\HOME\dino\l2d\plot_tdc.C: C:\root\include\cintdictversion.h |
Index: examples/plot_tdc_C.exp |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/examples/plot_tdc_C.exp |
---|
Property changes: |
Deleted: svn:mime-type |
## -1 +0,0 ## |
-application/octet-stream |
\ No newline at end of property |
Index: examples/plot_tdc_C.lib |
=================================================================== |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/examples/plot_tdc_C.lib |
---|
Property changes: |
Deleted: svn:mime-type |
## -1 +0,0 ## |
-application/octet-stream |
\ No newline at end of property |
Index: examples/plot_tdc_C.def |
=================================================================== |
--- examples/plot_tdc_C.def (revision 46) |
+++ examples/plot_tdc_C.def (nonexistent) |
@@ -1,58 +0,0 @@ |
-LIBRARY plot_tdc_C |
-EXPORTS |
- ?G__plot_tdc_C_ACLiC_dictLN_TVectorTlEfloatgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_TMatrixTBaselEfloatgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_TVectorTlEdoublegR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_TMatrixTBaselEdoublegR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_iteratorlErandom_access_iterator_tagcOcharcOlongcOcharmUcOcharaNgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_vectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN__RanitlEROOTcLcLTSchemaHelpercOlongcOROOTcLcLTSchemaHelpermUcOROOTcLcLTSchemaHelperaNgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_iteratorlErandom_access_iterator_tagcOROOTcLcLTSchemaHelpercOlongcOROOTcLcLTSchemaHelpermUcOROOTcLcLTSchemaHelperaNgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLiteratorgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_reverse_iteratorlEvectorlEROOTcLcLTSchemaHelpercOallocatorlEROOTcLcLTSchemaHelpergRsPgRcLcLconst_iteratorgR@@3UG__linked_taginfo@@A DATA |
- ?G__plot_tdc_C_ACLiC_dictLN_iteratorlEbidirectional_iterator_tagcOTObjectmUcOlongcOconstsPTObjectmUmUcOconstsPTObjectmUaNgR@@3UG__linked_taginfo@@A DATA |
- ?strchr@@YAPADPADH@Z |
- ?strstr@@YAPADPADPBD@Z |
- ??2TObject@@SAPAXI@Z |
- ??1TDatime@@UAE@XZ |
- ??_R0?AVTDatime@@@8 DATA |
- ?IsA@TDatime@@UBEPAVTClass@@XZ |
- ?SetCanvasColor@TStyle@@QAEXF@Z |
- ?SetCanvasBorderMode@TStyle@@QAEXH@Z |
- ?SetPadColor@TStyle@@QAEXF@Z |
- ?SetPadBorderMode@TStyle@@QAEXH@Z |
- ?SetPadBottomMargin@TStyle@@QAEXM@Z |
- ?SetPadTopMargin@TStyle@@QAEXM@Z |
- ?SetPadLeftMargin@TStyle@@QAEXM@Z |
- ?SetPadRightMargin@TStyle@@QAEXM@Z |
- ?SetFrameFillColor@TStyle@@QAEXF@Z |
- ?SetFrameBorderMode@TStyle@@QAEXH@Z |
- ?SetHistFillColor@TStyle@@QAEXF@Z |
- ?SetStatColor@TStyle@@QAEXH@Z |
- ?SetStatBorderSize@TStyle@@QAEXF@Z |
- ?RTSetStyle@@YAXPAVTStyle@@@Z |
- ??0RTCanvas@@QAE@PAD0HHHH@Z |
- ?Divide@RTCanvas@@QAEXHH@Z |
- ?Divide@RTCanvas@@QAEXH@Z |
- ?cd@RTCanvas@@QAEPAVTPad@@H@Z |
- ?SaveAs@RTCanvas@@QAEXPBD@Z |
- ?Update@RTCanvas@@QAEXXZ |
- ?plot_tdc@@YAHPAD0HHHH@Z |
- G__cpp_dllrevplot_tdc_C_ACLiC_dict |
- ?sizep2memfunc@G__Sizep2memfuncplot_tdc_C_ACLiC_dict@@QAEIXZ |
- G__cpp_setup_inheritanceplot_tdc_C_ACLiC_dict |
- G__cpp_setup_typetableplot_tdc_C_ACLiC_dict |
- G__cpp_setup_memvarplot_tdc_C_ACLiC_dict |
- G__cpp_setup_memfuncplot_tdc_C_ACLiC_dict |
- G__cpp_setup_globalplot_tdc_C_ACLiC_dict |
- G__cpp_setup_funcplot_tdc_C_ACLiC_dict |
- G__cpp_reset_tagtableplot_tdc_C_ACLiC_dict |
- G__cpp_setup_tagtableplot_tdc_C_ACLiC_dict |
- ??1G__cpp_setup_initplot_tdc_C_ACLiC_dict@@QAE@XZ |
- ??0RTCanvas@@QAE@XZ |
- G__set_cpp_environmentplot_tdc_C_ACLiC_dict |
- ??0G__Sizep2memfuncplot_tdc_C_ACLiC_dict@@QAE@XZ |
- ?G__get_sizep2memfuncplot_tdc_C_ACLiC_dict@@YAIXZ |
- G__cpp_setupplot_tdc_C_ACLiC_dict |
- ??0G__cpp_setup_initplot_tdc_C_ACLiC_dict@@QAE@XZ |
- ?G__cpp_setup_initializerplot_tdc_C_ACLiC_dict@@3VG__cpp_setup_initplot_tdc_C_ACLiC_dict@@A DATA |
Index: examples/focus.C |
=================================================================== |
--- examples/focus.C (nonexistent) |
+++ examples/focus.C (revision 47) |
@@ -0,0 +1,70 @@ |
+#include "TROOT.h" |
+#include "TFile.h" |
+#include "TBenchmark.h" |
+#include "TH1F.h" |
+#include "TH2F.h" |
+#include "TCanvas.h" |
+#include "TStyle.h" |
+#include "TPad.h" |
+#include "TPaveText.h" |
+//#include "TLabel.h" |
+#include "TF1.h" |
+#include "TGraph.h" |
+#include "TSpectrum.h" |
+#include "stdio.h" |
+ |
+#include "include/RTUtil.h" |
+ |
+int focus(char filename[256] = "test", int chX=3, int chY=2, double parameter1=16.90, double parameter2=17.20, bool debug = false) |
+{ |
+ const int c_nChannels = 64; |
+ |
+ int map[8][8]={{32,34,53,55,40,42,61,63}, |
+ {48,50,37,39,56,58,45,47}, |
+ {33,35,52,54,41,43,60,62}, |
+ {49,51,36,38,57,59,44,46}, |
+ {17,19,4,6,25,27,12,14}, |
+ {1,3,20,22,9,11,28,30}, |
+ {16,18,5,7,24,26,13,15}, |
+ {0,2,21,23,8,10,29,31} |
+ }; |
+ |
+ char fnameroot[256]; |
+ TFile* rootfile; |
+ sprintf(fnameroot, "root/%s.root", filename); |
+ rootfile = (TFile *) gROOT->FindObject(filename); |
+ if(rootfile==NULL) rootfile = new TFile(fnameroot); |
+ if(rootfile==NULL) { |
+ printf("Cannot open root file %s!!!\n",fnameroot); |
+ return(0); |
+ } |
+ |
+ // set draw style |
+ RTSetStyle(gStyle); |
+ |
+ /** Draws the beam profile and fits it with error function |
+ * on some background function |
+ */ |
+ |
+ TCanvas* canvas9 = new TCanvas("canvas9","canvas9", 500,500); |
+ canvas9->cd(); |
+ char hname[128]; |
+ int channel = map[chX][chY]; |
+ sprintf(hname, "hnhitsx%d", channel); |
+ TH1F* h_laser = (TH1F*)rootfile->Get(hname); |
+ h_laser->Draw(); |
+ h_laser->SetStats(1); |
+ |
+ TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",parameter1,parameter2); |
+ err->SetParameter(0,2500); |
+ err->SetParameter(1, h_laser->GetMaximum()); |
+ err->SetParameter(2, h_laser->GetBinCenter(h_laser->GetMaximumBin())); |
+ err->SetParameter(3, 0.001); |
+ h_laser->Fit(err,"qr"); |
+ h_laser->Fit(err,"lr"); |
+ double sigma = err->GetParameter(3); |
+ printf("sigma = %2.0f um, FWHM = %2.0f um\n", sigma*1000, 2.35*sigma*1000); |
+ |
+ return 0; |
+ |
+ } |
Index: examples/sipm.C |
=================================================================== |
--- examples/sipm.C (revision 46) |
+++ examples/sipm.C (revision 47) |
@@ -6,6 +6,8 @@ |
#include "TCanvas.h" |
#include "TStyle.h" |
#include "TPad.h" |
+#include "TPaveText.h" |
+//#include "TLabel.h" |
#include "TF1.h" |
#include "TGraph.h" |
#include "TSpectrum.h" |
@@ -15,11 +17,9 @@ |
double getNoise(TH2F*, int, int); |
-int sipm(char filename[256] = "test", char plopt[256]="all", int chXstart=0, int chXend=7, int chYstart=0, int chYend=7, bool debug = false) |
+int sipm(char filename[256] = "test", char plopt[256]="all", int parameter1=0, int parameter2=7, int chYstart=0, int chYend=7, bool debug = false) |
{ |
const int c_nChannels = 64; |
- 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}, |
@@ -43,6 +43,16 @@ |
// set draw style |
RTSetStyle(gStyle); |
+ |
+ // Print results to .pdf (option "p") |
+ if(strstr(plopt, "p") != NULL) { |
+ TCanvas* canvasFirst = new TCanvas("canvasFirst","",500,500); |
+ TPaveText* text = new TPaveText(.05,.1,.95,.8); |
+ text->AddText("SiPM Scan results"); |
+ canvasFirst->cd(); |
+ text->Draw(); |
+ canvasFirst->Print("result.pdf("); |
+ } |
if( strstr(plopt, "all") != NULL ) { |
TCanvas *canvas2 = new TCanvas("canvas2","Hits x;;",2000,2000); |
@@ -68,10 +78,16 @@ |
TCanvas *canvas10 = new TCanvas("canvas10","Ch x;;",500,500); |
TH1F* h_hitsx; |
canvas10->cd(); |
+ int chPosition = map[parameter1][parameter2]; |
char hname[128]; |
- sprintf(hname, "hnhitsx%d", chXstart); |
+ sprintf(hname, "hnhitsx%d", chPosition); |
h_hitsx = (TH1F*)rootfile->Get(hname); |
- h_hitsx->Draw(); |
+ h_hitsx->Draw(); |
+ |
+ if(strstr(plopt, "p") != NULL) { |
+ canvas10->Print("result.pdf"); |
+ } |
+ |
} |
if( strstr(plopt, "y") != NULL ) { |
@@ -78,10 +94,15 @@ |
TCanvas *canvas11 = new TCanvas("canvas11","Ch x;;",500,500); |
TH1F* h_hitsy; |
canvas11->cd(); |
+ int chPosition = map[parameter1][parameter2]; |
char hname[128]; |
- sprintf(hname, "hnhitsy%d", chXstart); |
+ sprintf(hname, "hnhitsy%d", chPosition); |
h_hitsy = (TH1F*)rootfile->Get(hname); |
h_hitsy->Draw(); |
+ |
+ if(strstr(plopt, "p") != NULL) { |
+ canvas11->Print("result.pdf"); |
+ } |
} |
if( strstr(plopt, "share") != NULL ) { |
@@ -102,7 +123,7 @@ |
TCanvas *canvas4 = new TCanvas("canvas4","canvas4",500,500); |
canvas4->cd(); |
- for(int i=chXstart; i<=chXend; i++) { |
+ for(int i=parameter1; i<=parameter2; i++) { |
TH1F* h_hitsx; |
char hname[128]; |
int chPosition = map[i][chYstart]; |
@@ -111,7 +132,7 @@ |
h_hitsx->SetTitle("Scan X;x [mm]; Entries"); |
h_hitsx->GetYaxis()->SetTitleOffset(1.3); |
h_hitsx->SetStats(0); |
- if (i == chXstart) |
+ if (i == parameter1) |
h_hitsx->Draw(); |
else { |
h_hitsx->SetLineColor(i+1); |
@@ -126,7 +147,7 @@ |
for(int i=chYstart; i<=chYend; i++) { |
TH1F* h_hitsy; |
char hname[128]; |
- int chPosition = map[chXstart][i]; |
+ int chPosition = map[parameter1][i]; |
sprintf(hname, "hnhitsy%d", chPosition); |
h_hitsy = (TH1F*)rootfile->Get(hname); |
h_hitsy->SetTitle("Scan Y;y [mm]; Entries"); |
@@ -153,12 +174,12 @@ |
// Get the filled histogram from scan |
TH1F* h_x; |
char name[32]; |
- sprintf(name, "hnhitsx%d", chXstart); |
+ sprintf(name, "hnhitsx%d", parameter1); |
h_x = (TH1F*)rootfile->Get(name); |
h_x->DrawCopy(); |
TH1F* h_y; |
- sprintf(name, "hnhitsy%d", chXstart); |
+ sprintf(name, "hnhitsy%d", parameter1); |
h_y = (TH1F*)rootfile->Get(name); |
// Create and fill corrected histogram |
@@ -229,7 +250,7 @@ |
h_line[j] = new TH1F("h_line", "h_line", binsX, xLowUser, xUpUser); |
} |
- for(int j=chXstart; j<=chXend; j++) { |
+ for(int j=parameter1; j<=parameter2; j++) { |
int chPosition = map[j][chYstart]; |
char hname[128]; |
sprintf(hname, "h2d%d", chPosition); |
@@ -245,10 +266,10 @@ |
double eta = -log(1 - signal); |
double x = xLowUser + k*(xUpUser-xLowUser)/double(binsX); |
//double y = l*(yUpUser-yLowUser)/double(binsY); |
- h_line[j]->Fill(x-c_xOffset, signal); |
+ h_line[j]->Fill(x, signal); |
//} |
} |
- if (j == chXstart) { |
+ if (j == parameter1) { |
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); |
@@ -265,9 +286,9 @@ |
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; |
+ for(int i=parameter1; i<=parameter2; i++) { |
+ //int canvasPosition = nX*(i-chYstart)+(j-parameter1)+1; |
+ //int canvasPosition = nX*(chYend-i)+parameter1+1; |
//if (debug) printf("canvas %d\n",canvasPosition); |
int chPosition = map[i][chYstart]; |
char hname[128]; |
@@ -292,7 +313,7 @@ |
//double y = l*(yUpUser-yLowUser)/double(binsY); |
double x = h[histogram]->GetXaxis()->GetBinCenter(k); |
double y = h[histogram]->GetYaxis()->GetBinCenter(l); |
- h_corrected->Fill(x-c_xOffset, y-c_yOffset, eta); |
+ h_corrected->Fill(x, y, eta); |
} |
} |
} |
@@ -315,10 +336,10 @@ |
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=chXend-1; i<=chXend+1; i++) { |
- for(int j=chXstart-1; j<=chXstart+1; j++) { |
- //int canvasPosition = nX*(i-chYstart)+(j-chXstart)+1; |
- int canvasPosition = nX*(chXend+1-i) + (j-chXstart+1) +1; |
+ for(int i=parameter2-1; i<=parameter2+1; i++) { |
+ for(int j=parameter1-1; j<=parameter1+1; j++) { |
+ //int canvasPosition = nX*(i-chYstart)+(j-parameter1)+1; |
+ int canvasPosition = nX*(parameter2+1-i) + (j-parameter1+1) +1; |
if (debug) printf("canvas %d\n",canvasPosition); |
canvas7->cd(canvasPosition); |
char hname[128]; |
@@ -334,7 +355,7 @@ |
canvas8->cd(); |
gStyle->SetOptStat(0); |
char hname[128]; |
- int chPosition = map[chXstart][chXend]; |
+ int chPosition = map[parameter1][parameter2]; |
sprintf(hname, "h2d%d", chPosition); |
TH2F* h_2d = (TH2F*)rootfile->Get(hname); |
@@ -350,6 +371,9 @@ |
Double_t yUpUser = h_2d->GetYaxis()->GetXmax(); |
if (debug) printf("xLow %f xUp %f\n",xLowUser,xUpUser); |
TH2F* h_corrected = new TH2F("h_corrected","h_corrected",binsX, xLowUser, xUpUser, binsY, yLowUser, yUpUser); |
+ double diffX = xUpUser - xLowUser; |
+ double diffY = yUpUser - yLowUser; |
+ //TH2F* h_corrected = new TH2F("h_corrected","h_corrected",binsX, 3.00, 3.00+diffX, binsY, 8.00, 8.00+diffY); |
//TH2F* h_corrected = new TH2F("h_corrected","h_corrected",binsX, minX, maxX, binsY, minY, maxY); |
double noise = getNoise(h_2d, 1, 70); |
@@ -359,24 +383,28 @@ |
double signal = h_2d->GetBinContent(k,j); // detected |
//double p = ((signal - noise) > 1) ? (signal-noise) : 1; |
double p = signal - noise; |
- p /= 10000.; |
+ /* |
+ p /= 1000.; |
double p0 = 1.0 - p; // events with zero photons |
//double eta = (-log(p0) * p0 ) / (1-p0-0.00001); |
double eta = -log(p0); // constant of the poissonian statistics |
if (debug) printf("p=%f p0=%f log(p0)=%f eta=%f\n",p,p0,log(p0),eta); |
+ */ |
//double x = xLowUser + k*(xUpUser - xLowUser) / double(binsX); |
double x = h_2d->GetXaxis()->GetBinCenter(k); |
//double y = yLowUser + j*(yUpUser-yLowUser)/double(binsY); |
double y = h_2d->GetYaxis()->GetBinCenter(j); |
if (debug) printf("x=%f y=%f\n", x, y); |
- h_corrected->Fill(x + c_xOffset, y + c_yOffset, eta); |
+ h_corrected->Fill(x, y, p); |
} |
} |
- 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->SetTitle("n_pe = - ln P(0);x[mm];y[mm]"); |
+ h_corrected->SetTitle(";x[mm];y[mm]"); |
+ //gStyle->SetPalette(52,0); // black and white for print |
+ //h_corrected->GetZaxis()->SetRangeUser(-0.05,1); |
+ //h_corrected->SetContour(100); |
+ //gStyle->SetPalette(1); |
+ //SetGS(); |
h_corrected->Draw("colz"); |
// collection efficiency |
@@ -391,6 +419,11 @@ |
} |
} |
printf("Signal sum = %f\n # of points = %d\n",efficiency,nPoints); |
+ |
+ if(strstr(plopt, "p") != NULL) { |
+ canvas8->Print("result.pdf"); |
+ } |
+ |
} |
/** Draws the sum of channel signals |
@@ -398,7 +431,7 @@ |
* Suitable for 8x8 chs scan |
*/ |
if( strstr(plopt, "sum") != NULL ) { |
- int nX = chXend - chXstart + 1; |
+ int nX = parameter2 - parameter1 + 1; |
int nY = chYend - chYstart + 1; |
TCanvas* canvas12 = new TCanvas("canvas12","c2",8*200, 8*200); |
canvas12->cd(); |
@@ -422,11 +455,11 @@ |
// 2d histogram noise subtraction and poisson scaling |
for(int i=chYstart; i<=chYend; i++) { |
- for(int j=chXstart; j<=chXend; j++) { |
+ for(int j=parameter1; j<=parameter2; 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-chYstart)+(j-parameter1); |
h[histogram] = (TH2F *) rootfile->Get(hname); |
int noise = getNoise(h[histogram], 1, 170); |
if (debug) printf("noise: %d\n",noise); |
@@ -442,7 +475,7 @@ |
//printf("p=%f p0=%f log(p0)=%f eta=%f\n",p,p0,log(p0),eta); |
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->Fill(x, y, eta); |
} |
} |
@@ -469,12 +502,12 @@ |
TCanvas* canvas9 = new TCanvas("canvas9","canvas9", 500,500); |
canvas9->cd(); |
char hname[128]; |
- sprintf(hname, "hnhitsx%d", 36); |
+ sprintf(hname, "hnhitsx%d", 49); |
TH1F* h_laser = (TH1F*)rootfile->Get(hname); |
h_laser->Draw(); |
h_laser->SetStats(1); |
- TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",17.02,17.30); |
+ TF1* err = new TF1("err","[0]+[1]*TMath::Erf((x-[2])/[3])",parameter1,parameter2); |
err->SetParameter(0,2500); |
err->SetParameter(1, h_laser->GetMaximum()); |
err->SetParameter(2, h_laser->GetBinCenter(h_laser->GetMaximumBin())); |
@@ -500,6 +533,12 @@ |
gStyle->SetOptStat(0); |
h_map->Draw("text"); |
} |
+ |
+ if(strstr(plopt, "p") != NULL) { |
+ TCanvas* canvasLast = new TCanvas("canvasLast","",500,500); |
+ canvasLast->Print("result.pdf)"); |
+ } |
+ |
return(0); |
} |
/sipmScan/examples/tdc.C |
---|
65,11 → 65,13 |
canvas1->cd(); |
htdc->Draw("colz"); |
TH3F* h_3D = (TH3F*) rootfile->Get("h_correctedTDC"); |
//TH3F* h_3D = (TH3F*) rootfile->Get("h_correctedTDC"); |
TH2F* h_correctedTDC = (TH2F*) rootfile->Get("h_correctedTDC"); |
TCanvas* canvas2 = new TCanvas("canvas2","canvas2",800,800); |
canvas2->cd(); |
//h_correctedTDC->Draw("colz"); |
h_correctedTDC->Draw("colz"); |
/* |
TH2D* h_correctedTDC = (TH2D*) h_3D->Project3D("xz"); |
h_correctedTDC->SetTitle("; t [ns]; Channel"); |
h_correctedTDC->Draw("colz"); |
77,6 → 79,7 |
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); |