Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 298 → Rev 299

/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/CAENV965.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/CC_options.txt
1,0 → 0,0
-triple i386-pc-win32 -fno-caret-diagnostics -fno-gnu-keywords -fms-extensions -mms-bitfields -fmath-errno -mdisable-fp-elim -Wno-microsoft -Wno-error=invalid-token-paste -Werror=gnu -Werror=pointer-arith -Wno-pointer-sign -Wno-unreachable-code -Wno-parentheses -Wno-unused-variable -Wuninitialized -Wno-div-by-zero -Wno-array-bounds -Wno-null-dereference -Wno-ignored-qualifiers -Wreturn-type -Wno-panel-handle -Wno-tautological-compare -Wno-empty-body -Wno-missing-braces -Wno-overlength-strings -Wno-cast-align -Wno-missing-noreturn -Wno-invalid-noreturn -Wno-shadow -Wno-switch -Wno-switch-enum -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-value -Wno-used-but-marked-unused -Wno-conversion -Wno-sign-compare -Wno-char-subscripts -Wno-declaration-after-statement -Wno-typecheck-convert -Wno-float-equal -Wno-vla -Wno-attributes -Wno-unknown-attributes -Wno-deprecated-declarations -Wno-packed -Wno-padded -Wno-comment -Wno-format -Wno-implicit-int -Wno-implicit-function-declaration -Wno-builtin-implicit-decl -Wno-missing-declarations -Wno-missing-field-initializers -Wno-trigraphs -Wno-multichar -Wno-long-long -Wno-unknown-pragmas -Wno-ignored-pragmas -Wno-pragma-reset -Wno-pragma-on-off-switch -Wno-pragma-unused -Wno-end-of-directive -Wno-pragma-not-supported -Wno-unexpected-token -Wno-four-char-constants -Wno-discard-qual -Wno-sign-conversion -Wno-variadic-macros -Wno-macro-name -Wno-macro-poisoning -Wno-macro-redefined -Wno-builtin-macro-redefined -Wno-builtin-macro-undefined -Wno-unused-macros -Wno-gnu-designator -Wno-nonnull -Wno-constant-conversion -Wno-out-of-scope-declarations -Wno-static-non-static -Wno-constant-too-large -Wno-#warnings -Wno-undef -Wno-include-next -Wno-extra-tokens -Wno-line-number -Wno-weak -Wno-member-redeclare -Wno-expected-semi -Wno-too-many-args -Wno-literal-range -Wno-unknown-escape -Wno-shift -Wchar-init -Wno-braces-init -Wno-incomplete-field -Wno-tentative -Wno-ordered-comparison -Wno-pointer-compare -Wno-stack-memory -Wno-excess-elements -Wno-missing-terminating -Wno-illegal-storage -Wno-clang -Wno-backslash -Wno-decl-param -Wno-negative-to-unsigned -Wno-extern -Wno-constant-logical-operand -Wno-initializer-overrides -Wno-variadic-call-conv -Wno-main -Wno-omp-nested-parallel -Wno-omp-repeated-ordered -Wpointer-int-conv -Wint-conversion -Wpointer-conv -Wmissing-return-value -Winvalid-return -Wduplicate-decl-spec -Wpromoted-param -Wno-strict-prototypes -Wno-va-named-param -Wno-invalid-token-paste -fdiagnostics-show-option -cvi-debugging=standard -Wuninitialized-runtime -I "c:\Program Files\National Instruments\CVI2013\instr\CAMAC_2000" -I "c:\Program Files\National Instruments\CVI2013\instr\WIENVME_DLL" -I "c:\Program Files\National Instruments\CVI2013\instr\CAENV965" -I "c:\program files\national instruments\cvi2013\toolslib\activex\word" -I "c:\program files\national instruments\cvi2013\toolslib\activex\excel" -I "c:\program files\national instruments\cvi2013\toolslib\custctrl" -I "c:\program files\national instruments\cvi2013\toolslib\custctrl\custsupp" -I "c:\program files\national instruments\cvi2013\toolslib\cvirtsup" -I "c:\program files\national instruments\cvi2013\toolslib\datasock" -I "c:\program files\national instruments\cvi2013\toolslib\daqUtil" -I "c:\program files\national instruments\cvi2013\toolslib\printing" -I "c:\program files\national instruments\cvi2013\toolslib\toolbox" -I "c:\program files\national instruments\cvi2013\toolslib\reportgen" -I "c:\program files\national instruments\cvi2013\toolslib\localui" -I "c:\program files\national instruments\cvi2013\instr" -I "C:\Program Files\National Instruments\Shared\CVI\toolslib\custctrl" -I "C:\Program Files\National Instruments\Shared\CVI\toolslib\custctrl\custsupp" -I "C:\Program Files\National Instruments\Shared\CVI\instr" -I "C:\ProgramData\National Instruments\CVI2013\instr" -I "c:\program files\national instruments\cvi2013\include" -I "C:\Program Files\National Instruments\Shared\CVI\include" -I "C:\ProgramData\National Instruments\CVI2013\include" -I "C:\ProgramData\National Instruments\CVI\include" -I "c:\program files\national instruments\cvi2013\include\ansi" -I "c:\program files\national instruments\cvi2013\include\clang\2.9" -I "C:\Program Files\IVI Foundation\IVI\Include" -I "C:\Program Files\IVI Foundation\VISA\winnt\include" -I "c:\program files\national instruments\cvi2013\sdk\include" -I c:\home\cvi\instr\CAENV965 -I c:\home\cvi\instr\CAMAC_2000 -I c:\home\cvi\instr\WIENVME_DLL -I "c:\Program Files\National Instruments\CVI2013\bin" -I "c:\ProgramData\National Instruments\CVI2013\bin" -I "c:\Program Files\National Instruments\Shared\CVI\Bin"
-triple i386-pc-win32 -fno-caret-diagnostics -fno-gnu-keywords -fms-extensions -mms-bitfields -fmath-errno -mdisable-fp-elim -Wno-microsoft -Wno-error=invalid-token-paste -Werror=gnu -Werror=pointer-arith -Wno-pointer-sign -Wno-unreachable-code -Wno-parentheses -Wno-unused-variable -Wuninitialized -Wno-div-by-zero -Wno-array-bounds -Wno-null-dereference -Wno-ignored-qualifiers -Wreturn-type -Wno-panel-handle -Wno-tautological-compare -Wno-empty-body -Wno-missing-braces -Wno-overlength-strings -Wno-cast-align -Wno-missing-noreturn -Wno-invalid-noreturn -Wno-shadow -Wno-switch -Wno-switch-enum -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-value -Wno-used-but-marked-unused -Wno-conversion -Wno-sign-compare -Wno-char-subscripts -Wno-declaration-after-statement -Wno-typecheck-convert -Wno-float-equal -Wno-vla -Wno-attributes -Wno-unknown-attributes -Wno-deprecated-declarations -Wno-packed -Wno-padded -Wno-comment -Wno-format -Wno-implicit-int -Wno-implicit-function-declaration -Wno-builtin-implicit-decl -Wno-missing-declarations -Wno-missing-field-initializers -Wno-trigraphs -Wno-multichar -Wno-long-long -Wno-unknown-pragmas -Wno-ignored-pragmas -Wno-pragma-reset -Wno-pragma-on-off-switch -Wno-pragma-unused -Wno-end-of-directive -Wno-pragma-not-supported -Wno-unexpected-token -Wno-four-char-constants -Wno-discard-qual -Wno-sign-conversion -Wno-variadic-macros -Wno-macro-name -Wno-macro-poisoning -Wno-macro-redefined -Wno-builtin-macro-redefined -Wno-builtin-macro-undefined -Wno-unused-macros -Wno-gnu-designator -Wno-nonnull -Wno-constant-conversion -Wno-out-of-scope-declarations -Wno-static-non-static -Wno-constant-too-large -Wno-#warnings -Wno-undef -Wno-include-next -Wno-extra-tokens -Wno-line-number -Wno-weak -Wno-member-redeclare -Wno-expected-semi -Wno-too-many-args -Wno-literal-range -Wno-unknown-escape -Wno-shift -Wchar-init -Wno-braces-init -Wno-incomplete-field -Wno-tentative -Wno-ordered-comparison -Wno-pointer-compare -Wno-stack-memory -Wno-excess-elements -Wno-missing-terminating -Wno-illegal-storage -Wno-clang -Wno-backslash -Wno-decl-param -Wno-negative-to-unsigned -Wno-extern -Wno-constant-logical-operand -Wno-initializer-overrides -Wno-variadic-call-conv -Wno-main -Wno-omp-nested-parallel -Wno-omp-repeated-ordered -Wpointer-int-conv -Wint-conversion -Wpointer-conv -Wmissing-return-value -Winvalid-return -Wduplicate-decl-spec -Wpromoted-param -Wno-strict-prototypes -Wno-va-named-param -Wno-invalid-token-paste -fdiagnostics-show-option -cvi-debugging=standard -Wuninitialized-runtime -I "c:\program files\national instruments\cvi2013\instr\CAMAC_2000" -I "c:\program files\national instruments\cvi2013\instr\WIENVME_DLL" -I "c:\program files\national instruments\cvi2013\instr\CAENV965" -I c:\home\rokd\l2d2_easyroc\instr\WIENVME_DLL -I "c:\program files\national instruments\cvi2013\toolslib\activex\word" -I "c:\program files\national instruments\cvi2013\toolslib\activex\excel" -I "c:\program files\national instruments\cvi2013\toolslib\custctrl" -I "c:\program files\national instruments\cvi2013\toolslib\custctrl\custsupp" -I "c:\program files\national instruments\cvi2013\toolslib\cvirtsup" -I "c:\program files\national instruments\cvi2013\toolslib\datasock" -I "c:\program files\national instruments\cvi2013\toolslib\daqUtil" -I "c:\program files\national instruments\cvi2013\toolslib\printing" -I "c:\program files\national instruments\cvi2013\toolslib\toolbox" -I "c:\program files\national instruments\cvi2013\toolslib\reportgen" -I "c:\program files\national instruments\cvi2013\toolslib\localui" -I "c:\program files\national instruments\cvi2013\instr" -I "C:\Program Files\National Instruments\Shared\CVI\toolslib\custctrl" -I "C:\Program Files\National Instruments\Shared\CVI\toolslib\custctrl\custsupp" -I "C:\Program Files\National Instruments\Shared\CVI\instr" -I "C:\ProgramData\National Instruments\CVI2013\instr" -I "c:\program files\national instruments\cvi2013\include" -I "C:\Program Files\National Instruments\Shared\CVI\include" -I "C:\ProgramData\National Instruments\CVI2013\include" -I "C:\ProgramData\National Instruments\CVI\include" -I "c:\program files\national instruments\cvi2013\include\ansi" -I "c:\program files\national instruments\cvi2013\include\clang\2.9" -I "C:\Program Files\IVI Foundation\IVI\Include" -I "C:\Program Files\IVI Foundation\VISA\winnt\include" -I "c:\program files\national instruments\cvi2013\sdk\include" -I c:\home\cvi\instr\CAENV965 -I c:\home\cvi\instr\CAMAC_2000 -I c:\home\cvi\instr\WIENVME_DLL -I "c:\Program Files\National Instruments\CVI2013\bin" -I "c:\ProgramData\National Instruments\CVI2013\bin" -I "c:\Program Files\National Instruments\Shared\CVI\Bin"
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/Jamfile
1,7 → 1,8
CCFLAGS = -g ;
HDRS = "c:\\Program Files\\National Instruments\\CVI2013\\instr\\CAMAC_2000"
"c:\\Program Files\\National Instruments\\CVI2013\\instr\\WIENVME_DLL"
"c:\\Program Files\\National Instruments\\CVI2013\\instr\\CAENV965"
HDRS = "c:\\program files\\national instruments\\cvi2013\\instr\\CAMAC_2000"
"c:\\program files\\national instruments\\cvi2013\\instr\\WIENVME_DLL"
"c:\\program files\\national instruments\\cvi2013\\instr\\CAENV965"
"c:\\home\\rokd\\l2d2_easyroc\\instr\\WIENVME_DLL"
"c:\\program files\\national instruments\\cvi2013\\toolslib\\activex\\word"
"c:\\program files\\national instruments\\cvi2013\\toolslib\\activex\\excel"
"c:\\program files\\national instruments\\cvi2013\\toolslib\\custctrl"
34,7 → 35,6
"c:\\ProgramData\\National Instruments\\CVI2013\\bin"
"c:\\Program Files\\National Instruments\\Shared\\CVI\\Bin"
;
include Jamfile_instr ;
LOCATE on "easiroc.c" = "c:\\home\\rokd\\l2d2_easyroc" ;
LOCATE on "easiroc.h" = "c:\\home\\rokd\\l2d2_easyroc" ;
LOCATE on "l2d.c" = "c:\\home\\rokd\\l2d2_easyroc" ;
43,43 → 43,19
LOCATE on "sender.h" = "c:\\home\\rokd\\l2d2_easyroc" ;
LOCATE on "SiTCP.c" = "c:\\home\\rokd\\l2d2_easyroc" ;
LOCATE on "SiTCP.h" = "c:\\home\\rokd\\l2d2_easyroc" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\easiroc.obj" : "c:\\home\\rokd\\l2d2_easyroc\\easiroc.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\easiroc.obj" = 1 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\easiroc.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\easiroc.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\easiroc.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\easiroc.obj.out" ;
PrjObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\easiroc.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.obj" : "c:\\home\\rokd\\l2d2_easyroc\\l2d.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.obj" = 2 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.obj.out" ;
PrjObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\sender.obj" : "c:\\home\\rokd\\l2d2_easyroc\\sender.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\sender.obj" = 3 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\sender.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\sender.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\sender.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\sender.obj.out" ;
PrjObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\sender.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\SiTCP.obj" : "c:\\home\\rokd\\l2d2_easyroc\\SiTCP.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\SiTCP.obj" = 4 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\SiTCP.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\SiTCP.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\SiTCP.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\SiTCP.obj.out" ;
PrjObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\SiTCP.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" : "c:\\home\\cvi\\instr\\CAENV965\\CAENV965.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" = 1 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj.out" ;
PrjObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj" : "c:\\home\\cvi\\instr\\CAMAC_2000\\camac.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj" = 5 ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj" = 2 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj.out" ;
InstrObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" : "c:\\home\\cvi\\instr\\CAENV965\\CAENV965.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" = 6 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj.out" ;
InstrObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\CAENV965.obj" ;
PrjObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\camac.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj" : "c:\\home\\cvi\\instr\\WIENVME_DLL\\wienvme_dll.c" ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj" = 7 ;
FILENUM on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj" = 3 ;
DEFPROTS on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj.cvidefprots" ;
OUTFILE on "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj" = "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj.out" ;
InstrObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj" ;
Object "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\resources.res" : "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\resources.in.rc" ;
MainFromObjects "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.exe" : $(PrjObjects) $(InstrObjects) ;
Depends "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.exe" : "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\link_options.txt" ;
Depends "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.exe" : "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\resources.res" ;
Depends all : "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\l2d.exe" ;
PrjObjects += "c:\\home\\rokd\\l2d2_easyroc\\cvibuild.l2d\\Debug\\wienvme_dll.obj" ;
Depends all : $(PrjObjects) ;
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/SiTCP.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/camac.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/easiroc.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/easiroc.obj.cvidefprots
14,6 → 14,10
Class="Function"
Prototype="int WriteData(unsigned int sock, unsigned int data);"
 
[easiroc_LoadIni]
Class="Function"
Prototype="int easiroc_LoadIni(const char *iniFile);"
 
[PrepareFPGA]
Class="Function"
Prototype="void PrepareFPGA();"
26,6 → 30,10
Class="Function"
Prototype="void PrepareReadSC(int chipNo);"
 
[easiroc_PrintData]
Class="Function"
Prototype="void easiroc_PrintData();"
 
[DebugFPGA]
Class="Function"
Prototype="int DebugFPGA(unsigned int socket);"
64,7 → 72,7
 
[ADCOneCycle_wHeader_ver2]
Class="Function"
Prototype="int ADCOneCycle_wHeader_ver2(unsigned int socket, FILE *file);"
Prototype="int ADCOneCycle_wHeader_ver2(unsigned int socket, FILE *file, int stopping);"
 
[ADCStop]
Class="Function"
78,3 → 86,15
Class="Function"
Prototype="int easiroc_fDAQ(char *file_name, int MaxCycleNum);"
 
[easiroc_singleADCstart]
Class="Function"
Prototype="int easiroc_singleADCstart();"
 
[easiroc_singleADCevent]
Class="Function"
Prototype="int easiroc_singleADCevent(unsigned int *retData);"
 
[easiroc_singleADCstop]
Class="Function"
Prototype="int easiroc_singleADCstop();"
 
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/l2d.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/l2d.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/l2d.obj.cvidefprots
18,6 → 18,22
Class="Function"
Prototype="int WinMain(struct HINSTANCE__ *hInstance, struct HINSTANCE__ *hPrevInstance, char *lpszCmdLine, int nCmdShow);"
 
[V1290_writeOC]
Class="Function"
Prototype="int V1290_writeOC(int *write_buffer);"
 
[V1290_readOC]
Class="Function"
Prototype="int V1290_readOC(int *return_buffer);"
 
[V1290_init]
Class="Function"
Prototype="void V1290_init();"
 
[V1290_readConfig]
Class="Function"
Prototype="void V1290_readConfig();"
 
