diff --git a/.gitignore b/.gitignore index fcdfe5c402494534d9b198c9d6d7864dfd1d34c0..43334f1fd689d36db42fcb562b39bcf4bdef449e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,15 +7,12 @@ bck/* hcana raw .root_history -CALIBRATION/*/data_files/* -CALIBRATION/*/root_files/* HISTOGRAMS/* REPORT_OUTPUT/* log/* full_hms.sh full_shms.sh onlineGUI/Config/kpp_* -run_* *.d *.so *Auto* diff --git a/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.aux b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.aux new file mode 100644 index 0000000000000000000000000000000000000000..c02c4136d19dd3cca6bc59b4a2cbd287d21e835d --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.aux @@ -0,0 +1,4 @@ +\relax +\@writefile{toc}{\contentsline {section}{\numberline {1}How to Perform a Calibration}{1}} +\@writefile{toc}{\contentsline {section}{\numberline {2}Data Cuts and Histogram Creation}{1}} +\@writefile{toc}{\contentsline {section}{\numberline {3}Calibration}{3}} diff --git a/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.dvi b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.dvi new file mode 100644 index 0000000000000000000000000000000000000000..3bc11bee8785d25155bdc6c018f35ace735e5281 Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.dvi differ diff --git a/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.log b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.log new file mode 100644 index 0000000000000000000000000000000000000000..8b69a4f1db01227d664728ab6d275f1df0c511db --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.log @@ -0,0 +1,260 @@ +This is pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6) (format=latex 2013.9.19) 16 JUN 2017 12:27 +entering extended mode + %&-line parsing enabled. +**\nonstopmode\input Calibration_Description.tex +(./Calibration_Description.tex (/usr/share/texmf/tex/latex/base/article.cls +Document Class: article 2005/09/16 v1.4f Standard LaTeX document class +(/usr/share/texmf/tex/latex/base/size12.clo +File: size12.clo 2005/09/16 v1.4f Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texmf/tex/latex/base/fontenc.sty +Package: fontenc 2005/09/27 v1.99g Standard LaTeX package + +(/usr/share/texmf/tex/latex/base/t1enc.def +File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file +LaTeX Font Info: Redeclaring font encoding T1 on input line 43. +)) +(/usr/share/texmf/tex/latex/lm/lmodern.sty +Package: lmodern 2007/01/14 v1.3 Latin Modern Fonts +LaTeX Font Info: Overwriting symbol font `operators' in version `normal' +(Font) OT1/cmr/m/n --> OT1/lmr/m/n on input line 13. +LaTeX Font Info: Overwriting symbol font `letters' in version `normal' +(Font) OML/cmm/m/it --> OML/lmm/m/it on input line 14. +LaTeX Font Info: Overwriting symbol font `symbols' in version `normal' +(Font) OMS/cmsy/m/n --> OMS/lmsy/m/n on input line 15. +LaTeX Font Info: Overwriting symbol font `largesymbols' in version `normal' +(Font) OMX/cmex/m/n --> OMX/lmex/m/n on input line 16. +LaTeX Font Info: Overwriting symbol font `operators' in version `bold' +(Font) OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 17. +LaTeX Font Info: Overwriting symbol font `letters' in version `bold' +(Font) OML/cmm/b/it --> OML/lmm/b/it on input line 18. +LaTeX Font Info: Overwriting symbol font `symbols' in version `bold' +(Font) OMS/cmsy/b/n --> OMS/lmsy/b/n on input line 19. +LaTeX Font Info: Overwriting symbol font `largesymbols' in version `bold' +(Font) OMX/cmex/m/n --> OMX/lmex/m/n on input line 20. +LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `normal' +(Font) OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 22. +LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `normal' +(Font) OT1/cmss/m/n --> OT1/lmss/m/n on input line 23. +LaTeX Font Info: Overwriting math alphabet `\mathit' in version `normal' +(Font) OT1/cmr/m/it --> OT1/lmr/m/it on input line 24. +LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `normal' +(Font) OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 25. +LaTeX Font Info: Overwriting math alphabet `\mathbf' in version `bold' +(Font) OT1/cmr/bx/n --> OT1/lmr/bx/n on input line 26. +LaTeX Font Info: Overwriting math alphabet `\mathsf' in version `bold' +(Font) OT1/cmss/bx/n --> OT1/lmss/bx/n on input line 27. +LaTeX Font Info: Overwriting math alphabet `\mathit' in version `bold' +(Font) OT1/cmr/bx/it --> OT1/lmr/bx/it on input line 28. +LaTeX Font Info: Overwriting math alphabet `\mathtt' in version `bold' +(Font) OT1/cmtt/m/n --> OT1/lmtt/m/n on input line 29. +) +(/usr/share/texmf/tex/latex/setspace/setspace.sty +Package: setspace 2000/12/01 6.7 Contributed and Supported LaTeX2e package + +Package: `setspace' 6.7 <2000/12/01> +) (/usr/share/texmf/tex/latex/amsmath/amsmath.sty +Package: amsmath 2000/07/18 v2.13 AMS math features +\@mathmargin=\skip43 + +For additional information on amsmath, use the `?' option. +(/usr/share/texmf/tex/latex/amsmath/amstext.sty +Package: amstext 2000/06/29 v2.01 + +(/usr/share/texmf/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 +\@emptytoks=\toks14 +\ex@=\dimen103 +)) +(/usr/share/texmf/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d +\pmbraise@=\dimen104 +) +(/usr/share/texmf/tex/latex/amsmath/amsopn.sty +Package: amsopn 1999/12/14 v2.01 operator names +) +\inf@bad=\count87 +LaTeX Info: Redefining \frac on input line 211. +\uproot@=\count88 +\leftroot@=\count89 +LaTeX Info: Redefining \overline on input line 307. +\classnum@=\count90 +\DOTSCASE@=\count91 +LaTeX Info: Redefining \ldots on input line 379. +LaTeX Info: Redefining \dots on input line 382. +LaTeX Info: Redefining \cdots on input line 467. +\Mathstrutbox@=\box26 +\strutbox@=\box27 +\big@size=\dimen105 +LaTeX Font Info: Redeclaring font encoding OML on input line 567. +LaTeX Font Info: Redeclaring font encoding OMS on input line 568. +\macc@depth=\count92 +\c@MaxMatrixCols=\count93 +\dotsspace@=\muskip10 +\c@parentequation=\count94 +\dspbrk@lvl=\count95 +\tag@help=\toks15 +\row@=\count96 +\column@=\count97 +\maxfields@=\count98 +\andhelp@=\toks16 +\eqnshift@=\dimen106 +\alignsep@=\dimen107 +\tagshift@=\dimen108 +\tagwidth@=\dimen109 +\totwidth@=\dimen110 +\lineht@=\dimen111 +\@envbody=\toks17 +\multlinegap=\skip44 +\multlinetaggap=\skip45 +\mathdisplay@stack=\toks18 +LaTeX Info: Redefining \[ on input line 2666. +LaTeX Info: Redefining \] on input line 2667. +) +(/usr/share/texmf/tex/latex/amsfonts/amssymb.sty +Package: amssymb 2002/01/22 v2.2d + +(/usr/share/texmf/tex/latex/amsfonts/amsfonts.sty +Package: amsfonts 2001/10/25 v2.2f +\symAMSa=\mathgroup4 +\symAMSb=\mathgroup5 +LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' +(Font) U/euf/m/n --> U/euf/b/n on input line 132. +)) +(/usr/share/texmf/tex/latex/graphics/graphicx.sty +Package: graphicx 1999/02/16 v1.0f Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/share/texmf/tex/latex/graphics/keyval.sty +Package: keyval 1999/03/16 v1.13 key=value parser (DPC) +\KV@toks@=\toks19 +) +(/usr/share/texmf/tex/latex/graphics/graphics.sty +Package: graphics 2006/02/20 v1.0o Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texmf/tex/latex/graphics/trig.sty +Package: trig 1999/03/16 v1.09 sin cos tan (DPC) +) +(/usr/share/texmf/tex/latex/config/graphics.cfg +File: graphics.cfg 2007/01/18 v1.5 graphics configuration of teTeX/TeXLive +) +Package graphics Info: Driver file: dvips.def on input line 90. + +(/usr/share/texmf/tex/latex/graphics/dvips.def +File: dvips.def 1999/02/16 v3.0i Driver-dependant file (DPC,SPQR) +)) +\Gin@req@height=\dimen112 +\Gin@req@width=\dimen113 +) +(/usr/share/texmf/tex/latex/preprint/fullpage.sty +Package: fullpage 1999/02/23 1.1 (PWD) +\FP@margin=\skip46 +) +(./Calibration_Description.aux) +\openout1 = `Calibration_Description.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 13. +LaTeX Font Info: ... okay on input line 13. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 13. +LaTeX Font Info: ... okay on input line 13. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 13. +LaTeX Font Info: ... okay on input line 13. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 13. +LaTeX Font Info: ... okay on input line 13. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 13. +LaTeX Font Info: ... okay on input line 13. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 13. +LaTeX Font Info: ... okay on input line 13. +LaTeX Font Info: Try loading font information for T1+lmr on input line 13. + (/usr/share/texmf/tex/latex/lm/t1lmr.fd +File: t1lmr.fd 2007/01/14 v1.3 Font defs for Latin Modern +) +LaTeX Font Info: Try loading font information for OT1+lmr on input line 18. + +(/usr/share/texmf/tex/latex/lm/ot1lmr.fd +File: ot1lmr.fd 2007/01/14 v1.3 Font defs for Latin Modern +) +LaTeX Font Info: Try loading font information for OML+lmm on input line 18. + +(/usr/share/texmf/tex/latex/lm/omllmm.fd +File: omllmm.fd 2007/01/14 v1.3 Font defs for Latin Modern +) +LaTeX Font Info: Try loading font information for OMS+lmsy on input line 18. + + +(/usr/share/texmf/tex/latex/lm/omslmsy.fd +File: omslmsy.fd 2007/01/14 v1.3 Font defs for Latin Modern +) +LaTeX Font Info: Try loading font information for OMX+lmex on input line 18. + + +(/usr/share/texmf/tex/latex/lm/omxlmex.fd +File: omxlmex.fd 2007/01/14 v1.3 Font defs for Latin Modern +) +LaTeX Font Info: External font `lmex10' loaded for size +(Font) <14.4> on input line 18. +LaTeX Font Info: External font `lmex10' loaded for size +(Font) <10> on input line 18. +LaTeX Font Info: External font `lmex10' loaded for size +(Font) <7> on input line 18. +LaTeX Font Info: Try loading font information for U+msa on input line 18. + +(/usr/share/texmf/tex/latex/amsfonts/umsa.fd +File: umsa.fd 2002/01/19 v2.2g AMS font definitions +) +LaTeX Font Info: Try loading font information for U+msb on input line 18. + +(/usr/share/texmf/tex/latex/amsfonts/umsb.fd +File: umsb.fd 2002/01/19 v2.2g AMS font definitions +) +LaTeX Font Info: External font `lmex10' loaded for size +(Font) <12> on input line 25. +LaTeX Font Info: External font `lmex10' loaded for size +(Font) <8> on input line 25. +LaTeX Font Info: External font `lmex10' loaded for size +(Font) <6> on input line 25. + +Underfull \hbox (badness 10000) in paragraph at lines 25--26 + + [] + +[1 + +] +Overfull \hbox (26.44315pt too wide) in paragraph at lines 27--28 +\T1/lmr/m/n/12 re-play script. The leaves of in-ter-est are ``P.hgcer.goodAdcPu +lseInt'', ``P.hgcer.goodAdcPulseAmp'', + [] + + +Underfull \hbox (badness 10000) in paragraph at lines 27--28 + + [] + +[2] +Underfull \hbox (badness 10000) in paragraph at lines 39--40 + + [] + +[3] [4] (./Calibration_Description.aux) ) +Here is how much of TeX's memory you used: + 1799 strings out of 256217 + 20942 string characters out of 1917095 + 67256 words of memory out of 1500000 + 5060 multiletter control sequences out of 10000+200000 + 50552 words of font info for 54 fonts, out of 1200000 for 2000 + 645 hyphenation exceptions out of 8191 + 27i,8n,24p,1091b,197s stack positions out of 5000i,500n,6000p,200000b,15000s + +Output written on Calibration_Description.dvi (4 pages, 7892 bytes). diff --git a/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.tex b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.tex new file mode 100644 index 0000000000000000000000000000000000000000..b0f72b9ab79b5081fcba4d37c4f52f7c67a90866 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/README/Calibration_Description.tex @@ -0,0 +1,42 @@ +\documentclass[12pt,letterpaper]{article} + +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{setspace} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{graphicx} +\usepackage{fullpage} + +\doublespacing + +\begin{document} + +\title{SHMS Heavy Gas Cherenkov (HGC) Detector Calibration Procedure} +\author{Ryan Ambrose -- gra353@uregina.ca} +\date{} +\maketitle + +\section{How to Perform a Calibration} +From the main directory (hallc\_replay/CALIBRATION/shms\_hgc\_calib) run the script Calibration.C (in terminal type: root Calibration.C). The terminal will then ask for a run number; once entered the script will output three canvases for each photomultiplier tube (PMT): heavy gas Cherenkov (HGC) spectra after several cuts to determine single photoelectron (SPE) peak, calibration of full ADC spectra with calibration effectiveness, and a second round of calibration based off the slope of the previous. Calibration was successful if slope of the line is approximately 1. + +\section{Data Cuts and Histogram Creation} + +After the raw cdaq data are replayed using replay\_shms.C, it is fed into a script designed to sort the data event-by-event. For each event, the script extracts the pulse amplitude, integral, and timing information from the HGC, shower/preshower, noble gas Cherenkov (NGC), Aerogel, and various other quantities from the trigger, drift chamber, and hodoscopes for timing information. Each event corresponds to a single trigger, and the first cut performed is the requirement that the quantity $ntracks$ is equal to one, i.e. there is one and only one good track for the event. This is to eliminate the large number of signals coming from sources outside of the beam path. Next, several histograms are filled for troubleshooting and verifying the correct operation of the script. To reduce run time, the filling of histograms for other detectors may be omitted, since they have little relevance for the HGC. A quantity which will be useful is the pulse integral for each detector for each event, for particle identification. \\ + +For the actual HGC loop, it is important to understand how the data is output from the replay script. The leaves of interest are ``P.hgcer.goodAdcPulseInt'', ``P.hgcer.goodAdcPulseAmp'', and ``P.hgcer.goodAdcPulseTime'', which have inherent in them cuts already. They require that the FPGA did not fail and the hit must have occured within the prompt FADC timing peak (500. < adcTime < 2500.). The quantity PulseInt refers to the pulse integral, summing the voltage at each sampling point of the pulse. PulseAmp refers to the pulse amplitude (maximum voltage achieved) and PulseTime refers to the time it takes the pulse to reach the half-maximum point from the initial sampling. Each of these leaves are then indexed into arrays of length four corresponding to each PMT. The resulting histograms are highly sparsified due to a signal of 0.0 being filled for each event the HGC doesn't record any measurement (such as tracks not going through the HGC). \\ + +Two major cuts are then performed: on particle ID and particle location. Particle ID is determined by comparing the pulse integral between the NGC and the sum of the shower and pre-shower (SHWR/PSHWR). Naturally, electrons deposit more energy when they traverse a medium which dictates the division between electrons and pions. Particle location is determined by using the tracking replayed data and the geometric location of the HGC mirrors. A small angle of deflection from the optical axis is assumed, simplifying the calculation of particle location in the HGC to: +\begin{eqnarray*} +y_{HGC} = y_{Focal Plane} + y'_{Focal Plane}* z_{HGC} \\ +x_{HGC} = x_{Focal Plane} + x'_{Focal Plane}* z_{HGC} \\ +z_{HGC} = 156.27\text{cm (From focal plane)} +\end{eqnarray*} +The mirror plane of the HGC is divided into four quadrants based of detector geometry. Individual histograms are filled for each type of particle in each quadrant, indexed by PMT, and these are used in the actual calibration script. + +\section{Calibration} + +To perform the calibration, it is assumed the ADC pulse integral and corresponding number of photoelectrons have a linear relationship. In the first step ADC histograms for the HGC with cuts on particle ID and location are used to visolate SPE events. As a note, each PMT looking at its own quadrant (signal PMT 1 gets from quadrant 1) is ignored since there are many fewer SPE events. The ROOT class TSpectrum, specifically the method search(), is used to locate the peak of the pedistle and SPE. The data is fit with a sum of two Gaussian distributions with their mean restricted to the prediction from TSpectrum within $\pm$10 ADC channels. The resultant mean for the SPE for electrons is then averaged and used as a first guess for a calibration. Pion events are not used due to typically low statistics. \\ + +Once the calibration is obtained the full spectra, for each PMT, is scaled from ADC channel to photoelectron and normalized by its integral. This calibrated spectra is then fitted by a Poisson distribution on the right hand side to remove the non-Gaussian characteristics of that larger photoelectron peaks (remove signal from approximately 5.5 photoelectrons and onward). Once the Poisson characteristics are subtracted, the final spectrum is fit with a sum of three Gaussians to ensure the peaks correspond to integer photoelectron values. As a verification, a plot of photoelectron position is created to check for linearity. After this first iteration, the calibration constant is multiplied by the linear slope and the process is repeated. Both calibration constants are outputted so that the better fit can be determined. +\end{document} diff --git a/CALIBRATION/shms_hgcer_calib/data_files/phgcer.param.482 b/CALIBRATION/shms_hgcer_calib/data_files/phgcer.param.482 new file mode 100644 index 0000000000000000000000000000000000000000..50129414df0752bf4af6fed8187bababf245bfbe --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/data_files/phgcer.param.482 @@ -0,0 +1,6 @@ +; Calibration constants for run482 + +phgcer_gain_calib =745, + 1.18e+03, + 420, + 495, diff --git a/CALIBRATION/shms_hgcer_calib/data_files/phgcer.param.488 b/CALIBRATION/shms_hgcer_calib/data_files/phgcer.param.488 new file mode 100644 index 0000000000000000000000000000000000000000..b1be27fcdd1150c441f08efa34b8804300aefd09 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/data_files/phgcer.param.488 @@ -0,0 +1,6 @@ +; Calibration constants for run488 + +phgcer_gain_calib =531, + 440, + 376, + 495, diff --git a/CALIBRATION/shms_hgcer_calib/root_files/.root_history b/CALIBRATION/shms_hgcer_calib/root_files/.root_history new file mode 100755 index 0000000000000000000000000000000000000000..0a7e178d206277060078ae537784eab94f30a0d6 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/root_files/.root_history @@ -0,0 +1 @@ +.q diff --git a/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_481.root b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_481.root new file mode 100644 index 0000000000000000000000000000000000000000..d355f73272e5462247ad8c67e0156e5e986f2fd0 Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_481.root differ diff --git a/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_482.root b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_482.root new file mode 100644 index 0000000000000000000000000000000000000000..55b82f7e13b465627a87adcc11b9c30baa1e6e19 Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_482.root differ diff --git a/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_483.root b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_483.root new file mode 100644 index 0000000000000000000000000000000000000000..e72e17a8cfad3f71f44e98c6b0340281dab564f4 Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_483.root differ diff --git a/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_484.root b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_484.root new file mode 100644 index 0000000000000000000000000000000000000000..ed720c6465b39ff989485ccc847dd29bb121bfd1 Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_484.root differ diff --git a/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_486.root b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_486.root new file mode 100644 index 0000000000000000000000000000000000000000..1c03688174f9204b519c1eac2be5ea1a76111306 Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_486.root differ diff --git a/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_487.root b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_487.root new file mode 100644 index 0000000000000000000000000000000000000000..1ae23ef7ecd9f8f5d729748eb968d2a2dc16cd6a Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_487.root differ diff --git a/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_488.root b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_488.root new file mode 100644 index 0000000000000000000000000000000000000000..e10f3f5b42e42e3d74c4997dbd8149fd7e8e1b76 Binary files /dev/null and b/CALIBRATION/shms_hgcer_calib/root_files/shms_calibration_488.root differ diff --git a/CALIBRATION/shms_hgcer_calib/run_calibration.C b/CALIBRATION/shms_hgcer_calib/run_calibration.C new file mode 100644 index 0000000000000000000000000000000000000000..a216f1f352a0b96547281c294a0d004b036b1609 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/run_calibration.C @@ -0,0 +1,53 @@ +//Script to run over all SHMS HGCER calibration scripts ar once and update the necessary parameter files + +void run_calibration() +{ + + //User Input Run + Int_t run_NUM; + cout << "Enter run number: "; + cin >> run_NUM; + + Int_t events_NUM; + cout << "Enter number of events: "; + cin >> events_NUM; + + //Create root and data file directories if they don't exist + gROOT->ProcessLine(".! mkdir root_files"); + gROOT->ProcessLine(".! mkdir data_files"); + + //Execute histogram creator & cutting script + gROOT->ProcessLine(Form(".x scripts/analysis.C(%d, %d)", run_NUM, events_NUM)); + + //cout << "I got here!" << endl; + + //Take those histograms and determine the calibration constants + gROOT->ProcessLine(Form(".x scripts/calib_const.C(%d, %d)", run_NUM, events_NUM)); + + //Take calibration constants and put into parameter file + ofstream output; + output.open(Form("data_files/phgcer.param.%d",run_NUM),ios::out); + output << "; Calibration constants for run" << run_NUM << endl; + output << endl; + + Double_t run_constants[4]; + cout << "To choose correct calibration constant, verify which plot is more linear." << endl; + cout << "Gain constant for PMT1: "; + cin >> run_constants[0]; + cout << endl << "Gain constant for PMT2: "; + cin >> run_constants[1]; + cout << endl << "Gain constant for PMT3: "; + cin >> run_constants[2]; + cout << endl << "Gain constant for PMT4: "; + cin >> run_constants[3]; + + output << "phgcer_gain_calib =" << setw(3) << setprecision(3) << run_constants[0] << "," << endl; + for (Int_t i=1; i < 4; i++) + { + output << setw(22) << setprecision(3) << run_constants[i] << ","; + output << endl; + } + + output.close(); + cout << "Something went wrong? Consult the README!" << endl; +} diff --git a/CALIBRATION/shms_hgcer_calib/run_calibration.C~ b/CALIBRATION/shms_hgcer_calib/run_calibration.C~ new file mode 100644 index 0000000000000000000000000000000000000000..a84c4e4e8229e87708279080a738c8b4bf9bec32 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/run_calibration.C~ @@ -0,0 +1,24 @@ +//Script to run over all SHMS HGCER calibration scripts ar once and update the necessary parameter files + +void run_calibration() +{ + + //User Input Run + Int_t run_NUM; + cout << "Enter run number: "; + cin >> run_NUM; + + //Create root and data file directories if they don't exist + gROOT->ProcessLine(".! mkdir root_files"); + + //Execute histogram creator & cutting script + gROOT->ProcessLine(Form(".x scripts/analysis.C(%d)", run_NUM)); + + cout << "I got here!" << endl; + + //Take those histograms and determine the calibration constants + gROOT->ProcessLine(Form(".x scripts/calib_const.C(%d)", run_NUM)); + + cout << "To choose correct calibration constant, verify which plot is more linear." << endl; + cout << "Something went wrong? Consult the README!" << endl; +} diff --git a/CALIBRATION/shms_hgcer_calib/scripts/Calibration_Visualization.C b/CALIBRATION/shms_hgcer_calib/scripts/Calibration_Visualization.C new file mode 100644 index 0000000000000000000000000000000000000000..4c92a36f92daf351a683cf0ecb4eec6c35199411 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/Calibration_Visualization.C @@ -0,0 +1,358 @@ +//Note: to use this script the calibration constants need to be entered manually + + +void Calibration_Visualization(Int_t RunNumber=0, Int_t EventNumber=-1) +{ + if (RunNumber == 0) + { + cout << "Enter a Run Number (-1 to exit): "; + cin >> RunNumber; + if (RunNumber <= 0) return; + cout << "Enter number of events: "; + cin >> EventNumber; + } + TFile *F = new TFile(Form("../root_files/shms_calibration_%d_%d.root", RunNumber, EventNumber)); + //Enter Calibration constants here + Double_t xscale[4] = {541.092, 432.955, 377.598, 488.450}; + + TH1F *hgc_e[4][4]; //[quadrant][pmt] + TH1F *hgc_e_npe[4][4]; + TH1F *hgc_pi[4][4]; + TH1F *hgc_pi_npe[4][4]; + + for (Int_t i=0; i<4; i++) + { + for (Int_t j=0; j<4; j++) + { + hgc_e[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_e%d", i+1, j+1)); + hgc_e[i][j]->Rebin(10); + hgc_e_npe[i][j] = new TH1F(Form("hgc_e_npe_quad%d_e%d", i+1, j+1), "Diagonal NPE with electron cut", hgc_e[i][j]->GetXaxis()->GetNbins(), hgc_e[i][j]->GetXaxis()->GetXmin()/xscale[i], hgc_e[i][j]->GetXaxis()->GetXmax()/xscale[i]); + hgc_pi[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_pi%d", i+1, j+1)); + hgc_pi[i][j]->Rebin(10); + hgc_pi_npe[i][j] = new TH1F(Form("hgc_pi_npe_quad%d_pi%d", i+1, j+1), "Diagonal NPE with pion cut", hgc_pi[i][j]->GetXaxis()->GetNbins(), hgc_pi[i][j]->GetXaxis()->GetXmin()/xscale[i], hgc_pi[i][j]->GetXaxis()->GetXmax()/xscale[i]); + for (Int_t l=0; l<hgc_e[i][j]->GetXaxis()->GetNbins(); l++) + { + Double_t y_e = hgc_e[i][j]->GetBinContent(l); + Double_t y_pi = hgc_pi[i][j]->GetBinContent(l); + hgc_e_npe[i][j]->SetBinContent(l,y_e); + hgc_pi_npe[i][j]->SetBinContent(l,y_pi); + } + } + } + TList *od_e1 = new TList; + od_e1->Add(hgc_e[1][0]), od_e1->Add(hgc_e[2][0]), od_e1->Add(hgc_e[3][0]); + TList *od_e2 = new TList; + od_e2->Add(hgc_e[0][1]), od_e2->Add(hgc_e[2][1]), od_e2->Add(hgc_e[3][1]); + TList *od_e3 = new TList; + od_e3->Add(hgc_e[0][2]), od_e3->Add(hgc_e[3][2]), od_e3->Add(hgc_e[1][2]); + TList *od_e4 = new TList; + od_e4->Add(hgc_e[1][3]), od_e4->Add(hgc_e[2][3]), od_e4->Add(hgc_e[0][3]); + TList *od_pi1 = new TList; + od_pi1->Add(hgc_pi[1][0]), od_pi1->Add(hgc_pi[2][0]), od_pi1->Add(hgc_pi[3][0]); + TList *od_pi2 = new TList; + od_pi2->Add(hgc_pi[0][1]), od_pi2->Add(hgc_pi[2][1]), od_pi2->Add(hgc_pi[3][1]); + TList *od_pi3 = new TList; + od_pi3->Add(hgc_pi[0][2]), od_pi3->Add(hgc_pi[3][2]), od_pi3->Add(hgc_pi[1][2]); + TList *od_pi4 = new TList; + od_pi4->Add(hgc_pi[1][3]), od_pi4->Add(hgc_pi[2][3]), od_pi4->Add(hgc_pi[0][3]); + TList *all_e1 = new TList; + all_e1->Add(hgc_e[0][0]), all_e1->Add(hgc_e[1][0]), all_e1->Add(hgc_e[2][0]), all_e1->Add(hgc_e[3][0]); + TList *all_e2 = new TList; + all_e2->Add(hgc_e[0][1]), all_e2->Add(hgc_e[1][1]), all_e2->Add(hgc_e[2][1]), all_e2->Add(hgc_e[3][1]); + TList *all_e3 = new TList; + all_e3->Add(hgc_e[0][2]), all_e3->Add(hgc_e[1][2]), all_e3->Add(hgc_e[2][2]), all_e3->Add(hgc_e[3][2]); + TList *all_e4 = new TList; + all_e4->Add(hgc_e[0][3]), all_e4->Add(hgc_e[1][3]), all_e4->Add(hgc_e[2][3]), all_e4->Add(hgc_e[3][3]); + TList *all_pi1 = new TList; + all_pi1->Add(hgc_pi[0][0]), all_pi1->Add(hgc_pi[1][0]), all_pi1->Add(hgc_pi[2][0]), all_pi1->Add(hgc_pi[3][0]); + TList *all_pi2 = new TList; + all_pi2->Add(hgc_pi[0][1]), all_pi2->Add(hgc_pi[1][1]), all_pi2->Add(hgc_pi[2][1]), all_pi2->Add(hgc_pi[3][1]); + TList *all_pi3 = new TList; + all_pi3->Add(hgc_pi[0][2]), all_pi3->Add(hgc_pi[1][2]), all_pi3->Add(hgc_pi[2][2]), all_pi3->Add(hgc_pi[3][2]); + TList *all_pi4 = new TList; + all_pi4->Add(hgc_pi[0][3]), all_pi4->Add(hgc_pi[1][3]), all_pi4->Add(hgc_pi[2][3]), all_pi4->Add(hgc_pi[3][3]); + + TList *full = new TList; + for (Int_t i=0; i<4; i++) + { + for (Int_t j=0; j<4; j++) + { + full->Add(hgc_e[i][j]), full->Add(hgc_pi[i][j]); + } + } + + TH1F *offd_e1 = (TH1F*)hgc_e[0][0]->Clone("offd_e1"); + offd_e1->Reset(); + offd_e1->Merge(od_e1); + + TH1F *offd_e2 = (TH1F*)hgc_e[0][1]->Clone("offd_e2"); + offd_e2->Reset(); + offd_e2->Merge(od_e2); + + TH1F *offd_e3 = (TH1F*)hgc_e[0][2]->Clone("offd_e3"); + offd_e3->Reset(); + offd_e3->Merge(od_e3); + + TH1F *offd_e4 = (TH1F*)hgc_e[0][3]->Clone("offd_e4"); + offd_e4->Reset(); + offd_e4->Merge(od_e4); + + TH1F *alld_e1 = (TH1F*)hgc_e[0][0]->Clone("alld_e1"); + alld_e1->Reset(); + alld_e1->Merge(all_e1); + + TH1F *alld_e2 = (TH1F*)hgc_e[0][1]->Clone("alld_e2"); + alld_e2->Reset(); + alld_e2->Merge(all_e2); + + TH1F *alld_e3 = (TH1F*)hgc_e[0][2]->Clone("alld_e3"); + alld_e3->Reset(); + alld_e3->Merge(all_e3); + + TH1F *alld_e4 = (TH1F*)hgc_e[0][3]->Clone("alld_e4"); + alld_e4->Reset(); + alld_e4->Merge(all_e4); + + TH1F *offd_pi1 = (TH1F*)hgc_pi[0][0]->Clone("offd_pi1"); + offd_pi1->Reset(); + offd_pi1->Merge(od_pi1); + + TH1F *offd_pi2 = (TH1F*)hgc_pi[0][1]->Clone("offd_pi2"); + offd_pi2->Reset(); + offd_pi2->Merge(od_pi2); + + TH1F *offd_pi3 = (TH1F*)hgc_pi[0][2]->Clone("offd_pi3"); + offd_pi3->Reset(); + offd_pi3->Merge(od_pi3); + + TH1F *offd_pi4 = (TH1F*)hgc_pi[0][3]->Clone("offd_pi4"); + offd_pi4->Reset(); + offd_pi4->Merge(od_pi4); + + TH1F *alld_pi1 = (TH1F*)hgc_pi[0][0]->Clone("alld_pi1"); + alld_pi1->Reset(); + alld_pi1->Merge(all_pi1); + + TH1F *alld_pi2 = (TH1F*)hgc_pi[0][1]->Clone("alld_pi2"); + alld_pi2->Reset(); + alld_pi2->Merge(all_pi2); + + TH1F *alld_pi3 = (TH1F*)hgc_pi[0][2]->Clone("alld_pi3"); + alld_pi3->Reset(); + alld_pi3->Merge(all_pi3); + + TH1F *alld_pi4 = (TH1F*)hgc_pi[0][3]->Clone("alld_pi4"); + alld_pi4->Reset(); + alld_pi4->Merge(all_pi4); + + TH1F *alld_full = (TH1F*)hgc_e[0][0]->Clone("alld_full"); + alld_full->Reset(); + alld_full->Merge(full); + + TH1F *offd_e1_npe, *offd_pi1_npe; + TH1F *offd_e2_npe, *offd_pi2_npe; + TH1F *offd_e3_npe, *offd_pi3_npe; + TH1F *offd_e4_npe, *offd_pi4_npe; + + offd_e1_npe = new TH1F("offd_e1_npe", "Sum of Off Diagonal electrons", offd_e1->GetXaxis()->GetNbins(), offd_e1->GetXaxis()->GetXmin()/xscale[0], offd_e1->GetXaxis()->GetXmax()/xscale[0]); + + offd_e2_npe = new TH1F("offd_e2_npe", "Sum of Off Diagonal PMT2", offd_e2->GetXaxis()->GetNbins(), offd_e2->GetXaxis()->GetXmin()/xscale[1], offd_e2->GetXaxis()->GetXmax()/xscale[1]); + + offd_e3_npe = new TH1F("offd_e3_npe", "Sum of Off Diagonal PMT3", offd_e3->GetXaxis()->GetNbins(), offd_e3->GetXaxis()->GetXmin()/xscale[2], offd_e3->GetXaxis()->GetXmax()/xscale[2]); + + offd_e4_npe = new TH1F("offd_e4_npe", "Sum of Off Diagonal PMT4", offd_e4->GetXaxis()->GetNbins(), offd_e4->GetXaxis()->GetXmin()/xscale[3], offd_e4->GetXaxis()->GetXmax()/xscale[3]); + + offd_pi1_npe = new TH1F("offd_pi1_npe", "Sum of Off Diagonal pions", offd_pi1->GetXaxis()->GetNbins(), offd_pi1->GetXaxis()->GetXmin()/xscale[0], offd_pi1->GetXaxis()->GetXmax()/xscale[0]); + + offd_pi2_npe = new TH1F("offd_pi2_npe", "Sum of Off Diagonal PMT2", offd_pi2->GetXaxis()->GetNbins(), offd_pi2->GetXaxis()->GetXmin()/xscale[1], offd_pi2->GetXaxis()->GetXmax()/xscale[1]); + + offd_pi3_npe = new TH1F("offd_pi3_npe", "Sum of Off Diagonal PMT3", offd_pi3->GetXaxis()->GetNbins(), offd_pi3->GetXaxis()->GetXmin()/xscale[2], offd_pi3->GetXaxis()->GetXmax()/xscale[2]); + + offd_pi4_npe = new TH1F("offd_pi4_npe", "Sum of Off Diagonal PMT4", offd_pi4->GetXaxis()->GetNbins(), offd_pi4->GetXaxis()->GetXmin()/xscale[3], offd_pi4->GetXaxis()->GetXmax()/xscale[3]); + + + for (Int_t l=0; l < offd_e1->GetXaxis()->GetNbins(); l++) + { + Double_t y_e_1 = offd_e1->GetBinContent(l); + Double_t y_e_2 = offd_e2->GetBinContent(l); + Double_t y_e_3 = offd_e3->GetBinContent(l); + Double_t y_e_4 = offd_e4->GetBinContent(l); + Double_t y_pi_1 = offd_pi1->GetBinContent(l); + Double_t y_pi_2 = offd_pi2->GetBinContent(l); + Double_t y_pi_3 = offd_pi3->GetBinContent(l); + Double_t y_pi_4 = offd_pi4->GetBinContent(l); + offd_e1_npe->SetBinContent(l,y_e_1); + offd_e2_npe->SetBinContent(l,y_e_2); + offd_e3_npe->SetBinContent(l,y_e_3); + offd_e4_npe->SetBinContent(l,y_e_4); + offd_pi1_npe->SetBinContent(l,y_pi_1); + offd_pi2_npe->SetBinContent(l,y_pi_2); + offd_pi3_npe->SetBinContent(l,y_pi_3); + offd_pi4_npe->SetBinContent(l,y_pi_4); + } + + TH1F *alld_e1_npe, *alld_pi1_npe; + TH1F *alld_e2_npe, *alld_pi2_npe; + TH1F *alld_e3_npe, *alld_pi3_npe; + TH1F *alld_e4_npe, *alld_pi4_npe; + + alld_e1_npe = new TH1F("alld_e1_npe", "Sum of All electrons", alld_e1->GetXaxis()->GetNbins(), alld_e1->GetXaxis()->GetXmin()/xscale[0], alld_e1->GetXaxis()->GetXmax()/xscale[0]); + + alld_e2_npe = new TH1F("alld_e2_npe", "Sum of All Diagonal PMT2", alld_e2->GetXaxis()->GetNbins(), alld_e2->GetXaxis()->GetXmin()/xscale[1], alld_e2->GetXaxis()->GetXmax()/xscale[1]); + + alld_e3_npe = new TH1F("alld_e3_npe", "Sum of All Diagonal PMT3", alld_e3->GetXaxis()->GetNbins(), alld_e3->GetXaxis()->GetXmin()/xscale[2], alld_e3->GetXaxis()->GetXmax()/xscale[2]); + + alld_e4_npe = new TH1F("alld_e4_npe", "Sum of All Diagonal PMT4", alld_e4->GetXaxis()->GetNbins(), alld_e4->GetXaxis()->GetXmin()/xscale[3], alld_e4->GetXaxis()->GetXmax()/xscale[3]); + + alld_pi1_npe = new TH1F("alld_pi1_npe", "Sum of All pions", alld_pi1->GetXaxis()->GetNbins(), alld_pi1->GetXaxis()->GetXmin()/xscale[0], alld_pi1->GetXaxis()->GetXmax()/xscale[0]); + + alld_pi2_npe = new TH1F("alld_pi2_npe", "Sum of All Diagonal PMT2", alld_pi2->GetXaxis()->GetNbins(), alld_pi2->GetXaxis()->GetXmin()/xscale[1], alld_pi2->GetXaxis()->GetXmax()/xscale[1]); + + alld_pi3_npe = new TH1F("alld_pi3_npe", "Sum of All Diagonal PMT3", alld_pi3->GetXaxis()->GetNbins(), alld_pi3->GetXaxis()->GetXmin()/xscale[2], alld_pi3->GetXaxis()->GetXmax()/xscale[2]); + + alld_pi4_npe = new TH1F("alld_pi4_npe", "Sum of All Diagonal PMT4", alld_pi4->GetXaxis()->GetNbins(), alld_pi4->GetXaxis()->GetXmin()/xscale[3], alld_pi4->GetXaxis()->GetXmax()/xscale[3]); + + + for (Int_t l=0; l < alld_e1->GetXaxis()->GetNbins(); l++) + { + Double_t y_e_1 = alld_e1->GetBinContent(l); + Double_t y_e_2 = alld_e2->GetBinContent(l); + Double_t y_e_3 = alld_e3->GetBinContent(l); + Double_t y_e_4 = alld_e4->GetBinContent(l); + Double_t y_pi_1 = alld_pi1->GetBinContent(l); + Double_t y_pi_2 = alld_pi2->GetBinContent(l); + Double_t y_pi_3 = alld_pi3->GetBinContent(l); + Double_t y_pi_4 = alld_pi4->GetBinContent(l); + alld_e1_npe->SetBinContent(l,y_e_1); + alld_e2_npe->SetBinContent(l,y_e_2); + alld_e3_npe->SetBinContent(l,y_e_3); + alld_e4_npe->SetBinContent(l,y_e_4); + alld_pi1_npe->SetBinContent(l,y_pi_1); + alld_pi2_npe->SetBinContent(l,y_pi_2); + alld_pi3_npe->SetBinContent(l,y_pi_3); + alld_pi4_npe->SetBinContent(l,y_pi_4); + } + + TCanvas *one = new TCanvas("one", "NPE for electrons and pions in diagonal only"); + one->Divide(2,1); + one->cd(1); + hgc_e_npe[0][0]->SetLineColor(2); + hgc_e_npe[1][1]->SetLineColor(1); + hgc_e_npe[2][2]->SetLineColor(4); + hgc_e_npe[3][3]->SetLineColor(8); + + hgc_e_npe[0][0]->GetYaxis()->SetRangeUser(0,2000); + hgc_e_npe[0][0]->Draw(); + hgc_e_npe[1][1]->Draw("same"); + hgc_e_npe[2][2]->Draw("same"); + hgc_e_npe[3][3]->Draw("same"); + + auto legend1 = new TLegend(0.5,0.7,0.7,0.9); + legend1->AddEntry("hgc_e_npe_quad1_e1","PMT 1","ep"); + legend1->AddEntry("hgc_e_npe_quad2_e2","PMT 2","ep"); + legend1->AddEntry("hgc_e_npe_quad3_e3","PMT 3","ep"); + legend1->AddEntry("hgc_e_npe_quad4_e4","PMT 4","ep"); + legend1->Draw(); + gPad->Modified(); + + one->cd(2); + hgc_pi_npe[0][0]->SetLineColor(2); + hgc_pi_npe[1][1]->SetLineColor(1); + hgc_pi_npe[2][2]->SetLineColor(4); + hgc_pi_npe[3][3]->SetLineColor(8); + + hgc_pi_npe[0][0]->GetYaxis()->SetRangeUser(0,2000); + hgc_pi_npe[0][0]->Draw(); + hgc_pi_npe[1][1]->Draw("same"); + hgc_pi_npe[2][2]->Draw("same"); + hgc_pi_npe[3][3]->Draw("same"); + + auto legend2 = new TLegend(0.5,0.7,0.7,0.9); + legend2->AddEntry("hgc_pi_npe_quad1_pi1","PMT 1","ep"); + legend2->AddEntry("hgc_pi_npe_quad2_pi2","PMT 2","ep"); + legend2->AddEntry("hgc_pi_npe_quad3_pi3","PMT 3","ep"); + legend2->AddEntry("hgc_pi_npe_quad4_pi4","PMT 4","ep"); + legend2->Draw(); + gPad->Modified(); + + TCanvas *diagonal = new TCanvas("diagonal","NPE for electrons and pions off diagonals"); + diagonal->Divide(2,1); + diagonal->cd(1); + offd_e1_npe->SetLineColor(2); + offd_e2_npe->SetLineColor(1); + offd_e3_npe->SetLineColor(4); + offd_e4_npe->SetLineColor(8); + + offd_e1_npe->Draw(); + offd_e2_npe->Draw("same"); + offd_e3_npe->Draw("same"); + offd_e4_npe->Draw("same"); + + auto legend3 = new TLegend(0.5,0.7,0.7,0.9); + legend3->AddEntry("offd_e1_npe","PMT 1","ep"); + legend3->AddEntry("offd_e2_npe","PMT 2","ep"); + legend3->AddEntry("offd_e3_npe","PMT 3","ep"); + legend3->AddEntry("offd_e4_npe","PMT 4","ep"); + legend3->Draw(); + gPad->Modified(); + + diagonal->cd(2); + offd_pi1_npe->SetLineColor(2); + offd_pi2_npe->SetLineColor(1); + offd_pi3_npe->SetLineColor(4); + offd_pi4_npe->SetLineColor(8); + + offd_pi1_npe->Draw(); + offd_pi2_npe->Draw("same"); + offd_pi3_npe->Draw("same"); + offd_pi4_npe->Draw("same"); + + auto legend4 = new TLegend(0.5,0.7,0.7,0.9); + legend4->AddEntry("offd_pi1_npe","PMT 1","ep"); + legend4->AddEntry("offd_pi2_npe","PMT 2","ep"); + legend4->AddEntry("offd_pi3_npe","PMT 3","ep"); + legend4->AddEntry("offd_pi4_npe","PMT 4","ep"); + legend4->Draw(); + gPad->Modified(); + + TCanvas *all = new TCanvas("all","NPE for electrons and pions everything"); + all->Divide(2,1); + all->cd(1); + alld_e1_npe->SetLineColor(2); + alld_e2_npe->SetLineColor(1); + alld_e3_npe->SetLineColor(4); + alld_e4_npe->SetLineColor(8); + + alld_e1_npe->Draw(); + alld_e2_npe->Draw("same"); + alld_e3_npe->Draw("same"); + alld_e4_npe->Draw("same"); + + auto legend5 = new TLegend(0.5,0.7,0.7,0.9); + legend5->AddEntry("alld_e1_npe","PMT 1","ep"); + legend5->AddEntry("alld_e2_npe","PMT 2","ep"); + legend5->AddEntry("alld_e3_npe","PMT 3","ep"); + legend5->AddEntry("alld_e4_npe","PMT 4","ep"); + legend5->Draw(); + gPad->Modified(); + + all->cd(2); + alld_pi1_npe->SetLineColor(2); + alld_pi2_npe->SetLineColor(1); + alld_pi3_npe->SetLineColor(4); + alld_pi4_npe->SetLineColor(8); + + alld_pi1_npe->Draw(); + alld_pi2_npe->Draw("same"); + alld_pi3_npe->Draw("same"); + alld_pi4_npe->Draw("same"); + + auto legend6 = new TLegend(0.5,0.7,0.7,0.9); + legend6->AddEntry("alld_pi1_npe","PMT 1","ep"); + legend6->AddEntry("alld_pi2_npe","PMT 2","ep"); + legend6->AddEntry("alld_pi3_npe","PMT 3","ep"); + legend6->AddEntry("alld_pi4_npe","PMT 4","ep"); + legend6->Draw(); + gPad->Modified(); + +} diff --git a/CALIBRATION/shms_hgcer_calib/scripts/Calibration_Visualization.C~ b/CALIBRATION/shms_hgcer_calib/scripts/Calibration_Visualization.C~ new file mode 100644 index 0000000000000000000000000000000000000000..fd4e3f860ad440cd9308229d08161b9dfa23d736 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/Calibration_Visualization.C~ @@ -0,0 +1,339 @@ +void Calibration_Visualization(Int_t RunNumber=0) +{ + if (RunNumber == 0) + { + cout << "Enter a Run Number (-1 to exit): "; + cin >> RunNumber; + if (RunNumber <= 0) return; + else TFile *F = new TFile(Form("../root_files/shms_calibration_%d.root", RunNumber)); + //Need to be more careful with file location + } + Double_t xscale[4] = {541.092, 432.955, 377.598, 488.450}; + + TH1F *hgc_e[4][4]; //[quadrant][pmt] + TH1F *hgc_e_npe[4][4]; + TH1F *hgc_pi[4][4]; + TH1F *hgc_pi_npe[4][4]; + for (Int_t i=0; i<4; i++) + { + for (Int_t j=0; j<4; j++) + { + hgc_e[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_e%d", i+1, j+1)); + hgc_e[i][j]->Rebin(10); + hgc_e_npe[i][j] = new TH1F(Form("hgc_e_npe_quad%d_e%d", i+1, j+1), "Diagonal NPE with electron cut", hgc_e[i][j]->GetXaxis()->GetNbins(), hgc_e[i][j]->GetXaxis()->GetXmin()/xscale[i], hgc_e[i][j]->GetXaxis()->GetXmax()/xscale[i]); + hgc_pi[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_pi%d", i+1, j+1)); + hgc_pi[i][j]->Rebin(10); + hgc_pi_npe[i][j] = new TH1F(Form("hgc_pi_npe_quad%d_pi%d", i+1, j+1), "Diagonal NPE with pion cut", hgc_pi[i][j]->GetXaxis()->GetNbins(), hgc_pi[i][j]->GetXaxis()->GetXmin()/xscale[i], hgc_pi[i][j]->GetXaxis()->GetXmax()/xscale[i]); + for (Int_t l=0; l<hgc_e[i][j]->GetXaxis()->GetNbins(); l++) + { + Double_t y_e = hgc_e[i][j]->GetBinContent(l); + Double_t y_pi = hgc_pi[i][j]->GetBinContent(l); + hgc_e_npe[i][j]->SetBinContent(l,y_e); + hgc_pi_npe[i][j]->SetBinContent(l,y_pi); + } + } + } + TList *od_e1 = new TList; + od_e1->Add(hgc_e[1][0]), od_e1->Add(hgc_e[2][0]), od_e1->Add(hgc_e[3][0]); + TList *od_e2 = new TList; + od_e2->Add(hgc_e[0][1]), od_e2->Add(hgc_e[2][1]), od_e2->Add(hgc_e[3][1]); + TList *od_e3 = new TList; + od_e3->Add(hgc_e[0][2]), od_e3->Add(hgc_e[3][2]), od_e3->Add(hgc_e[1][2]); + TList *od_e4 = new TList; + od_e4->Add(hgc_e[1][3]), od_e4->Add(hgc_e[2][3]), od_e4->Add(hgc_e[0][3]); + TList *od_pi1 = new TList; + od_pi1->Add(hgc_pi[1][0]), od_pi1->Add(hgc_pi[2][0]), od_pi1->Add(hgc_pi[3][0]); + TList *od_pi2 = new TList; + od_pi2->Add(hgc_pi[0][1]), od_pi2->Add(hgc_pi[2][1]), od_pi2->Add(hgc_pi[3][1]); + TList *od_pi3 = new TList; + od_pi3->Add(hgc_pi[0][2]), od_pi3->Add(hgc_pi[3][2]), od_pi3->Add(hgc_pi[1][2]); + TList *od_pi4 = new TList; + od_pi4->Add(hgc_pi[1][3]), od_pi4->Add(hgc_pi[2][3]), od_pi4->Add(hgc_pi[0][3]); + TList *all_e1 = new TList; + all_e1->Add(hgc_e[0][0]), all_e1->Add(hgc_e[1][0]), all_e1->Add(hgc_e[2][0]), all_e1->Add(hgc_e[3][0]); + TList *all_e2 = new TList; + all_e2->Add(hgc_e[0][1]), all_e2->Add(hgc_e[1][1]), all_e2->Add(hgc_e[2][1]), all_e2->Add(hgc_e[3][1]); + TList *all_e3 = new TList; + all_e3->Add(hgc_e[0][2]), all_e3->Add(hgc_e[1][2]), all_e3->Add(hgc_e[2][2]), all_e3->Add(hgc_e[3][2]); + TList *all_e4 = new TList; + all_e4->Add(hgc_e[0][3]), all_e4->Add(hgc_e[1][3]), all_e4->Add(hgc_e[2][3]), all_e4->Add(hgc_e[3][3]); + TList *all_pi1 = new TList; + all_pi1->Add(hgc_pi[0][0]), all_pi1->Add(hgc_pi[1][0]), all_pi1->Add(hgc_pi[2][0]), all_pi1->Add(hgc_pi[3][0]); + TList *all_pi2 = new TList; + all_pi2->Add(hgc_pi[0][1]), all_pi2->Add(hgc_pi[1][1]), all_pi2->Add(hgc_pi[2][1]), all_pi2->Add(hgc_pi[3][1]); + TList *all_pi3 = new TList; + all_pi3->Add(hgc_pi[0][2]), all_pi3->Add(hgc_pi[1][2]), all_pi3->Add(hgc_pi[2][2]), all_pi3->Add(hgc_pi[3][2]); + TList *all_pi4 = new TList; + all_pi4->Add(hgc_pi[0][3]), all_pi4->Add(hgc_pi[1][3]), all_pi4->Add(hgc_pi[2][3]), all_pi4->Add(hgc_pi[3][3]); + + TH1F *offd_e1 = (TH1F*)hgc_e[0][0]->Clone("offd_e1"); + offd_e1->Reset(); + offd_e1->Merge(od_e1); + + TH1F *offd_e2 = (TH1F*)hgc_e[0][1]->Clone("offd_e2"); + offd_e2->Reset(); + offd_e2->Merge(od_e2); + + TH1F *offd_e3 = (TH1F*)hgc_e[0][2]->Clone("offd_e3"); + offd_e3->Reset(); + offd_e3->Merge(od_e3); + + TH1F *offd_e4 = (TH1F*)hgc_e[0][3]->Clone("offd_e4"); + offd_e4->Reset(); + offd_e4->Merge(od_e4); + + TH1F *alld_e1 = (TH1F*)hgc_e[0][0]->Clone("alld_e1"); + alld_e1->Reset(); + alld_e1->Merge(all_e1); + + TH1F *alld_e2 = (TH1F*)hgc_e[0][1]->Clone("alld_e2"); + alld_e2->Reset(); + alld_e2->Merge(all_e2); + + TH1F *alld_e3 = (TH1F*)hgc_e[0][2]->Clone("alld_e3"); + alld_e3->Reset(); + alld_e3->Merge(all_e3); + + TH1F *alld_e4 = (TH1F*)hgc_e[0][3]->Clone("alld_e4"); + alld_e4->Reset(); + alld_e4->Merge(all_e4); + + TH1F *offd_pi1 = (TH1F*)hgc_pi[0][0]->Clone("offd_pi1"); + offd_pi1->Reset(); + offd_pi1->Merge(od_pi1); + + TH1F *offd_pi2 = (TH1F*)hgc_pi[0][1]->Clone("offd_pi2"); + offd_pi2->Reset(); + offd_pi2->Merge(od_pi2); + + TH1F *offd_pi3 = (TH1F*)hgc_pi[0][2]->Clone("offd_pi3"); + offd_pi3->Reset(); + offd_pi3->Merge(od_pi3); + + TH1F *offd_pi4 = (TH1F*)hgc_pi[0][3]->Clone("offd_pi4"); + offd_pi4->Reset(); + offd_pi4->Merge(od_pi4); + + TH1F *alld_pi1 = (TH1F*)hgc_pi[0][0]->Clone("alld_pi1"); + alld_pi1->Reset(); + alld_pi1->Merge(all_pi1); + + TH1F *alld_pi2 = (TH1F*)hgc_pi[0][1]->Clone("alld_pi2"); + alld_pi2->Reset(); + alld_pi2->Merge(all_pi2); + + TH1F *alld_pi3 = (TH1F*)hgc_pi[0][2]->Clone("alld_pi3"); + alld_pi3->Reset(); + alld_pi3->Merge(all_pi3); + + TH1F *alld_pi4 = (TH1F*)hgc_pi[0][3]->Clone("alld_pi4"); + alld_pi4->Reset(); + alld_pi4->Merge(all_pi4); + + TH1F *offd_e1_npe, *offd_pi1_npe; + TH1F *offd_e2_npe, *offd_pi2_npe; + TH1F *offd_e3_npe, *offd_pi3_npe; + TH1F *offd_e4_npe, *offd_pi4_npe; + + offd_e1_npe = new TH1F("offd_e1_npe", "Sum of Off Diagonal electrons", offd_e1->GetXaxis()->GetNbins(), offd_e1->GetXaxis()->GetXmin()/xscale[0], offd_e1->GetXaxis()->GetXmax()/xscale[0]); + + offd_e2_npe = new TH1F("offd_e2_npe", "Sum of Off Diagonal PMT2", offd_e2->GetXaxis()->GetNbins(), offd_e2->GetXaxis()->GetXmin()/xscale[1], offd_e2->GetXaxis()->GetXmax()/xscale[1]); + + offd_e3_npe = new TH1F("offd_e3_npe", "Sum of Off Diagonal PMT3", offd_e3->GetXaxis()->GetNbins(), offd_e3->GetXaxis()->GetXmin()/xscale[2], offd_e3->GetXaxis()->GetXmax()/xscale[2]); + + offd_e4_npe = new TH1F("offd_e4_npe", "Sum of Off Diagonal PMT4", offd_e4->GetXaxis()->GetNbins(), offd_e4->GetXaxis()->GetXmin()/xscale[3], offd_e4->GetXaxis()->GetXmax()/xscale[3]); + + offd_pi1_npe = new TH1F("offd_pi1_npe", "Sum of Off Diagonal pions", offd_pi1->GetXaxis()->GetNbins(), offd_pi1->GetXaxis()->GetXmin()/xscale[0], offd_pi1->GetXaxis()->GetXmax()/xscale[0]); + + offd_pi2_npe = new TH1F("offd_pi2_npe", "Sum of Off Diagonal PMT2", offd_pi2->GetXaxis()->GetNbins(), offd_pi2->GetXaxis()->GetXmin()/xscale[1], offd_pi2->GetXaxis()->GetXmax()/xscale[1]); + + offd_pi3_npe = new TH1F("offd_pi3_npe", "Sum of Off Diagonal PMT3", offd_pi3->GetXaxis()->GetNbins(), offd_pi3->GetXaxis()->GetXmin()/xscale[2], offd_pi3->GetXaxis()->GetXmax()/xscale[2]); + + offd_pi4_npe = new TH1F("offd_pi4_npe", "Sum of Off Diagonal PMT4", offd_pi4->GetXaxis()->GetNbins(), offd_pi4->GetXaxis()->GetXmin()/xscale[3], offd_pi4->GetXaxis()->GetXmax()/xscale[3]); + + + for (Int_t l=0; l < offd_e1->GetXaxis()->GetNbins(); l++) + { + Double_t y_e_1 = offd_e1->GetBinContent(l); + Double_t y_e_2 = offd_e2->GetBinContent(l); + Double_t y_e_3 = offd_e3->GetBinContent(l); + Double_t y_e_4 = offd_e4->GetBinContent(l); + Double_t y_pi_1 = offd_pi1->GetBinContent(l); + Double_t y_pi_2 = offd_pi2->GetBinContent(l); + Double_t y_pi_3 = offd_pi3->GetBinContent(l); + Double_t y_pi_4 = offd_pi4->GetBinContent(l); + offd_e1_npe->SetBinContent(l,y_e_1); + offd_e2_npe->SetBinContent(l,y_e_2); + offd_e3_npe->SetBinContent(l,y_e_3); + offd_e4_npe->SetBinContent(l,y_e_4); + offd_pi1_npe->SetBinContent(l,y_pi_1); + offd_pi2_npe->SetBinContent(l,y_pi_2); + offd_pi3_npe->SetBinContent(l,y_pi_3); + offd_pi4_npe->SetBinContent(l,y_pi_4); + } + + TH1F *alld_e1_npe, *alld_pi1_npe; + TH1F *alld_e2_npe, *alld_pi2_npe; + TH1F *alld_e3_npe, *alld_pi3_npe; + TH1F *alld_e4_npe, *alld_pi4_npe; + + alld_e1_npe = new TH1F("alld_e1_npe", "Sum of All electrons", alld_e1->GetXaxis()->GetNbins(), alld_e1->GetXaxis()->GetXmin()/xscale[0], alld_e1->GetXaxis()->GetXmax()/xscale[0]); + + alld_e2_npe = new TH1F("alld_e2_npe", "Sum of All Diagonal PMT2", alld_e2->GetXaxis()->GetNbins(), alld_e2->GetXaxis()->GetXmin()/xscale[1], alld_e2->GetXaxis()->GetXmax()/xscale[1]); + + alld_e3_npe = new TH1F("alld_e3_npe", "Sum of All Diagonal PMT3", alld_e3->GetXaxis()->GetNbins(), alld_e3->GetXaxis()->GetXmin()/xscale[2], alld_e3->GetXaxis()->GetXmax()/xscale[2]); + + alld_e4_npe = new TH1F("alld_e4_npe", "Sum of All Diagonal PMT4", alld_e4->GetXaxis()->GetNbins(), alld_e4->GetXaxis()->GetXmin()/xscale[3], alld_e4->GetXaxis()->GetXmax()/xscale[3]); + + alld_pi1_npe = new TH1F("alld_pi1_npe", "Sum of All pions", alld_pi1->GetXaxis()->GetNbins(), alld_pi1->GetXaxis()->GetXmin()/xscale[0], alld_pi1->GetXaxis()->GetXmax()/xscale[0]); + + alld_pi2_npe = new TH1F("alld_pi2_npe", "Sum of All Diagonal PMT2", alld_pi2->GetXaxis()->GetNbins(), alld_pi2->GetXaxis()->GetXmin()/xscale[1], alld_pi2->GetXaxis()->GetXmax()/xscale[1]); + + alld_pi3_npe = new TH1F("alld_pi3_npe", "Sum of All Diagonal PMT3", alld_pi3->GetXaxis()->GetNbins(), alld_pi3->GetXaxis()->GetXmin()/xscale[2], alld_pi3->GetXaxis()->GetXmax()/xscale[2]); + + alld_pi4_npe = new TH1F("alld_pi4_npe", "Sum of All Diagonal PMT4", alld_pi4->GetXaxis()->GetNbins(), alld_pi4->GetXaxis()->GetXmin()/xscale[3], alld_pi4->GetXaxis()->GetXmax()/xscale[3]); + + + for (Int_t l=0; l < alld_e1->GetXaxis()->GetNbins(); l++) + { + Double_t y_e_1 = alld_e1->GetBinContent(l); + Double_t y_e_2 = alld_e2->GetBinContent(l); + Double_t y_e_3 = alld_e3->GetBinContent(l); + Double_t y_e_4 = alld_e4->GetBinContent(l); + Double_t y_pi_1 = alld_pi1->GetBinContent(l); + Double_t y_pi_2 = alld_pi2->GetBinContent(l); + Double_t y_pi_3 = alld_pi3->GetBinContent(l); + Double_t y_pi_4 = alld_pi4->GetBinContent(l); + alld_e1_npe->SetBinContent(l,y_e_1); + alld_e2_npe->SetBinContent(l,y_e_2); + alld_e3_npe->SetBinContent(l,y_e_3); + alld_e4_npe->SetBinContent(l,y_e_4); + alld_pi1_npe->SetBinContent(l,y_pi_1); + alld_pi2_npe->SetBinContent(l,y_pi_2); + alld_pi3_npe->SetBinContent(l,y_pi_3); + alld_pi4_npe->SetBinContent(l,y_pi_4); + } + + TCanvas *one = new TCanvas("one", "NPE for electrons and pions in diagonal only"); + one->Divide(2,1); + one->cd(1); + hgc_e_npe[0][0]->SetLineColor(2); + hgc_e_npe[1][1]->SetLineColor(1); + hgc_e_npe[2][2]->SetLineColor(4); + hgc_e_npe[3][3]->SetLineColor(8); + + hgc_e_npe[0][0]->GetYaxis()->SetRangeUser(0,2000); + hgc_e_npe[0][0]->Draw(); + hgc_e_npe[1][1]->Draw("same"); + hgc_e_npe[2][2]->Draw("same"); + hgc_e_npe[3][3]->Draw("same"); + + auto legend = new TLegend(0.5,0.7,0.7,0.9); + legend->AddEntry("hgc_e_npe_quad1_e1","PMT 1","ep"); + legend->AddEntry("hgc_e_npe_quad2_e2","PMT 2","ep"); + legend->AddEntry("hgc_e_npe_quad3_e3","PMT 3","ep"); + legend->AddEntry("hgc_e_npe_quad4_e4","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + + one->cd(2); + hgc_pi_npe[0][0]->SetLineColor(2); + hgc_pi_npe[1][1]->SetLineColor(1); + hgc_pi_npe[2][2]->SetLineColor(4); + hgc_pi_npe[3][3]->SetLineColor(8); + + hgc_pi_npe[0][0]->GetYaxis()->SetRangeUser(0,2000); + hgc_pi_npe[0][0]->Draw(); + hgc_pi_npe[1][1]->Draw("same"); + hgc_pi_npe[2][2]->Draw("same"); + hgc_pi_npe[3][3]->Draw("same"); + + auto legend = new TLegend(0.5,0.7,0.7,0.9); + legend->AddEntry("hgc_pi_npe_quad1_pi1","PMT 1","ep"); + legend->AddEntry("hgc_pi_npe_quad2_pi2","PMT 2","ep"); + legend->AddEntry("hgc_pi_npe_quad3_pi3","PMT 3","ep"); + legend->AddEntry("hgc_pi_npe_quad4_pi4","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + + TCanvas *diagonal = new TCanvas("diagonal","NPE for electrons and pions off diagonals"); + diagonal->Divide(2,1); + diagonal->cd(1); + offd_e1_npe->SetLineColor(2); + offd_e2_npe->SetLineColor(1); + offd_e3_npe->SetLineColor(4); + offd_e4_npe->SetLineColor(8); + + offd_e1_npe->Draw(); + offd_e2_npe->Draw("same"); + offd_e3_npe->Draw("same"); + offd_e4_npe->Draw("same"); + + auto legend = new TLegend(0.5,0.7,0.7,0.9); + legend->AddEntry("offd_e1_npe","PMT 1","ep"); + legend->AddEntry("offd_e2_npe","PMT 2","ep"); + legend->AddEntry("offd_e3_npe","PMT 3","ep"); + legend->AddEntry("offd_e4_npe","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + + diagonal->cd(2); + offd_pi1_npe->SetLineColor(2); + offd_pi2_npe->SetLineColor(1); + offd_pi3_npe->SetLineColor(4); + offd_pi4_npe->SetLineColor(8); + + offd_pi1_npe->Draw(); + offd_pi2_npe->Draw("same"); + offd_pi3_npe->Draw("same"); + offd_pi4_npe->Draw("same"); + + auto legend = new TLegend(0.5,0.7,0.7,0.9); + legend->AddEntry("offd_pi1_npe","PMT 1","ep"); + legend->AddEntry("offd_pi2_npe","PMT 2","ep"); + legend->AddEntry("offd_pi3_npe","PMT 3","ep"); + legend->AddEntry("offd_pi4_npe","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + + TCanvas *all = new TCanvas("all","NPE for electrons and pions everything"); + all->Divide(2,1); + all->cd(1); + alld_e1_npe->SetLineColor(2); + alld_e2_npe->SetLineColor(1); + alld_e3_npe->SetLineColor(4); + alld_e4_npe->SetLineColor(8); + + alld_e1_npe->Draw(); + alld_e2_npe->Draw("same"); + alld_e3_npe->Draw("same"); + alld_e4_npe->Draw("same"); + + auto legend = new TLegend(0.5,0.7,0.7,0.9); + legend->AddEntry("alld_e1_npe","PMT 1","ep"); + legend->AddEntry("alld_e2_npe","PMT 2","ep"); + legend->AddEntry("alld_e3_npe","PMT 3","ep"); + legend->AddEntry("alld_e4_npe","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + + all->cd(2); + alld_pi1_npe->SetLineColor(2); + alld_pi2_npe->SetLineColor(1); + alld_pi3_npe->SetLineColor(4); + alld_pi4_npe->SetLineColor(8); + + alld_pi1_npe->Draw(); + alld_pi2_npe->Draw("same"); + alld_pi3_npe->Draw("same"); + alld_pi4_npe->Draw("same"); + + auto legend = new TLegend(0.5,0.7,0.7,0.9); + legend->AddEntry("alld_pi1_npe","PMT 1","ep"); + legend->AddEntry("alld_pi2_npe","PMT 2","ep"); + legend->AddEntry("alld_pi3_npe","PMT 3","ep"); + legend->AddEntry("alld_pi4_npe","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + +} diff --git a/CALIBRATION/shms_hgcer_calib/scripts/Constants.dat b/CALIBRATION/shms_hgcer_calib/scripts/Constants.dat new file mode 100644 index 0000000000000000000000000000000000000000..2fc091d745a334fc065117f6b6929f4cd78513a4 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/Constants.dat @@ -0,0 +1,23 @@ +#Template of data entries +#Voltage PMT# Calibration_constant +#2100 1 559 +2347 1 551.595 +2347 1 546.364 +2347 1 556.326 +2300 1 454.735 +2200 1 273.575 +2087 2 426.382 +2087 2 430.011 +2087 2 436.321 +2090 2 447.212 +2100 2 460.617 +2015 3 376.590 +2015 3 376.207 +2015 3 383.599 +2030 3 409.983 +2100 3 582.385 +2158 4 488.450 +2158 4 477.550 +2158 4 496.105 +2175 4 547.152 +2100 4 378.169 diff --git a/CALIBRATION/shms_hgcer_calib/scripts/analysis.C b/CALIBRATION/shms_hgcer_calib/scripts/analysis.C new file mode 100755 index 0000000000000000000000000000000000000000..14b4ee6ece6f279d05bc8aea924814956480224b --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/analysis.C @@ -0,0 +1,2343 @@ +/* +Description of...everything + +***Abbreviations*** +PMT -- Photo-Multiplier Tube +HODO -- Hodoscopes +NGC -- Nobel Gas Cherenkov +HGC -- Heavy Gas Cherenkov +DC -- Drift Chambers +SHWR -- Shower Counter +PSHWR -- Pre-Shower Counter +hist -- Histogram + +***Constants*** +clk2tdc -- Conversion from channel to ns for TDC (in trigger) +clk2adc -- Conversion from channel to ns for FADC +ndcRefTimes -- Drift Chamber Reference Times + +nbars -- Number of paddles in HODO + +maxTDCHits -- Depreciated +maxAdcHits -- Depreciated + +bins -- # of bins for the hist +adc_min -- lower range for hist +adc_max -- upper range for hist + +nhgc_z -- location of HGC focal plane downstream +nhgc_pmts -- # of PMTs in HGC + +nshwr_blks -- # of blocks in the Shower +npos_pshwr_blks -- # of positive blocks in the PreShower +nneg_pshwr_blks -- # of negative blocks in the PreShower + +pshwr_neg_adc2Gev -- Converting SHWR channel into Energy (GeV) + +hgc_adc2npe -- Converting HGC channel into photo-electrons + +maxNUMTracks -- Number of viable tracks through SHMS, should only be 1 + +***Variables*** +phgc_hits -- Comes from NData...need to figure this one out +phgc_pmt -- Which HGC PMT detected event +phgc_pulseTimeRaw -- Two modes coarse and fine: coarse is the FADC time that the pulse passed threshold (not corrected), fine is the FADC time of 50% of max (time-walk corrected) (using fine) +phgc_pulseInt -- Integral of ADC waveform +phgc_pulseAmp -- Maximum amplitude of ADC waveform !!There is a ceiling on this value; if only 1-2 samples are above threshold this value will be 0.0 + */ + +//Main Script +void analysis(Int_t RunNumber=0, Int_t EventNumber=-1) +{ + if (RunNumber == 0) + { + cout << "Enter a Run Number (-1 to exit): "; + cin >> RunNumber; + cout << "Enter number of events: "; + cin >> EventNumber; + if (RunNumber <= 0) return; + } + + //Read Appropriate ROOT file + TFile *F = new TFile(Form("../../ROOTfiles/shms_replay_%d_%d.root", RunNumber, EventNumber)); + + //Output Histograms + TFile *g = new TFile(Form("root_files/shms_calibration_%d_%d.root", RunNumber, EventNumber), "RECREATE"); + + //Function to separate e and pi in shwr vs NGC + //TF1 *shwr_ngc_id = new TF1("shwr_ngc_id","-[0]*x + [1]",-5000,12000); + //shwr_ngc_id->SetParameters(0,6); + //shwr_ngc_id->SetParameters(0.002,14); + + TF1 *shwr_ngc_id = new TF1("shwr_ngc_id","[0]/(x + [1]) + [2]",2000,12000); + shwr_ngc_id->SetParameters(1000,-2000,4); + + //Function to separate e and pi in shwr vs HGC + TF1 *shwr_hgc_id = new TF1("shwr_hgc_id", "[0]*pow(x,2) + [1]*x + [2]", -10, 20); + shwr_hgc_id->SetParameters(0.12,-1.2,6.0); + + //Declare constants...but note it's better to pull these quantities from parameter files? + + const Double_t clk2tdc = 0.100; + const Double_t clk2adc = 0.0625; + const UInt_t ndcRefTimes = 10; + + const UInt_t nbars_1x = 13; + const UInt_t nbars_1y = 13; + const UInt_t nbars_2x = 14; + const UInt_t nbars_2y = 21; + + const UInt_t maxTdcHits = 128; + const UInt_t maxAdcHits = 4; + + const UInt_t bins = 560; + const UInt_t adc_min = -1000; + const UInt_t adc_max = 7000; + + const Float_t nhgc_z = 156.27; + const UInt_t nhgc_pmts = 4; + + const Float_t nngc_z = -50.00; + const UInt_t nngc_pmts = 4; + + const UInt_t npos_aero_pmts = 7; + const UInt_t nneg_aero_pmts = 7; + + const UInt_t nshwr_blks = 224; + const UInt_t npos_pshwr_blks = 14; + const UInt_t nneg_pshwr_blks = 14; + + //Converting the ADC signal in preShower/Shower to GeV + const Double_t pshwr_neg_adc2GeV[nneg_pshwr_blks] = {1.0/466.2, 1.0/514.7, 1.0/325.5, 1.0/247.8, + 1.0/322.0, 1.0/176.2, 1.0/161.9, 1.0/197.7, + 1.0/269.9, 1.0/241.6, 1.0/193.7, 1.0/337.5, + 1.0/237.3, 1.0/82.0}; + + const Double_t pshwr_pos_adc2GeV[npos_pshwr_blks] = {1.0/411.2, 1.0/378.6, 1.0/357.9, 1.0/254.8, + 1.0/315.6, 1.0/331.0, 1.0/264.6, 1.0/305.4, + 1.0/149.8, 1.0/380.6, 1.0/183.1, 1.0/206.5, + 1.0/139.8, 1.0/163.1}; + + const Double_t shwr_adc2GeV = 0.0005; + + //Converting the ADC signal in detectors to NPE + const Double_t hgc_adcInt2npe_pulseInt[nhgc_pmts] = {1./541.092, 1./432.955, 1./377.598, 1./488.450}; + const Double_t ngc_adc2npe[nngc_pmts] = {1.0/500., 1.0/500., 1.0/500., 1.0/500.}; + const Double_t aero_neg_adc2npe[nneg_aero_pmts] = {1./586.8, 1./536.5, 1./690.5, 1./563.1, + 1./574.4, 1./432.7, 1./601.5}; + const Double_t aero_pos_adc2npe[npos_aero_pmts] = {1./496.7, 1./467.5, 1./554.3, 1./766.1, + 1./412.1, 1./517.9, 1./435.6}; + + const UInt_t maxNumTracks = 10; + + + + //Declare variables + + //Drift Chamber Times + + Double_t p1X_tdcTime, p1Y_tdcTime, p2X_tdcTime, p2Y_tdcTime; + Double_t p1T_tdcTime, p2T_tdcTime; + Double_t pT1_tdcTime, pT2_tdcTime, pT3_tdcTime; + Double_t pDCREF_tdcTime[ndcRefTimes]; + + //Hodoscope Hits + + Int_t p1X_negAdcHits, p1Y_negAdcHits, p2X_negAdcHits, p2Y_negAdcHits; + Int_t p1X_negTdcHits, p1Y_negTdcHits, p2X_negTdcHits, p2Y_negTdcHits; + Double_t p1X_negAdcPaddle[maxAdcHits*nbars_1x], p1Y_negAdcPaddle[maxAdcHits*nbars_1y]; + Double_t p2X_negAdcPaddle[maxAdcHits*nbars_2x], p2Y_negAdcPaddle[maxAdcHits*nbars_2y]; + Double_t p1X_negTdcPaddle[maxTdcHits*nbars_1x], p1Y_negTdcPaddle[maxTdcHits*nbars_1y]; + Double_t p2X_negTdcPaddle[maxTdcHits*nbars_2x], p2Y_negTdcPaddle[maxTdcHits*nbars_2y]; + Double_t p1X_negAdcPulseTime[maxAdcHits*nbars_1x], p1Y_negAdcPulseTime[maxAdcHits*nbars_1y]; + Double_t p2X_negAdcPulseTime[maxAdcHits*nbars_2x], p2Y_negAdcPulseTime[maxAdcHits*nbars_2y]; + Double_t p1X_negTdcTime[maxTdcHits*nbars_1x], p1Y_negTdcTime[maxTdcHits*nbars_1y]; + Double_t p2X_negTdcTime[maxTdcHits*nbars_2x], p2Y_negTdcTime[maxTdcHits*nbars_2y]; + Int_t p1X_posAdcHits, p1Y_posAdcHits, p2X_posAdcHits, p2Y_posAdcHits; + Int_t p1X_posTdcHits, p1Y_posTdcHits, p2X_posTdcHits, p2Y_posTdcHits; + Double_t p1X_posAdcPaddle[maxAdcHits*nbars_1x], p1Y_posAdcPaddle[maxAdcHits*nbars_1y]; + Double_t p2X_posAdcPaddle[maxAdcHits*nbars_2x], p2Y_posAdcPaddle[maxAdcHits*nbars_2y]; + Double_t p1X_posTdcPaddle[maxTdcHits*nbars_1x], p1Y_posTdcPaddle[maxTdcHits*nbars_1y]; + Double_t p2X_posTdcPaddle[maxTdcHits*nbars_2x], p2Y_posTdcPaddle[maxTdcHits*nbars_2y]; + Double_t p1X_posAdcPulseTime[maxAdcHits*nbars_1x], p1Y_posAdcPulseTime[maxAdcHits*nbars_1y]; + Double_t p2X_posAdcPulseTime[maxAdcHits*nbars_2x], p2Y_posAdcPulseTime[maxAdcHits*nbars_2y]; + Double_t p1X_posTdcTime[maxTdcHits*nbars_1x], p1Y_posTdcTime[maxTdcHits*nbars_1y]; + Double_t p2X_posTdcTime[maxTdcHits*nbars_2x], p2Y_posTdcTime[maxTdcHits*nbars_2y]; + + //"Good" Hodo Hits + Int_t p1X_nGoodHodoHits, p1Y_nGoodHodoHits, p2X_nGoodHodoHits, p2Y_nGoodHodoHits; + Double_t p1X_goodPaddle[maxAdcHits*nbars_1x], p1Y_goodPaddle[maxAdcHits*nbars_1y]; + Double_t p2X_goodPaddle[maxAdcHits*nbars_2x], p2Y_goodPaddle[maxAdcHits*nbars_2y]; + Double_t p1X_goodNegTdcTimeCorr[maxTdcHits*nbars_1x], p1Y_goodNegTdcTimeCorr[maxTdcHits*nbars_1y]; + Double_t p2X_goodNegTdcTimeCorr[maxTdcHits*nbars_2x], p2Y_goodNegTdcTimeCorr[maxTdcHits*nbars_2y]; + Double_t p1X_goodPosTdcTimeCorr[maxTdcHits*nbars_1x], p1Y_goodPosTdcTimeCorr[maxTdcHits*nbars_1y]; + Double_t p2X_goodPosTdcTimeCorr[maxTdcHits*nbars_2x], p2Y_goodPosTdcTimeCorr[maxTdcHits*nbars_2y]; + + //Hodoscope Focal Plane Times + Double_t p1X_fpTime, p1Y_fpTime, p2X_fpTime, p2Y_fpTime; + Double_t p1X_plTime, p1Y_plTime, p2X_plTime, p2Y_plTime; + Double_t phod_starttime; + + + //Aerogel ADC + Int_t paero_posHits, paero_negHits; + Double_t paero_posPmt[maxAdcHits*npos_aero_pmts], paero_negPmt[maxAdcHits*nneg_aero_pmts]; + Double_t paero_posPulseTime[maxAdcHits*npos_aero_pmts], paero_negPulseTime[maxAdcHits*nneg_aero_pmts]; + Double_t paero_posPulseInt[maxAdcHits*npos_aero_pmts], paero_negPulseInt[maxAdcHits*nneg_aero_pmts]; + + //HGC ADC + Int_t phgc_hits; + Double_t phgc_pmt[nhgc_pmts]; + Double_t phgc_pulseTimeRaw[nhgc_pmts]; //changed from maxAdcHits*nhgc_pmts to nhgc_pmts with the new GoodAdcPulse hcana change -- Ryan Ambrose May 15 + Double_t phgc_pulseAmp[nhgc_pmts]; + Double_t phgc_pulseInt[nhgc_pmts]; + + //NGC ADC + Int_t pngc_hits; + Double_t pngc_pmt[nngc_pmts]; + Double_t pngc_pulseTimeRaw[nngc_pmts]; + Double_t pngc_pulseAmp[nngc_pmts]; + Double_t pngc_pulseInt[nngc_pmts]; + + //Pre-Shower ADC + Int_t ppshwr_posHits, ppshwr_negHits; + Double_t ppshwr_posPmt[maxAdcHits*npos_pshwr_blks], ppshwr_negPmt[maxAdcHits*nneg_pshwr_blks]; + Double_t ppshwr_posPulseTime[maxAdcHits*npos_pshwr_blks], ppshwr_negPulseTime[maxAdcHits*nneg_pshwr_blks]; + Double_t ppshwr_posPulseInt[maxAdcHits*npos_pshwr_blks], ppshwr_negPulseInt[maxAdcHits*nneg_pshwr_blks]; + + //Shower ADC + Int_t pshwr_hits; + Double_t pshwr_pmt[maxAdcHits*nshwr_blks], pshwr_pulseTimeRaw[maxAdcHits*nshwr_blks]; + Double_t pshwr_pulseInt[maxAdcHits*nshwr_blks]; + + //Tracking Information + Int_t ntracks; + Double_t trk_pmag[maxNumTracks]; + Double_t trk_beta[maxNumTracks]; + Double_t trk_x[maxNumTracks]; + Double_t trk_theta[maxNumTracks]; + Double_t trk_y[maxNumTracks]; + Double_t trk_phi[maxNumTracks]; + + + Long64_t nentries; + + + //Declare Histos + + //Drift Chamber + TH1F *h_p1X_tdc, *h_p1Y_tdc, *h_p2X_tdc, *h_p2Y_tdc; + TH1F *h_p1T_tdc, *h_p2T_tdc; + TH1F *h_pT1_tdc, *h_pT2_tdc, *h_pT3_tdc; + TH1F *h_p1XmpT2_tdc, *h_p1YmpT2_tdc, *h_p2XmpT2_tdc, *h_p2YmpT2_tdc; + TH1F *h_p1XmpT3_tdc, *h_p1YmpT3_tdc, *h_p2XmpT3_tdc, *h_p2YmpT3_tdc; + TH1F *h_p1TmpT2_tdc, *h_p2TmpT2_tdc, *h_p1TmpT3_tdc, *h_p2TmpT3_tdc; + TH1F *h_pDCREF_tdc[ndcRefTimes]; + + TH2F *h2_p1Xneg_pt_tt_diff, *h2_p1Yneg_pt_tt_diff, *h2_p2Xneg_pt_tt_diff, *h2_p2Yneg_pt_tt_diff; + TH2F *h2_p1Xpos_pt_tt_diff, *h2_p1Ypos_pt_tt_diff, *h2_p2Xpos_pt_tt_diff, *h2_p2Ypos_pt_tt_diff; + + TH1F *h_p1X_fpTime, *h_p1Y_fpTime, *h_p2X_fpTime, *h_p2Y_fpTime; + TH1F *h_p1X_plTime, *h_p1Y_plTime, *h_p2X_plTime, *h_p2Y_plTime; + + TH2F *h2_p1X_negTdcCorr, *h2_p1Y_negTdcCorr, *h2_p2X_negTdcCorr, *h2_p2Y_negTdcCorr; + TH2F *h2_p1X_posTdcCorr, *h2_p1Y_posTdcCorr, *h2_p2X_posTdcCorr, *h2_p2Y_posTdcCorr; + TH2F *h2_p1X_tdcCorrDiff, *h2_p1Y_tdcCorrDiff, *h2_p2X_tdcCorrDiff, *h2_p2Y_tdcCorrDiff; + + //Aerogel + TH2F *h2_paero_posPulseTime_pT1_diff, *h2_paero_negPulseTime_pT1_diff; + TH2F *h2_paero_posPulseTime_pT2_diff, *h2_paero_negPulseTime_pT2_diff; + TH2F *h2_paero_posPulseTime_pT3_diff, *h2_paero_negPulseTime_pT3_diff; + TH1F *h_paero_PulseInt; + + //HGC + TH1F *h_TEST; + + TH1F *h_phgc_adcPulseInt[4]; + TH1F *h_phgc_adcPulseTimeRaw[4]; + TH1F *h_phgc_adcPulseAmp[4]; + + TH1F *h_phgc_adcPulseAmpSum; + TH1F *h_phgc_adcPulseIntSum; + TH1F *h_phgc_adcPulseIntSum_e; + TH1F *h_phgc_adcPulseIntSum_pi; + + TH2F *h2_phgc_hodstarttime_pulseTime[4]; + + TH1F *h_phgc_adcPulseTimeCorr_T1[4]; + TH1F *h_phgc_adcPulseTimeCorr_T2[4]; + TH1F *h_phgc_adcPulseTimeCorr_T3[4]; + + TH2F *h2_phgc_adcInt_TimeRaw[4]; + TH2F *h2_phgc_adcAmp_TimeRaw[4]; + + TH2F *h2_phgc_pulseTime_pT1_pmt; + TH2F *h2_phgc_pulseTime_pT2_pmt; + TH2F *h2_phgc_pulseTime_pT3_pmt; + + TH2F *h2_phgc_pulseTime_pT1_diff; + TH2F *h2_phgc_pulseTime_pT2_diff; + TH2F *h2_phgc_pulseTime_pT3_diff; + + TH2F *h2_phgc_adcInt_T1[4]; + TH2F *h2_phgc_adcInt_T2[4]; + TH2F *h2_phgc_adcInt_T3[4]; + + TH2F *h2_phgc_pulseInt_pT1[4]; + TH2F *h2_phgc_pulseInt_pT2[4]; + TH2F *h2_phgc_pulseInt_pT3[4]; + + TH2F *h2_phgc_TimeWalk_T1[4]; + TH2F *h2_phgc_TimeWalk_T2[4]; + TH2F *h2_phgc_TimeWalk_T3[4]; + + TH2F *h2_phgc_adcInt_TimeRaw_pi[4]; + TH2F *h2_phgc_adcInt_TimeRaw_e[4]; + + TH1F *h_phgc_pulseAmp_10[4]; + TH1F *h_phgc_pulseAmp_no10[4]; + TH1F *h_phgc_pulseAmp_20[4]; + TH1F *h_phgc_pulseAmp_no20[4]; + TH1F *h_phgc_pulseAmp_30[4]; + TH1F *h_phgc_pulseAmp_no30[4]; + TH1F *h_phgc_pulseAmp_40[4]; + TH1F *h_phgc_pulseAmp_no40[4]; + TH1F *h_phgc_pulseAmp_50[4]; + TH1F *h_phgc_pulseAmp_no50[4]; + TH1F *h_phgc_pulseAmp_60[4]; + TH1F *h_phgc_pulseAmp_no60[4]; + TH1F *h_phgc_pulseAmp_70[4]; + TH1F *h_phgc_pulseAmp_no70[4]; + + TH1F *h_phgc_quad1_pulseInt_e[4]; + TH1F *h_phgc_quad1_pulseInt_pi[4]; + TH1F *h_phgc_quad1_pulseInt_sum[4]; + + TH1F *h_phgc_quad2_pulseInt_e[4]; + TH1F *h_phgc_quad2_pulseInt_pi[4]; + TH1F *h_phgc_quad2_pulseInt_sum[4]; + + TH1F *h_phgc_quad3_pulseInt_e[4]; + TH1F *h_phgc_quad3_pulseInt_pi[4]; + TH1F *h_phgc_quad3_pulseInt_sum[4]; + + TH1F *h_phgc_quad4_pulseInt_e[4]; + TH1F *h_phgc_quad4_pulseInt_pi[4]; + TH1F *h_phgc_quad4_pulseInt_sum[4]; + + TH1F *h_phgc_quad1_pulseAmp_e[4]; + TH1F *h_phgc_quad1_pulseAmp_pi[4]; + TH1F *h_phgc_quad1_pulseAmp_sum[4]; + + TH1F *h_phgc_quad2_pulseAmp_e[4]; + TH1F *h_phgc_quad2_pulseAmp_pi[4]; + TH1F *h_phgc_quad2_pulseAmp_sum[4]; + + TH1F *h_phgc_quad3_pulseAmp_e[4]; + TH1F *h_phgc_quad3_pulseAmp_pi[4]; + TH1F *h_phgc_quad3_pulseAmp_sum[4]; + + TH1F *h_phgc_quad4_pulseAmp_e[4]; + TH1F *h_phgc_quad4_pulseAmp_pi[4]; + TH1F *h_phgc_quad4_pulseAmp_sum[4]; + + TH1F *h_phgc_pulseInt_npe[4]; + TH1F *h_phgc_npesum; + + //PreShower & Shower + TH1F *h_ppshwr_PulseInt; + TH1F *h_pshwr_PulseInt; + + TH2F *h2_ppshwr_posPulseTime_pT1_diff, *h2_ppshwr_negPulseTime_pT1_diff; + TH2F *h2_ppshwr_posPulseTime_pT2_diff, *h2_ppshwr_negPulseTime_pT2_diff; + TH2F *h2_ppshwr_posPulseTime_pT3_diff, *h2_ppshwr_negPulseTime_pT3_diff; + + TH2F *h2_pshwr_pulseTime_pT1_diff; + TH2F *h2_pshwr_pulseTime_pT2_diff; + TH2F *h2_pshwr_pulseTime_pT3_diff; + + //NGC + TH1F *h_pngc_adcPulseInt_sum; + + TH1F *h_pngc_adcPulseInt[4]; + TH1F *h_pngc_adcPulseTimeRaw[4]; + TH1F *h_pngc_adcPulseAmp[4]; + + TH2F *h2_pngc_pulseTime_pT1_diff; + TH2F *h2_pngc_pulseTime_pT2_diff; + TH2F *h2_pngc_pulseTime_pT3_diff; + + TH1F *h_pngc_quad1_pulseInt_e[4]; + TH1F *h_pngc_quad1_pulseInt_pi[4]; + TH1F *h_pngc_quad1_pulseInt_sum[4]; + + TH1F *h_pngc_quad2_pulseInt_e[4]; + TH1F *h_pngc_quad2_pulseInt_pi[4]; + TH1F *h_pngc_quad2_pulseInt_sum[4]; + + TH1F *h_pngc_quad3_pulseInt_e[4]; + TH1F *h_pngc_quad3_pulseInt_pi[4]; + TH1F *h_pngc_quad3_pulseInt_sum[4]; + + TH1F *h_pngc_quad4_pulseInt_e[4]; + TH1F *h_pngc_quad4_pulseInt_pi[4]; + TH1F *h_pngc_quad4_pulseInt_sum[4]; + + TH1F *h_pngc_quad1_pulseAmp_e[4]; + TH1F *h_pngc_quad1_pulseAmp_pi[4]; + TH1F *h_pngc_quad1_pulseAmp_sum[4]; + + TH1F *h_pngc_quad2_pulseAmp_e[4]; + TH1F *h_pngc_quad2_pulseAmp_pi[4]; + TH1F *h_pngc_quad2_pulseAmp_sum[4]; + + TH1F *h_pngc_quad3_pulseAmp_e[4]; + TH1F *h_pngc_quad3_pulseAmp_pi[4]; + TH1F *h_pngc_quad3_pulseAmp_sum[4]; + + TH1F *h_pngc_quad4_pulseAmp_e[4]; + TH1F *h_pngc_quad4_pulseAmp_pi[4]; + TH1F *h_pngc_quad4_pulseAmp_sum[4]; + + //Tracking Information + TH2F *h2_ptrk_fp; + TH2F *h2_ptrk_fp_e; + TH2F *h2_ptrk_fp_pi; + + TH2F *h2_ptrk_ngc_sum; + TH2F *h2_ptrk_ngc_sum_noped; + TH2F *h2_ptrk_ngc_sum_ped; + + TH2F *h2_ptrk_hgc_e; + TH2F *h2_ptrk_hgc_pi; + TH2F *h2_ptrk_hgc_sum; + TH2F *h2_ptrk_hgc[4]; + TH2F *h2_ptrk_hgc_adcAmp[4]; + + TH3F *h3_ptrk_hgc_adcInt2NPE[4]; + TH3F *h3_ptrk_hgc_adcInt2NPE_e[4]; + TH3F *h3_ptrk_hgc_adcInt2NPE_pi[4]; + TH3F *h3_ptrk_hgc_adcAmp2NPE[4]; + TH3F *h3_ptrk_hgc_adcInt2NPE_full; + TH3F *h3_ptrk_hgc_adcInt2NPE_full_e; + TH3F *h3_ptrk_hgc_adcInt2NPE_full_pi; + + TH1F *h_ptrk_beta; + + //Between Detectors + TH2F *h2_pshwr_vs_phgcer; + TH2F *h2_pshwr_vs_pngc; + TH2F *h2_pshwr_vs_ppshwr; + + TH2F *h2_pshwr_vs_pngc_ecut; + TH2F *h2_pshwr_vs_pngc_picut; + TH2F *h2_pshwr_vs_pngc_ecut_pmt[4]; + TH2F *h2_pshwr_vs_pngc_picut_pmt[4]; + TH2F *h2_pshwr_vs_phgc_ecut; + TH2F *h2_pshwr_vs_phgc_picut; + + TH2F *h2_pshwr_vs_pngc_latetcut[4]; + TH2F *h2_pshwr_vs_pngc_earlytcut[4]; + + + TH1F *h_phgc_ecut_shwr[4]; + TH1F *h_phgc_picut_shwr[4]; + + TH2F *h2_EdivP_vs_P; + + + //Declare tree + TTree *T = (TTree*)F->Get("T"); + nentries = T->GetEntries(); + + + //Aquire the branches + //Trigger Time Information + T->SetBranchAddress("T.shms.p1X_tdcTime", &p1X_tdcTime); + T->SetBranchAddress("T.shms.p1Y_tdcTime", &p1Y_tdcTime); + T->SetBranchAddress("T.shms.p2X_tdcTime", &p2X_tdcTime); + T->SetBranchAddress("T.shms.p2Y_tdcTime", &p2Y_tdcTime); + T->SetBranchAddress("T.shms.p1T_tdcTime", &p1T_tdcTime); + T->SetBranchAddress("T.shms.p2T_tdcTime", &p2T_tdcTime); + T->SetBranchAddress("T.shms.pT1_tdcTime", &pT1_tdcTime); + T->SetBranchAddress("T.shms.pT2_tdcTime", &pT2_tdcTime); + T->SetBranchAddress("T.shms.pT3_tdcTime", &pT3_tdcTime); + + //DC Refernce Times + for (UInt_t iref = 0; iref < ndcRefTimes; iref++) + T->SetBranchAddress(Form("T.shms.pDCREF%d_tdcTime", iref+1), &pDCREF_tdcTime[iref]); + + //Hodoscope Focal Plane Time Calculation + T->SetBranchAddress("P.hod.1x.fptime", &p1X_fpTime); + T->SetBranchAddress("P.hod.1y.fptime", &p1Y_fpTime); + T->SetBranchAddress("P.hod.2x.fptime", &p2X_fpTime); + T->SetBranchAddress("P.hod.2y.fptime", &p2Y_fpTime); + + //Hodoscope ADC Information + T->SetBranchAddress("Ndata.P.hod.1x.negAdcCounter", &p1X_negAdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.negAdcCounter", &p1Y_negAdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.negAdcCounter", &p2X_negAdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.negAdcCounter", &p2Y_negAdcHits); + T->SetBranchAddress("P.hod.1x.negAdcCounter", p1X_negAdcPaddle); + T->SetBranchAddress("P.hod.1y.negAdcCounter", p1Y_negAdcPaddle); + T->SetBranchAddress("P.hod.2x.negAdcCounter", p2X_negAdcPaddle); + T->SetBranchAddress("P.hod.2y.negAdcCounter", p2Y_negAdcPaddle); + T->SetBranchAddress("P.hod.1x.negAdcPulseTimeRaw", p1X_negAdcPulseTime); + T->SetBranchAddress("P.hod.1y.negAdcPulseTimeRaw", p1Y_negAdcPulseTime); + T->SetBranchAddress("P.hod.2x.negAdcPulseTimeRaw", p2X_negAdcPulseTime); + T->SetBranchAddress("P.hod.2y.negAdcPulseTimeRaw", p2Y_negAdcPulseTime); + T->SetBranchAddress("Ndata.P.hod.1x.posAdcCounter", &p1X_posAdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.posAdcCounter", &p1Y_posAdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.posAdcCounter", &p2X_posAdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.posAdcCounter", &p2Y_posAdcHits); + T->SetBranchAddress("P.hod.1x.posAdcCounter", p1X_posAdcPaddle); + T->SetBranchAddress("P.hod.1y.posAdcCounter", p1Y_posAdcPaddle); + T->SetBranchAddress("P.hod.2x.posAdcCounter", p2X_posAdcPaddle); + T->SetBranchAddress("P.hod.2y.posAdcCounter", p2Y_posAdcPaddle); + T->SetBranchAddress("P.hod.1x.posAdcPulseTimeRaw", p1X_posAdcPulseTime); + T->SetBranchAddress("P.hod.1y.posAdcPulseTimeRaw", p1Y_posAdcPulseTime); + T->SetBranchAddress("P.hod.2x.posAdcPulseTimeRaw", p2X_posAdcPulseTime); + T->SetBranchAddress("P.hod.2y.posAdcPulseTimeRaw", p2Y_posAdcPulseTime); + //Hodoscope TDC Information + T->SetBranchAddress("Ndata.P.hod.1x.negTdcCounter", &p1X_negTdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.negTdcCounter", &p1Y_negTdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.negTdcCounter", &p2X_negTdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.negTdcCounter", &p2Y_negTdcHits); + T->SetBranchAddress("P.hod.1x.negTdcCounter", p1X_negTdcPaddle); + T->SetBranchAddress("P.hod.1y.negTdcCounter", p1Y_negTdcPaddle); + T->SetBranchAddress("P.hod.2x.negTdcCounter", p2X_negTdcPaddle); + T->SetBranchAddress("P.hod.2y.negTdcCounter", p2Y_negTdcPaddle); + T->SetBranchAddress("P.hod.1x.negTdcTime", p1X_negTdcTime); + T->SetBranchAddress("P.hod.1y.negTdcTime", p1Y_negTdcTime); + T->SetBranchAddress("P.hod.2x.negTdcTime", p2X_negTdcTime); + T->SetBranchAddress("P.hod.2y.negTdcTime", p2Y_negTdcTime); + T->SetBranchAddress("Ndata.P.hod.1x.posTdcCounter", &p1X_posTdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.posTdcCounter", &p1Y_posTdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.posTdcCounter", &p2X_posTdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.posTdcCounter", &p2Y_posTdcHits); + T->SetBranchAddress("P.hod.1x.posTdcCounter", p1X_posTdcPaddle); + T->SetBranchAddress("P.hod.1y.posTdcCounter", p1Y_posTdcPaddle); + T->SetBranchAddress("P.hod.2x.posTdcCounter", p2X_posTdcPaddle); + T->SetBranchAddress("P.hod.2y.posTdcCounter", p2Y_posTdcPaddle); + T->SetBranchAddress("P.hod.1x.posTdcTime", p1X_posTdcTime); + T->SetBranchAddress("P.hod.1y.posTdcTime", p1Y_posTdcTime); + T->SetBranchAddress("P.hod.2x.posTdcTime", p2X_posTdcTime); + T->SetBranchAddress("P.hod.2y.posTdcTime", p2Y_posTdcTime); + + //"Good" Hodoscope Hits, corrected times (not corrected for TOF to focal plane + T->SetBranchAddress("Ndata.P.hod.1x.GoodPaddle", &p1X_nGoodHodoHits); + T->SetBranchAddress("Ndata.P.hod.1y.GoodPaddle", &p1Y_nGoodHodoHits); + T->SetBranchAddress("Ndata.P.hod.2x.GoodPaddle", &p2X_nGoodHodoHits); + T->SetBranchAddress("Ndata.P.hod.2y.GoodPaddle", &p2Y_nGoodHodoHits); + T->SetBranchAddress("P.hod.1x.GoodPaddle", p1X_goodPaddle); + T->SetBranchAddress("P.hod.1y.GoodPaddle", p1Y_goodPaddle); + T->SetBranchAddress("P.hod.2x.GoodPaddle", p2X_goodPaddle); + T->SetBranchAddress("P.hod.2y.GoodPaddle", p2Y_goodPaddle); + T->SetBranchAddress("P.hod.1x.GoodNegTdcTimeCorr", p1X_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.1y.GoodNegTdcTimeCorr", p1Y_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.2x.GoodNegTdcTimeCorr", p2X_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.2y.GoodNegTdcTimeCorr", p2Y_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.1x.GoodPosTdcTimeCorr", p1X_goodPosTdcTimeCorr); + T->SetBranchAddress("P.hod.1y.GoodPosTdcTimeCorr", p1Y_goodPosTdcTimeCorr); + T->SetBranchAddress("P.hod.2x.GoodPosTdcTimeCorr", p2X_goodPosTdcTimeCorr); + T->SetBranchAddress("P.hod.2y.GoodPosTdcTimeCorr", p2Y_goodPosTdcTimeCorr); + + //Other Hodoscope Data + T->SetBranchAddress("P.hod.starttime", &phod_starttime); + + //Aerogel + T->SetBranchAddress("Ndata.P.aero.negAdcCounter", &paero_negHits); + T->SetBranchAddress("Ndata.P.aero.posAdcCounter", &paero_posHits); + T->SetBranchAddress("P.aero.negAdcCounter", paero_negPmt); + T->SetBranchAddress("P.aero.posAdcCounter", paero_posPmt); + T->SetBranchAddress("P.aero.goodNegAdcPulseTime", paero_negPulseTime); + T->SetBranchAddress("P.aero.goodPosAdcPulseTime", paero_posPulseTime); + T->SetBranchAddress("P.aero.goodNegAdcPulseInt", paero_negPulseInt); + T->SetBranchAddress("P.aero.goodPosAdcPulseInt", paero_posPulseInt); + + /* Following Branch entries altered in hcana May 04 -- Ryan Ambrose + T->SetBranchAddress("P.aero.negAdcPulseTimeRaw", paero_negPulseTime); + T->SetBranchAddress("P.aero.posAdcPulseTimeRaw", paero_posPulseTime); + T->SetBranchAddress("P.aero.negAdcPulseInt", paero_negPulseInt); + T->SetBranchAddress("P.aero.posAdcPulseInt", paero_posPulseInt); + */ + + //HGC + T->SetBranchAddress("Ndata.P.hgcer.adcCounter", &phgc_hits); + T->SetBranchAddress("P.hgcer.adcCounter", phgc_pmt); + T->SetBranchAddress("P.hgcer.goodAdcPulseTime", phgc_pulseTimeRaw); + T->SetBranchAddress("P.hgcer.goodAdcPulseInt", phgc_pulseInt); + T->SetBranchAddress("P.hgcer.goodAdcPulseAmp", phgc_pulseAmp); + + /* Following Branch entries altered in hcana May 04 -- Ryan Ambrose + T->SetBranchAddress("P.hgcer.adcPulseTimeRaw", phgc_pulseTimeRaw); + T->SetBranchAddress("P.hgcer.adcPulseInt", phgc_pulseInt); + T->SetBranchAddress("P.hgcer.adcPulseAmp", phgc_pulseAmp); + */ + + //PreShower & Shower + T->SetBranchAddress("Ndata.P.cal.pr.negAdcCounter", &ppshwr_negHits); + T->SetBranchAddress("Ndata.P.cal.pr.posAdcCounter", &ppshwr_posHits); + T->SetBranchAddress("P.cal.pr.negAdcCounter", ppshwr_negPmt); + T->SetBranchAddress("P.cal.pr.posAdcCounter", ppshwr_posPmt); + T->SetBranchAddress("P.cal.pr.goodNegAdcPulseTime", ppshwr_negPulseTime); + T->SetBranchAddress("P.cal.pr.goodPosAdcPulseTime", ppshwr_posPulseTime); + T->SetBranchAddress("P.cal.pr.goodNegAdcPulseInt", ppshwr_negPulseInt); + T->SetBranchAddress("P.cal.pr.goodPosAdcPulseInt", ppshwr_posPulseInt); + + T->SetBranchAddress("Ndata.P.cal.fly.adcCounter", &pshwr_hits); + T->SetBranchAddress("P.cal.fly.adcCounter", pshwr_pmt); + T->SetBranchAddress("P.cal.fly.goodAdcPulseTime", pshwr_pulseTimeRaw); + T->SetBranchAddress("P.cal.fly.goodAdcPulseInt", pshwr_pulseInt); + + //NGC + T->SetBranchAddress("Ndata.P.ngcer.adcCounter", &pngc_hits); + T->SetBranchAddress("P.ngcer.adcCounter", pngc_pmt); + T->SetBranchAddress("P.ngcer.goodAdcPulseTime", pngc_pulseTimeRaw); + T->SetBranchAddress("P.ngcer.goodAdcPulseInt", pngc_pulseInt); + T->SetBranchAddress("P.ngcer.goodAdcPulseAmp", pngc_pulseAmp); + + /* Following Branch entries altered in hcana May 04 -- Ryan Ambrose + T->SetBranchAddress("P.ngcer.adcPulseTimeRaw", pngc_pulseTimeRaw); + T->SetBranchAddress("P.ngcer.adcPulseInt", pngc_pulseInt); + */ + + //Tracking + T->SetBranchAddress("Ndata.P.tr.p", &ntracks); + T->SetBranchAddress("P.tr.p", trk_pmag); + T->SetBranchAddress("P.tr.beta", trk_beta); + T->SetBranchAddress("P.tr.x", trk_x); + T->SetBranchAddress("P.tr.th", trk_theta); + T->SetBranchAddress("P.tr.y", trk_y); + T->SetBranchAddress("P.tr.ph", trk_phi); + + + //Create Histos + + //Drift Chambers + h_p1X_tdc = new TH1F("pdc_p1X_tdc", "S1X Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p1Y_tdc = new TH1F("pdc_p1Y_tdc", "S1Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p2X_tdc = new TH1F("pdc_p2X_tdc", "S2X Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p2Y_tdc = new TH1F("pdc_p2Y_tdc", "S2Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p1T_tdc = new TH1F("pdc_p1T_tdc", "S1X/S1Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p2T_tdc = new TH1F("pdc_p2T_tdc", "S2X/S2Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_pT1_tdc = new TH1F("pdc_pT1_tdc", "Hodoscope Trigger (Slot 20 Channel 15); TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_pT2_tdc = new TH1F("pdc_pT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31); TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_pT3_tdc = new TH1F("pdc_pT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38); TDC Time (ns); Counts / 1 ns", 300, 0, 300); + for (UInt_t iref = 0; iref < ndcRefTimes; iref++) + h_pDCREF_tdc[iref] = new TH1F(Form("pdcREF%d_tdc", iref+1), Form("DC Reference Time %d; TDC Time (ns); Counts / 1 ns", iref+1), 200, 400, 600); + h_p1XmpT2_tdc = new TH1F("pdc_p1XmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S1X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1YmpT2_tdc = new TH1F("pdc_p1YmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S1Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2XmpT2_tdc = new TH1F("pdc_p2XmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S2X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2YmpT2_tdc = new TH1F("pdc_p2YmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S2Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1TmpT2_tdc = new TH1F("pdc_p1TmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S1; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2TmpT2_tdc = new TH1F("pdc_p2TmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S2; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1XmpT3_tdc = new TH1F("pdc_p1XmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S1X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1YmpT3_tdc = new TH1F("pdc_p1YmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S1Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2XmpT3_tdc = new TH1F("pdc_p2XmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S2X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2YmpT3_tdc = new TH1F("pdc_p2YmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S2Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1TmpT3_tdc = new TH1F("pdc_p1TmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S1; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2TmpT3_tdc = new TH1F("pdc_p2TmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S2; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + + //Time Corrected Drift Chamber? + h2_p1Xneg_pt_tt_diff = new TH2F("pdc_h2_p1Xneg_pt_tt_diff", "S1X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1x, 0.5, nbars_1x + 0.5, 300, 0, 300); + h2_p1Yneg_pt_tt_diff = new TH2F("pdc_h2_p1Yneg_pt_tt_diff", "S1Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1y, 0.5, nbars_1y + 0.5, 300, 0, 300); + h2_p2Xneg_pt_tt_diff = new TH2F("pdc_h2_p2Xneg_pt_tt_diff", "S2X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2x, 0.5, nbars_2x + 0.5, 300, 0, 300); + h2_p2Yneg_pt_tt_diff = new TH2F("pdc_h2_p2Yneg_pt_tt_diff", "S2Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2y, 0.5, nbars_2y + 0.5, 300, 0, 300); + h2_p1Xpos_pt_tt_diff = new TH2F("pdc_h2_p1Xpos_pt_tt_diff", "S1X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1x, 0.5, nbars_1x + 0.5, 300, 0, 300); + h2_p1Ypos_pt_tt_diff = new TH2F("pdc_h2_p1Ypos_pt_tt_diff", "S1Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1y, 0.5, nbars_1y + 0.5, 300, 0, 300); + h2_p2Xpos_pt_tt_diff = new TH2F("pdc_h2_p2Xpos_pt_tt_diff", "S2X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2x, 0.5, nbars_2x + 0.5, 300, 0, 300); + h2_p2Ypos_pt_tt_diff = new TH2F("pdc_h2_p2Ypos_pt_tt_diff", "S2Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2y, 0.5, nbars_2y + 0.5, 300, 0, 300); + + //Drift Chamber Focal Plane Time + h_p1X_fpTime = new TH1F("pdc_p1X_fpTime", "S1X Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + h_p1Y_fpTime = new TH1F("pdc_p1Y_fpTime", "S1Y Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + h_p2X_fpTime = new TH1F("pdc_p2X_fpTime", "S2X Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + h_p2Y_fpTime = new TH1F("pdc_p2Y_fpTime", "S2Y Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + + h_p1X_plTime = new TH1F("pdc_p1X_plTime", "S1X Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + h_p1Y_plTime = new TH1F("pdc_p1Y_plTime", "S1Y Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + h_p2X_plTime = new TH1F("pdc_p2X_plTime", "S2X Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + h_p2Y_plTime = new TH1F("pdc_p2Y_plTime", "S2Y Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + + //Corrected TDC Hodoscope + h2_p1X_negTdcCorr = new TH2F("phodo_h2_p1X_negTdcCorr", "S1X- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1x, 0.5, nbars_1x + 0.5, 200, -100, 100); + h2_p1Y_negTdcCorr = new TH2F("phodo_h2_p1Y_negTdcCorr", "S1Y- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1y, 0.5, nbars_1y + 0.5, 200, -100, 100); + h2_p2X_negTdcCorr = new TH2F("phodo_h2_p2X_negTdcCorr", "S2X- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2x, 0.5, nbars_2x + 0.5, 200, -100, 100); + h2_p2Y_negTdcCorr = new TH2F("phodo_h2_p2Y_negTdcCorr", "S2Y- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2y, 0.5, nbars_2y + 0.5, 200, -100, 100); + h2_p1X_posTdcCorr = new TH2F("phodo_h2_p1X_posTdcCorr", "S1X+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1x, 0.5, nbars_1x + 0.5, 200, -100, 100); + h2_p1Y_posTdcCorr = new TH2F("phodo_h2_p1Y_posTdcCorr", "S1Y+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1y, 0.5, nbars_1y + 0.5, 200, -100, 100); + h2_p2X_posTdcCorr = new TH2F("phodo_h2_p2X_posTdcCorr", "S2X+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2x, 0.5, nbars_2x + 0.5, 200, -100, 100); + h2_p2Y_posTdcCorr = new TH2F("phodo_h2_p2Y_posTdcCorr", "S2Y+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2y, 0.5, nbars_2y + 0.5, 200, -100, 100); + h2_p1X_tdcCorrDiff = new TH2F("phodo_h2_p1X_tdcCorrDiff", "S1X-/S1X+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1x, 0.5, nbars_1x + 0.5, 100, -50, 50); + h2_p1Y_tdcCorrDiff = new TH2F("phodo_h2_p1Y_tdcCorrDiff", "S1Y-/S1Y+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1y, 0.5, nbars_1y + 0.5, 100, -50, 50); + h2_p2X_tdcCorrDiff = new TH2F("phodo_h2_p2X_tdcCorrDiff", "S2X-/S2X+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2x, 0.5, nbars_2x + 0.5, 100, -50, 50); + h2_p2Y_tdcCorrDiff = new TH2F("phodo_h2_p2Y_tdcCorrDiff", "S2Y-/S2Y+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2y, 0.5, nbars_2y + 0.5, 100, -50, 50); + + //Aerogel + h2_paero_negPulseTime_pT1_diff = new TH2F("paero_h2_negPulseTime_pT1_diff", "SHMS Negative Aerogel ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nneg_aero_pmts, 0.5, nneg_aero_pmts + 0.5, 300, -300, 0); + h2_paero_negPulseTime_pT2_diff = new TH2F("paero_h2_negPulseTime_pT2_diff", "SHMS Negative Aerogel ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nneg_aero_pmts, 0.5, nneg_aero_pmts + 0.5, 300, -300, 0); + h2_paero_negPulseTime_pT3_diff = new TH2F("paero_h2_negPulseTime_pT3_diff", "SHMS Negative Aerogel ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nneg_aero_pmts, 0.5, nneg_aero_pmts + 0.5, 300, -300, 0); + h2_paero_posPulseTime_pT1_diff = new TH2F("paero_h2_posPulseTime_pT1_diff", "SHMS Positive Aerogel ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", npos_aero_pmts, 0.5, npos_aero_pmts + 0.5, 300, -300, 0); + h2_paero_posPulseTime_pT2_diff = new TH2F("paero_h2_posPulseTime_pT2_diff", "SHMS Positive Aerogel ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", npos_aero_pmts, 0.5, npos_aero_pmts + 0.5, 300, -300, 0); + h2_paero_posPulseTime_pT3_diff = new TH2F("paero_h2_posPulseTime_pT3_diff", "SHMS Positive Aerogel ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", npos_aero_pmts, 0.5, npos_aero_pmts + 0.5, 300, -300, 0); + h_paero_PulseInt = new TH1F("paero_PulseInt", "Raw Pulse Int", bins, adc_min, adc_max); + + //HGC + h_phgc_adcPulseInt[0] = new TH1F ("phgc_adcPulseInt1", "Raw Pulse Integral PMT1; PulseInt; Counts", 14500, -500, 14000); + h_phgc_adcPulseInt[1] = new TH1F ("phgc_adcPulseInt2", "Raw Pulse Integral PMT2; PulseInt; Counts", 14500, -500, 14000); + h_phgc_adcPulseInt[2] = new TH1F ("phgc_adcPulseInt3", "Raw Pulse Integral PMT3; PulseInt; Counts", 14500, -500, 14000); + h_phgc_adcPulseInt[3] = new TH1F ("phgc_adcPulseInt4", "Raw Pulse Integral PMT4; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_adcPulseAmp[0] = new TH1F ("phgc_adcPulseAmp1", "Raw Pulse Amp PMT1; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_adcPulseAmp[1] = new TH1F ("phgc_adcPulseAmp2", "Raw Pulse Amp PMT2; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_adcPulseAmp[2] = new TH1F ("phgc_adcPulseAmp3", "Raw Pulse Amp PMT3; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_adcPulseAmp[3] = new TH1F ("phgc_adcPulseAmp4", "Raw Pulse Amp PMT4; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_adcPulseTimeRaw[0] = new TH1F ("phgc_adcPulseTimeRaw1", "Raw Pulse TimeRaw PMT1; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeRaw[1] = new TH1F ("phgc_adcPulseTimeRaw2", "Raw Pulse TimeRaw PMT2; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeRaw[2] = new TH1F ("phgc_adcPulseTimeRaw3", "Raw Pulse TimeRaw PMT3; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeRaw[3] = new TH1F ("phgc_adcPulseTimeRaw4", "Raw Pulse TimeRaw PMT4; PulseTimeRaw; Counts", bins, adc_min, adc_max); + + h_phgc_adcPulseAmpSum = new TH1F ("phgc_adcPulseAmpSum", "Raw Pulse Amplitude Sum; PulseAmp; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseIntSum = new TH1F ("phgc_adcPulseIntSum", "Raw Pulse Integral Sum; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseIntSum_e = new TH1F ("phgc_adcPulseIntSum_e", "Raw Pulse Integral Electrons; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseIntSum_pi = new TH1F ("phgc_adcPulseIntSum_pi", "Raw Pulse Integral Pions; PulseInt; Counts", bins, adc_min, adc_max); + + h2_phgc_hodstarttime_pulseTime[0] = new TH2F ("phgc_hodstarttime_pulseTime1", "PulseTimeRaw vs HodoStartTime PMT1; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_hodstarttime_pulseTime[1] = new TH2F ("phgc_hodstarttime_pulseTime2", "PulseTimeRaw vs HodoStartTime PMT2; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_hodstarttime_pulseTime[2] = new TH2F ("phgc_hodstarttime_pulseTime3", "PulseTimeRaw vs HodoStartTime PMT3; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_hodstarttime_pulseTime[3] = new TH2F ("phgc_hodstarttime_pulseTime4", "PulseTimeRaw vs HodoStartTime PMT4; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + + + h_phgc_adcPulseTimeCorr_T1[0] = new TH1F("phgc_adcPulseTimeCorr_T11", "Corrected Pulse Time PMT1; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T1[1] = new TH1F("phgc_adcPulseTimeCorr_T12", "Corrected Pulse Time PMT2; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T1[2] = new TH1F("phgc_adcPulseTimeCorr_T13", "Corrected Pulse Time PMT3; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T1[3] = new TH1F("phgc_adcPulseTimeCorr_T14", "Corrected Pulse Time PMT4; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + + h_phgc_adcPulseTimeCorr_T2[0] = new TH1F("phgc_adcPulseTimeCorr_T21", "Corrected Pulse Time PMT1; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T2[1] = new TH1F("phgc_adcPulseTimeCorr_T22", "Corrected Pulse Time PMT2; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T2[2] = new TH1F("phgc_adcPulseTimeCorr_T23", "Corrected Pulse Time PMT3; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T2[3] = new TH1F("phgc_adcPulseTimeCorr_T24", "Corrected Pulse Time PMT4; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + + h_phgc_adcPulseTimeCorr_T3[0] = new TH1F("phgc_adcPulseTimeCorr_T31", "Corrected Pulse Time PMT1; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T3[1] = new TH1F("phgc_adcPulseTimeCorr_T32", "Corrected Pulse Time PMT2; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T3[2] = new TH1F("phgc_adcPulseTimeCorr_T33", "Corrected Pulse Time PMT3; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T3[3] = new TH1F("phgc_adcPulseTimeCorr_T34", "Corrected Pulse Time PMT4; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + + h2_phgc_pulseTime_pT1_pmt = new TH2F("phgc_h2_pulseTime_pT1_pmt", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nhgc_pmts, 0.5, nhgc_pmts + 0.5, 300, -300, 100); + h2_phgc_pulseTime_pT2_pmt = new TH2F("phgc_h2_pulseTime_pT2_pmt", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nhgc_pmts, 0.5, nhgc_pmts + 0.5, 300, -300, 100); + h2_phgc_pulseTime_pT3_pmt = new TH2F("phgc_h2_pulseTime_pT3_pmt", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nhgc_pmts, 0.5, nhgc_pmts + 0.5, 300, -300, 100); + + h2_phgc_pulseTime_pT1_diff = new TH2F("phgc_h2_pulseTime_pT1_diff", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T1; Trigger 1 Time (ns); ADC Pulse Time", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_pulseTime_pT2_diff = new TH2F("phgc_h2_pulseTime_pT2_diff", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T2; Trigger 2 Time (ns); ADC Pulse Time", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_pulseTime_pT3_diff = new TH2F("phgc_h2_pulseTime_pT3_diff", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T3; Trigger 3 Time (ns); ADC Pulse Time", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_TimeRaw[0] = new TH2F ("phgc_adcInt_TimeRaw1", "Raw Pulse TimeRaw vs Int PMT1; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw[1] = new TH2F ("phgc_adcInt_TimeRaw2", "Raw Pulse TimeRaw vs Int PMT2; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw[2] = new TH2F ("phgc_adcInt_TimeRaw3", "Raw Pulse TimeRaw vs Int PMT3; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw[3] = new TH2F ("phgc_adcInt_TimeRaw4", "Raw Pulse TimeRaw vs Int PMT4; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcAmp_TimeRaw[0] = new TH2F ("phgc_adcAmp_TimeRaw1", "Raw Pulse TimeRaw vs Amp PMT1; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcAmp_TimeRaw[1] = new TH2F ("phgc_adcAmp_TimeRaw2", "Raw Pulse TimeRaw vs Amp PMT2; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcAmp_TimeRaw[2] = new TH2F ("phgc_adcAmp_TimeRaw3", "Raw Pulse TimeRaw vs Amp PMT3; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcAmp_TimeRaw[3] = new TH2F ("phgc_adcAmp_TimeRaw4", "Raw Pulse TimeRaw vs Amp PMT4; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_TimeRaw_pi[0] = new TH2F ("phgc_adcInt_TimeRaw_pi1", "Raw Pulse TimeRaw vs Int PMT1 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_pi[1] = new TH2F ("phgc_adcInt_TimeRaw_pi2", "Raw Pulse TimeRaw vs Int PMT2 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_pi[2] = new TH2F ("phgc_adcInt_TimeRaw_pi3", "Raw Pulse TimeRaw vs Int PMT3 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_pi[3] = new TH2F ("phgc_adcInt_TimeRaw_pi4", "Raw Pulse TimeRaw vs Int PMT4 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_TimeRaw_e[0] = new TH2F ("phgc_adcInt_TimeRaw_e1", "Raw Pulse TimeRaw vs Int PMT1 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_e[1] = new TH2F ("phgc_adcInt_TimeRaw_e2", "Raw Pulse TimeRaw vs Int PMT2 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_e[2] = new TH2F ("phgc_adcInt_TimeRaw_e3", "Raw Pulse TimeRaw vs Int PMT3 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_e[3] = new TH2F ("phgc_adcInt_TimeRaw_e4", "Raw Pulse TimeRaw vs Int PMT4 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_T1[0] = new TH2F ("phgc_adcInt_T11", "Raw Pulse TimeRaw vs Int PMT1; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T1[1] = new TH2F ("phgc_adcInt_T12", "Raw Pulse TimeRaw vs Int PMT2; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T1[2] = new TH2F ("phgc_adcInt_T13", "Raw Pulse TimeRaw vs Int PMT3; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T1[3] = new TH2F ("phgc_adcInt_T14", "Raw Pulse TimeRaw vs Int PMT4; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_T2[0] = new TH2F ("phgc_adcInt_T21", "Raw Pulse TimeRaw vs Int PMT1; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T2[1] = new TH2F ("phgc_adcInt_T22", "Raw Pulse TimeRaw vs Int PMT2; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T2[2] = new TH2F ("phgc_adcInt_T23", "Raw Pulse TimeRaw vs Int PMT3; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T2[3] = new TH2F ("phgc_adcInt_T24", "Raw Pulse TimeRaw vs Int PMT4; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_T3[0] = new TH2F ("phgc_adcInt_T31", "Raw Pulse TimeRaw vs Int PMT1; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T3[1] = new TH2F ("phgc_adcInt_T32", "Raw Pulse TimeRaw vs Int PMT2; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T3[2] = new TH2F ("phgc_adcInt_T33", "Raw Pulse TimeRaw vs Int PMT3; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T3[3] = new TH2F ("phgc_adcInt_T34", "Raw Pulse TimeRaw vs Int PMT4; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_pulseInt_pT1[0] = new TH2F("phgc_h2_pulseInt_pT11", "HGC PulseInt vs Trigger PulseTime PMT1; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT1[1] = new TH2F("phgc_h2_pulseInt_pT12", "HGC PulseInt vs Trigger PulseTime PMT2; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT1[2] = new TH2F("phgc_h2_pulseInt_pT13", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT1[3] = new TH2F("phgc_h2_pulseInt_pT14", "HGC PulseInt vs Trigger PulseTime PMT4; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_pulseInt_pT2[0] = new TH2F("phgc_h2_pulseInt_pT21", "HGC PulseInt vs Trigger PulseTime PMT1; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT2[1] = new TH2F("phgc_h2_pulseInt_pT22", "HGC PulseInt vs Trigger PulseTime PMT2; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT2[2] = new TH2F("phgc_h2_pulseInt_pT23", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT2[3] = new TH2F("phgc_h2_pulseInt_pT24", "HGC PulseInt vs Trigger PulseTime PMT4; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_pulseInt_pT3[0] = new TH2F("phgc_h2_pulseInt_pT31", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT3[1] = new TH2F("phgc_h2_pulseInt_pT32", "HGC PulseInt vs Trigger PulseTime PMT2; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT3[2] = new TH2F("phgc_h2_pulseInt_pT33", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT3[3] = new TH2F("phgc_h2_pulseInt_pT34", "HGC PulseInt vs Trigger PulseTime PMT4; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_TimeWalk_T1[0] = new TH2F("phgc_h2_TimeWalk_T11", "HGC Hit Time vs. Pulse Peak PMT 1; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T1[1] = new TH2F("phgc_h2_TimeWalk_T12", "HGC Hit Time vs. Pulse Peak PMT 2; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T1[2] = new TH2F("phgc_h2_TimeWalk_T13", "HGC Hit Time vs. Pulse Peak PMT 3; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T1[3] = new TH2F("phgc_h2_TimeWalk_T14", "HGC Hit Time vs. Pulse Peak PMT 4; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_TimeWalk_T2[0] = new TH2F("phgc_h2_TimeWalk_T21", "HGC Hit Time vs. Pulse Peak PMT 1; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T2[1] = new TH2F("phgc_h2_TimeWalk_T22", "HGC Hit Time vs. Pulse Peak PMT 2; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T2[2] = new TH2F("phgc_h2_TimeWalk_T23", "HGC Hit Time vs. Pulse Peak PMT 3; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T2[3] = new TH2F("phgc_h2_TimeWalk_T24", "HGC Hit Time vs. Pulse Peak PMT 4; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_TimeWalk_T3[0] = new TH2F("phgc_h2_TimeWalk_T31", "HGC Hit Time vs. Pulse Peak PMT 1; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T3[1] = new TH2F("phgc_h2_TimeWalk_T32", "HGC Hit Time vs. Pulse Peak PMT 2; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T3[2] = new TH2F("phgc_h2_TimeWalk_T33", "HGC Hit Time vs. Pulse Peak PMT 3; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T3[3] = new TH2F("phgc_h2_TimeWalk_T34", "HGC Hit Time vs. Pulse Peak PMT 4; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h_phgc_pulseAmp_10[0] = new TH1F ("phgc_pulseAmp_101", "HGC PulseInt with PulseAmp = 10 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[0] = new TH1F ("phgc_pulseAmp_no101", "HGC PulseInt without PulseAmp = 10 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_10[1] = new TH1F ("phgc_pulseAmp_102", "HGC PulseInt with PulseAmp = 10 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[1] = new TH1F ("phgc_pulseAmp_no102", "HGC PulseInt without PulseAmp = 10 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_10[2] = new TH1F ("phgc_pulseAmp_103", "HGC PulseInt with PulseAmp = 10 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[2] = new TH1F ("phgc_pulseAmp_no103", "HGC PulseInt without PulseAmp = 10 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_10[3] = new TH1F ("phgc_pulseAmp_104", "HGC PulseInt with PulseAmp = 10 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[3] = new TH1F ("phgc_pulseAmp_no104", "HGC PulseInt without PulseAmp = 10 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_20[0] = new TH1F ("phgc_pulseAmp_201", "HGC PulseInt with PulseAmp = 20 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[0] = new TH1F ("phgc_pulseAmp_no201", "HGC PulseInt without PulseAmp = 20 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_20[1] = new TH1F ("phgc_pulseAmp_202", "HGC PulseInt with PulseAmp = 20 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[1] = new TH1F ("phgc_pulseAmp_no202", "HGC PulseInt without PulseAmp = 20 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_20[2] = new TH1F ("phgc_pulseAmp_203", "HGC PulseInt with PulseAmp = 20 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[2] = new TH1F ("phgc_pulseAmp_no203", "HGC PulseInt without PulseAmp = 20 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_20[3] = new TH1F ("phgc_pulseAmp_204", "HGC PulseInt with PulseAmp = 20 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[3] = new TH1F ("phgc_pulseAmp_no204", "HGC PulseInt without PulseAmp = 20 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_30[0] = new TH1F ("phgc_pulseAmp_301", "HGC PulseInt with PulseAmp = 30 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[0] = new TH1F ("phgc_pulseAmp_no301", "HGC PulseInt without PulseAmp = 30 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_30[1] = new TH1F ("phgc_pulseAmp_302", "HGC PulseInt with PulseAmp = 30 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[1] = new TH1F ("phgc_pulseAmp_no302", "HGC PulseInt without PulseAmp = 30 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_30[2] = new TH1F ("phgc_pulseAmp_303", "HGC PulseInt with PulseAmp = 30 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[2] = new TH1F ("phgc_pulseAmp_no303", "HGC PulseInt without PulseAmp = 30 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_30[3] = new TH1F ("phgc_pulseAmp_304", "HGC PulseInt with PulseAmp = 30 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[3] = new TH1F ("phgc_pulseAmp_no304", "HGC PulseInt without PulseAmp = 30 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_40[0] = new TH1F ("phgc_pulseAmp_401", "HGC PulseInt with PulseAmp = 40 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[0] = new TH1F ("phgc_pulseAmp_no401", "HGC PulseInt without PulseAmp = 40 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_40[1] = new TH1F ("phgc_pulseAmp_402", "HGC PulseInt with PulseAmp = 40 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[1] = new TH1F ("phgc_pulseAmp_no402", "HGC PulseInt without PulseAmp = 40 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_40[2] = new TH1F ("phgc_pulseAmp_403", "HGC PulseInt with PulseAmp = 40 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[2] = new TH1F ("phgc_pulseAmp_no403", "HGC PulseInt without PulseAmp = 40 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_40[3] = new TH1F ("phgc_pulseAmp_404", "HGC PulseInt with PulseAmp = 40 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[3] = new TH1F ("phgc_pulseAmp_no404", "HGC PulseInt without PulseAmp = 40 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_50[0] = new TH1F ("phgc_pulseAmp_501", "HGC PulseInt with PulseAmp = 50 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[0] = new TH1F ("phgc_pulseAmp_no501", "HGC PulseInt without PulseAmp = 50 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_50[1] = new TH1F ("phgc_pulseAmp_502", "HGC PulseInt with PulseAmp = 50 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[1] = new TH1F ("phgc_pulseAmp_no502", "HGC PulseInt without PulseAmp = 50 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_50[2] = new TH1F ("phgc_pulseAmp_503", "HGC PulseInt with PulseAmp = 50 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[2] = new TH1F ("phgc_pulseAmp_no503", "HGC PulseInt without PulseAmp = 50 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_50[3] = new TH1F ("phgc_pulseAmp_504", "HGC PulseInt with PulseAmp = 50 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[3] = new TH1F ("phgc_pulseAmp_no504", "HGC PulseInt without PulseAmp = 50 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_60[0] = new TH1F ("phgc_pulseAmp_601", "HGC PulseInt with PulseAmp = 60 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[0] = new TH1F ("phgc_pulseAmp_no601", "HGC PulseInt without PulseAmp = 60 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_60[1] = new TH1F ("phgc_pulseAmp_602", "HGC PulseInt with PulseAmp = 60 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[1] = new TH1F ("phgc_pulseAmp_no602", "HGC PulseInt without PulseAmp = 60 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_60[2] = new TH1F ("phgc_pulseAmp_603", "HGC PulseInt with PulseAmp = 60 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[2] = new TH1F ("phgc_pulseAmp_no603", "HGC PulseInt without PulseAmp = 60 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_60[3] = new TH1F ("phgc_pulseAmp_604", "HGC PulseInt with PulseAmp = 60 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[3] = new TH1F ("phgc_pulseAmp_no604", "HGC PulseInt without PulseAmp = 60 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_70[0] = new TH1F ("phgc_pulseAmp_701", "HGC PulseInt with PulseAmp = 70 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[0] = new TH1F ("phgc_pulseAmp_no701", "HGC PulseInt without PulseAmp = 70 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_70[1] = new TH1F ("phgc_pulseAmp_702", "HGC PulseInt with PulseAmp = 70 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[1] = new TH1F ("phgc_pulseAmp_no702", "HGC PulseInt without PulseAmp = 70 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_70[2] = new TH1F ("phgc_pulseAmp_703", "HGC PulseInt with PulseAmp = 70 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[2] = new TH1F ("phgc_pulseAmp_no703", "HGC PulseInt without PulseAmp = 70 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_70[3] = new TH1F ("phgc_pulseAmp_704", "HGC PulseInt with PulseAmp = 70 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[3] = new TH1F ("phgc_pulseAmp_no704", "HGC PulseInt without PulseAmp = 70 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_quad1_pulseInt_e[0] = new TH1F ("phgc_quad1_pulseInt_e1", "Electrons in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_e[1] = new TH1F ("phgc_quad1_pulseInt_e2", "Electrons in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_e[2] = new TH1F ("phgc_quad1_pulseInt_e3", "Electrons in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_e[3] = new TH1F ("phgc_quad1_pulseInt_e4", "Electrons in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad1_pulseInt_pi[0] = new TH1F ("phgc_quad1_pulseInt_pi1", "Pions in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_pi[1] = new TH1F ("phgc_quad1_pulseInt_pi2", "Pions in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_pi[2] = new TH1F ("phgc_quad1_pulseInt_pi3", "Pions in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_pi[3] = new TH1F ("phgc_quad1_pulseInt_pi4", "Pions in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad1_pulseInt_sum[0] = new TH1F ("phgc_quad1_pulseInt_sum1", "Sum in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_sum[1] = new TH1F ("phgc_quad1_pulseInt_sum2", "Sum in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_sum[2] = new TH1F ("phgc_quad1_pulseInt_sum3", "Sum in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_sum[3] = new TH1F ("phgc_quad1_pulseInt_sum4", "Sum in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad2_pulseInt_e[0] = new TH1F ("phgc_quad2_pulseInt_e1", "Electrons in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_e[1] = new TH1F ("phgc_quad2_pulseInt_e2", "Electrons in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_e[2] = new TH1F ("phgc_quad2_pulseInt_e3", "Electrons in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_e[3] = new TH1F ("phgc_quad2_pulseInt_e4", "Electrons in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad2_pulseInt_pi[0] = new TH1F ("phgc_quad2_pulseInt_pi1", "Pions in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_pi[1] = new TH1F ("phgc_quad2_pulseInt_pi2", "Pions in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_pi[2] = new TH1F ("phgc_quad2_pulseInt_pi3", "Pions in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_pi[3] = new TH1F ("phgc_quad2_pulseInt_pi4", "Pions in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad2_pulseInt_sum[0] = new TH1F ("phgc_quad2_pulseInt_sum1", "Sum in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_sum[1] = new TH1F ("phgc_quad2_pulseInt_sum2", "Sum in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_sum[2] = new TH1F ("phgc_quad2_pulseInt_sum3", "Sum in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_sum[3] = new TH1F ("phgc_quad2_pulseInt_sum4", "Sum in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad3_pulseInt_e[0] = new TH1F ("phgc_quad3_pulseInt_e1", "Electrons in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_e[1] = new TH1F ("phgc_quad3_pulseInt_e2", "Electrons in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_e[2] = new TH1F ("phgc_quad3_pulseInt_e3", "Electrons in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_e[3] = new TH1F ("phgc_quad3_pulseInt_e4", "Electrons in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad3_pulseInt_pi[0] = new TH1F ("phgc_quad3_pulseInt_pi1", "Pions in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_pi[1] = new TH1F ("phgc_quad3_pulseInt_pi2", "Pions in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_pi[2] = new TH1F ("phgc_quad3_pulseInt_pi3", "Pions in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_pi[3] = new TH1F ("phgc_quad3_pulseInt_pi4", "Pions in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad3_pulseInt_sum[0] = new TH1F ("phgc_quad3_pulseInt_sum1", "Sum in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_sum[1] = new TH1F ("phgc_quad3_pulseInt_sum2", "Sum in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_sum[2] = new TH1F ("phgc_quad3_pulseInt_sum3", "Sum in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_sum[3] = new TH1F ("phgc_quad3_pulseInt_sum4", "Sum in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad4_pulseInt_e[0] = new TH1F ("phgc_quad4_pulseInt_e1", "Electrons in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_e[1] = new TH1F ("phgc_quad4_pulseInt_e2", "Electrons in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_e[2] = new TH1F ("phgc_quad4_pulseInt_e3", "Electrons in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_e[3] = new TH1F ("phgc_quad4_pulseInt_e4", "Electrons in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad4_pulseInt_pi[0] = new TH1F ("phgc_quad4_pulseInt_pi1", "Pions in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_pi[1] = new TH1F ("phgc_quad4_pulseInt_pi2", "Pions in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_pi[2] = new TH1F ("phgc_quad4_pulseInt_pi3", "Pions in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_pi[3] = new TH1F ("phgc_quad4_pulseInt_pi4", "Pions in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad4_pulseInt_sum[0] = new TH1F ("phgc_quad4_pulseInt_sum1", "Sum in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_sum[1] = new TH1F ("phgc_quad4_pulseInt_sum2", "Sum in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_sum[2] = new TH1F ("phgc_quad4_pulseInt_sum3", "Sum in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_sum[3] = new TH1F ("phgc_quad4_pulseInt_sum4", "Sum in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad1_pulseAmp_e[0] = new TH1F ("phgc_quad1_pulseAmp_e1", "Electrons in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_phgc_quad1_pulseAmp_e[1] = new TH1F ("phgc_quad1_pulseAmp_e2", "Electrons in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_phgc_quad1_pulseAmp_e[2] = new TH1F ("phgc_quad1_pulseAmp_e3", "Electrons in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_phgc_quad1_pulseAmp_e[3] = new TH1F ("phgc_quad1_pulseAmp_e4", "Electrons in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + + h_phgc_quad1_pulseAmp_pi[0] = new TH1F ("phgc_quad1_pulseAmp_pi1", "Pions in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_pi[1] = new TH1F ("phgc_quad1_pulseAmp_pi2", "Pions in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_pi[2] = new TH1F ("phgc_quad1_pulseAmp_pi3", "Pions in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_pi[3] = new TH1F ("phgc_quad1_pulseAmp_pi4", "Pions in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad1_pulseAmp_sum[0] = new TH1F ("phgc_quad1_pulseAmp_sum1", "Sum in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_sum[1] = new TH1F ("phgc_quad1_pulseAmp_sum2", "Sum in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_sum[2] = new TH1F ("phgc_quad1_pulseAmp_sum3", "Sum in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_sum[3] = new TH1F ("phgc_quad1_pulseAmp_sum4", "Sum in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad2_pulseAmp_e[0] = new TH1F ("phgc_quad2_pulseAmp_e1", "Electrons in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_e[1] = new TH1F ("phgc_quad2_pulseAmp_e2", "Electrons in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_e[2] = new TH1F ("phgc_quad2_pulseAmp_e3", "Electrons in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_e[3] = new TH1F ("phgc_quad2_pulseAmp_e4", "Electrons in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad2_pulseAmp_pi[0] = new TH1F ("phgc_quad2_pulseAmp_pi1", "Pions in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_pi[1] = new TH1F ("phgc_quad2_pulseAmp_pi2", "Pions in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_pi[2] = new TH1F ("phgc_quad2_pulseAmp_pi3", "Pions in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_pi[3] = new TH1F ("phgc_quad2_pulseAmp_pi4", "Pions in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad2_pulseAmp_sum[0] = new TH1F ("phgc_quad2_pulseAmp_sum1", "Sum in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_sum[1] = new TH1F ("phgc_quad2_pulseAmp_sum2", "Sum in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_sum[2] = new TH1F ("phgc_quad2_pulseAmp_sum3", "Sum in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_sum[3] = new TH1F ("phgc_quad2_pulseAmp_sum4", "Sum in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad3_pulseAmp_e[0] = new TH1F ("phgc_quad3_pulseAmp_e1", "Electrons in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_e[1] = new TH1F ("phgc_quad3_pulseAmp_e2", "Electrons in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_e[2] = new TH1F ("phgc_quad3_pulseAmp_e3", "Electrons in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_e[3] = new TH1F ("phgc_quad3_pulseAmp_e4", "Electrons in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad3_pulseAmp_pi[0] = new TH1F ("phgc_quad3_pulseAmp_pi1", "Pions in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_pi[1] = new TH1F ("phgc_quad3_pulseAmp_pi2", "Pions in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_pi[2] = new TH1F ("phgc_quad3_pulseAmp_pi3", "Pions in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_pi[3] = new TH1F ("phgc_quad3_pulseAmp_pi4", "Pions in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad3_pulseAmp_sum[0] = new TH1F ("phgc_quad3_pulseAmp_sum1", "Sum in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_sum[1] = new TH1F ("phgc_quad3_pulseAmp_sum2", "Sum in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_sum[2] = new TH1F ("phgc_quad3_pulseAmp_sum3", "Sum in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_sum[3] = new TH1F ("phgc_quad3_pulseAmp_sum4", "Sum in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad4_pulseAmp_e[0] = new TH1F ("phgc_quad4_pulseAmp_e1", "Electrons in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_e[1] = new TH1F ("phgc_quad4_pulseAmp_e2", "Electrons in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_e[2] = new TH1F ("phgc_quad4_pulseAmp_e3", "Electrons in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_e[3] = new TH1F ("phgc_quad4_pulseAmp_e4", "Electrons in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad4_pulseAmp_pi[0] = new TH1F ("phgc_quad4_pulseAmp_pi1", "Pions in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_pi[1] = new TH1F ("phgc_quad4_pulseAmp_pi2", "Pions in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_pi[2] = new TH1F ("phgc_quad4_pulseAmp_pi3", "Pions in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_pi[3] = new TH1F ("phgc_quad4_pulseAmp_pi4", "Pions in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad4_pulseAmp_sum[0] = new TH1F ("phgc_quad4_pulseAmp_sum1", "Sum in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_sum[1] = new TH1F ("phgc_quad4_pulseAmp_sum2", "Sum in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_sum[2] = new TH1F ("phgc_quad4_pulseAmp_sum3", "Sum in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_sum[3] = new TH1F ("phgc_quad4_pulseAmp_sum4", "Sum in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_pulseInt_npe[0] = new TH1F ("phgc_pulseInt_npe1", "Photoelectrons from pulseInt in PMT1; NPE; Counts", bins, 0, 20); + h_phgc_pulseInt_npe[1] = new TH1F ("phgc_pulseInt_npe2", "Photoelectrons from pulseInt in PMT2; NPE; Counts", bins, 0, 20); + h_phgc_pulseInt_npe[2] = new TH1F ("phgc_pulseInt_npe3", "Photoelectrons from pulseInt in PMT3; NPE; Counts", bins, 0, 20); + h_phgc_pulseInt_npe[3] = new TH1F ("phgc_pulseInt_npe4", "Photoelectrons from pulseInt in PMT4; NPE; Counts", bins, 0, 20); + + h_phgc_npesum = new TH1F("phgc_npesum", "Photoelectrons from all PMTs; NPE; Counts", bins, 0, 20); + + //PreShower & Shower + h_ppshwr_PulseInt = new TH1F ("ppshwr_PulseInt", "Pulse Integral for PreShower", bins, adc_min, adc_max); + h2_ppshwr_negPulseTime_pT1_diff = new TH2F("ppshwr_h2negPulseTime_pT1_diff", "SHMS Negative Pre Shower ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nneg_pshwr_blks, 0.5, nneg_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_negPulseTime_pT2_diff = new TH2F("ppshwr_h2negPulseTime_pT2_diff", "SHMS Negative Pre Shower ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nneg_pshwr_blks, 0.5, nneg_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_negPulseTime_pT3_diff = new TH2F("ppshwr_h2negPulseTime_pT3_diff", "SHMS Negative Pre Shower ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nneg_pshwr_blks, 0.5, nneg_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_posPulseTime_pT1_diff = new TH2F("ppshwr_h2posPulseTime_pT1_diff", "SHMS Positive Pre Shower ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", npos_pshwr_blks, 0.5, npos_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_posPulseTime_pT2_diff = new TH2F("ppshwr_h2posPulseTime_pT2_diff", "SHMS Positive Pre Shower ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", npos_pshwr_blks, 0.5, npos_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_posPulseTime_pT3_diff = new TH2F("ppshwr_h2posPulseTime_pT3_diff", "SHMS Positive Pre Shower ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", npos_pshwr_blks, 0.5, npos_pshwr_blks + 0.5, 300, -300, 0); + + h_pshwr_PulseInt = new TH1F ("pshwr_PulseInt", "Pulse Integral for Shower", bins, adc_min, adc_max); + h2_pshwr_pulseTime_pT1_diff = new TH2F("pshwr_h2_pulseTime_pT1_diff", "SHMS Shower ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nshwr_blks, 0.5, nshwr_blks + 0.5, 300, -300, 0); + h2_pshwr_pulseTime_pT2_diff = new TH2F("pshwr_h2_pulseTime_pT2_diff", "SHMS Shower ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nshwr_blks, 0.5, nshwr_blks + 0.5, 300, -300, 0); + h2_pshwr_pulseTime_pT3_diff = new TH2F("pshwr_h2_pulseTime_pT3_diff", "SHMS Shower ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nshwr_blks, 0.5, nshwr_blks + 0.5, 300, -300, 0); + + //NGC + h_pngc_adcPulseInt_sum = new TH1F ("pngc_adcPulseInt_sum", "Raw Pulse Int", bins, adc_min, adc_max); + + h_pngc_adcPulseInt[0] = new TH1F ("pngc_adcPulseInt1", "Raw Pulse Integral PMT1; PulseInt; Counts", 14500, -500, 14000); + h_pngc_adcPulseInt[1] = new TH1F ("pngc_adcPulseInt2", "Raw Pulse Integral PMT2; PulseInt; Counts", 14500, -500, 14000); + h_pngc_adcPulseInt[2] = new TH1F ("pngc_adcPulseInt3", "Raw Pulse Integral PMT3; PulseInt; Counts", 14500, -500, 14000); + h_pngc_adcPulseInt[3] = new TH1F ("pngc_adcPulseInt4", "Raw Pulse Integral PMT4; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_adcPulseAmp[0] = new TH1F ("pngc_adcPulseAmp1", "Raw Pulse Amp PMT1; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_adcPulseAmp[1] = new TH1F ("pngc_adcPulseAmp2", "Raw Pulse Amp PMT2; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_adcPulseAmp[2] = new TH1F ("pngc_adcPulseAmp3", "Raw Pulse Amp PMT3; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_adcPulseAmp[3] = new TH1F ("pngc_adcPulseAmp4", "Raw Pulse Amp PMT4; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_adcPulseTimeRaw[0] = new TH1F ("pngc_adcPulseTimeRaw1", "Raw Pulse TimeRaw PMT1; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_pngc_adcPulseTimeRaw[1] = new TH1F ("pngc_adcPulseTimeRaw2", "Raw Pulse TimeRaw PMT2; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_pngc_adcPulseTimeRaw[2] = new TH1F ("pngc_adcPulseTimeRaw3", "Raw Pulse TimeRaw PMT3; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_pngc_adcPulseTimeRaw[3] = new TH1F ("pngc_adcPulseTimeRaw4", "Raw Pulse TimeRaw PMT4; PulseTimeRaw; Counts", bins, adc_min, adc_max); + + h2_pngc_pulseTime_pT1_diff = new TH2F("pngc_h2_pulseTime_pT1_diff", "SHMS Noble Gas Cherenkov ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nngc_pmts, 0.5, nngc_pmts + 0.5, 300, -300, 0); + h2_pngc_pulseTime_pT2_diff = new TH2F("pngc_h2_pulseTime_pT2_diff", "SHMS Noble Gas Cherenkov ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nngc_pmts, 0.5, nngc_pmts + 0.5, 300, -300, 0); + h2_pngc_pulseTime_pT3_diff = new TH2F("pngc_h2_pulseTime_pT3_diff", "SHMS Noble Gas Cherenkov ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nngc_pmts, 0.5, nngc_pmts + 0.5, 300, -300, 0); + + h_pngc_quad1_pulseInt_e[0] = new TH1F ("pngc_quad1_pulseInt_e1", "Electrons in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_e[1] = new TH1F ("pngc_quad1_pulseInt_e2", "Electrons in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_e[2] = new TH1F ("pngc_quad1_pulseInt_e3", "Electrons in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_e[3] = new TH1F ("pngc_quad1_pulseInt_e4", "Electrons in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad1_pulseInt_pi[0] = new TH1F ("pngc_quad1_pulseInt_pi1", "Pions in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_pi[1] = new TH1F ("pngc_quad1_pulseInt_pi2", "Pions in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_pi[2] = new TH1F ("pngc_quad1_pulseInt_pi3", "Pions in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_pi[3] = new TH1F ("pngc_quad1_pulseInt_pi4", "Pions in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad1_pulseInt_sum[0] = new TH1F ("pngc_quad1_pulseInt_sum1", "Sum in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_sum[1] = new TH1F ("pngc_quad1_pulseInt_sum2", "Sum in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_sum[2] = new TH1F ("pngc_quad1_pulseInt_sum3", "Sum in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_sum[3] = new TH1F ("pngc_quad1_pulseInt_sum4", "Sum in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad2_pulseInt_e[0] = new TH1F ("pngc_quad2_pulseInt_e1", "Electrons in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_e[1] = new TH1F ("pngc_quad2_pulseInt_e2", "Electrons in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_e[2] = new TH1F ("pngc_quad2_pulseInt_e3", "Electrons in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_e[3] = new TH1F ("pngc_quad2_pulseInt_e4", "Electrons in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad2_pulseInt_pi[0] = new TH1F ("pngc_quad2_pulseInt_pi1", "Pions in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_pi[1] = new TH1F ("pngc_quad2_pulseInt_pi2", "Pions in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_pi[2] = new TH1F ("pngc_quad2_pulseInt_pi3", "Pions in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_pi[3] = new TH1F ("pngc_quad2_pulseInt_pi4", "Pions in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad2_pulseInt_sum[0] = new TH1F ("pngc_quad2_pulseInt_sum1", "Sum in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_sum[1] = new TH1F ("pngc_quad2_pulseInt_sum2", "Sum in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_sum[2] = new TH1F ("pngc_quad2_pulseInt_sum3", "Sum in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_sum[3] = new TH1F ("pngc_quad2_pulseInt_sum4", "Sum in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad3_pulseInt_e[0] = new TH1F ("pngc_quad3_pulseInt_e1", "Electrons in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_e[1] = new TH1F ("pngc_quad3_pulseInt_e2", "Electrons in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_e[2] = new TH1F ("pngc_quad3_pulseInt_e3", "Electrons in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_e[3] = new TH1F ("pngc_quad3_pulseInt_e4", "Electrons in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad3_pulseInt_pi[0] = new TH1F ("pngc_quad3_pulseInt_pi1", "Pions in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_pi[1] = new TH1F ("pngc_quad3_pulseInt_pi2", "Pions in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_pi[2] = new TH1F ("pngc_quad3_pulseInt_pi3", "Pions in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_pi[3] = new TH1F ("pngc_quad3_pulseInt_pi4", "Pions in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad3_pulseInt_sum[0] = new TH1F ("pngc_quad3_pulseInt_sum1", "Sum in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_sum[1] = new TH1F ("pngc_quad3_pulseInt_sum2", "Sum in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_sum[2] = new TH1F ("pngc_quad3_pulseInt_sum3", "Sum in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_sum[3] = new TH1F ("pngc_quad3_pulseInt_sum4", "Sum in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad4_pulseInt_e[0] = new TH1F ("pngc_quad4_pulseInt_e1", "Electrons in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_e[1] = new TH1F ("pngc_quad4_pulseInt_e2", "Electrons in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_e[2] = new TH1F ("pngc_quad4_pulseInt_e3", "Electrons in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_e[3] = new TH1F ("pngc_quad4_pulseInt_e4", "Electrons in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad4_pulseInt_pi[0] = new TH1F ("pngc_quad4_pulseInt_pi1", "Pions in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_pi[1] = new TH1F ("pngc_quad4_pulseInt_pi2", "Pions in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_pi[2] = new TH1F ("pngc_quad4_pulseInt_pi3", "Pions in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_pi[3] = new TH1F ("pngc_quad4_pulseInt_pi4", "Pions in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad4_pulseInt_sum[0] = new TH1F ("pngc_quad4_pulseInt_sum1", "Sum in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_sum[1] = new TH1F ("pngc_quad4_pulseInt_sum2", "Sum in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_sum[2] = new TH1F ("pngc_quad4_pulseInt_sum3", "Sum in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_sum[3] = new TH1F ("pngc_quad4_pulseInt_sum4", "Sum in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad1_pulseAmp_e[0] = new TH1F ("pngc_quad1_pulseAmp_e1", "Electrons in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_pngc_quad1_pulseAmp_e[1] = new TH1F ("pngc_quad1_pulseAmp_e2", "Electrons in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_pngc_quad1_pulseAmp_e[2] = new TH1F ("pngc_quad1_pulseAmp_e3", "Electrons in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_pngc_quad1_pulseAmp_e[3] = new TH1F ("pngc_quad1_pulseAmp_e4", "Electrons in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + + h_pngc_quad1_pulseAmp_pi[0] = new TH1F ("pngc_quad1_pulseAmp_pi1", "Pions in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_pi[1] = new TH1F ("pngc_quad1_pulseAmp_pi2", "Pions in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_pi[2] = new TH1F ("pngc_quad1_pulseAmp_pi3", "Pions in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_pi[3] = new TH1F ("pngc_quad1_pulseAmp_pi4", "Pions in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad1_pulseAmp_sum[0] = new TH1F ("pngc_quad1_pulseAmp_sum1", "Sum in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_sum[1] = new TH1F ("pngc_quad1_pulseAmp_sum2", "Sum in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_sum[2] = new TH1F ("pngc_quad1_pulseAmp_sum3", "Sum in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_sum[3] = new TH1F ("pngc_quad1_pulseAmp_sum4", "Sum in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad2_pulseAmp_e[0] = new TH1F ("pngc_quad2_pulseAmp_e1", "Electrons in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_e[1] = new TH1F ("pngc_quad2_pulseAmp_e2", "Electrons in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_e[2] = new TH1F ("pngc_quad2_pulseAmp_e3", "Electrons in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_e[3] = new TH1F ("pngc_quad2_pulseAmp_e4", "Electrons in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad2_pulseAmp_pi[0] = new TH1F ("pngc_quad2_pulseAmp_pi1", "Pions in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_pi[1] = new TH1F ("pngc_quad2_pulseAmp_pi2", "Pions in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_pi[2] = new TH1F ("pngc_quad2_pulseAmp_pi3", "Pions in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_pi[3] = new TH1F ("pngc_quad2_pulseAmp_pi4", "Pions in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad2_pulseAmp_sum[0] = new TH1F ("pngc_quad2_pulseAmp_sum1", "Sum in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_sum[1] = new TH1F ("pngc_quad2_pulseAmp_sum2", "Sum in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_sum[2] = new TH1F ("pngc_quad2_pulseAmp_sum3", "Sum in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_sum[3] = new TH1F ("pngc_quad2_pulseAmp_sum4", "Sum in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad3_pulseAmp_e[0] = new TH1F ("pngc_quad3_pulseAmp_e1", "Electrons in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_e[1] = new TH1F ("pngc_quad3_pulseAmp_e2", "Electrons in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_e[2] = new TH1F ("pngc_quad3_pulseAmp_e3", "Electrons in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_e[3] = new TH1F ("pngc_quad3_pulseAmp_e4", "Electrons in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad3_pulseAmp_pi[0] = new TH1F ("pngc_quad3_pulseAmp_pi1", "Pions in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_pi[1] = new TH1F ("pngc_quad3_pulseAmp_pi2", "Pions in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_pi[2] = new TH1F ("pngc_quad3_pulseAmp_pi3", "Pions in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_pi[3] = new TH1F ("pngc_quad3_pulseAmp_pi4", "Pions in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad3_pulseAmp_sum[0] = new TH1F ("pngc_quad3_pulseAmp_sum1", "Sum in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_sum[1] = new TH1F ("pngc_quad3_pulseAmp_sum2", "Sum in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_sum[2] = new TH1F ("pngc_quad3_pulseAmp_sum3", "Sum in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_sum[3] = new TH1F ("pngc_quad3_pulseAmp_sum4", "Sum in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad4_pulseAmp_e[0] = new TH1F ("pngc_quad4_pulseAmp_e1", "Electrons in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_e[1] = new TH1F ("pngc_quad4_pulseAmp_e2", "Electrons in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_e[2] = new TH1F ("pngc_quad4_pulseAmp_e3", "Electrons in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_e[3] = new TH1F ("pngc_quad4_pulseAmp_e4", "Electrons in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad4_pulseAmp_pi[0] = new TH1F ("pngc_quad4_pulseAmp_pi1", "Pions in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_pi[1] = new TH1F ("pngc_quad4_pulseAmp_pi2", "Pions in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_pi[2] = new TH1F ("pngc_quad4_pulseAmp_pi3", "Pions in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_pi[3] = new TH1F ("pngc_quad4_pulseAmp_pi4", "Pions in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad4_pulseAmp_sum[0] = new TH1F ("pngc_quad4_pulseAmp_sum1", "Sum in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_sum[1] = new TH1F ("pngc_quad4_pulseAmp_sum2", "Sum in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_sum[2] = new TH1F ("pngc_quad4_pulseAmp_sum3", "Sum in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_sum[3] = new TH1F ("pngc_quad4_pulseAmp_sum4", "Sum in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + //Tracking Information + h2_ptrk_fp = new TH2F("ptrk_h2_fp", "Tracking Information in Focal Plane; x Dimension; y Dimension", 100, -50, 50, 100, -50, 50); + h2_ptrk_fp_e = new TH2F("ptrk_h2_fp_e", "Tracking Information in Focal Plane with electron cuts; x Dimension; y Dimension", 100, -50, 50, 100, -50, 50); + h2_ptrk_fp_pi = new TH2F("ptrk_h2_fp_pi", "Tracking Information in Focal Plane with pion cuts; x Dimension; y Dimension", 100, -50, 50, 100, -50, 50); + + h2_ptrk_ngc_sum = new TH2F("ptrk_h2_ngc_sum", "Tracking Information in NGC; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_ngc_sum_noped = new TH2F("ptrk_h2_ngc_sum_noped", "Tracking Information in NGC, Pedistal Removed; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_ngc_sum_ped = new TH2F("ptrk_h2_ngc_sum_ped", "Tracking Information in NGC, Pedistal Only; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h2_ptrk_hgc_e = new TH2F("ptrk_h2_hgc_e", "Tracking Information in HGC with electron cuts; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_pi = new TH2F("ptrk_h2_hgc_pi", "Tracking Information in HGC with pion cuts; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_sum = new TH2F("ptrk_h2_hgc_sum", "Tracking Information in HGC; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h2_ptrk_hgc[0] = new TH2F("ptrk_h2_hgc1_PulseInt", "Tracking Information in HGC for PMT1 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc[1] = new TH2F("ptrk_h2_hgc2_PulseInt", "Tracking Information in HGC for PMT2 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc[2] = new TH2F("ptrk_h2_hgc3_PulseInt", "Tracking Information in HGC for PMT3 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc[3] = new TH2F("ptrk_h2_hgc4_PulseInt", "Tracking Information in HGC for PMT4 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h2_ptrk_hgc_adcAmp[0] = new TH2F("ptrk_h2_hgc1_PulseAmp", "Tracking Information in HGC for PMT1 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_adcAmp[1] = new TH2F("ptrk_h2_hgc2_PulseAmp", "Tracking Information in HGC for PMT2 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_adcAmp[2] = new TH2F("ptrk_h2_hgc3_PulseAmp", "Tracking Information in HGC for PMT3 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_adcAmp[3] = new TH2F("ptrk_h2_hgc4_PulseAmp", "Tracking Information in HGC for PMT4 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h3_ptrk_hgc_adcInt2NPE[0] = new TH3F("ptrk_h3_hgc_adcInt2NPE1", "Tracking Information in HGC for PMT1 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE[1] = new TH3F("ptrk_h3_hgc_adcInt2NPE2", "Tracking Information in HGC for PMT2 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE[2] = new TH3F("ptrk_h3_hgc_adcInt2NPE3", "Tracking Information in HGC for PMT3 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE[3] = new TH3F("ptrk_h3_hgc_adcInt2NPE4", "Tracking Information in HGC for PMT4 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcInt2NPE_e[0] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e1", "Tracking Information in HGC for PMT1 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_e[1] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e2", "Tracking Information in HGC for PMT2 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_e[2] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e3", "Tracking Information in HGC for PMT3 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_e[3] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e4", "Tracking Information in HGC for PMT4 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcInt2NPE_pi[0] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi1", "Tracking Information in HGC for PMT1 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_pi[1] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi2", "Tracking Information in HGC for PMT2 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_pi[2] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi3", "Tracking Information in HGC for PMT3 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_pi[3] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi4", "Tracking Information in HGC for PMT4 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcAmp2NPE[0] = new TH3F("ptrk_h3_hgc_adcAmp2NPE1", "Tracking Information in HGC for PMT1 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcAmp2NPE[1] = new TH3F("ptrk_h3_hgc_adcAmp2NPE2", "Tracking Information in HGC for PMT2 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcAmp2NPE[2] = new TH3F("ptrk_h3_hgc_adcAmp2NPE3", "Tracking Information in HGC for PMT3 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcAmp2NPE[3] = new TH3F("ptrk_h3_hgc_adcAmp2NPE4", "Tracking Information in HGC for PMT4 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcInt2NPE_full = new TH3F("ptrk_h3_hgc_adcInt2NPE_full", "Tracking Information in HGC for all PMTs; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, 20, 0, 20); + h3_ptrk_hgc_adcInt2NPE_full_e = new TH3F("ptrk_h3_hgc_adcInt2NPE_full_e", "Tracking Information in HGC for all PMTs with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, 20, 0, 20); + h3_ptrk_hgc_adcInt2NPE_full_pi = new TH3F("ptrk_h3_hgc_adcInt2NPE_full_pi", "Tracking Information in HGC for all PMTs with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, 20, 0, 20); + + h_ptrk_beta = new TH1F("ptrk_h_beta", "Beta Quantity from Tracking; Beta; Counts", 200, -5, 5); + + //Combination of Detectors + h2_pshwr_vs_phgcer = new TH2F ("pcom_h2_pshwr_vs_phgcer", "Pre-Shower vs. HGC; HGC NPE; Shower+Pre-Shower Energy (GeV)", 60, -10, 20, 100, 0, 20); + h2_pshwr_vs_pngc = new TH2F ("pcom_h2_pshwr_vs_pngc", "Pre-Shower vs. NGC; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_ppshwr = new TH2F("pcom_h2_pshwr_vs_ppshwr", "Pre-Shower vs. Shower; Shower Energy (GeV); Pre-Shower Energy (GeV)", 100, 0, 20, 100, 0, 20); + + h2_pshwr_vs_pngc_ecut = new TH2F ("pcom_h2_pshwr_vs_pngc_ecut", "Pre-Shower vs. NGC only Electrons; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_picut = new TH2F ("pcom_h2_pshwr_vs_pngc_picut", "Pre-Shower vs. NGC only Pions; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + + h2_pshwr_vs_pngc_ecut_pmt[0] = new TH2F ("pcom_h2_pshwr_vs_pngc_ecut_pmt1", "Pre-Shower vs. NGC only Electrons PMT1; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_ecut_pmt[1] = new TH2F ("pcom_h2_pshwr_vs_pngc_ecut_pmt2", "Pre-Shower vs. NGC only Electrons PMT2; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_ecut_pmt[2] = new TH2F ("pcom_h2_pshwr_vs_pngc_ecut_pmt3", "Pre-Shower vs. NGC only Electrons PMT3; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_ecut_pmt[3] = new TH2F ("pcom_h2_pshwr_vs_pngc_ecut_pmt4", "Pre-Shower vs. NGC only Electrons PMT4; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + + h2_pshwr_vs_pngc_picut_pmt[0] = new TH2F ("pcom_h2_pshwr_vs_pngc_picut_pmt1", "Pre-Shower vs. NGC only Pions PMT1; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_picut_pmt[1] = new TH2F ("pcom_h2_pshwr_vs_pngc_picut_pmt2", "Pre-Shower vs. NGC only Pions PMT2; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_picut_pmt[2] = new TH2F ("pcom_h2_pshwr_vs_pngc_picut_pmt3", "Pre-Shower vs. NGC only Pions PMT3; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_picut_pmt[3] = new TH2F ("pcom_h2_pshwr_vs_pngc_picut_pmt4", "Pre-Shower vs. NGC only Pions PMT4; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + + h2_pshwr_vs_phgc_ecut = new TH2F ("pcom_h2_pshwr_vs_phgc_ecut", "Pre-Shower vs. HGC only Electrons; HGC NPE; Shower+Pre-Shower Energy (GeV)", 60, -10, 20, 100, 0, 20); + h2_pshwr_vs_phgc_picut = new TH2F ("pcom_h2_pshwr_vs_phgc_picut", "Pre-Shower vs. HGC only Pions; HGC NPE; Shower+Pre-Shower Energy (GeV)", 60, -10, 20, 100, 0, 20); + + h2_pshwr_vs_pngc_latetcut[0] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut1", "Pre-Shower vs. NGC later time PMT1; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_latetcut[1] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut2", "Pre-Shower vs. NGC later time PMT2; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_latetcut[2] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut3", "Pre-Shower vs. NGC later time PMT3; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_latetcut[3] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut4", "Pre-Shower vs. NGC later time PMT4; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + + h2_pshwr_vs_pngc_earlytcut[0] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut1", "Pre-Shower vs. NGC earlier time PMT1; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_earlytcut[1] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut2", "Pre-Shower vs. NGC earlier time PMT2; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_earlytcut[2] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut3", "Pre-Shower vs. NGC earlier time PMT3; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_earlytcut[3] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut4", "Pre-Shower vs. NGC earlier time PMT4; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + + h_phgc_ecut_shwr[0] = new TH1F ("pcom_phgc_ecut_shwr1", "Electrons in HGC using Shower PMT1; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_ecut_shwr[1] = new TH1F ("pcom_phgc_ecut_shwr2", "Electrons in HGC using Shower PMT2; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_ecut_shwr[2] = new TH1F ("pcom_phgc_ecut_shwr3", "Electrons in HGC using Shower PMT3; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_ecut_shwr[3] = new TH1F ("pcom_phgc_ecut_shwr4", "Electrons in HGC using Shower PMT4; PulseInt; Counts", bins, adc_min, adc_max); + + h_phgc_picut_shwr[0] = new TH1F ("pcom_phgc_picut_shwr1", "Pions in HGC using Shower PMT1; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_picut_shwr[1] = new TH1F ("pcom_phgc_picut_shwr2", "Pions in HGC using Shower PMT2; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_picut_shwr[2] = new TH1F ("pcom_phgc_picut_shwr3", "Pions in HGC using Shower PMT3; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_picut_shwr[3] = new TH1F ("pcom_phgc_picut_shwr4", "Pions in HGC using Shower PMT4; PulseInt; Counts", bins, adc_min, adc_max); + + h2_EdivP_vs_P = new TH2F ("pcom_h2_EdivP_vs_P", "SHMS E/p vs. p; p (geV); E/p", 600, 0, 6, 100, 0, 1); + + //Loop of entries in tree + cout << "Number of entries found: " << nentries << endl; + + //Quantities used across detectors + Double_t pngc_NPE; + Double_t phgc_NPE; + + for (UInt_t ievent = 0; ievent < nentries; ievent++) + { + T->GetEntry(ievent); + + if ((ievent)%1000 == 0) + { + cout << "ievent = " << ievent << endl; + } + + if (ntracks != 1) continue; + for (UInt_t itrack = 0; itrack < ntracks; itrack++) + { + //Quantities for Particle ID cuts + phgc_NPE = 0; + for (UInt_t ipmt = 0; ipmt < nhgc_pmts; ipmt++) + { + phgc_NPE = phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]; + } + pngc_NPE = 0; + for (UInt_t ipmt = 0; ipmt < nngc_pmts; ipmt++) + { + pngc_NPE = pngc_pulseInt[ipmt]*ngc_adc2npe[ipmt]; + } + + //h_ptrk_beta->Fill(trk_beta[itrack]); + if (TMath::Abs(trk_beta[itrack] - 1.) > 0.2) continue; + + //Fill "Good" Hit Histos + for (UInt_t igoodhit = 0; igoodhit < p1X_nGoodHodoHits; igoodhit++) + {/* + h2_p1X_negTdcCorr->Fill(p1X_goodPaddle[igoodhit], p1X_goodNegTdcTimeCorr[igoodhit]); + h2_p1X_posTdcCorr->Fill(p1X_goodPaddle[igoodhit], p1X_goodPosTdcTimeCorr[igoodhit]); + h2_p1X_tdcCorrDiff->Fill(p1X_goodPaddle[igoodhit], p1X_goodPosTdcTimeCorr[igoodhit] - p1X_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p1X_goodPosTdcTimeCorr[igoodhit] - p1X_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p1X_plTime->Fill(p1X_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p1X Good Hodo Loop + + for (UInt_t igoodhit = 0; igoodhit < p1Y_nGoodHodoHits; igoodhit++) + {/* + h2_p1Y_negTdcCorr->Fill(p1Y_goodPaddle[igoodhit], p1Y_goodNegTdcTimeCorr[igoodhit]); + h2_p1Y_posTdcCorr->Fill(p1Y_goodPaddle[igoodhit], p1Y_goodPosTdcTimeCorr[igoodhit]); + h2_p1Y_tdcCorrDiff->Fill(p1Y_goodPaddle[igoodhit], p1Y_goodPosTdcTimeCorr[igoodhit] - p1Y_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p1Y_goodPosTdcTimeCorr[igoodhit] - p1Y_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p1Y_plTime->Fill(p1Y_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p1Y Good Hodo Loop + + for (UInt_t igoodhit = 0; igoodhit < p2X_nGoodHodoHits; igoodhit++) + {/* + h2_p2X_negTdcCorr->Fill(p2X_goodPaddle[igoodhit], p2X_goodNegTdcTimeCorr[igoodhit]); + h2_p2X_posTdcCorr->Fill(p2X_goodPaddle[igoodhit], p2X_goodPosTdcTimeCorr[igoodhit]); + h2_p2X_tdcCorrDiff->Fill(p2X_goodPaddle[igoodhit], p2X_goodPosTdcTimeCorr[igoodhit] - p2X_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p2X_goodPosTdcTimeCorr[igoodhit] - p2X_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p2X_plTime->Fill(p2X_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p2X Good Hodo Loop + + for (UInt_t igoodhit = 0; igoodhit < p2Y_nGoodHodoHits; igoodhit++) + {/* + h2_p2Y_negTdcCorr->Fill(p2Y_goodPaddle[igoodhit], p2Y_goodNegTdcTimeCorr[igoodhit]); + h2_p2Y_posTdcCorr->Fill(p2Y_goodPaddle[igoodhit], p2Y_goodPosTdcTimeCorr[igoodhit]); + h2_p2Y_tdcCorrDiff->Fill(p2Y_goodPaddle[igoodhit], p2Y_goodPosTdcTimeCorr[igoodhit] - p2Y_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p2Y_goodPosTdcTimeCorr[igoodhit] - p2Y_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p2Y_plTime->Fill(p2Y_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p2Y Good Hodo Loop + + //Fill Pulse/TDC Time Difference Histos + for (UInt_t iadchit = 0; iadchit < p1X_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1X_negTdcHits; itdchit++) + {/* + if (p1X_negAdcPaddle[iadchit] != p1X_negTdcPaddle[itdchit]) continue; + h2_p1Xneg_pt_tt_diff->Fill(p1X_negAdcPaddle[iadchit], p1X_negAdcPulseTime[iadchit]*clk2adc - p1X_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p1X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p1Y_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1Y_negTdcHits; itdchit++) + {///* + if (p1Y_negAdcPaddle[iadchit] != p1Y_negTdcPaddle[itdchit]) continue; + //h2_p1Yneg_pt_tt_diff->Fill(p1Y_negAdcPaddle[iadchit], p1Y_negAdcPulseTime[iadchit]*clk2adc - p1Y_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p1Y Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2X_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2X_negTdcHits; itdchit++) + {/* + if (p2X_negAdcPaddle[iadchit] != p2X_negTdcPaddle[itdchit]) continue; + h2_p2Xneg_pt_tt_diff->Fill(p2X_negAdcPaddle[iadchit], p2X_negAdcPulseTime[iadchit]*clk2adc - p2X_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p2X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2Y_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2Y_negTdcHits; itdchit++) + {///* + if (p2Y_negAdcPaddle[iadchit] != p2Y_negTdcPaddle[itdchit]) continue; + //h2_p2Yneg_pt_tt_diff->Fill(p2Y_negAdcPaddle[iadchit], p2Y_negAdcPulseTime[iadchit]*clk2adc - p2Y_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p2Y Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p1X_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1X_posTdcHits; itdchit++) + {/* + if (p1X_posAdcPaddle[iadchit] != p1X_posTdcPaddle[itdchit]) continue; + h2_p1Xpos_pt_tt_diff->Fill(p1X_posAdcPaddle[iadchit], p1X_posAdcPulseTime[iadchit]*clk2adc - p1X_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p1X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p1Y_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1Y_posTdcHits; itdchit++) + {/* + if (p1Y_nGoodHodoHits < 1) continue; + if (p1Y_posAdcPaddle[iadchit] != p1Y_posTdcPaddle[itdchit]) continue; + h2_p1Ypos_pt_tt_diff->Fill(p1Y_posAdcPaddle[iadchit], p1Y_posAdcPulseTime[iadchit]*clk2adc - p1Y_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p1Y Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2X_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2X_posTdcHits; itdchit++) + {/* + if (p2X_posAdcPaddle[iadchit] != p2X_posTdcPaddle[itdchit]) continue; + h2_p2Xpos_pt_tt_diff->Fill(p2X_posAdcPaddle[iadchit], p2X_posAdcPulseTime[iadchit]*clk2adc - p2X_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p2X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2Y_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2Y_posTdcHits; itdchit++) + {/* + if (p2Y_posAdcPaddle[iadchit] != p2Y_posTdcPaddle[itdchit]) continue; + h2_p2Ypos_pt_tt_diff->Fill(p2Y_posAdcPaddle[iadchit], p2Y_posAdcPulseTime[iadchit]*clk2adc - p2Y_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p2Y Time Corrected? + + //Fill Trigger Time Histos + /* + if (p1X_tdcTime != 0.0) h_p1X_tdc->Fill(p1X_tdcTime*clk2tdc); + if (p1Y_tdcTime != 0.0) h_p1Y_tdc->Fill(p1Y_tdcTime*clk2tdc); + if (p2X_tdcTime != 0.0) h_p2X_tdc->Fill(p2X_tdcTime*clk2tdc); + if (p2Y_tdcTime != 0.0) h_p2Y_tdc->Fill(p2Y_tdcTime*clk2tdc); + if (p1T_tdcTime != 0.0) h_p1T_tdc->Fill(p1T_tdcTime*clk2tdc); + if (p2T_tdcTime != 0.0) h_p2T_tdc->Fill(p2T_tdcTime*clk2tdc); + + h_pT1_tdc->Fill(pT1_tdcTime*clk2tdc); + h_pT2_tdc->Fill(pT2_tdcTime*clk2tdc); + h_pT3_tdc->Fill(pT3_tdcTime*clk2tdc);//*/ + + for (UInt_t iref = 0; iref < ndcRefTimes; iref++) + { + //h_pDCREF_tdc[iref]->Fill(pDCREF_tdcTime[iref]*clk2tdc); + } + /* + if (p1X_tdcTime != 0.0) h_p1XmpT2_tdc->Fill((pT2_tdcTime - p1X_tdcTime)*clk2tdc); + if (p1Y_tdcTime != 0.0) h_p1YmpT2_tdc->Fill((pT2_tdcTime - p1Y_tdcTime)*clk2tdc); + if (p2X_tdcTime != 0.0) h_p2XmpT2_tdc->Fill((pT2_tdcTime - p2X_tdcTime)*clk2tdc); + if (p2Y_tdcTime != 0.0) h_p2YmpT2_tdc->Fill((pT2_tdcTime - p2Y_tdcTime)*clk2tdc); + if (p1T_tdcTime != 0.0) h_p1TmpT2_tdc->Fill((pT2_tdcTime - p1T_tdcTime)*clk2tdc); + if (p2T_tdcTime != 0.0) h_p2TmpT2_tdc->Fill((pT2_tdcTime - p2T_tdcTime)*clk2tdc); + + if (p1X_tdcTime != 0.0) h_p1XmpT3_tdc->Fill((pT3_tdcTime - p1X_tdcTime)*clk2tdc); + if (p1Y_tdcTime != 0.0) h_p1YmpT3_tdc->Fill((pT3_tdcTime - p1Y_tdcTime)*clk2tdc); + if (p2X_tdcTime != 0.0) h_p2XmpT3_tdc->Fill((pT3_tdcTime - p2X_tdcTime)*clk2tdc); + if (p2Y_tdcTime != 0.0) h_p2YmpT3_tdc->Fill((pT3_tdcTime - p2Y_tdcTime)*clk2tdc); + if (p1T_tdcTime != 0.0) h_p1TmpT3_tdc->Fill((pT3_tdcTime - p1T_tdcTime)*clk2tdc); + if (p2T_tdcTime != 0.0) h_p2TmpT3_tdc->Fill((pT3_tdcTime - p2T_tdcTime)*clk2tdc); + + h_p1X_fpTime->Fill(p1X_fpTime); h_p1Y_fpTime->Fill(p1Y_fpTime); + h_p2X_fpTime->Fill(p2X_fpTime); h_p2Y_fpTime->Fill(p2Y_fpTime); + //*/ + //Aerogel + Double_t paero_adcPulseInt = 0.0; + for (UInt_t iaerohit = 0; iaerohit < paero_negHits; iaerohit++) + {/* + h2_paero_negPulseTime_pT1_diff->Fill(paero_negPmt[iaerohit], paero_negPulseTime[iaerohit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_paero_negPulseTime_pT2_diff->Fill(paero_negPmt[iaerohit], paero_negPulseTime[iaerohit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_paero_negPulseTime_pT3_diff->Fill(paero_negPmt[iaerohit], paero_negPulseTime[iaerohit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + paero_adcPulseInt += paero_negPulseInt[iaerohit]*aero_neg_adc2npe[iaerohit]; + } + for (UInt_t iaerohit = 0; iaerohit < paero_posHits; iaerohit++) + {/* + h2_paero_posPulseTime_pT1_diff->Fill(paero_posPmt[iaerohit], paero_posPulseTime[iaerohit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_paero_posPulseTime_pT2_diff->Fill(paero_posPmt[iaerohit], paero_posPulseTime[iaerohit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_paero_posPulseTime_pT3_diff->Fill(paero_posPmt[iaerohit], paero_posPulseTime[iaerohit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + paero_adcPulseInt += paero_posPulseInt[iaerohit]*aero_pos_adc2npe[iaerohit]; + } + //if (paero_adcPulseInt != 0.0) h_paero_PulseInt->Fill(paero_adcPulseInt); + //End of Loop over Aerogel + + + //Pre-Shower + Double_t ppshwr_adcPulseInt = 0; + for (UInt_t ipshwrhit=0; ipshwrhit < nneg_pshwr_blks; ipshwrhit++) + {/* + h2_ppshwr_negPulseTime_pT1_diff->Fill(ppshwr_negPmt[ipshwrhit], ppshwr_negPulseTime[ipshwrhit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_ppshwr_negPulseTime_pT2_diff->Fill(ppshwr_negPmt[ipshwrhit], ppshwr_negPulseTime[ipshwrhit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_ppshwr_negPulseTime_pT3_diff->Fill(ppshwr_negPmt[ipshwrhit], ppshwr_negPulseTime[ipshwrhit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + ppshwr_adcPulseInt += ppshwr_negPulseInt[ipshwrhit]*pshwr_neg_adc2GeV[ipshwrhit]; + } + + for (UInt_t ipshwrhit=0; ipshwrhit < npos_pshwr_blks; ipshwrhit++) + {/* + h2_ppshwr_posPulseTime_pT1_diff->Fill(ppshwr_posPmt[ipshwrhit], ppshwr_posPulseTime[ipshwrhit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_ppshwr_posPulseTime_pT2_diff->Fill(ppshwr_posPmt[ipshwrhit], ppshwr_posPulseTime[ipshwrhit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_ppshwr_posPulseTime_pT3_diff->Fill(ppshwr_posPmt[ipshwrhit], ppshwr_posPulseTime[ipshwrhit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + ppshwr_adcPulseInt += ppshwr_posPulseInt[ipshwrhit]*pshwr_pos_adc2GeV[ipshwrhit]; + } + if (ppshwr_adcPulseInt != 0.0) h_ppshwr_PulseInt->Fill(ppshwr_adcPulseInt); + //End of loop over Pre-Shower + + //Shower + Double_t pshwr_adcPulseInt = 0; + + for (UInt_t ishwrhit = 0; ishwrhit < nshwr_blks; ishwrhit++) + {/* + h2_pshwr_pulseTime_pT1_diff->Fill(pshwr_pmt[ishwrhit], pshwr_pulseTimeRaw[ishwrhit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_pshwr_pulseTime_pT2_diff->Fill(pshwr_pmt[ishwrhit], pshwr_pulseTimeRaw[ishwrhit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_pshwr_pulseTime_pT3_diff->Fill(pshwr_pmt[ishwrhit], pshwr_pulseTimeRaw[ishwrhit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + pshwr_adcPulseInt += pshwr_pulseInt[ishwrhit]*shwr_adc2GeV; + } + if (pshwr_adcPulseInt != 0.0) h_pshwr_PulseInt->Fill(pshwr_adcPulseInt); + + for (UInt_t itrack = 0; itrack < ntracks; itrack++) + { + // if (trk_pmag[0] != 0.0 && ntracks == 1) h2_EdivP_vs_P->Fill(trk_pmag[0], (ppshwr_adcPulseInt + pshwr_adcPulseInt)/trk_pmag[0]); + } + //End of Loop over Shower + + + //NGC + Double_t pngc_adcInt = 0; + Double_t pngc_adcAmp = 0; + pngc_NPE = 0; + + for (UInt_t ipmt = 0; ipmt < nngc_pmts; ipmt++) + { + if (pngc_pulseAmp[ipmt] == 0.0) continue; + if (pngc_pulseTimeRaw[ipmt] == 0.0) continue; + + pngc_adcInt += pngc_pulseInt[ipmt]; + pngc_adcAmp += pngc_pulseAmp[ipmt]; + pngc_NPE += pngc_pulseInt[ipmt]*ngc_adc2npe[ipmt]; + + //Basic Quantities + /* + h_pngc_adcPulseInt[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_adcPulseAmp[ipmt]->Fill(pngc_pulseAmp[ipmt]); + h_pngc_adcPulseTimeRaw[ipmt]->Fill(pngc_pulseTimeRaw[ipmt]*clk2adc); //*/ + + /* + h2_pngc_pulseTime_pT1_diff->Fill(pngc_pmt[ingchit], pngc_pulseTimeRaw[ingchit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_pngc_pulseTime_pT2_diff->Fill(pngc_pmt[ingchit], pngc_pulseTimeRaw[ingchit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_pngc_pulseTime_pT3_diff->Fill(pngc_pmt[ingchit], pngc_pulseTimeRaw[ingchit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + + //Generating histos for Quadrants vs PMT + /* + + if (trk_y[0] + trk_phi[0] * nngc_z >= 0.0 && trk_x[0] + trk_theta[0] * nngc_z >= 0.0) + { + h_pngc_quad1_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad1_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad1_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad1_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad1_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad1_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 1 + + if (trk_y[0] + trk_phi[0] * nngc_z < 0.0 && trk_x[0] + trk_theta[0] * nngc_z >= 0.0) + { + h_pngc_quad2_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad2_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad2_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad2_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad2_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad2_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 2 + + if (trk_y[0] + trk_phi[0] * nngc_z >= 0.0 && trk_x[0] + trk_theta[0] * nngc_z < 0.0) + { + h_pngc_quad3_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad3_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad3_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad3_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad3_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad3_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 3 + + if (trk_y[0] + trk_phi[0] * nngc_z < 0.0 && trk_x[0] + trk_theta[0] * nngc_z < 0.0) + { + h_pngc_quad4_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad4_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad4_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad4_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad4_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad4_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 4 //*/ + } + if (pngc_adcInt != 0.0) h_pngc_adcPulseInt_sum->Fill(pngc_adcInt); + //End of loop over NGC + + //HGC + Double_t phgc_Int = 0; + Double_t phgc_Amp = 0; + phgc_NPE = 0; + + for (UInt_t ipmt = 0; ipmt < nhgc_pmts; ipmt++) + { + if (phgc_pulseAmp[ipmt] == 0.0) continue; + if (phgc_pulseTimeRaw[ipmt] == 0.0) continue; + + phgc_Int += phgc_pulseInt[ipmt]; + phgc_Amp += phgc_pulseAmp[ipmt]; + phgc_NPE += phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]; //Remove pedistal from other PMTs? + + //Basic Quantities + ///* + h_phgc_adcPulseInt[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_adcPulseAmp[ipmt]->Fill(phgc_pulseAmp[ipmt]); + //h_phgc_adcPulseTimeRaw[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc); //*/ + + //Timing Information + /* + h2_phgc_hodstarttime_pulseTime[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phod_starttime*clk2tdc); + + h_phgc_adcPulseTimeCorr_T1[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc); + h_phgc_adcPulseTimeCorr_T2[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc); + h_phgc_adcPulseTimeCorr_T3[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc); + + h2_phgc_pulseTime_pT1_pmt->Fill(phgc_pmt[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc); + h2_phgc_pulseTime_pT2_pmt->Fill(phgc_pmt[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc); + h2_phgc_pulseTime_pT3_pmt->Fill(phgc_pmt[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc); + + h2_phgc_pulseTime_pT1_diff->Fill(pT1_tdcTime*clk2tdc, phgc_pulseTimeRaw[ipmt]*clk2adc); + h2_phgc_pulseTime_pT2_diff->Fill(pT2_tdcTime*clk2tdc, phgc_pulseTimeRaw[ipmt]*clk2adc); + h2_phgc_pulseTime_pT3_diff->Fill(pT3_tdcTime*clk2tdc, phgc_pulseTimeRaw[ipmt]*clk2adc); + + h2_phgc_adcInt_TimeRaw[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h2_phgc_adcAmp_TimeRaw[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseAmp[ipmt]); + + h2_phgc_adcInt_T1[ipmt]->Fill(pT1_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_adcInt_T2[ipmt]->Fill(pT2_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_adcInt_T3[ipmt]->Fill(pT3_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + + h2_phgc_pulseInt_pT1[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_pulseInt_pT2[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_pulseInt_pT3[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + + h2_phgc_TimeWalk_T1[ipmt]->Fill(phgc_pulseAmp[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc); + h2_phgc_TimeWalk_T2[ipmt]->Fill(phgc_pulseAmp[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc); + h2_phgc_TimeWalk_T3[ipmt]->Fill(phgc_pulseAmp[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + + //Performing cuts on PulseAmp to eliminate large counts with PulseInt = 0 + /* + if (phgc_pulseAmp[ipmt] <= 10) h_phgc_pulseAmp_10[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 10) h_phgc_pulseAmp_no10[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 20) h_phgc_pulseAmp_20[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 20) h_phgc_pulseAmp_no20[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 30) h_phgc_pulseAmp_30[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 30) h_phgc_pulseAmp_no30[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 40) h_phgc_pulseAmp_40[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 40) h_phgc_pulseAmp_no40[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 50) h_phgc_pulseAmp_50[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 50) h_phgc_pulseAmp_no50[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 60) h_phgc_pulseAmp_60[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 60) h_phgc_pulseAmp_no60[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 70) h_phgc_pulseAmp_70[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 70) h_phgc_pulseAmp_no70[ipmt]->Fill(phgc_pulseInt[ipmt]); + //*/ + + //Particle ID cuts with a linear cut + /* + if (pngc_adcInt > shwr_ngc_id->Eval(ppshwr_adcPulseInt + pshwr_adcPulseInt)) h_phgc_ecut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (pngc_adcInt < shwr_ngc_id->Eval(ppshwr_adcPulseInt + pshwr_adcPulseInt)) h_phgc_picut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + */ + + //Particle ID cuts with a 1/x cut + ///* + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + //h_phgc_ecut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h2_phgc_adcInt_TimeRaw_e[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h2_pshwr_vs_pngc_ecut_pmt[ipmt]->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h3_ptrk_hgc_adcInt2NPE_e[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + //h_phgc_picut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h2_phgc_adcInt_TimeRaw_pi[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h2_pshwr_vs_pngc_picut_pmt[ipmt]->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h3_ptrk_hgc_adcInt2NPE_pi[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + //h_phgc_picut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h2_phgc_adcInt_TimeRaw_pi[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h2_pshwr_vs_pngc_picut_pmt[ipmt]->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h3_ptrk_hgc_adcInt2NPE_pi[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + }//*/ + + //Tracking Information in HGC + ///* + h2_ptrk_hgc[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]); + h2_ptrk_hgc_adcAmp[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseAmp[ipmt]); + h3_ptrk_hgc_adcInt2NPE[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + //h3_ptrk_hgc_adcAmp2NPE[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseAmp[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + //*/ + + + //Generating histos for Quadrants vs PMT + ///* + + if (trk_y[0] + trk_phi[0] * nhgc_z >= 4.6 && trk_x[0] + trk_theta[0] * nhgc_z >= 9.4) + { + h_phgc_quad1_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad1_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad1_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad1_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 1 + + if (trk_y[0] + trk_phi[0] * nhgc_z < 4.6 && trk_x[0] + trk_theta[0] * nhgc_z >= 9.4) + { + h_phgc_quad2_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad2_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad2_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad2_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 2 + + if (trk_y[0] + trk_phi[0] * nhgc_z >= 4.6 && trk_x[0] + trk_theta[0] * nhgc_z < 9.4) + { + h_phgc_quad3_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad3_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad3_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad3_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 3 + + if (trk_y[0] + trk_phi[0] * nhgc_z < 4.6 && trk_x[0] + trk_theta[0] * nhgc_z < 9.4) + { + h_phgc_quad4_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad4_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad4_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad4_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 4 + + //*/ + + h_phgc_pulseInt_npe[ipmt]->Fill(phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + } + if (phgc_Int != 0.0) h_phgc_npesum->Fill(phgc_NPE); + //if (phgc_Int != 0.0) h_phgc_adcPulseIntSum->Fill(phgc_Int); + //if (phgc_Amp != 0.0) h_phgc_adcPulseAmpSum->Fill(phgc_Amp); + //if (phgc_Amp != 0.0) h3_ptrk_hgc_adcInt2NPE_full->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + //End of loop over HGC + + //Tracking Information + /* + h2_ptrk_ngc_sum->Fill(trk_x[0] + trk_theta[0] * nngc_z, trk_y[0] + trk_phi[0] * nngc_z); + if (pngc_adcAmp > 25.0) h2_ptrk_ngc_sum_noped->Fill(trk_x[0] + trk_theta[0] * nngc_z, trk_y[0] + trk_phi[0] * nngc_z); + if (pngc_adcAmp <= 25.0) h2_ptrk_ngc_sum_ped->Fill(trk_x[0] + trk_theta[0] * nngc_z, trk_y[0] + trk_phi[0] * nngc_z); + //h2_ptrk_hgc_sum->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + //h2_ptrk_fp->Fill(trk_x[0], trk_y[0]); //*/ + + //For a 1/x Cut on Paricle ID + /* + if (pngc_adcInt > 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_ptrk_fp_e->Fill(trk_x[0], trk_y[0]); + h2_ptrk_hgc_e->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + h3_ptrk_hgc_adcInt2NPE_full_e->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_ptrk_fp_pi->Fill(trk_x[0], trk_y[0]); + h2_ptrk_hgc_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + h3_ptrk_hgc_adcInt2NPE_full_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_ptrk_fp_pi->Fill(trk_x[0], trk_y[0]); + h2_ptrk_hgc_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + h3_ptrk_hgc_adcInt2NPE_full_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + }//*/ + + //Combinations of Detectors + ///* + if (phgc_NPE != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) h2_pshwr_vs_phgcer->Fill(phgc_NPE, pshwr_adcPulseInt + ppshwr_adcPulseInt); + if (pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) h2_pshwr_vs_pngc->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + //if (ppshwr_adcPulseInt != 0.0 && pshwr_adcPulseInt != 0.0) h2_pshwr_vs_ppshwr->Fill(pshwr_adcPulseInt, ppshwr_adcPulseInt); + //*/ + + //Cut on Shower and NGC for Electrons + //For a Linear Cut for Particle ID + /* + if (ppshwr_adcPulseInt + pshwr_adcPulseInt >= shwr_ngc_id->Eval(pngc_adcInt) && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_pshwr_vs_pngc_ecut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h_phgc_adcPulseIntSum_e->Fill(phgc_Int); + } + //Cut on Shower for Pions + if (ppshwr_adcPulseInt + pshwr_adcPulseInt < shwr_ngc_id->Eval(pngc_adcInt) && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_pshwr_vs_pngc_picut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h_phgc_adcPulseIntSum_pi->Fill(phgc_Int); + } + */ + //For a 1/x Cut on Paricle ID + ///* + if (pngc_adcInt > 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_pshwr_vs_pngc_ecut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + //h_phgc_adcPulseIntSum_e->Fill(phgc_Int); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_pshwr_vs_pngc_picut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + //h_phgc_adcPulseIntSum_pi->Fill(phgc_Int); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_pshwr_vs_pngc_picut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + //h_phgc_adcPulseIntSum_pi->Fill(phgc_Int); + } + //*/ + //Cut on Shower and HGC for Particle ID + ///* + if (phgc_NPE != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h2_pshwr_vs_phgc_ecut->Fill(phgc_NPE, pshwr_adcPulseInt + ppshwr_adcPulseInt); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h2_pshwr_vs_phgc_picut->Fill(phgc_NPE, pshwr_adcPulseInt + ppshwr_adcPulseInt); + } + }//*/ + + + //End Loop over Combination of Detectors + + } + }//End of loop over entries + + g->Write(); + + + + + //Start to draw things nicely + /* + + //Draw HGC PulseInt for each PMT + TCanvas *hgc_pulseInt = new TCanvas("hgc_pulseInt","[Diag]hgc_Int",1200,600); + hgc_pulseInt->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pulseInt->cd(i+1); + hgc_pulseInt->cd(i+1)->SetLogy(); + h_phgc_adcPulseInt[i]->GetXaxis()->SetTitle("ADC Channel"); + h_phgc_adcPulseInt[i]->GetYaxis()->SetTitle("Counts"); + h_phgc_adcPulseInt[i]->SetStats(0); + h_phgc_adcPulseInt[i]->DrawCopy(); + } + + //Draw HGC PulseAmp for each PMT + TCanvas *hgc_pulseAmp = new TCanvas("hgc_pulseAmp","[Diag]hgc_Amp",1200,600); + hgc_pulseAmp->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pulseAmp->cd(i+1); + hgc_pulseAmp->cd(i+1)->SetLogy(); + h_phgc_adcPulseAmp[i]->DrawCopy(); + } + + //Draw HGC PulseTimeRaw for each PMT + TCanvas *hgc_pulseTimeRaw = new TCanvas("hgc_pulseTimeRaw","[Diag]hgc_TimeRaw",1200,600); + hgc_pulseTimeRaw->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pulseTimeRaw->cd(i+1); + h_phgc_adcPulseTimeRaw[i]->DrawCopy(); + } + + //Draw NGC PulseInt + TCanvas *ngc_pulseInt = new TCanvas("ngc_pulseInt","[Diag]ngc_Int",1200,600); + ngc_pulseInt->cd(1)->SetLogy(); + h_pngc_adcPulseInt->DrawCopy(); + + + //Draw Pre-Shower and Shower PulseInt + TCanvas *ppshwr_pulseInt = new TCanvas("ppshwr_pulseInt","[Diag]Pre-/Shower PulseInt",1200,600); + ppshwr_pulseInt->Divide(1,2); + + ppshwr_pulseInt->cd(1); + ppshwr_pulseInt->cd(1)->SetLogy(); + h_pshwr_PulseInt->DrawCopy(); + + ppshwr_pulseInt->cd(2); + ppshwr_pulseInt->cd(2)->SetLogy(); + h_ppshwr_PulseInt->DrawCopy(); + + //Draw Pre-Shower vs HGC PulseInt + TCanvas *ppshwr_vs_hgc = new TCanvas("ppshwr_vs_hgc","[Diag]ppshwr vs hgc PulseInt",1200,600); + h2_pshwr_vs_phgcer->GetXaxis()->SetTitle("HGC ADC channel"); + h2_pshwr_vs_phgcer->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_phgcer->SetStats(0); + h2_pshwr_vs_phgcer->DrawCopy("Colz"); + + //Draw Pre-Shower vs Shower + TCanvas *ppshwr_vs_pshwr = new TCanvas("ppshwr_vs_pshwr","[Diag]ppshwr vs pshwr PulseInt",1200,600); + h2_pshwr_vs_ppshwr->GetXaxis()->SetTitle("Shower GeV"); + h2_pshwr_vs_ppshwr->GetYaxis()->SetTitle("Pre-Shower GeV"); + h2_pshwr_vs_ppshwr->SetStats(0); + h2_pshwr_vs_ppshwr->DrawCopy("Colz"); + + //Draw Pre-Shower vs NGC PulseInt + TCanvas *ppshwr_vs_ngc = new TCanvas("ppshwr_vs_ngc","[Diag]ppshwr vs ngc PulseInt",1200,600); + h2_pshwr_vs_pngc->GetXaxis()->SetTitle("NGC ADC channel"); + h2_pshwr_vs_pngc->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_pngc->DrawCopy("Colz"); + shwr_ngc_id->DrawCopy("same"); + + //Draw Pre-Shower vs NGC PulseInt pion & e cuts + TCanvas *pshwr_vs_ngc_cuts = new TCanvas("pswr_vs_ngc_cuts","[Diag]pshwr vs ngc PulseInt Cuts",1200,600); + pshwr_vs_ngc_cuts->Divide(2,1); + + pshwr_vs_ngc_cuts->cd(1); + h2_pshwr_vs_pngc_ecut->GetXaxis()->SetTitle("NGC ADC channel"); + h2_pshwr_vs_pngc_ecut->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_pngc_ecut->DrawCopy("Colz"); + shwr_ngc_id->DrawCopy("same"); + + pshwr_vs_ngc_cuts->cd(2); + h2_pshwr_vs_pngc_picut->GetXaxis()->SetTitle("NGC ADC channel"); + h2_pshwr_vs_pngc_picut->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_pngc_picut->DrawCopy("Colz"); + shwr_ngc_id->DrawCopy("same"); + + //Draw Electrons in HGC wrt Shower/Pre-Shower per PMT + TCanvas *hgc_ecut_shwr = new TCanvas("hgc_ecut_shwr","[Cut]HGC Electrons from Shower",1200,600); + hgc_ecut_shwr->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_ecut_shwr->cd(i+1); + hgc_ecut_shwr->cd(i+1)->SetLogy(); + h_phgc_ecut_shwr[i]->DrawCopy(); + } + + //Draw Pions in HGC wrt Shower/Pre-Shower per PMT + TCanvas *hgc_picut_shwr = new TCanvas("hgc_picut_shwr","[Cut]HGC Pions from Shower",1200,600); + hgc_picut_shwr->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_picut_shwr->cd(i+1); + hgc_picut_shwr->cd(i+1)->SetLogy(); + h_phgc_picut_shwr[i]->DrawCopy(); + } + + //Draw Pions, Electrons and Unchanged Pulse Int for HGC w Shower cut + TCanvas *hgc_sumcut_shwr = new TCanvas("hgc_sumcut_shwr","[Cut]HGC PulseInt Sum, e, pi",1200,600); + hgc_sumcut_shwr->cd(1)->SetLogy(); + h_phgc_adcPulseIntSum->DrawCopy(); + h_phgc_adcPulseIntSum_e->SetLineColor(5); + h_phgc_adcPulseIntSum_e->DrawCopy("same"); + h_phgc_adcPulseIntSum_pi->SetLineColor(7); + h_phgc_adcPulseIntSum_pi->DrawCopy("same"); + + //Draw HGC PulseInt with cuts on PulseAmp = 0. + TCanvas *hgc_pulseAmp0 = new TCanvas("hgc_pulseAmp0", "[Diag]HGC PulseInt with PulseAmp = 0.",1200,600); + hgc_pulseAmp0->Divide(2,7); + + hgc_pulseAmp0->cd(1); + hgc_pulseAmp0->cd(1)->SetLogy(); + h_phgc_pulseAmp_10->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_10->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_10->DrawCopy(); + + hgc_pulseAmp0->cd(2); + hgc_pulseAmp0->cd(2)->SetLogy(); + h_phgc_pulseAmp_no10->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no10->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no10->DrawCopy(); + + hgc_pulseAmp0->cd(3); + hgc_pulseAmp0->cd(3)->SetLogy(); + h_phgc_pulseAmp_20->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_20->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_20->DrawCopy(); + + hgc_pulseAmp0->cd(4); + hgc_pulseAmp0->cd(4)->SetLogy(); + h_phgc_pulseAmp_no20->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no20->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no20->DrawCopy(); + + hgc_pulseAmp0->cd(5); + hgc_pulseAmp0->cd(5)->SetLogy(); + h_phgc_pulseAmp_30->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_30->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_30->DrawCopy(); + + hgc_pulseAmp0->cd(6); + hgc_pulseAmp0->cd(6)->SetLogy(); + h_phgc_pulseAmp_no30->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no30->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no30->DrawCopy(); + + hgc_pulseAmp0->cd(7); + hgc_pulseAmp0->cd(7)->SetLogy(); + h_phgc_pulseAmp_40->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_40->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_40->DrawCopy(); + + hgc_pulseAmp0->cd(8); + hgc_pulseAmp0->cd(8)->SetLogy(); + h_phgc_pulseAmp_no40->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no40->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no40->DrawCopy(); + + hgc_pulseAmp0->cd(9); + hgc_pulseAmp0->cd(9)->SetLogy(); + h_phgc_pulseAmp_50->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_50->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_50->DrawCopy(); + + hgc_pulseAmp0->cd(10); + hgc_pulseAmp0->cd(10)->SetLogy(); + h_phgc_pulseAmp_no50->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no50->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no50->DrawCopy(); + + hgc_pulseAmp0->cd(11); + hgc_pulseAmp0->cd(11)->SetLogy(); + h_phgc_pulseAmp_60->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_60->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_60->DrawCopy(); + + hgc_pulseAmp0->cd(12); + hgc_pulseAmp0->cd(12)->SetLogy(); + h_phgc_pulseAmp_no60->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no60->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no60->DrawCopy(); + + hgc_pulseAmp0->cd(13); + hgc_pulseAmp0->cd(13)->SetLogy(); + h_phgc_pulseAmp_70->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_70->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_70->DrawCopy(); + + hgc_pulseAmp0->cd(14); + hgc_pulseAmp0->cd(14)->SetLogy(); + h_phgc_pulseAmp_no70->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no70->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no70->DrawCopy(); + + //Draw HGC adcInt vs TimeRaw + TCanvas *hgc_adcInt_TimeRaw = new TCanvas("hgc_adcInt_TimeRaw","[Diag]HGC PulseInt vs TimeRaw",1200,600); + hgc_adcInt_TimeRaw->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_TimeRaw->cd(i+1); + hgc_adcInt_TimeRaw->cd(i+1)->SetLogx(); + h2_phgc_adcInt_TimeRaw[i]->GetXaxis()->SetTitle("PulseInt"); + h2_phgc_adcInt_TimeRaw[i]->GetYaxis()->SetTitle("TimeRaw"); + h2_phgc_adcInt_TimeRaw[i]->DrawCopy("Colz"); + } + + //Draw HGC adcInt vs DC Trigger T1 + TCanvas *hgc_adcInt_T1 = new TCanvas("hgc_adcInt_T1","[Diag]HGC PulseInt vs T1",1200,600); + hgc_adcInt_T1->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_T1->cd(i+1); + hgc_adcInt_T1->cd(i+1)->SetLogx(); + h2_phgc_pulseInt_pT1[i]->GetYaxis()->SetTitle("ADC Time (ns)"); + h2_phgc_pulseInt_pT1[i]->GetXaxis()->SetTitle("ADC Channel"); + h2_phgc_pulseInt_pT1[i]->DrawCopy("Colz"); + } + + //Draw HGC adcInt vs DC Trigger T2 + TCanvas *hgc_adcInt_T2 = new TCanvas("hgc_adcInt_T2","[Diag]HGC PulseInt vs T2",1200,600); + hgc_adcInt_T2->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_T2->cd(i+1); + hgc_adcInt_T2->cd(i+1)->SetLogx(); + h2_phgc_pulseInt_pT2[i]->GetYaxis()->SetTitle("ADC Time (ns)"); + h2_phgc_pulseInt_pT2[i]->GetXaxis()->SetTitle("ADC Channel"); + h2_phgc_pulseInt_pT2[i]->DrawCopy("Colz"); + } + + //Draw HGC adcInt vs DC Trigger T3 + TCanvas *hgc_adcInt_T3 = new TCanvas("hgc_adcInt_T3","[Diag]HGC PulseInt vs T3",1200,600); + hgc_adcInt_T3->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_T3->cd(i+1); + hgc_adcInt_T3->cd(i+1)->SetLogx(); + h2_phgc_pulseInt_pT3[i]->GetYaxis()->SetTitle("ADC Time (ns)"); + h2_phgc_pulseInt_pT3[i]->GetXaxis()->SetTitle("ADC Channel"); + h2_phgc_pulseInt_pT3[i]->DrawCopy("Colz"); + } + + + //Draw Particle Tracking in HGC + TCanvas *hgc_trk = new TCanvas("hgc_trk", "[Diag]Particle Tracks in HGC",1200,600); + h2_ptrk_hgc_sum->GetYaxis()->SetTitle("Y Position"); + h2_ptrk_hgc_sum->GetXaxis()->SetTitle("X Position"); + h2_ptrk_hgc_sum->DrawCopy("Colz"); + + //Draw Particle Tracking in HGC for each PMT + TCanvas *hgc_pmt_trk = new TCanvas("hgc_pmt_trk", "[Diag]Particle Tracks in HGC for each PMT weighted by PulseInt",1200,600); + hgc_pmt_trk->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pmt_trk->cd(i+1); + hgc_pmt_trk->cd(i+1)->SetLogz(); + h2_ptrk_hgc[i]->GetYaxis()->SetTitle("Y Position"); + h2_ptrk_hgc[i]->GetXaxis()->SetTitle("X Position"); + h2_ptrk_hgc[i]->DrawCopy("Colz"); + } + + + //Draw Particle ID Separation with Quadrant Separation + TCanvas *hgc_trk_id_cut = new TCanvas("hgc_trk_id_cut", "[Cut]HGC Particle ID cut with Quadrant Cuts",1200,600); + hgc_trk_id_cut->Divide(4,4); + + for (int i=0; i<16; i++) + { + hgc_trk_id_cut->cd(i+1); + hgc_trk_id_cut->cd(i+1)->SetLogy(); + + if (i % 4 == 0) //Looking at PMT1 + { + if (i / 4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[0]->DrawCopy(); + h_phgc_quad1_e[0]->SetLineColor(2); + h_phgc_quad1_e[0]->DrawCopy("same"); + h_phgc_quad1_pi[0]->SetLineColor(8); + h_phgc_quad1_pi[0]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[0]->DrawCopy(); + h_phgc_quad2_e[0]->SetLineColor(2); + h_phgc_quad2_e[0]->DrawCopy("same"); + h_phgc_quad2_pi[0]->SetLineColor(8); + h_phgc_quad2_pi[0]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[0]->DrawCopy(); + h_phgc_quad3_e[0]->SetLineColor(2); + h_phgc_quad3_e[0]->DrawCopy("same"); + h_phgc_quad3_pi[0]->SetLineColor(8); + h_phgc_quad3_pi[0]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[0]->DrawCopy(); + h_phgc_quad4_e[0]->SetLineColor(2); + h_phgc_quad4_e[0]->DrawCopy("same"); + h_phgc_quad4_pi[0]->SetLineColor(8); + h_phgc_quad4_pi[0]->DrawCopy("same"); + } + }//End of PMT1 + + if (i % 4 == 1) //Looking at PMT2 + { + if (i / 4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[1]->DrawCopy(); + h_phgc_quad1_e[1]->SetLineColor(2); + h_phgc_quad1_e[1]->DrawCopy("same"); + h_phgc_quad1_pi[1]->SetLineColor(8); + h_phgc_quad1_pi[1]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[1]->DrawCopy(); + h_phgc_quad2_e[1]->SetLineColor(2); + h_phgc_quad2_e[1]->DrawCopy("same"); + h_phgc_quad2_pi[1]->SetLineColor(8); + h_phgc_quad2_pi[1]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[1]->DrawCopy(); + h_phgc_quad3_e[1]->SetLineColor(2); + h_phgc_quad3_e[1]->DrawCopy("same"); + h_phgc_quad3_pi[1]->SetLineColor(8); + h_phgc_quad3_pi[1]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[1]->DrawCopy(); + h_phgc_quad4_e[1]->SetLineColor(2); + h_phgc_quad4_e[1]->DrawCopy("same"); + h_phgc_quad4_pi[1]->SetLineColor(8); + h_phgc_quad4_pi[1]->DrawCopy("same"); + } + }//End of PMT2 + + if (i % 4 == 2) //Looking at PMT3 + { + if (i/4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[2]->DrawCopy(); + h_phgc_quad1_e[2]->SetLineColor(2); + h_phgc_quad1_e[2]->DrawCopy("same"); + h_phgc_quad1_pi[2]->SetLineColor(8); + h_phgc_quad1_pi[2]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[2]->DrawCopy(); + h_phgc_quad2_e[2]->SetLineColor(2); + h_phgc_quad2_e[2]->DrawCopy("same");trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z,phgc_pulseInt[ipmt]) + h_phgc_quad2_pi[2]->SetLineColor(8); + h_phgc_quad2_pi[2]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[2]->DrawCopy(); + h_phgc_quad3_e[2]->SetLineColor(2); + h_phgc_quad3_e[2]->DrawCopy("same"); + h_phgc_quad3_pi[2]->SetLineColor(8); + h_phgc_quad3_pi[2]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[2]->DrawCopy(); + h_phgc_quad4_e[2]->SetLineColor(2); + h_phgc_quad4_e[2]->DrawCopy("same"); + h_phgc_quad4_pi[2]->SetLineColor(8); + h_phgc_quad4_pi[2]->DrawCopy("same"); + } + }//End of PMT3 + + if (i % 4 == 3) //Looking at PMT4 + { + if (i/4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[3]->DrawCopy(); + h_phgc_quad1_e[3]->SetLineColor(2); + h_phgc_quad1_e[3]->DrawCopy("same"); + h_phgc_quad1_pi[3]->SetLineColor(8); + h_phgc_quad1_pi[3]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[3]->DrawCopy(); + h_phgc_quad2_e[3]->SetLineColor(2); + h_phgc_quad2_e[3]->DrawCopy("same"); + h_phgc_quad2_pi[3]->SetLineColor(8); + h_phgc_quad2_pi[3]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[3]->DrawCopy(); + h_phgc_quad3_e[3]->SetLineColor(2); + h_phgc_quad3_e[3]->DrawCopy("same"); + h_phgc_quad3_pi[3]->SetLineColor(8); + h_phgc_quad3_pi[3]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[3]->DrawCopy(); + h_phgc_quad4_e[3]->SetLineColor(2); + h_phgc_quad4_e[3]->DrawCopy("same"); + h_phgc_quad4_pi[3]->SetLineColor(8); + h_phgc_quad4_pi[3]->DrawCopy("same"); + } + }//End of PMT4 + } + */ +}//End of Program diff --git a/CALIBRATION/shms_hgcer_calib/scripts/analysis.C~ b/CALIBRATION/shms_hgcer_calib/scripts/analysis.C~ new file mode 100755 index 0000000000000000000000000000000000000000..94805291027d51a44b186d65d173c3405c6d1c37 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/analysis.C~ @@ -0,0 +1,2318 @@ +/* +Description of...everything + +***Abbreviations*** +PMT -- Photo-Multiplier Tube +HODO -- Hodoscopes +NGC -- Nobel Gas Cherenkov +HGC -- Heavy Gas Cherenkov +DC -- Drift Chambers +SHWR -- Shower Counter +PSHWR -- Pre-Shower Counter +hist -- Histogram + +***Constants*** +clk2tdc -- Conversion from channel to ns for TDC (in trigger) +clk2adc -- Conversion from channel to ns for FADC +ndcRefTimes -- Drift Chamber Reference Times + +nbars -- Number of paddles in HODO + +maxTDCHits -- Depreciated +maxAdcHits -- Depreciated + +bins -- # of bins for the hist +adc_min -- lower range for hist +adc_max -- upper range for hist + +nhgc_z -- location of HGC focal plane downstream +nhgc_pmts -- # of PMTs in HGC + +nshwr_blks -- # of blocks in the Shower +npos_pshwr_blks -- # of positive blocks in the PreShower +nneg_pshwr_blks -- # of negative blocks in the PreShower + +pshwr_neg_adc2Gev -- Converting SHWR channel into Energy (GeV) + +hgc_adc2npe -- Converting HGC channel into photo-electrons + +maxNUMTracks -- Number of viable tracks through SHMS, should only be 1 + +***Variables*** +phgc_hits -- Comes from NData...need to figure this one out +phgc_pmt -- Which HGC PMT detected event +phgc_pulseTimeRaw -- Two modes coarse and fine: coarse is the FADC time that the pulse passed threshold (not corrected), fine is the FADC time of 50% of max (time-walk corrected) (using fine) +phgc_pulseInt -- Integral of ADC waveform +phgc_pulseAmp -- Maximum amplitude of ADC waveform !!There is a ceiling on this value; if only 1-2 samples are above threshold this value will be 0.0 + */ + +//Main Script +void analysis(Int_t RunNumber=0) +{ + if (RunNumber == 0) + { + cout << "Enter a Run Number (-1 to exit): "; + cin >> RunNumber; + if (RunNumber <= 0) return; + } + + //Read Appropriate ROOT file + //TFile *F = new TFile("../../../ROOTfiles/shms_replay_488_10000.root"); + TFile *F = new TFile(Form("../../ROOTfiles/shms_replay_%d.root", RunNumber)); + + //Output Histograms + TFile *g = new TFile(Form("root_files/shms_calibration_%d.root", RunNumber), "RECREATE"); + + //Function to separate e and pi in shwr vs NGC + //TF1 *shwr_ngc_id = new TF1("shwr_ngc_id","-[0]*x + [1]",-5000,12000); + //shwr_ngc_id->SetParameters(0,6); + //shwr_ngc_id->SetParameters(0.002,14); + + TF1 *shwr_ngc_id = new TF1("shwr_ngc_id","[0]/(x + [1]) + [2]",2000,12000); + shwr_ngc_id->SetParameters(1000,-2000,4); + + //Function to separate e and pi in shwr vs HGC + TF1 *shwr_hgc_id = new TF1("shwr_hgc_id", "[0]*pow(x,2) + [1]*x + [2]", -10, 20); + shwr_hgc_id->SetParameters(0.12,-1.2,6.0); + + //Declare constants...but note it's better to pull these quantities from parameter files? + + const Double_t clk2tdc = 0.100; + const Double_t clk2adc = 0.0625; + const UInt_t ndcRefTimes = 10; + + const UInt_t nbars_1x = 13; + const UInt_t nbars_1y = 13; + const UInt_t nbars_2x = 14; + const UInt_t nbars_2y = 21; + + const UInt_t maxTdcHits = 128; + const UInt_t maxAdcHits = 4; + + const UInt_t bins = 560; + const UInt_t adc_min = -1000; + const UInt_t adc_max = 7000; + + const Float_t nhgc_z = 156.27; + const UInt_t nhgc_pmts = 4; + + const Float_t nngc_z = -50.00; + const UInt_t nngc_pmts = 4; + + const UInt_t npos_aero_pmts = 7; + const UInt_t nneg_aero_pmts = 7; + + const UInt_t nshwr_blks = 224; + const UInt_t npos_pshwr_blks = 14; + const UInt_t nneg_pshwr_blks = 14; + + //Converting the ADC signal in preShower/Shower to GeV + const Double_t pshwr_neg_adc2GeV[nneg_pshwr_blks] = {1.0/466.2, 1.0/514.7, 1.0/325.5, 1.0/247.8, + 1.0/322.0, 1.0/176.2, 1.0/161.9, 1.0/197.7, + 1.0/269.9, 1.0/241.6, 1.0/193.7, 1.0/337.5, + 1.0/237.3, 1.0/82.0}; + + const Double_t pshwr_pos_adc2GeV[npos_pshwr_blks] = {1.0/411.2, 1.0/378.6, 1.0/357.9, 1.0/254.8, + 1.0/315.6, 1.0/331.0, 1.0/264.6, 1.0/305.4, + 1.0/149.8, 1.0/380.6, 1.0/183.1, 1.0/206.5, + 1.0/139.8, 1.0/163.1}; + + const Double_t shwr_adc2GeV = 0.0005; + + //Converting the ADC signal in detectors to NPE + const Double_t hgc_adcInt2npe_pulseInt[nhgc_pmts] = {1./541.092, 1./432.955, 1./377.598, 1./488.450}; + const Double_t ngc_adc2npe[nngc_pmts] = {1.0/500., 1.0/500., 1.0/500., 1.0/500.}; + const Double_t aero_neg_adc2npe[nneg_aero_pmts] = {1./586.8, 1./536.5, 1./690.5, 1./563.1, + 1./574.4, 1./432.7, 1./601.5}; + const Double_t aero_pos_adc2npe[npos_aero_pmts] = {1./496.7, 1./467.5, 1./554.3, 1./766.1, + 1./412.1, 1./517.9, 1./435.6}; + + const UInt_t maxNumTracks = 10; + + + + //Declare variables + + //Drift Chamber Times + + Double_t p1X_tdcTime, p1Y_tdcTime, p2X_tdcTime, p2Y_tdcTime; + Double_t p1T_tdcTime, p2T_tdcTime; + Double_t pT1_tdcTime, pT2_tdcTime, pT3_tdcTime; + Double_t pDCREF_tdcTime[ndcRefTimes]; + + //Hodoscope Hits + + Int_t p1X_negAdcHits, p1Y_negAdcHits, p2X_negAdcHits, p2Y_negAdcHits; + Int_t p1X_negTdcHits, p1Y_negTdcHits, p2X_negTdcHits, p2Y_negTdcHits; + Double_t p1X_negAdcPaddle[maxAdcHits*nbars_1x], p1Y_negAdcPaddle[maxAdcHits*nbars_1y]; + Double_t p2X_negAdcPaddle[maxAdcHits*nbars_2x], p2Y_negAdcPaddle[maxAdcHits*nbars_2y]; + Double_t p1X_negTdcPaddle[maxTdcHits*nbars_1x], p1Y_negTdcPaddle[maxTdcHits*nbars_1y]; + Double_t p2X_negTdcPaddle[maxTdcHits*nbars_2x], p2Y_negTdcPaddle[maxTdcHits*nbars_2y]; + Double_t p1X_negAdcPulseTime[maxAdcHits*nbars_1x], p1Y_negAdcPulseTime[maxAdcHits*nbars_1y]; + Double_t p2X_negAdcPulseTime[maxAdcHits*nbars_2x], p2Y_negAdcPulseTime[maxAdcHits*nbars_2y]; + Double_t p1X_negTdcTime[maxTdcHits*nbars_1x], p1Y_negTdcTime[maxTdcHits*nbars_1y]; + Double_t p2X_negTdcTime[maxTdcHits*nbars_2x], p2Y_negTdcTime[maxTdcHits*nbars_2y]; + Int_t p1X_posAdcHits, p1Y_posAdcHits, p2X_posAdcHits, p2Y_posAdcHits; + Int_t p1X_posTdcHits, p1Y_posTdcHits, p2X_posTdcHits, p2Y_posTdcHits; + Double_t p1X_posAdcPaddle[maxAdcHits*nbars_1x], p1Y_posAdcPaddle[maxAdcHits*nbars_1y]; + Double_t p2X_posAdcPaddle[maxAdcHits*nbars_2x], p2Y_posAdcPaddle[maxAdcHits*nbars_2y]; + Double_t p1X_posTdcPaddle[maxTdcHits*nbars_1x], p1Y_posTdcPaddle[maxTdcHits*nbars_1y]; + Double_t p2X_posTdcPaddle[maxTdcHits*nbars_2x], p2Y_posTdcPaddle[maxTdcHits*nbars_2y]; + Double_t p1X_posAdcPulseTime[maxAdcHits*nbars_1x], p1Y_posAdcPulseTime[maxAdcHits*nbars_1y]; + Double_t p2X_posAdcPulseTime[maxAdcHits*nbars_2x], p2Y_posAdcPulseTime[maxAdcHits*nbars_2y]; + Double_t p1X_posTdcTime[maxTdcHits*nbars_1x], p1Y_posTdcTime[maxTdcHits*nbars_1y]; + Double_t p2X_posTdcTime[maxTdcHits*nbars_2x], p2Y_posTdcTime[maxTdcHits*nbars_2y]; + + //"Good" Hodo Hits + Int_t p1X_nGoodHodoHits, p1Y_nGoodHodoHits, p2X_nGoodHodoHits, p2Y_nGoodHodoHits; + Double_t p1X_goodPaddle[maxAdcHits*nbars_1x], p1Y_goodPaddle[maxAdcHits*nbars_1y]; + Double_t p2X_goodPaddle[maxAdcHits*nbars_2x], p2Y_goodPaddle[maxAdcHits*nbars_2y]; + Double_t p1X_goodNegTdcTimeCorr[maxTdcHits*nbars_1x], p1Y_goodNegTdcTimeCorr[maxTdcHits*nbars_1y]; + Double_t p2X_goodNegTdcTimeCorr[maxTdcHits*nbars_2x], p2Y_goodNegTdcTimeCorr[maxTdcHits*nbars_2y]; + Double_t p1X_goodPosTdcTimeCorr[maxTdcHits*nbars_1x], p1Y_goodPosTdcTimeCorr[maxTdcHits*nbars_1y]; + Double_t p2X_goodPosTdcTimeCorr[maxTdcHits*nbars_2x], p2Y_goodPosTdcTimeCorr[maxTdcHits*nbars_2y]; + + //Hodoscope Focal Plane Times + Double_t p1X_fpTime, p1Y_fpTime, p2X_fpTime, p2Y_fpTime; + Double_t p1X_plTime, p1Y_plTime, p2X_plTime, p2Y_plTime; + Double_t phod_starttime; + + + //Aerogel ADC + Int_t paero_posHits, paero_negHits; + Double_t paero_posPmt[maxAdcHits*npos_aero_pmts], paero_negPmt[maxAdcHits*nneg_aero_pmts]; + Double_t paero_posPulseTime[maxAdcHits*npos_aero_pmts], paero_negPulseTime[maxAdcHits*nneg_aero_pmts]; + Double_t paero_posPulseInt[maxAdcHits*npos_aero_pmts], paero_negPulseInt[maxAdcHits*nneg_aero_pmts]; + + //HGC ADC + Int_t phgc_hits; + Double_t phgc_pmt[nhgc_pmts]; + Double_t phgc_pulseTimeRaw[nhgc_pmts]; //changed from maxAdcHits*nhgc_pmts to nhgc_pmts with the new GoodAdcPulse hcana change -- Ryan Ambrose May 15 + Double_t phgc_pulseAmp[nhgc_pmts]; + Double_t phgc_pulseInt[nhgc_pmts]; + + //NGC ADC + Int_t pngc_hits; + Double_t pngc_pmt[nngc_pmts]; + Double_t pngc_pulseTimeRaw[nngc_pmts]; + Double_t pngc_pulseAmp[nngc_pmts]; + Double_t pngc_pulseInt[nngc_pmts]; + + //Pre-Shower ADC + Int_t ppshwr_posHits, ppshwr_negHits; + Double_t ppshwr_posPmt[maxAdcHits*npos_pshwr_blks], ppshwr_negPmt[maxAdcHits*nneg_pshwr_blks]; + Double_t ppshwr_posPulseTime[maxAdcHits*npos_pshwr_blks], ppshwr_negPulseTime[maxAdcHits*nneg_pshwr_blks]; + Double_t ppshwr_posPulseInt[maxAdcHits*npos_pshwr_blks], ppshwr_negPulseInt[maxAdcHits*nneg_pshwr_blks]; + + //Shower ADC + Int_t pshwr_hits; + Double_t pshwr_pmt[maxAdcHits*nshwr_blks], pshwr_pulseTimeRaw[maxAdcHits*nshwr_blks]; + Double_t pshwr_pulseInt[maxAdcHits*nshwr_blks]; + + //Tracking Information + Int_t ntracks; + Double_t trk_pmag[maxNumTracks]; + Double_t trk_beta[maxNumTracks]; + Double_t trk_x[maxNumTracks]; + Double_t trk_theta[maxNumTracks]; + Double_t trk_y[maxNumTracks]; + Double_t trk_phi[maxNumTracks]; + + + Long64_t nentries; + + + //Declare Histos + + //Drift Chamber + TH1F *h_p1X_tdc, *h_p1Y_tdc, *h_p2X_tdc, *h_p2Y_tdc; + TH1F *h_p1T_tdc, *h_p2T_tdc; + TH1F *h_pT1_tdc, *h_pT2_tdc, *h_pT3_tdc; + TH1F *h_p1XmpT2_tdc, *h_p1YmpT2_tdc, *h_p2XmpT2_tdc, *h_p2YmpT2_tdc; + TH1F *h_p1XmpT3_tdc, *h_p1YmpT3_tdc, *h_p2XmpT3_tdc, *h_p2YmpT3_tdc; + TH1F *h_p1TmpT2_tdc, *h_p2TmpT2_tdc, *h_p1TmpT3_tdc, *h_p2TmpT3_tdc; + TH1F *h_pDCREF_tdc[ndcRefTimes]; + + TH2F *h2_p1Xneg_pt_tt_diff, *h2_p1Yneg_pt_tt_diff, *h2_p2Xneg_pt_tt_diff, *h2_p2Yneg_pt_tt_diff; + TH2F *h2_p1Xpos_pt_tt_diff, *h2_p1Ypos_pt_tt_diff, *h2_p2Xpos_pt_tt_diff, *h2_p2Ypos_pt_tt_diff; + + TH1F *h_p1X_fpTime, *h_p1Y_fpTime, *h_p2X_fpTime, *h_p2Y_fpTime; + TH1F *h_p1X_plTime, *h_p1Y_plTime, *h_p2X_plTime, *h_p2Y_plTime; + + TH2F *h2_p1X_negTdcCorr, *h2_p1Y_negTdcCorr, *h2_p2X_negTdcCorr, *h2_p2Y_negTdcCorr; + TH2F *h2_p1X_posTdcCorr, *h2_p1Y_posTdcCorr, *h2_p2X_posTdcCorr, *h2_p2Y_posTdcCorr; + TH2F *h2_p1X_tdcCorrDiff, *h2_p1Y_tdcCorrDiff, *h2_p2X_tdcCorrDiff, *h2_p2Y_tdcCorrDiff; + + //Aerogel + TH2F *h2_paero_posPulseTime_pT1_diff, *h2_paero_negPulseTime_pT1_diff; + TH2F *h2_paero_posPulseTime_pT2_diff, *h2_paero_negPulseTime_pT2_diff; + TH2F *h2_paero_posPulseTime_pT3_diff, *h2_paero_negPulseTime_pT3_diff; + TH1F *h_paero_PulseInt; + + //HGC + TH1F *h_TEST; + + TH1F *h_phgc_adcPulseInt[4]; + TH1F *h_phgc_adcPulseTimeRaw[4]; + TH1F *h_phgc_adcPulseAmp[4]; + + TH1F *h_phgc_adcPulseAmpSum; + TH1F *h_phgc_adcPulseIntSum; + TH1F *h_phgc_adcPulseIntSum_e; + TH1F *h_phgc_adcPulseIntSum_pi; + + TH2F *h2_phgc_hodstarttime_pulseTime[4]; + + TH1F *h_phgc_adcPulseTimeCorr_T1[4]; + TH1F *h_phgc_adcPulseTimeCorr_T2[4]; + TH1F *h_phgc_adcPulseTimeCorr_T3[4]; + + TH2F *h2_phgc_adcInt_TimeRaw[4]; + TH2F *h2_phgc_adcAmp_TimeRaw[4]; + + TH2F *h2_phgc_pulseTime_pT1_pmt; + TH2F *h2_phgc_pulseTime_pT2_pmt; + TH2F *h2_phgc_pulseTime_pT3_pmt; + + TH2F *h2_phgc_pulseTime_pT1_diff; + TH2F *h2_phgc_pulseTime_pT2_diff; + TH2F *h2_phgc_pulseTime_pT3_diff; + + TH2F *h2_phgc_adcInt_T1[4]; + TH2F *h2_phgc_adcInt_T2[4]; + TH2F *h2_phgc_adcInt_T3[4]; + + TH2F *h2_phgc_pulseInt_pT1[4]; + TH2F *h2_phgc_pulseInt_pT2[4]; + TH2F *h2_phgc_pulseInt_pT3[4]; + + TH2F *h2_phgc_TimeWalk_T1[4]; + TH2F *h2_phgc_TimeWalk_T2[4]; + TH2F *h2_phgc_TimeWalk_T3[4]; + + TH2F *h2_phgc_adcInt_TimeRaw_pi[4]; + TH2F *h2_phgc_adcInt_TimeRaw_e[4]; + + TH1F *h_phgc_pulseAmp_10[4]; + TH1F *h_phgc_pulseAmp_no10[4]; + TH1F *h_phgc_pulseAmp_20[4]; + TH1F *h_phgc_pulseAmp_no20[4]; + TH1F *h_phgc_pulseAmp_30[4]; + TH1F *h_phgc_pulseAmp_no30[4]; + TH1F *h_phgc_pulseAmp_40[4]; + TH1F *h_phgc_pulseAmp_no40[4]; + TH1F *h_phgc_pulseAmp_50[4]; + TH1F *h_phgc_pulseAmp_no50[4]; + TH1F *h_phgc_pulseAmp_60[4]; + TH1F *h_phgc_pulseAmp_no60[4]; + TH1F *h_phgc_pulseAmp_70[4]; + TH1F *h_phgc_pulseAmp_no70[4]; + + TH1F *h_phgc_quad1_pulseInt_e[4]; + TH1F *h_phgc_quad1_pulseInt_pi[4]; + TH1F *h_phgc_quad1_pulseInt_sum[4]; + + TH1F *h_phgc_quad2_pulseInt_e[4]; + TH1F *h_phgc_quad2_pulseInt_pi[4]; + TH1F *h_phgc_quad2_pulseInt_sum[4]; + + TH1F *h_phgc_quad3_pulseInt_e[4]; + TH1F *h_phgc_quad3_pulseInt_pi[4]; + TH1F *h_phgc_quad3_pulseInt_sum[4]; + + TH1F *h_phgc_quad4_pulseInt_e[4]; + TH1F *h_phgc_quad4_pulseInt_pi[4]; + TH1F *h_phgc_quad4_pulseInt_sum[4]; + + TH1F *h_phgc_quad1_pulseAmp_e[4]; + TH1F *h_phgc_quad1_pulseAmp_pi[4]; + TH1F *h_phgc_quad1_pulseAmp_sum[4]; + + TH1F *h_phgc_quad2_pulseAmp_e[4]; + TH1F *h_phgc_quad2_pulseAmp_pi[4]; + TH1F *h_phgc_quad2_pulseAmp_sum[4]; + + TH1F *h_phgc_quad3_pulseAmp_e[4]; + TH1F *h_phgc_quad3_pulseAmp_pi[4]; + TH1F *h_phgc_quad3_pulseAmp_sum[4]; + + TH1F *h_phgc_quad4_pulseAmp_e[4]; + TH1F *h_phgc_quad4_pulseAmp_pi[4]; + TH1F *h_phgc_quad4_pulseAmp_sum[4]; + + TH1F *h_phgc_pulseInt_npe[4]; + + //PreShower & Shower + TH1F *h_ppshwr_PulseInt; + TH1F *h_pshwr_PulseInt; + + TH2F *h2_ppshwr_posPulseTime_pT1_diff, *h2_ppshwr_negPulseTime_pT1_diff; + TH2F *h2_ppshwr_posPulseTime_pT2_diff, *h2_ppshwr_negPulseTime_pT2_diff; + TH2F *h2_ppshwr_posPulseTime_pT3_diff, *h2_ppshwr_negPulseTime_pT3_diff; + + TH2F *h2_pshwr_pulseTime_pT1_diff; + TH2F *h2_pshwr_pulseTime_pT2_diff; + TH2F *h2_pshwr_pulseTime_pT3_diff; + + //NGC + TH1F *h_pngc_adcPulseInt_sum; + + TH1F *h_pngc_adcPulseInt[4]; + TH1F *h_pngc_adcPulseTimeRaw[4]; + TH1F *h_pngc_adcPulseAmp[4]; + + TH2F *h2_pngc_pulseTime_pT1_diff; + TH2F *h2_pngc_pulseTime_pT2_diff; + TH2F *h2_pngc_pulseTime_pT3_diff; + + TH1F *h_pngc_quad1_pulseInt_e[4]; + TH1F *h_pngc_quad1_pulseInt_pi[4]; + TH1F *h_pngc_quad1_pulseInt_sum[4]; + + TH1F *h_pngc_quad2_pulseInt_e[4]; + TH1F *h_pngc_quad2_pulseInt_pi[4]; + TH1F *h_pngc_quad2_pulseInt_sum[4]; + + TH1F *h_pngc_quad3_pulseInt_e[4]; + TH1F *h_pngc_quad3_pulseInt_pi[4]; + TH1F *h_pngc_quad3_pulseInt_sum[4]; + + TH1F *h_pngc_quad4_pulseInt_e[4]; + TH1F *h_pngc_quad4_pulseInt_pi[4]; + TH1F *h_pngc_quad4_pulseInt_sum[4]; + + TH1F *h_pngc_quad1_pulseAmp_e[4]; + TH1F *h_pngc_quad1_pulseAmp_pi[4]; + TH1F *h_pngc_quad1_pulseAmp_sum[4]; + + TH1F *h_pngc_quad2_pulseAmp_e[4]; + TH1F *h_pngc_quad2_pulseAmp_pi[4]; + TH1F *h_pngc_quad2_pulseAmp_sum[4]; + + TH1F *h_pngc_quad3_pulseAmp_e[4]; + TH1F *h_pngc_quad3_pulseAmp_pi[4]; + TH1F *h_pngc_quad3_pulseAmp_sum[4]; + + TH1F *h_pngc_quad4_pulseAmp_e[4]; + TH1F *h_pngc_quad4_pulseAmp_pi[4]; + TH1F *h_pngc_quad4_pulseAmp_sum[4]; + + //Tracking Information + TH2F *h2_ptrk_fp; + TH2F *h2_ptrk_fp_e; + TH2F *h2_ptrk_fp_pi; + + TH2F *h2_ptrk_ngc_sum; + TH2F *h2_ptrk_ngc_sum_noped; + TH2F *h2_ptrk_ngc_sum_ped; + + TH2F *h2_ptrk_hgc_e; + TH2F *h2_ptrk_hgc_pi; + TH2F *h2_ptrk_hgc_sum; + TH2F *h2_ptrk_hgc[4]; + TH2F *h2_ptrk_hgc_adcAmp[4]; + + TH3F *h3_ptrk_hgc_adcInt2NPE[4]; + TH3F *h3_ptrk_hgc_adcInt2NPE_e[4]; + TH3F *h3_ptrk_hgc_adcInt2NPE_pi[4]; + TH3F *h3_ptrk_hgc_adcAmp2NPE[4]; + TH3F *h3_ptrk_hgc_adcInt2NPE_full; + TH3F *h3_ptrk_hgc_adcInt2NPE_full_e; + TH3F *h3_ptrk_hgc_adcInt2NPE_full_pi; + + TH1F *h_ptrk_beta; + + //Between Detectors + TH2F *h2_pshwr_vs_phgcer; + TH2F *h2_pshwr_vs_pngc; + TH2F *h2_pshwr_vs_ppshwr; + + TH2F *h2_pshwr_vs_pngc_ecut; + TH2F *h2_pshwr_vs_pngc_picut; + TH2F *h2_pshwr_vs_phgc_ecut; + TH2F *h2_pshwr_vs_phgc_picut; + + TH2F *h2_pshwr_vs_pngc_latetcut[4]; + TH2F *h2_pshwr_vs_pngc_earlytcut[4]; + + + TH1F *h_phgc_ecut_shwr[4]; + TH1F *h_phgc_picut_shwr[4]; + + TH2F *h2_EdivP_vs_P; + + + //Declare tree + TTree *T = (TTree*)F->Get("T"); + nentries = T->GetEntries(); + + + //Aquire the branches + //Trigger Time Information + T->SetBranchAddress("T.shms.p1X_tdcTime", &p1X_tdcTime); + T->SetBranchAddress("T.shms.p1Y_tdcTime", &p1Y_tdcTime); + T->SetBranchAddress("T.shms.p2X_tdcTime", &p2X_tdcTime); + T->SetBranchAddress("T.shms.p2Y_tdcTime", &p2Y_tdcTime); + T->SetBranchAddress("T.shms.p1T_tdcTime", &p1T_tdcTime); + T->SetBranchAddress("T.shms.p2T_tdcTime", &p2T_tdcTime); + T->SetBranchAddress("T.shms.pT1_tdcTime", &pT1_tdcTime); + T->SetBranchAddress("T.shms.pT2_tdcTime", &pT2_tdcTime); + T->SetBranchAddress("T.shms.pT3_tdcTime", &pT3_tdcTime); + + //DC Refernce Times + for (UInt_t iref = 0; iref < ndcRefTimes; iref++) + T->SetBranchAddress(Form("T.shms.pDCREF%d_tdcTime", iref+1), &pDCREF_tdcTime[iref]); + + //Hodoscope Focal Plane Time Calculation + T->SetBranchAddress("P.hod.1x.fptime", &p1X_fpTime); + T->SetBranchAddress("P.hod.1y.fptime", &p1Y_fpTime); + T->SetBranchAddress("P.hod.2x.fptime", &p2X_fpTime); + T->SetBranchAddress("P.hod.2y.fptime", &p2Y_fpTime); + + //Hodoscope ADC Information + T->SetBranchAddress("Ndata.P.hod.1x.negAdcCounter", &p1X_negAdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.negAdcCounter", &p1Y_negAdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.negAdcCounter", &p2X_negAdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.negAdcCounter", &p2Y_negAdcHits); + T->SetBranchAddress("P.hod.1x.negAdcCounter", p1X_negAdcPaddle); + T->SetBranchAddress("P.hod.1y.negAdcCounter", p1Y_negAdcPaddle); + T->SetBranchAddress("P.hod.2x.negAdcCounter", p2X_negAdcPaddle); + T->SetBranchAddress("P.hod.2y.negAdcCounter", p2Y_negAdcPaddle); + T->SetBranchAddress("P.hod.1x.negAdcPulseTimeRaw", p1X_negAdcPulseTime); + T->SetBranchAddress("P.hod.1y.negAdcPulseTimeRaw", p1Y_negAdcPulseTime); + T->SetBranchAddress("P.hod.2x.negAdcPulseTimeRaw", p2X_negAdcPulseTime); + T->SetBranchAddress("P.hod.2y.negAdcPulseTimeRaw", p2Y_negAdcPulseTime); + T->SetBranchAddress("Ndata.P.hod.1x.posAdcCounter", &p1X_posAdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.posAdcCounter", &p1Y_posAdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.posAdcCounter", &p2X_posAdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.posAdcCounter", &p2Y_posAdcHits); + T->SetBranchAddress("P.hod.1x.posAdcCounter", p1X_posAdcPaddle); + T->SetBranchAddress("P.hod.1y.posAdcCounter", p1Y_posAdcPaddle); + T->SetBranchAddress("P.hod.2x.posAdcCounter", p2X_posAdcPaddle); + T->SetBranchAddress("P.hod.2y.posAdcCounter", p2Y_posAdcPaddle); + T->SetBranchAddress("P.hod.1x.posAdcPulseTimeRaw", p1X_posAdcPulseTime); + T->SetBranchAddress("P.hod.1y.posAdcPulseTimeRaw", p1Y_posAdcPulseTime); + T->SetBranchAddress("P.hod.2x.posAdcPulseTimeRaw", p2X_posAdcPulseTime); + T->SetBranchAddress("P.hod.2y.posAdcPulseTimeRaw", p2Y_posAdcPulseTime); + //Hodoscope TDC Information + T->SetBranchAddress("Ndata.P.hod.1x.negTdcCounter", &p1X_negTdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.negTdcCounter", &p1Y_negTdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.negTdcCounter", &p2X_negTdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.negTdcCounter", &p2Y_negTdcHits); + T->SetBranchAddress("P.hod.1x.negTdcCounter", p1X_negTdcPaddle); + T->SetBranchAddress("P.hod.1y.negTdcCounter", p1Y_negTdcPaddle); + T->SetBranchAddress("P.hod.2x.negTdcCounter", p2X_negTdcPaddle); + T->SetBranchAddress("P.hod.2y.negTdcCounter", p2Y_negTdcPaddle); + T->SetBranchAddress("P.hod.1x.negTdcTime", p1X_negTdcTime); + T->SetBranchAddress("P.hod.1y.negTdcTime", p1Y_negTdcTime); + T->SetBranchAddress("P.hod.2x.negTdcTime", p2X_negTdcTime); + T->SetBranchAddress("P.hod.2y.negTdcTime", p2Y_negTdcTime); + T->SetBranchAddress("Ndata.P.hod.1x.posTdcCounter", &p1X_posTdcHits); + T->SetBranchAddress("Ndata.P.hod.1y.posTdcCounter", &p1Y_posTdcHits); + T->SetBranchAddress("Ndata.P.hod.2x.posTdcCounter", &p2X_posTdcHits); + T->SetBranchAddress("Ndata.P.hod.2y.posTdcCounter", &p2Y_posTdcHits); + T->SetBranchAddress("P.hod.1x.posTdcCounter", p1X_posTdcPaddle); + T->SetBranchAddress("P.hod.1y.posTdcCounter", p1Y_posTdcPaddle); + T->SetBranchAddress("P.hod.2x.posTdcCounter", p2X_posTdcPaddle); + T->SetBranchAddress("P.hod.2y.posTdcCounter", p2Y_posTdcPaddle); + T->SetBranchAddress("P.hod.1x.posTdcTime", p1X_posTdcTime); + T->SetBranchAddress("P.hod.1y.posTdcTime", p1Y_posTdcTime); + T->SetBranchAddress("P.hod.2x.posTdcTime", p2X_posTdcTime); + T->SetBranchAddress("P.hod.2y.posTdcTime", p2Y_posTdcTime); + + //"Good" Hodoscope Hits, corrected times (not corrected for TOF to focal plane + T->SetBranchAddress("Ndata.P.hod.1x.GoodPaddle", &p1X_nGoodHodoHits); + T->SetBranchAddress("Ndata.P.hod.1y.GoodPaddle", &p1Y_nGoodHodoHits); + T->SetBranchAddress("Ndata.P.hod.2x.GoodPaddle", &p2X_nGoodHodoHits); + T->SetBranchAddress("Ndata.P.hod.2y.GoodPaddle", &p2Y_nGoodHodoHits); + T->SetBranchAddress("P.hod.1x.GoodPaddle", p1X_goodPaddle); + T->SetBranchAddress("P.hod.1y.GoodPaddle", p1Y_goodPaddle); + T->SetBranchAddress("P.hod.2x.GoodPaddle", p2X_goodPaddle); + T->SetBranchAddress("P.hod.2y.GoodPaddle", p2Y_goodPaddle); + T->SetBranchAddress("P.hod.1x.GoodNegTdcTimeCorr", p1X_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.1y.GoodNegTdcTimeCorr", p1Y_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.2x.GoodNegTdcTimeCorr", p2X_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.2y.GoodNegTdcTimeCorr", p2Y_goodNegTdcTimeCorr); + T->SetBranchAddress("P.hod.1x.GoodPosTdcTimeCorr", p1X_goodPosTdcTimeCorr); + T->SetBranchAddress("P.hod.1y.GoodPosTdcTimeCorr", p1Y_goodPosTdcTimeCorr); + T->SetBranchAddress("P.hod.2x.GoodPosTdcTimeCorr", p2X_goodPosTdcTimeCorr); + T->SetBranchAddress("P.hod.2y.GoodPosTdcTimeCorr", p2Y_goodPosTdcTimeCorr); + + //Other Hodoscope Data + T->SetBranchAddress("P.hod.starttime", &phod_starttime); + + //Aerogel + T->SetBranchAddress("Ndata.P.aero.negAdcCounter", &paero_negHits); + T->SetBranchAddress("Ndata.P.aero.posAdcCounter", &paero_posHits); + T->SetBranchAddress("P.aero.negAdcCounter", paero_negPmt); + T->SetBranchAddress("P.aero.posAdcCounter", paero_posPmt); + T->SetBranchAddress("P.aero.goodNegAdcPulseTime", paero_negPulseTime); + T->SetBranchAddress("P.aero.goodPosAdcPulseTime", paero_posPulseTime); + T->SetBranchAddress("P.aero.goodNegAdcPulseInt", paero_negPulseInt); + T->SetBranchAddress("P.aero.goodPosAdcPulseInt", paero_posPulseInt); + + /* Following Branch entries altered in hcana May 04 -- Ryan Ambrose + T->SetBranchAddress("P.aero.negAdcPulseTimeRaw", paero_negPulseTime); + T->SetBranchAddress("P.aero.posAdcPulseTimeRaw", paero_posPulseTime); + T->SetBranchAddress("P.aero.negAdcPulseInt", paero_negPulseInt); + T->SetBranchAddress("P.aero.posAdcPulseInt", paero_posPulseInt); + */ + + //HGC + T->SetBranchAddress("Ndata.P.hgcer.adcCounter", &phgc_hits); + T->SetBranchAddress("P.hgcer.adcCounter", phgc_pmt); + T->SetBranchAddress("P.hgcer.goodAdcPulseTime", phgc_pulseTimeRaw); + T->SetBranchAddress("P.hgcer.goodAdcPulseInt", phgc_pulseInt); + T->SetBranchAddress("P.hgcer.goodAdcPulseAmp", phgc_pulseAmp); + + /* Following Branch entries altered in hcana May 04 -- Ryan Ambrose + T->SetBranchAddress("P.hgcer.adcPulseTimeRaw", phgc_pulseTimeRaw); + T->SetBranchAddress("P.hgcer.adcPulseInt", phgc_pulseInt); + T->SetBranchAddress("P.hgcer.adcPulseAmp", phgc_pulseAmp); + */ + + //PreShower & Shower + T->SetBranchAddress("Ndata.P.cal.pr.negAdcCounter", &ppshwr_negHits); + T->SetBranchAddress("Ndata.P.cal.pr.posAdcCounter", &ppshwr_posHits); + T->SetBranchAddress("P.cal.pr.negAdcCounter", ppshwr_negPmt); + T->SetBranchAddress("P.cal.pr.posAdcCounter", ppshwr_posPmt); + T->SetBranchAddress("P.cal.pr.negAdcPulseTimeRaw", ppshwr_negPulseTime); + T->SetBranchAddress("P.cal.pr.posAdcPulseTimeRaw", ppshwr_posPulseTime); + T->SetBranchAddress("P.cal.pr.negAdcPulseInt", ppshwr_negPulseInt); + T->SetBranchAddress("P.cal.pr.posAdcPulseInt", ppshwr_posPulseInt); + + T->SetBranchAddress("Ndata.P.cal.fly.adcCounter", &pshwr_hits); + T->SetBranchAddress("P.cal.fly.adcCounter", pshwr_pmt); + T->SetBranchAddress("P.cal.fly.adcPulseTimeRaw", pshwr_pulseTimeRaw); + T->SetBranchAddress("P.cal.fly.adcPulseInt", pshwr_pulseInt); + + //NGC + T->SetBranchAddress("Ndata.P.ngcer.adcCounter", &pngc_hits); + T->SetBranchAddress("P.ngcer.adcCounter", pngc_pmt); + T->SetBranchAddress("P.ngcer.goodAdcPulseTime", pngc_pulseTimeRaw); + T->SetBranchAddress("P.ngcer.goodAdcPulseInt", pngc_pulseInt); + T->SetBranchAddress("P.ngcer.goodAdcPulseAmp", pngc_pulseAmp); + + /* Following Branch entries altered in hcana May 04 -- Ryan Ambrose + T->SetBranchAddress("P.ngcer.adcPulseTimeRaw", pngc_pulseTimeRaw); + T->SetBranchAddress("P.ngcer.adcPulseInt", pngc_pulseInt); + */ + + //Tracking + T->SetBranchAddress("Ndata.P.tr.p", &ntracks); + T->SetBranchAddress("P.tr.p", trk_pmag); + T->SetBranchAddress("P.tr.beta", trk_beta); + T->SetBranchAddress("P.tr.x", trk_x); + T->SetBranchAddress("P.tr.th", trk_theta); + T->SetBranchAddress("P.tr.y", trk_y); + T->SetBranchAddress("P.tr.ph", trk_phi); + + + //Create Histos + + //Drift Chambers + h_p1X_tdc = new TH1F("pdc_p1X_tdc", "S1X Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p1Y_tdc = new TH1F("pdc_p1Y_tdc", "S1Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p2X_tdc = new TH1F("pdc_p2X_tdc", "S2X Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p2Y_tdc = new TH1F("pdc_p2Y_tdc", "S2Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p1T_tdc = new TH1F("pdc_p1T_tdc", "S1X/S1Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_p2T_tdc = new TH1F("pdc_p2T_tdc", "S2X/S2Y Coincidence Time; TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_pT1_tdc = new TH1F("pdc_pT1_tdc", "Hodoscope Trigger (Slot 20 Channel 15); TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_pT2_tdc = new TH1F("pdc_pT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31); TDC Time (ns); Counts / 1 ns", 300, 0, 300); + h_pT3_tdc = new TH1F("pdc_pT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38); TDC Time (ns); Counts / 1 ns", 300, 0, 300); + for (UInt_t iref = 0; iref < ndcRefTimes; iref++) + h_pDCREF_tdc[iref] = new TH1F(Form("pdcREF%d_tdc", iref+1), Form("DC Reference Time %d; TDC Time (ns); Counts / 1 ns", iref+1), 200, 400, 600); + h_p1XmpT2_tdc = new TH1F("pdc_p1XmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S1X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1YmpT2_tdc = new TH1F("pdc_p1YmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S1Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2XmpT2_tdc = new TH1F("pdc_p2XmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S2X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2YmpT2_tdc = new TH1F("pdc_p2YmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S2Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1TmpT2_tdc = new TH1F("pdc_p1TmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S1; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2TmpT2_tdc = new TH1F("pdc_p2TmpT2_tdc", "Hodoscope Trigger (Slot 19 Channel 31) - S2; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1XmpT3_tdc = new TH1F("pdc_p1XmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S1X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1YmpT3_tdc = new TH1F("pdc_p1YmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S1Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2XmpT3_tdc = new TH1F("pdc_p2XmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S2X; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2YmpT3_tdc = new TH1F("pdc_p2YmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S2Y; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p1TmpT3_tdc = new TH1F("pdc_p1TmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S1; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + h_p2TmpT3_tdc = new TH1F("pdc_p2TmpT3_tdc", "Hodoscope Trigger (Slot 19 Channel 38) - S2; TDC Time (ns); Counts / 1 ns", 150, 0, 150); + + //Time Corrected Drift Chamber? + h2_p1Xneg_pt_tt_diff = new TH2F("pdc_h2_p1Xneg_pt_tt_diff", "S1X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1x, 0.5, nbars_1x + 0.5, 300, 0, 300); + h2_p1Yneg_pt_tt_diff = new TH2F("pdc_h2_p1Yneg_pt_tt_diff", "S1Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1y, 0.5, nbars_1y + 0.5, 300, 0, 300); + h2_p2Xneg_pt_tt_diff = new TH2F("pdc_h2_p2Xneg_pt_tt_diff", "S2X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2x, 0.5, nbars_2x + 0.5, 300, 0, 300); + h2_p2Yneg_pt_tt_diff = new TH2F("pdc_h2_p2Yneg_pt_tt_diff", "S2Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2y, 0.5, nbars_2y + 0.5, 300, 0, 300); + h2_p1Xpos_pt_tt_diff = new TH2F("pdc_h2_p1Xpos_pt_tt_diff", "S1X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1x, 0.5, nbars_1x + 0.5, 300, 0, 300); + h2_p1Ypos_pt_tt_diff = new TH2F("pdc_h2_p1Ypos_pt_tt_diff", "S1Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_1y, 0.5, nbars_1y + 0.5, 300, 0, 300); + h2_p2Xpos_pt_tt_diff = new TH2F("pdc_h2_p2Xpos_pt_tt_diff", "S2X- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2x, 0.5, nbars_2x + 0.5, 300, 0, 300); + h2_p2Ypos_pt_tt_diff = new TH2F("pdc_h2_p2Ypos_pt_tt_diff", "S2Y- Pulse Time - TDC Time; Pulse Time - TDC Time (ns); Counts / 1 ns", nbars_2y, 0.5, nbars_2y + 0.5, 300, 0, 300); + + //Drift Chamber Focal Plane Time + h_p1X_fpTime = new TH1F("pdc_p1X_fpTime", "S1X Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + h_p1Y_fpTime = new TH1F("pdc_p1Y_fpTime", "S1Y Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + h_p2X_fpTime = new TH1F("pdc_p2X_fpTime", "S2X Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + h_p2Y_fpTime = new TH1F("pdc_p2Y_fpTime", "S2Y Focal Plane Time; TDC Time (ns); Counts / 1ns", 100, 0, 100); + + h_p1X_plTime = new TH1F("pdc_p1X_plTime", "S1X Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + h_p1Y_plTime = new TH1F("pdc_p1Y_plTime", "S1Y Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + h_p2X_plTime = new TH1F("pdc_p2X_plTime", "S2X Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + h_p2Y_plTime = new TH1F("pdc_p2Y_plTime", "S2Y Plane Time; TDC Time (ns); Counts / 1ns", 120, -20, 100); + + //Corrected TDC Hodoscope + h2_p1X_negTdcCorr = new TH2F("phodo_h2_p1X_negTdcCorr", "S1X- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1x, 0.5, nbars_1x + 0.5, 200, -100, 100); + h2_p1Y_negTdcCorr = new TH2F("phodo_h2_p1Y_negTdcCorr", "S1Y- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1y, 0.5, nbars_1y + 0.5, 200, -100, 100); + h2_p2X_negTdcCorr = new TH2F("phodo_h2_p2X_negTdcCorr", "S2X- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2x, 0.5, nbars_2x + 0.5, 200, -100, 100); + h2_p2Y_negTdcCorr = new TH2F("phodo_h2_p2Y_negTdcCorr", "S2Y- Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2y, 0.5, nbars_2y + 0.5, 200, -100, 100); + h2_p1X_posTdcCorr = new TH2F("phodo_h2_p1X_posTdcCorr", "S1X+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1x, 0.5, nbars_1x + 0.5, 200, -100, 100); + h2_p1Y_posTdcCorr = new TH2F("phodo_h2_p1Y_posTdcCorr", "S1Y+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1y, 0.5, nbars_1y + 0.5, 200, -100, 100); + h2_p2X_posTdcCorr = new TH2F("phodo_h2_p2X_posTdcCorr", "S2X+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2x, 0.5, nbars_2x + 0.5, 200, -100, 100); + h2_p2Y_posTdcCorr = new TH2F("phodo_h2_p2Y_posTdcCorr", "S2Y+ Corrected TDC Time vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2y, 0.5, nbars_2y + 0.5, 200, -100, 100); + h2_p1X_tdcCorrDiff = new TH2F("phodo_h2_p1X_tdcCorrDiff", "S1X-/S1X+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1x, 0.5, nbars_1x + 0.5, 100, -50, 50); + h2_p1Y_tdcCorrDiff = new TH2F("phodo_h2_p1Y_tdcCorrDiff", "S1Y-/S1Y+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_1y, 0.5, nbars_1y + 0.5, 100, -50, 50); + h2_p2X_tdcCorrDiff = new TH2F("phodo_h2_p2X_tdcCorrDiff", "S2X-/S2X+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2x, 0.5, nbars_2x + 0.5, 100, -50, 50); + h2_p2Y_tdcCorrDiff = new TH2F("phodo_h2_p2Y_tdcCorrDiff", "S2Y-/S2Y+ Corrected TDC Time Difference vs. Paddle Number; Paddle Number; TDC Time (ns)", nbars_2y, 0.5, nbars_2y + 0.5, 100, -50, 50); + + //Aerogel + h2_paero_negPulseTime_pT1_diff = new TH2F("paero_h2_negPulseTime_pT1_diff", "SHMS Negative Aerogel ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nneg_aero_pmts, 0.5, nneg_aero_pmts + 0.5, 300, -300, 0); + h2_paero_negPulseTime_pT2_diff = new TH2F("paero_h2_negPulseTime_pT2_diff", "SHMS Negative Aerogel ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nneg_aero_pmts, 0.5, nneg_aero_pmts + 0.5, 300, -300, 0); + h2_paero_negPulseTime_pT3_diff = new TH2F("paero_h2_negPulseTime_pT3_diff", "SHMS Negative Aerogel ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nneg_aero_pmts, 0.5, nneg_aero_pmts + 0.5, 300, -300, 0); + h2_paero_posPulseTime_pT1_diff = new TH2F("paero_h2_posPulseTime_pT1_diff", "SHMS Positive Aerogel ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", npos_aero_pmts, 0.5, npos_aero_pmts + 0.5, 300, -300, 0); + h2_paero_posPulseTime_pT2_diff = new TH2F("paero_h2_posPulseTime_pT2_diff", "SHMS Positive Aerogel ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", npos_aero_pmts, 0.5, npos_aero_pmts + 0.5, 300, -300, 0); + h2_paero_posPulseTime_pT3_diff = new TH2F("paero_h2_posPulseTime_pT3_diff", "SHMS Positive Aerogel ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", npos_aero_pmts, 0.5, npos_aero_pmts + 0.5, 300, -300, 0); + h_paero_PulseInt = new TH1F("paero_PulseInt", "Raw Pulse Int", bins, adc_min, adc_max); + + //HGC + h_phgc_adcPulseInt[0] = new TH1F ("phgc_adcPulseInt1", "Raw Pulse Integral PMT1; PulseInt; Counts", 14500, -500, 14000); + h_phgc_adcPulseInt[1] = new TH1F ("phgc_adcPulseInt2", "Raw Pulse Integral PMT2; PulseInt; Counts", 14500, -500, 14000); + h_phgc_adcPulseInt[2] = new TH1F ("phgc_adcPulseInt3", "Raw Pulse Integral PMT3; PulseInt; Counts", 14500, -500, 14000); + h_phgc_adcPulseInt[3] = new TH1F ("phgc_adcPulseInt4", "Raw Pulse Integral PMT4; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_adcPulseAmp[0] = new TH1F ("phgc_adcPulseAmp1", "Raw Pulse Amp PMT1; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_adcPulseAmp[1] = new TH1F ("phgc_adcPulseAmp2", "Raw Pulse Amp PMT2; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_adcPulseAmp[2] = new TH1F ("phgc_adcPulseAmp3", "Raw Pulse Amp PMT3; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_adcPulseAmp[3] = new TH1F ("phgc_adcPulseAmp4", "Raw Pulse Amp PMT4; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_adcPulseTimeRaw[0] = new TH1F ("phgc_adcPulseTimeRaw1", "Raw Pulse TimeRaw PMT1; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeRaw[1] = new TH1F ("phgc_adcPulseTimeRaw2", "Raw Pulse TimeRaw PMT2; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeRaw[2] = new TH1F ("phgc_adcPulseTimeRaw3", "Raw Pulse TimeRaw PMT3; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeRaw[3] = new TH1F ("phgc_adcPulseTimeRaw4", "Raw Pulse TimeRaw PMT4; PulseTimeRaw; Counts", bins, adc_min, adc_max); + + h_phgc_adcPulseAmpSum = new TH1F ("phgc_adcPulseAmpSum", "Raw Pulse Amplitude Sum; PulseAmp; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseIntSum = new TH1F ("phgc_adcPulseIntSum", "Raw Pulse Integral Sum; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseIntSum_e = new TH1F ("phgc_adcPulseIntSum_e", "Raw Pulse Integral Electrons; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_adcPulseIntSum_pi = new TH1F ("phgc_adcPulseIntSum_pi", "Raw Pulse Integral Pions; PulseInt; Counts", bins, adc_min, adc_max); + + h2_phgc_hodstarttime_pulseTime[0] = new TH2F ("phgc_hodstarttime_pulseTime1", "PulseTimeRaw vs HodoStartTime PMT1; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_hodstarttime_pulseTime[1] = new TH2F ("phgc_hodstarttime_pulseTime2", "PulseTimeRaw vs HodoStartTime PMT2; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_hodstarttime_pulseTime[2] = new TH2F ("phgc_hodstarttime_pulseTime3", "PulseTimeRaw vs HodoStartTime PMT3; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_hodstarttime_pulseTime[3] = new TH2F ("phgc_hodstarttime_pulseTime4", "PulseTimeRaw vs HodoStartTime PMT4; PulseTimeRaw (ns); Hodoscope Start Time (ns)", bins, adc_min, adc_max, bins, adc_min, adc_max); + + + h_phgc_adcPulseTimeCorr_T1[0] = new TH1F("phgc_adcPulseTimeCorr_T11", "Corrected Pulse Time PMT1; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T1[1] = new TH1F("phgc_adcPulseTimeCorr_T12", "Corrected Pulse Time PMT2; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T1[2] = new TH1F("phgc_adcPulseTimeCorr_T13", "Corrected Pulse Time PMT3; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T1[3] = new TH1F("phgc_adcPulseTimeCorr_T14", "Corrected Pulse Time PMT4; PulseTimeRaw - T1 (ns); Counts", bins, adc_min, adc_max); + + h_phgc_adcPulseTimeCorr_T2[0] = new TH1F("phgc_adcPulseTimeCorr_T21", "Corrected Pulse Time PMT1; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T2[1] = new TH1F("phgc_adcPulseTimeCorr_T22", "Corrected Pulse Time PMT2; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T2[2] = new TH1F("phgc_adcPulseTimeCorr_T23", "Corrected Pulse Time PMT3; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T2[3] = new TH1F("phgc_adcPulseTimeCorr_T24", "Corrected Pulse Time PMT4; PulseTimeRaw - T2 (ns); Counts", bins, adc_min, adc_max); + + h_phgc_adcPulseTimeCorr_T3[0] = new TH1F("phgc_adcPulseTimeCorr_T31", "Corrected Pulse Time PMT1; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T3[1] = new TH1F("phgc_adcPulseTimeCorr_T32", "Corrected Pulse Time PMT2; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T3[2] = new TH1F("phgc_adcPulseTimeCorr_T33", "Corrected Pulse Time PMT3; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + h_phgc_adcPulseTimeCorr_T3[3] = new TH1F("phgc_adcPulseTimeCorr_T34", "Corrected Pulse Time PMT4; PulseTimeRaw - T3 (ns); Counts", bins, adc_min, adc_max); + + h2_phgc_pulseTime_pT1_pmt = new TH2F("phgc_h2_pulseTime_pT1_pmt", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nhgc_pmts, 0.5, nhgc_pmts + 0.5, 300, -300, 100); + h2_phgc_pulseTime_pT2_pmt = new TH2F("phgc_h2_pulseTime_pT2_pmt", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nhgc_pmts, 0.5, nhgc_pmts + 0.5, 300, -300, 100); + h2_phgc_pulseTime_pT3_pmt = new TH2F("phgc_h2_pulseTime_pT3_pmt", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nhgc_pmts, 0.5, nhgc_pmts + 0.5, 300, -300, 100); + + h2_phgc_pulseTime_pT1_diff = new TH2F("phgc_h2_pulseTime_pT1_diff", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T1; Trigger 1 Time (ns); ADC Pulse Time", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_pulseTime_pT2_diff = new TH2F("phgc_h2_pulseTime_pT2_diff", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T2; Trigger 2 Time (ns); ADC Pulse Time", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_pulseTime_pT3_diff = new TH2F("phgc_h2_pulseTime_pT3_diff", "SHMS Heavy Gas Cherenkov ADC Pulse Time - T3; Trigger 3 Time (ns); ADC Pulse Time", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_TimeRaw[0] = new TH2F ("phgc_adcInt_TimeRaw1", "Raw Pulse TimeRaw vs Int PMT1; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw[1] = new TH2F ("phgc_adcInt_TimeRaw2", "Raw Pulse TimeRaw vs Int PMT2; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw[2] = new TH2F ("phgc_adcInt_TimeRaw3", "Raw Pulse TimeRaw vs Int PMT3; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw[3] = new TH2F ("phgc_adcInt_TimeRaw4", "Raw Pulse TimeRaw vs Int PMT4; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcAmp_TimeRaw[0] = new TH2F ("phgc_adcAmp_TimeRaw1", "Raw Pulse TimeRaw vs Amp PMT1; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcAmp_TimeRaw[1] = new TH2F ("phgc_adcAmp_TimeRaw2", "Raw Pulse TimeRaw vs Amp PMT2; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcAmp_TimeRaw[2] = new TH2F ("phgc_adcAmp_TimeRaw3", "Raw Pulse TimeRaw vs Amp PMT3; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcAmp_TimeRaw[3] = new TH2F ("phgc_adcAmp_TimeRaw4", "Raw Pulse TimeRaw vs Amp PMT4; PulseTimeRaw (ns); PulseAmp", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_TimeRaw_pi[0] = new TH2F ("phgc_adcInt_TimeRaw_pi1", "Raw Pulse TimeRaw vs Int PMT1 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_pi[1] = new TH2F ("phgc_adcInt_TimeRaw_pi2", "Raw Pulse TimeRaw vs Int PMT2 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_pi[2] = new TH2F ("phgc_adcInt_TimeRaw_pi3", "Raw Pulse TimeRaw vs Int PMT3 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_pi[3] = new TH2F ("phgc_adcInt_TimeRaw_pi4", "Raw Pulse TimeRaw vs Int PMT4 with pions; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_TimeRaw_e[0] = new TH2F ("phgc_adcInt_TimeRaw_e1", "Raw Pulse TimeRaw vs Int PMT1 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_e[1] = new TH2F ("phgc_adcInt_TimeRaw_e2", "Raw Pulse TimeRaw vs Int PMT2 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_e[2] = new TH2F ("phgc_adcInt_TimeRaw_e3", "Raw Pulse TimeRaw vs Int PMT3 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_TimeRaw_e[3] = new TH2F ("phgc_adcInt_TimeRaw_e4", "Raw Pulse TimeRaw vs Int PMT4 with electrons; PulseTimeRaw (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_T1[0] = new TH2F ("phgc_adcInt_T11", "Raw Pulse TimeRaw vs Int PMT1; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T1[1] = new TH2F ("phgc_adcInt_T12", "Raw Pulse TimeRaw vs Int PMT2; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T1[2] = new TH2F ("phgc_adcInt_T13", "Raw Pulse TimeRaw vs Int PMT3; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T1[3] = new TH2F ("phgc_adcInt_T14", "Raw Pulse TimeRaw vs Int PMT4; Trigger 1 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_T2[0] = new TH2F ("phgc_adcInt_T21", "Raw Pulse TimeRaw vs Int PMT1; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T2[1] = new TH2F ("phgc_adcInt_T22", "Raw Pulse TimeRaw vs Int PMT2; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T2[2] = new TH2F ("phgc_adcInt_T23", "Raw Pulse TimeRaw vs Int PMT3; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T2[3] = new TH2F ("phgc_adcInt_T24", "Raw Pulse TimeRaw vs Int PMT4; Trigger 2 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_adcInt_T3[0] = new TH2F ("phgc_adcInt_T31", "Raw Pulse TimeRaw vs Int PMT1; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T3[1] = new TH2F ("phgc_adcInt_T32", "Raw Pulse TimeRaw vs Int PMT2; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T3[2] = new TH2F ("phgc_adcInt_T33", "Raw Pulse TimeRaw vs Int PMT3; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + h2_phgc_adcInt_T3[3] = new TH2F ("phgc_adcInt_T34", "Raw Pulse TimeRaw vs Int PMT4; Trigger 3 (ns); PulseInt", bins, adc_min, adc_max, bins, adc_min, adc_max); + + h2_phgc_pulseInt_pT1[0] = new TH2F("phgc_h2_pulseInt_pT11", "HGC PulseInt vs Trigger PulseTime PMT1; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT1[1] = new TH2F("phgc_h2_pulseInt_pT12", "HGC PulseInt vs Trigger PulseTime PMT2; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT1[2] = new TH2F("phgc_h2_pulseInt_pT13", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT1[3] = new TH2F("phgc_h2_pulseInt_pT14", "HGC PulseInt vs Trigger PulseTime PMT4; PulseTimeRaw - T1 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_pulseInt_pT2[0] = new TH2F("phgc_h2_pulseInt_pT21", "HGC PulseInt vs Trigger PulseTime PMT1; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT2[1] = new TH2F("phgc_h2_pulseInt_pT22", "HGC PulseInt vs Trigger PulseTime PMT2; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT2[2] = new TH2F("phgc_h2_pulseInt_pT23", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT2[3] = new TH2F("phgc_h2_pulseInt_pT24", "HGC PulseInt vs Trigger PulseTime PMT4; PulseTimeRaw - T2 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_pulseInt_pT3[0] = new TH2F("phgc_h2_pulseInt_pT31", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT3[1] = new TH2F("phgc_h2_pulseInt_pT32", "HGC PulseInt vs Trigger PulseTime PMT2; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT3[2] = new TH2F("phgc_h2_pulseInt_pT33", "HGC PulseInt vs Trigger PulseTime PMT3; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_pulseInt_pT3[3] = new TH2F("phgc_h2_pulseInt_pT34", "HGC PulseInt vs Trigger PulseTime PMT4; PulseTimeRaw - T3 (ns); PulseInt", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_TimeWalk_T1[0] = new TH2F("phgc_h2_TimeWalk_T11", "HGC Hit Time vs. Pulse Peak PMT 1; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T1[1] = new TH2F("phgc_h2_TimeWalk_T12", "HGC Hit Time vs. Pulse Peak PMT 2; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T1[2] = new TH2F("phgc_h2_TimeWalk_T13", "HGC Hit Time vs. Pulse Peak PMT 3; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T1[3] = new TH2F("phgc_h2_TimeWalk_T14", "HGC Hit Time vs. Pulse Peak PMT 4; Pulse Peak; PulseTimeRaw - Tigger T1", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_TimeWalk_T2[0] = new TH2F("phgc_h2_TimeWalk_T21", "HGC Hit Time vs. Pulse Peak PMT 1; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T2[1] = new TH2F("phgc_h2_TimeWalk_T22", "HGC Hit Time vs. Pulse Peak PMT 2; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T2[2] = new TH2F("phgc_h2_TimeWalk_T23", "HGC Hit Time vs. Pulse Peak PMT 3; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T2[3] = new TH2F("phgc_h2_TimeWalk_T24", "HGC Hit Time vs. Pulse Peak PMT 4; Pulse Peak; PulseTimeRaw - Tigger T2", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h2_phgc_TimeWalk_T3[0] = new TH2F("phgc_h2_TimeWalk_T31", "HGC Hit Time vs. Pulse Peak PMT 1; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T3[1] = new TH2F("phgc_h2_TimeWalk_T32", "HGC Hit Time vs. Pulse Peak PMT 2; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T3[2] = new TH2F("phgc_h2_TimeWalk_T33", "HGC Hit Time vs. Pulse Peak PMT 3; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + h2_phgc_TimeWalk_T3[3] = new TH2F("phgc_h2_TimeWalk_T34", "HGC Hit Time vs. Pulse Peak PMT 4; Pulse Peak; PulseTimeRaw - Tigger T3", 1000, adc_min, adc_max, 500, adc_min, adc_max); + + h_phgc_pulseAmp_10[0] = new TH1F ("phgc_pulseAmp_101", "HGC PulseInt with PulseAmp = 10 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[0] = new TH1F ("phgc_pulseAmp_no101", "HGC PulseInt without PulseAmp = 10 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_10[1] = new TH1F ("phgc_pulseAmp_102", "HGC PulseInt with PulseAmp = 10 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[1] = new TH1F ("phgc_pulseAmp_no102", "HGC PulseInt without PulseAmp = 10 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_10[2] = new TH1F ("phgc_pulseAmp_103", "HGC PulseInt with PulseAmp = 10 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[2] = new TH1F ("phgc_pulseAmp_no103", "HGC PulseInt without PulseAmp = 10 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_10[3] = new TH1F ("phgc_pulseAmp_104", "HGC PulseInt with PulseAmp = 10 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no10[3] = new TH1F ("phgc_pulseAmp_no104", "HGC PulseInt without PulseAmp = 10 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_20[0] = new TH1F ("phgc_pulseAmp_201", "HGC PulseInt with PulseAmp = 20 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[0] = new TH1F ("phgc_pulseAmp_no201", "HGC PulseInt without PulseAmp = 20 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_20[1] = new TH1F ("phgc_pulseAmp_202", "HGC PulseInt with PulseAmp = 20 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[1] = new TH1F ("phgc_pulseAmp_no202", "HGC PulseInt without PulseAmp = 20 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_20[2] = new TH1F ("phgc_pulseAmp_203", "HGC PulseInt with PulseAmp = 20 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[2] = new TH1F ("phgc_pulseAmp_no203", "HGC PulseInt without PulseAmp = 20 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_20[3] = new TH1F ("phgc_pulseAmp_204", "HGC PulseInt with PulseAmp = 20 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no20[3] = new TH1F ("phgc_pulseAmp_no204", "HGC PulseInt without PulseAmp = 20 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_30[0] = new TH1F ("phgc_pulseAmp_301", "HGC PulseInt with PulseAmp = 30 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[0] = new TH1F ("phgc_pulseAmp_no301", "HGC PulseInt without PulseAmp = 30 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_30[1] = new TH1F ("phgc_pulseAmp_302", "HGC PulseInt with PulseAmp = 30 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[1] = new TH1F ("phgc_pulseAmp_no302", "HGC PulseInt without PulseAmp = 30 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_30[2] = new TH1F ("phgc_pulseAmp_303", "HGC PulseInt with PulseAmp = 30 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[2] = new TH1F ("phgc_pulseAmp_no303", "HGC PulseInt without PulseAmp = 30 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_30[3] = new TH1F ("phgc_pulseAmp_304", "HGC PulseInt with PulseAmp = 30 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no30[3] = new TH1F ("phgc_pulseAmp_no304", "HGC PulseInt without PulseAmp = 30 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_40[0] = new TH1F ("phgc_pulseAmp_401", "HGC PulseInt with PulseAmp = 40 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[0] = new TH1F ("phgc_pulseAmp_no401", "HGC PulseInt without PulseAmp = 40 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_40[1] = new TH1F ("phgc_pulseAmp_402", "HGC PulseInt with PulseAmp = 40 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[1] = new TH1F ("phgc_pulseAmp_no402", "HGC PulseInt without PulseAmp = 40 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_40[2] = new TH1F ("phgc_pulseAmp_403", "HGC PulseInt with PulseAmp = 40 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[2] = new TH1F ("phgc_pulseAmp_no403", "HGC PulseInt without PulseAmp = 40 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_40[3] = new TH1F ("phgc_pulseAmp_404", "HGC PulseInt with PulseAmp = 40 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no40[3] = new TH1F ("phgc_pulseAmp_no404", "HGC PulseInt without PulseAmp = 40 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_50[0] = new TH1F ("phgc_pulseAmp_501", "HGC PulseInt with PulseAmp = 50 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[0] = new TH1F ("phgc_pulseAmp_no501", "HGC PulseInt without PulseAmp = 50 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_50[1] = new TH1F ("phgc_pulseAmp_502", "HGC PulseInt with PulseAmp = 50 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[1] = new TH1F ("phgc_pulseAmp_no502", "HGC PulseInt without PulseAmp = 50 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_50[2] = new TH1F ("phgc_pulseAmp_503", "HGC PulseInt with PulseAmp = 50 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[2] = new TH1F ("phgc_pulseAmp_no503", "HGC PulseInt without PulseAmp = 50 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_50[3] = new TH1F ("phgc_pulseAmp_504", "HGC PulseInt with PulseAmp = 50 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no50[3] = new TH1F ("phgc_pulseAmp_no504", "HGC PulseInt without PulseAmp = 50 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_60[0] = new TH1F ("phgc_pulseAmp_601", "HGC PulseInt with PulseAmp = 60 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[0] = new TH1F ("phgc_pulseAmp_no601", "HGC PulseInt without PulseAmp = 60 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_60[1] = new TH1F ("phgc_pulseAmp_602", "HGC PulseInt with PulseAmp = 60 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[1] = new TH1F ("phgc_pulseAmp_no602", "HGC PulseInt without PulseAmp = 60 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_60[2] = new TH1F ("phgc_pulseAmp_603", "HGC PulseInt with PulseAmp = 60 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[2] = new TH1F ("phgc_pulseAmp_no603", "HGC PulseInt without PulseAmp = 60 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_60[3] = new TH1F ("phgc_pulseAmp_604", "HGC PulseInt with PulseAmp = 60 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no60[3] = new TH1F ("phgc_pulseAmp_no604", "HGC PulseInt without PulseAmp = 60 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_pulseAmp_70[0] = new TH1F ("phgc_pulseAmp_701", "HGC PulseInt with PulseAmp = 70 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[0] = new TH1F ("phgc_pulseAmp_no701", "HGC PulseInt without PulseAmp = 70 PMT1; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_70[1] = new TH1F ("phgc_pulseAmp_702", "HGC PulseInt with PulseAmp = 70 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[1] = new TH1F ("phgc_pulseAmp_no702", "HGC PulseInt without PulseAmp = 70 PMT2; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_70[2] = new TH1F ("phgc_pulseAmp_703", "HGC PulseInt with PulseAmp = 70 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[2] = new TH1F ("phgc_pulseAmp_no703", "HGC PulseInt without PulseAmp = 70 PMT3; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_70[3] = new TH1F ("phgc_pulseAmp_704", "HGC PulseInt with PulseAmp = 70 PMT4; PulseInt; Counts", 200, 0, 40000); + h_phgc_pulseAmp_no70[3] = new TH1F ("phgc_pulseAmp_no704", "HGC PulseInt without PulseAmp = 70 PMT4; PulseInt; Counts", 200, 0, 40000); + + h_phgc_quad1_pulseInt_e[0] = new TH1F ("phgc_quad1_pulseInt_e1", "Electrons in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_e[1] = new TH1F ("phgc_quad1_pulseInt_e2", "Electrons in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_e[2] = new TH1F ("phgc_quad1_pulseInt_e3", "Electrons in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_e[3] = new TH1F ("phgc_quad1_pulseInt_e4", "Electrons in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad1_pulseInt_pi[0] = new TH1F ("phgc_quad1_pulseInt_pi1", "Pions in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_pi[1] = new TH1F ("phgc_quad1_pulseInt_pi2", "Pions in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_pi[2] = new TH1F ("phgc_quad1_pulseInt_pi3", "Pions in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_pi[3] = new TH1F ("phgc_quad1_pulseInt_pi4", "Pions in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad1_pulseInt_sum[0] = new TH1F ("phgc_quad1_pulseInt_sum1", "Sum in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_sum[1] = new TH1F ("phgc_quad1_pulseInt_sum2", "Sum in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_sum[2] = new TH1F ("phgc_quad1_pulseInt_sum3", "Sum in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad1_pulseInt_sum[3] = new TH1F ("phgc_quad1_pulseInt_sum4", "Sum in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad2_pulseInt_e[0] = new TH1F ("phgc_quad2_pulseInt_e1", "Electrons in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_e[1] = new TH1F ("phgc_quad2_pulseInt_e2", "Electrons in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_e[2] = new TH1F ("phgc_quad2_pulseInt_e3", "Electrons in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_e[3] = new TH1F ("phgc_quad2_pulseInt_e4", "Electrons in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad2_pulseInt_pi[0] = new TH1F ("phgc_quad2_pulseInt_pi1", "Pions in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_pi[1] = new TH1F ("phgc_quad2_pulseInt_pi2", "Pions in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_pi[2] = new TH1F ("phgc_quad2_pulseInt_pi3", "Pions in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_pi[3] = new TH1F ("phgc_quad2_pulseInt_pi4", "Pions in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad2_pulseInt_sum[0] = new TH1F ("phgc_quad2_pulseInt_sum1", "Sum in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_sum[1] = new TH1F ("phgc_quad2_pulseInt_sum2", "Sum in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_sum[2] = new TH1F ("phgc_quad2_pulseInt_sum3", "Sum in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad2_pulseInt_sum[3] = new TH1F ("phgc_quad2_pulseInt_sum4", "Sum in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad3_pulseInt_e[0] = new TH1F ("phgc_quad3_pulseInt_e1", "Electrons in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_e[1] = new TH1F ("phgc_quad3_pulseInt_e2", "Electrons in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_e[2] = new TH1F ("phgc_quad3_pulseInt_e3", "Electrons in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_e[3] = new TH1F ("phgc_quad3_pulseInt_e4", "Electrons in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad3_pulseInt_pi[0] = new TH1F ("phgc_quad3_pulseInt_pi1", "Pions in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_pi[1] = new TH1F ("phgc_quad3_pulseInt_pi2", "Pions in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_pi[2] = new TH1F ("phgc_quad3_pulseInt_pi3", "Pions in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_pi[3] = new TH1F ("phgc_quad3_pulseInt_pi4", "Pions in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad3_pulseInt_sum[0] = new TH1F ("phgc_quad3_pulseInt_sum1", "Sum in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_sum[1] = new TH1F ("phgc_quad3_pulseInt_sum2", "Sum in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_sum[2] = new TH1F ("phgc_quad3_pulseInt_sum3", "Sum in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad3_pulseInt_sum[3] = new TH1F ("phgc_quad3_pulseInt_sum4", "Sum in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad4_pulseInt_e[0] = new TH1F ("phgc_quad4_pulseInt_e1", "Electrons in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_e[1] = new TH1F ("phgc_quad4_pulseInt_e2", "Electrons in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_e[2] = new TH1F ("phgc_quad4_pulseInt_e3", "Electrons in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_e[3] = new TH1F ("phgc_quad4_pulseInt_e4", "Electrons in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad4_pulseInt_pi[0] = new TH1F ("phgc_quad4_pulseInt_pi1", "Pions in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_pi[1] = new TH1F ("phgc_quad4_pulseInt_pi2", "Pions in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_pi[2] = new TH1F ("phgc_quad4_pulseInt_pi3", "Pions in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_pi[3] = new TH1F ("phgc_quad4_pulseInt_pi4", "Pions in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad4_pulseInt_sum[0] = new TH1F ("phgc_quad4_pulseInt_sum1", "Sum in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_sum[1] = new TH1F ("phgc_quad4_pulseInt_sum2", "Sum in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_sum[2] = new TH1F ("phgc_quad4_pulseInt_sum3", "Sum in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_phgc_quad4_pulseInt_sum[3] = new TH1F ("phgc_quad4_pulseInt_sum4", "Sum in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_phgc_quad1_pulseAmp_e[0] = new TH1F ("phgc_quad1_pulseAmp_e1", "Electrons in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_phgc_quad1_pulseAmp_e[1] = new TH1F ("phgc_quad1_pulseAmp_e2", "Electrons in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_phgc_quad1_pulseAmp_e[2] = new TH1F ("phgc_quad1_pulseAmp_e3", "Electrons in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_phgc_quad1_pulseAmp_e[3] = new TH1F ("phgc_quad1_pulseAmp_e4", "Electrons in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + + h_phgc_quad1_pulseAmp_pi[0] = new TH1F ("phgc_quad1_pulseAmp_pi1", "Pions in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_pi[1] = new TH1F ("phgc_quad1_pulseAmp_pi2", "Pions in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_pi[2] = new TH1F ("phgc_quad1_pulseAmp_pi3", "Pions in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_pi[3] = new TH1F ("phgc_quad1_pulseAmp_pi4", "Pions in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad1_pulseAmp_sum[0] = new TH1F ("phgc_quad1_pulseAmp_sum1", "Sum in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_sum[1] = new TH1F ("phgc_quad1_pulseAmp_sum2", "Sum in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_sum[2] = new TH1F ("phgc_quad1_pulseAmp_sum3", "Sum in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad1_pulseAmp_sum[3] = new TH1F ("phgc_quad1_pulseAmp_sum4", "Sum in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad2_pulseAmp_e[0] = new TH1F ("phgc_quad2_pulseAmp_e1", "Electrons in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_e[1] = new TH1F ("phgc_quad2_pulseAmp_e2", "Electrons in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_e[2] = new TH1F ("phgc_quad2_pulseAmp_e3", "Electrons in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_e[3] = new TH1F ("phgc_quad2_pulseAmp_e4", "Electrons in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad2_pulseAmp_pi[0] = new TH1F ("phgc_quad2_pulseAmp_pi1", "Pions in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_pi[1] = new TH1F ("phgc_quad2_pulseAmp_pi2", "Pions in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_pi[2] = new TH1F ("phgc_quad2_pulseAmp_pi3", "Pions in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_pi[3] = new TH1F ("phgc_quad2_pulseAmp_pi4", "Pions in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad2_pulseAmp_sum[0] = new TH1F ("phgc_quad2_pulseAmp_sum1", "Sum in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_sum[1] = new TH1F ("phgc_quad2_pulseAmp_sum2", "Sum in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_sum[2] = new TH1F ("phgc_quad2_pulseAmp_sum3", "Sum in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad2_pulseAmp_sum[3] = new TH1F ("phgc_quad2_pulseAmp_sum4", "Sum in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad3_pulseAmp_e[0] = new TH1F ("phgc_quad3_pulseAmp_e1", "Electrons in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_e[1] = new TH1F ("phgc_quad3_pulseAmp_e2", "Electrons in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_e[2] = new TH1F ("phgc_quad3_pulseAmp_e3", "Electrons in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_e[3] = new TH1F ("phgc_quad3_pulseAmp_e4", "Electrons in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad3_pulseAmp_pi[0] = new TH1F ("phgc_quad3_pulseAmp_pi1", "Pions in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_pi[1] = new TH1F ("phgc_quad3_pulseAmp_pi2", "Pions in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_pi[2] = new TH1F ("phgc_quad3_pulseAmp_pi3", "Pions in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_pi[3] = new TH1F ("phgc_quad3_pulseAmp_pi4", "Pions in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad3_pulseAmp_sum[0] = new TH1F ("phgc_quad3_pulseAmp_sum1", "Sum in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_sum[1] = new TH1F ("phgc_quad3_pulseAmp_sum2", "Sum in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_sum[2] = new TH1F ("phgc_quad3_pulseAmp_sum3", "Sum in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad3_pulseAmp_sum[3] = new TH1F ("phgc_quad3_pulseAmp_sum4", "Sum in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad4_pulseAmp_e[0] = new TH1F ("phgc_quad4_pulseAmp_e1", "Electrons in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_e[1] = new TH1F ("phgc_quad4_pulseAmp_e2", "Electrons in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_e[2] = new TH1F ("phgc_quad4_pulseAmp_e3", "Electrons in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_e[3] = new TH1F ("phgc_quad4_pulseAmp_e4", "Electrons in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad4_pulseAmp_pi[0] = new TH1F ("phgc_quad4_pulseAmp_pi1", "Pions in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_pi[1] = new TH1F ("phgc_quad4_pulseAmp_pi2", "Pions in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_pi[2] = new TH1F ("phgc_quad4_pulseAmp_pi3", "Pions in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_pi[3] = new TH1F ("phgc_quad4_pulseAmp_pi4", "Pions in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_quad4_pulseAmp_sum[0] = new TH1F ("phgc_quad4_pulseAmp_sum1", "Sum in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_sum[1] = new TH1F ("phgc_quad4_pulseAmp_sum2", "Sum in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_sum[2] = new TH1F ("phgc_quad4_pulseAmp_sum3", "Sum in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_phgc_quad4_pulseAmp_sum[3] = new TH1F ("phgc_quad4_pulseAmp_sum4", "Sum in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_phgc_pulseInt_npe[0] = new TH1F ("phgc_pulseInt_npe1", "Photoelectrons from pulseInt in PMT1; NPE; Counts", bins, 0, 20); + h_phgc_pulseInt_npe[1] = new TH1F ("phgc_pulseInt_npe2", "Photoelectrons from pulseInt in PMT2; NPE; Counts", bins, 0, 20); + h_phgc_pulseInt_npe[2] = new TH1F ("phgc_pulseInt_npe3", "Photoelectrons from pulseInt in PMT3; NPE; Counts", bins, 0, 20); + h_phgc_pulseInt_npe[3] = new TH1F ("phgc_pulseInt_npe4", "Photoelectrons from pulseInt in PMT4; NPE; Counts", bins, 0, 20); + + + //PreShower & Shower + h_ppshwr_PulseInt = new TH1F ("ppshwr_PulseInt", "Pulse Integral for PreShower", bins, adc_min, adc_max); + h2_ppshwr_negPulseTime_pT1_diff = new TH2F("ppshwr_h2negPulseTime_pT1_diff", "SHMS Negative Pre Shower ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nneg_pshwr_blks, 0.5, nneg_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_negPulseTime_pT2_diff = new TH2F("ppshwr_h2negPulseTime_pT2_diff", "SHMS Negative Pre Shower ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nneg_pshwr_blks, 0.5, nneg_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_negPulseTime_pT3_diff = new TH2F("ppshwr_h2negPulseTime_pT3_diff", "SHMS Negative Pre Shower ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nneg_pshwr_blks, 0.5, nneg_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_posPulseTime_pT1_diff = new TH2F("ppshwr_h2posPulseTime_pT1_diff", "SHMS Positive Pre Shower ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", npos_pshwr_blks, 0.5, npos_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_posPulseTime_pT2_diff = new TH2F("ppshwr_h2posPulseTime_pT2_diff", "SHMS Positive Pre Shower ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", npos_pshwr_blks, 0.5, npos_pshwr_blks + 0.5, 300, -300, 0); + h2_ppshwr_posPulseTime_pT3_diff = new TH2F("ppshwr_h2posPulseTime_pT3_diff", "SHMS Positive Pre Shower ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", npos_pshwr_blks, 0.5, npos_pshwr_blks + 0.5, 300, -300, 0); + + h_pshwr_PulseInt = new TH1F ("pshwr_PulseInt", "Pulse Integral for Shower", bins, adc_min, adc_max); + h2_pshwr_pulseTime_pT1_diff = new TH2F("pshwr_h2_pulseTime_pT1_diff", "SHMS Shower ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nshwr_blks, 0.5, nshwr_blks + 0.5, 300, -300, 0); + h2_pshwr_pulseTime_pT2_diff = new TH2F("pshwr_h2_pulseTime_pT2_diff", "SHMS Shower ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nshwr_blks, 0.5, nshwr_blks + 0.5, 300, -300, 0); + h2_pshwr_pulseTime_pT3_diff = new TH2F("pshwr_h2_pulseTime_pT3_diff", "SHMS Shower ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nshwr_blks, 0.5, nshwr_blks + 0.5, 300, -300, 0); + + //NGC + h_pngc_adcPulseInt_sum = new TH1F ("pngc_adcPulseInt_sum", "Raw Pulse Int", bins, adc_min, adc_max); + + h_pngc_adcPulseInt[0] = new TH1F ("pngc_adcPulseInt1", "Raw Pulse Integral PMT1; PulseInt; Counts", 14500, -500, 14000); + h_pngc_adcPulseInt[1] = new TH1F ("pngc_adcPulseInt2", "Raw Pulse Integral PMT2; PulseInt; Counts", 14500, -500, 14000); + h_pngc_adcPulseInt[2] = new TH1F ("pngc_adcPulseInt3", "Raw Pulse Integral PMT3; PulseInt; Counts", 14500, -500, 14000); + h_pngc_adcPulseInt[3] = new TH1F ("pngc_adcPulseInt4", "Raw Pulse Integral PMT4; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_adcPulseAmp[0] = new TH1F ("pngc_adcPulseAmp1", "Raw Pulse Amp PMT1; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_adcPulseAmp[1] = new TH1F ("pngc_adcPulseAmp2", "Raw Pulse Amp PMT2; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_adcPulseAmp[2] = new TH1F ("pngc_adcPulseAmp3", "Raw Pulse Amp PMT3; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_adcPulseAmp[3] = new TH1F ("pngc_adcPulseAmp4", "Raw Pulse Amp PMT4; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_adcPulseTimeRaw[0] = new TH1F ("pngc_adcPulseTimeRaw1", "Raw Pulse TimeRaw PMT1; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_pngc_adcPulseTimeRaw[1] = new TH1F ("pngc_adcPulseTimeRaw2", "Raw Pulse TimeRaw PMT2; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_pngc_adcPulseTimeRaw[2] = new TH1F ("pngc_adcPulseTimeRaw3", "Raw Pulse TimeRaw PMT3; PulseTimeRaw; Counts", bins, adc_min, adc_max); + h_pngc_adcPulseTimeRaw[3] = new TH1F ("pngc_adcPulseTimeRaw4", "Raw Pulse TimeRaw PMT4; PulseTimeRaw; Counts", bins, adc_min, adc_max); + + h2_pngc_pulseTime_pT1_diff = new TH2F("pngc_h2_pulseTime_pT1_diff", "SHMS Noble Gas Cherenkov ADC Pulse Time - T1; PMT Number; ADC Pulse Time - Trigger 1 Time (ns)", nngc_pmts, 0.5, nngc_pmts + 0.5, 300, -300, 0); + h2_pngc_pulseTime_pT2_diff = new TH2F("pngc_h2_pulseTime_pT2_diff", "SHMS Noble Gas Cherenkov ADC Pulse Time - T2; PMT Number; ADC Pulse Time - Trigger 2 Time (ns)", nngc_pmts, 0.5, nngc_pmts + 0.5, 300, -300, 0); + h2_pngc_pulseTime_pT3_diff = new TH2F("pngc_h2_pulseTime_pT3_diff", "SHMS Noble Gas Cherenkov ADC Pulse Time - T3; PMT Number; ADC Pulse Time - Trigger 3 Time (ns)", nngc_pmts, 0.5, nngc_pmts + 0.5, 300, -300, 0); + + h_pngc_quad1_pulseInt_e[0] = new TH1F ("pngc_quad1_pulseInt_e1", "Electrons in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_e[1] = new TH1F ("pngc_quad1_pulseInt_e2", "Electrons in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_e[2] = new TH1F ("pngc_quad1_pulseInt_e3", "Electrons in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_e[3] = new TH1F ("pngc_quad1_pulseInt_e4", "Electrons in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad1_pulseInt_pi[0] = new TH1F ("pngc_quad1_pulseInt_pi1", "Pions in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_pi[1] = new TH1F ("pngc_quad1_pulseInt_pi2", "Pions in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_pi[2] = new TH1F ("pngc_quad1_pulseInt_pi3", "Pions in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_pi[3] = new TH1F ("pngc_quad1_pulseInt_pi4", "Pions in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad1_pulseInt_sum[0] = new TH1F ("pngc_quad1_pulseInt_sum1", "Sum in Quadrant 1 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_sum[1] = new TH1F ("pngc_quad1_pulseInt_sum2", "Sum in Quadrant 1 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_sum[2] = new TH1F ("pngc_quad1_pulseInt_sum3", "Sum in Quadrant 1 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad1_pulseInt_sum[3] = new TH1F ("pngc_quad1_pulseInt_sum4", "Sum in Quadrant 1 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad2_pulseInt_e[0] = new TH1F ("pngc_quad2_pulseInt_e1", "Electrons in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_e[1] = new TH1F ("pngc_quad2_pulseInt_e2", "Electrons in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_e[2] = new TH1F ("pngc_quad2_pulseInt_e3", "Electrons in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_e[3] = new TH1F ("pngc_quad2_pulseInt_e4", "Electrons in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad2_pulseInt_pi[0] = new TH1F ("pngc_quad2_pulseInt_pi1", "Pions in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_pi[1] = new TH1F ("pngc_quad2_pulseInt_pi2", "Pions in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_pi[2] = new TH1F ("pngc_quad2_pulseInt_pi3", "Pions in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_pi[3] = new TH1F ("pngc_quad2_pulseInt_pi4", "Pions in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad2_pulseInt_sum[0] = new TH1F ("pngc_quad2_pulseInt_sum1", "Sum in Quadrant 2 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_sum[1] = new TH1F ("pngc_quad2_pulseInt_sum2", "Sum in Quadrant 2 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_sum[2] = new TH1F ("pngc_quad2_pulseInt_sum3", "Sum in Quadrant 2 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad2_pulseInt_sum[3] = new TH1F ("pngc_quad2_pulseInt_sum4", "Sum in Quadrant 2 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad3_pulseInt_e[0] = new TH1F ("pngc_quad3_pulseInt_e1", "Electrons in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_e[1] = new TH1F ("pngc_quad3_pulseInt_e2", "Electrons in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_e[2] = new TH1F ("pngc_quad3_pulseInt_e3", "Electrons in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_e[3] = new TH1F ("pngc_quad3_pulseInt_e4", "Electrons in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad3_pulseInt_pi[0] = new TH1F ("pngc_quad3_pulseInt_pi1", "Pions in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_pi[1] = new TH1F ("pngc_quad3_pulseInt_pi2", "Pions in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_pi[2] = new TH1F ("pngc_quad3_pulseInt_pi3", "Pions in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_pi[3] = new TH1F ("pngc_quad3_pulseInt_pi4", "Pions in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad3_pulseInt_sum[0] = new TH1F ("pngc_quad3_pulseInt_sum1", "Sum in Quadrant 3 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_sum[1] = new TH1F ("pngc_quad3_pulseInt_sum2", "Sum in Quadrant 3 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_sum[2] = new TH1F ("pngc_quad3_pulseInt_sum3", "Sum in Quadrant 3 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad3_pulseInt_sum[3] = new TH1F ("pngc_quad3_pulseInt_sum4", "Sum in Quadrant 3 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad4_pulseInt_e[0] = new TH1F ("pngc_quad4_pulseInt_e1", "Electrons in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_e[1] = new TH1F ("pngc_quad4_pulseInt_e2", "Electrons in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_e[2] = new TH1F ("pngc_quad4_pulseInt_e3", "Electrons in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_e[3] = new TH1F ("pngc_quad4_pulseInt_e4", "Electrons in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad4_pulseInt_pi[0] = new TH1F ("pngc_quad4_pulseInt_pi1", "Pions in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_pi[1] = new TH1F ("pngc_quad4_pulseInt_pi2", "Pions in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_pi[2] = new TH1F ("pngc_quad4_pulseInt_pi3", "Pions in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_pi[3] = new TH1F ("pngc_quad4_pulseInt_pi4", "Pions in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad4_pulseInt_sum[0] = new TH1F ("pngc_quad4_pulseInt_sum1", "Sum in Quadrant 4 PMT1 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_sum[1] = new TH1F ("pngc_quad4_pulseInt_sum2", "Sum in Quadrant 4 PMT2 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_sum[2] = new TH1F ("pngc_quad4_pulseInt_sum3", "Sum in Quadrant 4 PMT3 pulseInt; PulseInt; Counts", 14500, -500, 14000); + h_pngc_quad4_pulseInt_sum[3] = new TH1F ("pngc_quad4_pulseInt_sum4", "Sum in Quadrant 4 PMT4 pulseInt; PulseInt; Counts", 14500, -500, 14000); + + h_pngc_quad1_pulseAmp_e[0] = new TH1F ("pngc_quad1_pulseAmp_e1", "Electrons in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_pngc_quad1_pulseAmp_e[1] = new TH1F ("pngc_quad1_pulseAmp_e2", "Electrons in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_pngc_quad1_pulseAmp_e[2] = new TH1F ("pngc_quad1_pulseAmp_e3", "Electrons in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + h_pngc_quad1_pulseAmp_e[3] = new TH1F ("pngc_quad1_pulseAmp_e4", "Electrons in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, -500, 14000); + + h_pngc_quad1_pulseAmp_pi[0] = new TH1F ("pngc_quad1_pulseAmp_pi1", "Pions in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_pi[1] = new TH1F ("pngc_quad1_pulseAmp_pi2", "Pions in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_pi[2] = new TH1F ("pngc_quad1_pulseAmp_pi3", "Pions in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_pi[3] = new TH1F ("pngc_quad1_pulseAmp_pi4", "Pions in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad1_pulseAmp_sum[0] = new TH1F ("pngc_quad1_pulseAmp_sum1", "Sum in Quadrant 1 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_sum[1] = new TH1F ("pngc_quad1_pulseAmp_sum2", "Sum in Quadrant 1 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_sum[2] = new TH1F ("pngc_quad1_pulseAmp_sum3", "Sum in Quadrant 1 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad1_pulseAmp_sum[3] = new TH1F ("pngc_quad1_pulseAmp_sum4", "Sum in Quadrant 1 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad2_pulseAmp_e[0] = new TH1F ("pngc_quad2_pulseAmp_e1", "Electrons in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_e[1] = new TH1F ("pngc_quad2_pulseAmp_e2", "Electrons in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_e[2] = new TH1F ("pngc_quad2_pulseAmp_e3", "Electrons in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_e[3] = new TH1F ("pngc_quad2_pulseAmp_e4", "Electrons in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad2_pulseAmp_pi[0] = new TH1F ("pngc_quad2_pulseAmp_pi1", "Pions in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_pi[1] = new TH1F ("pngc_quad2_pulseAmp_pi2", "Pions in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_pi[2] = new TH1F ("pngc_quad2_pulseAmp_pi3", "Pions in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_pi[3] = new TH1F ("pngc_quad2_pulseAmp_pi4", "Pions in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad2_pulseAmp_sum[0] = new TH1F ("pngc_quad2_pulseAmp_sum1", "Sum in Quadrant 2 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_sum[1] = new TH1F ("pngc_quad2_pulseAmp_sum2", "Sum in Quadrant 2 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_sum[2] = new TH1F ("pngc_quad2_pulseAmp_sum3", "Sum in Quadrant 2 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad2_pulseAmp_sum[3] = new TH1F ("pngc_quad2_pulseAmp_sum4", "Sum in Quadrant 2 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad3_pulseAmp_e[0] = new TH1F ("pngc_quad3_pulseAmp_e1", "Electrons in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_e[1] = new TH1F ("pngc_quad3_pulseAmp_e2", "Electrons in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_e[2] = new TH1F ("pngc_quad3_pulseAmp_e3", "Electrons in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_e[3] = new TH1F ("pngc_quad3_pulseAmp_e4", "Electrons in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad3_pulseAmp_pi[0] = new TH1F ("pngc_quad3_pulseAmp_pi1", "Pions in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_pi[1] = new TH1F ("pngc_quad3_pulseAmp_pi2", "Pions in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_pi[2] = new TH1F ("pngc_quad3_pulseAmp_pi3", "Pions in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_pi[3] = new TH1F ("pngc_quad3_pulseAmp_pi4", "Pions in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad3_pulseAmp_sum[0] = new TH1F ("pngc_quad3_pulseAmp_sum1", "Sum in Quadrant 3 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_sum[1] = new TH1F ("pngc_quad3_pulseAmp_sum2", "Sum in Quadrant 3 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_sum[2] = new TH1F ("pngc_quad3_pulseAmp_sum3", "Sum in Quadrant 3 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad3_pulseAmp_sum[3] = new TH1F ("pngc_quad3_pulseAmp_sum4", "Sum in Quadrant 3 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad4_pulseAmp_e[0] = new TH1F ("pngc_quad4_pulseAmp_e1", "Electrons in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_e[1] = new TH1F ("pngc_quad4_pulseAmp_e2", "Electrons in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_e[2] = new TH1F ("pngc_quad4_pulseAmp_e3", "Electrons in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_e[3] = new TH1F ("pngc_quad4_pulseAmp_e4", "Electrons in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad4_pulseAmp_pi[0] = new TH1F ("pngc_quad4_pulseAmp_pi1", "Pions in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_pi[1] = new TH1F ("pngc_quad4_pulseAmp_pi2", "Pions in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_pi[2] = new TH1F ("pngc_quad4_pulseAmp_pi3", "Pions in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_pi[3] = new TH1F ("pngc_quad4_pulseAmp_pi4", "Pions in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + h_pngc_quad4_pulseAmp_sum[0] = new TH1F ("pngc_quad4_pulseAmp_sum1", "Sum in Quadrant 4 PMT1 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_sum[1] = new TH1F ("pngc_quad4_pulseAmp_sum2", "Sum in Quadrant 4 PMT2 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_sum[2] = new TH1F ("pngc_quad4_pulseAmp_sum3", "Sum in Quadrant 4 PMT3 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + h_pngc_quad4_pulseAmp_sum[3] = new TH1F ("pngc_quad4_pulseAmp_sum4", "Sum in Quadrant 4 PMT4 pulseAmp; PulseAmp; Counts", 4000, 0, 4000); + + //Tracking Information + h2_ptrk_fp = new TH2F("ptrk_h2_fp", "Tracking Information in Focal Plane; x Dimension; y Dimension", 100, -50, 50, 100, -50, 50); + h2_ptrk_fp_e = new TH2F("ptrk_h2_fp_e", "Tracking Information in Focal Plane with electron cuts; x Dimension; y Dimension", 100, -50, 50, 100, -50, 50); + h2_ptrk_fp_pi = new TH2F("ptrk_h2_fp_pi", "Tracking Information in Focal Plane with pion cuts; x Dimension; y Dimension", 100, -50, 50, 100, -50, 50); + + h2_ptrk_ngc_sum = new TH2F("ptrk_h2_ngc_sum", "Tracking Information in NGC; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_ngc_sum_noped = new TH2F("ptrk_h2_ngc_sum_noped", "Tracking Information in NGC, Pedistal Removed; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_ngc_sum_ped = new TH2F("ptrk_h2_ngc_sum_ped", "Tracking Information in NGC, Pedistal Only; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h2_ptrk_hgc_e = new TH2F("ptrk_h2_hgc_e", "Tracking Information in HGC with electron cuts; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_pi = new TH2F("ptrk_h2_hgc_pi", "Tracking Information in HGC with pion cuts; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_sum = new TH2F("ptrk_h2_hgc_sum", "Tracking Information in HGC; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h2_ptrk_hgc[0] = new TH2F("ptrk_h2_hgc1_PulseInt", "Tracking Information in HGC for PMT1 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc[1] = new TH2F("ptrk_h2_hgc2_PulseInt", "Tracking Information in HGC for PMT2 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc[2] = new TH2F("ptrk_h2_hgc3_PulseInt", "Tracking Information in HGC for PMT3 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc[3] = new TH2F("ptrk_h2_hgc4_PulseInt", "Tracking Information in HGC for PMT4 weighted with PulseInt; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h2_ptrk_hgc_adcAmp[0] = new TH2F("ptrk_h2_hgc1_PulseAmp", "Tracking Information in HGC for PMT1 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_adcAmp[1] = new TH2F("ptrk_h2_hgc2_PulseAmp", "Tracking Information in HGC for PMT2 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_adcAmp[2] = new TH2F("ptrk_h2_hgc3_PulseAmp", "Tracking Information in HGC for PMT3 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + h2_ptrk_hgc_adcAmp[3] = new TH2F("ptrk_h2_hgc4_PulseAmp", "Tracking Information in HGC for PMT4 weighted with PulseAmp; x Dimension; y Dimension", 100, -70, 70, 100, -70, 70); + + h3_ptrk_hgc_adcInt2NPE[0] = new TH3F("ptrk_h3_hgc_adcInt2NPE1", "Tracking Information in HGC for PMT1 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE[1] = new TH3F("ptrk_h3_hgc_adcInt2NPE2", "Tracking Information in HGC for PMT2 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE[2] = new TH3F("ptrk_h3_hgc_adcInt2NPE3", "Tracking Information in HGC for PMT3 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE[3] = new TH3F("ptrk_h3_hgc_adcInt2NPE4", "Tracking Information in HGC for PMT4 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcInt2NPE_e[0] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e1", "Tracking Information in HGC for PMT1 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_e[1] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e2", "Tracking Information in HGC for PMT2 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_e[2] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e3", "Tracking Information in HGC for PMT3 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_e[3] = new TH3F("ptrk_h3_hgc_adcInt2NPE_e4", "Tracking Information in HGC for PMT4 in NPE with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcInt2NPE_pi[0] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi1", "Tracking Information in HGC for PMT1 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_pi[1] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi2", "Tracking Information in HGC for PMT2 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_pi[2] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi3", "Tracking Information in HGC for PMT3 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcInt2NPE_pi[3] = new TH3F("ptrk_h3_hgc_adcInt2NPE_pi4", "Tracking Information in HGC for PMT4 in NPE with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcAmp2NPE[0] = new TH3F("ptrk_h3_hgc_adcAmp2NPE1", "Tracking Information in HGC for PMT1 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcAmp2NPE[1] = new TH3F("ptrk_h3_hgc_adcAmp2NPE2", "Tracking Information in HGC for PMT2 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcAmp2NPE[2] = new TH3F("ptrk_h3_hgc_adcAmp2NPE3", "Tracking Information in HGC for PMT3 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + h3_ptrk_hgc_adcAmp2NPE[3] = new TH3F("ptrk_h3_hgc_adcAmp2NPE4", "Tracking Information in HGC for PMT4 in NPE; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, bins, 0, 20); + + h3_ptrk_hgc_adcInt2NPE_full = new TH3F("ptrk_h3_hgc_adcInt2NPE_full", "Tracking Information in HGC for all PMTs; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, 20, 0, 20); + h3_ptrk_hgc_adcInt2NPE_full_e = new TH3F("ptrk_h3_hgc_adcInt2NPE_full_e", "Tracking Information in HGC for all PMTs with electron cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, 20, 0, 20); + h3_ptrk_hgc_adcInt2NPE_full_pi = new TH3F("ptrk_h3_hgc_adcInt2NPE_full_pi", "Tracking Information in HGC for all PMTs with pion cuts; x Dimension; y Dimension; NPE", 100, -70, 70, 100, -70, 70, 20, 0, 20); + + h_ptrk_beta = new TH1F("ptrk_h_beta", "Beta Quantity from Tracking; Beta; Counts", 200, -5, 5); + + //Combination of Detectors + h2_pshwr_vs_phgcer = new TH2F ("pcom_h2_pshwr_vs_phgcer", "Pre-Shower vs. HGC; HGC NPE; Shower+Pre-Shower Energy (GeV)", 60, -10, 20, 100, 0, 20); + h2_pshwr_vs_pngc = new TH2F ("pcom_h2_pshwr_vs_pngc", "Pre-Shower vs. NGC; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_ppshwr = new TH2F("pcom_h2_pshwr_vs_ppshwr", "Pre-Shower vs. Shower; Shower Energy (GeV); Pre-Shower Energy (GeV)", 100, 0, 20, 100, 0, 20); + + h2_pshwr_vs_pngc_ecut = new TH2F ("pcom_h2_pshwr_vs_pngc_ecut", "Pre-Shower vs. NGC only Electrons; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_picut = new TH2F ("pcom_h2_pshwr_vs_pngc_picut", "Pre-Shower vs. NGC only Pions; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_phgc_ecut = new TH2F ("pcom_h2_pshwr_vs_phgc_ecut", "Pre-Shower vs. HGC only Electrons; HGC NPE; Shower+Pre-Shower Energy (GeV)", 60, -10, 20, 100, 0, 20); + h2_pshwr_vs_phgc_picut = new TH2F ("pcom_h2_pshwr_vs_phgc_picut", "Pre-Shower vs. HGC only Pions; HGC NPE; Shower+Pre-Shower Energy (GeV)", 60, -10, 20, 100, 0, 20); + + h2_pshwr_vs_pngc_latetcut[0] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut1", "Pre-Shower vs. NGC later time PMT1; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_latetcut[1] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut2", "Pre-Shower vs. NGC later time PMT2; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_latetcut[2] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut3", "Pre-Shower vs. NGC later time PMT3; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_latetcut[3] = new TH2F ("pcom_h2_pshwr_vs_pngc_latetcut4", "Pre-Shower vs. NGC later time PMT4; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + + h2_pshwr_vs_pngc_earlytcut[0] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut1", "Pre-Shower vs. NGC earlier time PMT1; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_earlytcut[1] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut2", "Pre-Shower vs. NGC earlier time PMT2; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_earlytcut[2] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut3", "Pre-Shower vs. NGC earlier time PMT3; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + h2_pshwr_vs_pngc_earlytcut[3] = new TH2F ("pcom_h2_pshwr_vs_pngc_earlytcut4", "Pre-Shower vs. NGC earlier time PMT4; NGC PulseInt; Shower+Pre-Shower Energy (GeV)", 100, 0, 10000, 100, 0, 20); + + h_phgc_ecut_shwr[0] = new TH1F ("pcom_phgc_ecut_shwr1", "Electrons in HGC using Shower PMT1; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_ecut_shwr[1] = new TH1F ("pcom_phgc_ecut_shwr2", "Electrons in HGC using Shower PMT2; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_ecut_shwr[2] = new TH1F ("pcom_phgc_ecut_shwr3", "Electrons in HGC using Shower PMT3; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_ecut_shwr[3] = new TH1F ("pcom_phgc_ecut_shwr4", "Electrons in HGC using Shower PMT4; PulseInt; Counts", bins, adc_min, adc_max); + + h_phgc_picut_shwr[0] = new TH1F ("pcom_phgc_picut_shwr1", "Pions in HGC using Shower PMT1; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_picut_shwr[1] = new TH1F ("pcom_phgc_picut_shwr2", "Pions in HGC using Shower PMT2; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_picut_shwr[2] = new TH1F ("pcom_phgc_picut_shwr3", "Pions in HGC using Shower PMT3; PulseInt; Counts", bins, adc_min, adc_max); + h_phgc_picut_shwr[3] = new TH1F ("pcom_phgc_picut_shwr4", "Pions in HGC using Shower PMT4; PulseInt; Counts", bins, adc_min, adc_max); + + h2_EdivP_vs_P = new TH2F ("pcom_h2_EdivP_vs_P", "SHMS E/p vs. p; p (geV); E/p", 600, 0, 6, 100, 0, 1); + + //Loop of entries in tree + cout << "Number of entries found: " << nentries << endl; + + for (UInt_t ievent = 0; ievent < nentries; ievent++) + { + T->GetEntry(ievent); + + if ((ievent)%1000 == 0) + { + cout << "ievent = " << ievent << endl; + } + + if (ntracks != 1) continue; + for (UInt_t itrack = 0; itrack < ntracks; itrack++) + { + //Quantities for Particle ID cuts + Double_t phgc_NPE = 0; + for (UInt_t ipmt = 0; ipmt < nhgc_pmts; ipmt++) + { + phgc_NPE = phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]; + } + Double_t pngc_NPE = 0; + for (UInt_t ipmt = 0; ipmt < nngc_pmts; ipmt++) + { + pngc_NPE = pngc_pulseInt[ipmt]*ngc_adc2npe[ipmt]; + } + + //h_ptrk_beta->Fill(trk_beta[itrack]); + if (TMath::Abs(trk_beta[itrack] - 1.) > 0.2) continue; + + //Fill "Good" Hit Histos + for (UInt_t igoodhit = 0; igoodhit < p1X_nGoodHodoHits; igoodhit++) + {/* + h2_p1X_negTdcCorr->Fill(p1X_goodPaddle[igoodhit], p1X_goodNegTdcTimeCorr[igoodhit]); + h2_p1X_posTdcCorr->Fill(p1X_goodPaddle[igoodhit], p1X_goodPosTdcTimeCorr[igoodhit]); + h2_p1X_tdcCorrDiff->Fill(p1X_goodPaddle[igoodhit], p1X_goodPosTdcTimeCorr[igoodhit] - p1X_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p1X_goodPosTdcTimeCorr[igoodhit] - p1X_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p1X_plTime->Fill(p1X_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p1X Good Hodo Loop + + for (UInt_t igoodhit = 0; igoodhit < p1Y_nGoodHodoHits; igoodhit++) + {/* + h2_p1Y_negTdcCorr->Fill(p1Y_goodPaddle[igoodhit], p1Y_goodNegTdcTimeCorr[igoodhit]); + h2_p1Y_posTdcCorr->Fill(p1Y_goodPaddle[igoodhit], p1Y_goodPosTdcTimeCorr[igoodhit]); + h2_p1Y_tdcCorrDiff->Fill(p1Y_goodPaddle[igoodhit], p1Y_goodPosTdcTimeCorr[igoodhit] - p1Y_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p1Y_goodPosTdcTimeCorr[igoodhit] - p1Y_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p1Y_plTime->Fill(p1Y_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p1Y Good Hodo Loop + + for (UInt_t igoodhit = 0; igoodhit < p2X_nGoodHodoHits; igoodhit++) + {/* + h2_p2X_negTdcCorr->Fill(p2X_goodPaddle[igoodhit], p2X_goodNegTdcTimeCorr[igoodhit]); + h2_p2X_posTdcCorr->Fill(p2X_goodPaddle[igoodhit], p2X_goodPosTdcTimeCorr[igoodhit]); + h2_p2X_tdcCorrDiff->Fill(p2X_goodPaddle[igoodhit], p2X_goodPosTdcTimeCorr[igoodhit] - p2X_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p2X_goodPosTdcTimeCorr[igoodhit] - p2X_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p2X_plTime->Fill(p2X_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p2X Good Hodo Loop + + for (UInt_t igoodhit = 0; igoodhit < p2Y_nGoodHodoHits; igoodhit++) + {/* + h2_p2Y_negTdcCorr->Fill(p2Y_goodPaddle[igoodhit], p2Y_goodNegTdcTimeCorr[igoodhit]); + h2_p2Y_posTdcCorr->Fill(p2Y_goodPaddle[igoodhit], p2Y_goodPosTdcTimeCorr[igoodhit]); + h2_p2Y_tdcCorrDiff->Fill(p2Y_goodPaddle[igoodhit], p2Y_goodPosTdcTimeCorr[igoodhit] - p2Y_goodNegTdcTimeCorr[igoodhit]); + if (TMath::Abs(p2Y_goodPosTdcTimeCorr[igoodhit] - p2Y_goodNegTdcTimeCorr[igoodhit]) > 0.1) continue; + h_p2Y_plTime->Fill(p2Y_goodPosTdcTimeCorr[igoodhit]);//*/ + }//End of p2Y Good Hodo Loop + + //Fill Pulse/TDC Time Difference Histos + for (UInt_t iadchit = 0; iadchit < p1X_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1X_negTdcHits; itdchit++) + {/* + if (p1X_negAdcPaddle[iadchit] != p1X_negTdcPaddle[itdchit]) continue; + h2_p1Xneg_pt_tt_diff->Fill(p1X_negAdcPaddle[iadchit], p1X_negAdcPulseTime[iadchit]*clk2adc - p1X_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p1X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p1Y_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1Y_negTdcHits; itdchit++) + {///* + if (p1Y_negAdcPaddle[iadchit] != p1Y_negTdcPaddle[itdchit]) continue; + //h2_p1Yneg_pt_tt_diff->Fill(p1Y_negAdcPaddle[iadchit], p1Y_negAdcPulseTime[iadchit]*clk2adc - p1Y_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p1Y Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2X_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2X_negTdcHits; itdchit++) + {/* + if (p2X_negAdcPaddle[iadchit] != p2X_negTdcPaddle[itdchit]) continue; + h2_p2Xneg_pt_tt_diff->Fill(p2X_negAdcPaddle[iadchit], p2X_negAdcPulseTime[iadchit]*clk2adc - p2X_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p2X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2Y_negAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2Y_negTdcHits; itdchit++) + {///* + if (p2Y_negAdcPaddle[iadchit] != p2Y_negTdcPaddle[itdchit]) continue; + //h2_p2Yneg_pt_tt_diff->Fill(p2Y_negAdcPaddle[iadchit], p2Y_negAdcPulseTime[iadchit]*clk2adc - p2Y_negTdcTime[itdchit]*clk2tdc);//*/ + } + }//Neg p2Y Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p1X_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1X_posTdcHits; itdchit++) + {/* + if (p1X_posAdcPaddle[iadchit] != p1X_posTdcPaddle[itdchit]) continue; + h2_p1Xpos_pt_tt_diff->Fill(p1X_posAdcPaddle[iadchit], p1X_posAdcPulseTime[iadchit]*clk2adc - p1X_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p1X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p1Y_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p1Y_posTdcHits; itdchit++) + {/* + if (p1Y_nGoodHodoHits < 1) continue; + if (p1Y_posAdcPaddle[iadchit] != p1Y_posTdcPaddle[itdchit]) continue; + h2_p1Ypos_pt_tt_diff->Fill(p1Y_posAdcPaddle[iadchit], p1Y_posAdcPulseTime[iadchit]*clk2adc - p1Y_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p1Y Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2X_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2X_posTdcHits; itdchit++) + {/* + if (p2X_posAdcPaddle[iadchit] != p2X_posTdcPaddle[itdchit]) continue; + h2_p2Xpos_pt_tt_diff->Fill(p2X_posAdcPaddle[iadchit], p2X_posAdcPulseTime[iadchit]*clk2adc - p2X_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p2X Time Corrected? + + for (UInt_t iadchit = 0; iadchit < p2Y_posAdcHits; iadchit++) + { + for (UInt_t itdchit = 0; itdchit < p2Y_posTdcHits; itdchit++) + {/* + if (p2Y_posAdcPaddle[iadchit] != p2Y_posTdcPaddle[itdchit]) continue; + h2_p2Ypos_pt_tt_diff->Fill(p2Y_posAdcPaddle[iadchit], p2Y_posAdcPulseTime[iadchit]*clk2adc - p2Y_posTdcTime[itdchit]*clk2tdc);//*/ + } + }//Pos p2Y Time Corrected? + + //Fill Trigger Time Histos + /* + if (p1X_tdcTime != 0.0) h_p1X_tdc->Fill(p1X_tdcTime*clk2tdc); + if (p1Y_tdcTime != 0.0) h_p1Y_tdc->Fill(p1Y_tdcTime*clk2tdc); + if (p2X_tdcTime != 0.0) h_p2X_tdc->Fill(p2X_tdcTime*clk2tdc); + if (p2Y_tdcTime != 0.0) h_p2Y_tdc->Fill(p2Y_tdcTime*clk2tdc); + if (p1T_tdcTime != 0.0) h_p1T_tdc->Fill(p1T_tdcTime*clk2tdc); + if (p2T_tdcTime != 0.0) h_p2T_tdc->Fill(p2T_tdcTime*clk2tdc); + + h_pT1_tdc->Fill(pT1_tdcTime*clk2tdc); + h_pT2_tdc->Fill(pT2_tdcTime*clk2tdc); + h_pT3_tdc->Fill(pT3_tdcTime*clk2tdc);//*/ + + for (UInt_t iref = 0; iref < ndcRefTimes; iref++) + { + //h_pDCREF_tdc[iref]->Fill(pDCREF_tdcTime[iref]*clk2tdc); + } + /* + if (p1X_tdcTime != 0.0) h_p1XmpT2_tdc->Fill((pT2_tdcTime - p1X_tdcTime)*clk2tdc); + if (p1Y_tdcTime != 0.0) h_p1YmpT2_tdc->Fill((pT2_tdcTime - p1Y_tdcTime)*clk2tdc); + if (p2X_tdcTime != 0.0) h_p2XmpT2_tdc->Fill((pT2_tdcTime - p2X_tdcTime)*clk2tdc); + if (p2Y_tdcTime != 0.0) h_p2YmpT2_tdc->Fill((pT2_tdcTime - p2Y_tdcTime)*clk2tdc); + if (p1T_tdcTime != 0.0) h_p1TmpT2_tdc->Fill((pT2_tdcTime - p1T_tdcTime)*clk2tdc); + if (p2T_tdcTime != 0.0) h_p2TmpT2_tdc->Fill((pT2_tdcTime - p2T_tdcTime)*clk2tdc); + + if (p1X_tdcTime != 0.0) h_p1XmpT3_tdc->Fill((pT3_tdcTime - p1X_tdcTime)*clk2tdc); + if (p1Y_tdcTime != 0.0) h_p1YmpT3_tdc->Fill((pT3_tdcTime - p1Y_tdcTime)*clk2tdc); + if (p2X_tdcTime != 0.0) h_p2XmpT3_tdc->Fill((pT3_tdcTime - p2X_tdcTime)*clk2tdc); + if (p2Y_tdcTime != 0.0) h_p2YmpT3_tdc->Fill((pT3_tdcTime - p2Y_tdcTime)*clk2tdc); + if (p1T_tdcTime != 0.0) h_p1TmpT3_tdc->Fill((pT3_tdcTime - p1T_tdcTime)*clk2tdc); + if (p2T_tdcTime != 0.0) h_p2TmpT3_tdc->Fill((pT3_tdcTime - p2T_tdcTime)*clk2tdc); + + h_p1X_fpTime->Fill(p1X_fpTime); h_p1Y_fpTime->Fill(p1Y_fpTime); + h_p2X_fpTime->Fill(p2X_fpTime); h_p2Y_fpTime->Fill(p2Y_fpTime); + //*/ + //Aerogel + Double_t paero_adcPulseInt = 0.0; + for (UInt_t iaerohit = 0; iaerohit < paero_negHits; iaerohit++) + {/* + h2_paero_negPulseTime_pT1_diff->Fill(paero_negPmt[iaerohit], paero_negPulseTime[iaerohit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_paero_negPulseTime_pT2_diff->Fill(paero_negPmt[iaerohit], paero_negPulseTime[iaerohit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_paero_negPulseTime_pT3_diff->Fill(paero_negPmt[iaerohit], paero_negPulseTime[iaerohit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + paero_adcPulseInt += paero_negPulseInt[iaerohit]*aero_neg_adc2npe[iaerohit]; + } + for (UInt_t iaerohit = 0; iaerohit < paero_posHits; iaerohit++) + {/* + h2_paero_posPulseTime_pT1_diff->Fill(paero_posPmt[iaerohit], paero_posPulseTime[iaerohit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_paero_posPulseTime_pT2_diff->Fill(paero_posPmt[iaerohit], paero_posPulseTime[iaerohit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_paero_posPulseTime_pT3_diff->Fill(paero_posPmt[iaerohit], paero_posPulseTime[iaerohit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + paero_adcPulseInt += paero_posPulseInt[iaerohit]*aero_pos_adc2npe[iaerohit]; + } + if (paero_adcPulseInt != 0.0) //h_paero_PulseInt->Fill(paero_adcPulseInt); + //End of Loop over Aerogel + + + //Pre-Shower + Double_t ppshwr_adcPulseInt = 0.0; + for (UInt_t ipshwrhit=0; ipshwrhit < ppshwr_negHits; ipshwrhit++) + {/* + h2_ppshwr_negPulseTime_pT1_diff->Fill(ppshwr_negPmt[ipshwrhit], ppshwr_negPulseTime[ipshwrhit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_ppshwr_negPulseTime_pT2_diff->Fill(ppshwr_negPmt[ipshwrhit], ppshwr_negPulseTime[ipshwrhit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_ppshwr_negPulseTime_pT3_diff->Fill(ppshwr_negPmt[ipshwrhit], ppshwr_negPulseTime[ipshwrhit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + ppshwr_adcPulseInt += ppshwr_negPulseInt[ipshwrhit]*pshwr_neg_adc2GeV[ipshwrhit]; + } + + for (UInt_t ipshwrhit=0; ipshwrhit < ppshwr_posHits; ipshwrhit++) + {/* + h2_ppshwr_posPulseTime_pT1_diff->Fill(ppshwr_posPmt[ipshwrhit], ppshwr_posPulseTime[ipshwrhit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_ppshwr_posPulseTime_pT2_diff->Fill(ppshwr_posPmt[ipshwrhit], ppshwr_posPulseTime[ipshwrhit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_ppshwr_posPulseTime_pT3_diff->Fill(ppshwr_posPmt[ipshwrhit], ppshwr_posPulseTime[ipshwrhit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + ppshwr_adcPulseInt += ppshwr_posPulseInt[ipshwrhit]*pshwr_pos_adc2GeV[ipshwrhit]; + } + if (ppshwr_adcPulseInt != 0.0) //h_ppshwr_PulseInt->Fill(ppshwr_adcPulseInt); + //End of loop over Pre-Shower + + //Shower + Double_t pshwr_adcPulseInt = 0.0; + + for (UInt_t ishwrhit = 0; ishwrhit < pshwr_hits; ishwrhit++) + {/* + h2_pshwr_pulseTime_pT1_diff->Fill(pshwr_pmt[ishwrhit], pshwr_pulseTimeRaw[ishwrhit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_pshwr_pulseTime_pT2_diff->Fill(pshwr_pmt[ishwrhit], pshwr_pulseTimeRaw[ishwrhit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_pshwr_pulseTime_pT3_diff->Fill(pshwr_pmt[ishwrhit], pshwr_pulseTimeRaw[ishwrhit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + pshwr_adcPulseInt += pshwr_pulseInt[ishwrhit]*shwr_adc2GeV; + } + if (pshwr_adcPulseInt != 0.0) //h_pshwr_PulseInt->Fill(pshwr_adcPulseInt); + + for (UInt_t itrack = 0; itrack < ntracks; itrack++) + { + // if (trk_pmag[0] != 0.0 && ntracks == 1) h2_EdivP_vs_P->Fill(trk_pmag[0], (ppshwr_adcPulseInt + pshwr_adcPulseInt)/trk_pmag[0]); + } + //End of Loop over Shower + + + //NGC + Double_t pngc_adcInt = 0.0; + Double_t pngc_adcAmp = 0.0; + Double_t pngc_NPE = 0.0; + + for (UInt_t ipmt = 0; ipmt < nngc_pmts; ipmt++) + { + if (pngc_pulseAmp[ipmt] == 0.0) continue; + if (pngc_pulseTimeRaw[ipmt] == 0.0) continue; + + pngc_adcInt += pngc_pulseInt[ipmt]; + pngc_adcAmp += pngc_pulseAmp[ipmt]; + pngc_NPE += pngc_pulseInt[ipmt]*ngc_adc2npe[ipmt]; + + //Basic Quantities + /* + h_pngc_adcPulseInt[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_adcPulseAmp[ipmt]->Fill(pngc_pulseAmp[ipmt]); + h_pngc_adcPulseTimeRaw[ipmt]->Fill(pngc_pulseTimeRaw[ipmt]*clk2adc); //*/ + + /* + h2_pngc_pulseTime_pT1_diff->Fill(pngc_pmt[ingchit], pngc_pulseTimeRaw[ingchit]*clk2adc - pT1_tdcTime*clk2tdc); + h2_pngc_pulseTime_pT2_diff->Fill(pngc_pmt[ingchit], pngc_pulseTimeRaw[ingchit]*clk2adc - pT2_tdcTime*clk2tdc); + h2_pngc_pulseTime_pT3_diff->Fill(pngc_pmt[ingchit], pngc_pulseTimeRaw[ingchit]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + + //Generating histos for Quadrants vs PMT + /* + + if (trk_y[0] + trk_phi[0] * nngc_z >= 0.0 && trk_x[0] + trk_theta[0] * nngc_z >= 0.0) + { + h_pngc_quad1_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad1_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad1_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad1_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad1_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad1_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 1 + + if (trk_y[0] + trk_phi[0] * nngc_z < 0.0 && trk_x[0] + trk_theta[0] * nngc_z >= 0.0) + { + h_pngc_quad2_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad2_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad2_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad2_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad2_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad2_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 2 + + if (trk_y[0] + trk_phi[0] * nngc_z >= 0.0 && trk_x[0] + trk_theta[0] * nngc_z < 0.0) + { + h_pngc_quad3_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad3_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad3_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad3_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad3_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad3_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 3 + + if (trk_y[0] + trk_phi[0] * nngc_z < 0.0 && trk_x[0] + trk_theta[0] * nngc_z < 0.0) + { + h_pngc_quad4_pulseInt_sum[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad4_pulseAmp_sum[ipmt]->Fill(pngc_pulseAmp[ipmt]); + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad4_pulseInt_e[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad4_pulseAmp_e[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h_pngc_quad4_pulseInt_pi[ipmt]->Fill(pngc_pulseInt[ipmt]); + h_pngc_quad4_pulseAmp_pi[ipmt]->Fill(pngc_pulseAmp[ipmt]); + } + }//Quadrant 4 //*/ + } + if (pngc_adcInt != 0.0) //h_pngc_adcPulseInt_sum->Fill(pngc_adcInt); + //End of loop over NGC + + //HGC + Double_t phgc_Int = 0; + Double_t phgc_Amp = 0; + Double_t phgc_NPE = 0; + + for (UInt_t ipmt = 0; ipmt < nhgc_pmts; ipmt++) + { + if (phgc_pulseAmp[ipmt] == 0.0) continue; + if (phgc_pulseTimeRaw[ipmt] == 0.0) continue; + + phgc_Int += phgc_pulseInt[ipmt]; + phgc_Amp += phgc_pulseAmp[ipmt]; + phgc_NPE += phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]; //Remove pedistal from other PMTs? + + //Basic Quantities + ///* + h_phgc_adcPulseInt[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_adcPulseAmp[ipmt]->Fill(phgc_pulseAmp[ipmt]); + //h_phgc_adcPulseTimeRaw[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc); //*/ + + //Timing Information + /* + h2_phgc_hodstarttime_pulseTime[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phod_starttime*clk2tdc); + + h_phgc_adcPulseTimeCorr_T1[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc); + h_phgc_adcPulseTimeCorr_T2[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc); + h_phgc_adcPulseTimeCorr_T3[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc); + + h2_phgc_pulseTime_pT1_pmt->Fill(phgc_pmt[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc); + h2_phgc_pulseTime_pT2_pmt->Fill(phgc_pmt[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc); + h2_phgc_pulseTime_pT3_pmt->Fill(phgc_pmt[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc); + + h2_phgc_pulseTime_pT1_diff->Fill(pT1_tdcTime*clk2tdc, phgc_pulseTimeRaw[ipmt]*clk2adc); + h2_phgc_pulseTime_pT2_diff->Fill(pT2_tdcTime*clk2tdc, phgc_pulseTimeRaw[ipmt]*clk2adc); + h2_phgc_pulseTime_pT3_diff->Fill(pT3_tdcTime*clk2tdc, phgc_pulseTimeRaw[ipmt]*clk2adc); + + h2_phgc_adcInt_TimeRaw[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h2_phgc_adcAmp_TimeRaw[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseAmp[ipmt]); + + h2_phgc_adcInt_T1[ipmt]->Fill(pT1_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_adcInt_T2[ipmt]->Fill(pT2_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_adcInt_T3[ipmt]->Fill(pT3_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + + h2_phgc_pulseInt_pT1[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_pulseInt_pT2[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + h2_phgc_pulseInt_pT3[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc, phgc_pulseInt[ipmt]); + + h2_phgc_TimeWalk_T1[ipmt]->Fill(phgc_pulseAmp[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT1_tdcTime*clk2tdc); + h2_phgc_TimeWalk_T2[ipmt]->Fill(phgc_pulseAmp[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT2_tdcTime*clk2tdc); + h2_phgc_TimeWalk_T3[ipmt]->Fill(phgc_pulseAmp[ipmt], phgc_pulseTimeRaw[ipmt]*clk2adc - pT3_tdcTime*clk2tdc); + //*/ + + //Performing cuts on PulseAmp to eliminate large counts with PulseInt = 0 + /* + if (phgc_pulseAmp[ipmt] <= 10) h_phgc_pulseAmp_10[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 10) h_phgc_pulseAmp_no10[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 20) h_phgc_pulseAmp_20[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 20) h_phgc_pulseAmp_no20[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 30) h_phgc_pulseAmp_30[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 30) h_phgc_pulseAmp_no30[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 40) h_phgc_pulseAmp_40[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 40) h_phgc_pulseAmp_no40[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 50) h_phgc_pulseAmp_50[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 50) h_phgc_pulseAmp_no50[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 60) h_phgc_pulseAmp_60[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 60) h_phgc_pulseAmp_no60[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] <= 70) h_phgc_pulseAmp_70[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (phgc_pulseAmp[ipmt] > 70) h_phgc_pulseAmp_no70[ipmt]->Fill(phgc_pulseInt[ipmt]); + //*/ + + //Particle ID cuts with a linear cut + /* + if (pngc_adcInt > shwr_ngc_id->Eval(ppshwr_adcPulseInt + pshwr_adcPulseInt)) h_phgc_ecut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + if (pngc_adcInt < shwr_ngc_id->Eval(ppshwr_adcPulseInt + pshwr_adcPulseInt)) h_phgc_picut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + */ + + //Particle ID cuts with a 1/x cut + /* + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + //h_phgc_ecut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h2_phgc_adcInt_TimeRaw_e[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h3_ptrk_hgc_adcInt2NPE_e[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + //h_phgc_picut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h2_phgc_adcInt_TimeRaw_pi[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h3_ptrk_hgc_adcInt2NPE_pi[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + //h_phgc_picut_shwr[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h2_phgc_adcInt_TimeRaw_pi[ipmt]->Fill(phgc_pulseTimeRaw[ipmt]*clk2adc, phgc_pulseInt[ipmt]); + h3_ptrk_hgc_adcInt2NPE_pi[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + }//*/ + + //Tracking Information in HGC + /* + h2_ptrk_hgc[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]); + h2_ptrk_hgc_adcAmp[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseAmp[ipmt]); + h3_ptrk_hgc_adcInt2NPE[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + //h3_ptrk_hgc_adcAmp2NPE[ipmt]->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_pulseAmp[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + //*/ + + + //Generating histos for Quadrants vs PMT + ///* + + if (trk_y[0] + trk_phi[0] * nhgc_z >= 4.6 && trk_x[0] + trk_theta[0] * nhgc_z >= 9.4) + { + h_phgc_quad1_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad1_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad1_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad1_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad1_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 1 + + if (trk_y[0] + trk_phi[0] * nhgc_z < 4.6 && trk_x[0] + trk_theta[0] * nhgc_z >= 9.4) + { + h_phgc_quad2_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad2_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad2_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad2_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad2_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 2 + + if (trk_y[0] + trk_phi[0] * nhgc_z >= 4.6 && trk_x[0] + trk_theta[0] * nhgc_z < 9.4) + { + h_phgc_quad3_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad3_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad3_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad3_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad3_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 3 + + if (trk_y[0] + trk_phi[0] * nhgc_z < 4.6 && trk_x[0] + trk_theta[0] * nhgc_z < 9.4) + { + h_phgc_quad4_pulseInt_sum[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_sum[ipmt]->Fill(phgc_pulseAmp[ipmt]); + if (pngc_adcInt >= 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) >= shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad4_pulseInt_e[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_e[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h_phgc_quad4_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + } + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h_phgc_quad4_pulseInt_pi[ipmt]->Fill(phgc_pulseInt[ipmt]); + //h_phgc_quad4_pulseAmp_pi[ipmt]->Fill(phgc_pulseAmp[ipmt]); + } + }//Quadrant 4 + + //*/ + + //h_phgc_pulseInt_npe[ipmt]->Fill(phgc_pulseInt[ipmt]*hgc_adcInt2npe_pulseInt[ipmt]); + } + //if (phgc_Int != 0.0) h_phgc_adcPulseIntSum->Fill(phgc_Int); + //if (phgc_Amp != 0.0) h_phgc_adcPulseAmpSum->Fill(phgc_Amp); + //if (phgc_Amp != 0.0) h3_ptrk_hgc_adcInt2NPE_full->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + //End of loop over HGC + + //Tracking Information + /* + h2_ptrk_ngc_sum->Fill(trk_x[0] + trk_theta[0] * nngc_z, trk_y[0] + trk_phi[0] * nngc_z); + if (pngc_adcAmp > 25.0) h2_ptrk_ngc_sum_noped->Fill(trk_x[0] + trk_theta[0] * nngc_z, trk_y[0] + trk_phi[0] * nngc_z); + if (pngc_adcAmp <= 25.0) h2_ptrk_ngc_sum_ped->Fill(trk_x[0] + trk_theta[0] * nngc_z, trk_y[0] + trk_phi[0] * nngc_z); + //h2_ptrk_hgc_sum->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + //h2_ptrk_fp->Fill(trk_x[0], trk_y[0]); //*/ + + //For a 1/x Cut on Paricle ID + /* + if (pngc_adcInt > 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_ptrk_fp_e->Fill(trk_x[0], trk_y[0]); + h2_ptrk_hgc_e->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + h3_ptrk_hgc_adcInt2NPE_full_e->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_ptrk_fp_pi->Fill(trk_x[0], trk_y[0]); + h2_ptrk_hgc_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + h3_ptrk_hgc_adcInt2NPE_full_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_ptrk_fp_pi->Fill(trk_x[0], trk_y[0]); + h2_ptrk_hgc_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z); + h3_ptrk_hgc_adcInt2NPE_full_pi->Fill(trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z, phgc_NPE); + }//*/ + + //Combinations of Detectors + /* + if (phgc_NPE != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) h2_pshwr_vs_phgcer->Fill(phgc_NPE, pshwr_adcPulseInt + ppshwr_adcPulseInt); + //if (pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) h2_pshwr_vs_pngc->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + //if (ppshwr_adcPulseInt != 0.0 && pshwr_adcPulseInt != 0.0) h2_pshwr_vs_ppshwr->Fill(pshwr_adcPulseInt, ppshwr_adcPulseInt); + //*/ + + //Cut on Shower and NGC for Electrons + //For a Linear Cut for Particle ID + /* + if (ppshwr_adcPulseInt + pshwr_adcPulseInt >= shwr_ngc_id->Eval(pngc_adcInt) && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_pshwr_vs_pngc_ecut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h_phgc_adcPulseIntSum_e->Fill(phgc_Int); + } + //Cut on Shower for Pions + if (ppshwr_adcPulseInt + pshwr_adcPulseInt < shwr_ngc_id->Eval(pngc_adcInt) && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_pshwr_vs_pngc_picut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h_phgc_adcPulseIntSum_pi->Fill(phgc_Int); + } + */ + //For a 1/x Cut on Paricle ID + /* + if (pngc_adcInt > 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_pshwr_vs_pngc_ecut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h_phgc_adcPulseIntSum_e->Fill(phgc_Int); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_ngc_id->Eval(pngc_adcInt)) + { + h2_pshwr_vs_pngc_picut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h_phgc_adcPulseIntSum_pi->Fill(phgc_Int); + } + } + + if (pngc_adcInt < 2000 && pngc_adcInt != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + h2_pshwr_vs_pngc_picut->Fill(pngc_adcInt, pshwr_adcPulseInt + ppshwr_adcPulseInt); + h_phgc_adcPulseIntSum_pi->Fill(phgc_Int); + } + //*/ + //Cut on Shower and HGC for Particle ID + if (phgc_NPE != 0.0 && (ppshwr_adcPulseInt + pshwr_adcPulseInt) != 0.0) + { + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) > shwr_hgc_id->Eval(phgc_NPE)) + { + h2_pshwr_vs_phgc_ecut->Fill(phgc_NPE, pshwr_adcPulseInt + ppshwr_adcPulseInt); + } + if ((ppshwr_adcPulseInt + pshwr_adcPulseInt) < shwr_hgc_id->Eval(phgc_NPE)) + { + h2_pshwr_vs_phgc_picut->Fill(phgc_NPE, pshwr_adcPulseInt + ppshwr_adcPulseInt); + } + } + + + //End Loop over Combination of Detectors + + } + }//End of loop over entries + + g->Write(); + + + + + //Start to draw things nicely + /* + + //Draw HGC PulseInt for each PMT + TCanvas *hgc_pulseInt = new TCanvas("hgc_pulseInt","[Diag]hgc_Int",1200,600); + hgc_pulseInt->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pulseInt->cd(i+1); + hgc_pulseInt->cd(i+1)->SetLogy(); + h_phgc_adcPulseInt[i]->GetXaxis()->SetTitle("ADC Channel"); + h_phgc_adcPulseInt[i]->GetYaxis()->SetTitle("Counts"); + h_phgc_adcPulseInt[i]->SetStats(0); + h_phgc_adcPulseInt[i]->DrawCopy(); + } + + //Draw HGC PulseAmp for each PMT + TCanvas *hgc_pulseAmp = new TCanvas("hgc_pulseAmp","[Diag]hgc_Amp",1200,600); + hgc_pulseAmp->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pulseAmp->cd(i+1); + hgc_pulseAmp->cd(i+1)->SetLogy(); + h_phgc_adcPulseAmp[i]->DrawCopy(); + } + + //Draw HGC PulseTimeRaw for each PMT + TCanvas *hgc_pulseTimeRaw = new TCanvas("hgc_pulseTimeRaw","[Diag]hgc_TimeRaw",1200,600); + hgc_pulseTimeRaw->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pulseTimeRaw->cd(i+1); + h_phgc_adcPulseTimeRaw[i]->DrawCopy(); + } + + //Draw NGC PulseInt + TCanvas *ngc_pulseInt = new TCanvas("ngc_pulseInt","[Diag]ngc_Int",1200,600); + ngc_pulseInt->cd(1)->SetLogy(); + h_pngc_adcPulseInt->DrawCopy(); + + + //Draw Pre-Shower and Shower PulseInt + TCanvas *ppshwr_pulseInt = new TCanvas("ppshwr_pulseInt","[Diag]Pre-/Shower PulseInt",1200,600); + ppshwr_pulseInt->Divide(1,2); + + ppshwr_pulseInt->cd(1); + ppshwr_pulseInt->cd(1)->SetLogy(); + h_pshwr_PulseInt->DrawCopy(); + + ppshwr_pulseInt->cd(2); + ppshwr_pulseInt->cd(2)->SetLogy(); + h_ppshwr_PulseInt->DrawCopy(); + + //Draw Pre-Shower vs HGC PulseInt + TCanvas *ppshwr_vs_hgc = new TCanvas("ppshwr_vs_hgc","[Diag]ppshwr vs hgc PulseInt",1200,600); + h2_pshwr_vs_phgcer->GetXaxis()->SetTitle("HGC ADC channel"); + h2_pshwr_vs_phgcer->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_phgcer->SetStats(0); + h2_pshwr_vs_phgcer->DrawCopy("Colz"); + + //Draw Pre-Shower vs Shower + TCanvas *ppshwr_vs_pshwr = new TCanvas("ppshwr_vs_pshwr","[Diag]ppshwr vs pshwr PulseInt",1200,600); + h2_pshwr_vs_ppshwr->GetXaxis()->SetTitle("Shower GeV"); + h2_pshwr_vs_ppshwr->GetYaxis()->SetTitle("Pre-Shower GeV"); + h2_pshwr_vs_ppshwr->SetStats(0); + h2_pshwr_vs_ppshwr->DrawCopy("Colz"); + + //Draw Pre-Shower vs NGC PulseInt + TCanvas *ppshwr_vs_ngc = new TCanvas("ppshwr_vs_ngc","[Diag]ppshwr vs ngc PulseInt",1200,600); + h2_pshwr_vs_pngc->GetXaxis()->SetTitle("NGC ADC channel"); + h2_pshwr_vs_pngc->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_pngc->DrawCopy("Colz"); + shwr_ngc_id->DrawCopy("same"); + + //Draw Pre-Shower vs NGC PulseInt pion & e cuts + TCanvas *pshwr_vs_ngc_cuts = new TCanvas("pswr_vs_ngc_cuts","[Diag]pshwr vs ngc PulseInt Cuts",1200,600); + pshwr_vs_ngc_cuts->Divide(2,1); + + pshwr_vs_ngc_cuts->cd(1); + h2_pshwr_vs_pngc_ecut->GetXaxis()->SetTitle("NGC ADC channel"); + h2_pshwr_vs_pngc_ecut->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_pngc_ecut->DrawCopy("Colz"); + shwr_ngc_id->DrawCopy("same"); + + pshwr_vs_ngc_cuts->cd(2); + h2_pshwr_vs_pngc_picut->GetXaxis()->SetTitle("NGC ADC channel"); + h2_pshwr_vs_pngc_picut->GetYaxis()->SetTitle("Shwr/Pshwr GeV"); + h2_pshwr_vs_pngc_picut->DrawCopy("Colz"); + shwr_ngc_id->DrawCopy("same"); + + //Draw Electrons in HGC wrt Shower/Pre-Shower per PMT + TCanvas *hgc_ecut_shwr = new TCanvas("hgc_ecut_shwr","[Cut]HGC Electrons from Shower",1200,600); + hgc_ecut_shwr->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_ecut_shwr->cd(i+1); + hgc_ecut_shwr->cd(i+1)->SetLogy(); + h_phgc_ecut_shwr[i]->DrawCopy(); + } + + //Draw Pions in HGC wrt Shower/Pre-Shower per PMT + TCanvas *hgc_picut_shwr = new TCanvas("hgc_picut_shwr","[Cut]HGC Pions from Shower",1200,600); + hgc_picut_shwr->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_picut_shwr->cd(i+1); + hgc_picut_shwr->cd(i+1)->SetLogy(); + h_phgc_picut_shwr[i]->DrawCopy(); + } + + //Draw Pions, Electrons and Unchanged Pulse Int for HGC w Shower cut + TCanvas *hgc_sumcut_shwr = new TCanvas("hgc_sumcut_shwr","[Cut]HGC PulseInt Sum, e, pi",1200,600); + hgc_sumcut_shwr->cd(1)->SetLogy(); + h_phgc_adcPulseIntSum->DrawCopy(); + h_phgc_adcPulseIntSum_e->SetLineColor(5); + h_phgc_adcPulseIntSum_e->DrawCopy("same"); + h_phgc_adcPulseIntSum_pi->SetLineColor(7); + h_phgc_adcPulseIntSum_pi->DrawCopy("same"); + + //Draw HGC PulseInt with cuts on PulseAmp = 0. + TCanvas *hgc_pulseAmp0 = new TCanvas("hgc_pulseAmp0", "[Diag]HGC PulseInt with PulseAmp = 0.",1200,600); + hgc_pulseAmp0->Divide(2,7); + + hgc_pulseAmp0->cd(1); + hgc_pulseAmp0->cd(1)->SetLogy(); + h_phgc_pulseAmp_10->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_10->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_10->DrawCopy(); + + hgc_pulseAmp0->cd(2); + hgc_pulseAmp0->cd(2)->SetLogy(); + h_phgc_pulseAmp_no10->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no10->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no10->DrawCopy(); + + hgc_pulseAmp0->cd(3); + hgc_pulseAmp0->cd(3)->SetLogy(); + h_phgc_pulseAmp_20->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_20->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_20->DrawCopy(); + + hgc_pulseAmp0->cd(4); + hgc_pulseAmp0->cd(4)->SetLogy(); + h_phgc_pulseAmp_no20->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no20->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no20->DrawCopy(); + + hgc_pulseAmp0->cd(5); + hgc_pulseAmp0->cd(5)->SetLogy(); + h_phgc_pulseAmp_30->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_30->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_30->DrawCopy(); + + hgc_pulseAmp0->cd(6); + hgc_pulseAmp0->cd(6)->SetLogy(); + h_phgc_pulseAmp_no30->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no30->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no30->DrawCopy(); + + hgc_pulseAmp0->cd(7); + hgc_pulseAmp0->cd(7)->SetLogy(); + h_phgc_pulseAmp_40->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_40->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_40->DrawCopy(); + + hgc_pulseAmp0->cd(8); + hgc_pulseAmp0->cd(8)->SetLogy(); + h_phgc_pulseAmp_no40->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no40->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no40->DrawCopy(); + + hgc_pulseAmp0->cd(9); + hgc_pulseAmp0->cd(9)->SetLogy(); + h_phgc_pulseAmp_50->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_50->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_50->DrawCopy(); + + hgc_pulseAmp0->cd(10); + hgc_pulseAmp0->cd(10)->SetLogy(); + h_phgc_pulseAmp_no50->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no50->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no50->DrawCopy(); + + hgc_pulseAmp0->cd(11); + hgc_pulseAmp0->cd(11)->SetLogy(); + h_phgc_pulseAmp_60->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_60->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_60->DrawCopy(); + + hgc_pulseAmp0->cd(12); + hgc_pulseAmp0->cd(12)->SetLogy(); + h_phgc_pulseAmp_no60->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no60->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no60->DrawCopy(); + + hgc_pulseAmp0->cd(13); + hgc_pulseAmp0->cd(13)->SetLogy(); + h_phgc_pulseAmp_70->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_70->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_70->DrawCopy(); + + hgc_pulseAmp0->cd(14); + hgc_pulseAmp0->cd(14)->SetLogy(); + h_phgc_pulseAmp_no70->GetXaxis()->SetTitle("PulseInt"); + h_phgc_pulseAmp_no70->GetYaxis()->SetTitle("Counts"); + h_phgc_pulseAmp_no70->DrawCopy(); + + //Draw HGC adcInt vs TimeRaw + TCanvas *hgc_adcInt_TimeRaw = new TCanvas("hgc_adcInt_TimeRaw","[Diag]HGC PulseInt vs TimeRaw",1200,600); + hgc_adcInt_TimeRaw->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_TimeRaw->cd(i+1); + hgc_adcInt_TimeRaw->cd(i+1)->SetLogx(); + h2_phgc_adcInt_TimeRaw[i]->GetXaxis()->SetTitle("PulseInt"); + h2_phgc_adcInt_TimeRaw[i]->GetYaxis()->SetTitle("TimeRaw"); + h2_phgc_adcInt_TimeRaw[i]->DrawCopy("Colz"); + } + + //Draw HGC adcInt vs DC Trigger T1 + TCanvas *hgc_adcInt_T1 = new TCanvas("hgc_adcInt_T1","[Diag]HGC PulseInt vs T1",1200,600); + hgc_adcInt_T1->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_T1->cd(i+1); + hgc_adcInt_T1->cd(i+1)->SetLogx(); + h2_phgc_pulseInt_pT1[i]->GetYaxis()->SetTitle("ADC Time (ns)"); + h2_phgc_pulseInt_pT1[i]->GetXaxis()->SetTitle("ADC Channel"); + h2_phgc_pulseInt_pT1[i]->DrawCopy("Colz"); + } + + //Draw HGC adcInt vs DC Trigger T2 + TCanvas *hgc_adcInt_T2 = new TCanvas("hgc_adcInt_T2","[Diag]HGC PulseInt vs T2",1200,600); + hgc_adcInt_T2->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_T2->cd(i+1); + hgc_adcInt_T2->cd(i+1)->SetLogx(); + h2_phgc_pulseInt_pT2[i]->GetYaxis()->SetTitle("ADC Time (ns)"); + h2_phgc_pulseInt_pT2[i]->GetXaxis()->SetTitle("ADC Channel"); + h2_phgc_pulseInt_pT2[i]->DrawCopy("Colz"); + } + + //Draw HGC adcInt vs DC Trigger T3 + TCanvas *hgc_adcInt_T3 = new TCanvas("hgc_adcInt_T3","[Diag]HGC PulseInt vs T3",1200,600); + hgc_adcInt_T3->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_adcInt_T3->cd(i+1); + hgc_adcInt_T3->cd(i+1)->SetLogx(); + h2_phgc_pulseInt_pT3[i]->GetYaxis()->SetTitle("ADC Time (ns)"); + h2_phgc_pulseInt_pT3[i]->GetXaxis()->SetTitle("ADC Channel"); + h2_phgc_pulseInt_pT3[i]->DrawCopy("Colz"); + } + + + //Draw Particle Tracking in HGC + TCanvas *hgc_trk = new TCanvas("hgc_trk", "[Diag]Particle Tracks in HGC",1200,600); + h2_ptrk_hgc_sum->GetYaxis()->SetTitle("Y Position"); + h2_ptrk_hgc_sum->GetXaxis()->SetTitle("X Position"); + h2_ptrk_hgc_sum->DrawCopy("Colz"); + + //Draw Particle Tracking in HGC for each PMT + TCanvas *hgc_pmt_trk = new TCanvas("hgc_pmt_trk", "[Diag]Particle Tracks in HGC for each PMT weighted by PulseInt",1200,600); + hgc_pmt_trk->Divide(2,2); + + for (int i=0; i<4; i++) + { + hgc_pmt_trk->cd(i+1); + hgc_pmt_trk->cd(i+1)->SetLogz(); + h2_ptrk_hgc[i]->GetYaxis()->SetTitle("Y Position"); + h2_ptrk_hgc[i]->GetXaxis()->SetTitle("X Position"); + h2_ptrk_hgc[i]->DrawCopy("Colz"); + } + + + //Draw Particle ID Separation with Quadrant Separation + TCanvas *hgc_trk_id_cut = new TCanvas("hgc_trk_id_cut", "[Cut]HGC Particle ID cut with Quadrant Cuts",1200,600); + hgc_trk_id_cut->Divide(4,4); + + for (int i=0; i<16; i++) + { + hgc_trk_id_cut->cd(i+1); + hgc_trk_id_cut->cd(i+1)->SetLogy(); + + if (i % 4 == 0) //Looking at PMT1 + { + if (i / 4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[0]->DrawCopy(); + h_phgc_quad1_e[0]->SetLineColor(2); + h_phgc_quad1_e[0]->DrawCopy("same"); + h_phgc_quad1_pi[0]->SetLineColor(8); + h_phgc_quad1_pi[0]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[0]->DrawCopy(); + h_phgc_quad2_e[0]->SetLineColor(2); + h_phgc_quad2_e[0]->DrawCopy("same"); + h_phgc_quad2_pi[0]->SetLineColor(8); + h_phgc_quad2_pi[0]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[0]->DrawCopy(); + h_phgc_quad3_e[0]->SetLineColor(2); + h_phgc_quad3_e[0]->DrawCopy("same"); + h_phgc_quad3_pi[0]->SetLineColor(8); + h_phgc_quad3_pi[0]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[0]->DrawCopy(); + h_phgc_quad4_e[0]->SetLineColor(2); + h_phgc_quad4_e[0]->DrawCopy("same"); + h_phgc_quad4_pi[0]->SetLineColor(8); + h_phgc_quad4_pi[0]->DrawCopy("same"); + } + }//End of PMT1 + + if (i % 4 == 1) //Looking at PMT2 + { + if (i / 4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[1]->DrawCopy(); + h_phgc_quad1_e[1]->SetLineColor(2); + h_phgc_quad1_e[1]->DrawCopy("same"); + h_phgc_quad1_pi[1]->SetLineColor(8); + h_phgc_quad1_pi[1]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[1]->DrawCopy(); + h_phgc_quad2_e[1]->SetLineColor(2); + h_phgc_quad2_e[1]->DrawCopy("same"); + h_phgc_quad2_pi[1]->SetLineColor(8); + h_phgc_quad2_pi[1]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[1]->DrawCopy(); + h_phgc_quad3_e[1]->SetLineColor(2); + h_phgc_quad3_e[1]->DrawCopy("same"); + h_phgc_quad3_pi[1]->SetLineColor(8); + h_phgc_quad3_pi[1]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[1]->DrawCopy(); + h_phgc_quad4_e[1]->SetLineColor(2); + h_phgc_quad4_e[1]->DrawCopy("same"); + h_phgc_quad4_pi[1]->SetLineColor(8); + h_phgc_quad4_pi[1]->DrawCopy("same"); + } + }//End of PMT2 + + if (i % 4 == 2) //Looking at PMT3 + { + if (i/4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[2]->DrawCopy(); + h_phgc_quad1_e[2]->SetLineColor(2); + h_phgc_quad1_e[2]->DrawCopy("same"); + h_phgc_quad1_pi[2]->SetLineColor(8); + h_phgc_quad1_pi[2]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[2]->DrawCopy(); + h_phgc_quad2_e[2]->SetLineColor(2); + h_phgc_quad2_e[2]->DrawCopy("same");trk_x[0] + trk_theta[0] * nhgc_z, trk_y[0] + trk_phi[0] * nhgc_z,phgc_pulseInt[ipmt]) + h_phgc_quad2_pi[2]->SetLineColor(8); + h_phgc_quad2_pi[2]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[2]->DrawCopy(); + h_phgc_quad3_e[2]->SetLineColor(2); + h_phgc_quad3_e[2]->DrawCopy("same"); + h_phgc_quad3_pi[2]->SetLineColor(8); + h_phgc_quad3_pi[2]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[2]->DrawCopy(); + h_phgc_quad4_e[2]->SetLineColor(2); + h_phgc_quad4_e[2]->DrawCopy("same"); + h_phgc_quad4_pi[2]->SetLineColor(8); + h_phgc_quad4_pi[2]->DrawCopy("same"); + } + }//End of PMT3 + + if (i % 4 == 3) //Looking at PMT4 + { + if (i/4 == 0)//Quadrant 1 + { + h_phgc_quad1_sum[3]->DrawCopy(); + h_phgc_quad1_e[3]->SetLineColor(2); + h_phgc_quad1_e[3]->DrawCopy("same"); + h_phgc_quad1_pi[3]->SetLineColor(8); + h_phgc_quad1_pi[3]->DrawCopy("same"); + } + if (i/4 == 1)//Quadrant 2 + { + h_phgc_quad2_sum[3]->DrawCopy(); + h_phgc_quad2_e[3]->SetLineColor(2); + h_phgc_quad2_e[3]->DrawCopy("same"); + h_phgc_quad2_pi[3]->SetLineColor(8); + h_phgc_quad2_pi[3]->DrawCopy("same"); + } + if (i/4 == 2)//Quadrant 3 + { + h_phgc_quad3_sum[3]->DrawCopy(); + h_phgc_quad3_e[3]->SetLineColor(2); + h_phgc_quad3_e[3]->DrawCopy("same"); + h_phgc_quad3_pi[3]->SetLineColor(8); + h_phgc_quad3_pi[3]->DrawCopy("same"); + } + if (i/4 == 3)//Quadrant 4 + { + h_phgc_quad4_sum[3]->DrawCopy(); + h_phgc_quad4_e[3]->SetLineColor(2); + h_phgc_quad4_e[3]->DrawCopy("same"); + h_phgc_quad4_pi[3]->SetLineColor(8); + h_phgc_quad4_pi[3]->DrawCopy("same"); + } + }//End of PMT4 + } + */ +}//End of Program diff --git a/CALIBRATION/shms_hgcer_calib/scripts/calib_const.C b/CALIBRATION/shms_hgcer_calib/scripts/calib_const.C new file mode 100644 index 0000000000000000000000000000000000000000..6c7ae52a7e36c16d5d1a3615fc7a33a27e28e3f7 --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/calib_const.C @@ -0,0 +1,363 @@ +#include "Fit/Fitter.h" +#include "Fit/BinData.h" +#include "Fit/Chi2FCN.h" +#include "TH1.h" +#include "TList.h" +#include "TCanvas.h" +#include "TStyle.h" +#include "TFile.h" +#include "TSpectrum.h" +#include "TPolyMarker.h" + +Double_t poisson(Double_t *x, Double_t *par) +{ + Double_t result1 = (par[1]*pow(par[0],x[0])*exp(-par[0]))/(ROOT::Math::tgamma(x[0]+1)); + return result1; +} + +Double_t gauss(Double_t *x, Double_t *par) +{ + Double_t result1 = par[0]*exp((-0.5)*(pow((x[0] - par[1]),2)/pow((par[2]),2))); + Double_t result2 = par[3]*exp((-0.5)*(pow((x[0] - par[4]),2)/pow((par[5]),2))); + Double_t result3 = par[6]*exp((-0.5)*(pow((x[0] - par[7]),2)/pow((par[8]),2))); + Double_t result4 = par[9]*exp((-0.5)*(pow((x[0] - par[10]),2)/pow((par[11]),2))); + Double_t result5 = par[12]*exp((-0.5)*(pow((x[0] - par[13]),2)/pow((par[14]),2))); + return result1 + result2 + result3 + result4 + result5; +} + +Double_t linear(Double_t *x, Double_t *par) +{ + Double_t result1 = par[0]*x[0] + par[1]; + return result1; +} + +void calib_const(Int_t RunNumber=0, Int_t EventNumber=-1) +{ + if (RunNumber == 0) + { + cout << "Enter a Run Number (-1 to exit): "; + cin >> RunNumber; + cout << "Enter number of events (default is -1): "; + cin >> EventNumber; + if (RunNumber <= 0) return; + } + TFile *F = new TFile(Form("root_files/shms_calibration_%d_%d.root", RunNumber, EventNumber)); + + int num_pars = 6; + int fit_max = 10000; + int fit_min = -1000; + + TH1F *hgc_e[4][4]; + TH1F *hgc_pi[4][4]; + TH1F *hgc_full[4]; + TH1F *hgc_conv[4]; + TH1F *hgc_background[4]; + TH1F *hgc_conv_noback[4]; + TH1F *hgc_conv_mk2[4]; + TH1F *hgc_conv_noback_mk2[4]; + + for (Int_t i=0; i<4; i++) + { + for (Int_t j=0; j<4; j++) + { + hgc_e[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_e%d", i+1, j+1)); + hgc_e[i][j]->Rebin(10); + hgc_pi[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_pi%d", i+1, j+1)); + hgc_pi[i][j]->Rebin(10); + } + hgc_full[i] = (TH1F*)F->Get(Form("phgc_adcPulseInt%d", i+1)); + hgc_full[i]->Rebin(10); + } + + + TF1 *l1 = new TF1("l1",linear,0,4,2); + l1->SetParNames("Slope", "Intercept"); + + TF1 *p1 = new TF1("p1",poisson,4,20,2); + p1->SetParNames("Amplitude", "Mean"); + + TF1 *f1 = new TF1("f1",gauss,0.5,3.5,9); + f1->SetParNames("Amplitude 1"," Mean 1","Std. Dev. 1","Amplitude 2","Mean 2","Std. Dev. 2","Amplitude 3","Mean 3","Std. Dev. 3"); + + TF1 *Gauss3 = new TF1("Gauss3",gauss,fit_min,fit_max,9); + Gauss3->SetParNames("Ped Amp","Ped Mean","Ped Std. Dev.","Amplitude 1","Mean 1","Std. Dev. 1","Amplitude 2","Mean 2","Std. Dev. 2"); + + TF1 *Gauss2 = new TF1("Gauss2",gauss,fit_min,fit_max,6); + Gauss2->SetParNames("Ped Amp","Ped Mean","Ped Std. Dev.","Amplitude 1","Mean 1","Std. Dev. 1"); + + TF1 *Gauss1 = new TF1("Gauss1",gauss,fit_min,fit_max,3); + Gauss1->SetParNames("Amplitude","Mean","Std. Dev."); + + Double_t mean_1[6]; + Double_t mean_2[3]; + Double_t x_npe[3], y_npe[3], x_err[3], y_err[3]; + Double_t calibration[4], calibration_mk2[4]; + + TSpectrum *s = new TSpectrum(2); + Double_t *xpeaks; + + TPolyMarker *pm = new TPolyMarker(); + TList *functions = new TList(); + + gStyle->SetOptFit(111); + + + //Main loop for calibration + for (Int_t i=0; i<4; i++) + { + //Examining the single photoelectron (SPE) peak + for (Int_t n=0; n<3; n++) + { + mean_1[n] = 0; + mean_2[n] = 0; + x_npe[n] = 0, y_npe[n] = 0, x_err[n] = 0, y_err[n] = 0; + } + + TCanvas *cuts_i = new TCanvas(Form("cuts_%d",i), Form("First Photoelectron peaks for e & pions PMT%d",i+1)); + cuts_i->Divide(2,3); + Int_t k = 1; + for (Int_t j=0; j<4; j++) + { + if (j == i) continue; + cuts_i->cd(k); + cuts_i->cd(k)->SetLogy(); + + //Peak Finder for parameter guesses + s->Search(hgc_e[j][i], 2.5, "nobackground", 0.001); + functions = hgc_e[j][i]->GetListOfFunctions(); + pm = (TPolyMarker*)functions->FindObject("TPolyMarker"); + xpeaks = pm->GetX(); + + //Fit the Pedistal + /* + Gauss1->SetParameters(1000., xpeaks[0], 100.); + Gauss1->SetParLimits(0, 0., 1000000.); + Gauss1->SetParLimits(1, xpeaks[0]-30., xpeaks[0]+30.); + Gauss1->SetParLimits(2, 1., 200.); + hgc_e[j][i]->Fit("Gauss1","RQNsame"); + */ + //Fit the first SPE for electrons + /* + Gauss2->SetParameters(Gauss1->GetParameter(0), xpeaks[0], Gauss1->GetParameter(2), Gauss1->GetParameter(0)*0.1, xpeaks[1], Gauss1->GetParameter(2)); + Gauss2->SetParLimits(0, Gauss1->GetParameter(0)-100, Gauss1->GetParameter(0)+100); + Gauss2->SetParLimits(1, xpeaks[0]-30, xpeaks[0]+30); + Gauss2->SetParLimits(2, Gauss1->GetParameter(2)-10, Gauss1->GetParameter(2)+10); + Gauss2->SetParLimits(3, 0., Gauss1->GetParameter(0)+1); + Gauss2->SetParLimits(4, xpeaks[1]-10, xpeaks[1]+10); + Gauss2->SetParLimits(5, Gauss1->GetParameter(2), Gauss1->GetParameter(2)+200); + */ + Gauss1->SetRange(xpeaks[1]-100, xpeaks[1]+100); + Gauss1->SetParameter(1, xpeaks[1]); + Gauss1->SetParameter(2, 200.); + Gauss1->SetParLimits(0, 0., 2000.); + Gauss1->SetParLimits(1, xpeaks[1]-200, xpeaks[1]+200); + Gauss1->SetParLimits(2, 10., 500.); + hgc_e[j][i]->Fit("Gauss1","RQN"); + Gauss1->SetParLimits(1, Gauss1->GetParameter(1)-50, Gauss1->GetParameter(1)+50); + Gauss1->SetRange(Gauss1->GetParameter(1)-1.5*Gauss1->GetParameter(2), Gauss1->GetParameter(1)+1.5*Gauss1->GetParameter(2)); + //Gauss1->SetRange(Gauss1->GetParameter(1)-1.0*Gauss1->GetParameter(2), Gauss1->GetParameter(1)+1.0*Gauss1->GetParameter(2)); + hgc_e[j][i]->Fit("Gauss1","RQ"); + if (xpeaks[1] != 0.0 && hgc_e[j][i]->GetBinContent(hgc_e[j][i]->GetXaxis()->FindBin(xpeaks[1])) > 100) mean_1[(k/2)] = Gauss1->GetParameter(1); + if (xpeaks[1] != 0.0 && hgc_e[j][i]->GetBinContent(hgc_e[j][i]->GetXaxis()->FindBin(xpeaks[1])) > 15) mean_2[(k/2)] = Gauss1->GetParameter(1); + gPad->Update(); + + //Repeat for pions + cuts_i->cd(k+1); + cuts_i->cd(k+1)->SetLogy(); + + //Peak finder for parameter guess + s->Search(hgc_pi[j][i], 2.5, "nobackground", 0.001); + functions = hgc_pi[j][i]->GetListOfFunctions(); + pm = (TPolyMarker*)functions->FindObject("TPolyMarker"); + xpeaks = pm->GetX(); + + //Fit the Pedistal + /* + Gauss1->SetParameters(1000., 0., 100.); + Gauss1->SetParLimits(0, 0., 1000000.); + Gauss1->SetParLimits(1, -10., 100.); + Gauss1->SetParLimits(2, 1., 200.); + hgc_pi[j][i]->Fit("Gauss1","RQNsame"); + */ + + //Fit the first SPE for pions + /* + Gauss2->SetParameters(Gauss1->GetParameter(0), Gauss1->GetParameter(1), Gauss1->GetParameter(2), Gauss1->GetParameter(0)*0.1, Gauss1->GetParameter(1)+100, Gauss1->GetParameter(2)); + Gauss2->SetParLimits(0, Gauss1->GetParameter(0)-100, Gauss1->GetParameter(0)+100); + Gauss2->SetParLimits(1, Gauss1->GetParameter(1)-10, Gauss1->GetParameter(1)+10); + Gauss2->SetParLimits(2, Gauss1->GetParameter(2)-10, Gauss1->GetParameter(2)+10); + Gauss2->SetParLimits(3, 0., Gauss1->GetParameter(0)+1); + Gauss2->SetParLimits(4, Gauss1->GetParameter(1)+100, Gauss1->GetParameter(1)+600); + Gauss2->SetParLimits(5, Gauss1->GetParameter(2), Gauss1->GetParameter(2)+200); + hgc_pi[j][i]->Fit("Gauss2","RQsame"); + */ + Gauss1->SetRange(xpeaks[1]-100, xpeaks[1]+100); + Gauss1->SetParameter(1, xpeaks[1]); + Gauss1->SetParameter(2, 200.); + Gauss1->SetParLimits(0, 0., 2000.); + Gauss1->SetParLimits(1, xpeaks[1]-50, xpeaks[1]+50); + Gauss1->SetParLimits(2, 10., 500.); + hgc_pi[j][i]->Fit("Gauss1","RQ"); + if (xpeaks[1] != 0.0 && hgc_pi[j][i]->GetBinContent(hgc_pi[j][i]->GetXaxis()->FindBin(xpeaks[1])) > 100) mean_1[(k/2)] = Gauss1->GetParameter(1); + gPad->Update(); + + k += 2; + } + + //Scale full ADC spectra according to SPE + Int_t nbins; + nbins = hgc_full[i]->GetXaxis()->GetNbins(); + Double_t m = 0.0; + Double_t xscale = 0.0; + for (Int_t n = 0; n < 6; n++) + { + if (mean_1[n] == 0.0) continue; + //cout << mean_1[n] << endl; + xscale += mean_1[n]; + m += 1.0; + } + //cout << m << endl; + if (m == 0.0) + { /* + for (Int_t n = 0; n < 3; n++) + { + cout << mean_2[n] << endl; + if (mean_2[n] == 0.0) continue; + xscale += mean_2[n]; + m += 1.0; + } + xscale = xscale/m;//*/ + ///* + TCanvas *low_stats_i = new TCanvas(Form("low_stats_%d",i),Form("Low stats analysis for PMT%d",i+1)); + s->Search(hgc_full[i], 2.0, "nobackground", 0.001); + functions = hgc_full[i]->GetListOfFunctions(); + pm = (TPolyMarker*)functions->FindObject("TPolyMarker"); + xpeaks = pm->GetX(); + Gauss1->SetRange(xpeaks[1]-100, xpeaks[1]+100); + Gauss1->SetParameter(1, xpeaks[1]); + Gauss1->SetParameter(2, 200.); + Gauss1->SetParLimits(0, 0., 2000.); + Gauss1->SetParLimits(1, xpeaks[1]-50, xpeaks[1]+50); + Gauss1->SetParLimits(2, 10., 500.); + hgc_full[i]->Fit("Gauss1","RQ"); + xscale = Gauss1->GetParameter(1);//*/ + } + else xscale = xscale/m; + //cout << xscale << endl; + hgc_conv[i] = new TH1F(Form("hgc_conv_%d", i+1), Form("Scaled ADC spectra for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale,hgc_full[i]->GetXaxis()->GetXmax()/xscale); + for (Int_t k=0; k<nbins; k++) + { + Double_t y = hgc_full[i]->GetBinContent(k); + Double_t x = hgc_full[i]->GetXaxis()->GetBinLowEdge(k); + hgc_conv[i]->SetBinContent(k,y); + } + //And normalize the heights + hgc_conv[i]->Scale(1.0/hgc_conv[i]->Integral(), "width"); + + TCanvas *ADCspectra_i = new TCanvas(Form("ADCspectra_%d",i), Form("Scaled ADC pulseInt spectra for PMT%d",i+1)); + p1->SetParameter(0, 5.5); + p1->SetParameter(1, 0.25); + hgc_conv[i]->Fit("p1","RQ"); + gPad->Update(); + + hgc_background[i] = new TH1F(Form("hgc_background_%d", i+1), Form("Scaled ADC spectra background for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale,hgc_full[i]->GetXaxis()->GetXmax()/xscale); + hgc_conv_noback[i] = new TH1F(Form("hgc_conv_noback_%d", i+1), Form("Scaled ADC spectra background removed for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale,hgc_full[i]->GetXaxis()->GetXmax()/xscale); + for (Int_t l=0; l<nbins; l++) + { + Double_t y = p1->Eval(hgc_conv[i]->GetXaxis()->GetBinCenter(l)); + Double_t y2 = hgc_conv[i]->GetBinContent(l) - y; + hgc_background[i]->SetBinContent(l,y); + hgc_conv_noback[i]->SetBinContent(l,y2); + } + TCanvas *Final_Spectra_i = new TCanvas(Form("Final_Spectra_%d",i), Form("Scaled ADC pulseInt spectra Background Removed for PMT%d",i+1)); + Final_Spectra_i->Divide(2,1); + Final_Spectra_i->cd(1); + f1->SetParameters(0.08, 1.0, 0.22, 0.029, 2, 0.5, 0.15, 3, 0.26); + f1->SetParLimits(1, 0.5, 1.5); + f1->SetParLimits(2, 0.0, 1.0); + f1->SetParLimits(3, 0.0, 1.0); + f1->SetParLimits(4, 1.5, 2.5); + f1->SetParLimits(5, 0.2, 0.6); + f1->SetParLimits(6, 0.0, 1.0); + f1->SetParLimits(7, 2.5, 3.5); + f1->SetParLimits(8, 0.2, 0.5); + hgc_conv_noback[i]->Fit("f1","RQ"); + hgc_conv_noback[i]->GetXaxis()->SetRangeUser(0,5); + hgc_conv_noback[i]->GetYaxis()->SetRangeUser(0,0.2); + gPad->Update(); + + y_npe[0] = f1->GetParameter(1), y_npe[1] = f1->GetParameter(4), y_npe[2] = f1->GetParameter(7); + y_err[0] = f1->GetParError(1), y_err[1] = f1->GetParError(4), y_err[2] = f1->GetParError(7); + x_npe[0] = 1, x_npe[1] = 2, x_npe[2] = 3; + TGraphErrors *gr_npe = new TGraphErrors(3, x_npe, y_npe, x_err, y_err); + //TCanvas *Linear_i = new TCanvas(Form("Linear_%d",i), Form("Verification of Linear Relationship for PMT%d",i+1)); + Final_Spectra_i->cd(2); + l1->SetParameters(1.0, 0.0); + gr_npe->Fit("l1","RQ"); + gr_npe->Draw("A*"); + gPad->Update(); + calibration[i] = xscale; + + Double_t xscale_mk2 = xscale * l1->GetParameter(0); + hgc_conv_mk2[i] = new TH1F(Form("hgc_conv_mk2_%d", i+1), Form("Scaled ADC spectra mk2 for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale_mk2,hgc_full[i]->GetXaxis()->GetXmax()/xscale_mk2); + for (Int_t k=0; k<nbins; k++) + { + Double_t y = hgc_full[i]->GetBinContent(k); + Double_t x = hgc_full[i]->GetXaxis()->GetBinLowEdge(k); + hgc_conv_mk2[i]->SetBinContent(k,y); + } + hgc_conv_mk2[i]->Scale(1.0/hgc_conv_mk2[i]->Integral(), "width"); + + //TCanvas *ADCspectra_mk2_i = new TCanvas(Form("ADCspectra_mk2_%d",i), Form("Scaled ADC pulseInt spectra mk2 for PMT%d",i+1)); + p1->SetParameter(0, 5.5); + p1->SetParameter(1, 0.25); + hgc_conv_mk2[i]->Fit("p1","RQN"); + gPad->Update(); + + hgc_conv_noback_mk2[i] = new TH1F(Form("hgc_conv_noback_mk2_%d", i+1), Form("Scaled ADC spectra background removed mk2 for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale_mk2,hgc_full[i]->GetXaxis()->GetXmax()/xscale_mk2); + for (Int_t l=0; l<nbins; l++) + { + Double_t y = p1->Eval(hgc_conv_mk2[i]->GetXaxis()->GetBinCenter(l)); + Double_t y2 = hgc_conv_mk2[i]->GetBinContent(l) - y; + hgc_conv_noback_mk2[i]->SetBinContent(l,y2); + } + + TCanvas *Final_Spectra_mk2_i = new TCanvas(Form("Final_Spectra_mk2_%d",i), Form("Scaled ADC pulseInt spectra Background Removed mk2 for PMT%d",i+1)); + Final_Spectra_mk2_i->Divide(2,1); + Final_Spectra_mk2_i->cd(1); + + f1->SetParameters(0.08, 1.0, 0.22, 0.029, 2, 0.5, 0.15, 3, 0.26); + f1->SetParLimits(1, 0.5, 1.5); + f1->SetParLimits(2, 0.0, 1.0); + f1->SetParLimits(3, 0.0, 1.0); + f1->SetParLimits(4, 1.5, 2.5); + f1->SetParLimits(5, 0.2, 0.6); + f1->SetParLimits(6, 0.0, 1.0); + f1->SetParLimits(7, 2.5, 3.5); + f1->SetParLimits(8, 0.2, 0.5); + + //f1->SetParameters(0.15, 1.02, 0.3, 0.07, 2.06, 0.4, 0.04, 3.2, 0.5); + hgc_conv_noback_mk2[i]->DrawCopy(); + hgc_conv_noback_mk2[i]->Fit("f1","RQsame"); + hgc_conv_noback_mk2[i]->GetXaxis()->SetRangeUser(0,5); + hgc_conv_noback_mk2[i]->GetYaxis()->SetRangeUser(0,0.2); + //f1->Draw("same"); + gPad->Update(); + + y_npe[0] = f1->GetParameter(1), y_npe[1] = f1->GetParameter(4), y_npe[2] = f1->GetParameter(7); + y_err[0] = f1->GetParError(1), y_err[1] = f1->GetParError(4), y_err[2] = f1->GetParError(7); + x_npe[0] = 1, x_npe[1] = 2, x_npe[2] = 3; + TGraphErrors *gr_npe_mk2 = new TGraphErrors(3, x_npe, y_npe, x_err, y_err); + Final_Spectra_mk2_i->cd(2); + l1->SetParameters(1.0, 0.0); + gr_npe_mk2->Fit("l1","RQ"); + gr_npe_mk2->Draw("A*"); + gPad->Update(); + calibration_mk2[i] = xscale_mk2; + } + cout << "Calibration constants are: " << endl; + for (Int_t i=0; i<4; i++) + { + cout << Form("PMT%d: ",i+1) << calibration[i] << " " << calibration_mk2[i] << endl; + } +} diff --git a/CALIBRATION/shms_hgcer_calib/scripts/calib_const.C~ b/CALIBRATION/shms_hgcer_calib/scripts/calib_const.C~ new file mode 100644 index 0000000000000000000000000000000000000000..d17dd54a6af14332abc35c2e0a40c3eba695adcd --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/calib_const.C~ @@ -0,0 +1,352 @@ +#include "Fit/Fitter.h" +#include "Fit/BinData.h" +#include "Fit/Chi2FCN.h" +#include "TH1.h" +#include "TList.h" +#include "TCanvas.h" +#include "TStyle.h" +#include "TFile.h" + +Double_t poisson(Double_t *x, Double_t *par) +{ + Double_t result1 = (par[1]*pow(par[0],x[0])*exp(-par[0]))/(ROOT::Math::tgamma(x[0]+1)); + return result1; +} + +Double_t gauss(Double_t *x, Double_t *par) +{ + Double_t result1 = par[0]*exp((-0.5)*(pow((x[0] - par[1]),2)/pow((par[2]),2))); + Double_t result2 = par[3]*exp((-0.5)*(pow((x[0] - par[4]),2)/pow((par[5]),2))); + Double_t result3 = par[6]*exp((-0.5)*(pow((x[0] - par[7]),2)/pow((par[8]),2))); + Double_t result4 = par[9]*exp((-0.5)*(pow((x[0] - par[10]),2)/pow((par[11]),2))); + Double_t result5 = par[12]*exp((-0.5)*(pow((x[0] - par[13]),2)/pow((par[14]),2))); + return result1 + result2 + result3 + result4 + result5; +} + +Double_t linear(Double_t *x, Double_t *par) +{ + Double_t result1 = par[0]*x[0] + par[1]; + return result1; +} + +void calib_const(Int_t RunNumber=0) +{ + if (RunNumber == 0) + { + cout << "Enter a Run Number (-1 to exit): "; + cin >> RunNumber; + if (RunNumber <= 0) return; + else TFile *F = new TFile(Form("../root_files/shms_calibration_%d.root", RunNumber)); + } + else TFile *F = new TFile(Form("root_files/shms_calibration_%d.root", RunNumber)); + + int num_pars = 6; + int fit_max = 10000; + int fit_min = -1000; + + TH1F *hgc_e[4][4]; + TH1F *hgc_pi[4][4]; + TH1F *hgc_full[4]; + TH1F *hgc_conv[4]; + TH1F *hgc_background[4]; + TH1F *hgc_conv_noback[4]; + TH1F *hgc_conv_mk2[4]; + TH1F *hgc_conv_noback_mk2[4]; + + for (Int_t i=0; i<4; i++) + { + for (Int_t j=0; j<4; j++) + { + hgc_e[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_e%d", i+1, j+1)); + hgc_e[i][j]->Rebin(10); + hgc_pi[i][j] = (TH1F*)F->Get(Form("phgc_quad%d_pulseInt_pi%d", i+1, j+1)); + hgc_pi[i][j]->Rebin(10); + } + hgc_full[i] = (TH1F*)F->Get(Form("phgc_adcPulseInt%d", i+1)); + hgc_full[i]->Rebin(10); + } + TF1 *l1 = new TF1("l1",linear,0,4,2); + l1->SetParNames("Slope", "Intercept"); + + TF1 *p1 = new TF1("p1",poisson,4,20,2); + p1->SetParNames("Amplitude", "Mean"); + + TF1 *f1 = new TF1("f1",gauss,0.5,3.5,9); + f1->SetParNames("Amplitude 1"," Mean 1","Std. Dev. 1","Amplitude 2","Mean 2","Std. Dev. 2","Amplitude 3","Mean 3","Std. Dev. 3"); + + TF1 *Gauss3 = new TF1("Gauss3",gauss,fit_min,fit_max,9); + Gauss3->SetParNames("Ped Amp","Ped Mean","Ped Std. Dev.","Amplitude 1","Mean 1","Std. Dev. 1","Amplitude 2","Mean 2","Std. Dev. 2"); + + TF1 *Gauss2 = new TF1("Gauss2",gauss,fit_min,fit_max,6); + Gauss2->SetParNames("Ped Amp","Ped Mean","Ped Std. Dev.","Amplitude 1","Mean 1","Std. Dev. 1"); + + TF1 *Gauss1 = new TF1("Gauss1",gauss,fit_min,fit_max,3); + Gauss1->SetParNames("Amplitude","Mean","Std. Dev."); + + Double_t mean_1[6]; + Double_t mean_2[3]; + Double_t x_npe[3], y_npe[3], x_err[3], y_err[3]; + Double_t calibration[4], calibration_mk2[4]; + + TSpectrum *s = new TSpectrum(2); + + gStyle->SetOptFit(111); + + + //Main loop for calibration + for (Int_t i=0; i<4; i++) + { + //Examining the single photoelectron (SPE) peak + for (Int_t n=0; n<3; n++) + { + mean_1[n] = 0; + mean_2[n] = 0; + x_npe[n] = 0, y_npe[n] = 0, x_err[n] = 0, y_err[n] = 0; + } + + TCanvas *cuts_i = new TCanvas(Form("cuts_%d",i), Form("First Photoelectron peaks for e & pions PMT%d",i+1)); + cuts_i->Divide(2,3); + Int_t k = 1; + for (Int_t j=0; j<4; j++) + { + if (j == i) continue; + cuts_i->cd(k); + cuts_i->cd(k)->SetLogy(); + + //Peak Finder for parameter guesses + s->Search(hgc_e[j][i], 2.5, "nobackground", 0.001); + TList *functions = hgc_e[j][i]->GetListOfFunctions(); + TPolyMarker *pm = (TPolyMarker*)functions->FindObject("TPolyMarker"); + Double_t *xpeaks = pm->GetX(); + + //Fit the Pedistal + /* + Gauss1->SetParameters(1000., xpeaks[0], 100.); + Gauss1->SetParLimits(0, 0., 1000000.); + Gauss1->SetParLimits(1, xpeaks[0]-30., xpeaks[0]+30.); + Gauss1->SetParLimits(2, 1., 200.); + hgc_e[j][i]->Fit("Gauss1","RQNsame"); + */ + //Fit the first SPE for electrons + /* + Gauss2->SetParameters(Gauss1->GetParameter(0), xpeaks[0], Gauss1->GetParameter(2), Gauss1->GetParameter(0)*0.1, xpeaks[1], Gauss1->GetParameter(2)); + Gauss2->SetParLimits(0, Gauss1->GetParameter(0)-100, Gauss1->GetParameter(0)+100); + Gauss2->SetParLimits(1, xpeaks[0]-30, xpeaks[0]+30); + Gauss2->SetParLimits(2, Gauss1->GetParameter(2)-10, Gauss1->GetParameter(2)+10); + Gauss2->SetParLimits(3, 0., Gauss1->GetParameter(0)+1); + Gauss2->SetParLimits(4, xpeaks[1]-10, xpeaks[1]+10); + Gauss2->SetParLimits(5, Gauss1->GetParameter(2), Gauss1->GetParameter(2)+200); + */ + Gauss1->SetRange(xpeaks[1]-100, xpeaks[1]+100); + Gauss1->SetParameter(1, xpeaks[1]); + Gauss1->SetParameter(2, 200.); + Gauss1->SetParLimits(0, 0., 2000.); + Gauss1->SetParLimits(1, xpeaks[1]-200, xpeaks[1]+200); + Gauss1->SetParLimits(2, 10., 500.); + hgc_e[j][i]->Fit("Gauss1","RQN"); + Gauss1->SetParLimits(1, Gauss1->GetParameter(1)-50, Gauss1->GetParameter(1)+50); + Gauss1->SetRange(Gauss1->GetParameter(1)-1.5*Gauss1->GetParameter(2), Gauss1->GetParameter(1)+1.5*Gauss1->GetParameter(2)); + //Gauss1->SetRange(Gauss1->GetParameter(1)-1.0*Gauss1->GetParameter(2), Gauss1->GetParameter(1)+1.0*Gauss1->GetParameter(2)); + hgc_e[j][i]->Fit("Gauss1","RQ"); + if (xpeaks[1] != 0.0 && hgc_e[j][i]->GetBinContent(hgc_e[j][i]->GetXaxis()->FindBin(xpeaks[1])) > 90) mean_1[(k/2)] = Gauss1->GetParameter(1); + if (xpeaks[1] != 0.0 && hgc_e[j][i]->GetBinContent(hgc_e[j][i]->GetXaxis()->FindBin(xpeaks[1])) > 15) mean_2[(k/2)] = Gauss1->GetParameter(1); + gPad->Update(); + + //Repeat for pions + cuts_i->cd(k+1); + cuts_i->cd(k+1)->SetLogy(); + + //Peak finder for parameter guess + s->Search(hgc_pi[j][i], 2.5, "nobackground", 0.001); + TList *functions = hgc_pi[j][i]->GetListOfFunctions(); + TPolyMarker *pm = (TPolyMarker*)functions->FindObject("TPolyMarker"); + Double_t *xpeaks = pm->GetX(); + + //Fit the Pedistal + /* + Gauss1->SetParameters(1000., 0., 100.); + Gauss1->SetParLimits(0, 0., 1000000.); + Gauss1->SetParLimits(1, -10., 100.); + Gauss1->SetParLimits(2, 1., 200.); + hgc_pi[j][i]->Fit("Gauss1","RQNsame"); + */ + + //Fit the first SPE for pions + /* + Gauss2->SetParameters(Gauss1->GetParameter(0), Gauss1->GetParameter(1), Gauss1->GetParameter(2), Gauss1->GetParameter(0)*0.1, Gauss1->GetParameter(1)+100, Gauss1->GetParameter(2)); + Gauss2->SetParLimits(0, Gauss1->GetParameter(0)-100, Gauss1->GetParameter(0)+100); + Gauss2->SetParLimits(1, Gauss1->GetParameter(1)-10, Gauss1->GetParameter(1)+10); + Gauss2->SetParLimits(2, Gauss1->GetParameter(2)-10, Gauss1->GetParameter(2)+10); + Gauss2->SetParLimits(3, 0., Gauss1->GetParameter(0)+1); + Gauss2->SetParLimits(4, Gauss1->GetParameter(1)+100, Gauss1->GetParameter(1)+600); + Gauss2->SetParLimits(5, Gauss1->GetParameter(2), Gauss1->GetParameter(2)+200); + hgc_pi[j][i]->Fit("Gauss2","RQsame"); + */ + Gauss1->SetRange(xpeaks[1]-100, xpeaks[1]+100); + Gauss1->SetParameter(1, xpeaks[1]); + Gauss1->SetParameter(2, 200.); + Gauss1->SetParLimits(0, 0., 2000.); + Gauss1->SetParLimits(1, xpeaks[1]-50, xpeaks[1]+50); + Gauss1->SetParLimits(2, 10., 500.); + hgc_pi[j][i]->Fit("Gauss1","RQ"); + if (xpeaks[1] != 0.0 && hgc_pi[j][i]->GetBinContent(hgc_pi[j][i]->GetXaxis()->FindBin(xpeaks[1])) > 100) mean_1[(k/2)] = Gauss1->GetParameter(1); + gPad->Update(); + + k += 2; + } + + //Scale full ADC spectra according to SPE + Int_t nbins; + nbins = hgc_full[i]->GetXaxis()->GetNbins(); + Double_t m = 0.0; + Double_t xscale = 0.0; + for (Int_t n = 0; n < 6; n++) + { + if (mean_1[n] == 0.0) continue; + //cout << mean_1[n] << endl; + xscale += mean_1[n]; + m += 1.0; + } + //cout << m << endl; + if (m == 0.0) + { /* + for (Int_t n = 0; n < 3; n++) + { + cout << mean_2[n] << endl; + if (mean_2[n] == 0.0) continue; + xscale += mean_2[n]; + m += 1.0; + } + xscale = xscale/m;//*/ + ///* + TCanvas *low_stats_i = new TCanvas(Form("low_stats_%d",i),Form("Low stats analysis for PMT%d",i+1)); + s->Search(hgc_full[i], 2.0, "nobackground", 0.001); + TList *functions = hgc_full[i]->GetListOfFunctions(); + TPolyMarker *pm = (TPolyMarker*)functions->FindObject("TPolyMarker"); + Double_t *xpeaks = pm->GetX(); + Gauss1->SetRange(xpeaks[1]-100, xpeaks[1]+100); + Gauss1->SetParameter(1, xpeaks[1]); + Gauss1->SetParameter(2, 200.); + Gauss1->SetParLimits(0, 0., 2000.); + Gauss1->SetParLimits(1, xpeaks[1]-50, xpeaks[1]+50); + Gauss1->SetParLimits(2, 10., 500.); + hgc_full[i]->Fit("Gauss1","RQ"); + xscale = Gauss1->GetParameter(1);//*/ + } + else xscale = xscale/m; + //cout << xscale << endl; + hgc_conv[i] = new TH1F(Form("hgc_conv_%d", i+1), Form("Scaled ADC spectra for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale,hgc_full[i]->GetXaxis()->GetXmax()/xscale); + for (Int_t k=0; k<nbins; k++) + { + Double_t y = hgc_full[i]->GetBinContent(k); + Double_t x = hgc_full[i]->GetXaxis()->GetBinLowEdge(k); + hgc_conv[i]->SetBinContent(k,y); + } + //And normalize the heights + hgc_conv[i]->Scale(1.0/hgc_conv[i]->Integral(), "width"); + + //TCanvas *ADCspectra_i = new TCanvas(Form("ADCspectra_%d",i), Form("Scaled ADC pulseInt spectra for PMT%d",i+1)); + p1->SetParameter(0, 5.5); + p1->SetParameter(1, 0.25); + hgc_conv[i]->Fit("p1","RQN"); + gPad->Update(); + + hgc_background[i] = new TH1F(Form("hgc_background_%d", i+1), Form("Scaled ADC spectra background for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale,hgc_full[i]->GetXaxis()->GetXmax()/xscale); + hgc_conv_noback[i] = new TH1F(Form("hgc_conv_noback_%d", i+1), Form("Scaled ADC spectra background removed for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale,hgc_full[i]->GetXaxis()->GetXmax()/xscale); + for (Int_t l=0; l<nbins; l++) + { + Double_t y = p1->Eval(hgc_conv[i]->GetXaxis()->GetBinCenter(l)); + Double_t y2 = hgc_conv[i]->GetBinContent(l) - y; + hgc_background[i]->SetBinContent(l,y); + hgc_conv_noback[i]->SetBinContent(l,y2); + } + TCanvas *Final_Spectra_i = new TCanvas(Form("Final_Spectra_%d",i), Form("Scaled ADC pulseInt spectra Background Removed for PMT%d",i+1)); + Final_Spectra_i->Divide(2,1); + Final_Spectra_i->cd(1); + f1->SetParameters(0.08, 1.0, 0.22, 0.029, 2, 0.5, 0.15, 3, 0.26); + f1->SetParLimits(1, 0.5, 1.5); + f1->SetParLimits(2, 0.0, 1.0); + f1->SetParLimits(3, 0.0, 1.0); + f1->SetParLimits(4, 1.5, 2.5); + f1->SetParLimits(5, 0.2, 0.6); + f1->SetParLimits(6, 0.0, 1.0); + f1->SetParLimits(7, 2.5, 3.5); + f1->SetParLimits(8, 0.2, 0.5); + hgc_conv_noback[i]->Fit("f1","RQ"); + hgc_conv_noback[i]->GetXaxis()->SetRangeUser(0,5); + gPad->Update(); + + y_npe[0] = f1->GetParameter(1), y_npe[1] = f1->GetParameter(4), y_npe[2] = f1->GetParameter(7); + y_err[0] = f1->GetParError(1), y_err[1] = f1->GetParError(4), y_err[2] = f1->GetParError(7); + x_npe[0] = 1, x_npe[1] = 2, x_npe[2] = 3; + gr_npe = new TGraphErrors(3, x_npe, y_npe, x_err, y_err); + //TCanvas *Linear_i = new TCanvas(Form("Linear_%d",i), Form("Verification of Linear Relationship for PMT%d",i+1)); + Final_Spectra_i->cd(2); + l1->SetParameters(1.0, 0.0); + gr_npe->Fit("l1","RQ"); + gr_npe->Draw("A*"); + gPad->Update(); + calibration[i] = xscale; + + Double_t xscale_mk2 = xscale * l1->GetParameter(0); + hgc_conv_mk2[i] = new TH1F(Form("hgc_conv_mk2_%d", i+1), Form("Scaled ADC spectra mk2 for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale_mk2,hgc_full[i]->GetXaxis()->GetXmax()/xscale_mk2); + for (Int_t k=0; k<nbins; k++) + { + Double_t y = hgc_full[i]->GetBinContent(k); + Double_t x = hgc_full[i]->GetXaxis()->GetBinLowEdge(k); + hgc_conv_mk2[i]->SetBinContent(k,y); + } + hgc_conv_mk2[i]->Scale(1.0/hgc_conv_mk2[i]->Integral(), "width"); + + //TCanvas *ADCspectra_mk2_i = new TCanvas(Form("ADCspectra_mk2_%d",i), Form("Scaled ADC pulseInt spectra mk2 for PMT%d",i+1)); + p1->SetParameter(0, 5.5); + p1->SetParameter(1, 0.25); + hgc_conv_mk2[i]->Fit("p1","RQN"); + gPad->Update(); + + hgc_conv_noback_mk2[i] = new TH1F(Form("hgc_conv_noback_mk2_%d", i+1), Form("Scaled ADC spectra background removed mk2 for PMT%d",i+1), nbins, hgc_full[i]->GetXaxis()->GetXmin()/xscale_mk2,hgc_full[i]->GetXaxis()->GetXmax()/xscale_mk2); + for (Int_t l=0; l<nbins; l++) + { + Double_t y = p1->Eval(hgc_conv_mk2[i]->GetXaxis()->GetBinCenter(l)); + Double_t y2 = hgc_conv_mk2[i]->GetBinContent(l) - y; + hgc_conv_noback_mk2[i]->SetBinContent(l,y2); + } + + TCanvas *Final_Spectra_mk2_i = new TCanvas(Form("Final_Spectra_mk2_%d",i), Form("Scaled ADC pulseInt spectra Background Removed mk2 for PMT%d",i+1)); + Final_Spectra_mk2_i->Divide(2,1); + Final_Spectra_mk2_i->cd(1); + + f1->SetParameters(0.08, 1.0, 0.22, 0.029, 2, 0.5, 0.15, 3, 0.26); + f1->SetParLimits(1, 0.5, 1.5); + f1->SetParLimits(2, 0.0, 1.0); + f1->SetParLimits(3, 0.0, 1.0); + f1->SetParLimits(4, 1.5, 2.5); + f1->SetParLimits(5, 0.2, 0.6); + f1->SetParLimits(6, 0.0, 1.0); + f1->SetParLimits(7, 2.5, 3.5); + f1->SetParLimits(8, 0.2, 0.5); + + //f1->SetParameters(0.15, 1.02, 0.3, 0.07, 2.06, 0.4, 0.04, 3.2, 0.5); + hgc_conv_noback_mk2[i]->DrawCopy(); + hgc_conv_noback_mk2[i]->Fit("f1","RQsame"); + hgc_conv_noback_mk2[i]->GetXaxis()->SetRangeUser(0,5); + //f1->Draw("same"); + gPad->Update(); + + y_npe[0] = f1->GetParameter(1), y_npe[1] = f1->GetParameter(4), y_npe[2] = f1->GetParameter(7); + y_err[0] = f1->GetParError(1), y_err[1] = f1->GetParError(4), y_err[2] = f1->GetParError(7); + x_npe[0] = 1, x_npe[1] = 2, x_npe[2] = 3; + gr_npe_mk2 = new TGraphErrors(3, x_npe, y_npe, x_err, y_err); + Final_Spectra_mk2_i->cd(2); + l1->SetParameters(1.0, 0.0); + gr_npe_mk2->Fit("l1","RQ"); + gr_npe_mk2->Draw("A*"); + gPad->Update(); + calibration_mk2[i] = xscale_mk2; + } + cout << "Calibration constants are: " << endl; + for (Int_t i=0; i<4; i++) + { + cout << Form("PMT%d: ",i+1) << calibration[i] << " " << calibration_mk2[i] << endl; + } +} diff --git a/CALIBRATION/shms_hgcer_calib/scripts/gain_calculation.C b/CALIBRATION/shms_hgcer_calib/scripts/gain_calculation.C new file mode 100644 index 0000000000000000000000000000000000000000..873930c3ff4464308ff70f2fe77effde1fbdf29a --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/gain_calculation.C @@ -0,0 +1,131 @@ +#include <sstream> +#include <TGraphErrors.h> + +Double_t exponential(Double_t *x, Double_t *par) +{ + Double_t result = par[0]*pow(x[0],par[1]); + return result; +} + +void gain_calculation() +{ + struct input_t + { + Int_t voltage; + Int_t index; + float constant; + }; + + input_t input; + + string datafile; + datafile = "Constants.dat"; + + FILE *fp = fopen(datafile.c_str(),"r"); + Double_t const_err = 5; + //Double_t pC = 0.006; + Double_t pC = 0.01953125; + + char line[50]; + TGraphErrors *gr_1 = new TGraphErrors(); + TGraphErrors *gr_2 = new TGraphErrors(); + TGraphErrors *gr_3 = new TGraphErrors(); + TGraphErrors *gr_4 = new TGraphErrors(); + + while (fgets(&line[0],50,fp)) + { + if (line[0] == '#') continue; + else + { + sscanf(&line[0],"%i%i%f",&input.voltage,&input.index,&input.constant); + if (input.index == 1) + { + gr_1->SetPoint(gr_1->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_1->SetPointError(gr_1->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + if (input.index == 2) + { + gr_2->SetPoint(gr_2->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_2->SetPointError(gr_2->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + if (input.index == 3) + { + gr_3->SetPoint(gr_3->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_3->SetPointError(gr_3->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + if (input.index == 4) + { + gr_4->SetPoint(gr_4->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_4->SetPointError(gr_4->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + } + } + fclose(fp); + + TF1 *e1 = new TF1("e1",exponential,2000,2400,2); + e1->SetParNames("Coefficient","Exponent"); + e1->SetParameters(1*pow(10,-28), 10.5); + TF1 *e2 = new TF1("e2",exponential,2000,2400,2); + e2->SetParNames("Coefficient","Exponent"); + e2->SetParameters(1*pow(10,-28), 10.5); + TF1 *e3 = new TF1("e3",exponential,2000,2400,2); + e3->SetParNames("Coefficient","Exponent"); + e3->SetParameters(1*pow(10,-28), 10.5); + TF1 *e4 = new TF1("e4",exponential,2000,2400,2); + e4->SetParNames("Coefficient","Exponent"); + e4->SetParameters(1*pow(10,-28), 10.5); + + TCanvas *c0 = new TCanvas("c0","Gain vs. Voltage"); + gr_1->SetName("gr_1"); + gr_1->SetMarkerColor(kMagenta); + gr_1->SetMarkerStyle(22); + gr_1->SetMarkerSize(1); + e1->SetLineColor(kMagenta); + gr_1->Fit("e1","RMEQ"); + //gr_1->Draw("AP"); + gr_2->SetName("gr_2"); + gr_2->SetMarkerColor(kBlue); + gr_2->SetMarkerStyle(22); + gr_2->SetMarkerSize(1); + e2->SetLineColor(kBlue); + gr_2->Fit("e2","RMEQ"); + //gr_2->Draw("APsame"); + gr_3->SetName("gr_3"); + gr_3->SetMarkerColor(kCyan); + gr_3->SetMarkerStyle(22); + gr_3->SetMarkerSize(1); + e3->SetLineColor(kCyan); + gr_3->Fit("e3","RMEQ"); + //gr_3->Draw("APsame"); + gr_4->SetName("gr_4"); + gr_4->SetMarkerColor(kGreen); + gr_4->SetMarkerStyle(22); + gr_4->SetMarkerSize(1); + e4->SetLineColor(kGreen); + gr_4->Fit("e4","RMEQ"); + //gr_4->Draw("same"); + TMultiGraph *mg = new TMultiGraph(); + mg->SetTitle("Voltage vs Gain for HGC PMTs"); + mg->Add(gr_1); + mg->Add(gr_2); + mg->Add(gr_3); + mg->Add(gr_4); + mg->Draw("AP"); + mg->GetXaxis()->SetTitle("Voltage"); + mg->GetYaxis()->SetTitle("Gain"); + auto legend = new TLegend(0.6,0.7,0.8,0.9); + legend->AddEntry("gr_1","PMT 1","ep"); + legend->AddEntry("gr_2","PMT 2","ep"); + legend->AddEntry("gr_3","PMT 3","ep"); + legend->AddEntry("gr_4","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + + cout << "Calibration values are: (Constant & Exponent)" << endl; + cout << "PMT1: " << e1->GetParameter(0) << " " << e1->GetParameter(1) << " +/- " << e1->GetParError(1) << endl; + cout << "PMT2: " << e2->GetParameter(0) << " " << e2->GetParameter(1) << " +/- " << e2->GetParError(1) << endl; + cout << "PMT3: " << e3->GetParameter(0) << " " << e3->GetParameter(1) << " +/- " << e3->GetParError(1) <<endl; + cout << "PMT4: " << e4->GetParameter(0) << " " << e4->GetParameter(1) << " +/- " << e4->GetParError(1) <<endl; + + +} diff --git a/CALIBRATION/shms_hgcer_calib/scripts/gain_calculation.C~ b/CALIBRATION/shms_hgcer_calib/scripts/gain_calculation.C~ new file mode 100644 index 0000000000000000000000000000000000000000..014302a3113a6aee9a73d2e86dcecd675dbecd7e --- /dev/null +++ b/CALIBRATION/shms_hgcer_calib/scripts/gain_calculation.C~ @@ -0,0 +1,131 @@ +#include <sstream> +#include <TGraphErrors.h> + +Double_t exponential(Double_t *x, Double_t *par) +{ + Double_t result = par[0]*pow(x[0],par[1]); + return result; +} + +void gain_calculation() +{ + struct input_t + { + Int_t voltage; + Int_t index; + float constant; + }; + + input_t input; + + string datafile; + datafile = "/home/rambrose/hallc_replay/CALIBRATION/shms_hgcer_calib/Final Scripts/Constants.dat"; + + FILE *fp = fopen(datafile.c_str(),"r"); + Double_t const_err = 5; + //Double_t pC = 0.006; + Double_t pC = 0.01953125; + + char line[50]; + TGraphErrors *gr_1 = new TGraphErrors(); + TGraphErrors *gr_2 = new TGraphErrors(); + TGraphErrors *gr_3 = new TGraphErrors(); + TGraphErrors *gr_4 = new TGraphErrors(); + + while (fgets(&line[0],50,fp)) + { + if (line[0] == '#') continue; + else + { + sscanf(&line[0],"%i%i%f",&input.voltage,&input.index,&input.constant); + if (input.index == 1) + { + gr_1->SetPoint(gr_1->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_1->SetPointError(gr_1->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + if (input.index == 2) + { + gr_2->SetPoint(gr_2->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_2->SetPointError(gr_2->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + if (input.index == 3) + { + gr_3->SetPoint(gr_3->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_3->SetPointError(gr_3->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + if (input.index == 4) + { + gr_4->SetPoint(gr_4->GetN(),input.voltage,(input.constant * pC)/(0.0000001602)); + gr_4->SetPointError(gr_4->GetN()-1,0,(const_err * pC)/(0.0000001602)); + } + } + } + fclose(fp); + + TF1 *e1 = new TF1("e1",exponential,2000,2400,2); + e1->SetParNames("Coefficient","Exponent"); + e1->SetParameters(1*pow(10,-28), 10.5); + TF1 *e2 = new TF1("e2",exponential,2000,2400,2); + e2->SetParNames("Coefficient","Exponent"); + e2->SetParameters(1*pow(10,-28), 10.5); + TF1 *e3 = new TF1("e3",exponential,2000,2400,2); + e3->SetParNames("Coefficient","Exponent"); + e3->SetParameters(1*pow(10,-28), 10.5); + TF1 *e4 = new TF1("e4",exponential,2000,2400,2); + e4->SetParNames("Coefficient","Exponent"); + e4->SetParameters(1*pow(10,-28), 10.5); + + TCanvas *c0 = new TCanvas("c0","Gain vs. Voltage"); + gr_1->SetName("gr_1"); + gr_1->SetMarkerColor(kMagenta); + gr_1->SetMarkerStyle(22); + gr_1->SetMarkerSize(1); + e1->SetLineColor(kMagenta); + gr_1->Fit("e1","RMEQ"); + //gr_1->Draw("AP"); + gr_2->SetName("gr_2"); + gr_2->SetMarkerColor(kBlue); + gr_2->SetMarkerStyle(22); + gr_2->SetMarkerSize(1); + e2->SetLineColor(kBlue); + gr_2->Fit("e2","RMEQ"); + //gr_2->Draw("APsame"); + gr_3->SetName("gr_3"); + gr_3->SetMarkerColor(kCyan); + gr_3->SetMarkerStyle(22); + gr_3->SetMarkerSize(1); + e3->SetLineColor(kCyan); + gr_3->Fit("e3","RMEQ"); + //gr_3->Draw("APsame"); + gr_4->SetName("gr_4"); + gr_4->SetMarkerColor(kGreen); + gr_4->SetMarkerStyle(22); + gr_4->SetMarkerSize(1); + e4->SetLineColor(kGreen); + gr_4->Fit("e4","RMEQ"); + //gr_4->Draw("same"); + TMultiGraph *mg = new TMultiGraph(); + mg->SetTitle("Voltage vs Gain for HGC PMTs"); + mg->Add(gr_1); + mg->Add(gr_2); + mg->Add(gr_3); + mg->Add(gr_4); + mg->Draw("AP"); + mg->GetXaxis()->SetTitle("Voltage"); + mg->GetYaxis()->SetTitle("Gain"); + auto legend = new TLegend(0.6,0.7,0.8,0.9); + legend->AddEntry("gr_1","PMT 1","ep"); + legend->AddEntry("gr_2","PMT 2","ep"); + legend->AddEntry("gr_3","PMT 3","ep"); + legend->AddEntry("gr_4","PMT 4","ep"); + legend->Draw(); + gPad->Modified(); + + cout << "Calibration values are: (Constant & Exponent)" << endl; + cout << "PMT1: " << e1->GetParameter(0) << " " << e1->GetParameter(1) << " +/- " << e1->GetParError(1) << endl; + cout << "PMT2: " << e2->GetParameter(0) << " " << e2->GetParameter(1) << " +/- " << e2->GetParError(1) << endl; + cout << "PMT3: " << e3->GetParameter(0) << " " << e3->GetParameter(1) << " +/- " << e3->GetParError(1) <<endl; + cout << "PMT4: " << e4->GetParameter(0) << " " << e4->GetParameter(1) << " +/- " << e4->GetParError(1) <<endl; + + +} diff --git a/PARAM/SHMS/HGCER/phgcer.param b/PARAM/SHMS/HGCER/phgcer.param index c7dd2fda080c8139f838ad7428168160651795dd..0682861639767864af4a635f1511ae0a21ca74f0 100644 --- a/PARAM/SHMS/HGCER/phgcer.param +++ b/PARAM/SHMS/HGCER/phgcer.param @@ -2,7 +2,19 @@ phgcer_tot_pmts = 4 ; Garth H. gain calibration from run 486, March 9 2017 -phgcer_adc_to_npe = 1/436., 1/393., 1/364., 1/372. +; phgcer_adc_to_npe = 1/436., 1/393., 1/364., 1/372. + +; Garth H. gain calibration from run 488, June 20 2017 +phgcer_adc_to_npe = 1/546., 1/430., 1/376., 1/477. + +; Garth H. gain calibration from run 487, June 20 2017 +; phgcer_adc_to_npe = 1/551., 1/426., 1/376., 1/488. + +; Garth H. gain calibration from run 486, June 20 2017 +; phgcer_adc_to_npe = 1/556., 1/436., 1/383., 1/496. + +; Garth H. gain calibration from run 484, June 20 2017 +; phgcer_adc_to_npe = 1/454., 1/477., 1/409., 1/547. ; Track matching reduced chi2 cut values phgcer_red_chi2_min = 0.0 diff --git a/SCRIPTS/SHMS/replay_shms.C b/SCRIPTS/SHMS/replay_shms.C index 1be01de60b45bca86dcfe9e5cc8682a342b06e07..092e4adb51d33acc885a51fcce77b44d0b364859 100644 --- a/SCRIPTS/SHMS/replay_shms.C +++ b/SCRIPTS/SHMS/replay_shms.C @@ -16,8 +16,8 @@ void replay_shms(Int_t RunNumber=0, Int_t MaxEvent=0) { } // Create file name patterns. - const char* RunFileNamePattern = "raw/shms_all_%05d.dat"; - const char* ROOTFileNamePattern = "ROOTfiles/shms_replay_%d_%d.root"; + const char* RunFileNamePattern = "../nobackup/spring17/shms_all_%05d.dat"; + const char* ROOTFileNamePattern = "ROOTfiles/shms_replay_%d_%d_old.root"; // Add variables to global list. gHcParms->Define("gen_run_number", "Run Number", RunNumber); gHcParms->AddString("g_ctp_database_filename", "DBASE/standard.database");