[max_from]
Class="Function"
Prototype="int max_from(int *array, int ifrom, int ito);"
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/linkersummary.txt
5,7 → 5,9
cvi.lib
analysis.lib
cvistart.lib
camac.obj
kernel32.lib
wienvme_dll.obj
WS2_32.Lib
user32.lib
EXE Symbol Module
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/moduledependencies.txt
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/sender.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/cvibuild.l2d/Debug/wienvme_dll.obj
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/d2r.cpp
146,27 → 146,15
//histograms
char hname[256], htitle[256];
double adc,tdc;
TH1F *hadc[NCH], *hadc_cut[NCH], *hadc_cut_2[NCH];
TH1F *htdc[NCH], *htdc_cut[NCH], *htdc_cut_2[NCH], *hctdc[NCH];
TH2F *h2d[NCH], *hcor[NCH];
TH2F *hdiffcor[NCH][NCH];
TH2F *hdiffcor_low[NCH][NCH];
TH2F *hdiffcor_hi[NCH][NCH];
TH2F *hadccor;
TH2F *htdccor;
TH2F *hcoradctdc0, *hcoradctdc1, hcoradctdc01, hcoradctdc11;
TH1F *htesttdc1, *htesttdc2;
TTree *ftt;
TH1F *htdcdiff, *htdcdiff_cut, *htdcdiff_cut_2;
TH1F *hadc[NCH], *hadc_cut[NCH];
TH1F *htdc[NCH], *htdc_cut[NCH], *hctdc[NCH];
TH2F *hcor[NCH];
TH1F *htdcdiff, *htdcdiff_cut;
double ref_cut_1_lo = qdcmi;
double ref_cut_1_hi = qdcma;
double ref_cut_2_lo = tdcmi;
double ref_cut_2_hi = tdcma;
//kobayashi
double t_adc0, t_tdc0, t_adc1, t_tdc1, t_ctdc;
//data buffer
char readbuf[READBUFFERLENGTH];
267,69 → 255,7
}
//create histograms
sprintf(hname, "htdcdiff");
htdcdiff = (TH1F*)gROOT->FindObject(hname);
if(htdcdiff) delete htdcdiff;
htdcdiff = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
//~ htdcdiff = new TH1F(hname, hname, 4096, -0.5*TDC_BIN, 4095.5*TDC_BIN);
sprintf(hname, "htdcdiff_cut");
htdcdiff_cut = (TH1F*)gROOT->FindObject(hname);
if(htdcdiff_cut) delete htdcdiff_cut;
//~ htdcdiff_cut = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
htdcdiff_cut = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
//kobayashi
//~ htdcdiff_cut = new TH1F(hname, hname, 4096, -0.5*TDC_BIN, 4095.5*TDC_BIN);
sprintf(hname, "htdcdiff_cut_2");
htdcdiff_cut_2 = (TH1F*)gROOT->FindObject(hname);
if(htdcdiff_cut_2) delete htdcdiff_cut_2;
htdcdiff_cut_2 = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
//~ htdcdiff_cut_2 = new TH1F(hname, hname, 4096, -0.5*TDC_BIN, 4095.5*TDC_BIN);
sprintf(hname, "hadccor");
hadccor = (TH2F*)gROOT->FindObject(hname);
if(hadccor) delete hadccor;
//~ hadccor = new TH2F(hname, hname, 256, 0, 4096, 256, 0, 4096);
hadccor = new TH2F(hname, hname, 256, 0, 4096, 256, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
sprintf(hname, "htdccor");
htdccor = (TH2F*)gROOT->FindObject(hname);
if(htdccor) delete hadccor;
//~ htdccor = new TH2F(hname, hname, 512, 0, 1024*TDC_BIN, 512, 0, 1024*TDC_BIN);
htdccor = new TH2F(hname, hname, 512, 1024*TDC_BIN, 2048*TDC_BIN, 512, 1024*TDC_BIN, 2048*TDC_BIN);
//~ htdccor = new TH2F(hname, hname, 512, 0, 2048*TDC_BIN, 512, 0, 2048*TDC_BIN);
//~ htdccor = new TH2F(hname, hname, 11*20+1, 15.985, 27.035, 3*40+1, 15.990,19.015);
//~ htdccor = new TH2F(hname, hname, 512, 0, 2047.5*TDC_BIN, 3*40+1, 15.990,19.015);
//kobayashi
sprintf(hname, "hcoradctdc0");
hcoradctdc0 = (TH2F*)gROOT->FindObject(hname);
hcoradctdc0 = new TH2F(hname,hname,2000,0,2000,800,-10,10);
sprintf(hname, "hcoradctdc1");
hcoradctdc1 = (TH2F*)gROOT->FindObject(hname);
hcoradctdc1 = new TH2F(hname,hname,2000,0,2000,800,-10,10);
ftt = (TTree*)gROOT->FindObject("ftt");
if(ftt) delete ftt;
ftt = new TTree("ftt","ftt");
ftt->Branch("t_adc0",&t_adc0,"t_adc0/D");
ftt->Branch("t_adc1",&t_adc1,"t_adc1/D");
ftt->Branch("t_tdc0",&t_tdc0,"t_tdc0/D");
ftt->Branch("t_tdc1",&t_tdc1,"t_tdc1/D");
ftt->Branch("t_ctdc",&t_ctdc,"t_ctdc/D");
#ifdef testpulse
sprintf(hname, "htesttdc1");
htesttdc1 = (TH1F*)gROOT->FindObject(hname);
if(htesttdc1) delete htesttdc1;
htesttdc1 = new TH1F(hname, hname, 65536, -0.5*TDC_BIN, 65535.5*TDC_BIN);
sprintf(hname, "htesttdc2");
htesttdc2 = (TH1F*)gROOT->FindObject(hname);
if(htesttdc2) delete htesttdc2;
htesttdc2 = new TH1F(hname, hname, 65536, -0.5*TDC_BIN, 65535.5*TDC_BIN);
#endif
for(int i=0; i<ANALYSE_CH; i++) {
for(int i=0; i<ANALYSE_CH; i++) {
sprintf(hname, "hadc%d", i);
hadc[i] = (TH1F*)gROOT->FindObject(hname);
if(hadc[i]) delete hadc[i];
340,18 → 266,9
if(hadc_cut[i]) delete hadc_cut[i];
hadc_cut[i] = new TH1F(hname, hname, 4096, -0.5, 4095.5);
sprintf(hname, "hadc_cut_2%d", i);
hadc_cut_2[i] = (TH1F*)gROOT->FindObject(hname);
if(hadc_cut_2[i]) delete hadc_cut_2[i];
hadc_cut_2[i] = new TH1F(hname, hname, 4096, -0.5, 4095.5);
sprintf(hname, "htdc%d", i);
htdc[i] = (TH1F*)gROOT->FindObject(hname);
if(htdc[i]) delete htdc[i];
//~ htdc[i] = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
//~ htdc[i] = new TH1F(hname, hname, 4096, -0.5*TDC_BIN, 4095.5*TDC_BIN); //original
//~ htdc[i] = new TH1F(hname, hname, 65536/2, -0.5*TDC_BIN, 65535.5*TDC_BIN); //koba
//~ htdc[i] = new TH1F(hname, hname, 65536/2, -32768.5*TDC_BIN, 32767.5*TDC_BIN); //koba
htdc[i] = new TH1F(hname, hname, 65536, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
//~ htdc[i] = new TH1F(hname, hname, 65536, -0.5*TDC_BIN, 65535.5*TDC_BIN);
358,62 → 275,35
sprintf(hname, "htdc_cut%d", i);
htdc_cut[i] = (TH1F*)gROOT->FindObject(hname);
if(htdc_cut[i]) delete htdc_cut[i];
//~ htdc_cut[i] = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
//~ htdc_cut[i] = new TH1F(hname, hname, 4096, -0.5*TDC_BIN, 4095.5*TDC_BIN);//original
//~ htdc_cut[i] = new TH1F(hname, hname, 65536/2, -0.5*TDC_BIN, 65535.5*TDC_BIN); //koba
htdc_cut[i] = new TH1F(hname, hname, 65536/2, -32768.5*TDC_BIN, 32767.5*TDC_BIN); //koba
//~ htdc_cut[i] = new TH1F(hname, hname, 65536, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
htdc_cut[i] = new TH1F(hname, hname, 65536, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
//~ htdc_cut[i] = new TH1F(hname, hname, 65536, -0.5*TDC_BIN, 65535.5*TDC_BIN);
sprintf(hname, "htdc_cut_2%d", i);
htdc_cut_2[i] = (TH1F*)gROOT->FindObject(hname);
if(htdc_cut_2[i]) delete htdc_cut_2[i];
//~ htdc_cut_2[i] = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
//~ htdc_cut_2[i] = new TH1F(hname, hname, 4096, -0.5*TDC_BIN, 4095.5*TDC_BIN);//original
htdc_cut_2[i] = new TH1F(hname, hname, 65536, -0.5*TDC_BIN, 65535.5*TDC_BIN); //koba
sprintf(hname, "hctdc%d", i);
hctdc[i] = (TH1F*)gROOT->FindObject(hname);
if(hctdc[i]) delete hctdc[i];
//~ hctdc[i] = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
//~ hctdc[i] = new TH1F(hname, hname, 65536/2, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
hctdc[i] = new TH1F(hname, hname, 65536, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
sprintf(hname, "h2d%d", i);
h2d[i] = (TH2F*)gROOT->FindObject(hname);
if(h2d[i]) delete h2d[i];
h2d[i] = new TH2F(hname, hname, run.nx, (run.x0-0.5*run.dx)*MIKRO_BIN, (run.x0+(run.nx-0.5)*run.dx)*MIKRO_BIN,
run.ny, (run.y0-0.5*run.dy)*MIKRO_BIN, (run.y0+(run.ny-0.5)*run.dy)*MIKRO_BIN);
//~ hctdc[i] = new TH1F(hname, hname, 65536, -0.5*TDC_BIN, 65535.5*TDC_BIN);
sprintf(hname, "hcor%d", i);
hcor[i] = (TH2F*)gROOT->FindObject(hname);
if(hcor[i]) delete hcor[i];
//~ hcor[i] = new TH2F(hname, hname, 256, 0-0.5, 1024-0.5, 200, 10-(TDC_BIN/2), 20-(TDC_BIN/2));
//~ hcor[i] = new TH2F(hname, hname, 512, 0-0.5, 1024-0.5, 4096, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
//~ hcor[i] = new TH2F(hname, hname, 256, 0-0.5, 512-0.5, 160, -2-(TDC_BIN/2), 2-(TDC_BIN/2));
hcor[i] = new TH2F(hname, hname, 512, 0-0.5, 1024-0.5, 160, -1.5-(TDC_BIN/2), 2.5-(TDC_BIN/2));
for(int j=0; j<ANALYSE_CH; j++) {
sprintf(hname, "hdiffcor_%d_%d",i,j);
sprintf(htitle, "ch.%d - ch.%d",i,j);
hdiffcor[i][j] = (TH2F*)gROOT->FindObject(hname);
if(hdiffcor[i][j]) delete hdiffcor[i][j];
hdiffcor[i][j] = new TH2F(hname, htitle, 256, 0-0.5, 1024-0.5, 128, -6.4-(TDC_BIN/2), 6.4-(TDC_BIN/2));
sprintf(hname, "hdiffcor_low_%d_%d",i,j);
sprintf(htitle, "ch.%d - ch.%d",i,j);
hdiffcor_low[i][j] = (TH2F*)gROOT->FindObject(hname);
if(hdiffcor_low[i][j]) delete hdiffcor_low[i][j];
hdiffcor_low[i][j] = new TH2F(hname, htitle, 256, 0-0.5, 512-0.5, 128, -6.4-(TDC_BIN/2), 6.4-(TDC_BIN/2));
sprintf(hname, "hdiffcor_hi_%d_%d",i,j);
sprintf(htitle, "ch.%d - ch.%d",i,j);
hdiffcor_hi[i][j] = (TH2F*)gROOT->FindObject(hname);
if(hdiffcor_hi[i][j]) delete hdiffcor_hi[i][j];
hdiffcor_hi[i][j] = new TH2F(hname, htitle, 256, 0-0.5, 2048-0.5, 128, -6.4-(TDC_BIN/2), 6.4-(TDC_BIN/2));
}
//~ hcor[i] = new TH2F(hname, hname, 512, 0-0.5, 1024-0.5, 160, -1.5-(TDC_BIN/2), 2.5-(TDC_BIN/2));
hcor[i] = new TH2F(hname, hname, 512, 0-0.5, 4096-0.5, (100/TDC_BIN)/8, -50-(TDC_BIN/2), 50-(TDC_BIN/2));
//~ hcor[i] = new TH2F(hname, hname, 512, 0-0.5, 4096-0.5, 256, -32768.5*TDC_BIN, 32767.5*TDC_BIN);
//~ hcor[i] = new TH2F(hname, hname, 512, 0-0.5, 4096-0.5, 256, -0.5*TDC_BIN, 65535.5*TDC_BIN);
}
sprintf(hname, "htdcdiff");
htdcdiff = (TH1F*)gROOT->FindObject(hname);
if(htdcdiff) delete htdcdiff;
htdcdiff = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
sprintf(hname, "htdcdiff_cut");
htdcdiff_cut = (TH1F*)gROOT->FindObject(hname);
if(htdcdiff_cut) delete htdcdiff_cut;
htdcdiff_cut = new TH1F(hname, hname, 4096, -2048.5*TDC_BIN, 2047.5*TDC_BIN);
break;
case POSREC_ID:
467,23 → 357,20
for(int i=0; i<ANALYSE_CH; i++) {
tdc=((double)evtrec->data[i])*TDC_BIN + tdcoffset[i];
//~ tdc=((double)evtrec->data[i])*TDC_BIN;
adc=(double)evtrec->data[i+NCH];
//~ if(i==15) printf("aaaaaaaaaaa15 norma %f\n",tdc);
tdca[i]=tdc;
adca[i]=adc;
//~ if(ceve < 100) {
//~ printf("[%3d] tdc[%2d] = %lf | adc[%2d] = %lf\n", ceve, i, tdc, i, adc);
//~ }
}
for(int i=0; i<ANALYSE_CH; i++) {
if(0 < adca[i]) hadc[i]->Fill(adca[i]);
//~ if(0 < adca[i])
hadc[i]->Fill(adca[i]);
//~ if( (qdcmi < adca[i]) && (adca[i] < qdcma) )
if(0 < tdca[i]) htdc[i]->Fill(tdca[i]-tdca[TRIGGER_CH]);
//~ if(0 < tdca[i]) htdc[i]->Fill(tdca[i]);
hcor[i]->Fill(adca[i],tdca[i]-tdca[TRIGGER_CH]);
//~ if(0 < tdca[i]) htdc[i]->Fill(tdca[i]-tdca[TRIGGER_CH]);
//~ if(0 < tdca[i])
htdc[i]->Fill(tdca[i]-tdca[TRIGGER_CH]);
//~ hcor[i]->Fill(adca[i],tdca[i]);
hcor[i]->Fill(adca[i],tdca[i]-tdca[TRIGGER_CH]);
if(adca[i] > corpar[i][2]) {
ctdca[i] = tdca[i]-tdca[TRIGGER_CH] - (corpar[i][0] + corpar[i][1]/TMath::Sqrt(adca[i] - corpar[i][2]));
491,41 → 378,14
ctdca[i] = -999.9*(i+1);
}
//~ if(tdc_noise_cut < tdca[i])
double adc_max_cut = 1000;
if(adca[i] < adc_max_cut)
//~ double adc_max_cut = 1000;
//~ if(adca[i] < adc_max_cut)
hctdc[i]->Fill( ctdca[i] );
//~ if(dbg && (i<4) && (1 < tdca[0] && (1 < tdca[1]))) printf("tdca[%d] = %lf | tdca[TRG] = %lf | ctdca[i] = %lf | adca[i] = %lf\n", i, tdca[i],tdca[TRIGGER_CH],ctdca[i],adca[i]);
if(dbg && (i<4) ) printf("[%4d] tdca[%d] = %lf | tdca[TRG] = %lf | ctdca[i] = %lf | adca[i] = %lf\n", ceve, i, tdca[i],tdca[TRIGGER_CH],ctdca[i],adca[i]);
 
if( (qdcmi < adca[i]) && (adca[i] < qdcma) && (tdcmi < tdca[i]) && (tdca[i] < tdcma)) {
h2d[i]->Fill(pos.xset*MIKRO_BIN, pos.yset*MIKRO_BIN);
}
}
//~ printf("aaaaaaaaaaa15 %f\n",((double)evtrec->data[15])); printf("aaaaaaaaaaa15 %f\n",((double)evtrec->data[15])*TDC_BIN);
//~ printf("aaaaaaaaaaa30 %d\n",evtrec->data[30]);
//~ printf("aaaaaaaaaaa31 %d\n",evtrec->data[31]);
//~ printf("aaaaaaaaaaa15 %f\n",tdca[15]);
//~ printf("aaaaaaaaaaa30 %d\n",tdca[30]);
//~ printf("aaaaaaaaaaa31 %d\n",tdca[31]);
//~
//kobayashi
ctdcdiff = ctdca[MPPC_2_CH] - ctdca[MPPC_1_CH] +deltaT_ctdcdiff;
tdcdiff = tdca[MPPC_2_CH] - tdca[MPPC_1_CH];
t_ctdc = ctdcdiff;
t_tdc0=tdca[0];
t_tdc1=tdca[1];
t_adc0=adca[15];
t_adc1=adca[1];
hcoradctdc0->Fill(adca[0],ctdcdiff);
hcoradctdc1->Fill(adca[1],ctdcdiff);
ftt->Fill();
#ifdef testpulse
htesttdc1->Fill(tdca[16]-tdca[14]);
htesttdc2->Fill(tdca[14]-tdca[15]);
#endif
//cut za timing:
#define CUT_1_CONDITION ( (qdcmi < adca[MPPC_1_CH]) && (adca[MPPC_1_CH] < qdcma) && (tdcmi < adca[MPPC_2_CH]) && (adca[MPPC_2_CH] < tdcma) )
557,9 → 417,6
htdcdiff_cut->Fill(ctdcdiff);
//~ htdcdiff_cut->Fill(tdcdiff);
}
if( CUT_2_CONDITION ) {
htdcdiff_cut_2->Fill(ctdcdiff);
}
}
for(int i=0; i<ANALYSE_CH; i++) {
574,37 → 431,9
if( (qdcmi < adca[i]) && (adca[i] < qdcma) && (adca[i] > corpar[i][2]) )
htdc_cut[i]->Fill(ctdca[i]);
if( (tdcmi < ctdca[i]) && (ctdca[i] < tdcma) )
hadc_cut[i]->Fill(adca[i]);
if( CUT_2_CONDITION ) {
htdc_cut_2[i]->Fill(tdca[i]);
hadc_cut_2[i]->Fill(adca[i]);
hadc_cut_2[i]->Fill(adca[i]);
}
hadc_cut[i]->Fill(adca[i]);
}
//~ hadccor->Fill(adca[REF_CH], adca[MPPC_1_CH]);
hadccor->Fill(adca[REF_CH], tdca[8]-tdca[31]);
htdccor->Fill(tdca[MPPC_1_CH], tdca[MPPC_2_CH]);
// --------------- corelation plots for time-walk correction ---------------
 
if( (tdc_noise_cut<tdca[MPPC_1_CH]) && (tdc_noise_cut<tdca[MPPC_2_CH]) && (adc_cor_min<adca[MPPC_2_CH]) ) {
hdiffcor[MPPC_1_CH][MPPC_2_CH]->Fill(adca[MPPC_1_CH],tdca[MPPC_1_CH]-ctdca[MPPC_2_CH]);
hdiffcor_low[MPPC_1_CH][MPPC_2_CH]->Fill(adca[MPPC_1_CH],tdca[MPPC_1_CH]-ctdca[MPPC_2_CH]);
hdiffcor_hi[MPPC_1_CH][MPPC_2_CH]->Fill(adca[MPPC_1_CH],tdca[MPPC_1_CH]-ctdca[MPPC_2_CH]);
}
 
if( (tdc_noise_cut<tdca[MPPC_2_CH]) && (tdc_noise_cut<tdca[MPPC_1_CH]) && (adc_cor_min<adca[MPPC_1_CH]) ) {
hdiffcor[MPPC_2_CH][MPPC_1_CH]->Fill(adca[MPPC_2_CH],tdca[MPPC_2_CH]-ctdca[MPPC_1_CH]);
hdiffcor_low[MPPC_2_CH][MPPC_1_CH]->Fill(adca[MPPC_2_CH],tdca[MPPC_2_CH]-ctdca[MPPC_1_CH]);
hdiffcor_hi[MPPC_2_CH][MPPC_1_CH]->Fill(adca[MPPC_2_CH],tdca[MPPC_2_CH]-ctdca[MPPC_1_CH]);
}
// events ------------------------------------------------------------------------------------------
break;
673,11 → 502,6
 
if(dbg) return 1;
if(rootfile) {
#ifdef testpulse
printf("<<< EASIROC Disc : %f [ps]\n", htesttdc1->GetRMS()*1000);
printf("<<< TEST Disc : %f [ps]\n", htesttdc2->GetRMS()*1000);
#endif
ftt->Write();
rootfile->Write();
//cout<<"maximum x value = " << htdcdiff->GetXaxis()->GetBinCenter( htdcdiff->GetMaximumBin()) <<endl;
printf("Saved to %s\n", fnameroot);
/cvi/apps/l2d2_easyroc/d2r.ini
1,33 → 1,33
# pad_center_x pad_center_y tdc_offset
0.0 0.0 -3.50000
1.0 0.0 0.000000
2.0 0.0 0.000000
3.0 0.0 0.000000
4.0 0.0 0.000000
5.0 0.0 0.000000
6.0 0.0 0.000000
7.0 0.0 0.000000
8.0 0.0 0.000000
9.0 0.0 0.000000
10. 0.0 0.000000
11. 0.0 0.000000
12. 0.0 0.000000
13. 0.0 0.000000
14. 0.0 0.000000
15. 0.0 -3.70000
16. 0.0 -3.20000
17. 0.0 0.000000
18. 0.0 0.000000
19. 0.0 0.000000
20. 0.0 0.000000
21. 0.0 0.000000
22. 0.0 0.000000
23. 0.0 0.000000
24. 0.0 0.000000
25. 0.0 0.000000
26. 0.0 0.000000
27. 0.0 0.000000
28. 0.0 0.000000
29. 0.0 0.000000
30. 0.0 0.000000
31. 0.0 0.000000
0.0 0.0 0.0
1.0 0.0 -11.0
2.0 0.0 -0.00
3.0 0.0 -0.00
4.0 0.0 -0.00
5.0 0.0 -0.00
6.0 0.0 -0.00
7.0 0.0 -0.00
8.0 0.0 -0.00
9.0 0.0 -0.00
10. 0.0 -0.00
11. 0.0 -0.00
12. 0.0 -0.00
13. 0.0 -0.00
14. 0.0 -0.00
15. 0.0 -0.00
16. 0.0 -0.00
17. 0.0 -0.00
18. 0.0 -0.00
19. 0.0 -0.00
20. 0.0 -0.00
21. 0.0 -0.00
22. 0.0 -0.00
23. 0.0 -0.00
24. 0.0 -0.00
25. 0.0 -0.00
26. 0.0 -0.00
27. 0.0 -0.00
28. 0.0 -0.00
29. 0.0 -0.00
30. 0.0 -0.00
31. 0.0 -0.00
/cvi/apps/l2d2_easyroc/data/test
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/easiroc.c
5,9 → 5,10
 
unsigned int slowdata[sizeByte_SC];
unsigned int ReadSCdata[sizeByte_RSC];
unsigned int Probedata[sizeByte_PSC];
unsigned int Pindata[sizeByte_PIN];
 
unsigned int iniData[sizeByte_PIN + 2*sizeByte_SC + 2*sizeByte_RSC];
 
unsigned int Probedata[sizeByte_PSC];
 
int ForceStop = 0;
54,7 → 55,7
IP = SiTCP_MASTER_IP;
port = SiTCP_PORT;
SiTCP_ADDR.sin_family = AF_INET;
SiTCP_ADDR.sin_port = htons(port);
SiTCP_ADDR.sin_port = htons((unsigned short)port);
SiTCP_ADDR.sin_addr.s_addr = inet_addr(IP);
struct timeval tv;
151,46 → 152,74
return 0;
}
//------------------------------------------------------------------------------------------------------
int easiroc_LoadIni(const char *iniFile)
{
FILE *fp=fopen(iniFile, "rt");
if(!fp) {
printf("easiroc::LoadIni() cannot open file %s !!!\n", iniFile);
return 0;
}
char lbuff[256];
int counter = 0;
while(1) {
int c = fgetc(fp);
if(feof(fp)) break;
if( '#' == (char)c ) {
fgets(lbuff,256,fp);
//printf("Found Comment line: %s", lbuff);
} else {
ungetc(c, fp);
fscanf(fp, "%u\n", &iniData[counter] );
//printf("Found value [%d] %u\n", counter, iniData[counter]);
counter++;
}
}
fclose(fp);
return 1;
}
//------------------------------------------------------------------------------------------------------
void PrepareFPGA()
{
Pindata[0] = 20;
Pindata[1] = 65776;
Pindata[0] = iniData[0];
Pindata[1] = iniData[1];
}
//------------------------------------------------------------------------------------------------------
void PrepareSC(int chipNo)
{
if(chipNo == 1) {
slowdata[0] = 192;
slowdata[1] = 1720319;
slowdata[2] = 4253040640;
slowdata[3] = 413;
slowdata[4] = 0;
slowdata[5] = 3739423232;
slowdata[6] = 4294967295;
slowdata[7] = 4294967295;
slowdata[8] = 4294967295;
slowdata[9] = 4294967295;
slowdata[10] = 4294967295;
slowdata[11] = 4294967295;
slowdata[12] = 4294967295;
slowdata[13] = 4294967295;
slowdata[14] = 4294967295;
slowdata[ 0] = iniData[sizeByte_PIN + 0];
slowdata[ 1] = iniData[sizeByte_PIN + 1];
slowdata[ 2] = iniData[sizeByte_PIN + 2];
slowdata[ 3] = iniData[sizeByte_PIN + 3];
slowdata[ 4] = iniData[sizeByte_PIN + 4];
slowdata[ 5] = iniData[sizeByte_PIN + 5];
slowdata[ 6] = iniData[sizeByte_PIN + 6];
slowdata[ 7] = iniData[sizeByte_PIN + 7];
slowdata[ 8] = iniData[sizeByte_PIN + 8];
slowdata[ 9] = iniData[sizeByte_PIN + 9];
slowdata[10] = iniData[sizeByte_PIN + 0];
slowdata[11] = iniData[sizeByte_PIN + 11];
slowdata[12] = iniData[sizeByte_PIN + 12];
slowdata[13] = iniData[sizeByte_PIN + 13];
slowdata[14] = iniData[sizeByte_PIN + 14];
} else {
slowdata[0] = 192;
slowdata[1] = 4292874239;
slowdata[2] = 4257218559;
slowdata[3] = 478;
slowdata[4] = 0;
slowdata[5] = 3740340736;
slowdata[6] = 1175693740;
slowdata[7] = 2815957775;
slowdata[8] = 766945147;
slowdata[9] = 1504433946;
slowdata[10] = 2729016485;
slowdata[11] = 3412554245;
slowdata[12] = 2725848728;
slowdata[13] = 2267165112;
slowdata[14] = 4291041547;
slowdata[ 0] = iniData[sizeByte_PIN + 1*sizeByte_SC + 0];
slowdata[ 1] = iniData[sizeByte_PIN + 1*sizeByte_SC + 1];
slowdata[ 2] = iniData[sizeByte_PIN + 1*sizeByte_SC + 2];
slowdata[ 3] = iniData[sizeByte_PIN + 1*sizeByte_SC + 3];
slowdata[ 4] = iniData[sizeByte_PIN + 1*sizeByte_SC + 4];
slowdata[ 5] = iniData[sizeByte_PIN + 1*sizeByte_SC + 5];
slowdata[ 6] = iniData[sizeByte_PIN + 1*sizeByte_SC + 6];
slowdata[ 7] = iniData[sizeByte_PIN + 1*sizeByte_SC + 7];
slowdata[ 8] = iniData[sizeByte_PIN + 1*sizeByte_SC + 8];
slowdata[ 9] = iniData[sizeByte_PIN + 1*sizeByte_SC + 9];
slowdata[10] = iniData[sizeByte_PIN + 1*sizeByte_SC + 10];
slowdata[11] = iniData[sizeByte_PIN + 1*sizeByte_SC + 11];
slowdata[12] = iniData[sizeByte_PIN + 1*sizeByte_SC + 12];
slowdata[13] = iniData[sizeByte_PIN + 1*sizeByte_SC + 13];
slowdata[14] = iniData[sizeByte_PIN + 1*sizeByte_SC + 14];
}
}
//------------------------------------------------------------------------------------------------------
197,14 → 226,40
void PrepareReadSC(int chipNo)
{
if(chipNo == 1) {
ReadSCdata[0] = 0;
ReadSCdata[0] = iniData[sizeByte_PIN + 2*sizeByte_SC + 0];
} else {
ReadSCdata[0] = 1;
ReadSCdata[0] = iniData[sizeByte_PIN + 2*sizeByte_SC + 1];
}
}
//------------------------------------------------------------------------------------------------------
void easiroc_PrintData()
{
printf(">>> Pindata\n");
for(int i=0; i<sizeByte_PIN; i++) printf("%u\n", Pindata[i]);
printf(">>> slowdata (1)\n");
for(int i=0; i<sizeByte_SC; i++) printf("%u\n", slowdata[i]);
printf(">>> slowdata (2)\n");
for(int i=0; i<sizeByte_SC; i++) printf("%u\n", slowdata[i]);
printf(">>> ReadSCdata (1)\n");
for(int i=0; i<sizeByte_RSC; i++) printf("%u\n", ReadSCdata[i]);
printf(">>> ReadSCdata (2)\n");
for(int i=0; i<sizeByte_RSC; i++) printf("%u\n", ReadSCdata[i]);
}
//------------------------------------------------------------------------------------------------------
int DebugFPGA(SOCKET socket)
{
printf(">>> DebugFPGA Pindata:\n");
for(int i=0; i<sizeByte_PIN; i++) printf("%u\n", Pindata[i]);
unsigned int buffer = 0;
buffer += 0 << 16;
buffer += (Pindata[0] & 255) << 8;
232,6 → 287,9
//------------------------------------------------------------------------------------------------------
int TransmitSC(SOCKET socket)
{
printf(">>> TransmitSC slowdata:\n");
for(int i=0; i<sizeByte_SC; i++) printf("%u\n", slowdata[i]);
unsigned int data = 0;
//Set SC mode -----------------------------------------------------------
data = 0;
301,7 → 359,11
//------------------------------------------------------------------------------------------------------
int TransmitReadSC(SOCKET socket)
{
//SCA read ---------------------------------------------------------------
printf(">>> TransmitReadSC ReadSCdata:\n");
for(int i=0; i<sizeByte_RSC; i++) printf("%u\n", ReadSCdata[i]);
 
//SCA read ---------------------------------------------------------------
unsigned int data = 0;
 
for(int i = 0; i<4; ++i){
347,35 → 409,35
}
 
switch(CurrentProbeType){
case '1':
case 1:
CurrentProbe = pa_hg;
break;
 
case '2':
case 2:
CurrentProbe = pa_lg;
break;
 
case '3':
case 3:
CurrentProbe = ssh_hg;
break;
 
case '4':
case 4:
CurrentProbe = ssh_lg;
break;
 
case '5':
case 5:
CurrentProbe = fs;
break;
 
case '6':
case 6:
 
break;
 
case '7':
case 7:
 
break;
 
case '8':
case 8:
flag_rst = 1;
CurrentCh = 0;
ProbeBuffer = 0;
385,6 → 447,8
default:
break;
};
//printf("CurrentProbeType = %d | CurrentProbe = %d\n", CurrentProbeType, CurrentProbe);
 
if(flag_rst) {
return 0;
397,10 → 461,12
unsigned int buffer_16 = ProbeBuffer*ProbeBuffer;
unsigned int buffer_0 = (ProbeBuffer >> 16)*(ProbeBuffer >> 16);
if(CurrentProbe == ssh_hg || CurrentProbe == pa_hg) {
//printf("CurrentProbe == ssh_hg || CurrentProbe == pa_hg\n");
buffer_16 = buffer_16 << 1;
buffer_0 = buffer_0 << 1;
}
if(CurrentProbe == fs) {
//printf("CurrentProbe == fs\n");
Probedata[fs_all] = ProbeBuffer;
} else if(CurrentProbe == ssh_hg || CurrentProbe == ssh_lg) {
if(CurrentCh > 15) {
562,7 → 628,7
return 0;
}
//------------------------------------------------------------------------------------------------------
int ADCOneCycle_wHeader_ver2(SOCKET socket, FILE* file)
int ADCOneCycle_wHeader_ver2(SOCKET socket, FILE* file, int stopping)
{
static const int NofHeader = 3;
 
578,10 → 644,8
int ret = 0;
ret = recv(sock, (char*)Header, sizeHeader, 0);
if(ret <= 0 && EndADC == 1) {
if(EndADC != 0) printf("Fatal ADC ERROR : recv\n");
return -1;
}
//if(ret <= 0) printf("Fatal ADC ERROR : recv\n");
if(ret <= 0 && EndADC == 1) return -1;
// sleep necessary! ERRORS happen if trigger rate lower than ~ sleep frequency!
usleep(200);
598,9 → 662,10
unsigned int OneData[NofWord];
recv(socket, (char*)OneData, sizeData, 0);
 
// for(int i = 0; i<NofWord; ++i){ std::cout << std::hex << OneData[i] << std::endl; }
 
if(!stopping) {
for(int i = 0; i<NofWord; ++i) printf("[%d] 0x%x ", i, OneData[i]);
printf("\n");
}
memcpy(ptr_DataBuf, Header, sizeHeader);
ptr_DataBuf += NofHeader;
 
611,7 → 676,7
++TotalRecvEvent;
}
 
if(EndADC != 1){
if(EndADC != 1 && file!=NULL){
for(unsigned int i = 0; i<TotalRecvByte/sizeof(int); ++i) {
unsigned int buffer = DataBuffer[i];
fwrite((char*)&buffer, sizeof(int), 1, file);
659,7 → 724,7
while(EventNum < MaxCycleNum){
//Sleep(10);
ADCOneCycle_wHeader_ver2(socket, file);
ADCOneCycle_wHeader_ver2(socket, file, 0);
++EventNum;
if(0 == EventNum%1000){
printf("Event # %d\n", EventNum);
670,7 → 735,7
 
EndADC = 1;
int abort = 0;
while(0 == ADCOneCycle_wHeader_ver2(socket, file)) {
while(0 == ADCOneCycle_wHeader_ver2(socket, file, 1)) {
Sleep(1);
if(abort == 50) {
ADCStop(socket);
699,7 → 764,84
if(ContinuousADC_ver2(sock, file_name, MaxCycleNum) != 0) return -1;
return 0;
}
}
//------------------------------------------------------------------------------------------------------
int easiroc_singleADCstart() {
unsigned int signal = 0;
 
signal += 32 << 24;
signal += 100 << 16;
send(sock, (char*)&signal, sizeof(int), 0);
Sleep(100);
printf("\nStart ADC\n");
return 0;
}
//------------------------------------------------------------------------------------------------------
int easiroc_singleADCevent(unsigned int *retData) {
static const int NofHeader = 3;
 
unsigned int DataBuffer[1000];
memset(DataBuffer, 0, sizeof(DataBuffer));
 
unsigned int sizeHeader = NofHeader*sizeof(int);
 
unsigned int Header[] = {1, 1, 1};
int ret = 0;
ret = recv(sock, (char*)Header, sizeHeader, 0);
//if(ret <= 0) printf("Fatal ADC ERROR : recv\n");
if(ret <= 0 && EndADC == 1) return -1;
//usleep(200);
//Sleep(1);
 
//printf("Header1 (0xFFFFEA0C) : 0x%x | Header2 (0x00000100) : 0x%x\n", Header[0], Header[1]);
if(Header[0] != 0xFFFFEA0C) {
printf("Fatal ADC ERROR : HEADER\n");
printf("Header1 : 0x%x | Header2 : 0x%x | Header3 : 0x%x\n", Header[0], Header[1], Header[2]);
return -2;
} else {
unsigned int sizeData = (sizeof(int)*Header[1] & 0xffff);
unsigned int NofWord = (Header[1] & 0xffff);
unsigned int OneData[NofWord];
recv(sock, (char*)OneData, sizeData, 0);
 
//for(int i = 0; i<NofWord; ++i) printf("[%d] 0x%x ", i, OneData[i]);
//printf("\n");
if(NofWord < EASIROC_MAX_READ_N_WORDS) memcpy(retData, OneData, sizeData);
return NofWord;
}
}
//------------------------------------------------------------------------------------------------------
int easiroc_singleADCstop() {
ADCStop(sock);
 
EndADC = 1;
int abort = 0;
while(0 == ADCOneCycle_wHeader_ver2(sock, NULL, 1)) {
Sleep(1);
if(abort == 50) {
ADCStop(sock);
abort = 0;
}
//printf("dummy data\n");
printf(".");
++abort;
}
 
EndADC = 0;
ForceStop = 0;
printf("\nEnd ADC\n");
return 0;
}
//------------------------------------------------------------------------------------------------------
 
 
 
/cvi/apps/l2d2_easyroc/easiroc.h
13,7 → 13,9
 
#define WRITEDATA_DELAY 40
 
#define EASIROC_MAX_READ_N_WORDS 100
 
 
//------------------------------------------------------------------------------------------------------
 
int easiroc_Init(const char* SiTCP_MASTER_IP, unsigned int daq_mode) ;
21,6 → 23,8
 
int WriteData(SOCKET sock, unsigned int data);
 
int easiroc_LoadIni(const char *iniFile);
 
void PrepareFPGA();
int DebugFPGA(SOCKET socket);
 
31,11 → 35,17
int TransmitReadSC(SOCKET socket);
 
int PreparePSC(int CurrentCh, int CurrentProbeType);
void easiroc_PrintData();
 
int ADCOneCycle_wHeader_ver2(SOCKET socket, FILE* file);
int ADCOneCycle_wHeader_ver2(SOCKET socket, FILE* file, int stopping);
void ADCStop(SOCKET socket);
int ContinuousADC_ver2(SOCKET socket, char *file_name, int MaxCycleNum);
 
int easiroc_singleADCstart();
int easiroc_singleADCevent(unsigned int *retData);
int easiroc_singleADCstop();
 
int easiroc_fTransmitSC();
int easiroc_fTransmitReadSC();
int easiroc_fAsicInitialize();
/cvi/apps/l2d2_easyroc/l2d.c
1,4 → 1,4
//#define USE_DAQ
#define USE_DAQ
//#define USE_MIKRO
#define USE_EASIROC
#define USE_UDPCONTROL
8,6 → 8,11
 
#define erIpAddr "192.168.10.16"
#define erDAQmode 3
 
#define ID_ADC_HG 0x81
#define ID_ADC_LG 0x60
#define ID_TDC 0xCC
unsigned int esrcdata[EASIROC_MAX_READ_N_WORDS];
#endif
 
#ifdef USE_UDPCONTROL
47,6 → 52,7
// Options->CompilerDefines (dodaj /DSISVME ali /DWIENVME)
#ifdef USE_DAQ
# define USE_CAMAC
int cres;
# include "camac.h"
# ifdef SISVME
# include "sisWIENVME_VME_dll.h"
70,7 → 76,7
#include "l2d_ui.h"
 
#ifdef USE_DAQ
# define VADC_ADDR1 0x55550000
//# define VADC_ADDR1 0x55550000
# define VADC1 1
//# define VADC_ADDR2 0x550000
# define VADC2 2
91,9 → 97,11
 
#ifdef USE_CAEN_TDC
// CAEN V1290 TDC
#define TDC_CH_SHIFT
int V1290_writeOC(int *write_buffer);
int V1290_readOC(int *write_buffer);
void V1290_init();
void V1290_readConfig();
#endif
// Pomozne funkcije
int max_from(int* array, int ifrom, int ito);
171,7 → 179,7
int CVICALLBACK daq_run(void *functionData)
{
int i,j;
int ndat,dtype,ch,rg,adc,cres;
int ndat,dtype,ch,rg,adc;
unsigned long a,b,ec1,ec2;
unsigned long data[100], data2[100];
unsigned long aa[NCH][4];
305,13 → 313,16
#ifdef USE_CAEN_TDC
dum=0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1016, &dum); Delay(0.01);
/* function moved to TDC INIT
//pair(00)/trailing(01)/leading(10)/both(11) edge
dum=0x2200; V1290_writeOC(&dum);
GetCtrlVal (p1h, P1_TDC_EDGE, &dum);
V1290_writeOC(&dum);
*/
#endif
//some init moved to Main
/*
#ifdef USE_CAMAC
BZ(&cres);
CAMAC_cccz(&cres);
341,8 → 352,14
printf("CSSA_R(NTDCJ2,0,26,&cres)=0x%0x\n", cres);
#endif
#endif
*/
#endif
 
#ifdef USE_EASIROC
//easiroc_singleADCstop(); // clear??
easiroc_singleADCstart();
#endif
if (dsave) {
sprintf(dfile,"%s_file%02d.dat",dfile0,fcount);
/*
457,8 → 474,13
wait_loop(IWAIT);
//CSSA_R(NGL,0,10,&cres);
 
 
#ifdef USE_EASIROC
//easiroc_singleADCstop(); // clear??
//easiroc_singleADCstart();
#endif
# ifdef NPIO
dum=0x0;
CSSA_W(NPIO, 0, 16, &dum);
465,6 → 487,8
//printf("PIO VETO OFF\n");
# endif
# endif
 
// Waiting for LAM
582,8 → 606,9
// TDC
#ifdef USE_CAEN_TDC
int dbg_tdc_t = 0;
int dbg_tdc_f = 0;
int dbg_tdc_t = 0; GetCtrlVal(p1h, P1_TDC_DBG_STDOUT, &dbg_tdc_t);
int dbg_tdc_f = 0; GetCtrlVal(p1h, P1_TDC_DBG_FILOUT, &dbg_tdc_f);
FILE *fpout=NULL;
if(dbg_tdc_f) fpout=fopen("TDCout.txt", "at");
626,10 → 651,15
//TDC Channel = 0000 0x<...Channel...>x 20*x
tdcch = tdcmap[(dum32 & 0x3FFFFFF) >> 21];
#ifdef TDC_CH_SHIFT
if( (0<tdcch) && (tdcch<=15) ) tdcch -= 1;
#endif
//TDC Measurement = 0000 0xxx xxx<...TDC...>
unsigned long tdc_ev = dum32 & 0x1FFFFF;
//if(tdcch < 31) printf("tdc_ev[%d] = %d\n", tdcch, tdc_ev);
int tdc_edge = (dum32 & 0x1) >> 26;
648,16 → 678,19
if(dbg_tdc_t) printf(">>> tdcch = %d | tdc_ev = %d | raw = %d\n", tdcch, tdc_ev, dum32);
if(dbg_tdc_f) fprintf(fpout, ">>> tdcch = %d | tdc_ev = %d | raw = %d\n", tdcch, tdc_ev, dum32);
if(l==0)
//if(l==0)
if(tdcchhit[tdcch]==0)
if(tdc_edge==0) {
if(tdc_edge==0)
if(tdcch < NCH_TDC) {
aa[tdcch][0]=tdc_ev;
if(tdcch < MAXCH_TDC) {
dtdc[tdcch][0][tdc_ev]+=1;
}
if(dbg_tdc_t) printf(">>>>>> TDC Measurement saved >>> CH = %d | edge = %d | ev = %d\n", tdcch, tdc_edge, tdc_ev);
if(dbg_tdc_f) fprintf(fpout, ">>>>>> TDC Measurement saved >>> CH = %d | edge = %d | ev = %d\n", tdcch, tdc_edge, tdc_ev);
}
}
tdcchhit[tdcch]=1;
break;
761,6 → 794,48
}
}
# endif
#ifdef USE_EASIROC
ndat = easiroc_singleADCevent(esrcdata);
//printf("ndat = %d\n", ndat);
//for(int iw=0; iw<ndat; iw++) printf("[%d] 0x%x ", iw, esrcdata[iw]);
//printf("\n");
for (i=0; i<ndat; i++) {
dtype = (esrcdata[i] >> 24) & 0xFF;
//int ch, overflow, edge, data;
switch(dtype) {
case ID_ADC_HG:
rg=0;
ch = (esrcdata[i] >> 16) & 0x1F;
//overflow = (esrcdata[i] >> 13) & 0x1;
adc = (esrcdata[i]) & 0xFFF;
//printf("ID_ADC_HG: ch = %d | X = %d | data = %d\n", ch, overflow, data);
aa[ch][rg+2]=adc;
dadc[ch][rg][adc]+=1;
break;
case ID_ADC_LG:
rg=1;
ch = (esrcdata[i] >> 16) & 0x1F;
//overflow = (esrcdata[i] >> 13) & 0x1;
adc = (esrcdata[i]) & 0xFFF;
//printf("ID_ADC_LG: ch = %d | X = %d | data = %d\n", ch, overflow, data);
aa[ch][rg+2]=adc;
dadc[ch][rg][adc]+=1;
break;
case ID_TDC:
//ch = (esrcdata[i] >> 16) & 0x1F;
//edge = (esrcdata[i] >> 15) & 0x1;
//data = (esrcdata[i]) & 0x3FFF;
//printf("ID_TDC: ch = %d | X = %d | data = %d\n", ch, overflow, data);
printf("EASIROC TDC: esrcdata[i] = 0x%X !?!?!?\n", esrcdata[i]);
break;
default:
printf("EASIROC default: esrcdata[i] = 0x%X !!!\n", esrcdata[i]);
break;
}
}
#endif
#else /* generate test data */
if (!daq_on) break;
883,15 → 958,67
SetStdioWindowSize (900, 600);
//SetStdioWindowPosition (20, 800);
SetStdioWindowPosition (20, 1100);
/*
easiroc_LoadIni("EASIROCini\\EASIROC.ini");
PrepareFPGA();
PrepareSC(1);
PrepareReadSC(1);
//easiroc_PrintData();
PrepareSC(2);
PrepareReadSC(2);
//easiroc_PrintData();
*/
 
if ((p1h = LoadPanel (0, "l2d_ui.uir", P1)) < 0) return -1;
DisplayPanel (p1h);
// some Init
#ifdef USE_DAQ
WIENVME_VME_START(NULL);
#endif
#ifdef USE_CAEN_TDC
V1290_init();
#endif
//WIENVME_VME_START(NULL);
WIENVME_VME_START("C:\\home\\cvi\\instr\\WIENVME_DLL\\pcivme_ni.dll");
 
#ifdef USE_CAMAC
BZ(&cres);
CAMAC_cccz(&cres);
CAMAC_cccc(&cres);
CREM_I(&cres);
//CSSA_R(NGL,0,25,&cres);
#ifdef NPIO
//CAEN C 219 Progammable I/O
CSSA_R(NPIO, 0, 9, &dum);//init
//dum=6; //(OUTPUT, POSITIVE, NORMAL, TRANSPARENT)
dum=2; //(OUTPUT, NEGATIVE, NORMAL, TRANSPARENT)
CSSA_W(NPIO, 0, 17, &dum);
Delay(0.01);
#endif
Delay(0.01);
#ifdef NTDCJ1
CSSA_R(NTDCJ1,0,9,&cres);
printf("CSSA_R(NTDCJ1,0,9,&cres)=0x%0x\n", cres);
CSSA_R(NTDCJ1,0,26,&cres);
CSSA_R(NTDCJ1,1,26,&cres);
printf("CSSA_R(NTDCJ1,0,26,&cres)=0x%0x\n", cres);
#endif
#ifdef NTDCJ2
CSSA_R(NTDCJ2,0,9,&cres);
printf("CSSA_R(NTDCJ2,0,9,&cres)=0x%0x\n", cres);
CSSA_R(NTDCJ2,0,26,&cres);
printf("CSSA_R(NTDCJ2,0,26,&cres)=0x%0x\n", cres);
#endif
#endif //USE_CAMAC
#ifdef USE_CAEN_TDC
V1290_init();
#endif
#endif //USE_DAQ
 
 
#ifdef USE_MIKRO
MIKRO_Open (MIKRO_COM);
MIKRO_Init (MIKRO_X,0);
903,8 → 1030,6
#endif
#endif
 
if ((p1h = LoadPanel (0, "l2d_ui.uir", P1)) < 0) return -1;
DisplayPanel (p1h);
SetCtrlAttribute (p1h, P1_PLCH, ATTR_MAX_VALUE, NCH-1);
GetCtrlVal(p1h, P1_ADCHLSAVE, &runrec.xy);
1036,6 → 1161,15
printf("PIO VETO OFF\n");
# endif
break;
case P1_PIO_PULSE:
# ifdef NPIO
dum=0x1;
CSSA_W(NPIO, 0, 16, &dum);
Delay(0.001);
dum=0x0;
CSSA_W(NPIO, 0, 16, &dum);
# endif
break;
case P1_TDCCLEAR:
#ifdef USE_CAEN_TDC
dum16=0x0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1014, &dum16); Delay(0.1);
1051,16 → 1185,13
case P1_TDCINIT:
#ifdef USE_CAEN_TDC
//V1290_init() ;
V1290_init();
V1290_readConfig();
/*
////Maximum number of hits per event
printf("V1290_writeOC(0x3300)\n");
dum=0x3300; V1290_writeOC(&dum); Delay(0.1);
//dum=0x0001; V1290_writeOC(&dum); Delay(0.1);
printf("V1290_writeOC(0x1000)\n");
dum=0x1000; V1290_writeOC(&dum); Delay(0.1);
printf("V1290_writeOC(0x3400)\n");
dum=0x3400; V1290_writeOC(&dum); Delay(0.1);
printf("V1290_writeOC(0x3300)\n"); dum=0x3300; V1290_writeOC(&dum); Delay(0.1);
printf("V1290_writeOC(0x1000)\n"); dum= 8; V1290_writeOC(&dum); Delay(0.1);
printf("V1290_writeOC(0x3400)\n"); dum=0x3400; V1290_writeOC(&dum); Delay(0.1);
dum=0x0;
printf("V1290_readOC()\n");
if(V1290_readOC(&dum) == -1)
1069,13 → 1200,15
Delay(0.1);
printf("TDC Maximum number of hits per event = %d\n", dum);
}
*/
#endif
break;
case P1_TDCTEST:
#ifdef USE_CAEN_TDC
/*
V1290_readConfig();
/*
for (i=0x4000;i<0x4050;i+=4) {
dum=0;
WIENVME_VME_A24D16_R(TDC_ADDR+i, &dum);
1094,24 → 1227,8
dum=0x0200; V1290_writeOC(&dum);
dum=0x0; V1290_readOC(&dum); printf("dum = %04X\n", dum&0xFFFF);
*/
dum=0x4500; V1290_writeOC(&dum);
dum=0x0; V1290_readOC(&dum); printf("Ch Enable 1 = %04X\n", dum&0xFFFF);
dum=0x0; V1290_readOC(&dum); printf("Ch Enable 2 = %04X\n", dum&0xFFFF);
dum=0x1600; V1290_writeOC(&dum);
dum=0x0000; V1290_readOC(&dum); printf("Match window Width = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Window Offset = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Extra Search Window = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Reject Margin = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Trigger Subtraction = %d\n", dum&0xFFFF);
dum=0x3400; V1290_writeOC(&dum);
dum=0x0000; V1290_readOC(&dum); printf("TDC Maximum number of hits per event = %d\n", dum);
/*
// test
1164,9 → 1281,21
break;
#ifdef USE_EASIROC
case P1_ESRC_INIT:
easiroc_LoadIni("EASIROCini\\EASIROC.ini");
easiroc_Init(erIpAddr, erDAQmode);
break;
case P1_ESRC_LOAD_INI:
char iniFileBuff[MAX_PATHNAME_LEN];
if( 0 < FileSelectPopupEx ("", "*.ini", "*.ini;*.*", "EASIROC ini file", VAL_LOAD_BUTTON, 0, 0, iniFileBuff) ) {
printf("Loading ini file %s\n", iniFileBuff);
if( !easiroc_LoadIni(iniFileBuff) ) {
printf("Error loading Ini file %s!!!\n", iniFileBuff);
}
}
break;
case P1_ESRC_F1:
easiroc_fTransmitSC();
break;
1200,6 → 1329,20
printf("\nEASIROC DAQ SUCESS\n");
break;
case P1_ESRC_ADC_START:
easiroc_singleADCstart();
break;
case P1_ESRC_ADC_EVENT:
int esrcADCreturn = 0;
esrcADCreturn = easiroc_singleADCevent(esrcdata);
printf("esrcADCreturn = %d\n", esrcADCreturn);
for(int iw=0; iw<esrcADCreturn; iw++) printf("[%d] 0x%x ", iw, esrcdata[iw]);
printf("\n");
break;
case P1_ESRC_ADC_STOP:
easiroc_singleADCstop();
break;
case P1_ESRC_CLOSE:
easiroc_Close();
break;
1309,31 → 1452,42
{
int dum;
// intialization
printf("V1290_init().");
dum=0x0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1014, &dum); Delay(0.1);
dum=0x0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1016, &dum); Delay(0.1);
dum=0x0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1018, &dum); Delay(0.1);
dum=0x0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1014, &dum); Delay(0.1); printf(".");
dum=0x0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1016, &dum); Delay(0.1); printf(".");
dum=0x0; WIENVME_VME_A24D16_W(TDC_ADDR+0x1018, &dum); Delay(0.1); printf(".");
//Trigger matching
dum=0x0000; V1290_writeOC(&dum);
// Constraints: tdc_window < tdc_offset <= 4095
/*
// window precedes trigger
// Constraints: tdc_window < |tdc_offset| <= 4095
// Largest window: 4095-margin;
// units: clock cycles = 25 ns
int tdc_margin = 0;
int tdc_offset = 40;
int tdc_offset = 40; //negative, see below!
int tdc_window = tdc_offset - tdc_margin;
// window straddles trigger
// Constraints: tdc_window + tdc_offset <= 40
// units: clock cycles = 25 ns
int tdc_margin = 8;
int tdc_offset = 10; //negative, see below!
int tdc_window = 32;
*/
//set window width
dum=0x1000; V1290_writeOC(&dum);
dum=tdc_window; V1290_writeOC(&dum);
GetCtrlVal(p1h, P1_TDC_WINDOW, &dum); V1290_writeOC(&dum);
//set window offset
dum=0x1100; V1290_writeOC(&dum);
dum=-tdc_offset; V1290_writeOC(&dum);
GetCtrlVal(p1h, P1_TDC_OFFSET, &dum); V1290_writeOC(&dum);
//set extra search margin
dum=0x1200; V1290_writeOC(&dum);
dum=tdc_margin; V1290_writeOC(&dum);
GetCtrlVal(p1h, P1_TDC_MARGIN, &dum); V1290_writeOC(&dum);
 
printf(".");
//enable all channels
dum=0x4200; V1290_writeOC(&dum);
//disable all channels
1351,6 → 1505,8
// dum=0x4000 + i;
// V1290_writeOC(&dum);
// }
//disable channels
//for(int i=0;i<1;i++) {dum=0x4100 + i; V1290_writeOC(&dum);}
 
//enable(0x30xx)/disable(0x31xx) TDC Header and Trailer
dum=0x3100; V1290_writeOC(&dum);
1362,15 → 1518,44
*/
dum=0x3400; V1290_writeOC(&dum);
dum=0x0000; V1290_readOC(&dum);
printf("TDC Maximum number of hits per event = %d\n", dum);
//printf("TDC Maximum number of hits per event = %d\n", dum);
printf(".");
 
//pair(00)/trailing(01)/leading(10)/both(11) edge
dum=0x2200; V1290_writeOC(&dum);
dum=0x1; V1290_writeOC(&dum);
GetCtrlVal(p1h, P1_TDC_EDGE, &dum); V1290_writeOC(&dum);
 
//enable(0x14xx)/disable(0x15xx) substraction of trigger time
dum=0x1400; V1290_writeOC(&dum);
printf(".Done\n");
}
/* ****************** ******************************************* */
void V1290_readConfig()
{
int dum;
dum=0x4500; V1290_writeOC(&dum);
dum=0x0; V1290_readOC(&dum); printf("Ch Enable 1 = %04X\n", dum&0xFFFF);
dum=0x0; V1290_readOC(&dum); printf("Ch Enable 2 = %04X\n", dum&0xFFFF);
 
 
dum=0x1600; V1290_writeOC(&dum);
dum=0x0000; V1290_readOC(&dum); printf("Match window Width = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Window Offset = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Extra Search Window = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Reject Margin = %d\n", dum&0xFFFF);
dum=0x0000; V1290_readOC(&dum); printf("Trigger Subtraction = %d\n", dum&0xFFFF);
 
 
dum=0x3400; V1290_writeOC(&dum);
dum=0x0000; V1290_readOC(&dum); printf("TDC Maximum number of hits per event = %d\n", dum);
 
dum=0x2300; V1290_writeOC(&dum);
dum=0x0000; V1290_readOC(&dum); printf("TDC Edge type = %d\n", dum);
 
dum=0x2600; V1290_writeOC(&dum);
dum=0x0000; V1290_readOC(&dum); printf("TDC resolution= %d\n", dum);
}
 
#endif
/* ****** vrne (INT!) max vrednost iz arraya od elementa do elementa ****** */
int max_from(int* array, int ifrom, int ito)
/cvi/apps/l2d2_easyroc/l2d.cws
12,6 → 12,8
Number of Projects = 1
Active Project = 1
Project 0001 = "l2d.prj"
Project 0001 Folder Include Files Collapsed = True
Project 0001 FolderId 2 Collapsed = True
Drag Bar Left = 174
Window Top = 31
Window Left = 1
46,118 → 48,118
Batch Build Debug = False
 
[File 0001]
Path = "/c/home/cvi/instr/CAMAC_2000/CAMAC.fp"
Path = "/c/home/cvi/instr/CAENV965/CAENV965.fp"
File Type = "Function Panel"
Disk Date = 3368785720
Disk Date = 3565070985
In Projects = "1,"
 
[File 0002]
Path = "/c/home/cvi/instr/CAENV965/CAENV965.fp"
Path = "/c/home/cvi/instr/CAMAC_2000/CAMAC.fp"
File Type = "Function Panel"
Disk Date = 3565067385
Disk Date = 3368789320
In Projects = "1,"
 
[File 0003]
Path = "/c/home/cvi/instr/WIENVME_DLL/wienvme_dll.fp"
File Type = "Function Panel"
Disk Date = 3555477334
Disk Date = 3555480934
In Projects = "1,"
 
[File 0004]
Path = "/c/home/rokd/l2d2_easyroc/easiroc.c"
Path = "/c/home/rokd/l2d2_easyroc/l2d.c"
File Type = "CSource"
Disk Date = 3603793368
Disk Date = 3611896622
In Projects = "1,"
Window Top = 33
Window Left = 10
Window Top = 436
Window Left = 4
Window Z-Order = 1
Source Window State = "1,584,585,585,13,13,13,0,0,183,0,0,0,0,0,48,528,0,588,42,349,523,1,0,"
Source Window State = "1,1507,1510,1507,8,9,8,0,0,183,0,991,0,0,0,53,829,0,1508,62,349,683,1,13,"
 
[File 0005]
Path = "/c/home/rokd/l2d2_easyroc/l2d.c"
Path = "/c/home/rokd/l2d2_easyroc/easiroc.c"
File Type = "CSource"
Disk Date = 3603776262
Disk Date = 3610092018
In Projects = "1,"
Window Top = 436
Window Left = 4
Window Z-Order = 3
Source Window State = "1,8,8,8,20,33,20,0,0,80,0,0,0,0,0,25,39,0,915,4,349,683,1,15,"
Window Top = 33
Window Left = 10
Window Z-Order = 4
Source Window State = "1,450,450,450,34,46,46,0,0,60,0,0,0,0,0,25,0,0,69,12,349,523,1,0,"
 
[File 0006]
Path = "/c/home/rokd/l2d2_easyroc/l2d_ui.uir"
File Type = "User Interface Resource"
Disk Date = 3603787634
Disk Date = 3611311145
In Projects = "1,"
Window Top = 33
Window Left = 10
Window Height = 349
Window Width = 683
Window Z-Order = 5
Window Z-Order = 2
 
[File 0007]
Path = "/c/home/rokd/l2d2_easyroc/l2d_ui.h"
File Type = "Include"
Disk Date = 3603786987
Disk Date = 3611308259
In Projects = "1,"
Window Top = 33
Window Left = -204
Window Z-Order = 9
Window Z-Order = 3
Source Window State = "1,0,0,0,0,0,0,0,0,80,0,0,0,0,0,25,0,0,0,0,349,683,1,0,"
 
[File 0008]
Path = "/c/home/rokd/l2d2_easyroc/SiTCP.c"
File Type = "CSource"
Disk Date = 3594638249
Disk Date = 3594641849
In Projects = "1,"
Window Top = 219
Window Left = -108
Window Z-Order = 4
Window Z-Order = 6
Source Window State = "1,137,137,137,22,29,29,0,0,80,0,0,0,0,0,25,0,0,170,8,349,683,1,0,"
 
[File 0009]
Path = "/c/home/rokd/l2d2_easyroc/SiTCP.h"
File Type = "Include"
Disk Date = 3579505677
Disk Date = 3579509277
In Projects = "1,"
Window Top = 188
Window Left = -124
Window Z-Order = 7
Window Z-Order = 8
Source Window State = "1,0,1,1,0,17,17,0,3,80,0,0,0,0,0,25,0,0,0,0,349,683,1,0,"
 
[File 0010]
Path = "/c/home/rokd/l2d2_easyroc/sender.c"
File Type = "CSource"
Disk Date = 3594633824
Disk Date = 3594637424
In Projects = "1,"
Window Top = 281
Window Left = -76
Window Z-Order = 8
Window Z-Order = 9
Source Window State = "1,171,171,171,2,7,7,0,0,80,0,0,0,0,0,25,0,0,112,182,349,683,1,0,"
 
[File 0011]
Path = "/c/home/rokd/l2d2_easyroc/sender.h"
File Type = "Include"
Disk Date = 3579505274
Disk Date = 3579508874
In Projects = "1,"
Window Top = 250
Window Left = -92
Window Z-Order = 6
Window Z-Order = 7
Source Window State = "1,1,1,1,0,18,18,0,0,80,0,0,0,0,0,25,0,0,5,36,349,683,1,14,"
 
[File 0012]
Path = "/c/home/rokd/l2d2_easyroc/easiroc.h"
File Type = "Include"
Disk Date = 3603793222
Disk Date = 3610089518
In Projects = "1,"
Window Top = 188
Window Left = 90
Window Z-Order = 2
Source Window State = "1,13,14,14,29,29,29,0,0,80,0,44,0,44,0,25,0,0,13,29,349,683,1,0,"
Window Z-Order = 5
Source Window State = "1,10,10,10,8,20,20,0,3,80,0,54,0,54,0,25,0,0,10,8,349,683,1,0,"
 
[File 0013]
Path = "/c/Program Files/Microsoft SDKs/Windows/v7.1A/Lib/WS2_32.Lib"
File Type = "Library"
Disk Date = 3431916852
Disk Date = 3431920452
In Projects = "1,"
 
[Tab Order]
/cvi/apps/l2d2_easyroc/l2d.exe
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/l2d.prj
24,10 → 24,10
FolderEx 1 = "User Interface Files"
Folder 2 = "Include Files"
FolderEx 2 = "Include Files"
Folder 3 = "Instrument Files"
FolderEx 3 = "Instrument Files"
Folder 4 = "Library Files"
FolderEx 4 = "Library Files"
Folder 3 = "Library Files"
FolderEx 3 = "Library Files"
Folder 4 = "Instrument Files"
FolderEx 4 = "Instrument Files"
 
[File 0001]
File Type = "CSource"
142,15 → 142,15
Folder Id = 2
 
[File 0010]
File Type = "Function Panel"
File Type = "Library"
Res Id = 10
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../cvi/instr/CAENV965/CAENV965.fp"
Path = "/c/home/cvi/instr/CAENV965/CAENV965.fp"
Path Rel Path = "../../../Program Files/Microsoft SDKs/Windows/v7.1A/Lib/WS2_32.Lib"
Path = "/c/Program Files/Microsoft SDKs/Windows/v7.1A/Lib/WS2_32.Lib"
Exclude = False
Project Flags = 0
Folder = "Instrument Files"
Folder = "Library Files"
Folder Id = 3
 
[File 0011]
158,12 → 158,12
Res Id = 11
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../cvi/instr/CAMAC_2000/CAMAC.fp"
Path = "/c/home/cvi/instr/CAMAC_2000/CAMAC.fp"
Path Rel Path = "../../cvi/instr/CAENV965/CAENV965.fp"
Path = "/c/home/cvi/instr/CAENV965/CAENV965.fp"
Exclude = False
Project Flags = 0
Folder = "Instrument Files"
Folder Id = 3
Folder Id = 4
 
[File 0012]
File Type = "Function Panel"
170,23 → 170,23
Res Id = 12
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../cvi/instr/WIENVME_DLL/wienvme_dll.fp"
Path = "/c/home/cvi/instr/WIENVME_DLL/wienvme_dll.fp"
Path Rel Path = "../../cvi/instr/CAMAC_2000/CAMAC.fp"
Path = "/c/home/cvi/instr/CAMAC_2000/CAMAC.fp"
Exclude = False
Project Flags = 0
Folder = "Instrument Files"
Folder Id = 3
Folder Id = 4
 
[File 0013]
File Type = "Library"
File Type = "Function Panel"
Res Id = 13
Path Is Rel = True
Path Rel To = "Project"
Path Rel Path = "../../../Program Files/Microsoft SDKs/Windows/v7.1A/Lib/WS2_32.Lib"
Path = "/c/Program Files/Microsoft SDKs/Windows/v7.1A/Lib/WS2_32.Lib"
Path Rel Path = "../../cvi/instr/WIENVME_DLL/wienvme_dll.fp"
Path = "/c/home/cvi/instr/WIENVME_DLL/wienvme_dll.fp"
Exclude = False
Project Flags = 0
Folder = "Library Files"
Folder = "Instrument Files"
Folder Id = 4
 
[Custom Build Configs]
464,7 → 464,7
Enable Assignment In Conditional Warning = False
O Option Compatible With 5.0 = False
Enable C99 Extensions = True
Uninitialized Locals Compile Warning = "Conservative"
Uninitialized Locals Compile Warning = "Aggressive"
Precompile Prefix Header = False
Prefix Header File = ""
 
482,17 → 482,21
Include Path 1 Rel To = "CVI"
Include Path 1 Rel To Override = "CVI"
Include Path 1 Rel Path = "instr/CAMAC_2000"
Include Path 1 = "/c/Program Files/National Instruments/CVI2013/instr/CAMAC_2000"
Include Path 1 = "/c/program files/national instruments/cvi2013/instr/CAMAC_2000"
Include Path 2 Is Rel = True
Include Path 2 Rel To = "CVI"
Include Path 2 Rel To Override = "CVI"
Include Path 2 Rel Path = "instr/WIENVME_DLL"
Include Path 2 = "/c/Program Files/National Instruments/CVI2013/instr/WIENVME_DLL"
Include Path 2 = "/c/program files/national instruments/cvi2013/instr/WIENVME_DLL"
Include Path 3 Is Rel = True
Include Path 3 Rel To = "CVI"
Include Path 3 Rel To Override = "CVI"
Include Path 3 Rel Path = "instr/CAENV965"
Include Path 3 = "/c/Program Files/National Instruments/CVI2013/instr/CAENV965"
Include Path 3 = "/c/program files/national instruments/cvi2013/instr/CAENV965"
Include Path 4 Is Rel = True
Include Path 4 Rel To = "Project"
Include Path 4 Rel Path = "instr/WIENVME_DLL"
Include Path 4 = "/c/home/rokd/l2d2_easyroc/instr/WIENVME_DLL"
 
[Create Executable]
Executable File_Debug Is Rel = True
/cvi/apps/l2d2_easyroc/l2d_ui.h
25,7 → 25,7
#define P1_TDCMIN 10 /* control type: numeric, callback function: (none) */
#define P1_PEDESTAL 11 /* control type: numeric, callback function: (none) */
#define P1_ADCHLSAVE 12 /* control type: binary, callback function: (none) */
#define P1_TDC_EDGE 13 /* control type: binary, callback function: (none) */
#define P1_TDC_EDGE_OLD 13 /* control type: binary, callback function: (none) */
#define P1_ADCHL 14 /* control type: binary, callback function: (none) */
#define P1_ADCLOG 15 /* control type: binary, callback function: (none) */
#define P1_TDCLOG 16 /* control type: binary, callback function: (none) */
51,37 → 51,49
#define P1_HO 36 /* control type: command, callback function: (none) */
#define P1_PLCH 37 /* control type: numeric, callback function: (none) */
#define P1_NEWF 38 /* control type: numeric, callback function: (none) */
#define P1_REFON 39 /* control type: radioButton, callback function: (none) */
#define P1_REFRESH 40 /* control type: command, callback function: (none) */
#define P1_PIO_OFF 41 /* control type: command, callback function: (none) */
#define P1_PIO_ON 42 /* control type: command, callback function: (none) */
#define P1_TDCTEST 43 /* control type: command, callback function: (none) */
#define P1_TDCCLEAR 44 /* control type: command, callback function: (none) */
#define P1_TDCINIT 45 /* control type: command, callback function: (none) */
#define P1_TDCMIKRO 46 /* control type: command, callback function: (none) */
#define P1_ER_HV_STATUS 47 /* control type: command, callback function: (none) */
#define P1_ESRC_DAQ 48 /* control type: command, callback function: (none) */
#define P1_ESRC_F4 49 /* control type: command, callback function: (none) */
#define P1_ESRC_F3 50 /* control type: command, callback function: (none) */
#define P1_ESRC_F2 51 /* control type: command, callback function: (none) */
#define P1_ESRC_F1 52 /* control type: command, callback function: (none) */
#define P1_ER_HV_CONTROL 53 /* control type: command, callback function: (none) */
#define P1_ESRC_CLOSE 54 /* control type: command, callback function: (none) */
#define P1_ER_CLOSE 55 /* control type: command, callback function: (none) */
#define P1_ESRC_INIT 56 /* control type: command, callback function: (none) */
#define P1_ER_INIT 57 /* control type: command, callback function: (none) */
#define P1_TIMER 58 /* control type: timer, callback function: cb_timer */
#define P1_DECORATION 59 /* control type: deco, callback function: (none) */
#define P1_ESRC_PROBE_CH 60 /* control type: numeric, callback function: (none) */
#define P1_ER_HV_CONTROL_IN 61 /* control type: numeric, callback function: (none) */
#define P1_TEXTMSG 62 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_2 63 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_3 64 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_4 65 /* control type: textMsg, callback function: (none) */
#define P1_ESRC_PROBE_TYPE 66 /* control type: ring, callback function: (none) */
#define P1_TEXTMSG_6 67 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_5 68 /* control type: textMsg, callback function: (none) */
#define P1_DECORATION_2 69 /* control type: deco, callback function: (none) */
#define P1_TDC_DBG_FILOUT 39 /* control type: radioButton, callback function: (none) */
#define P1_TDC_DBG_STDOUT 40 /* control type: radioButton, callback function: (none) */
#define P1_REFON 41 /* control type: radioButton, callback function: (none) */
#define P1_REFRESH 42 /* control type: command, callback function: (none) */
#define P1_PIO_PULSE 43 /* control type: command, callback function: (none) */
#define P1_PIO_OFF 44 /* control type: command, callback function: (none) */
#define P1_PIO_ON 45 /* control type: command, callback function: (none) */
#define P1_TDCTEST 46 /* control type: command, callback function: (none) */
#define P1_TDCCLEAR 47 /* control type: command, callback function: (none) */
#define P1_TDCINIT 48 /* control type: command, callback function: (none) */
#define P1_TDCMIKRO 49 /* control type: command, callback function: (none) */
#define P1_ER_HV_STATUS 50 /* control type: command, callback function: (none) */
#define P1_ESRC_ADC_EVENT 51 /* control type: command, callback function: (none) */
#define P1_ESRC_DAQ 52 /* control type: command, callback function: (none) */
#define P1_ESRC_F4 53 /* control type: command, callback function: (none) */
#define P1_ESRC_F3 54 /* control type: command, callback function: (none) */
#define P1_ESRC_F2 55 /* control type: command, callback function: (none) */
#define P1_ESRC_LOAD_INI 56 /* control type: command, callback function: (none) */
#define P1_ESRC_F1 57 /* control type: command, callback function: (none) */
#define P1_ER_HV_CONTROL 58 /* control type: command, callback function: (none) */
#define P1_ESRC_ADC_STOP 59 /* control type: command, callback function: (none) */
#define P1_ESRC_CLOSE 60 /* control type: command, callback function: (none) */
#define P1_ER_CLOSE 61 /* control type: command, callback function: (none) */
#define P1_ESRC_ADC_START 62 /* control type: command, callback function: (none) */
#define P1_ESRC_INIT 63 /* control type: command, callback function: (none) */
#define P1_ER_INIT 64 /* control type: command, callback function: (none) */
#define P1_TIMER 65 /* control type: timer, callback function: cb_timer */
#define P1_DECORATION 66 /* control type: deco, callback function: (none) */
#define P1_ESRC_PROBE_CH 67 /* control type: numeric, callback function: (none) */
#define P1_TDC_MARGIN 68 /* control type: numeric, callback function: (none) */
#define P1_TDC_WINDOW 69 /* control type: numeric, callback function: (none) */
#define P1_TDC_OFFSET 70 /* control type: numeric, callback function: (none) */
#define P1_ER_HV_CONTROL_IN 71 /* control type: numeric, callback function: (none) */
#define P1_TEXTMSG 72 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_2 73 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_3 74 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_4 75 /* control type: textMsg, callback function: (none) */
#define P1_TDC_EDGE 76 /* control type: ring, callback function: (none) */
#define P1_ESRC_PROBE_TYPE 77 /* control type: ring, callback function: (none) */
#define P1_TEXTMSG_6 78 /* control type: textMsg, callback function: (none) */
#define P1_TEXTMSG_5 79 /* control type: textMsg, callback function: (none) */
#define P1_DECORATION_2 80 /* control type: deco, callback function: (none) */
#define P1_TEXTMSG_7 81 /* control type: textMsg, callback function: (none) */
 
 
/* Control Arrays: */
/cvi/apps/l2d2_easyroc/l2d_ui.uir
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/cvi/apps/l2d2_easyroc/plots2.cpp
114,7 → 114,7
 
// =======================================================================================================
 
void plots2(char *fname="480", char *plopt="d", double fitcenter = 1190., double fitw = 70., double comhi_range_hi = 2100., int batch_q=0)
void plots2(char *fname="480", char *plopt="d", int chich=0, double fitcenter = 1190., double fitw = 70., double comhi_range_hi = 2100., int batch_q=0)
{
char sbuff[256];
192,1995 → 192,152
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
c[++cc] = new TCanvas("a", "a", 0, 0, 1200, 700);
c[++cc] = new TCanvas("a", "a", 0, 0, 1600, 900);
c[cc]->Divide(2,2);
int draw_cuts = 1;
int rebin_tdcs = 0;
int ccccdi = 0;
int ich;
 
// -------------------------- qdc 0 ----------------------------------
ich = 0;
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hadc%d", ich);
int draw_cuts = 0;
int chmap[] = {0,1,2,31};
for(int ich = 0;ich<4;ich++) {
(c[cc]->cd(ich+1))->SetLogy(1);
sprintf(hname, "hadc%d", chmap[ich]);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("MPPC 1;Charge [200 fC/bin]");
hp1d->GetXaxis()->SetRangeUser(0,2000);
sprintf(htitle, "ADC%d;ADC;Count", chmap[ich]); hp1d->SetTitle(htitle);
//~ hp1d->GetXaxis()->SetRangeUser(0,2000);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "hadc_cut%d", ich);
sprintf(hname, "hadc_cut%d", chmap[ich]);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
//~ sprintf(hname, "hadc_cut_2%d", ich);
//~ hp1dcut = DrTH1F(dir, hname, "");
//~ hp1dcut->SetLineColor(kGreen);
//~ hp1dcut->DrawClone("SAME");
}
// -------------------------- TDC 0 ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("MPPC 1;Time [ns]");
if(rebin_tdcs) hp1d->Rebin(rebin_tdcs);
//~ hp1d->GetXaxis()->SetRangeUser(0,22);
hp1d->GetXaxis()->SetRangeUser(20,34);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "htdc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
//~ sprintf(hname, "htdc_cut_2%d", ich);
//~ hp1dcut = DrTH1F(dir, hname, "");
//~ if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs);
//~ hp1dcut->SetLineColor(kGreen);
//~ hp1dcut->DrawClone("SAME");
}
// -------------------------- qdc 1 ----------------------------------
ich = 1;
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hadc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("MPPC 2;Charge [200 fC/bin]");
hp1d->GetXaxis()->SetRangeUser(0,2000);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "hadc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
//~ sprintf(hname, "hadc_cut_2%d", ich);
//~ hp1dcut = DrTH1F(dir, hname, "");
//~ hp1dcut->SetLineColor(kGreen);
//~ hp1dcut->DrawClone("SAME");
}
// -------------------------- TDC 1 ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("MPPC 2;Time [ns]");
if(rebin_tdcs) hp1d->Rebin(rebin_tdcs);
//~ hp1d->GetXaxis()->SetRangeUser(0,22);
hp1d->GetXaxis()->SetRangeUser(20,34);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "htdc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
//~ sprintf(hname, "htdc_cut_2%d", ich);
//~ hp1dcut = DrTH1F(dir, hname, "");
//~ if(rebin_tdcs) hp1dcut->Rebin(rebin_tdcs);
//~ hp1dcut->SetLineColor(kGreen);
//~ hp1dcut->DrawClone("SAME");
}
}
sprintf(fullname, "gif/a_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "gif/%s_a.gif", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------
 
if( strchr(plopt, 'q') != NULL ) {
if( strchr(plopt, 't') != NULL ) {
gStyle->SetOptStat(1111);
//~ gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
c[++cc] = new TCanvas("q", "q", 0, 0, 1200, 700);
c[cc]->Divide(3,2);
c[++cc] = new TCanvas("t", "t", 0, 0, 1600, 900);
c[cc]->Divide(2,2);
int draw_cuts = 1;
int rebin_tdcs = 1;
int ccccdi = 0;
int ich;
/*
ich = 2;
// -------------------------- qdc ref ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hadc%d", ich);
int draw_cuts = 0;
int chmap[] = {0,1,2,31};
for(int ich = 0;ich<4;ich++) {
(c[cc]->cd(ich+1))->SetLogy(1);
sprintf(hname, "htdc%d", chmap[ich]);
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->GetXaxis()->SetRangeUser(0,100);
hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->DrawClone();
sprintf(hname, "hadc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "hadc_cut_2%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
 
// -------------------------- TDC ref ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->Rebin(8);
hp1d->GetXaxis()->SetRangeUser(5,105);
hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->DrawClone();
sprintf(hname, "htdc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(8);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "htdc_cut_2%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(8);
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
*/
 
// -------------------------- TDC DIFF ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(0);
sprintf(hname, "htdcdiff");
hp1d = DrTH1F(dir, hname, "");
hp1d->Rebin(rebin_tdcs);
hp1d->GetXaxis()->SetRangeUser(-15,15);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*2);
hp1d->GetYaxis()->SetRangeUser(0.,hp1d->GetMaximum()*1.1);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "htdcdiff_cut");
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "htdcdiff_cut_2");
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
// -------------------------- qdc MPPC ----------------------------------
ich = 0;
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hadc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->GetXaxis()->SetRangeUser(0,1500);
sprintf(htitle, "TDC%d - TRIGGER;Time [ns];Count", chmap[ich]); hp1d->SetTitle(htitle);
hp1d->GetXaxis()->SetRangeUser(-50,50);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "hadc_cut%d", ich);
sprintf(hname, "htdc_cut%d", chmap[ich]);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "hadc_cut_2%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
// -------------------------- TDC MPPC ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->Rebin(rebin_tdcs);
hp1d->GetXaxis()->SetRangeUser(0,20);
hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "htdc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "htdc_cut_2%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
// -------------------------- qdc MPPC ----------------------------------
ich = 1;
ccccdi++;
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hadc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->GetXaxis()->SetRangeUser(0,1500);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "hadc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "hadc_cut_2%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
// -------------------------- TDC MPPC ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->Rebin(rebin_tdcs);
hp1d->GetXaxis()->SetRangeUser(0,20);
hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->DrawClone();
if(draw_cuts) {
sprintf(hname, "htdc_cut%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "htdc_cut_2%d", ich);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
}
sprintf(fullname, "gif/q_%s.gif", fname); c[cc]->SaveAs(fullname);
//~ sprintf(fullname, "%s_j2.eps", fname); c[cc]->SaveAs(fullname);
 
if(batch_q) gSystem->Exit(1);
sprintf(fullname, "gif/%s_t.gif", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------
 
if( strchr(plopt, 'n') != NULL ) {
if( strchr(plopt, 'f') != NULL ) {
gStyle->SetOptStat("e");
//~ gStyle->SetOptFit(1);
gStyle->SetOptStat(1111);
//~ gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
c[++cc] = new TCanvas("d", "d", 0, 0, 900, 600);
//~ c[cc]->Divide(2,2);
c[++cc] = new TCanvas("f", "f", 0, 0, 1600, 900);
c[cc]->Divide(2,2);
int draw_cuts = 0;
int rebin_tdcs = 1;
double drawmin = -17;
double drawmax = +17;
double fitmin = -10;
double fitmax = 10;
double fitcenter = 0.0;
double HalfMax, MinHalfMax, MaxHalfMax, FWHM, FWHMc;
int ccccdi = 0;
int ich = 0;
TF1 *f_fit;
TF1 *fcg = new TF1("fcg", "pol0(0)+gaus(1)"); fcg->SetNpx(300);
fcg->SetParName(0,"Const"); fcg->SetParName(1,"G_Const");
fcg->SetParName(2,"G_Mean" ); fcg->SetParName(3,"G_Sigma" );
TF1 *fcgg = new TF1("fcgg", "pol0(0)+gaus(1)+gaus(4)"); fcgg->SetNpx(300);
fcgg->SetParName(0,"Const");
fcgg->SetParName(1,"G1_Const"); fcgg->SetParName(2,"G1_Mean" ); fcgg->SetParName(3,"G1_Sigma" );
fcgg->SetParName(4,"G2_Const"); fcgg->SetParName(5,"G2_Mean" ); fcgg->SetParName(6,"G2_Sigma" );
(c[cc]->cd(++ccccdi))->SetLogy(0);
sprintf(hname, "htdcdiff");
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->Rebin(rebin_tdcs);
hp1d->SetLineColor(kBlack);
hp1d->GetXaxis()->SetRangeUser(drawmin,drawmax);
hp1d->GetYaxis()->SetRangeUser(0.0,hp1d->GetMaximum()*1.1);
hp1d->SetTitle(";Coincidence Time [ns];Counts");
f_fit = fcgg;
f_fit->SetParameters(hp1d->GetMaximum()*0.25,
hp1d->GetMaximum()*0.7, 0, 0.4,
hp1d->GetMaximum()*0.05, 0, 0.05);
f_fit->SetParLimits(0, 0, hp1d->GetMaximum());
f_fit->SetParLimits(1, 0, hp1d->GetMaximum());
f_fit->SetParLimits(2, fitmin,fitmax);
f_fit->SetParLimits(3, 0.2, 1);
f_fit->SetParLimits(4, 0, hp1d->GetMaximum());
f_fit->SetParLimits(5, fitmin,fitmax);
f_fit->SetParLimits(6, 0.02, 0.3);
//~ f_fit = fcgg;
//~ f_fit->SetParameters(hp1d->GetMaximum()*0.1,
//~ hp1d->GetMaximum()*0.5, 0, 0.05,
//~ hp1d->GetMaximum()*0.4, 0, 0.5);
//~ f_fit = fcg;
//~ f_fit->SetParameters(hp1d->GetMaximum()*0.1,
//~ hp1d->GetMaximum()*0.9, 0, 0.05);
f_fit->SetRange(fitmin,fitmax);
f_fit->SetLineWidth(1);
hp1d->Fit(f_fit, "Q", "", fitmin,fitmax);
HalfMax = f_fit->GetMaximum(fitmin, fitmax)/2.0;
MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter);
MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax);
FWHM = MaxHalfMax - MinHalfMax;
HalfMax = (f_fit->GetMaximum(fitmin, fitmax) + f_fit->GetParameter(0))/2.0;
MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter);
MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax);
FWHMc = MaxHalfMax - MinHalfMax;
//~ printf("FWHM = %lf ns | FWHMc = %lf ns\n", FWHM, FWHMc);
printf("FWHM (peak only) = %.3lf ns\n", FWHMc);
leg[++legi] = new TLegend(0.122768, 0.740418, 0.420759, 0.878049);
leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.03); leg[legi]->SetTextAlign(22);
for(int i=0; i<6; i++) fgg->SetParameter(i, f_fit->GetParameter(i+1));
//~ fgg->SetRange(drawmin, drawmax); fgg->SetNpx(300); fgg->SetLineColor(kBlue); fgg->SetLineWidth(1); fgg->DrawClone("LSAME");
double Icherenkovs = fgg->Integral(drawmin, drawmax);
double Iall = f_fit->Integral(fitmin, fitmax);
double Rsn = Icherenkovs/(Iall-Icherenkovs);
double Ientr = hp1d->GetEntries()*hp1d->GetBinWidth(1);
double Rsne = Icherenkovs/(Ientr-Icherenkovs);
double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1)*hp1d->GetBinWidth(1);
double Rsnh = Icherenkovs/(Ihist-Icherenkovs);
//~ printf("ICherenkov = %lf | IAll = %lf | Ientr = %lf | Ihist = %lf\n", Icherenkovs, Iall, Ientr, Ihist);
//~ printf("TF1 -> S/N = %lf || TH1F(e) -> S/N = %lf || TH1F(i) -> S/N = %lf\n", Rsn, Rsne, Rsnh);
printf("S/N (vs. All) = %lf\n", Rsnh);
if(draw_cuts) {
sprintf(hname, "htdcdiff_cut");
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "htdcdiff_cut_2");
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
//~ #define USE_NOISE_FILE
 
#ifdef USE_NOISE_FILE
//get ROOT file with histograms
char fnameroot[1024];
TFile * rootfile2;
TDirectory *dir2;
sprintf(fname, "run054");
sprintf(fnameroot, "root/%s.root", fname);
rootfile2 = (TFile *) gROOT->FindObject(fname);
if(rootfile2==NULL) rootfile2 = new TFile(fnameroot);
if(rootfile2==NULL) {
printf("Cannot open root file 2 %s!!!\n",fnameroot);
return;
}
dir2 = (TDirectory*) rootfile2;
sprintf(hname, "htdcdiff");
hp1dcut = DrTH1F(dir2, hname, "");
hp1dcut->SetLineColor(kMagenta);
hp1dcut->DrawClone("SAME");
leg[legi]->AddEntry((TH1F*)hp1d->Clone(), "With source (30 min)", "L");
leg[legi]->AddEntry((TH1F*)hp1dcut->Clone(), "W/o source (30 min)", "L");
sprintf(fullname, "Fit FWHM = %.3lf ns", FWHMc);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "L");
leg[legi]->Draw();
#endif
sprintf(fullname, "gif/n_%s.gif", fname); c[cc]->SaveAs(fullname);
 
if(batch_q) gSystem->Exit(1);
}
// -------------------------------------------------------------------
 
if( strchr(plopt, 'f') != NULL ) {
DrSetDrawStyle(0.05);
gStyle->SetOptStat("e");
//~ gStyle->SetOptFit(1);
gStyle->SetPadRightMargin(0.03);
gStyle->SetPadTopMargin(0.05);
gStyle->SetPadBottomMargin(0.12);
gStyle->SetStatFontSize(0.05);
gStyle->SetStatX(0.97);
gStyle->SetStatY(0.95);
c[++cc] = new TCanvas("f", "f", 0, 460, 720, 400);
//~ c[cc]->Divide(2,2);
int draw_cuts = 0;
int rebin_tdcs = 1;
double drawmin = -10;
double drawmax = +10;
//~ double fitmin = inmin;
//~ double fitmax = inmax;
double fitmin = -10;
double fitmax = 10;
double fitcenter = 0.0;
double HalfMax, MinHalfMax, MaxHalfMax, FWHM, FWHMc;
int ccccdi = 0;
int ich = 0;
TF1 *f_fit;
TF1 *f_integrate;
TF1 *fc = new TF1("fc", "pol0(0)");
TF1 *fcg = new TF1("fcg", "pol0(0)+gaus(1)"); fcg->SetNpx(300);
fcg->SetParName(0,"Const"); fcg->SetParName(1,"G_Const");
fcg->SetParName(2,"G_Mean" ); fcg->SetParName(3,"G_Sigma" );
TF1 *fcgg = new TF1("fcgg", "pol0(0)+gaus(1)+gaus(4)"); fcgg->SetNpx(300);
fcgg->SetParName(0,"Const");
fcgg->SetParName(1,"G1_Const"); fcgg->SetParName(2,"G1_Mean" ); fcgg->SetParName(3,"G1_Sigma" );
fcgg->SetParName(4,"G2_Const"); fcgg->SetParName(5,"G2_Mean" ); fcgg->SetParName(6,"G2_Sigma" );
TF1 *fcggg = new TF1("fcggg", "pol0(0)+gaus(1)+gaus(4)+gaus(7)"); fcggg->SetNpx(300);
fcggg->SetParName(0,"Const");
fcggg->SetParName(1,"G1_Const"); fcggg->SetParName(2,"G1_Mean" ); fcggg->SetParName(3,"G1_Sigma" );
fcggg->SetParName(4,"G2_Const"); fcggg->SetParName(5,"G2_Mean" ); fcggg->SetParName(6,"G2_Sigma" );
fcggg->SetParName(7,"G3_Const"); fcggg->SetParName(8,"G3_Mean" ); fcggg->SetParName(9,"G3_Sigma" );
//~ TF1 *f_nocrystal = new TF1("f_nocrystal", "[0]*exp(-0.5*((x-[1])/(sqrt(2)*[2]))**2)+[3]*exp(-0.5*((x-[4])/(sqrt(2)*[5]))**2)+[6]*exp(-1*((x-[7])**2)/(2*(([2])**2+([5])**2)))+[8]*exp(-1*(((x-[9])**2)/(2*(([2])**2+([5])**2))))+[10]");
TF1 *f_nocrystal = new TF1("f_nocrystal", "[0]*([1]**2*TMath::Gaus(x,[2],sqrt(2)*[3],1)+(1-[1])**2*TMath::Gaus(x,[4],sqrt(2)*[5],1)+[1]*(1-[1])*TMath::Gaus(x,[6],sqrt([3]**2+[5]**2),1)+[1]*(1-[1])*TMath::Gaus(x,[7],sqrt([3]**2+[5]**2),1))+[8]");
f_nocrystal->SetParName(0, "const");
f_nocrystal->SetParName(1, "ratio");
f_nocrystal->SetParName(2, "WW_mean");
f_nocrystal->SetParName(3, "Window_sigma");
f_nocrystal->SetParName(4, "MM_mean");
f_nocrystal->SetParName(5, "MCP_sigma");
f_nocrystal->SetParName(6, "WM1_mean");
f_nocrystal->SetParName(7, "WM2_mean");
f_nocrystal->SetParName(8, "Constant");
//~ TF1 *f_crystal = new TF1("f_crystal", "[0]+[1]*([2]**2*(TMath::Gaus(x,[3],sqrt(2)*[4],1))+([5])**2*(TMath::Gaus(x,[6],sqrt(2)*[7],1))+(4*[5]/6)**2*(TMath::Gaus(x,[8],sqrt(2)*[9],1))+[2]*[5]*(TMath::Gaus(x,[10],sqrt([2]**2+[5]**2),1))+[5]*[2]*(TMath::Gaus(x,[11],sqrt([2]**2+[5]**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[12],sqrt([2]**2+(4/6*[5])**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[13],sqrt([2]**2+(4/6*[5])**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[14],sqrt([5]**2+(4/6*[5])**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[15],sqrt([5]**2+(4/6*[5])**2),1)))");
TF1 *f_crystal = new TF1("f_crystal", "[0]+[1]*([2]**2*(TMath::Gaus(x,[3],sqrt(2)*[4],1))+([5])**2*(TMath::Gaus(x,[6],sqrt(2)*[7],1))+(4*[5]/6)**2*(TMath::Gaus(x,[8],sqrt(2)*[9],1))+[2]*[5]*(TMath::Gaus(x,[10],sqrt([4]**2+[7]**2),1))+[5]*[2]*(TMath::Gaus(x,[11],sqrt([4]**2+[7]**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[12],sqrt([4]**2+[9]**2),1))+[2]*(4/6*[5])*(TMath::Gaus(x,[13],sqrt([4]**2+[9]**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[14],sqrt([7]**2+[9]**2),1))+[5]*(4/6*[5])*(TMath::Gaus(x,[15],sqrt([7]**2+[9]**2),1)))");
f_crystal->SetParName(0, "dark");
f_crystal->SetParName(1, "const");
f_crystal->SetParName(2, "Prob_Crystal");
f_crystal->SetParName(3, "CC_mean");
f_crystal->SetParName(4, "Crystal_sigma");
f_crystal->SetParName(5, "Prob_window");
f_crystal->SetParName(6, "WW_mean");
f_crystal->SetParName(7, "WW_sigma");
f_crystal->SetParName(8, "MM_mean");
f_crystal->SetParName(9, "MM_sigma");
f_crystal->SetParName(10, "CW1_mean");
f_crystal->SetParName(11, "CW2_mean");
f_crystal->SetParName(12, "CM1_mean");
f_crystal->SetParName(13, "CM2_mean");
f_crystal->SetParName(14, "WM1_mean");
f_crystal->SetParName(15, "WM2_mean");
int chmap[] = {0,1,2,31};
//~ TF1 *f_crystal1 = new TF1("f_crystal1", "[0]+[1]*([2]**2*TMath::Gaus(x,[3],sqrt(2)*[4],1)+(1.-5./3*[2])**2*TMath::Gaus(x,[5],sqrt(2)*[6],1)+(4.*[2]/6.)**2*TMath::Gaus(x,[7],sqrt(2)*[8],1)+[2]*(1.-(5./3)*[2])*TMath::Gaus(x,[9],sqrt([4]**2+[6]**2),1)+(1.-(5./3)*[2])*[2]*TMath::Gaus(x,[10],sqrt([4]**2+[6]**2),1)+[2]*4./6.*[2]*TMath::Gaus(x,[11],sqrt([4]**2+[8]**2),1)+[2]*4/6.*[2]*TMath::Gaus(x,[12],sqrt([4]**2+[8]**2),1)+4./6*[2]*(1.-5./3*[2])*TMath::Gaus(x,[13],sqrt([6]**2+[8]**2),1)+(1.-5./3*[2])*4./6*[2]*TMath::Gaus(x,[14],sqrt([8]**2+[6]**2),1))");
TF1 *f_crystal1 = new TF1("f_crystal1", "[0]+[1]*([2]**2*TMath::Gaus(x,[3],sqrt(2)*[4],1)+(1.-(1.+[15])*[2])**2*TMath::Gaus(x,[5],sqrt(2)*[6],1)+([15]*[2])**2*TMath::Gaus(x,[7],sqrt(2)*[8],1)+[16]**2*[2]*(1.-(1+[15])*[2])*TMath::Gaus(x,[9],sqrt([4]**2+[6]**2),1)+[16]**2*(1.-(1+[15])*[2])*[2]*TMath::Gaus(x,[10],sqrt([4]**2+[6]**2),1)+[2]*[15]*[2]*TMath::Gaus(x,[11],sqrt([4]**2+[8]**2),1)+[2]*[15]*[2]*TMath::Gaus(x,[12],sqrt([4]**2+[8]**2),1)+[15]*[2]*(1.-(1+[15])*[2])*TMath::Gaus(x,[13],sqrt([6]**2+[8]**2),1)+(1.-(1.+[15])*[2])*[15]*[2]*TMath::Gaus(x,[14],sqrt([8]**2+[6]**2),1))");
f_crystal1->SetParName(0, "dark");
f_crystal1->SetParName(1, "const");
f_crystal1->SetParName(2, "Prob_Window");
f_crystal1->SetParName(3, "WW_mean");
f_crystal1->SetParName(4, "Window_sigma");
f_crystal1->SetParName(5, "CC_mean");
f_crystal1->SetParName(6, "Crystal_sigma");
f_crystal1->SetParName(7, "MM_mean");
f_crystal1->SetParName(8, "MCP_sigma");
f_crystal1->SetParName(9, "CW1_mean");
f_crystal1->SetParName(10, "CW2_mean");
f_crystal1->SetParName(11, "WM1_mean");
f_crystal1->SetParName(12, "WM2_mean");
f_crystal1->SetParName(13, "CM1_mean");
f_crystal1->SetParName(14, "CM2_mean");
f_crystal1->SetParName(15, "ratio_mcp/window");
f_crystal1->SetParName(16, "Sup._CW");
double ratio_r=0;
(c[cc]->cd(++ccccdi))->SetLogy(0);
sprintf(hname, "htdcdiff_cut");
for(int ich = 0;ich<4;ich++) {
(c[cc]->cd(ich+1))->SetLogy(1);
sprintf(hname, "hctdc%d", chmap[ich]);
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->Rebin(rebin_tdcs);
sprintf(htitle, "corTDC%d - TRIGGER;Time [ns];Count", chmap[ich]); hp1d->SetTitle(htitle);
hp1d->GetXaxis()->SetRangeUser(-30,30);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->GetXaxis()->SetRangeUser(drawmin,drawmax);
hp1d->GetYaxis()->SetRangeUser(0.0,hp1d->GetMaximum()*1.1);
sprintf(fullname, ";Coincidence Time [ns];Counts");
hp1d->SetTitle(fullname);
hp1d->DrawClone();
if( strcmp(fitopt, "cgg")==0 ) {
f_fit = fcgg;
f_fit->SetParameters(hp1d->GetMaximum()*0.1,
hp1d->GetMaximum()*0.4, 0, 0.8,
hp1d->GetMaximum()*0.5, 0, 0.05);
f_fit->SetParLimits(0, 0, hp1d->GetMaximum());
f_fit->SetParLimits(1, 0, hp1d->GetMaximum());
f_fit->SetParLimits(2, fitmin,fitmax);
f_fit->SetParLimits(3, 0.05, 1);
f_fit->SetParLimits(4, 0, hp1d->GetMaximum());
f_fit->SetParLimits(5, fitmin,fitmax);
f_fit->SetParLimits(6, 0.01, 1);
} else if(strcmp(fitopt, "cggg")==0) {
f_fit = fcggg;
f_fit->SetParameters(hp1d->GetMaximum()*0.1,
hp1d->GetMaximum()*0.4, 0, 0.4,
hp1d->GetMaximum()*0.4, 0, 0.2,
hp1d->GetMaximum()*0.1, 0, 0.05);
f_fit->SetParLimits(0, 0, hp1d->GetMaximum());
f_fit->SetParLimits(1, 0, hp1d->GetMaximum());
f_fit->SetParLimits(2, fitmin,fitmax);
f_fit->SetParLimits(3, 0.01, 1);
f_fit->SetParLimits(4, 0, hp1d->GetMaximum());
f_fit->SetParLimits(5, fitmin,fitmax);
f_fit->SetParLimits(6, 0.05, 1);
f_fit->SetParLimits(7, 0, hp1d->GetMaximum());
f_fit->SetParLimits(8, fitmin,fitmax);
f_fit->SetParLimits(9, 0.2, 1);
} else if(strcmp(fitopt, "nocrystal")==0)
{ f_fit = f_nocrystal;
//~ f_fit->SetParameters(4000,0.87,0.03,0.03,0.28,0.1,200,200,0.01);
f_fit->SetParameters(200,0.8,0.0,0.03,0.0,0.1,-0.13,0.13,10.16);
f_fit->SetParLimits(0,0,10000);
f_fit->SetParLimits(1,0,1);
f_fit->SetParLimits(2,-0.02,0.02);
f_fit->SetParLimits(3,0.01,0.3);
f_fit->SetParLimits(4,-0.02,0.02);
f_fit->SetParLimits(5,0,0.8);
f_fit->SetParLimits(6,-0.5,0.0);
f_fit->SetParLimits(7,0.0,0.5);
f_fit->SetParLimits(8,0.00,9000.5);
//~ f_fit->FixParameter(6, 100);
//~ f_fit->FixParameter(7, 100);
//~
} else if(strcmp(fitopt, "crystal")==0)
{
f_fit = f_crystal;
//~ f_fit->SetParameters(0.1,300,0.8,0,0.07,0.01,0,0.028,0,0.15,0,0,-0.2,0.2,-0.2,0.2);
f_fit->SetParameter(0, 0.1);
f_fit->SetParameter(1, 300);
f_fit->SetParameter(2, 0.8);
f_fit->SetParameter(3, 0.);
f_fit->SetParameter(4, 0.07);
f_fit->SetParameter(5, 0.01);
f_fit->SetParameter(6, 0.0);
f_fit->SetParameter(7, 0.028);
f_fit->SetParameter(8, 0.0);
f_fit->SetParameter(9, 0.15);
f_fit->SetParameter(10, 0.0);
f_fit->SetParameter(11, 0.0);
f_fit->SetParameter(12, -0.2);
f_fit->SetParameter(13, 0.2);
f_fit->SetParameter(14, -0.2);
f_fit->SetParameter(15, 0.2);
f_fit->SetParameter(15, 0.2);
f_fit->SetParLimits(0, 0, 10);
f_fit->SetParLimits(1, 0, 1000);
f_fit->SetParLimits(2, 0, 1);
f_fit->SetParLimits(3, -0.02, 0.02); f_fit->SetParLimits(4, 0, 0.3);
f_fit->SetParLimits(5, 0, 1); f_fit->SetParLimits(6, -0.02, 0.02);
f_fit->SetParLimits(7, 0, 0.035);
f_fit->SetParLimits(8, -0.02, 0.02);
f_fit->SetParLimits(9, 0, 0.2);
f_fit->SetParLimits(10, -0.02, 0.02);
f_fit->SetParLimits(11, -0.02, 0.02);
f_fit->SetParLimits(12, -0.04, 0);
f_fit->SetParLimits(13, 0, 0.04);
f_fit->SetParLimits(14, -0.04, 0);
f_fit->SetParLimits(15, 0, 0.04);
} else if(strcmp(fitopt, "crystal1")==0)
{
f_fit = f_crystal1;
//~ f_fit->SetParameters(0.1,300,0.8,0,0.07,0.01,0,0.028,0,0.15,0,0,-0.2,0.2,-0.2,0.2);
f_fit->SetParameter(0, 100.1);
f_fit->SetParameter(1, 1);
f_fit->SetParameter(2, 0.2); //prob. window
f_fit->SetParameter(3, 0.0);
f_fit->SetParameter(4, 0.02); // window sigma
f_fit->SetParameter(5, 0.0);
f_fit->SetParameter(6, 120/3.3/1000); //crystal sigma
f_fit->SetParameter(7, 0.0);
f_fit->SetParameter(8, 0.15); // mcp sigma
f_fit->SetParameter(9, -0.1825); //cw
f_fit->SetParameter(10, 0.1825);
f_fit->SetParameter(11, -0.2); //wm
f_fit->SetParameter(12, 0.2);
f_fit->SetParameter(13, -0.3); //cm
f_fit->SetParameter(14, 0.3);
f_fit->SetParameter(15, 1/0.6795 -1.);
f_fit->SetParameter(16, 0.1);
f_fit->SetParameter(1, hp1d->GetMaximum()/(f_fit->Eval(0)-f_fit->GetParameter(0)));
f_fit->SetParLimits(0, 0, 400);
f_fit->SetParLimits(1, 0, 100000);
f_fit->SetParLimits(2, 0, 1.);
f_fit->SetParLimits(3, -0.025, 0.025);
f_fit->SetParLimits(4, 0.02, 0.08);
f_fit->SetParLimits(5, -0.025, 0.025);
f_fit->SetParLimits(6, 0.01, 0.2);
f_fit->SetParLimits(7, -0.025, 0.025);
f_fit->SetParLimits(8, 0, 0.5);
f_fit->SetParLimits(9, -0.6, 0.02);
f_fit->SetParLimits(10, -0.02, 0.6);
f_fit->SetParLimits(11, -0.3, -0.1);
f_fit->SetParLimits(12, 0.1, 0.3);
f_fit->SetParLimits(13, -0.7, -0.1);
f_fit->SetParLimits(14, 0.1, 0.7);
f_fit->SetParLimits(15, 0, 0.999);
f_fit->SetParLimits(16, 0, 1);
f_fit->FixParameter(4,0.02668);
//~ f_fit->FixParameter(6,0.048);
f_fit->FixParameter(8,0.0877);
f_fit->FixParameter(11,-0.19);
f_fit->FixParameter(12,0.19);
//~
ratio_r = 1/0.6795 -1.;
//~ ratio_r = 1/0.8089 -1.;
f_fit->FixParameter(15,ratio_r);
//~ f_fit->FixParameter(16,1);
//~ f_fit->FixParameter(2,0.52);
//~ f_fit->FixParameter(6,170/3.3/1000);
//~ f_fit->FixParameter(3,0);
//~ f_fit->FixParameter(5,0);
//~ f_fit->FixParameter(7,0);
//~ cout<<"hogeeeeeeeeeeee "<<f_fit->GetParameter(1)*((1.-5./3.*(f_fit->GetParameter(2)))*(4./6.*(f_fit->GetParameter(2))))<<endl;
}
//~ f_fit->SetRange(fitmin,fitmax);
f_fit->SetRange(-10,10);
f_fit->SetLineWidth(1); f_fit->SetLineStyle(2);
f_fit->SetNpx(300);
//~ hp1d->Fit(f_fit, "QWW", "", fitmin,fitmax);
//~ hp1d->Fit(f_fit, "ILM+", "", -0.4,0.4);
//~
hp1d->Fit(f_fit, "LM+", "", -.5,.5);
//~ hp1d->Draw();
//~ f_fit->Draw("same"); //f_fit->SetLineColor(6);
 
f_fit->SetLineColor(1);
hp1d->GetXaxis()->SetRangeUser(-1.5,2);
 
gStyle->SetOptFit(1111);
double wmsigma = sqrt(f_fit->GetParameter(3)**2 + f_fit->GetParameter(5)**2);
double cm1sigma = sqrt(f_fit->GetParameter(6)**2 + f_fit->GetParameter(8)**2);
double wm1sigma = sqrt(f_fit->GetParameter(4)**2 + f_fit->GetParameter(8)**2);
double cw1sigma = sqrt(f_fit->GetParameter(6)**2 + f_fit->GetParameter(4)**2);
//kobayashi
TPaveStats* st1 = (TPaveStats*) hp1d->FindObject("stats");
st1->SetX1NDC(0.63); st1->SetX2NDC(0.99);
st1->SetY1NDC(0.24); st1->SetY2NDC(0.99);
double pw = f_fit->GetParameter(2);
double pm = f_fit->GetParameter(15)*f_fit->GetParameter(2);
double pc = 1-pw - pm;
double rate = pw**2 + pm**2 + 2*pw*pm;
double sumrate = pw**2+pm**2+pc**2+2*pw*pm+2*pm*pc+2*pc*pw*f_fit->GetParameter(16)**2;
cout<<"pw = "<<pw<<" pm = "<<pm<<" pc = "<<pc<<endl;
cout<<"rate = "<<rate<<" sumrate = "<<sumrate<<" rate/sumrate = "<<rate/sumrate<<endl;
cout<<" FWHM_sim = "<<f_fit->GetParameter(6)*sqrt(2)*2.35<<endl;
if(strcmp(fitopt, "nocrystal")==0)
{
//~ TF1 *fg_WW = new TF1("fg_WW","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])");
//~ TF1 *fg_MM = new TF1("fg_MM","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])");
//~ TF1 *fg_WM1 = new TF1("fg_WM1","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])");
//~ TF1 *fg_WM2 = new TF1("fg_WM2","[0]*exp(-(x-[1])**2/2/([3]**2))/sqrt(2*3.141592*[2]*[2])");
TF1 *fg_WW = new TF1("fg_WW","[0]*TMath::Gaus(x,[1],[2],1)");fg_WW->SetNpx(300);
TF1 *fg_MM = new TF1("fg_MM","[0]*TMath::Gaus(x,[1],[2],1)");fg_MM->SetNpx(300);
TF1 *fg_WM1 = new TF1("fg_WM1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM1->SetNpx(300);
TF1 *fg_WM2 = new TF1("fg_WM2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM2->SetNpx(300);
fg_WW -> SetParameters(f_fit->GetParameter(1)**2*f_fit->GetParameter(0),f_fit->GetParameter(2),sqrt(2)*f_fit->GetParameter(3));
fg_MM -> SetParameters((1-f_fit->GetParameter(1))**2*f_fit->GetParameter(0),f_fit->GetParameter(4),sqrt(2)*f_fit->GetParameter(5));
fg_WM1 -> SetParameters(f_fit->GetParameter(0)*(1-f_fit->GetParameter(1))*f_fit->GetParameter(1),f_fit->GetParameter(6),wmsigma);
fg_WM2 -> SetParameters(f_fit->GetParameter(0)*(1-f_fit->GetParameter(1))*f_fit->GetParameter(1),f_fit->GetParameter(7),wmsigma);
fg_WW->Draw("sames"); fg_WW->SetLineColor(kYellow+1); fg_WW->SetRange(-10,10);
fg_MM->Draw("sames"); fg_MM->SetLineColor(kMagenta-7); fg_MM->SetRange(-10,10);
fg_WM1->Draw("sames"); fg_WM1->SetLineColor(kRed-4); fg_WM1->SetRange(-10,10);
fg_WM2->Draw("sames"); fg_WM2->SetLineColor(kRed-4); fg_WM2->SetRange(-10,10);
double integ_WW, integ_MM, integ_WM1, integ_WM2;
integ_WW = fg_WW->Integral(-4,4);
}
if(strcmp(fitopt, "crystal1")==0)
{
TF1 *fg_CC = new TF1("fg_CC","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CC->SetNpx(300);
TF1 *fg_WW = new TF1("fg_WW","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WW->SetNpx(300);
TF1 *fg_MM = new TF1("fg_MM","[0]*TMath::Gaus(x,[1],[2],1)"); fg_MM->SetNpx(300);
TF1 *fg_WM1 = new TF1("fg_WM1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM1->SetNpx(300);
TF1 *fg_WM2 = new TF1("fg_WM2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_WM2->SetNpx(300);
TF1 *fg_CW1 = new TF1("fg_CW1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CW1->SetNpx(300);
TF1 *fg_CW2 = new TF1("fg_CW2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CW2->SetNpx(300);
TF1 *fg_CM1 = new TF1("fg_CM1","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CM1->SetNpx(300);
TF1 *fg_CM2 = new TF1("fg_CM2","[0]*TMath::Gaus(x,[1],[2],1)"); fg_CM2->SetNpx(300);
// normalize
fg_CC -> SetParameters((1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(5),sqrt(2)*f_fit->GetParameter(6));
fg_WW -> SetParameters(f_fit->GetParameter(2)**2*f_fit->GetParameter(1),f_fit->GetParameter(3),sqrt(2)*f_fit->GetParameter(4));
fg_MM -> SetParameters((f_fit->GetParameter(15)*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(7),sqrt(2)*f_fit->GetParameter(8));
fg_WM1 -> SetParameters(f_fit->GetParameter(1)*(f_fit->GetParameter(15)*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(11),wm1sigma);
fg_WM2 -> SetParameters(f_fit->GetParameter(1)*(f_fit->GetParameter(15)*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(12),wm1sigma);
fg_CW1 -> SetParameters(f_fit->GetParameter(1)*f_fit->GetParameter(16)*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(9),cw1sigma);
fg_CW2 -> SetParameters(f_fit->GetParameter(1)*f_fit->GetParameter(16)*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(10),cw1sigma);
fg_CM1 -> SetParameters(f_fit->GetParameter(1)*(ratio_r*f_fit->GetParameter(2))*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2)),f_fit->GetParameter(13),cm1sigma);
fg_CM2 -> SetParameters(f_fit->GetParameter(1)*(ratio_r*f_fit->GetParameter(2))*(1.-(1+f_fit->GetParameter(15))*f_fit->GetParameter(2)),f_fit->GetParameter(14),cm1sigma);
 
//non normalize
//~ fg_CC -> SetParameters((1.-5./3.*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(5),sqrt(2)*f_fit->GetParameter(6));
//~ fg_WW -> SetParameters(f_fit->GetParameter(2)**2*f_fit->GetParameter(1),f_fit->GetParameter(3),sqrt(2)*f_fit->GetParameter(4));
//~ fg_MM -> SetParameters((4./6.*f_fit->GetParameter(2))**2*f_fit->GetParameter(1),f_fit->GetParameter(7),sqrt(2)*f_fit->GetParameter(8));
//~ fg_WM1 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(11),wm1sigma);
//~ fg_WM2 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(12),wm1sigma);
//~ fg_CW1 -> SetParameters(f_fit->GetParameter(1)*(1.-5./3*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(9),cw1sigma);
//~ fg_CW2 -> SetParameters(f_fit->GetParameter(1)*(1.-5./3*f_fit->GetParameter(2))*f_fit->GetParameter(2),f_fit->GetParameter(10),cw1sigma);
//~ fg_CM1 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*(1.-5./3*f_fit->GetParameter(2)),f_fit->GetParameter(13),cm1sigma);
//~ fg_CM2 -> SetParameters(f_fit->GetParameter(1)*(4./6.*f_fit->GetParameter(2))*(1.-5./3*f_fit->GetParameter(2)),f_fit->GetParameter(14),cm1sigma);
 
 
fg_CC->Draw("sames"); fg_CC->SetLineColor(kCyan-5); fg_CC->SetRange(-10,10);
fg_WW->Draw("sames"); fg_WW->SetLineColor(kYellow+1); fg_WW->SetRange(-10,10);
fg_MM->Draw("sames"); fg_MM->SetLineColor(kMagenta-7); fg_MM->SetRange(-10,10);
fg_CW1->Draw("sames"); fg_CW1->SetLineColor(kGreen+2); fg_CW1->SetRange(-10,10);
fg_CW2->Draw("sames"); fg_CW2->SetLineColor(kGreen+2); fg_CW2->SetRange(-10,10);
fg_WM1->Draw("sames"); fg_WM1->SetLineColor(kRed-4); fg_WM1->SetRange(-10,10);
fg_WM2->Draw("sames"); fg_WM2->SetLineColor(kRed-4); fg_WM2->SetRange(-10,10);
fg_CM1->Draw("sames"); fg_CM1->SetLineColor(kBlue+2); fg_CM1->SetRange(-10,10);
fg_CM2->Draw("sames"); fg_CM2->SetLineColor(kBlue+2); fg_CM2->SetRange(-10,10);
}
HalfMax = f_fit->GetMaximum(fitmin, fitmax)/2.0;
MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter);
MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax);
FWHM = MaxHalfMax - MinHalfMax;
HalfMax = (f_fit->GetMaximum(fitmin, fitmax) + f_fit->GetParameter(0))/2.0;
MinHalfMax = f_fit->GetX(HalfMax, fitmin, f_fit->GetMaximumX(fitmin, fitmax));
MaxHalfMax = f_fit->GetX(HalfMax, f_fit->GetMaximumX(fitmin, fitmax), fitmax);
FWHMc = MaxHalfMax - MinHalfMax;
printf("(f) HalfMax = %.3lf ns | MinHalfMax = %.3lf ns | MaxHalfMax = %.3lf ns\n", HalfMax, MinHalfMax, MaxHalfMax);
printf("(f) FWHM (peak only) = %.3lf ns\n", FWHMc);
f_integrate = fgg;
for(int i=0; i<6; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1));
//~ for(int i=0; i<9; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1));
//~ fgg->SetRange(drawmin, drawmax); fgg->SetNpx(300); fgg->SetLineColor(kBlue); fgg->SetLineWidth(1); fgg->DrawClone("LSAME");
double Icherenkovs = f_integrate->Integral(drawmin, drawmax)/hp1d->GetBinWidth(1);
double Iall = f_fit->Integral(fitmin, fitmax)/hp1d->GetBinWidth(1);
double Rsn = Icherenkovs/(Iall-Icherenkovs);
//~ double Ientr = hp1d->GetEntries()*hp1d->GetBinWidth(1);
double Ientr = hp1d->GetEntries();
double Rsne = Icherenkovs/(Ientr-Icherenkovs);
//~ double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1)*hp1d->GetBinWidth(1);
double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1);
double Rsnh = Icherenkovs/(Ihist-Icherenkovs);
double Icherenkovs_10ns = f_integrate->Integral(-10, 10)/hp1d->GetBinWidth(1);
fc->SetParameter(0, f_fit->GetParameter(0));
double Inoise_10ns = fc->Integral(-10, 10)/hp1d->GetBinWidth(1);
double R10ns = Icherenkovs_10ns/Inoise_10ns;
double Icherenkovs_4ns = f_integrate->Integral(-4, 4)/hp1d->GetBinWidth(1);
fc->SetParameter(0, f_fit->GetParameter(0));
double Inoise_4ns = fc->Integral(-4, 4)/hp1d->GetBinWidth(1);
double R4ns = Icherenkovs_4ns/Inoise_4ns;
double Icherenkovs_2ns = f_integrate->Integral(-2, 2)/hp1d->GetBinWidth(1);
fc->SetParameter(0, f_fit->GetParameter(0));
double Inoise_2ns = fc->Integral(-2, 2)/hp1d->GetBinWidth(1);
double R2ns = Icherenkovs_2ns/Inoise_2ns;
//~ printf("ICherenkov = %lf | IAll = %lf | Ientr = %lf | Ihist = %lf\n", Icherenkovs, Iall, Ientr, Ihist);
printf("Icherenkovs_4ns = %.0lf\n", Icherenkovs_4ns);
//~ printf("TF1 -> S/N = %lf || TH1F(e) -> S/N = %lf || TH1F(i) -> S/N = %lf\n", Rsn, Rsne, Rsnh);
//~ printf("S/N (All) = %lf\n", Rsnh);
printf("S/N (10ns) = %.2lf\n", R10ns);
printf("S/N (4 ns) = %.2lf\n", R4ns);
printf("S/N (2 ns) = %.2lf\n", R2ns);
leg[++legi] = new TLegend(0.12,0.4,0.43,0.925);
leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(12);
sprintf(fullname, "FWHM_fit = %.0lf ps", 1000*FWHMc);
//~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "L");
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "FWHM_c = %.0lf ps", 1000*f_fit->GetParameter(6)*2.35*sqrt(2));
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
//~ sprintf(fullname, "S/N (#pm10ns) = %.1lf", R10ns);
//~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
//~ sprintf(fullname, "S/N (#pm 4ns) = %.1lf", R4ns);
//~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
//~ sprintf(fullname, "S/N (#pm 2ns) = %.1lf", R2ns);
//~ leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
//kobayashi
sprintf(fullname, "R_w = %.2f" , pw);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "R_m = %.2f" , pm);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "R_c = %.2f" , pc);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "R_w&m = %.2f" , rate);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "R_sum = %.2f" , sumrate);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "R_w&m/sum = %.2f" , rate/sumrate);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
leg[legi]->Draw();
if(draw_cuts) {
sprintf(hname, "htdcdiff_cut");
sprintf(hname, "hctdc_cut%d", chmap[ich]);
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "htdcdiff_cut_2");
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
sprintf(fullname, "gif/f_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "eps/f_%s.eps", fname); c[cc]->SaveAs(fullname);
cout<< "maximum x value = " << hp1d->GetXaxis()->GetBinCenter( hp1d->GetMaximumBin())<<endl;
if(batch_q) gSystem->Exit(1);
}
sprintf(fullname, "gif/%s_f.gif", fname); c[cc]->SaveAs(fullname);
}
 
// -------------------------------------------------------------------
 
if( strchr(plopt, 'd') != NULL ) {
DrSetDrawStyle(0.05);
gStyle->SetOptStat("e");
//~ gStyle->SetOptStat(0);
gStyle->SetOptFit(1);
//~ gStyle->SetOptFit(0);
gStyle->SetPadRightMargin(0.03);
gStyle->SetPadTopMargin(0.05);
gStyle->SetPadBottomMargin(0.12);
gStyle->SetStatFontSize(0.05);
gStyle->SetStatX(0.97);
gStyle->SetStatY(0.95);
c[++cc] = new TCanvas("d", "d", 0, 0, 720, 400);
//~ c[cc]->Divide(2,2);
int draw_cuts = 0;
int rebin_tdcs = 1;
double drawmin = -10;
double drawmax = +10;
//~ double fitmin = inmin;
//~ double fitmax = inmax;
double fitmin = -10;
double fitmax = 10;
double fitcenter = 0.0;
double HalfMax, MinHalfMax, MaxHalfMax, FWHM, FWHMc;
int ccccdi = 0;
int ich = 0;
TF1 *f_fit;
TF1 *f_integrate;
TF1 *fc = new TF1("fc", "pol0(0)");
TF1 *fcg = new TF1("fcg", "pol0(0)+gaus(1)"); fcg->SetNpx(300);
fcg->SetParName(0,"Const"); fcg->SetParName(1,"G_Const");
fcg->SetParName(2,"G_Mean" ); fcg->SetParName(3,"G_Sigma" );
TF1 *fcgg = new TF1("fcgg", "pol0(0)+gaus(1)+gaus(4)"); fcgg->SetNpx(300);
fcgg->SetParName(0,"Const");
fcgg->SetParName(1,"G1_Const"); fcgg->SetParName(2,"G1_Mean" ); fcgg->SetParName(3,"G1_Sigma" );
fcgg->SetParName(4,"G2_Const"); fcgg->SetParName(5,"G2_Mean" ); fcgg->SetParName(6,"G2_Sigma" );
TF1 *fcggg = new TF1("fcggg", "pol0(0)+gaus(1)+gaus(4)+gaus(7)"); fcggg->SetNpx(300);
fcggg->SetParName(0,"Const");
fcggg->SetParName(1,"G1_Const"); fcggg->SetParName(2,"G1_Mean" ); fcggg->SetParName(3,"G1_Sigma" );
fcggg->SetParName(4,"G2_Const"); fcggg->SetParName(5,"G2_Mean" ); fcggg->SetParName(6,"G2_Sigma" );
fcggg->SetParName(7,"G3_Const"); fcggg->SetParName(8,"G3_Mean" ); fcggg->SetParName(9,"G3_Sigma" );
(c[cc]->cd(++ccccdi))->SetLogy(0);
//~ sprintf(hname, "htdcdiff");
sprintf(hname, "htdcdiff_cut");
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->Rebin(rebin_tdcs);
hp1d->SetLineColor(kBlack);
hp1d->GetXaxis()->SetRangeUser(drawmin,drawmax);
hp1d->GetYaxis()->SetRangeUser(0.0,hp1d->GetMaximum()*1.1);
//~ hp1d->GetYaxis()->SetRangeUser(0.0,hp1d->GetMaximum()*2);
sprintf(fullname, ";Coincidence Time [ns];Counts");
hp1d->SetTitle(fullname);
//kobayashi
//~ fitmin = hp1d->GetXaxis()->GetBinCenter(hp1d->GetMaximumBin()) - hp1d->GetRMS()/15;
//~ fitmax = hp1d->GetXaxis()->GetBinCenter(hp1d->GetMaximumBin()) + hp1d->GetRMS()/15;
//~ if( strcmp(fname, "run000")==0 ) {
//~ f_fit = fcg;
//~ f_fit->SetParameters(hp1d->GetMaximum()*0.1,
//~ hp1d->GetMaximum()*0.9, 0, 0.05);
//~ } else if( strcmp(fname, "run061")==0 ||
//~ strcmp(fname, "run062")==0 ||
//~ strcmp(fname, "run063")==0 ||
//~ strcmp(fname, "run064")==0 ||
//~ strcmp(fname, "run065")==0) {
//~ f_fit = fcgg;
//~ f_fit->SetParameters(hp1d->GetMaximum()*0.1,
//~ hp1d->GetMaximum()*0.5, 0, 0.05,
//~ hp1d->GetMaximum()*0.4, 0, 0.5);
//~ } else {
//~ f_fit = fcgg;
//~ f_fit->SetParameters(hp1d->GetMaximum()*0.25,
//~ hp1d->GetMaximum()*0.7, 0, 0.4,
//~ hp1d->GetMaximum()*0.05, 0, 0.05);
//~ f_fit->SetParLimits(0, 0, hp1d->GetMaximum());
//~ f_fit->SetParLimits(1, 0, hp1d->GetMaximum());
//~ f_fit->SetParLimits(2, fitmin,fitmax);
//~ f_fit->SetParLimits(3, 0.2, 1);
//~ f_fit->SetParLimits(4, 0, hp1d->GetMaximum());
//~ f_fit->SetParLimits(5, fitmin,fitmax);
//~ if( strcmp(fname, "run059")==0 ||
//~ strcmp(fname, "run060")==0)
//~ f_fit->SetParLimits(6, 0.02, 0.3);
//~ else
//~ f_fit->SetParLimits(6, 0.02, 0.2);
//~
//~ }
if( strcmp(fitopt, "cgg")==0 ) {
f_fit = fcgg;
f_fit->SetParameters(hp1d->GetMaximum()*0.1,
hp1d->GetMaximum()*0.4, 0, 0.9,
hp1d->GetMaximum()*0.5, 0, 0.05);
f_fit->SetParLimits(0, 0, hp1d->GetMaximum());
f_fit->SetParLimits(1, hp1d->GetMaximum()*0.01, hp1d->GetMaximum());
f_fit->SetParLimits(2, fitmin,fitmax);
f_fit->SetParLimits(3, 0.05, 1);
f_fit->SetParLimits(4, hp1d->GetMaximum()*0.01, hp1d->GetMaximum());
f_fit->SetParLimits(5, fitmin,fitmax);
f_fit->SetParLimits(6, 0.01, 1);
} else if(strcmp(fitopt, "cggg")==0) {
f_fit = fcggg;
//original
//~ f_fit->SetParameters(hp1d->GetMaximum()*0.01,
//~ hp1d->GetMaximum()*0.4, 0, 0.4,
//~ hp1d->GetMaximum()*0.4, 0, 0.2,
//~ hp1d->GetMaximum()*0.1, 0, 0.05);
//kobayashi
double init_mean = hp1d->GetXaxis()->GetBinCenter(hp1d->GetMaximumBin());
f_fit->SetParameters(hp1d->GetMaximum()*0.0001,
hp1d->GetMaximum()*0.01, init_mean , 0.04,
hp1d->GetMaximum()*0.01, init_mean + 0.2, 0.03,
hp1d->GetMaximum()*0.01, init_mean - 0.2, 0.03);
f_fit->SetParLimits(0, 0, hp1d->GetMaximum());
f_fit->SetParLimits(1, 0, hp1d->GetMaximum());
f_fit->SetParLimits(2, fitmin,fitmax);
f_fit->SetParLimits(3, 0.001, 1);
f_fit->SetParLimits(4, hp1d->GetMaximum()*0.1, hp1d->GetMaximum());
f_fit->SetParLimits(5, fitmin,fitmax);
f_fit->SetParLimits(6, 0.005, 3);
f_fit->SetParLimits(7, hp1d->GetMaximum()*0.1, hp1d->GetMaximum());
f_fit->SetParLimits(8, fitmin,fitmax);
f_fit->SetParLimits(9, 0.02, 5);
} else if(strcmp(fitopt, "gg")==0) {
f_fit = fgg;
f_fit->SetParameters(hp1d->GetMaximum()*0.4, 0, 0.9,
hp1d->GetMaximum()*0.5, 0, 0.05);
f_fit->SetParLimits(0, hp1d->GetMaximum()*0.01, hp1d->GetMaximum());
f_fit->SetParLimits(1, fitmin,fitmax);
f_fit->SetParLimits(2, 0.05, 1);
f_fit->SetParLimits(3, hp1d->GetMaximum()*0.01, hp1d->GetMaximum());
f_fit->SetParLimits(4, fitmin,fitmax);
f_fit->SetParLimits(5, 0.01, 1);
}
f_fit->SetRange(fitmin,fitmax);
f_fit->SetLineWidth(1); f_fit->SetLineStyle(9);
hp1d->Fit(f_fit, "QWW", "", fitmin,fitmax);
//~ hp1d->Fit(f_fit, "QWW", "", -0.5,+0.5);
//~ fg->SetRange(fitmin,fitmax); fg->SetLineWidth(1.0);
//~ fg->SetParameters(f_fit->GetParameter(0+1), f_fit->GetParameter(1+1), f_fit->GetParameter(2+1)); fg->SetLineColor(kMagenta); fg->DrawCopy("LSAME");
//~ fg->SetParameters(f_fit->GetParameter(0+4), f_fit->GetParameter(1+4), f_fit->GetParameter(2+4)); fg->SetLineColor(kGreen); fg->DrawCopy("LSAME");
//~ fg->SetParameters(f_fit->GetParameter(0+7), f_fit->GetParameter(1+7), f_fit->GetParameter(2+7)); fg->SetLineColor(kYellow); fg->DrawCopy("LSAME");
HalfMax = f_fit->GetMaximum(fitmin, fitmax)/2.0;
MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter);
MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax);
FWHM = MaxHalfMax - MinHalfMax;
HalfMax = (f_fit->GetMaximum(fitmin, fitmax) + f_fit->GetParameter(0))/2.0;
MinHalfMax = f_fit->GetX(HalfMax, fitmin, f_fit->GetMaximumX(fitmin, fitmax));
MaxHalfMax = f_fit->GetX(HalfMax, f_fit->GetMaximumX(fitmin, fitmax), fitmax);
FWHMc = MaxHalfMax - MinHalfMax;
//~ printf("FWHM = %lf ns | FWHMc = %lf ns\n", FWHM, FWHMc);
printf("(d) FWHM (peak only) = %.3lf ns\n", FWHMc);
f_integrate = fgg;
for(int i=0; i<6; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1));
//~ for(int i=0; i<9; i++) f_integrate->SetParameter(i, f_fit->GetParameter(i+1));
//~ fgg->SetRange(drawmin, drawmax); fgg->SetNpx(300); fgg->SetLineColor(kBlue); fgg->SetLineWidth(1); fgg->DrawClone("LSAME");
double Icherenkovs = f_integrate->Integral(drawmin, drawmax)/hp1d->GetBinWidth(1);
double Iall = f_fit->Integral(fitmin, fitmax)/hp1d->GetBinWidth(1);
double Rsn = Icherenkovs/(Iall-Icherenkovs);
//~ double Ientr = hp1d->GetEntries()*hp1d->GetBinWidth(1);
double Ientr = hp1d->GetEntries();
double Rsne = Icherenkovs/(Ientr-Icherenkovs);
//~ double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1)*hp1d->GetBinWidth(1);
double Ihist = hp1d->Integral(1, hp1d->GetNbinsX()-1);
double Rsnh = Icherenkovs/(Ihist-Icherenkovs);
double Icherenkovs_10ns = f_integrate->Integral(-10, 10)/hp1d->GetBinWidth(1);
fc->SetParameter(0, f_fit->GetParameter(0));
double Inoise_10ns = fc->Integral(-10, 10)/hp1d->GetBinWidth(1);
double R10ns = Icherenkovs_10ns/Inoise_10ns;
double Icherenkovs_4ns = f_integrate->Integral(-4, 4)/hp1d->GetBinWidth(1);
fc->SetParameter(0, f_fit->GetParameter(0));
double Inoise_4ns = fc->Integral(-4, 4)/hp1d->GetBinWidth(1);
double R4ns = Icherenkovs_4ns/Inoise_4ns;
double Icherenkovs_2ns = f_integrate->Integral(-2, 2)/hp1d->GetBinWidth(1);
fc->SetParameter(0, f_fit->GetParameter(0));
double Inoise_2ns = fc->Integral(-2, 2)/hp1d->GetBinWidth(1);
double R2ns = Icherenkovs_2ns/Inoise_2ns;
//~ printf("ICherenkov = %lf | IAll = %lf | Ientr = %lf | Ihist = %lf\n", Icherenkovs, Iall, Ientr, Ihist);
printf("Icherenkovs_4ns = %.0lf\n", Icherenkovs_4ns);
//~ printf("TF1 -> S/N = %lf || TH1F(e) -> S/N = %lf || TH1F(i) -> S/N = %lf\n", Rsn, Rsne, Rsnh);
//~ printf("S/N (All) = %lf\n", Rsnh);
printf("S/N (10ns) = %.2lf\n", R10ns);
printf("S/N (4 ns) = %.2lf\n", R4ns);
printf("S/N (2 ns) = %.2lf\n", R2ns);
//~ #define USE_NOISE_FILE
 
#ifdef USE_NOISE_FILE
//get ROOT file with histograms
char fnameroot[1024];
TFile * rootfile2;
TDirectory *dir2;
//~ sprintf(fname, "run054");
sprintf(fname, "run_309");
sprintf(fnameroot, "root/%s.root", fname);
rootfile2 = (TFile *) gROOT->FindObject(fname);
if(rootfile2==NULL) rootfile2 = new TFile(fnameroot);
if(rootfile2==NULL) {
printf("Cannot open root file 2 %s!!!\n",fnameroot);
return;
}
dir2 = (TDirectory*) rootfile2;
sprintf(hname, "htdcdiff");
hp1dcut = DrTH1F(dir2, hname, "");
hp1dcut->SetLineColor(40);
hp1dcut->SetLineStyle(2);
hp1dcut->DrawClone("SAME");
leg[++legi] = new TLegend(0.125,0.5,0.425,0.925);
leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(12);
leg[legi]->AddEntry((TH1F*)hp1d->Clone(), "With source", "L");
leg[legi]->AddEntry((TH1F*)hp1dcut->Clone(), "W/o source", "L");
#else
leg[++legi] = new TLegend(0.125,0.625,0.425,0.925);
leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(12);
#endif
sprintf(fullname, "FWHM = %.0lf ps", 1000*FWHMc);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "L");
sprintf(fullname, "S/N (#pm10ns) = %.1lf", R10ns);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "S/N (#pm 4ns) = %.1lf", R4ns);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
sprintf(fullname, "S/N (#pm 2ns) = %.1lf", R2ns);
leg[legi]->AddEntry((TF1*)f_fit->Clone(), fullname, "");
leg[legi]->Draw();
if(draw_cuts) {
sprintf(hname, "htdcdiff_cut");
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kRed);
hp1dcut->DrawClone("SAME");
sprintf(hname, "htdcdiff_cut_2");
hp1dcut = DrTH1F(dir, hname, "");
hp1dcut->Rebin(rebin_tdcs);
hp1dcut->SetLineColor(kGreen);
hp1dcut->DrawClone("SAME");
}
sprintf(fullname, "gif/d_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "eps/d_%s.eps", fname); c[cc]->SaveAs(fullname);
 
if(batch_q) gSystem->Exit(1);
}
// -------------------------------------------------------------------
 
if( strchr(plopt, 'c') != NULL ) {
//~ gStyle->SetOptStat(1111);
//~ gStyle->SetOptFit(0);
//gStyle->SetOptStat(1111);
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
c[++cc] = new TCanvas("c", "c", 0, 0, 900, 700);
//~ c[cc]->Divide(2,2);
c[++cc] = new TCanvas("c", "c", 0, 0, 1600, 900);
c[cc]->Divide(2,2);
int ccccdi = 0;
(c[cc]->cd(++ccccdi))->SetLogz(1);
sprintf(hname, "htdccor");
int draw_cuts = 0;
int chmap[] = {0,1,2,31};
for(int ich = 0;ich<4;ich++) {
(c[cc]->cd(ich+1))->SetLogz(1);
sprintf(hname, "hcor%d", chmap[ich]);
hp2d = DrTH2F(dir, hname, "");
//~ hp2d->GetYaxis()->SetRangeUser(0,1500);
//~ sprintf(fullname, "%s;QDC Reference 1275 keV; QDC Reference Coincidence", fname);
//~ hp2d->SetTitle(fullname);
sprintf(htitle, "TDC%d - TRIGGER;ADC;Time [ns];Count", chmap[ich]); hp2d->SetTitle(htitle);
hp2d->GetXaxis()->SetRangeUser(0,2048);
hp2d->DrawClone("COLZ");
//~ (c[cc]->cd(++ccccdi))->SetLogz(1);
//~ sprintf(hname, "hcor%d",0);
//~ hp2d = DrTH2F(dir, hname, "");
//~ hp2d->DrawClone("COLZ");
//~
//~ (c[cc]->cd(++ccccdi))->SetLogz(1);
//~ sprintf(hname, "hcor%d",1);
//~ hp2d = DrTH2F(dir, hname, "");
//~ hp2d->DrawClone("COLZ");
//~
//~
//~ (c[cc]->cd(++ccccdi))->SetLogz(1);
//~ sprintf(hname, "hdiffcor_%d_%d",0,1);
//~ hp2d = DrTH2F(dir, hname, "");
//~ hp2d->DrawClone("COLZ");
//~
//~ (c[cc]->cd(++ccccdi))->SetLogz(1);
//~ sprintf(hname, "hdiffcor_%d_%d",1,0);
//~ hp2d = DrTH2F(dir, hname, "");
//~ hp2d->DrawClone("COLZ");
sprintf(fullname, "gif/c_%s.gif", fname); c[cc]->SaveAs(fullname);
}
sprintf(fullname, "gif/%s_c.gif", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------------------
// -------------------------------------------------------------------
//~ // -------------------------------------------------------------------
 
if( strchr(plopt, 't') != NULL ) {
//~ if( strchr(plopt, 'c') != NULL ) {
gStyle->SetOptStat(1111);
//~ gStyle->SetOptStat(0);
//~ gStyle->SetOptFit(0);
c[++cc] = new TCanvas("c", "c", 0, 0, 700, 400);
//~ c[cc]->Divide(2,2);
//~ c[++cc] = new TCanvas("c", "c", 0, 0, 1600, 900);
double drawmin = -1;
double drawmax = 2;
double fitmin = -1;
double fitmax = 0.75;
double fitcenter = 0.0;
double HalfMax, MinHalfMax, MaxHalfMax, FWHM;
int ccccdi = 0;
//~ (c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hctdc%d", 0);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("Vov = 1.5V; Time [ns];");
hp1d->GetXaxis()->SetRangeUser(drawmin,drawmax);
f_fit = fgg;
f_fit->SetParameters(hp1d->GetMaximum()*0.9, 0, 0.1,
hp1d->GetMaximum()*0.1, 0, 0.5);
//~ f_fit->SetParLimits(1, 0, hp1d->GetMaximum());
//~ f_fit->SetParLimits(2, fitmin,fitmax);
//~ f_fit->SetParLimits(3, 0.2, 1);
//~ f_fit->SetParLimits(4, 0, hp1d->GetMaximum());
//~ f_fit->SetParLimits(5, fitmin,fitmax);
 
f_fit->SetRange(fitmin,fitmax);
f_fit->SetLineWidth(1);
hp1d->Fit(f_fit, "Q", "", fitmin,fitmax);
 
 
HalfMax = f_fit->GetMaximum(fitmin, fitmax)/2.0;
MinHalfMax = f_fit->GetX(HalfMax, fitmin, fitcenter);
MaxHalfMax = f_fit->GetX(HalfMax, fitcenter, fitmax);
FWHM = MaxHalfMax - MinHalfMax;
printf("FWHM = %.3lf ns\n", FWHM);
fg->SetRange(-2,5); fg->SetLineWidth(1.0);
fg->SetParameters(f_fit->GetParameter(0), f_fit->GetParameter(1), f_fit->GetParameter(2));
fg->SetLineColor(kGreen); fg->DrawClone("LSAME");
fg->SetParameters(f_fit->GetParameter(0+3), f_fit->GetParameter(1+3), f_fit->GetParameter(2+3));
fg->SetLineColor(kMagenta); fg->DrawClone("LSAME");
sprintf(fullname, "gif/t_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "eps/t_%s.eps", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------------------
// -------------------------------------------------------------------
 
if( strchr(plopt, 'e') != NULL ) {
DrSetDrawStyle(0.05);
gStyle->SetOptStat("e");
gStyle->SetOptFit(0);
gStyle->SetPadRightMargin(0.03);
gStyle->SetPadTopMargin(0.05);
gStyle->SetPadBottomMargin(0.12);
gStyle->SetStatFontSize(0.05);
gStyle->SetStatX(0.97);
gStyle->SetStatY(0.95);
c[++cc] = new TCanvas("e_ref", "e_ref", 0, 0, 720, 400);
int spectra_rebin = 0;
int yaxis_max = 0;
//~ int yaxis_max = 1200;
//~ int xaxis_max = 2500;
int xaxis_max = 3000;
//~ double fitcenter = 1190.;
//~ double fitw = 70.;
//~ double Cher_min = 10;
//~ double Cher_max = 16;
double Cher_min = -120;
double Cher_max = -110;
//~ double const_min = 20;
//~ double const_max = 80;
double const_min = -250;
double const_max = -200;
int ccccdi = 0;
if( strcmp(fname, "eff003")==0) {fitcenter=760.; fitw=100.;}
if( strcmp(fname, "eff004")==0) {fitcenter=1220.; fitw=150.; spectra_rebin=8; yaxis_max=3300;}
if( strcmp(fname, "eff005")==0) {fitcenter=1140.; fitw=60.;}
if( strcmp(fname, "eff006")==0) {fitcenter=2050.; fitw=60.; xaxis_max=4000;}
if( strcmp(fname, "eff012")==0) {Cher_min=13; Cher_max=15;}
if( strcmp(fname, "eff013")==0) {Cher_min=12; Cher_max=14;}
if( strcmp(fname, "eff014")==0) {Cher_min=12; Cher_max=14;}
if( strcmp(fname, "eff015")==0) {Cher_min=12; Cher_max=14;}
if( strcmp(fname, "eff016")==0) {Cher_min=12; Cher_max=14;}
if( strcmp(fname, "eff017")==0) {Cher_min=12; Cher_max=14;}
if( strcmp(fname, "eff018")==0) {Cher_min=12; Cher_max=14;}
sprintf(hname, "hadc%d", 0);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("; Charge [200 fC/bin];Counts");
if(spectra_rebin) hp1d->Rebin(spectra_rebin);
hp1d->SetLineColor(kBlack);
hp1d->GetXaxis()->SetRangeUser(0,xaxis_max);
if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0,yaxis_max);
hp1d->Draw();
//~ printf("Photofraction ~ %lf\n", hp1d->Integral(1300,1700)/hp1d->Integral(0,1300));
f_fit = fg;
f_fit->SetParameters(hp1d->GetMaximum()*0.1, fitcenter, fitw);
 
f_fit->SetRange(fitcenter-fitw, fitcenter+fitw);
f_fit->SetLineWidth(3);
hp1d->Fit(f_fit, "0Q", "", fitcenter-fitw, fitcenter+fitw);
f_fit->DrawClone("LSAME");
double PP_1sigma_min = f_fit->GetParameter(1)-f_fit->GetParameter(2);
double PP_1sigma_max = f_fit->GetParameter(1)+f_fit->GetParameter(2);
printf("PPcenter, PPwidth = %.0lf, %.0lf\n", f_fit->GetParameter(1), f_fit->GetParameter(2));
printf("PP+/-1sigma = [%.0lf, %.0lf]\n", PP_1sigma_min, PP_1sigma_max);
printf("PP resolution = %.1lf\%% (FWHM = %.1lf\%%)\n", 100*f_fit->GetParameter(2)/f_fit->GetParameter(1), 235*f_fit->GetParameter(2)/f_fit->GetParameter(1));
// -------- 1275keV Compton estimation --------
 
// COMPTON EDGE
//~ TF1 *fcompt = new TF1("fcompt", "[2]*(1 - ConstantStep(((x-[0])/[1]) - (1275.*(2*1275./511./(1+2*1275./511.)))))*(2 + (((x-[0])/[1])/1275.)^2/((1275./511.)^2*(1 - (((x-[0])/[1])/1275.))^2) + (((x-[0])/[1])/1275.)*((((x-[0])/[1])/1275.) - 2/(1275./511.))/(1 - (((x-[0])/[1])/1275.)))/(1275./511.)^2");
//~ TF1 *fcomhi = new TF1("fcomhi", "gaus(0)+fcompt");
//~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6);
//~ double comhi_range_low = 1670.;
//~ //double comhi_range_hi = 2130.;
//~ double comhi_range_hi = 2070.;
//~ fcomhi->SetParameters(2000., 1710., 50., 100, 2, 200);
//~ fcomhi->SetRange(comhi_range_low, comhi_range_hi);
//~ hp1d->Fit(fcomhi, "0QR");
//~ //fcomhi->DrawClone("LSAME");
//~
//~ fcompt->SetNpx(300); fcompt->SetLineWidth(1); fcompt->SetLineColor(kBlue); fcompt->SetLineStyle(9);
//~ fcompt->SetParameter(0, fcomhi->GetParameter(3));
//~ fcompt->SetParameter(1, fcomhi->GetParameter(4));
//~ fcompt->SetParameter(2, fcomhi->GetParameter(5));
//~ fcompt->SetRange(0, comhi_range_hi);
//~ fcompt->DrawClone("LSAME");
//~
//~ double IComHi = fcompt->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1);
//~ printf("IComHi = %.0lf\n", IComHi);
// G LINEAR G
//~ TF1 *fcomhi = new TF1("fcomhi", "gaus(0)+pol0(3)+gaus(4)");
//~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(kBlue);
//~ double comhi_range_low = 1700.;
//~ double comhi_range_hi = 2150.;
//~ fcomhi->SetParameters(2000., 1710., 50.,
//~ 150.,
//~ 200., 2150., 100.);
//~ fcomhi->SetRange(comhi_range_low, comhi_range_hi);
//~ hp1d->Fit(fcomhi, "0QR");
//~ fcomhi->DrawClone("LSAME");
//~
//~ TF1 *fcom_lin = new TF1("fcom_lin", "pol0(0)");
//~ fcom_lin->SetNpx(300); fcom_lin->SetLineWidth(1); fcom_lin->SetLineColor(6);
//~ fcom_lin->SetParameter(0, fcomhi->GetParameter(3));
//~ fcom_lin->SetRange(0, 4000);
//~ fcom_lin->DrawClone("LSAME");
//~
//~ double IComHi = fcom_lin->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1);
// G LINEAR EXP
TF1 *fcomhi = new TF1("fcomhi", "gaus(0) + [3] + [4]*TMath::Exp((x-[5])/[6])");
fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6);
//double comhi_range_low = 1250.;
double comhi_range_low = fitcenter - 1.5*fitw;
//double comhi_range_hi = 2100.;
//~ fcomhi->SetParameters(2000., fitcenter, fitw,
//~ 170.,
//~ 85., 2000., 100.);
fcomhi->SetParameters(800., fitcenter, fitw,
40.,
5., comhi_range_hi, 100.);
//~ fcomhi->SetParLimits(2, 50., 2000.);
fcomhi->SetRange(comhi_range_low, comhi_range_hi);
hp1d->Fit(fcomhi, "0QR");
//~ fcomhi->SetRange(0, 4000);
fcomhi->DrawClone("LSAME");
TF1 *fcompt = new TF1("fcompt", "[0] + [1]*TMath::Exp((x-[2])/[3])");
fcompt->SetNpx(300); fcompt->SetLineWidth(1); fcompt->SetLineColor(kBlue); fcompt->SetLineStyle(9);
fcompt->SetParameter(0, fcomhi->GetParameter(3));
fcompt->SetParameter(1, fcomhi->GetParameter(4));
fcompt->SetParameter(2, fcomhi->GetParameter(5));
fcompt->SetParameter(3, fcomhi->GetParameter(6));
//~ fcompt->SetRange(1000, comhi_range_hi);
fcompt->SetRange(400, comhi_range_hi);
fcompt->DrawClone("LSAME");
//~
double IComHi = fcompt->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1);
printf("IComHi = %.0lf\n", IComHi);
//~
//~ // EXP
//~ TF1 *fcomhi = new TF1("fcomhi", "[0] + [1]*TMath::Exp((x-[2])/[3])");
//~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6);
//~ double comhi_range_low = 1800.;
//~ double comhi_range_hi = 2000.;
//~ fcomhi->SetParameters(150., 1., 2000.,1.);
//~ fcomhi->SetRange(comhi_range_low, comhi_range_hi);
//~ hp1d->Fit(fcomhi, "R");
//~ fcomhi->SetRange(0, 4000);
//~ fcomhi->DrawClone("LSAME");
//~
//~ double IComHi = fcomhi->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1);
//~ printf("IComHi = %.0lf\n", IComHi);
// LIN
//~ TF1 *fcomhi = new TF1("fcomhi", "pol0");
//~ fcomhi->SetNpx(500); fcomhi->SetLineWidth(1); fcomhi->SetLineColor(6);
//~ double comhi_range_low = 1800.;
//~ double comhi_range_hi = 1900.;
//~ fcomhi->SetParameter(0,150);
//~ fcomhi->SetRange(comhi_range_low, comhi_range_hi);
//~ hp1d->Fit(fcomhi, "QR");
//~ fcomhi->SetRange(0, 4000);
//~ fcomhi->DrawClone("LSAME");
//~
//~ double IComHi = fcomhi->Integral(PP_1sigma_min, PP_1sigma_max)/hp1d->GetBinWidth(1);
//~ printf("IComHi = %.0lf\n", IComHi);
// -------- 1275keV Compton estimation --------
sprintf(hname, "hadc_cut%d", 0);
hp1dcut = DrTH1F(dir, hname, "");
if(spectra_rebin) hp1dcut->Rebin(spectra_rebin);
hp1dcut->SetLineColor(kRed);
hp1dcut->SetLineColor(40);
hp1dcut->SetLineStyle(2);
hp1dcut->DrawClone("SAME");
double N511 = hp1dcut->GetEntries();
//~ double N511 = hp1dcut->Integral(PP_1sigma_min-10, PP_1sigma_max+10);
leg[++legi] = new TLegend(0.124302, 0.65, 0.6, 0.925134);
leg[legi]->SetFillColor(0); leg[legi]->SetBorderSize(1); leg[legi]->SetTextSize(0.05); leg[legi]->SetTextAlign(22);
leg[legi]->AddEntry((TH1F*)hp1d->Clone(), "Measurement", "L");
leg[legi]->AddEntry((TH1F*)hp1dcut->Clone(), "#pm1 #sigma Photopeak Cut", "L");
leg[legi]->AddEntry((TF1*)fcompt->Clone(), "1275 keV Compton Estimate", "L");
//~ leg[legi]->Draw();
//~ sprintf(hname, "hadc_cut_2%d", 0);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kGreen);
//~ hp1d->DrawClone("SAME");
 
sprintf(fullname, "gif/e_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "eps/e_%s.eps", fname); c[cc]->SaveAs(fullname);
 
 
c[++cc] = new TCanvas("e_sipm", "e_sipm", 0, 470, 720, 300);
int ch_Sprttype = 8;
//~ int draw_cuts = 0;
(c[cc]->cd(1))->SetLogy(1);
sprintf(hname, "htdc%d", ch_Sprttype);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("; Time [ns];Counts");
//~ hp1d->Rebin(4);
hp1d->SetLineColor(kBlack);
//~ hp1d->GetXaxis()->SetRangeUser(0,80);//original
hp1d->GetXaxis()->SetRangeUser(-400,50);
hp1d->GetYaxis()->SetRangeUser(0.1,hp1d->GetMaximum()*2);
hp1d->DrawClone();
sprintf(hname, "htdc_cut%d", ch_Sprttype);
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->Rebin(4);
hp1d->SetLineColor(kRed);
TF1 *fc = new TF1("fc", "pol0"); fc->SetNpx(300);
fc->SetParameter(0,1);
//~ fc->SetParameter(1,-0.1);
fc->SetRange(const_min,const_max);
hp1d->Fit(fc, "0QWWR");
hp1d->DrawClone("SAME");
fc->SetLineColor(kBlue);
fc->DrawClone("LSAME");
double Ntdc = hp1d->Integral(hp1d->FindBin(Cher_min), hp1d->FindBin(Cher_max));
double Nbckg = fc->Integral(Cher_min,Cher_max)/hp1d->GetBinWidth(1);
printf("fc par(0) = %lf | Nbckg = %.0lf\n", fc->GetParameter(0), Nbckg);
//~ sprintf(hname, "htdc_cut_2%d", 1);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kGreen);
//~ hp1d->DrawClone("SAME");
printf("N511 = %.0lf | Ntdc = %.0lf | R = %.2lf \%% | R_1 = %.2lf \%% | R_2 = %.2lf \%%\n", N511, Ntdc, 100*Ntdc/N511, 100*(Ntdc-Nbckg)/N511, 100*(Ntdc-Nbckg)/(N511-IComHi));
sprintf(fullname, "gif/e2_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "eps/e2_%s.eps", fname); c[cc]->SaveAs(fullname);
int kobayashi =1;
if(kobayashi){
double Nnohit = hp1d->Integral(hp1d->FindBin(-715), hp1d->FindBin(-685));
printf("N511 = %.0lf | Nnohit = %.0lf | R = %.2lf \%% | R_1 = %.2lf \%% | R_2 = %.2lf \%%\n", N511, Nnohit, 100*(N511-Nnohit)/N511, 100*((N511-Nnohit)-Nbckg)/N511, 100*((N511-Nnohit)-Nbckg)/(N511-IComHi));
}
//~ (c[cc]->cd(++ccccdi))->SetLogy(1);
//~ sprintf(hname, "hadc%d", 1);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kBlack);
//~ hp1d->GetXaxis()->SetRangeUser(0,2000);
//~ hp1d->DrawClone();
//~
//~ sprintf(hname, "hadc_cut%d", 1);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kRed);
//~ hp1d->DrawClone("SAME");
//~
//~ sprintf(hname, "hadc_cut_2%d", 1);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kGreen);
//~ hp1d->DrawClone("SAME");
//~ sprintf(fullname, "gif/e_%s.gif", fname); c[cc]->SaveAs(fullname);
//~ sprintf(fullname, "eps/e_%s.eps", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------
 
if( strchr(plopt, 'r') != NULL ) {
//~ gStyle->SetOptStat(1111);
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
c[++cc] = new TCanvas("e", "e", 0, 0, 1200, 450);
c[cc]->Divide(3,1);
//~ int ich = chich;
//~ (c[cc]->cd(1))->SetLogz(1);
//~ sprintf(hname, "hcor%d", ich);
//~ hp2d = DrTH2F(dir, hname, "");
//~ sprintf(htitle, "TDC%d - TRIGGER;ADC;Time [ns];Count", ich); hp2d->SetTitle(htitle);
//~ hp2d->GetXaxis()->SetRangeUser(512,2048);
//~ hp2d->GetYaxis()->SetRangeUser(-10,20);
//~ hp2d->DrawClone("COLZ");
int spectra_rebin = 0;
int yaxis_max = 0;
int xaxis_max = 3000;
double fitcenter = 700.;
double fitw = 60.;
double Cher_min = 4;
double Cher_max = 16;
double const_min = Cher_max;
double const_max = 80;
int ccccdi = 0;
if( strcmp(fname, "eff003")==0) {fitcenter=760.; fitw=100.;}
if( strcmp(fname, "eff004")==0) {fitcenter=1220.; fitw=150.; spectra_rebin=8; yaxis_max=3300;}
if( strcmp(fname, "eff005")==0) {fitcenter=1140.; fitw=60.;}
if( strcmp(fname, "eff006")==0) {fitcenter=2050.; fitw=60.; xaxis_max=4000;}
if( strcmp(fname, "eff007")==0) {fitcenter=710.; fitw=50.;}
if( strcmp(fname, "eff009")==0) {fitcenter=900.; fitw=60.; xaxis_max=2000;}
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hadc%d", 0);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("Reference Coincidence; Charge [200 fC/bin];");
if(spectra_rebin) hp1d->Rebin(spectra_rebin);
hp1d->SetLineColor(kBlack);
hp1d->GetXaxis()->SetRangeUser(0,xaxis_max);
if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0.5,yaxis_max);
f_fit = fg;
f_fit->SetParameters(hp1d->GetMaximum()*0.1, fitcenter, fitw);
 
f_fit->SetRange(fitcenter-fitw, fitcenter+fitw);
f_fit->SetLineWidth(1);
hp1d->Fit(f_fit, "Q", "", fitcenter-fitw, fitcenter+fitw);
printf("PP+/-1sigma = [%.0lf, %.0lf]\n", f_fit->GetParameter(1)-f_fit->GetParameter(2), f_fit->GetParameter(1)+f_fit->GetParameter(2));
printf("PP resolution = %.1lf\%% (FWHM = %.1lf\%%)\n", 100*f_fit->GetParameter(2)/f_fit->GetParameter(1), 235*f_fit->GetParameter(2)/f_fit->GetParameter(1));
sprintf(hname, "hadc_cut%d", 0);
hp1d = DrTH1F(dir, hname, "");
if(spectra_rebin) hp1d->Rebin(spectra_rebin);
hp1d->SetLineColor(kRed);
hp1d->DrawClone("SAME");
double N511 = hp1d->GetEntries();
sprintf(hname, "hadc_cut_2%d", 0);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetLineColor(kGreen);
hp1d->DrawClone("SAME");
//-----------------------------------------------------------------------
 
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "hadc%d", 2);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("Reference 1275 keV; Charge [200 fC/bin];");
//~ if(spectra_rebin) hp1d->Rebin(spectra_rebin);
hp1d->SetLineColor(kBlack);
//~ hp1d->GetXaxis()->SetRangeUser(0,xaxis_max);
//~ if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0,yaxis_max);
hp1d->DrawClone();
sprintf(hname, "hadc_cut%d", 2);
hp1d = DrTH1F(dir, hname, "");
if(spectra_rebin) hp1d->Rebin(spectra_rebin);
hp1d->SetLineColor(kRed);
hp1d->DrawClone("SAME");
sprintf(hname, "hadc_cut_2%d", 2);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetLineColor(kGreen);
hp1d->DrawClone("SAME");
 
//-----------------------------------------------------------------------
 
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", 1);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("MPPC Cherenkov; Time [ns];");
//~ hp1d->Rebin(4);
hp1d->SetLineColor(kBlack);
hp1d->GetXaxis()->SetRangeUser(0,80);
hp1d->GetYaxis()->SetRangeUser(0.1,hp1d->GetMaximum()*2);
hp1d->DrawClone();
sprintf(hname, "htdc_cut%d", 1);
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->Rebin(4);
hp1d->SetLineColor(kRed);
TF1 *fc = new TF1("fc", "pol0"); fc->SetNpx(300);
fc->SetParameter(0,1);
fc->SetRange(const_min,const_max);
hp1d->Fit(fc, "0QWWR");
hp1d->DrawClone("SAME");
fc->SetLineColor(kBlue);
fc->DrawClone("LSAME");
double Ntdc = hp1d->Integral(hp1d->FindBin(Cher_min), hp1d->FindBin(Cher_max));
double Nbckg = fc->Integral(Cher_min,Cher_max)/hp1d->GetBinWidth(1);
printf("fc par(0) = %lf | Nbckg = %.0lf\n", fc->GetParameter(0), Nbckg);
sprintf(hname, "htdc_cut_2%d", 1);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetLineColor(kGreen);
hp1d->DrawClone("SAME");
printf("N511 = %.0lf | Ntdc = %.0lf | R = %lf\n", N511, Ntdc, Ntdc/N511);
printf("R_1 = %lf\n", (Ntdc-Nbckg)/N511);
//~ (c[cc]->cd(++ccccdi))->SetLogy(1);
//~ sprintf(hname, "hadc%d", 1);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kBlack);
//~ hp1d->GetXaxis()->SetRangeUser(0,2000);
//~ hp1d->DrawClone();
//~
//~ sprintf(hname, "hadc_cut%d", 1);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kRed);
//~ hp1d->DrawClone("SAME");
//~
//~ sprintf(hname, "hadc_cut_2%d", 1);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kGreen);
//~ hp1d->DrawClone("SAME");
sprintf(fullname, "gif/e_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "eps/e_%s.eps", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------------------
// -------------------------------------------------------------------
 
if( strchr(plopt, 'p') != NULL ) {
DrSetDrawStyle(0.05);
gStyle->SetOptStat("e");
gStyle->SetOptFit(0);
gStyle->SetPadRightMargin(0.03);
gStyle->SetPadTopMargin(0.05);
gStyle->SetPadBottomMargin(0.12);
gStyle->SetStatFontSize(0.05);
gStyle->SetStatX(0.97);
gStyle->SetStatY(0.95);
c[++cc] = new TCanvas("Print", "Print", 0, 0, 720, 400);
int spectra_rebin = 0;
int yaxis_max = 1000;
int xaxis_max = 1200;
 
double Cher_min = 10;
double Cher_max = 16;
double const_min = 20;
double const_max = 80;
int ccccdi = 0;
sprintf(hname, "hadc%d", 0);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("; Charge [200 fC/bin];Counts");
if(spectra_rebin) hp1d->Rebin(spectra_rebin);
hp1d->SetLineColor(kBlack);
hp1d->GetXaxis()->SetRangeUser(0,xaxis_max);
if(yaxis_max) hp1d->GetYaxis()->SetRangeUser(0,yaxis_max);
hp1d->Draw();
sprintf(hname, "hadc_cut%d", 0);
hp1dcut = DrTH1F(dir, hname, "");
if(spectra_rebin) hp1dcut->Rebin(spectra_rebin);
hp1dcut->SetLineColor(kRed);
hp1dcut->Draw("SAME");
sprintf(fullname, "gif/p_%s.gif", fname); c[cc]->SaveAs(fullname);
sprintf(fullname, "eps/p_%s.eps", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------
 
if( strchr(plopt, 'b') != NULL ) {
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
c[++cc] = new TCanvas("b", "b", 0, 0, 1200, 700);
c[cc]->Divide(2,2);
int ccccdi = 0;
int ich;
/*
// ------------------------------------------------------------
ich = 0;
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle(hname);
//~ hp1d->GetXaxis()->SetRangeUser(0,2000);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
// ------------------------------------------------------------
ich = 1;
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle(hname);
//~ hp1d->GetXaxis()->SetRangeUser(0,2000);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
*/
// -------------------------- qdc 0 ----------------------------------
ich = 0;
(c[cc]->cd(++ccccdi))->SetLogy(1);
/*
sprintf(hname, "hadc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("SiPM;Charge [200 fC/bin]");
hp1d->GetXaxis()->SetRangeUser(0,1000);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
*/
TLegend *leg0 = new TLegend(0.57,0.66,0.88,0.88);
leg0->SetFillColor(0);
leg0->SetBorderSize(1);
leg0->SetTextSize(0.05);
leg0->SetTextAlign(22);
sprintf(hname, "hadc%d", ich);
TH1F* hADC = DrTH1F(dir, hname, "");
hADC->SetTitle("SiPM;Charge [200 fC/bin]");
hADC->GetXaxis()->SetRangeUser(0,1000);
hADC->SetLineColor(kBlack);
hADC->DrawClone();
int dbgprint=1;
const int nPeaks=3;
double pSigma=10;
double pThr=0.005;
TSpectrum *sADC = new TSpectrum(nPeaks,0.3);
sADC->Search(hADC, pSigma,"",pThr);
int foundNPeaks = sADC->GetNPeaks();
float *foundPeakX = sADC->GetPositionX();
float *foundPeakY = sADC->GetPositionY();
if(1 < foundNPeaks) {
//void Sort(Int_t n1, const Float_t *a, Int_t *index, Bool_t down)
int sortedPeakIndex[nPeaks];
TMath::Sort(foundNPeaks, foundPeakX, sortedPeakIndex, 0);
if(dbgprint) {
printf("foundNPeaks = %d\n",foundNPeaks);
for(int i=0; i<foundNPeaks; i++) printf("Peak[%d] = %f\n",i, foundPeakX[sortedPeakIndex[i]]);
}
float peakMidpointX[nPeaks+1];
float peakMidpointY[nPeaks+1];
peakMidpointX[0] = 0; peakMidpointY[0] = 1;
for(int i=1; i<foundNPeaks; i++) {
peakMidpointX[i] = (foundPeakX[sortedPeakIndex[i]] + foundPeakX[sortedPeakIndex[i-1]])/2.0;
peakMidpointY[i] = 1;
if(dbgprint) printf("peakMidpointX[%d] = %f\n",i, peakMidpointX[i]);
}
peakMidpointX[foundNPeaks] = 1120; peakMidpointY[foundNPeaks] = 1;
if(dbgprint) printf("peakMidpointX[%d] = %f\n",foundNPeaks, peakMidpointX[foundNPeaks]);
TPolyMarker *pmMidpoints = new TPolyMarker(nPeaks+1, peakMidpointX, peakMidpointY);
pmMidpoints->SetMarkerStyle(33); pmMidpoints->SetMarkerColor(9); pmMidpoints->SetMarkerSize(2);
pmMidpoints->Draw("SAME");
//~ fprintf(fp,"peakEvents:\n");
 
double peakEvents[nPeaks];
for(int i=0; i<foundNPeaks-1; i++) {
peakEvents[i] = hADC->Integral(hADC->FindBin(peakMidpointX[i]), hADC->FindBin(peakMidpointX[i+1]));
if(dbgprint) printf("I(%.1f, %.1f) = %.1lf\n", peakMidpointX[i], peakMidpointX[i+1], peakEvents[i]);
//~ fprintf(fp,"%lf\n", peakEvents[i]);
}
peakEvents[foundNPeaks-1] = hADC->Integral(hADC->FindBin(peakMidpointX[foundNPeaks-1]), hADC->FindBin(1130.));
if(dbgprint) printf("I(%.1f, %.1f) = %.1lf\n", peakMidpointX[foundNPeaks-1], 1130., peakEvents[foundNPeaks-1]);
//~ fprintf(fp,"%lf\n", peakEvents[foundNPeaks-1]);
double N0all = -TMath::Log(peakEvents[0]/hADC->GetEntries());
double N01 = peakEvents[1]/peakEvents[0];
double N02 = 2*peakEvents[2]/peakEvents[1];
if(dbgprint) printf("Poisson <N>: N0all -> %.3lf | N01 -> %.3lf | N12 -> %.3lf\n", N0all, N01, N02);
sprintf(sbuff, "<N> = %.3lf", N0all);
leg0->AddEntry((TH1F*)hADC->Clone(),sbuff, "");
sprintf(sbuff, "1 CPH = %.0lf", foundPeakX[sortedPeakIndex[1]]);
leg0->AddEntry((TH1F*)hADC->Clone(),sbuff, "");
leg0->Draw();
}
double N_adc_integral = hADC->Integral(hADC->FindBin(peakMidpointX[1]), hADC->FindBin(1000.));
double N_poisson = (1 - TMath::Exp(-N0all))*hADC->GetEntries();
printf("hADC->GetEntries() = %.0lf\n", hADC->GetEntries());
printf("N_adc_integral = %.0lf | N_poisson = %.0lf\n", N_adc_integral, N_poisson);
 
sprintf(hname, "hadc_cut%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetLineColor(kRed);
hp1d->DrawClone("SAME");
// -------------------------- TDC 0 ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(1);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
hp1d->SetTitle("SiPM;Time [ns]");
hp1d->GetXaxis()->SetRangeUser(-5,5);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
hp1d->DrawClone();
printf("hTDC->GetEntries() = %.0lf\n", hp1d->GetEntries());
double N_tdc_integral = hp1d->Integral(hp1d->FindBin(-10), hp1d->FindBin(10));
printf("N_tdc_integral = %.0lf\n", N_tdc_integral);
// -----------------------------------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(0);
sprintf(hname, "hcor%d", ich);
hp2d = DrTH2F(dir, hname, "");
hp2d->SetTitle(";Charge [200 fC/bin];cTime [ns]");
//~ hp1d->GetXaxis()->SetRangeUser(0,2000);
//~ hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
//~ hp1d->SetLineColor(kBlack);
hp2d->DrawClone("COLZ");
// -------------------------- cTDC 0 ----------------------------------
(c[cc]->cd(++ccccdi))->SetLogy(0);
sprintf(hname, "hctdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetTitle("SiPM;cTime [ns]");
//~ hp1d->GetXaxis()->SetRangeUser(-5,5);
//~ //hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
//~ hp1d->DrawClone();
plotCorTDC(hp1d, "SiPM;cTime [ns]", -0.5, 0.45, -1., 2);
printf("hcTDC->GetEntries() = %.0lf\n", hp1d->GetEntries());
double N_ctdc_integral = hp1d->Integral(hp1d->FindBin(-2), hp1d->FindBin(2));
printf("N_ctdc_integral = %.0lf\n", N_ctdc_integral);
printf("N_ctdc_integral/N_poisson = %.3lf\n", N_ctdc_integral/N_poisson);
printf("N_adc_integral/N_poisson = %.3lf\n", N_adc_integral/N_poisson);
printf("N_ctdc_integral/N_adc_integral = %.3lf\n", N_ctdc_integral/N_adc_integral);
//~ sprintf(hname, "htdc_cut%d", ich);
//~ hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetLineColor(kRed);
//~ hp1d->DrawClone("SAME");
sprintf(fullname, "gif/b_%s.gif", fname); c[cc]->SaveAs(fullname);
}
 
//~ sprintf(fullname, "gif/%s_c.gif", fname); c[cc]->SaveAs(fullname);
//~ }
// -------------------------------------------------------------------
 
if( strchr(plopt, 'g') != NULL ) {
gStyle->SetOptStat(0);
gStyle->SetOptFit(0);
c[++cc] = new TCanvas("g", "g", 640, 0, 640, 360);
int ccccdi = 0;
int ich = 15;
(c[cc]->cd(++ccccdi))->SetLogy(0);
sprintf(hname, "htdc%d", ich);
hp1d = DrTH1F(dir, hname, "");
//~ hp1d->SetTitle("SiPM;cTime [ns]");
//~ hp1d->GetXaxis()->SetRangeUser(-5,5);
//~ //hp1d->GetYaxis()->SetRangeUser(0.9,hp1d->GetMaximum()*1.1);
hp1d->SetLineColor(kBlack);
//~ hp1d->DrawClone();
sprintf(hname, "Trigger(ch.%d)-Trigger(ch.31);Time [ns]", ich);
plotCorTDC(hp1d, hname, -0.25, 0.25, -0.5, 0.5);
sprintf(fullname, "gif/g_%s.gif", fname); c[cc]->SaveAs(fullname);
}
// -------------------------------------------------------------------------------
}