Page MenuHomeHEPForge

No OneTemporary

diff --git a/README b/README
index 39871f5..8f88fe5 100644
--- a/README
+++ b/README
@@ -1,34 +1,33 @@
-Author: Callum Wilkinson,
+Author Luke Pickering,
+ Patrick Stowell,
+ Callum Wilkinson,
Clarence Wret,
- Patrick Stowell
Package Manager: (p.stowell@sheffield.ac.uk)
-externalDataFitter Package v1r1
+NuFix Package v1r0
README
-21/04/2016
+20/07/2016
--- Compilation
The following instructions should be used to build the fitter after checking out from scratch.
-1. Copy example_env.sh to extfitter_env.sh "$ cp ./make/example_env.sh ./extfitter_env.sh"
-2. Copy example_config.sh to extfitter_config.sh "$ cp ./make/example_config.sh ./extfitter_config.sh"
-3. Edit extfitter_config.sh to enable/disable the required custom build flags.
-4. Edit "extfitter_env.sh" to include all dependencies that are required by the build options.
- Leaving any dependencies as blank variables if they are not needed.
-5. Run configure script "$ source ./extfitter_config.sh"
-6. If configure is successful and has the correct compile flags, run make
- "$ make clean && make all"
-
-Notes:
- - "./setup.sh and ./extfitter_env.sh" are both used by some parrrallel processing functions inside FitBase and FCN modules so it is advised not to rename these.
- - In theory if one only cares about a single generator, filling out just those dependencies and flags is all that is required.
+1. Make sure environmental variables required for the generators you wish to build against are set.
+2. In the top nufix directory make a new build directory: "$mkdir build && cd build"
+3. Run CMAKE with compiler flags for which generators are required
+ "$ cmake -DUSE_NuWro=1 -DUSE_NEUT=1 -DUSE_GENIE=0 ../"
+4. Build the fitter
+ "$ make -j"
+5. Build documentation
+ "$ make docs"
+6. Install to build location
+ "$ make install"
--- Adding Classes
The fitter is designed to be easily extended by adding new measurement classes whilst keeping the input convertors and tuning functionality the same.
The Devel module folder is setup with some examples of how to add new classes into the framework. Feel free to email me if there are difficulties adding new measurements.
--- Running Fits
Whilst running fits is relatively quick and simple, there are now a large range of possible options. Doxygen Documentation is being added to the $EXT_FIT/doc/html folder.
Refer thre for guidance on how to properly formulate a card file.
\ No newline at end of file
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_joint_covar.txt b/data/MINERvA/CCQE/20deg_Q2QE_joint_covar.txt
new file mode 100755
index 0000000..eda9d26
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_joint_covar.txt
@@ -0,0 +1,16 @@
+1.000 0.886 0.913 0.903 0.842 0.723 0.396 0.309 0.435 0.434 0.447 0.441 0.415 0.313 0.181 0.117
+0.886 1.000 0.916 0.907 0.836 0.699 0.378 0.291 0.430 0.436 0.447 0.447 0.409 0.290 0.143 0.077
+0.913 0.916 1.000 0.943 0.887 0.743 0.382 0.335 0.427 0.432 0.455 0.449 0.418 0.295 0.149 0.083
+0.903 0.907 0.943 1.000 0.940 0.838 0.450 0.427 0.397 0.413 0.432 0.440 0.442 0.371 0.219 0.169
+0.842 0.836 0.887 0.940 1.000 0.912 0.536 0.564 0.350 0.368 0.398 0.403 0.450 0.421 0.310 0.275
+0.723 0.699 0.743 0.838 0.912 1.000 0.643 0.640 0.249 0.273 0.299 0.321 0.422 0.523 0.442 0.441
+0.396 0.378 0.382 0.450 0.536 0.643 1.000 0.659 0.084 0.097 0.103 0.117 0.211 0.333 0.303 0.320
+0.309 0.291 0.335 0.427 0.564 0.640 0.659 1.000 0.020 0.026 0.036 0.048 0.127 0.246 0.174 0.215
+0.435 0.430 0.427 0.397 0.350 0.249 0.084 0.020 1.000 0.877 0.886 0.873 0.812 0.656 0.369 0.288
+0.434 0.436 0.432 0.413 0.368 0.273 0.097 0.026 0.877 1.000 0.911 0.918 0.868 0.700 0.412 0.313
+0.447 0.447 0.455 0.432 0.398 0.299 0.103 0.036 0.886 0.911 1.000 0.948 0.910 0.721 0.413 0.314
+0.441 0.447 0.449 0.440 0.403 0.321 0.117 0.048 0.873 0.918 0.948 1.000 0.938 0.769 0.441 0.339
+0.415 0.409 0.418 0.442 0.450 0.422 0.211 0.127 0.812 0.868 0.910 0.938 1.000 0.875 0.597 0.503
+0.313 0.290 0.295 0.371 0.421 0.523 0.333 0.246 0.656 0.700 0.721 0.769 0.875 1.000 0.753 0.718
+0.181 0.143 0.149 0.219 0.310 0.442 0.303 0.174 0.369 0.412 0.413 0.441 0.597 0.753 1.000 0.894
+0.117 0.077 0.083 0.169 0.275 0.441 0.320 0.215 0.288 0.313 0.314 0.339 0.503 0.718 0.894 1.000
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_joint_covar_SHAPE-extracted.txt b/data/MINERvA/CCQE/20deg_Q2QE_joint_covar_SHAPE-extracted.txt
new file mode 100755
index 0000000..7859827
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_joint_covar_SHAPE-extracted.txt
@@ -0,0 +1,16 @@
+ 1.0000 0.7902 0.8343 0.8069 0.6633 0.3856 0.1102 0.0490 -0.1135 -0.1723 -0.1924 -0.2609 -0.5332 -0.7578 -0.5159 -0.5108
+ 0.7902 1.0000 0.8441 0.8226 0.6617 0.3491 0.0915 0.0300 -0.1015 -0.1423 -0.1633 -0.2144 -0.5047 -0.7732 -0.5584 -0.5549
+ 0.8343 0.8441 1.0000 0.8856 0.7544 0.4157 0.0816 0.0825 -0.1466 -0.1962 -0.1961 -0.2663 -0.5597 -0.8420 -0.5937 -0.5861
+ 0.8069 0.8226 0.8856 1.0000 0.8501 0.5871 0.1603 0.2071 -0.3074 -0.3530 -0.3761 -0.4298 -0.6824 -0.8231 -0.5680 -0.5291
+ 0.6633 0.6617 0.7544 0.8501 1.0000 0.7672 0.2976 0.4414 -0.4842 -0.5468 -0.5597 -0.6363 -0.7871 -0.7782 -0.4262 -0.3626
+ 0.3856 0.3491 0.4157 0.5871 0.7672 1.0000 0.4857 0.5699 -0.6954 -0.7622 -0.8020 -0.8456 -0.8496 -0.4183 -0.1118 -0.0047
+ 0.1102 0.0915 0.0816 0.1603 0.2976 0.4857 1.0000 0.5809 -0.4135 -0.4474 -0.4846 -0.5109 -0.4787 -0.1721 -0.0280 0.0402
+ 0.0490 0.0300 0.0825 0.2071 0.4414 0.5699 0.5809 1.0000 -0.4110 -0.4535 -0.4817 -0.5076 -0.4972 -0.1989 -0.1216 -0.0255
+ -0.1135 -0.1015 -0.1466 -0.3074 -0.4842 -0.6954 -0.4135 -0.4110 1.0000 0.7365 0.7476 0.7149 0.5552 0.1233 -0.1773 -0.2202
+ -0.1723 -0.1423 -0.1962 -0.3530 -0.5468 -0.7622 -0.4474 -0.4535 0.7365 1.0000 0.7859 0.7990 0.6569 0.1477 -0.1727 -0.2472
+ -0.1924 -0.1633 -0.1961 -0.3761 -0.5597 -0.8020 -0.4846 -0.4817 0.7476 0.7859 1.0000 0.8620 0.7439 0.1309 -0.2341 -0.3058
+ -0.2609 -0.2144 -0.2663 -0.4298 -0.6363 -0.8456 -0.5109 -0.5076 0.7149 0.7990 0.8620 1.0000 0.8045 0.2204 -0.2241 -0.3040
+ -0.5332 -0.5047 -0.5597 -0.6824 -0.7871 -0.8496 -0.4787 -0.4972 0.5552 0.6569 0.7439 0.8045 1.0000 0.4908 0.0593 -0.0277
+ -0.7578 -0.7732 -0.8420 -0.8231 -0.7782 -0.4183 -0.1721 -0.1989 0.1233 0.1477 0.1309 0.2204 0.4908 1.0000 0.5200 0.5417
+ -0.5159 -0.5584 -0.5937 -0.5680 -0.4262 -0.1118 -0.0280 -0.1216 -0.1773 -0.1727 -0.2341 -0.2241 0.0593 0.5200 1.0000 0.8467
+ -0.5108 -0.5549 -0.5861 -0.5291 -0.3626 -0.0047 0.0402 -0.0255 -0.2202 -0.2472 -0.3058 -0.3040 -0.0277 0.5417 0.8467 1.0000
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_joint_covar_fluxfix.txt b/data/MINERvA/CCQE/20deg_Q2QE_joint_covar_fluxfix.txt
new file mode 100755
index 0000000..e1d4bbc
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_joint_covar_fluxfix.txt
@@ -0,0 +1,17 @@
+1.00000 0.84420 0.87998 0.86569 0.78476 0.62381 0.24728 0.19878 0.62528 0.63894 0.66536 0.65954 0.61511 0.45521 0.23740 0.16111
+0.84420 1.00000 0.88323 0.87029 0.77574 0.59187 0.22371 0.17721 0.62191 0.64260 0.66813 0.67050 0.61030 0.42813 0.19379 0.11603
+0.87998 0.88323 1.00000 0.91996 0.84521 0.64905 0.22549 0.22917 0.62295 0.64287 0.68272 0.67722 0.62627 0.43831 0.20208 0.12285
+0.86569 0.87029 0.91996 1.00000 0.91825 0.77865 0.31484 0.34392 0.58506 0.61811 0.65356 0.66573 0.65684 0.53413 0.28701 0.22623
+0.78476 0.77574 0.84521 0.91825 1.00000 0.88165 0.43137 0.51379 0.50559 0.53918 0.58565 0.59417 0.64211 0.57702 0.38284 0.33938
+0.62381 0.59187 0.64905 0.77865 0.88165 1.00000 0.57473 0.60981 0.36100 0.39675 0.43615 0.46291 0.58124 0.68305 0.53204 0.52863
+0.24728 0.22371 0.22549 0.31484 0.43137 0.57473 1.00000 0.63099 0.14081 0.15678 0.16848 0.18330 0.29378 0.42692 0.36427 0.38416
+0.19878 0.17721 0.22917 0.34392 0.51379 0.60981 0.63099 1.00000 0.05727 0.06556 0.07932 0.09301 0.18312 0.31164 0.21226 0.25193
+0.62528 0.62191 0.62295 0.58506 0.50559 0.36100 0.14081 0.05727 1.00000 0.86268 0.87173 0.85717 0.78925 0.61255 0.33485 0.26221
+0.63894 0.64260 0.64287 0.61811 0.53918 0.39675 0.15678 0.06556 0.86268 1.00000 0.89943 0.90673 0.84935 0.65496 0.37352 0.28123
+0.66536 0.66813 0.68272 0.65356 0.58565 0.43615 0.16848 0.07932 0.87173 0.89943 1.00000 0.94091 0.89597 0.67705 0.37483 0.28261
+0.65954 0.67050 0.67722 0.66573 0.59417 0.46291 0.18330 0.09301 0.85717 0.90673 0.94091 1.00000 0.92754 0.72891 0.40198 0.30629
+0.61511 0.61030 0.62627 0.65684 0.64211 0.58124 0.29378 0.18312 0.78925 0.84935 0.89597 0.92754 1.00000 0.85614 0.57853 0.49184
+0.45521 0.42813 0.43831 0.53413 0.57702 0.68305 0.42692 0.31164 0.61255 0.65496 0.67705 0.72891 0.85614 1.00000 0.75302 0.72746
+0.23740 0.19379 0.20208 0.28701 0.38284 0.53204 0.36427 0.21226 0.33485 0.37352 0.37483 0.40198 0.57853 0.75302 1.00000 0.89935
+0.16111 0.11603 0.12285 0.22623 0.33938 0.52863 0.38416 0.25193 0.26221 0.28123 0.28261 0.30629 0.49184 0.72746 0.89935 1.00000
+
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_joint_data.txt b/data/MINERvA/CCQE/20deg_Q2QE_joint_data.txt
new file mode 100755
index 0000000..6883b86
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_joint_data.txt
@@ -0,0 +1,31 @@
+0 0.813E-38 0.109E-38
+0.025 1.061E-38 0.143E-38
+0.05 1.185E-38 0.156E-38
+0.1 1.095E-38 0.140E-38
+0.2 0.754E-38 0.101E-38
+0.4 0.283E-38 0.042E-38
+0.8 0.073E-38 0.015E-38
+1.2 0.015E-38 0.004E-38
+2.0 0.761E-38 0.114E-38
+2.025 1.146E-38 0.155E-38
+2.05 1.344E-38 0.169E-38
+2.1 1.489E-38 0.182E-38
+2.2 1.021E-38 0.124E-38
+2.4 0.455E-38 0.065E-38
+2.8 0.127E-38 0.032E-38
+3.2 0.026E-38 0.008E-38
+4.0 0 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_joint_data_SHAPE-extracted.txt b/data/MINERvA/CCQE/20deg_Q2QE_joint_data_SHAPE-extracted.txt
new file mode 100755
index 0000000..c7d9e27
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_joint_data_SHAPE-extracted.txt
@@ -0,0 +1,17 @@
+0.000 0.813000E-38 0.079486E-38
+0.025 1.061000E-38 0.106384E-38
+0.050 1.185000E-38 0.112180E-38
+0.100 1.095000E-38 0.092194E-38
+0.200 0.754000E-38 0.062438E-38
+0.400 0.283000E-38 0.026403E-38
+0.800 0.073000E-38 0.013204E-38
+1.200 0.015000E-38 0.003667E-38
+2.000 0.761000E-38 0.079996E-38
+2.025 1.146000E-38 0.102264E-38
+2.050 1.344000E-38 0.105781E-38
+2.100 1.489000E-38 0.107557E-38
+2.200 1.021000E-38 0.060329E-38
+2.400 0.455000E-38 0.034272E-38
+2.800 0.127000E-38 0.025273E-38
+3.200 0.026000E-38 0.006754E-38
+4.000 0 0
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_joint_data_fluxfix.txt b/data/MINERvA/CCQE/20deg_Q2QE_joint_data_fluxfix.txt
new file mode 100755
index 0000000..016b8f4
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_joint_data_fluxfix.txt
@@ -0,0 +1,17 @@
+0.0 9.95248E-39 9.32331E-40
+0.025 1.29836E-38 1.21669E-39
+0.05 1.45069E-38 1.31568E-39
+0.1 1.34021E-38 1.17909E-39
+0.2 9.20783E-39 8.75596E-40
+0.4 3.44229E-39 3.72058E-40
+0.8 8.80692E-40 1.39413E-40
+1.2 1.79399E-40 3.84830E-41
+2.0 9.33281E-39 1.02142E-39
+2.025 1.40601E-38 1.40693E-39
+2.05 1.65064E-38 1.53664E-39
+2.1 1.82744E-38 1.65908E-39
+2.2 1.24987E-38 1.15731E-39
+2.4 5.52559E-39 6.12484E-40
+2.8 1.52186E-39 3.22217E-40
+3.2 3.07422E-40 7.72320E-41
+4.0 0.0 0.0
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numu_covar.txt b/data/MINERvA/CCQE/20deg_Q2QE_numu_covar.txt
new file mode 100755
index 0000000..1640696
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numu_covar.txt
@@ -0,0 +1,8 @@
+1.000 0.877 0.886 0.873 0.812 0.656 0.369 0.288
+0.877 1.000 0.911 0.918 0.868 0.700 0.412 0.313
+0.886 0.911 1.000 0.948 0.910 0.721 0.413 0.314
+0.873 0.918 0.948 1.000 0.938 0.769 0.441 0.339
+0.812 0.868 0.910 0.938 1.000 0.875 0.597 0.503
+0.656 0.700 0.721 0.769 0.875 1.000 0.753 0.718
+0.369 0.412 0.413 0.441 0.597 0.753 1.000 0.894
+0.288 0.313 0.314 0.339 0.503 0.718 0.894 1.000
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numu_covar_SHAPE-extracted.txt b/data/MINERvA/CCQE/20deg_Q2QE_numu_covar_SHAPE-extracted.txt
new file mode 100755
index 0000000..a4a6902
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numu_covar_SHAPE-extracted.txt
@@ -0,0 +1,8 @@
+ 1.0000 0.6260 0.6348 0.5771 0.2563 -0.5152 -0.5267 -0.5150
+ 0.6260 1.0000 0.6686 0.6761 0.3795 -0.5979 -0.5948 -0.6159
+ 0.6348 0.6686 1.0000 0.7727 0.5477 -0.6915 -0.7217 -0.7322
+ 0.5771 0.6761 0.7727 1.0000 0.5947 -0.6685 -0.8086 -0.8234
+ 0.2563 0.3795 0.5477 0.5947 1.0000 -0.5251 -0.6999 -0.7235
+ -0.5152 -0.5979 -0.6915 -0.6685 -0.5251 1.0000 0.3114 0.4337
+ -0.5267 -0.5948 -0.7217 -0.8086 -0.6999 0.3114 1.0000 0.8247
+ -0.5150 -0.6159 -0.7322 -0.8234 -0.7235 0.4337 0.8247 1.0000
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numu_covar_fluxfix.txt b/data/MINERvA/CCQE/20deg_Q2QE_numu_covar_fluxfix.txt
new file mode 100755
index 0000000..3c8c604
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numu_covar_fluxfix.txt
@@ -0,0 +1,8 @@
+1.00000 0.86268 0.87173 0.85717 0.78925 0.61255 0.33485 0.26221
+0.86268 1.00000 0.89943 0.90673 0.84935 0.65496 0.37352 0.28123
+0.87173 0.89943 1.00000 0.94091 0.89597 0.67705 0.37483 0.28261
+0.85717 0.90673 0.94091 1.00000 0.92754 0.72891 0.40198 0.30629
+0.78925 0.84935 0.89597 0.92754 1.00000 0.85614 0.57853 0.49184
+0.61255 0.65496 0.67705 0.72891 0.85614 1.00000 0.75302 0.72746
+0.33485 0.37352 0.37483 0.40198 0.57853 0.75302 1.00000 0.89935
+0.26221 0.28123 0.28261 0.30629 0.49184 0.72746 0.89935 1.00000
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numu_data.txt b/data/MINERvA/CCQE/20deg_Q2QE_numu_data.txt
new file mode 100755
index 0000000..c63e691
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numu_data.txt
@@ -0,0 +1,23 @@
+0.0 0.761E-38 0.114E-38
+0.025 1.146E-38 0.155E-38
+0.05 1.344E-38 0.169E-38
+0.1 1.489E-38 0.182E-38
+0.2 1.021E-38 0.124E-38
+0.4 0.455E-38 0.065E-38
+0.8 0.127E-38 0.032E-38
+1.2 0.026E-38 0.008E-38
+2.0 0 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numu_data_SHAPE-extracted.txt b/data/MINERvA/CCQE/20deg_Q2QE_numu_data_SHAPE-extracted.txt
new file mode 100755
index 0000000..033e237
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numu_data_SHAPE-extracted.txt
@@ -0,0 +1,9 @@
+0.000 0.761000E-38 0.068531E-38
+0.025 1.146000E-38 0.083212E-38
+0.050 1.344000E-38 0.084356E-38
+0.100 1.489000E-38 0.079473E-38
+0.200 1.021000E-38 0.031957E-38
+0.400 0.455000E-38 0.021607E-38
+0.800 0.127000E-38 0.022996E-38
+1.200 0.026000E-38 0.006357E-38
+2.000 0 0
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numu_data_fluxfix.txt b/data/MINERvA/CCQE/20deg_Q2QE_numu_data_fluxfix.txt
new file mode 100755
index 0000000..3be431d
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numu_data_fluxfix.txt
@@ -0,0 +1,9 @@
+0.0 9.33281E-39 1.02142E-39
+0.025 1.40601E-38 1.40693E-39
+0.05 1.65064E-38 1.53664E-39
+0.1 1.82744E-38 1.65908E-39
+0.2 1.24987E-38 1.15731E-39
+0.4 5.52559E-39 6.12484E-40
+0.8 1.52186E-39 3.22217E-40
+1.2 3.07422E-40 7.72320E-41
+2.0 0.0 0.0
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar.txt b/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar.txt
new file mode 100755
index 0000000..0384ab0
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar.txt
@@ -0,0 +1,9 @@
+1.000 0.886 0.913 0.903 0.842 0.723 0.396 0.309
+0.886 1.000 0.916 0.907 0.836 0.699 0.378 0.291
+0.913 0.916 1.000 0.943 0.887 0.743 0.382 0.335
+0.903 0.907 0.943 1.000 0.940 0.838 0.450 0.427
+0.842 0.836 0.887 0.940 1.000 0.912 0.536 0.564
+0.723 0.699 0.743 0.838 0.912 1.000 0.643 0.640
+0.396 0.378 0.382 0.450 0.536 0.643 1.000 0.659
+0.309 0.291 0.335 0.427 0.564 0.640 0.659 1.000
+
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar_SHAPE-extracted.txt b/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar_SHAPE-extracted.txt
new file mode 100755
index 0000000..278f93d
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar_SHAPE-extracted.txt
@@ -0,0 +1,8 @@
+ 1.0000 0.5687 0.6216 0.5232 -0.1175 -0.5643 -0.3473 -0.5217
+ 0.5687 1.0000 0.6499 0.5842 -0.0997 -0.6439 -0.3708 -0.5408
+ 0.6216 0.6499 1.0000 0.6481 -0.0046 -0.7298 -0.5056 -0.5835
+ 0.5232 0.5842 0.6481 1.0000 -0.0084 -0.6382 -0.6029 -0.6050
+ -0.1175 -0.0997 -0.0046 -0.0084 1.0000 -0.1577 -0.4750 -0.1030
+ -0.5643 -0.6439 -0.7298 -0.6382 -0.1577 1.0000 0.2246 0.3206
+ -0.3473 -0.3708 -0.5056 -0.6029 -0.4750 0.2246 1.0000 0.4566
+ -0.5217 -0.5408 -0.5835 -0.6050 -0.1030 0.3206 0.4566 1.0000
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar_fluxfix.txt b/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar_fluxfix.txt
new file mode 100755
index 0000000..96e9a73
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numubar_covar_fluxfix.txt
@@ -0,0 +1,8 @@
+1.00000 0.84420 0.87998 0.86569 0.78476 0.62381 0.24728 0.19878
+0.84420 1.00000 0.88323 0.87029 0.77574 0.59187 0.22371 0.17721
+0.87998 0.88323 1.00000 0.91996 0.84521 0.64905 0.22549 0.22917
+0.86569 0.87029 0.91996 1.00000 0.91825 0.77865 0.31484 0.34392
+0.78476 0.77574 0.84521 0.91825 1.00000 0.88165 0.43137 0.51379
+0.62381 0.59187 0.64905 0.77865 0.88165 1.00000 0.57473 0.60981
+0.24728 0.22371 0.22549 0.31484 0.43137 0.57473 1.00000 0.63099
+0.19878 0.17721 0.22917 0.34392 0.51379 0.60981 0.63099 1.00000
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numubar_data.txt b/data/MINERvA/CCQE/20deg_Q2QE_numubar_data.txt
new file mode 100755
index 0000000..8224914
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numubar_data.txt
@@ -0,0 +1,24 @@
+0 0.813E-38 0.109E-38
+0.025 1.061E-38 0.143E-38
+0.05 1.185E-38 0.156E-38
+0.1 1.095E-38 0.140E-38
+0.2 0.754E-38 0.101E-38
+0.4 0.283E-38 0.042E-38
+0.8 0.073E-38 0.015E-38
+1.2 0.015E-38 0.004E-38
+2.0 0 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numubar_data_SHAPE-extracted.txt b/data/MINERvA/CCQE/20deg_Q2QE_numubar_data_SHAPE-extracted.txt
new file mode 100755
index 0000000..62a2601
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numubar_data_SHAPE-extracted.txt
@@ -0,0 +1,9 @@
+0.000 0.813000E-38 0.055291E-38
+0.025 1.061000E-38 0.074446E-38
+0.050 1.185000E-38 0.068413E-38
+0.100 1.095000E-38 0.041436E-38
+0.200 0.754000E-38 0.019137E-38
+0.400 0.283000E-38 0.014572E-38
+0.800 0.073000E-38 0.011798E-38
+1.200 0.015000E-38 0.003251E-38
+2.000 0 0
diff --git a/data/MINERvA/CCQE/20deg_Q2QE_numubar_data_fluxfix.txt b/data/MINERvA/CCQE/20deg_Q2QE_numubar_data_fluxfix.txt
new file mode 100755
index 0000000..d1c5102
--- /dev/null
+++ b/data/MINERvA/CCQE/20deg_Q2QE_numubar_data_fluxfix.txt
@@ -0,0 +1,9 @@
+0.0 9.95248E-39 9.32331E-40
+0.025 1.29836E-38 1.21669E-39
+0.05 1.45069E-38 1.31568E-39
+0.1 1.34021E-38 1.17909E-39
+0.2 9.20783E-39 8.75596E-40
+0.4 3.44229E-39 3.72058E-40
+0.8 8.80692E-40 1.39413E-40
+1.2 1.79399E-40 3.84830E-41
+2.0 0.0 0.0
diff --git a/data/MINERvA/CCQE/MINERvA_1DQ2_nu_CCQE.root b/data/MINERvA/CCQE/MINERvA_1DQ2_nu_CCQE.root
new file mode 100755
index 0000000..8c865af
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_1DQ2_nu_CCQE.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_0.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_0.root
new file mode 100755
index 0000000..9bf9594
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_0.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_1.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_1.root
new file mode 100755
index 0000000..128c961
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_1.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_2.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_2.root
new file mode 100755
index 0000000..7f172f6
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_2.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_3.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_3.root
new file mode 100755
index 0000000..15c3138
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_20deg_msk_3.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_0.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_0.root
new file mode 100755
index 0000000..c9a7ef0
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_0.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_1.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_1.root
new file mode 100755
index 0000000..ffaf2d7
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_1.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_2.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_2.root
new file mode 100755
index 0000000..d130913
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_2.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_3.root b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_3.root
new file mode 100755
index 0000000..3c89ed2
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_antinu_msk_3.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_0.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_0.root
new file mode 100755
index 0000000..70ca11a
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_0.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_1.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_1.root
new file mode 100755
index 0000000..c4d2faf
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_1.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_2.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_2.root
new file mode 100755
index 0000000..034a0ae
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_2.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_3.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_3.root
new file mode 100755
index 0000000..d3dbb6e
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_20deg_msk_3.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_0.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_0.root
new file mode 100755
index 0000000..d9183f0
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_0.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_1.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_1.root
new file mode 100755
index 0000000..d73822d
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_1.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_2.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_2.root
new file mode 100755
index 0000000..8261f47
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_2.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_3.root b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_3.root
new file mode 100755
index 0000000..edd7c18
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_CCQE_nu_msk_3.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_Data_ARX1509_05729.root b/data/MINERvA/CCQE/MINERvA_Data_ARX1509_05729.root
new file mode 100755
index 0000000..a179215
Binary files /dev/null and b/data/MINERvA/CCQE/MINERvA_Data_ARX1509_05729.root differ
diff --git a/data/MINERvA/CCQE/MINERvA_numu_1D_data_rebin_data.txt b/data/MINERvA/CCQE/MINERvA_numu_1D_data_rebin_data.txt
new file mode 100755
index 0000000..f47c0fb
--- /dev/null
+++ b/data/MINERvA/CCQE/MINERvA_numu_1D_data_rebin_data.txt
@@ -0,0 +1,8 @@
+0.0 1.11260208377e-38 1.03634086256e-39
+0.0500000007451 1.5670944924e-38 1.86697780182e-39
+0.10000000149 1.73862307794e-38 2.00700113695e-39
+0.20000000298 1.24037337708e-38 1.42357057389e-39
+0.40000000596 6.79113175411e-39 8.75145844602e-40
+0.800000011921 2.82380371486e-39 6.41773571559e-40
+1.20000004768 1.13185537668e-39 2.91715303269e-40
+2.0 0.0 0.0
\ No newline at end of file
diff --git a/data/MINERvA/CCQE/MINMB_Ratio_20deg.txt b/data/MINERvA/CCQE/MINMB_Ratio_20deg.txt
new file mode 100755
index 0000000..4e98134
--- /dev/null
+++ b/data/MINERvA/CCQE/MINMB_Ratio_20deg.txt
@@ -0,0 +1,8 @@
+0.0 0.690363607761 0.151191050924
+0.0500000007451 0.929054315476 0.138957071771
+0.10000000149 0.97470080591 0.124640160166
+0.20000000298 1.16232198825 0.142105503687
+0.40000000596 1.23356203297 0.178478628665
+0.800000011921 1.46196102362 0.388501436588
+1.20000004768 2.35324783654 0.905887138074
+2.0 0.0 0.0
\ No newline at end of file
diff --git a/data/MINERvA/CCQE/MINMB_Ratio_full.txt b/data/MINERvA/CCQE/MINMB_Ratio_full.txt
new file mode 100755
index 0000000..96410d5
--- /dev/null
+++ b/data/MINERvA/CCQE/MINMB_Ratio_full.txt
@@ -0,0 +1,8 @@
+0.0 0.690363607761 0.148801857404
+0.0500000007451 0.929746090841 0.133936883256
+0.10000000149 0.974046644295 0.118247509753
+0.20000000298 1.1163976952 0.129085501291
+0.40000000596 0.964382689003 0.126228050526
+0.800000011921 0.767227479339 0.186015061021
+1.20000004768 0.63076746134 0.218448844784
+2.0 0.0 0.0
\ No newline at end of file
diff --git a/data/MINERvA/CCQE/Q2QE_antinu_covar_fluxfix.txt b/data/MINERvA/CCQE/Q2QE_antinu_covar_fluxfix.txt
new file mode 100755
index 0000000..eee91ff
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_antinu_covar_fluxfix.txt
@@ -0,0 +1,8 @@
+0.011085113377011332 0.012621627014913907 0.013832714262523093 0.013401259193064174 0.008923750033807087 0.003885418978731057 0.0016291066134889655 0.0004716445929751694
+0.012621627014913907 0.019105115622487668 0.018409058234818636 0.01831649562590485 0.012284115416167968 0.005275820923080161 0.002386362596766497 0.0006793779278293267
+0.013832714262523093 0.01840905823481864 0.022176021170818364 0.020322539107765183 0.013987338716624179 0.005845702036277676 0.002507832884304526 0.0006995651114106596
+0.013401259193064174 0.01831649562590485 0.02032253910776518 0.021554051514934544 0.01404118372663557 0.006103945117658788 0.0027066040836864983 0.000794821074894569
+0.008923750033807087 0.01228411541616797 0.01398733871662418 0.014041183726635568 0.010675116970821609 0.004989338359384158 0.0026883620446813143 0.0009466333007327206
+0.003885418978731058 0.005275820923080161 0.0058457020362776765 0.006103945117658788 0.004989338359384159 0.0037426211973084875 0.0022848867020996656 0.0010196253808122193
+0.0016291066134889653 0.002386362596766497 0.0025078328843045265 0.0027066040836864983 0.0026883620446813148 0.0022848867020996656 0.0026553447279390363 0.0010653625389391973
+0.0004716445929751692 0.0006793779278293267 0.0006995651114106595 0.0007948210748945691 0.0009466333007327206 0.0010196253808122196 0.0010653625389391973 0.000559413955901681
diff --git a/data/MINERvA/CCQE/Q2QE_antinu_data_fluxfix.txt b/data/MINERvA/CCQE/Q2QE_antinu_data_fluxfix.txt
new file mode 100755
index 0000000..8544138
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_antinu_data_fluxfix.txt
@@ -0,0 +1,9 @@
+0.0 9.0727046436e-39 1.0416665985e-39
+0.025 1.36713686945e-38 1.4555543707e-39
+0.05 1.60374921161e-38 1.61644970022e-39
+0.1 1.77779397112e-38 1.74480620602e-39
+0.2 1.26437732963e-38 1.24877587086e-39
+0.4 6.86399152713e-39 7.97875427422e-40
+0.8 2.81795050914e-39 5.93139341315e-40
+1.2 1.11818649182e-39 2.74908026663e-40
+2.00 0.0 0.0
diff --git a/data/MINERvA/CCQE/Q2QE_joint_covar.txt b/data/MINERvA/CCQE/Q2QE_joint_covar.txt
new file mode 100755
index 0000000..2415ff4
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_joint_covar.txt
@@ -0,0 +1,16 @@
+1.000 0.884 0.911 0.901 0.828 0.700 0.362 0.297 0.433 0.427 0.439 0.433 0.410 0.326 0.195 0.129
+0.884 1.000 0.913 0.904 0.820 0.675 0.343 0.278 0.428 0.429 0.438 0.439 0.403 0.300 0.155 0.089
+0.911 0.913 1.000 0.942 0.875 0.726 0.353 0.319 0.422 0.421 0.445 0.438 0.412 0.308 0.161 0.095
+0.901 0.904 0.942 1.000 0.933 0.825 0.431 0.413 0.384 0.394 0.414 0.420 0.419 0.369 0.229 0.184
+0.828 0.820 0.875 0.933 1.000 0.916 0.541 0.566 0.324 0.337 0.371 0.374 0.419 0.420 0.319 0.298
+0.700 0.675 0.726 0.825 0.916 1.000 0.643 0.653 0.223 0.243 0.268 0.286 0.376 0.509 0.453 0.471
+0.362 0.343 0.353 0.431 0.541 0.643 1.000 0.752 0.055 0.073 0.080 0.100 0.194 0.335 0.302 0.343
+0.297 0.278 0.319 0.413 0.566 0.653 0.752 1.000 0.009 0.022 0.035 0.047 0.134 0.266 0.210 0.259
+0.433 0.428 0.422 0.384 0.324 0.223 0.055 0.009 1.000 0.869 0.882 0.873 0.832 0.690 0.415 0.327
+0.427 0.429 0.421 0.394 0.337 0.243 0.073 0.022 0.869 1.000 0.905 0.917 0.882 0.727 0.457 0.357
+0.439 0.438 0.445 0.414 0.371 0.268 0.080 0.035 0.882 0.905 1.000 0.945 0.928 0.751 0.455 0.356
+0.433 0.439 0.438 0.420 0.374 0.286 0.100 0.047 0.873 0.917 0.945 1.000 0.946 0.788 0.481 0.385
+0.410 0.403 0.412 0.419 0.419 0.376 0.194 0.134 0.832 0.882 0.928 0.946 1.000 0.865 0.600 0.514
+0.326 0.300 0.308 0.369 0.420 0.509 0.335 0.266 0.690 0.727 0.751 0.788 0.865 1.000 0.756 0.741
+0.195 0.155 0.161 0.229 0.319 0.453 0.302 0.210 0.415 0.457 0.455 0.481 0.600 0.756 1.000 0.888
+0.129 0.089 0.095 0.184 0.298 0.471 0.343 0.259 0.327 0.357 0.356 0.385 0.514 0.741 0.888 1.000
diff --git a/data/MINERvA/CCQE/Q2QE_joint_covar_SHAPE-extracted.txt b/data/MINERvA/CCQE/Q2QE_joint_covar_SHAPE-extracted.txt
new file mode 100755
index 0000000..e45b275
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_joint_covar_SHAPE-extracted.txt
@@ -0,0 +1,16 @@
+ 1.0000 0.8165 0.8547 0.8320 0.6807 0.3784 0.0390 -0.0139 0.0360 -0.0062 -0.0128 -0.0538 -0.2502 -0.6609 -0.5731 -0.6099
+ 0.8165 1.0000 0.8627 0.8463 0.6808 0.3506 0.0264 -0.0275 0.0537 0.0277 0.0187 -0.0060 -0.2158 -0.6641 -0.6068 -0.6417
+ 0.8547 0.8627 1.0000 0.9031 0.7676 0.4221 0.0213 0.0130 0.0138 -0.0202 -0.0051 -0.0480 -0.2533 -0.7245 -0.6472 -0.6798
+ 0.8320 0.8463 0.9031 1.0000 0.8547 0.5760 0.0990 0.1197 -0.1363 -0.1642 -0.1655 -0.1947 -0.3899 -0.7599 -0.6434 -0.6390
+ 0.6807 0.6808 0.7676 0.8547 1.0000 0.7785 0.2611 0.3661 -0.3684 -0.4126 -0.3988 -0.4504 -0.5783 -0.8090 -0.5457 -0.4954
+ 0.3784 0.3506 0.4221 0.5760 0.7785 1.0000 0.4432 0.5317 -0.6599 -0.7116 -0.7345 -0.7674 -0.8128 -0.5930 -0.2402 -0.1202
+ 0.0390 0.0264 0.0213 0.0990 0.2611 0.4432 1.0000 0.6750 -0.4594 -0.4808 -0.5119 -0.5197 -0.5037 -0.2984 -0.1286 -0.0262
+ -0.0139 -0.0275 0.0130 0.1197 0.3661 0.5317 0.6750 1.0000 -0.4605 -0.4887 -0.5086 -0.5281 -0.5171 -0.3233 -0.1790 -0.0680
+ 0.0360 0.0537 0.0138 -0.1363 -0.3684 -0.6599 -0.4594 -0.4605 1.0000 0.7594 0.7789 0.7594 0.6755 0.2640 -0.2065 -0.3026
+ -0.0062 0.0277 -0.0202 -0.1642 -0.4126 -0.7116 -0.4808 -0.4887 0.7594 1.0000 0.8121 0.8335 0.7576 0.2827 -0.2034 -0.3238
+ -0.0128 0.0187 -0.0051 -0.1655 -0.3988 -0.7345 -0.5119 -0.5086 0.7789 0.8121 1.0000 0.8835 0.8463 0.2866 -0.2665 -0.3845
+ -0.0538 -0.0060 -0.0480 -0.1947 -0.4504 -0.7674 -0.5197 -0.5281 0.7594 0.8335 0.8835 1.0000 0.8733 0.3445 -0.2635 -0.3793
+ -0.2502 -0.2158 -0.2533 -0.3899 -0.5783 -0.8128 -0.5037 -0.5171 0.6755 0.7576 0.8463 0.8733 1.0000 0.4705 -0.1109 -0.2289
+ -0.6609 -0.6641 -0.7245 -0.7599 -0.8090 -0.5930 -0.2984 -0.3233 0.2640 0.2827 0.2866 0.3445 0.4705 1.0000 0.3390 0.3780
+ -0.5731 -0.6068 -0.6472 -0.6434 -0.5457 -0.2402 -0.1286 -0.1790 -0.2065 -0.2034 -0.2665 -0.2635 -0.1109 0.3390 1.0000 0.8017
+ -0.6099 -0.6417 -0.6798 -0.6390 -0.4954 -0.1202 -0.0262 -0.0680 -0.3026 -0.3238 -0.3845 -0.3793 -0.2289 0.3780 0.8017 1.0000
diff --git a/data/MINERvA/CCQE/Q2QE_joint_covar_fluxfix.txt b/data/MINERvA/CCQE/Q2QE_joint_covar_fluxfix.txt
new file mode 100755
index 0000000..f9ec1fd
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_joint_covar_fluxfix.txt
@@ -0,0 +1,16 @@
+0.010850693024217059 0.013190744200435017 0.014861923720325191 0.015889891078358833 0.010843787943299682 0.005624107037659058 0.0025710258458044675 0.0009246286420048676 0.008378114641718152 0.01067988363734119 0.011671724037168296 0.011431916393507763 0.0075471933941027415 0.003337914774220062 0.0014762551985362713 0.0004353654993927686
+0.013190744200435013 0.021186385260613207 0.021325301678827638 0.023317896472491724 0.015995395778463838 0.008142232076509406 0.003820676949165565 0.001342344168977523 0.011383354694144905 0.015277579700374168 0.016602514706689588 0.0166790277728349 0.01114454636902864 0.004836926009715195 0.0022763117600187047 0.0006583745056070657
+0.014861923720325191 0.02132530167882763 0.02612909633343725 0.026685112166221082 0.01869227729887766 0.00936112702492297 0.004242783507762443 0.001493691722655789 0.012744957539571802 0.016978636754317572 0.019420931847406217 0.01889459835452953 0.012999056272922806 0.0054797213853813795 0.0024290417320247904 0.0006903759773339679
+0.015889891078358837 0.023317896472491724 0.02668511216622108 0.03044348696552605 0.020557479283651925 0.010557606715164931 0.004816165433252427 0.0017313742322655548 0.01355452765171317 0.018512820512922235 0.020560023709156015 0.02102481933089481 0.014254197614929898 0.006260756975227824 0.00281070492616775 0.0008434210310601616
+0.010843787943299677 0.015995395778463834 0.018692277298877655 0.020557479283651925 0.015594411756460633 0.008520161551433196 0.004474689044173032 0.0017588384894984984 0.009031547360726156 0.01241291600059451 0.014151257204516404 0.014243139013575705 0.010491346278831672 0.00515343955084002 0.0028162564753531362 0.001010219685988915
+0.005624107037659056 0.008142232076509406 0.00936112702492297 0.010557606715164935 0.008520161551433196 0.006366051976845064 0.003724161849033904 0.0016865661669981432 0.004411070223107368 0.005946880071711517 0.006617602657956641 0.006874016482775016 0.005571412982647025 0.003932187259372631 0.0024941113830112332 0.0011138225101299368
+0.0025710258458044666 0.0038206769491655667 0.004242783507762443 0.004816165433252426 0.004474689044173032 0.0037241618490339045 0.0035181427821568347 0.0014757595136650808 0.0019165190628176803 0.002748500263194058 0.0029273785507615796 0.0031345641912810564 0.003016986685834871 0.0025043121828085056 0.0025952761869889604 0.0011307124381884845
+0.0009246286420048678 0.001342344168977523 0.001493691722655789 0.0017313742322655548 0.0017588384894984986 0.0016865661669981432 0.0014757595136650808 0.0007557442312393396 0.0006267246244974173 0.0008752851232593777 0.0009259621021978419 0.00102430329840903 0.0011222333581824024 0.0011347659976868717 0.0011376463706516797 0.0005314493307075546
+0.008378114641718152 0.011383354694144907 0.012744957539571802 0.01355452765171317 0.009031547360726156 0.004411070223107367 0.0019165190628176803 0.0006267246244974175 0.011085113377011332 0.012621627014913907 0.013832714262523093 0.013401259193064174 0.008923750033807087 0.003885418978731057 0.0016291066134889655 0.0004716445929751694
+0.010679883637341188 0.015277579700374168 0.016978636754317565 0.018512820512922232 0.01241291600059451 0.0059468800717115185 0.0027485002631940578 0.0008752851232593775 0.012621627014913907 0.019105115622487668 0.018409058234818636 0.01831649562590485 0.012284115416167968 0.005275820923080161 0.002386362596766497 0.0006793779278293267
+0.011671724037168296 0.01660251470668959 0.019420931847406217 0.020560023709156015 0.014151257204516404 0.006617602657956642 0.0029273785507615796 0.0009259621021978418 0.013832714262523093 0.01840905823481864 0.022176021170818364 0.020322539107765183 0.013987338716624179 0.005845702036277676 0.002507832884304526 0.0006995651114106596
+0.011431916393507763 0.0166790277728349 0.018894598354529536 0.02102481933089481 0.014243139013575705 0.006874016482775016 0.0031345641912810564 0.00102430329840903 0.013401259193064174 0.01831649562590485 0.02032253910776518 0.021554051514934544 0.01404118372663557 0.006103945117658788 0.0027066040836864983 0.000794821074894569
+0.007547193394102741 0.011144546369028643 0.012999056272922808 0.014254197614929898 0.010491346278831672 0.005571412982647023 0.0030169866858348704 0.0011222333581824024 0.008923750033807087 0.01228411541616797 0.01398733871662418 0.014041183726635568 0.010675116970821609 0.004989338359384158 0.0026883620446813143 0.0009466333007327206
+0.003337914774220062 0.004836926009715194 0.005479721385381378 0.006260756975227823 0.0051534395508400195 0.003932187259372631 0.0025043121828085056 0.0011347659976868717 0.003885418978731058 0.005275820923080161 0.0058457020362776765 0.006103945117658788 0.004989338359384159 0.0037426211973084875 0.0022848867020996656 0.0010196253808122193
+0.001476255198536271 0.0022763117600187047 0.0024290417320247904 0.00281070492616775 0.0028162564753531367 0.0024941113830112332 0.0025952761869889604 0.0011376463706516797 0.0016291066134889653 0.002386362596766497 0.0025078328843045265 0.0027066040836864983 0.0026883620446813148 0.0022848867020996656 0.0026553447279390363 0.0010653625389391973
+0.0004353654993927686 0.00065837
diff --git a/data/MINERvA/CCQE/Q2QE_joint_data.txt b/data/MINERvA/CCQE/Q2QE_joint_data.txt
new file mode 100755
index 0000000..445050f
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_joint_data.txt
@@ -0,0 +1,17 @@
+0 0.813E-38 0.108E-38
+0.025 1.061E-38 0.142E-38
+0.05 1.185E-38 0.154E-38
+0.1 1.096E-38 0.137E-38
+0.2 0.777E-38 0.103E-38
+0.4 0.340E-38 0.051E-38
+0.8 0.123E-38 0.026E-38
+1.2 0.041E-38 0.011E-38
+2.0 0.761E-38 0.104E-38
+2.025 1.146E-38 0.144E-38
+2.05 1.343E-38 0.160E-38
+2.1 1.490E-38 0.172E-38
+2.2 1.063E-38 0.122E-38
+2.4 0.582E-38 0.075E-38
+2.8 0.242E-38 0.055E-38
+3.2 0.097E-38 0.025E-38
+4.0 0 0
diff --git a/data/MINERvA/CCQE/Q2QE_joint_data_SHAPE-extracted.txt b/data/MINERvA/CCQE/Q2QE_joint_data_SHAPE-extracted.txt
new file mode 100755
index 0000000..cc3324b
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_joint_data_SHAPE-extracted.txt
@@ -0,0 +1,17 @@
+0.000 0.813000E-38 0.084656E-38
+0.025 1.061000E-38 0.114229E-38
+0.050 1.185000E-38 0.120467E-38
+0.100 1.096000E-38 0.098827E-38
+0.200 0.777000E-38 0.067082E-38
+0.400 0.340000E-38 0.031897E-38
+0.800 0.123000E-38 0.022216E-38
+1.200 0.041000E-38 0.009782E-38
+2.000 0.761000E-38 0.078085E-38
+2.025 1.146000E-38 0.103909E-38
+2.050 1.343000E-38 0.111408E-38
+2.100 1.490000E-38 0.115248E-38
+2.200 1.063000E-38 0.068290E-38
+2.400 0.582000E-38 0.035799E-38
+2.800 0.242000E-38 0.039803E-38
+3.200 0.097000E-38 0.019214E-38
+4.000 0 0
diff --git a/data/MINERvA/CCQE/Q2QE_joint_data_fluxfix.txt b/data/MINERvA/CCQE/Q2QE_joint_data_fluxfix.txt
new file mode 100755
index 0000000..ddd7a97
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_joint_data_fluxfix.txt
@@ -0,0 +1,17 @@
+0.0 9.0727046436e-39 1.0416665985e-39
+0.025 1.36713686945e-38 1.4555543707e-39
+0.05 1.60374921161e-38 1.61644970022e-39
+0.1 1.77779397112e-38 1.74480620602e-39
+0.2 1.26437732963e-38 1.24877587086e-39
+0.4 6.86399152713e-39 7.97875427422e-40
+0.8 2.81795050914e-39 5.93139341315e-40
+1.2 1.11818649182e-39 2.74908026663e-40
+2.0 9.74134032934e-39 1.05285865039e-39
+2.025 1.27053453213e-38 1.38221256044e-39
+2.05 1.41936302043e-38 1.48916154835e-39
+2.1 1.31214085033e-38 1.46812981425e-39
+2.2 9.27620248836e-39 1.03320457659e-39
+2.4 4.0394169746e-39 6.11769662317e-40
+2.8 1.44869365053e-39 5.15300371428e-40
+3.2 4.79844766693e-40 2.36519334495e-40
+4.0 0.0 0.0
diff --git a/data/MINERvA/CCQE/Q2QE_nu_covar_fluxfix.txt b/data/MINERvA/CCQE/Q2QE_nu_covar_fluxfix.txt
new file mode 100755
index 0000000..c0b618e
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_nu_covar_fluxfix.txt
@@ -0,0 +1,8 @@
+0.010850693024217059 0.013190744200435017 0.014861923720325191 0.015889891078358833 0.010843787943299682 0.005624107037659058 0.0025710258458044675 0.0009246286420048676
+0.013190744200435013 0.021186385260613207 0.021325301678827638 0.023317896472491724 0.015995395778463838 0.008142232076509406 0.003820676949165565 0.001342344168977523
+0.014861923720325191 0.02132530167882763 0.02612909633343725 0.026685112166221082 0.01869227729887766 0.00936112702492297 0.004242783507762443 0.001493691722655789
+0.015889891078358837 0.023317896472491724 0.02668511216622108 0.03044348696552605 0.020557479283651925 0.010557606715164931 0.004816165433252427 0.0017313742322655548
+0.010843787943299677 0.015995395778463834 0.018692277298877655 0.020557479283651925 0.015594411756460633 0.008520161551433196 0.004474689044173032 0.0017588384894984984
+0.005624107037659056 0.008142232076509406 0.00936112702492297 0.010557606715164935 0.008520161551433196 0.006366051976845064 0.003724161849033904 0.0016865661669981432
+0.0025710258458044666 0.0038206769491655667 0.004242783507762443 0.004816165433252426 0.004474689044173032 0.0037241618490339045 0.0035181427821568347 0.0014757595136650808
+0.0009246286420048678 0.001342344168977523 0.001493691722655789 0.0017313742322655548 0.0017588384894984986 0.0016865661669981432 0.0014757595136650808 0.0007557442312393396
diff --git a/data/MINERvA/CCQE/Q2QE_nu_data_fluxfix.txt b/data/MINERvA/CCQE/Q2QE_nu_data_fluxfix.txt
new file mode 100755
index 0000000..f000e17
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_nu_data_fluxfix.txt
@@ -0,0 +1,9 @@
+0.0 9.74134032934e-39 1.05285865039e-39
+0.025 1.27053453213e-38 1.38221256044e-39
+0.05 1.41936302043e-38 1.48916154835e-39
+0.1 1.31214085033e-38 1.46812981425e-39
+0.2 9.27620248836e-39 1.03320457659e-39
+0.4 4.0394169746e-39 6.11769662317e-40
+0.8 1.44869365053e-39 5.15300371428e-40
+1.2 4.79844766693e-40 2.36519334495e-40
+2.0 0.0 0.0
diff --git a/data/MINERvA/CCQE/Q2QE_numu_covar.txt b/data/MINERvA/CCQE/Q2QE_numu_covar.txt
new file mode 100755
index 0000000..ec94333
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numu_covar.txt
@@ -0,0 +1,8 @@
+1.000 0.869 0.882 0.873 0.832 0.690 0.415 0.327
+0.869 1.000 0.905 0.917 0.882 0.727 0.457 0.357
+0.882 0.905 1.000 0.945 0.928 0.751 0.455 0.356
+0.873 0.917 0.945 1.000 0.946 0.788 0.481 0.385
+0.832 0.882 0.928 0.946 1.000 0.865 0.600 0.514
+0.690 0.727 0.751 0.788 0.865 1.000 0.756 0.741
+0.415 0.457 0.455 0.481 0.600 0.756 1.000 0.888
+0.327 0.357 0.356 0.385 0.514 0.741 0.888 1.000
diff --git a/data/MINERvA/CCQE/Q2QE_numu_covar_SHAPE-extracted.txt b/data/MINERvA/CCQE/Q2QE_numu_covar_SHAPE-extracted.txt
new file mode 100755
index 0000000..61e62a9
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numu_covar_SHAPE-extracted.txt
@@ -0,0 +1,8 @@
+ 1.0000 0.6907 0.7141 0.6846 0.5615 -0.1831 -0.6084 -0.6567
+ 0.6907 1.0000 0.7493 0.7729 0.6589 -0.2225 -0.6618 -0.7357
+ 0.7141 0.7493 1.0000 0.8424 0.7965 -0.2238 -0.7659 -0.8301
+ 0.6846 0.7729 0.8424 1.0000 0.8187 -0.1823 -0.8180 -0.8756
+ 0.5615 0.6589 0.7965 0.8187 1.0000 -0.1550 -0.8038 -0.8625
+ -0.1831 -0.2225 -0.2238 -0.1823 -0.1550 1.0000 -0.2195 -0.0233
+ -0.6084 -0.6618 -0.7659 -0.8180 -0.8038 -0.2195 1.0000 0.7515
+ -0.6567 -0.7357 -0.8301 -0.8756 -0.8625 -0.0233 0.7515 1.0000
diff --git a/data/MINERvA/CCQE/Q2QE_numu_covar_SHAPE.txt b/data/MINERvA/CCQE/Q2QE_numu_covar_SHAPE.txt
new file mode 100755
index 0000000..caac26f
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numu_covar_SHAPE.txt
@@ -0,0 +1,8 @@
+ 1.000 0.689 0.712 0.684 0.557 -0.175 -0.585 -0.623
+ 0.689 1.000 0.745 0.770 0.653 -0.211 -0.631 -0.694
+ 0.712 0.745 1.000 0.840 0.793 -0.212 -0.736 -0.787
+ 0.684 0.770 0.840 1.000 0.817 -0.173 -0.780 -0.825
+ 0.557 0.653 0.793 0.817 1.000 -0.129 -0.752 -0.795
+-0.175 -0.211 -0.212 -0.173 -0.129 1.000 -0.142 0.060
+-0.585 -0.631 -0.736 -0.780 -0.752 -0.142 1.000 0.760
+-0.623 -0.694 -0.787 -0.825 -0.795 0.060 0.760 1.000
diff --git a/data/MINERvA/CCQE/Q2QE_numu_data.txt b/data/MINERvA/CCQE/Q2QE_numu_data.txt
new file mode 100755
index 0000000..522889c
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numu_data.txt
@@ -0,0 +1,9 @@
+0 0.761E-38 0.104E-38
+0.025 1.146E-38 0.144E-38
+0.05 1.343E-38 0.160E-38
+0.1 1.490E-38 0.172E-38
+0.2 1.063E-38 0.122E-38
+0.4 0.582E-38 0.075E-38
+0.8 0.242E-38 0.055E-38
+1.2 0.097E-38 0.025E-38
+2.0 0 0
diff --git a/data/MINERvA/CCQE/Q2QE_numu_data_SHAPE-extracted.txt b/data/MINERvA/CCQE/Q2QE_numu_data_SHAPE-extracted.txt
new file mode 100755
index 0000000..254e0e3
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numu_data_SHAPE-extracted.txt
@@ -0,0 +1,9 @@
+0.000 0.761000E-38 0.069655E-38
+0.025 1.146000E-38 0.090193E-38
+0.050 1.343000E-38 0.096715E-38
+0.100 1.490000E-38 0.097095E-38
+0.200 1.063000E-38 0.050770E-38
+0.400 0.582000E-38 0.021494E-38
+0.800 0.242000E-38 0.034482E-38
+1.200 0.097000E-38 0.017389E-38
+2.000 0 0
diff --git a/data/MINERvA/CCQE/Q2QE_numu_data_SHAPE.txt b/data/MINERvA/CCQE/Q2QE_numu_data_SHAPE.txt
new file mode 100755
index 0000000..6b61190
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numu_data_SHAPE.txt
@@ -0,0 +1,9 @@
+0 0.0215 0.0020
+0.025 0.0324 0.0026
+0.05 0.0760 0.0053
+0.1 0.1685 0.0109
+0.2 0.2406 0.0114
+0.4 0.2633 0.0103
+0.8 0.1095 0.0158
+1.2 0.0881 0.0160
+2.0 0 0
diff --git a/data/MINERvA/CCQE/Q2QE_numubar_covar.txt b/data/MINERvA/CCQE/Q2QE_numubar_covar.txt
new file mode 100755
index 0000000..a132092
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numubar_covar.txt
@@ -0,0 +1,8 @@
+1.000 0.884 0.911 0.901 0.828 0.700 0.362 0.297
+0.884 1.000 0.913 0.904 0.820 0.675 0.343 0.278
+0.911 0.913 1.000 0.942 0.875 0.726 0.353 0.319
+0.901 0.904 0.942 1.000 0.933 0.825 0.431 0.413
+0.828 0.820 0.875 0.933 1.000 0.916 0.541 0.566
+0.700 0.675 0.726 0.825 0.916 1.000 0.643 0.653
+0.362 0.343 0.353 0.431 0.541 0.643 1.000 0.752
+0.297 0.278 0.319 0.413 0.566 0.653 0.752 1.000
\ No newline at end of file
diff --git a/data/MINERvA/CCQE/Q2QE_numubar_covar_SHAPE-extracted.txt b/data/MINERvA/CCQE/Q2QE_numubar_covar_SHAPE-extracted.txt
new file mode 100755
index 0000000..fe9b9df
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numubar_covar_SHAPE-extracted.txt
@@ -0,0 +1,8 @@
+ 1.0000 0.6807 0.7280 0.6809 0.2311 -0.4840 -0.4692 -0.6250
+ 0.6807 1.0000 0.7461 0.7196 0.2475 -0.5438 -0.4818 -0.6337
+ 0.7280 0.7461 1.0000 0.7831 0.3545 -0.5714 -0.5991 -0.6880
+ 0.6809 0.7196 0.7831 1.0000 0.3938 -0.4729 -0.6834 -0.7416
+ 0.2311 0.2475 0.3545 0.3938 1.0000 -0.1136 -0.6939 -0.4946
+ -0.4840 -0.5438 -0.5714 -0.4729 -0.1136 1.0000 0.0116 0.1227
+ -0.4692 -0.4818 -0.5991 -0.6834 -0.6939 0.0116 1.0000 0.5466
+ -0.6250 -0.6337 -0.6880 -0.7416 -0.4946 0.1227 0.5466 1.0000
diff --git a/data/MINERvA/CCQE/Q2QE_numubar_covar_SHAPE.txt b/data/MINERvA/CCQE/Q2QE_numubar_covar_SHAPE.txt
new file mode 100755
index 0000000..6fd4d51
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numubar_covar_SHAPE.txt
@@ -0,0 +1,8 @@
+ 1.000 0.675 0.722 0.672 0.221 -0.464 -0.440 -0.577
+ 0.675 1.000 0.742 0.716 0.241 -0.517 -0.450 -0.585
+ 0.722 0.742 1.000 0.779 0.347 -0.543 -0.562 -0.635
+ 0.672 0.716 0.779 1.000 0.386 -0.434 -0.627 -0.671
+ 0.221 0.241 0.347 0.386 1.000 -0.051 -0.571 -0.375
+-0.464 -0.517 -0.543 -0.434 -0.051 1.000 0.080 0.186
+-0.440 -0.450 -0.562 -0.627 -0.571 0.080 1.000 0.568
+-0.577 -0.585 -0.635 -0.671 -0.375 0.186 0.568 1.000
diff --git a/data/MINERvA/CCQE/Q2QE_numubar_data.txt b/data/MINERvA/CCQE/Q2QE_numubar_data.txt
new file mode 100755
index 0000000..9303a12
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numubar_data.txt
@@ -0,0 +1,9 @@
+0 0.813E-38 0.108E-38
+0.025 1.061E-38 0.142E-38
+0.05 1.185E-38 0.154E-38
+0.1 1.096E-38 0.137E-38
+0.2 0.777E-38 0.103E-38
+0.4 0.340E-38 0.051E-38
+0.8 0.123E-38 0.026E-38
+1.2 0.041E-38 0.011E-38
+2.0 0 0
diff --git a/data/MINERvA/CCQE/Q2QE_numubar_data_SHAPE-extracted.txt b/data/MINERvA/CCQE/Q2QE_numubar_data_SHAPE-extracted.txt
new file mode 100755
index 0000000..7576b3d
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numubar_data_SHAPE-extracted.txt
@@ -0,0 +1,9 @@
+0.000 0.813000E-38 0.064142E-38
+0.025 1.061000E-38 0.086711E-38
+0.050 1.185000E-38 0.082845E-38
+0.100 1.096000E-38 0.055302E-38
+0.200 0.777000E-38 0.024172E-38
+0.400 0.340000E-38 0.016431E-38
+0.800 0.123000E-38 0.019152E-38
+1.200 0.041000E-38 0.008404E-38
+2.000 0 0
diff --git a/data/MINERvA/CCQE/Q2QE_numubar_data_SHAPE.txt b/data/MINERvA/CCQE/Q2QE_numubar_data_SHAPE.txt
new file mode 100755
index 0000000..47db0c4
--- /dev/null
+++ b/data/MINERvA/CCQE/Q2QE_numubar_data_SHAPE.txt
@@ -0,0 +1,9 @@
+0 0.0345 0.0027
+0.025 0.0450 0.0036
+0.05 0.1005 0.0069
+0.1 0.1859 0.0093
+0.2 0.2659 0.0083
+0.4 0.2311 0.0115
+0.8 0.0835 0.0130
+1.2 0.0557 0.0111
+2.0 0 0
diff --git a/data/MINERvA/CCQE/antinu_numu_flux.csv b/data/MINERvA/CCQE/antinu_numu_flux.csv
new file mode 100755
index 0000000..955b617
--- /dev/null
+++ b/data/MINERvA/CCQE/antinu_numu_flux.csv
@@ -0,0 +1,19 @@
+1500 0.281E-008
+2000 0.368E-008
+2500 0.444E-008
+3000 0.448E-008
+3500 0.349E-008
+4000 0.205E-008
+4500 0.106E-008
+5000 0.061E-008
+5500 0.038E-008
+6000 0.029E-008
+6500 0.022E-008
+7000 0.018E-008
+7500 0.016E-008
+8000 0.013E-008
+8500 0.012E-008
+9000 0.010E-008
+9500 0.009E-008
+10000 0
+
diff --git a/data/MINERvA/CCQE/createDataFile.py b/data/MINERvA/CCQE/createDataFile.py
new file mode 100755
index 0000000..839c0fc
--- /dev/null
+++ b/data/MINERvA/CCQE/createDataFile.py
@@ -0,0 +1,203 @@
+from ROOT import *
+import sys
+
+def getDecomp( hist):
+ nBins = hist.GetNbinsX()
+ Mat = TMatrixD(nBins,nBins)
+
+ for i in range(nBins):
+ for j in range(nBins):
+ Mat[i][j] = hist.GetBinContent(i+1,j+1)
+
+ tempMat = Mat.Clone()
+ testMat = Mat.Clone()
+
+ decompMat = TDecompSVD(tempMat)
+ decompMat.Decompose()
+
+ V = decompMat.GetV()
+ Sig = decompMat.GetSig()
+
+ S = TMatrixD(nBins,nBins)
+
+ Vt = V.Clone()
+ Vt = Vt.Transpose(Vt)
+
+ for i in range(nBins):
+ S[i][i] = sqrt(Sig[i])
+
+ J = TMatrixD(nBins,nBins)
+ J = V * S * Vt
+
+ newhist = hist.Clone()
+
+ for i in range(nBins):
+ for j in range(nBins):
+ newhist.SetBinContent(i+1,j+1,J[i][j])
+
+ return newhist
+
+def getInvert(hist):
+
+ mat = TMatrixD(hist.GetNbinsX(),hist.GetNbinsX())
+
+ for i in range(hist.GetNbinsX()):
+ for j in range(hist.GetNbinsX()):
+ mat[i][j] = hist.GetBinContent(i+1,j+1)
+
+ invmat = mat.Clone()
+
+ invmat.SetTol(1.6E-20)
+ decomp = TDecompSVD(invmat)
+ decomp.SetTol(1.6E-20)
+
+ decomp.Decompose()
+ decomp.Invert(invmat)
+ invhist = hist.Clone(hist.GetName()+"_invert")
+ for i in range(hist.GetNbinsX()):
+ for j in range(hist.GetNbinsX()):
+ invhist.SetBinContent(i+1,j+1,invmat[i][j])
+
+ ident = hist.Clone(hist.GetName()+"_ident")
+ for i in range(hist.GetNbinsX()):
+ for j in range(hist.GetNbinsX()):
+ val_ij = 0.0
+ for k in range(hist.GetNbinsX()):
+ val_ij += invmat[i][k]*mat[k][j]
+ ident.SetBinContent(i+1,j+1,val_ij)
+
+# hist.Scale(1E-76)
+# invhist.Scale(1E76)
+ return invhist, ident
+
+
+measurementName = str(sys.argv[1])
+dataFile = str(sys.argv[2])
+covFile = str(sys.argv[3])
+dataFile_shp = str(sys.argv[4])
+covFile_shp = str(sys.argv[5])
+
+print measurementName
+print dataFile
+print covFile
+
+plotTitles = ";Q2;Cross;"
+covTitles = ";Q2;Q2;"
+
+gr = TGraphErrors(dataFile,"%lg %lg %lg")
+
+xBins = gr.GetX()
+yBins = gr.GetY()
+yErr = gr.GetEY()
+nBins = gr.GetN()
+
+print "xbins = ",xBins
+print "yBins = ",yBins
+print "yErr = ",yErr
+print "nBins = ",nBins
+
+dataHist = TH1D("data",measurementName+plotTitles, nBins-1, xBins)
+correl = TH2D("fullcrl",measurementName+covTitles+";Correlation",nBins-1,xBins,nBins-1,xBins)
+correl_diag = TH2D("diagcrl",measurementName+covTitles+";Correlation",nBins-1,xBins,nBins-1,xBins)
+covar = TH2D("fullcov",measurementName+covTitles+";Covariance",nBins-1,xBins,nBins-1,xBins)
+covar_diag = TH2D("diagcov",measurementName+covTitles+";Covariance",nBins-1,xBins,nBins-1,xBins)
+
+with open(covFile,"r") as f:
+ row = 0
+ for line in f:
+ print yBins[row],yErr[row]
+
+ dataHist.SetBinContent(row+1,yBins[row])
+ dataHist.SetBinError(row+1,yErr[row])
+
+ for column in range(nBins-1):
+ covar.SetBinContent(row+1,column+1, float((line.split())[column]) *yErr[row]*yErr[column]*1E76)
+ correl.SetBinContent(row+1,column+1,float((line.split())[column]))
+
+ covar_diag.SetBinContent(row+1,column+1, (row==column)*float((line.split())[column]) *yErr[row]*yErr[column]*1E76)
+ correl_diag.SetBinContent(row+1,column+1,(row==column)*float((line.split())[column]))
+
+
+ row += 1
+ if row == nBins -1:
+ break
+
+outfile = TFile(measurementName,"RECREATE")
+outfile.cd()
+dataHist.Write()
+correl.Write()
+covar.Write()
+correl_diag.Write()
+covar_diag.Write()
+inv = getInvert(covar)
+inv[0].Write("fullcovinv")
+inv[1].Write("fullcovidt")
+
+inv = getInvert(covar_diag)
+inv[0].Write("diagcovinv")
+inv[1].Write("diagcovidt")
+
+getDecomp(covar).Write("fullcovdec")
+getDecomp(covar_diag).Write("diagcovdec")
+
+plotTitles = ";Q2;Cross;"
+covTitles = ";Q2;Q2;"
+
+gr = TGraphErrors(dataFile_shp,"%lg %lg %lg")
+
+xBins = gr.GetX()
+yBins = gr.GetY()
+yErr = gr.GetEY()
+nBins = gr.GetN()
+
+print xBins
+print yBins
+print yErr
+print nBins
+
+shp_dataHist = TH1D("shp_data",measurementName+plotTitles, nBins-1, xBins)
+shp_correl = TH2D("shp_fullcrl",measurementName+covTitles+";Correlation",nBins-1,xBins,nBins-1,xBins)
+shp_correl_diag = TH2D("shp_diagcrl",measurementName+covTitles+";Correlation",nBins-1,xBins,nBins-1,xBins)
+shp_covar = TH2D("shp_fullcov",measurementName+covTitles+";Covariance",nBins-1,xBins,nBins-1,xBins)
+shp_covar_diag = TH2D("shp_diagcov",measurementName+covTitles+";Covariance",nBins-1,xBins,nBins-1,xBins)
+
+print "REading shape form ",covFile_shp
+with open(covFile_shp,"r") as f:
+ row = 0
+ for line in f:
+ print yBins[row],yErr[row]
+
+ shp_dataHist.SetBinContent(row+1,yBins[row])
+ shp_dataHist.SetBinError(row+1,yErr[row])
+
+ for column in range(nBins-1):
+ shp_covar.SetBinContent(row+1,column+1, float((line.split())[column]) *yErr[row]*yErr[column]*1E76)
+ shp_correl.SetBinContent(row+1,column+1,float((line.split())[column]))
+
+ shp_covar_diag.SetBinContent(row+1,column+1, (row==column)*float((line.split())[column]) *yErr[row]*yErr[column]*1E76)
+ shp_correl_diag.SetBinContent(row+1,column+1,(row==column)*float((line.split())[column]))
+
+
+ row += 1
+
+ if row == nBins-1:
+ break
+
+shp_dataHist.Write()
+shp_correl.Write()
+shp_covar.Write()
+shp_correl_diag.Write()
+shp_covar_diag.Write()
+
+getDecomp(shp_covar).Write("shp_fullcovdec")
+getDecomp(shp_covar_diag).Write("shp_diagcovdec")
+
+
+inv = getInvert(shp_covar)
+inv[0].Write("shp_fullcovinv")
+inv[1].Write("shp_fullcovidt")
+
+inv = getInvert(shp_covar_diag)
+inv[0].Write("shp_diagcovinv")
+inv[1].Write("shp_diagcovidt")
+outfile.Close()
diff --git a/data/MINERvA/CCQE/createMaskedTail.py b/data/MINERvA/CCQE/createMaskedTail.py
new file mode 100755
index 0000000..b77c03e
--- /dev/null
+++ b/data/MINERvA/CCQE/createMaskedTail.py
@@ -0,0 +1,57 @@
+import sys
+
+maskedBins = map(int,sys.argv[3].split())
+
+print "Reading from ", sys.argv[1]," and ", sys.argv[2]
+
+with open(sys.argv[1],"r") as infile:
+
+ mskNum = len(maskedBins)
+
+ name = sys.argv[1].strip(".txt") + "_msk_" + str(mskNum) +".txt"
+ print name
+
+ with open(name,"w") as outfile:
+
+ #length = len(infile.readlines())
+ length = 0
+ for row, line in enumerate(infile):
+
+ nums = line.split()
+
+ print row, length,mskNum, length-1-mskNum
+
+ if row == length-1-mskNum:
+ outfile.write(nums[0] + ' 0.0 0.0 \n')
+
+ elif row in maskedBins:
+ continue
+
+
+ else:
+ for val in nums:
+ outfile.write(val + ' ')
+ outfile.write(' \n')
+
+
+
+with open(sys.argv[2],"r") as infile:
+
+ name = sys.argv[2].strip(".txt") + "_msk_" + str(mskNum) +".txt"
+
+ with open(name, "w") as outfile:
+
+ for row, line in enumerate(infile):
+
+ nums = line.split()
+
+ for column, val in enumerate(nums):
+
+ if column in maskedBins or row in maskedBins:
+ continue
+ else:
+ print val + " ",
+ outfile.write(val + ' ')
+
+ print ""
+ outfile.write(' \n')
diff --git a/data/MINERvA/CCQE/makeecov.py b/data/MINERvA/CCQE/makeecov.py
new file mode 100755
index 0000000..248983f
--- /dev/null
+++ b/data/MINERvA/CCQE/makeecov.py
@@ -0,0 +1,43 @@
+import sys
+infile = open(sys.argv[1],"r")
+outfile = open(sys.argv[2],"w")
+nbins = eval(sys.argv[3])
+
+myarray = nbins*[nbins*[0.0]]
+
+row = -1
+for line in infile:
+ if row == -1:
+ row +=1
+ continue
+
+
+ line.replace("$","")
+# print line.split(",")[1:]
+
+ col = 0
+ for obj in line.split(",")[1:]:
+
+ if (obj) == '':
+ col += 1
+ continue
+
+ print col, row,
+ number = float(obj.replace("$",""))
+ print number
+ myarray[row][col] = number
+ myarray[col][row] = number
+ col+=1
+# print number
+
+# numbers = map(float,line.split()[3:])
+# print numbers
+
+ row+=1
+
+
+for i in range(nbins):
+ for j in range(nbins):
+
+ outfile.write(str(myarray[j][i])+" ")
+ outfile.write("\n")
diff --git a/data/MINERvA/CCQE/nu_numu_flux.csv b/data/MINERvA/CCQE/nu_numu_flux.csv
new file mode 100755
index 0000000..26c6170
--- /dev/null
+++ b/data/MINERvA/CCQE/nu_numu_flux.csv
@@ -0,0 +1,19 @@
+1500 0.310E-008
+2000 0.409E-008
+2500 0.504E-008
+3000 0.526E-008
+3500 0.423E-008
+4000 0.253E-008
+4500 0.137E-008
+5000 0.081E-008
+5500 0.055E-008
+6000 0.043E-008
+6500 0.036E-008
+7000 0.031E-008
+7500 0.027E-008
+8000 0.024E-008
+8500 0.021E-008
+9000 0.019E-008
+9500 0.017E-008
+10000 0
+
diff --git a/data/MINERvA/CCQE/proton_Q2QE_nu_covar.txt b/data/MINERvA/CCQE/proton_Q2QE_nu_covar.txt
new file mode 100755
index 0000000..b2ce2d0
--- /dev/null
+++ b/data/MINERvA/CCQE/proton_Q2QE_nu_covar.txt
@@ -0,0 +1,7 @@
+1.00 0.48 0.24 0.19 0.19 0.14 0.26
+0.48 1.00 0.86 0.86 0.85 0.65 0.69
+0.24 0.86 1.00 0.94 0.93 0.78 0.82
+0.19 0.86 0.94 1.00 0.98 0.88 0.80
+0.19 0.85 0.93 0.98 1.00 0.90 0.80
+0.14 0.65 0.78 0.88 0.90 1.00 0.72
+0.26 0.69 0.82 0.80 0.80 0.80 1.00
diff --git a/data/MINERvA/CCQE/proton_Q2QE_nu_data.txt b/data/MINERvA/CCQE/proton_Q2QE_nu_data.txt
new file mode 100755
index 0000000..1b22cab
--- /dev/null
+++ b/data/MINERvA/CCQE/proton_Q2QE_nu_data.txt
@@ -0,0 +1,8 @@
+0.15 0.563E-38 0.062E-38
+0.29 0.654E-38 0.084E-38
+0.36 0.514E-38 0.082E-38
+0.46 0.393E-38 0.069E-38
+0.59 0.277E-38 0.051E-38
+0.83 0.131E-38 0.028E-38
+1.33 0.059E-38 0.011E-38
+2.00 0.0 0.0
diff --git a/data/MINERvA/CCQE/test.root b/data/MINERvA/CCQE/test.root
new file mode 100755
index 0000000..41daecc
Binary files /dev/null and b/data/MINERvA/CCQE/test.root differ
diff --git a/src/FCN/minimizerFCN.cxx b/src/FCN/minimizerFCN.cxx
index 7ce338e..7c0861f 100755
--- a/src/FCN/minimizerFCN.cxx
+++ b/src/FCN/minimizerFCN.cxx
@@ -1,373 +1,369 @@
#include "minimizerFCN.h"
#include <stdio.h>
#include "FitUtils.h"
minimizerFCN::minimizerFCN(std::string cardfile, TFile *outfile){
out = outfile;
card = cardfile;
FitPar::Config().out = out;
LoadSamples(card);
- useFullCovar = false; // default
+ useFullCovar = false; // default
this->current_iteration = 0;
filledMC = false;
randGen = new TRandom3();
randGen->SetSeed(time(NULL));
};
minimizerFCN::~minimizerFCN() {
for (std::list<MeasurementBase*>::iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
delete exp;
}
};
double minimizerFCN::DoEval(const double *x) const {
dialChanged = false;
- std::cout<<"Evaluating"<<std::endl;
// WEIGHT ENGINE
FitBase::GetRW()->UpdateWeightEngine(x);
dialChanged = FitBase::GetRW()->HasDialChanged();
FitBase::EvtManager().ResetWeightFlags();
- std::cout<<"Reconfiguring samples"<<std::endl;
// SORT SAMPLES
ReconfigureSamples();
-
- std::cout<<"Getting LIKE"<<std::endl;
// GET TEST STAT
double likelihood = GetLikelihood();
// PRINT PROGRESS
LOG(FIT) << "Current Stat (iter. "<< this->current_iteration << ") = "<<likelihood<<std::endl;
return likelihood;
}
int minimizerFCN::GetNDOF() {
int nDOF = 0;
for (std::list<MeasurementBase*>::iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
nDOF += exp->GetNDOF();
}
return nDOF;
}
double minimizerFCN::GetLikelihood() const {
double chi2 = 0.0;
if (!FitPar::Config().GetParB("JOINT_COVARIANCE")) {
for (std::list<MeasurementBase*>::const_iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
chi2 += exp->GetLikelihood();
}
} else {
std::vector<double> mcBins;
std::vector<double> dataBins;
std::vector<double> difBins;
mcBins.clear();
dataBins.clear();
difBins.clear();
for (std::list<MeasurementBase*>::const_iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
std::vector<TH1*> mcHists = exp->GetMCList();
std::vector<TH1*> dataHists = exp->GetDataList();
for (UInt_t hiter = 0; hiter < mcHists.size(); hiter++){
int dim = mcHists[hiter]->GetNbinsX()*mcHists[hiter]->GetNbinsY();
TH1* dataTemp = (TH1*)dataHists[hiter];
TH1* mcTemp = (TH1*)mcHists[hiter];
for (int ibin =0; ibin < dim;ibin++ ){
mcBins .push_back(mcTemp->GetBinContent(ibin+1));
dataBins.push_back(dataTemp->GetBinContent(ibin+1));
difBins.push_back(mcTemp->GetBinContent(ibin+1) - dataTemp->GetBinContent(ibin+1));
}
}
}
int dim = difBins.size();
for (int i = 0; i < dim; i++){
for (int j = 0; j < dim; j++){
chi2 += difBins.at(i) * difBins.at(j) * 1E38 * 1E38 * (*this->FullCovar)(i,j);
}
}
}
return chi2;
};
void minimizerFCN::CreateFullCovarMatrix(){
/*// Hack to get NBins for full covar
int dim = 0;
for (std::list<MeasurementBase*>::const_iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
std::vector<TH1*> mcHists = exp->GetMCList();
for (int hiter = 0; hiter < mcHists.size(); hiter++)
dim += mcHists.at(hiter)->GetNbinsX()*mcHists.at(hiter)->GetNbinsY();
}
// Create the full covar
(this->FullCovar) = new TMatrixDSym(dim);
// LOG(MIN)<<"Created matrix with dim = "<<dim<<std::endl;
int row = 0;
int col = 0;
int offset = 0;
for (std::list<MeasurementBase*>::const_iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
TH2D temp = (TH2D)exp->GetCovarMatrix();
int nbins = temp.GetNbinsX();
for (int i = 0; i < nbins; i++){
for (int j = 0; j < nbins; j++){
// LOG(MIN)<<"Before Fill covar "<<row<<","<<col<<std::endl;
(*this->FullCovar)(row, col) = (temp.GetBinContent(i+1,j+1));
col++;
// LOG(MIN)<<"Filling covar "<<row<<","<<col<<std::endl;
}
col = offset;
row++;
}
// offset col for next exp
col = nbins + offset;
offset += nbins;
}
*/
return;
};
void minimizerFCN::LoadSamples(std::string cardFile)
{
LOG(MIN)<<"Initializing Samples"<<std::endl;
// Read the card file here and load objects
std::string line;
std::ifstream card(cardFile.c_str(), ifstream::in);
while(std::getline(card, line, '\n')){
std::istringstream stream(line);
std::string token;
int val = 0;
std::string name;
std::string type;
std::string files;
double norm;
bool FoundSample = false;
// check the type
while(std::getline(stream, token, ' ')){
// Strip any leading whitespace from the stream
stream >> std::ws;
// Ignore comments
if (token.c_str()[0] == '#') continue;
if (val == 0){
if (token.compare("sample") !=0 ){
break;
}
FoundSample = true;
} else if (val == 1) {
name = token;
} else if (val == 2) {
type = token;
} else if (val == 3) {
files = token;
} else if (val == 4) {
std::istringstream stemp(token);
stemp >> norm;
} else break;
val++;
}
if (!FoundSample) continue;
out->cd();
bool LoadedSample = SampleUtils::LoadSample( &fChain, name, files, type, fakeData, FitBase::GetRW() );
if (!LoadedSample) {
ERR(FTL) << "Could not load sample provided: "<<name<<std::endl;
continue;
}
sampleNames.push_back(name);
sampleFiles.push_back(files);
sampleTypes.push_back(type);
sampleNorms.push_back(norm);
}
card.close();
};
// Used to override signal skipping functions
void minimizerFCN::ReconfigureSamples(bool fullconfig) const{
int starttime = time(NULL);
this->current_iteration = this->current_iteration + 1;
LOG(MIN) << "Starting Reconfigure iter. "<<this->current_iteration<<std::endl;
// Loop over all Measurement Classes
std::list<MeasurementBase*>::const_iterator iterSam = fChain.begin();
for ( ; iterSam != fChain.end(); iterSam++){
MeasurementBase* exp = (*iterSam);
// If only norm has changed...
if (!dialChanged and !fullconfig and !filledMC){
exp->Renormalise();
continue;
}
if (!fullconfig) exp->ReconfigureFast();
else exp->Reconfigure();
}
filledMC = true;
LOG(MIN) << "-> Time Taken "<< time(NULL) - starttime << "s"<<std::endl;
}
void minimizerFCN::SetFakeData(std::string fakeOpt){
-
+
for (std::list<MeasurementBase*>::const_iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
exp->SetFakeDataValues(fakeOpt);
}
return;
};
TH1D* minimizerFCN::GetXSecPlot(std::string type){
bool data = true;
if (!type.compare("MC")) data = false;
std::vector<double> xsection;
std::vector<double> xsection_errs;
std::vector<std::string> samplenames;
for (std::list<MeasurementBase*>::const_iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
samplenames.push_back(exp->GetName());
std::vector<double> vals;// = exp->GetXSec(type);
xsection.push_back(vals[0]);
xsection_errs.push_back(vals[1]);
}
int nsamples = xsection.size();
std::string title = "sample_xsecs_";
if (data) title += "data";
else title += "MC";
TH1D* xsecPlot = new TH1D(title.c_str(),title.c_str(), nsamples,0,nsamples);
for (int i = 0; i < nsamples; i++){
xsecPlot->SetBinContent(i+1, xsection.at(i));
xsecPlot->SetBinError(i+1, xsection_errs.at(i));
std::string sample = (samplenames.at(i));
xsecPlot->GetXaxis()->SetBinLabel(i+1, (sample).c_str());
}
return xsecPlot;
}
void minimizerFCN::ThrowSamples(){
std::list<MeasurementBase*>::const_iterator iter = fChain.begin();
for ( ; iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
exp->ThrowCovariance();
}
}
void minimizerFCN::ReconfigureSignal(){
this->ReconfigureSamples(false);
return;
}
void minimizerFCN::ReconfigureAllEvents() const{
this->ReconfigureSamples(true);
return;
}
void minimizerFCN::Write(){
- // Loop over individual experiments and save relevant information
- // Loop over all returned STL vectors (joint fits have more than one set of return values)
+ // Loop over individual experiments and save relevant information
+ // Loop over all returned STL vectors (joint fits have more than one set of return values)
LOG(MIN)<<"Writing each of the data classes:"<<std::endl;
for (std::list<MeasurementBase*>::iterator iter = fChain.begin(); iter != fChain.end(); iter++){
MeasurementBase* exp = *iter;
exp->Write();
}
return;
- // Save data and MC cross-section plots
+ // Save data and MC cross-section plots
TH1D* tempMCXsec = GetXSecPlot("MC");
tempMCXsec->Write();
TH1D* tempDataXsec = GetXSecPlot("DATA");
tempDataXsec->Write();
if (useFullCovar){
TH2D* temp = new TH2D(*FullCovar);
- // Make neater by removing empty bins
+ // Make neater by removing empty bins
int nbinsx = temp->GetNbinsX();
int nbinsy = temp->GetNbinsY();
TH2D* finalcov = new TH2D("cov","cov",nbinsx,0,nbinsx,nbinsy,0,nbinsy);
for (int i =0; i < nbinsx; i++){
for (int j = 0; j < nbinsy; j++){
if (temp->GetBinContent(i+1,j+1) == 0.0) continue;
finalcov->SetBinContent(i+1,j+1,temp->GetBinContent(i+1,j+1));
}
}
- // Save the output
+ // Save the output
finalcov->Write("FullChi2Covariance");
delete temp;
delete finalcov;
}
};
diff --git a/src/FitBase/BaseFitEvt.h b/src/FitBase/BaseFitEvt.h
index aff269d..ae05af7 100755
--- a/src/FitBase/BaseFitEvt.h
+++ b/src/FitBase/BaseFitEvt.h
@@ -1,95 +1,102 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NuFiX.
*
* NuFiX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NuFiX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef FITEVENTBASE_H_SEEN
#define FITEVENTBASE_H_SEEN
#include "TLorentzVector.h"
#include "FitParticle.h"
#include "TSpline.h"
#ifdef __NEUT_ENABLED__
#include "neutvect.h"
#include "neutpart.h"
#endif
#ifdef __NUWRO_ENABLED__
#include "event1.h"
#endif
#ifdef __GENIE_ENABLED__
#include "EVGCore/EventRecord.h"
#include "GHEP/GHepRecord.h"
#include "Ntuple/NtpMCEventRecord.h"
using namespace genie;
#endif
#include "TArrayD.h"
+#include "NuanceEvent.h"
/*!
* \addtogroup FitBase
* @{
*/
//! Global Enum to define generator type being read with FitEvent
-enum generator_event_type { kUNKNOWN=999, kNEUT=0, kNUWRO=2, kGENIE=5, kEVTSPLINE=6 };
+enum generator_event_type { kUNKNOWN=999, kNEUT=0, kNUWRO=2, kGENIE=5, kEVTSPLINE=6, kNUANCE=7 };
//! Base Event Class used to store just the generator event pointers and flat variables
class BaseFitEvt {
public:
BaseFitEvt();
~BaseFitEvt();
BaseFitEvt(const BaseFitEvt* obj);
double X_VAR;
double Y_VAR;
double Z_VAR;
int Mode;
double E;
double Weight;
double InputWeight;
double RWWeight;
double CustomWeight;
bool Signal;
UInt_t Index;
UInt_t BinIndex;
UInt_t fType;
TArrayD* dial_coeff; // Depedendent on dials (needs header file provided)
// NEUT : Default
#ifdef __NEUT_ENABLED__
NeutVect* neut_event; //!< Pointer to Neut Vector
#endif
// NUWRO
#ifdef __NUWRO_ENABLED__
event* nuwro_event; //!< Pointer to Nuwro event
#endif
// GENIE
#ifdef __GENIE_ENABLED__
NtpMCEventRecord* genie_event; //!< Pointer to NTuple Genie Event
GHepRecord* genie_record; //!< Pointer to actually accessible Genie Record
#endif
+ NuanceEvent* nuance_event;
+
double GetWeight(){ return InputWeight * RWWeight * CustomWeight; };
};
#endif
+
+
+
+
diff --git a/src/FitBase/CMakeLists.txt b/src/FitBase/CMakeLists.txt
index 1d35d4a..c69ed61 100644
--- a/src/FitBase/CMakeLists.txt
+++ b/src/FitBase/CMakeLists.txt
@@ -1,62 +1,63 @@
# Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
################################################################################
# This file is part of NuFiX.
#
# NuFiX is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# NuFiX is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
################################################################################
set(IMPLFILES
BaseFitEvt.cxx
FitParticle.cxx
FitWeight.cxx
Measurement1D.cxx
EventManager.cxx
FitSpline.cxx
InputHandler.cxx
Measurement2D.cxx
FitEvent.cxx
FitSplineHead.cxx
JointMeas1D.cxx
MeasurementBase.cxx
GeneratorUtils.cxx
)
set(HEADERFILES
+NuanceEvent.h
BaseFitEvt.h FitEvent.h FitSplineHead.h JointMeas1D.h Measurement2D.h
EventManager.h FitParticle.h FitWeight.h MeasurementBase.h
FitSpline.h InputHandler.h Measurement1D.h GeneratorUtils.h
)
set(LIBNAME FitBase)
if(CMAKE_BUILD_TYPE MATCHES DEBUG)
add_library(${LIBNAME} STATIC ${IMPLFILES})
else(CMAKE_BUILD_TYPE MATCHES RELEASE)
add_library(${LIBNAME} SHARED ${IMPLFILES})
endif()
include_directories(${RWENGINE_INCLUDE_DIRECTORIES})
include_directories(${CMAKE_SOURCE_DIR}/src/Utils)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(${LIBNAME} PROPERTIES VERSION
"${ExtFit_VERSION_MAJOR}.${ExtFit_VERSION_MINOR}.${ExtFit_VERSION_REVISION}")
set_target_properties(${LIBNAME} PROPERTIES LINK_FLAGS ${ROOT_LD_FLAGS})
install(TARGETS ${LIBNAME} DESTINATION lib)
#Can uncomment this to install the headers... but is it really neccessary?
install(FILES ${HEADERFILES} DESTINATION include)
set(MODULETargets ${MODULETargets} ${LIBNAME} PARENT_SCOPE)
diff --git a/src/FitBase/FitEvent.cxx b/src/FitBase/FitEvent.cxx
index 78530a2..c2dde1b 100644
--- a/src/FitBase/FitEvent.cxx
+++ b/src/FitBase/FitEvent.cxx
@@ -1,250 +1,314 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NuFiX.
*
* NuFiX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NuFiX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "FitEvent.h"
#include "TObjArray.h"
//***************************************************
// NEUT GENERATOR SPECIFIC
#ifdef __NEUT_ENABLED__
void FitEvent::SetEventAddress(NeutVect** tempevent){
this->fType = kNEUT;
neut_event = *tempevent;
return;
}
void FitEvent::NeutKinematics(){
/*
header information that needs filling
UInt_t fMode;
UInt_t EventNo;
Double_t TotCrs;
Double_t PFSurf;
Double_t PFMax;
UInt_t TargetA;
UInt_t TargetZ;
UInt_t TargetH;
UInt_t Ibound;
UInt_t fNParticles;
UInt_t fNFSIParticles;
UInt_t fNFinalParticles;
*/
// Reset number of particles etc for the event
this->ResetEvent();
this->Mode = neut_event->Mode;
this->fEventNo = neut_event->EventNo;
this->TotCrs = neut_event->Totcrs;
this->PFSurf = neut_event->PFSurf;
this->PFMax = neut_event->PFMax;
this->TargetA = neut_event->TargetA;
this->TargetZ = neut_event->TargetZ;
this->TargetH = neut_event->TargetH;
this->Ibound = neut_event->Ibound;
// Particle Counts
this->fNParticles = neut_event->Npart();
this->all_particles.clear();
// count up other particles
for (UInt_t i = 0; i < this->fNParticles; i++){
this->all_particles.push_back(FitParticle(neut_event->PartInfo(i)));
}
// FSI Vertex Counting Should go here.
return;
};
#endif
//***************************************************
//***************************************************
// NUWRO GENERATOR SPECIFIC
#ifdef __NUWRO_ENABLED__
//***************************************************
void FitEvent::SetEventAddress(event** tempevent){
//***************************************************
this->fType = kNUWRO;
nuwro_event = *(tempevent);
return;
}
//***************************************************
void FitEvent::NuwroKinematics(){
//***************************************************
this->ResetEvent();
// Sort Mode
this->TotCrs = nuwro_event->weight;
this->Mode = GeneratorUtils::ConvertNuwroMode(nuwro_event);
// These need to be set somehow...
this->fEventNo = 0;
this->PFSurf = nuwro_event->par.nucleus_kf;
this->PFMax = nuwro_event->par.nucleus_kf;
this->TargetA = nuwro_event->par.nucleus_n;
this->TargetZ = nuwro_event->par.nucleus_p;
this->TargetH = 0;
this->Ibound = (this->TargetA + this->TargetZ) == 1;
// Setup particles
all_particles.clear();
// Incoming particles state 0
for (UInt_t i = 0; i < nuwro_event->in.size(); i++)
all_particles.push_back( FitParticle(&nuwro_event->in[i], 0) );
// Intermediate Particles state 2
for (UInt_t i = 0; i < nuwro_event->out.size(); i++)
all_particles.push_back( FitParticle(&nuwro_event->out[i], 2) );
// Outgoing Particles State 1
for (UInt_t i = 0; i < nuwro_event->post.size(); i++)
all_particles.push_back( FitParticle(&nuwro_event->post[i], 1) );
this->fNParticles = this->all_particles.size();
return;
};
#endif //< NuWro ifdef
//***************************************************
//***************************************************
// REQUIRED FUNCTIONS FOR GENIE
#ifdef __GENIE_ENABLED__
//***************************************************
void FitEvent::SetEventAddress(NtpMCEventRecord** tempevent){
//***************************************************
this->fType = kGENIE;
genie_event = *tempevent;
};
//***************************************************
void FitEvent::GENIEKinematics(){
//***************************************************
this->ResetEvent();
// make the accessible record
genie_record = static_cast<GHepRecord*>(genie_event->event);
this->Mode = utils::ghep::NeutReactionCode(genie_record);
this->TotCrs = genie_record->XSec();
// These need to be set somehow...
this->fEventNo = 0;
this->PFSurf = 0;
this->PFMax = 0;
this->TargetA = 0;
this->TargetZ = 0;
this->TargetH = 0;
this->Ibound = 0;
this->fNParticles = genie_record->GetEntries();
// State defines where, 0 = ALL, 1 = Incoming, 2 = FSI, 3 = Final
int count = 0;
GHepParticle * p = 0;
TObjArrayIter iter(genie_record);
all_particles.clear();
while(p = dynamic_cast<genie::GHepParticle*>(iter.Next())){
if (!p) continue;
all_particles.push_back(FitParticle(p));
}
return;
};
#endif //< GENIE ifdef
//***************************************************
//***************************************************
// Refill all the particle vectors etc for the event
void FitEvent::CalcKinematics(){
//***************************************************
#ifdef __NEUT_ENABLED__
if ( fType == kNEUT ) this->NeutKinematics();
#endif
#ifdef __NUWRO_ENABLED__
if ( fType == kNUWRO ) this->NuwroKinematics();
#endif
#ifdef __GENIE_ENABLED__
if ( fType == kGENIE ) this->GENIEKinematics();
#endif
+ if ( fType == kNUANCE ) this->NuanceKinematics();
+
return;
};
//***************************************************
void FitEvent::ResetEvent(){
//***************************************************
this->Mode = 999;
this->fEventNo = 0;
this->TotCrs = 0.0;
this->PFSurf = 0.0;
this->PFMax = 0.0;
this->TargetA = 0.0;
this->TargetZ = 0.0;
this->TargetH = 0.0;
this->Ibound = 0.0;
this->fNParticles = 0;
this->fNFSIParticles = 0;
this->fNFinalParticles = 0;
this->fCurrPartIndex = 999;
return;
}
//***************************************************
FitParticle* FitEvent::PartInfo(UInt_t i){
//***************************************************
if (i < all_particles.size()){
return &(all_particles.at(i));
} else {
return NULL;
}
}
+
+
+//***************************************************
+void FitEvent::NuanceKinematics(){
+//***************************************************
+
+ this->ResetEvent();
+ // Read From Nuance_event
+
+ // Sort Mode
+ this->TotCrs = 1.0; // NEEDS SORTING
+ this->Mode = 1.0; // NEEDS SORTING
+
+ // These need to be set somehow...
+ this->fEventNo = 0;
+ this->PFSurf = 0.0;
+ this->PFMax = 0.0;
+ this->TargetA = 0.0;
+ this->TargetZ = 0.0;
+ this->TargetH = 0;
+ this->Ibound = 0.0;
+
+ // Setup particles
+ all_particles.clear();
+
+ // incoming neutrino
+ all_particles.push_back( FitParticle( nuance_event->p_neutrino[0],
+ nuance_event->p_neutrino[1],
+ nuance_event->p_neutrino[2],
+ nuance_event->p_neutrino[3],
+ nuance_event->neutrino,
+ 0 ) );
+
+ // incoming hadron
+ all_particles.push_back( FitParticle( nuance_event->p_targ[0],
+ nuance_event->p_targ[1],
+ nuance_event->p_targ[2],
+ nuance_event->p_targ[3],
+ nuance_event->target,
+ 0 ) );
+
+
+ // for outgoing leptons
+ for (int i = 0; i < nuance_event->n_leptons; i++){
+ all_particles.push_back( FitParticle( nuance_event->p_lepton[0][i],
+ nuance_event->p_lepton[1][i],
+ nuance_event->p_lepton[2][i],
+ nuance_event->p_lepton[3][i],
+ nuance_event->lepton[i], 1 ) );
+ }
+
+ // for outgoing hadrons
+ for (int i = 0; i < nuance_event->n_hadrons; i++){
+ all_particles.push_back( FitParticle( nuance_event->p_hadron[0][i],
+ nuance_event->p_hadron[1][i],
+ nuance_event->p_hadron[2][i],
+ nuance_event->p_hadron[3][i],
+ nuance_event->hadron[i], 1 ) );
+ }
+
+ this->fNParticles = this->all_particles.size();
+}
diff --git a/src/FitBase/FitEvent.h b/src/FitBase/FitEvent.h
index c1899de..5f12e8d 100644
--- a/src/FitBase/FitEvent.h
+++ b/src/FitBase/FitEvent.h
@@ -1,217 +1,217 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NuFiX.
*
* NuFiX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NuFiX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef FITEVENT_H_SEEN
#define FITEVENT_H_SEEN
#include "TLorentzVector.h"
#include "FitParticle.h"
#include "TSpline.h"
#ifdef __NEUT_ENABLED__
#include "neutvect.h"
#include "neutpart.h"
#endif
#ifdef __NUWRO_ENABLED__
#include "event1.h"
#endif
#ifdef __GENIE_ENABLED__
#include "EVGCore/EventRecord.h"
#include "GHEP/GHepRecord.h"
#include "Ntuple/NtpMCEventRecord.h"
using namespace genie;
#endif
#include "TArrayD.h"
#include "BaseFitEvt.h"
#include "GeneratorUtils.h"
/*!
* \addtogroup FitBase
* @{
*/
/*! FitEvent Class
Used to convert NEUT/NuWro/GENIE events into a common format that can be read by the fitter.
*/
//! Converts NEUT/NuWro/GENIE events to a comman format straight from the tree
class FitEvent : public BaseFitEvt {
public:
//! Default Consstructors. Everything is set to NULL
FitEvent(){
};
//! Default destructor
~FitEvent(){
};
// Generator specific functions
// Each event type needs a way to set the event address from the tree
// Then Neut Kinematics sets up the overall information for the event (Mode, NParticles)
/*
NEUT
*/
#ifdef __NEUT_ENABLED__
//! Constructor assigns event address to NeutVect memory.
FitEvent(NeutVect* event){ this->SetEventAddress(&event); };
//! Set event address to NeutVect memory
void SetEventAddress(NeutVect** tempevent);
//! Convert NeutVect to common format
void NeutKinematics();
#endif
/*
NUWRO
*/
#ifdef __NUWRO_ENABLED__
//! Constructor assigns event address to NuWro event class memory.
FitEvent(event* tempEvent){ this->SetEventAddress(&tempEvent); };
//! Set event address to NuWro event class memory
void SetEventAddress(event** tempevent);
//! Convert NuWro event class to common format
void NuwroKinematics();
#endif
/*
GENIE
*/
#ifdef __GENIE_ENABLED__
//! Constructor assigns event address to GENIE event class memory.
FitEvent(NtpMCEventRecord* tempevent){this->SetEventAddress(&tempevent);};
//! Set event address to GENIE event record memory
//! Gets GHepRecord from NTuple record.
void SetEventAddress(NtpMCEventRecord** tempevent);
//! Convert GENIE event class to common format
void GENIEKinematics();
#endif
/*
GENERAL Fit Event Functions
*/
//! Run event convertor, calls relevent event generator kinematic functions.
void CalcKinematics();
//! Reset the event to NULL
void ResetEvent();
// Access Functions
//! Return Any FitParticle from event
FitParticle* PartInfo(UInt_t i);
//! Return total particle number
UInt_t Npart(){return this->fNParticles;};
//! Return final state particle count.
UInt_t NFinalpart(){return this->fNFinalParticles;};
// Header Variables
// protected: // To Make things easier everything is accessible. Not a great standard.
UInt_t fEventNo; //!< Event No in MC
UInt_t fNParticles; //!< Total Number of Particles
UInt_t fNFSIParticles; //!< Total Number of Particles involved in FSI
UInt_t fNIncomingParticles; //!< Total Number of Starting particles
UInt_t fNFinalParticles; //!< Total Number of Final Particles
UInt_t fCurrPartIndex; //!< Current index of particle in iteration
FitParticle* fit_particle; //!< Pointer to the currently created fit_particle
std::vector<FitParticle> all_particles; //!< vector of all fit particles
Double_t TotCrs; //!< Total Cross-section (Gives per event in NEUT, Total Integrated in NuWro)
Double_t PFSurf; //!< Fermi Surface Momentum
Double_t PFMax; //!< Max Fermi Momentum
UInt_t TargetA; //!< Target Atomic Number
UInt_t TargetZ; //!< Target Nucleus Charge
UInt_t TargetH; //!< Target Free Protons
UInt_t Ibound; //!< Is target bound
UInt_t Nparticles; //!< Number of particles
UInt_t Nprimary; //!< Number of primary particles
Double_t weight; //!< event weight
Double_t FlightDistance; //!< flight distance of neutrino, used for oscillation analysis
// True Generator events: Just Pointers that can be set.
-
+ void NuanceKinematics();
// ACCESS FUNCTIONS
double Enu(){ return this->PartInfo(0)->fP.E(); };
double Tnu(){ return this->PartInfo(0)->fP.E(); };
double Pnu(){ return this->PartInfo(0)->fP.E(); };
int PDGnu(){ return this->PartInfo(0)->fPID; };
int Ilep(){
for (UInt_t i = 2; i < this->Npart(); i++){
if (this->PartInfo(i)->fPID == this->PDGnu() - int(this->Mode < 30))
return i;
}
return 0;
};
double q0(){ return (this->PartInfo(0)->fP - this->PartInfo(this->Ilep())->fP).E(); };
double q3(){ return (this->PartInfo(0)->fP - this->PartInfo(this->Ilep())->fP).Vect().Mag(); };
/* double Elep(); */
/* double Tlep(); */
/* double Plep(); */
/* double PDGlep(); */
/* double Coslep(); */
/* double Thetalep(); */
/* int Npions(); */
/* int Npiplus(); */
};
/*! @} */
#endif
diff --git a/src/FitBase/FitParticle.cxx b/src/FitBase/FitParticle.cxx
index 888bf66..2e62dbe 100644
--- a/src/FitBase/FitParticle.cxx
+++ b/src/FitBase/FitParticle.cxx
@@ -1,105 +1,127 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NuFiX.
*
* NuFiX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NuFiX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "FitParticle.h"
// NEUT Constructor
#ifdef __NEUT_ENABLED__
FitParticle::FitParticle(NeutPart* part){
// Set Momentum
fP = TLorentzVector( part->fP.X(),
part->fP.Y(),
part->fP.Z(),
part->fP.T());
fPID = part->fPID;
fIsAlive = part->fIsAlive;
fStatus = part->fStatus;
fMass = part->fMass;
};
#endif
// NUWRO Constructor
#ifdef __NUWRO_ENABLED__
FitParticle::FitParticle(particle* nuwro_particle, Int_t state){
// Set Momentum
this->fP = TLorentzVector(nuwro_particle->p4().x,
nuwro_particle->p4().y,
nuwro_particle->p4().z,
nuwro_particle->p4().t);
fPID = nuwro_particle->pdg;
// Set status manually from switch
switch(state){
case 0: fIsAlive= 0; fStatus=1; break; // Initial State
case 1: fIsAlive= 1; fStatus=0; break; // Final State
case 2: fIsAlive= 0; fStatus=2; break; // Intermediate State
default: fIsAlive=-1; fStatus=3; break; // Other?
}
fMass = nuwro_particle->m();
};
#endif
// GENIE Constructor
#ifdef __GENIE_ENABLED__
FitParticle::FitParticle(genie::GHepParticle* genie_particle){
this->fP = TLorentzVector(genie_particle->Px()*1000.0,
genie_particle->Py()*1000.0,
genie_particle->Pz()*1000.0,
genie_particle->E()*1000.0);
fPID = genie_particle->Pdg();
switch(genie_particle->Status()){
case genie::kIStInitialState: fIsAlive = 0; fStatus = 1; break; // Initial State
case genie::kIStStableFinalState: fIsAlive = 1; fStatus = 0; break; // Final State
case genie::kIStIntermediateState: fIsAlive = 0; fStatus = 2; break; // Intermediate State
default: fIsAlive = -1; fStatus = 3; break;
}
// Flag to remove nuclear part in genie
if (fPID > 3000){
fIsAlive = -1;
fStatus = 2;
}
fMass = genie_particle->Mass()*1000.0;
// Additional flag to remove off shell particles
if (fabs(fMass - fP.Mag()) > 0.001 ){
fIsAlive = -1;
fStatus = 2;
}
};
+
#endif
FitParticle::FitParticle(UInt_t* i){
(void) i;
// A NULL event has been passed
// ERR(FTL)<<"NULL Event Passed to FitEvent.cxx"<<std::endl;
return;
};
+
+// NUANCE Particle
+FitParticle::FitParticle(double x, double y, double z, double t, int pdg, Int_t state){
+
+ // Set Momentum
+ this->fP = TLorentzVector(x,
+ y,
+ z,
+ t);
+ fPID = pdg;
+
+ // Set status manually from switch
+ switch(state){
+ case 0: fIsAlive= 0; fStatus=1; break; // Initial State
+ case 1: fIsAlive= 1; fStatus=0; break; // Final State
+ case 2: fIsAlive= 0; fStatus=2; break; // Intermediate State
+ default: fIsAlive=-1; fStatus=3; break; // Other?
+ }
+
+ fMass = fP.Mag();
+};
diff --git a/src/FitBase/FitParticle.h b/src/FitBase/FitParticle.h
index 5d2d837..38411da 100644
--- a/src/FitBase/FitParticle.h
+++ b/src/FitBase/FitParticle.h
@@ -1,93 +1,94 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NuFiX.
*
* NuFiX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NuFiX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef FITPARTICLE_H_SEEN
#define FITPARTICLE_H_SEEN
#include "TLorentzVector.h"
#ifdef __NEUT_ENABLED__
#include "neutpart.h"
#endif
#ifdef __NUWRO_ENABLED__
#include "particle.h"
#endif
#ifdef __GENIE_ENABLED__
#include "EVGCore/EventRecord.h"
#include "GHEP/GHepRecord.h"
#include "Ntuple/NtpMCEventRecord.h"
#include "GHEP/GHepParticle.h"
#include "PDG/PDGCodes.h"
#include "PDG/PDGUtils.h"
#include "GHEP/GHepStatus.h"
#include "GHEP/GHepFlags.h"
#include "GHEP/GHepUtils.h"
#endif
#include "TObject.h"
/*!
* \addtogroup FitBase
* @{
*/
//! Condensed FitParticle class which acts a common format between the generators
class FitParticle {
public:
//! Virtual Destructor
~FitParticle(){ };
//! Default Constructor
FitParticle(){
fPID = -1;
};
#ifdef __NEUT_ENABLED__
//! NEUT Constructor
FitParticle(NeutPart* part);
#endif
#ifdef __NUWRO_ENABLED__
//! NUWRO Constructor
FitParticle(particle* nuwro_particle, Int_t state);
#endif
#ifdef __GENIE_ENABLED__
//! GENIE Constructor
FitParticle(genie::GHepParticle* genie_particle);
#endif
//! NULL Constructor for when the generator screws up.
FitParticle(UInt_t* i);
TLorentzVector fP; //!< Particle 4 Momentum
int fPID; //!< Particle PDG Code
int fIsAlive; //!< Whether the particle is alive at the end of the event (Yes 1, No 0, Other? -1)
int fStatus; //!< Particle Status (Incoming 1, FSI 2, Outgoing 0, Other 3)
double fMass; //!< Particle Mass
+ FitParticle(double x, double y, double z, double t, int pdg, Int_t state);
};
/*! @} */
#endif
diff --git a/src/FitBase/InputHandler.cxx b/src/FitBase/InputHandler.cxx
index f2e9496..797f746 100755
--- a/src/FitBase/InputHandler.cxx
+++ b/src/FitBase/InputHandler.cxx
@@ -1,785 +1,828 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NuFiX.
*
* NuFiX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NuFiX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#include "InputHandler.h"
//***********************************
InputHandler::InputHandler(std::string handle, std::string infile_name){
//***********************************
LOG(SAM) << "Creating InputHandler for " << handle << "..." << std::endl;
LOG(SAM) << " -> [" << infile_name << "]" << std::endl;
// Read in parameters for handler
this->maxEvents = FitPar::Config().GetParI("MAXEVENTS");
isJointInput = false;
// Setup a custom Event class
this->cust_event = new FitEvent();
this->signal_event = new BaseFitEvt();
this->inFile = infile_name;
this->handleName = handle;
// Parse Infile to allow enviornmental flags
this->inFile = this->ParseInputFile(this->inFile);
LOG(SAM) << " -> Type = " << inType << std::endl;
LOG(SAM) << " -> Input = " << inFile << std::endl;
// Automatically check what sort of event file it is
if (inType.compare("JOINT"))
this->inRootFile = new TFile(this->inFile.c_str(),"READ");
// Setup the handler for each type
if (!inType.compare("NEUT")) this->ReadNeutFile();
else if (!inType.compare("NUWRO")) this->ReadNuWroFile();
else if (!inType.compare("GENIE")) this->ReadGenieFile();
else if (!inType.compare("HIST")) this->ReadHistogramFile();
else if (!inType.compare("BNSPLN")) this->ReadBinSplineFile();
else if (!inType.compare("EVSPLN")) this->ReadEventSplineFile();
else if (!inType.compare("NUANCE")) this->ReadNuanceFile();
else if (!inType.compare("JOINT")) this->ReadJointFile();
else {
LOG(FTL) << " -> ERROR: Invalid Event File Type" << std::endl;
inRootFile->ls();
exit(-1);
}
// Setup MaxEvents After setup of ttree
if (maxEvents > 1 and maxEvents < nEvents) {
LOG(SAM) << " -> Reading only "<<maxEvents<<" events from total."<<std::endl;
nEvents = maxEvents;
}
this->fluxList.push_back(this->fluxHist);
this->eventList.push_back(this->eventHist);
this->xsecList.push_back(this->xsecHist);
LOG(SAM) << " -> Finished handler initialisation." << std::endl;
return;
};
//********************************************************************
std::string InputHandler::ParseInputFile(std::string inputstring){
//********************************************************************
// Parse out the input_type
- const int nfiletypes = 5;
- const std::string filetypes[nfiletypes] = {"NEUT","NUWRO","GENIE","EVSPLN","JOINT"};
+ const int nfiletypes = 6;
+ const std::string filetypes[nfiletypes] = {"NEUT","NUWRO","GENIE","EVSPLN","JOINT","NUANCE"};
for (int i = 0; i < nfiletypes; i++){
std::string tempTypes = filetypes[i] + ":";
if (inputstring.find(tempTypes) != std::string::npos){
inType = filetypes[i];
inputstring.replace(inputstring.find(tempTypes), tempTypes.size(), "");
break;
}
}
// Parse out envir flags
- const int nfiledir = 4;
- const std::string filedir[nfiledir] = {"NEUT_DIR","NUWRO_DIR","GENIE_DIR","EVSPLN_DIR"};
+ const int nfiledir = 5;
+ const std::string filedir[nfiledir] = {"NEUT_DIR","NUWRO_DIR","GENIE_DIR","NUANCE_DIR","EVSPLN_DIR"};
for (int i = 0; i < nfiledir; i++){
std::string tempDir = "@" + filedir[i];
if (inputstring.find(tempDir) != std::string::npos){
std::string event_folder = FitPar::Config().GetParS(filedir[i]);
inputstring.replace(inputstring.find(tempDir), tempDir.size(), event_folder);
break;
}
}
return inputstring;
}
//********************************************************************
bool InputHandler::CanIGoFast(){
//********************************************************************
if (eventType == 6){
return true;
}
return false;
}
//********************************************************************
void InputHandler::ReadEventSplineFile(){
//********************************************************************
LOG(SAM) << " -> Setting up SPLINE inputs"<<std::endl;
// Event Type 7 SPLINES
this->eventType = 6;
// Get flux histograms NEUT supplies
this->fluxHist = (TH1D*)inRootFile->Get( (this->handleName + "_FLUX").c_str() );
this->eventHist = (TH1D*)inRootFile->Get( (this->handleName + "_EVT").c_str() );
this->xsecHist = (TH1D*)inRootFile->Get( (this->handleName + "_XSEC").c_str() );
// Setup Spline Stuff
this->splhead = (FitSplineHead*) inRootFile->Get( (this->handleName + "_splineHead").c_str() );
tn = new TChain(Form("%s",(this->handleName + "_splineEvents").c_str()),"");
tn->Add( Form("%s/%s",this->inFile.c_str(),(this->handleName + "_splineEvents").c_str()) );
// Assign nvect
nEvents = tn->GetEntries();
cust_event = NULL;
tn->SetBranchAddress("FitEvent", &cust_event);
// Load Dial Coeffs into vector
for (int i = 0; i < nEvents; i++){
tn->GetEntry(i);
tn->Show(i);
spline_list.push_back( *cust_event->dial_coeff );
}
sleep(5);
// Set MAXEVENTS CALC Here before we load in splines
if (maxEvents > 1 and maxEvents < nEvents) {
LOG(SAM) << " -> Reading only "<<maxEvents<<" events from total spline events."<<std::endl;
nEvents = maxEvents;
}
// Load all the splines into signal memory
// for (int i = 0; i < nEvents; i++){
// tn->GetEntry(i);
// BaseFitEvt* base_event = (new BaseFitEvt(cust_event));
// base_event->fType=6;
// signal_events.push_back( base_event );
// }
// Print out what was read in
LOG(SAM) << " -> Successfully Read SPLINE file"<<std::endl;
if (LOG_LEVEL(SAM)) this->PrintStartInput();
int cnt = 1;
std::list<FitSpline*>::iterator spl_iter = this->splhead->SplineObjects.begin();
for ( ; spl_iter != this->splhead->SplineObjects.end(); spl_iter++){
FitSpline* spl = (*spl_iter);
LOG(SAM) << " -> Spline " << cnt << ". "
<< spl->id << " "
<< spl->form << " "
<< "NDIM(" << spl->ndim << ") "
<< "NPAR(" << spl->npar << ") "
<< "PTS(" << spl->points << ") "
<< std::endl;
cnt++;
}
}
//********************************************************************
FitSplineHead* InputHandler::GetSplineHead(){
//********************************************************************
return this->splhead;
}
//********************************************************************
void InputHandler::ReadJointFile(){
//********************************************************************
LOG(SAM) << " -> Reading list of inputs from file"<<std::endl;
isJointInput = true;
// Parse Input File
std::string line;
std::ifstream card(inFile.c_str(), ifstream::in);
std::vector<std::string> input_lines;
while(std::getline(card, line, '\n')){
std::istringstream stream(line);
// Add normalisation option for second line
input_lines.push_back(line);
// Split to get normalisation
}
card.close();
// Loop over input and get the flux files
// Using a temporary input handler to do this, which is a bit dodge.
int count_low = 0;
int temp_type = -1;
for (UInt_t i = 0; i < input_lines.size(); i++){
// Create Temporary InputHandlers inside
InputHandler* temp_input = new InputHandler(std::string(Form("temp_input_%i",i)),
input_lines.at(i));
if (temp_type != temp_input->GetType() and i > 0) {
ERR(FTL) << " Can't use joint events with mismatched trees yet!"<<std::endl;
ERR(FTL) << " Make them all the same type!"<<std::endl;
}
temp_type = temp_input->GetType();
TH1D* temp_flux = (TH1D*) temp_input->GetFluxHistogram()->Clone();
TH1D* temp_evts = (TH1D*) temp_input->GetEventHistogram()->Clone();
TH1D* temp_xsec = (TH1D*) temp_input->GetXSecHistogram()->Clone();
int temp_events = temp_input->GetNEvents();
temp_flux->SetName( (this->handleName + "_" + temp_input->GetInputStateString() + "_FLUX").c_str() );
temp_evts->SetName( (this->handleName + "_" + temp_input->GetInputStateString() + "_EVT").c_str() );
temp_xsec->SetName( (this->handleName + "_" + temp_input->GetInputStateString() + "_XSEC").c_str() );
this->fluxList.push_back(temp_flux);
this->eventList.push_back(temp_evts);
this->xsecList.push_back(temp_xsec);
this->joint_index_low.push_back(count_low);
this->joint_index_high.push_back(count_low + temp_events);
this->joint_index_hist.push_back( (TH1D*) temp_evts->Clone() );
count_low += temp_events;
if (i == 0){
this->fluxHist = (TH1D*) temp_flux->Clone();
this->eventHist = (TH1D*) temp_evts->Clone();
} else {
this->fluxHist ->Add( temp_flux );
this->eventHist ->Add( temp_evts );
}
std::cout<<"Added Input File "<< input_lines.at(i) <<std::endl<<" with "<<temp_events<<std::endl;
}
// Now have all correctly normalised histograms all we need to do is setup the TChains
// Input Assumes all the same type
std::string tree_name = "";
if (temp_type == 0) tree_name = "neuttree";
else if (temp_type == 1) tree_name = "treeout";
// Add up the TChains
tn = new TChain(tree_name.c_str());
for (UInt_t i = 0; i < input_lines.size(); i++){
// PARSE INPUT
std::cout<<"Adding new tchain "<<input_lines.at(i)<<std::endl;
std::string temp_file = this->ParseInputFile(input_lines.at(i));
tn->Add(temp_file.c_str());
}
// Setup Events
nEvents = tn->GetEntries();
if (temp_type == 0){
#ifdef __NEUT_ENABLED__
eventType = 0;
neut_event = NULL;
tn->SetBranchAddress("vectorbranch", &neut_event);
this->cust_event->SetEventAddress(&neut_event);
#endif
} else if (temp_type == 1){
#ifdef __NUWRO_ENABLED__
eventType = 1;
nuwro_event = NULL;
tn->SetBranchAddress("e",&nuwro_event);
this->cust_event->SetEventAddress(&nuwro_event);
#endif
}
// Normalise event histogram PDFS for weights
for (UInt_t i = 0; i < input_lines.size(); i++){
TH1D* temp_hist = (TH1D*)joint_index_hist.at(i)->Clone();
joint_index_weight.push_back( double(nEvents) / eventHist->Integral("width") *
joint_index_hist.at(i)->Integral("width") / double(joint_index_high.at(i) - joint_index_low.at(i) ));
temp_hist -> Scale( double(nEvents) / eventHist->Integral("width") );
temp_hist -> Scale( joint_index_hist.at(i)->Integral("width") / double(joint_index_high.at(i)) );
this->joint_index_hist.at(i) = temp_hist;
}
this->eventHist->SetNameTitle( (this->handleName + "_EVT").c_str(), (this->handleName + "_EVT").c_str() );
this->fluxHist->SetNameTitle( (this->handleName + "_FLUX").c_str(), (this->handleName + "_FLUX").c_str() );
return;
}
//********************************************************************
void InputHandler::ReadNeutFile(){
//********************************************************************
#ifdef __NEUT_ENABLED__
LOG(SAM) << " -> Setting up NEUT inputs"<<std::endl;
// Event Type 0 Neut
this->eventType = 0;
// Get flux histograms NEUT supplies
this->fluxHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "flux")).c_str());
this->fluxHist->SetNameTitle((this->handleName+"_FLUX").c_str(), (this->handleName+"; E_{#nu} (GeV)").c_str());
this->eventHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "evtrt")).c_str());
this->eventHist->SetNameTitle((this->handleName+"_EVT").c_str(), (this->handleName+"; E_{#nu} (GeV); Event Rate").c_str());
this->xsecHist = (TH1D*) eventHist->Clone();
this->xsecHist->Divide(this->fluxHist);
this->xsecHist->SetNameTitle((this->handleName+"_XSEC").c_str(),(this->handleName+"_XSEC;E_{#nu} (GeV); XSec (1#times10^{-38} cm^{2})").c_str());
// Read in the file once only
tn = new TChain("neuttree","");
tn->Add(Form("%s/neuttree",this->inFile.c_str()));
// Assign nvect
nEvents = tn->GetEntries();
neut_event = NULL;
tn->SetBranchAddress("vectorbranch", &neut_event);
// Make the custom event read in nvect when calling CalcKinematics
this->cust_event->SetEventAddress(&neut_event);
// Print out what was read in
LOG(SAM) << " -> Successfully Read NEUT file"<<std::endl;
if (LOG_LEVEL(SAM)) this->PrintStartInput();
#else
ERR(FTL) << "ERROR: Invalid Event File Provided" << std::endl;
ERR(FTL) << "NEUT Input Not Enabled." << std::endl;
ERR(FTL) << "Rebuild with --enable-neut or check FitBuild.h!" << std::endl;
exit(-1);
#endif
return;
}
//********************************************************************
void InputHandler::ReadNuWroFile(){
//********************************************************************
#ifdef __NUWRO_ENABLED__
LOG(SAM) << " -> Setting up Nuwro inputs"<<std::endl;
// Event Type 1 == NuWro
this->eventType = 1;
// Setup the TChain for nuwro event tree
tn = new TChain("treeout");
tn->AddFile(this->inFile.c_str());
// Get entries and nuwro_event
nEvents = tn->GetEntries();
nuwro_event = NULL;
tn->SetBranchAddress("e",&nuwro_event);
this->cust_event->SetEventAddress(&nuwro_event);
// Check if we have saved an xsec histogram before
this->fluxHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "flux")).c_str());
this->eventHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "evtrt")).c_str());
// Check if we are forcing plot generation (takes time)
bool regenFlux = FitPar::Config().GetParB("input.regen_nuwro_plots");
if (regenFlux) LOG(SAM) << " -> Forcing NuWro XSec/Flux plots to be generated at the start. "<<std::endl;
// Already generated flux and event histograms
if (fluxHist and eventHist and !regenFlux){
this->xsecHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "xsec")).c_str());
this->fluxHist->SetNameTitle((this->handleName + "_FLUX").c_str(), (this->handleName + "_FLUX").c_str());
this->eventHist->SetNameTitle((this->handleName + "_EVT").c_str(), (this->handleName + "_EVT").c_str());
this->xsecHist->SetNameTitle((this->handleName + "_XSEC").c_str(), (this->handleName + "_XSEC").c_str());
// Need to regenerate if not found
} else {
LOG(SAM) << " -> No NuWro XSec or Flux Histograms found, need to regenerate!" << std::endl;
// Can grab flux histogram from the pars
tn->GetEntry(0);
std::string fluxstring = nuwro_event->par.beam_energy;
LOG(SAM)<<"Nuwro Input Flux = "<<fluxstring<<std::endl;
std::vector<double> contents = PlotUtils::FillVectorDFromString(fluxstring, " ");
if (fluxstring.empty() or contents.empty()){
ERR(WRN) << "Incorrect NuWro flux type "<<std::endl;
ERR(WRN) << "Need to provide as a beam_energy list"<<std::endl;
ERR(WRN) << "e.g. beam_energy = Low High Contents_i"<<std::endl;
exit(-1);
}
// Parse the input string values
int count = 0;
for (UInt_t i = 0; i < contents.size(); i++){
if (contents.at(i) <= 0.0001 and contents.at(i) != 0.0 ) count++;
else break;
}
double nuwro_Elow = contents[count];
double nuwro_Ehigh = contents[count+1];
int nuwro_NBins = contents.size() - 2 - count;
std::cout<<"CONTENTS VALS = "<<contents[0]<<" "<<contents[1]<<" "<<contents[2]<<" "<<contents[3]<<std::endl;
std::cout<<"Nuwro Range = "<<nuwro_Elow<<"-"<<nuwro_Ehigh<<std::endl;
// Create Empty Histograms
this->fluxHist = new TH1D("nuwro_flux", "nuwro_flux; E_{#nu} (GeV);#nu",
nuwro_NBins, nuwro_Elow/1000.0, nuwro_Ehigh/1000.0);
this->eventHist = new TH1D("nuwro_evt", "nuwro_evt; E_{#nu} (GeV);Events [#times 10^{-38}]",
nuwro_NBins, nuwro_Elow/1000.0, nuwro_Ehigh/1000.0);
this->xsecHist = new TH1D("nuwro_xsec", "nuwro_xsec; E_{#nu} (GeV);#sigma [#times 10^{-38}]",
nuwro_NBins, nuwro_Elow/1000.0, nuwro_Ehigh/1000.0);
std::cout<<"Flux Edges = "<<nuwro_Elow<<" "<<nuwro_Ehigh<<std::endl;
// Fill Flux Histogram
for (UInt_t i = 0; i < nuwro_NBins; i++){
this->fluxHist->SetBinContent(i+1, contents.at(i+2+count));
}
// Start Processing
LOG(SAM) << " -> Processing NuWro Input Flux for "<< nEvents
<<" events (This can take a while...) "<<std::endl;
double Enu = 0.0;
double TotXSec = 0.0;
double totaleventmode = 0.0;
double totalevents = 0.0;
// --- loop
for (int i = 0; i < nEvents; i++){
tn->GetEntry(i);
// Get Variables
Enu = nuwro_event->in[0].E()/1000.0;
TotXSec = nuwro_event->weight;
// Fill a flux and xsec histogram
this->eventHist->Fill(Enu);
this->xsecHist->Fill(Enu, TotXSec);
// Keep Tally
totaleventmode += TotXSec;
totalevents++;
};
LOG(SAM) <<" -> Flux Processing Loop Finished."<<std::endl;
if (this->eventHist->Integral() == 0.0){
std::cout<<"ERROR NO EVENTS FOUND IN RANGE! "<<std::endl;
exit(-1);
}
// Sort out plot scaling
double AvgXSec = (totaleventmode*1.0E38/(totalevents+0.));
LOG(SAM)<<" -> Average XSec = "<<AvgXSec<<std::endl;
this->eventHist->Scale( 1.0 / eventHist->Integral() ); // Convert to PDF
this->eventHist->Scale( this->fluxHist->Integral() * AvgXSec ); // Convert to Proper Event Rate
this->xsecHist->Add(eventHist); // Get Event Rate Plot
this->xsecHist->Divide(this->fluxHist); // Make XSec Plot
//this->eventHist = (TH1D*)this->fluxHist->Clone();
//this->eventHist->Multiply(this->xsecHist);
// Clear over/underflows incase they mess with integrals later.
this->fluxHist->SetBinContent(0,0.0);
this->fluxHist->SetBinContent(this->fluxHist->GetNbinsX()+2,0.0);
this->eventHist->SetBinContent(0,0.0);
this->eventHist->SetBinContent(this->eventHist->GetNbinsX()+2,0.0);
LOG(SAM) << " -> Finished making NuWro event plots. Saving them for next time..."<<std::endl;
TFile* temp_save_file = new TFile(this->inFile.c_str(), "UPDATE");
temp_save_file->cd();
this->fluxHist->Write("nuwro_flux", TObject::kOverwrite);
this->eventHist->Write("nuwro_evtrt", TObject::kOverwrite);
this->xsecHist->Write("nuwro_xsec", TObject::kOverwrite);
temp_save_file->Close();
delete temp_save_file;
this->fluxHist->SetNameTitle((this->handleName + "_FLUX").c_str(), (this->handleName + "_FLUX").c_str());
this->eventHist->SetNameTitle((this->handleName + "_EVT").c_str(), (this->handleName + "_EVT").c_str());
this->xsecHist->SetNameTitle((this->handleName + "_XSEC").c_str(), (this->handleName + "_XSEC").c_str());
}
// Print out what was read in
LOG(SAM) << " -> Successfully Read NUWRO file"<<std::endl;
if (LOG_LEVEL(SAM)) this->PrintStartInput();
#else
ERR(FTL) << "ERROR: Invalid Event File Provided" << std::endl;
ERR(FTL) << "NuWro Input Not Enabled." << std::endl;
ERR(FTL) << "Rebuild with --enable-nuwro or check FitBuild.h!" << std::endl;
exit(-1);
#endif
return;
}
//********************************************************************
void InputHandler::ReadGenieFile(){
//********************************************************************
#ifdef __GENIE_ENABLED__
// Event Type 1 NuWro
this->eventType = 5;
// Open Root File
LOG(SAM) << "Opening event file "<<this->inFile<<std::endl;
TFile* rootFile = new TFile(this->inFile.c_str(),"READ");
// Get flux histograms NEUT supplies
this->fluxHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "spectrum")).c_str());
this->fluxHist->SetNameTitle((this->handleName+"_FLUX").c_str(), (this->handleName+"; E_{#nu} (GeV)").c_str());
this->eventHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "spectrum")).c_str());
this->eventHist->SetNameTitle((this->handleName+"_EVT").c_str(), (this->handleName+"; E_{#nu} (GeV); Event Rate").c_str());
this->xsecHist = (TH1D*)inRootFile->Get((PlotUtils::GetObjectWithName(inRootFile, "spectrum")).c_str());
this->xsecHist->SetNameTitle((this->handleName+"_XSEC").c_str(), (this->handleName+"; E_{#nu} (GeV); Event Rate").c_str());
double average_xsec = 0.0;
int total_events = 0;
// Setup the TChain for nuwro event tree
tn = new TChain("gtree");
tn->AddFile(this->inFile.c_str());
nEvents = tn->GetEntries();
LOG(SAM) << "Number of GENIE Eevents "<<tn->GetEntries()<<std::endl;
genie_event = NULL;
mcrec = NULL;
// NtpMCEventRecord * mcrec = 0; tree->SetBranchAddress(gmrec, &mcrec);
tn->SetBranchAddress("gmcrec", &mcrec);
this->eventHist->Reset();
TH1D* tempEvt = (TH1D*)(this->eventHist)->Clone();
// Make the custom event read in nvect when calling CalcKinematics
this->cust_event->SetEventAddress(&mcrec);
LOG(SAM) << "Processing GENIE flux events." <<std::endl;
for (int i = 0; i < nEvents; i++){
tn->GetEntry(i);
EventRecord& event = *(mcrec->event);
GHepParticle * neu = event.Probe();
GHepRecord genie_record = static_cast<GHepRecord>(event);
double xsec = (genie_record.XSec() / ( 1E-38 * genie::units::cm2 ) );
average_xsec += xsec;
total_events += 1;
this->eventHist->Fill( neu->E() );
this->xsecHist->Fill( neu->E(), xsec );
mcrec->Clear();
}
// Sort xsec hist
this->xsecHist->Divide(this->eventHist);
// Sort eventHist as xsecHist * eventHist
this->eventHist = (TH1D*)this->fluxHist->Clone();
this->eventHist->Multiply(this->xsecHist);
this->eventHist->SetNameTitle((this->handleName+"_EVT").c_str(),(this->handleName+"_EVT;E_{#nu} (GeV); Events (1#times10^{-38})").c_str());
this->xsecHist->SetNameTitle((this->handleName+"_XSEC").c_str(),(this->handleName+"_XSEC;E_{#nu} (GeV); XSec (1#times10^{-38} cm^{2})").c_str());
#else
ERR(FTL) << "ERROR: Invalid Event File Provided" << std::endl;
ERR(FTL) << "GENIE Input Not Enabled." << std::endl;
ERR(FTL) << "Rebuild with --enable-genie or check FitBuild.h!" << std::endl;
exit(-1);
#endif
return;
}
//********************************************************************
void InputHandler::ReadBinSplineFile(){
//********************************************************************
// Bin Splines are saved as one event for each histogram bin.
// So just read in as normal event splines and it'll all get sorted easily.
}
//********************************************************************
void InputHandler::ReadHistogramFile(){
//********************************************************************
// Convert the raw histogram into a series of events with X variables
- // So we don't have to pass stuff upsteam
+ // So we don't have to pas stuff upsteam
}
//********************************************************************
void InputHandler::ReadNuanceFile(){
//********************************************************************
// Read in Nuance output ROOT file (converted from hbook)
+ LOG(SAM) << " Reading NUANCE " << std::endl;
+ tn = new TChain("t3");
+ tn->AddFile(this->inFile.c_str());
+
+ // Get entries and nuwro_event
+ nEvents = tn->GetEntries();
+ nuance_event = new NuanceEvent();
+
+ // SetBranchAddress for Nuance
+ tn->SetBranchAddress("cc",&nuance_event->cc);
+ tn->SetBranchAddress("bound",&nuance_event->bound);
+ tn->SetBranchAddress("neutrino",&nuance_event->neutrino);
+ tn->SetBranchAddress("target",&nuance_event->target);
+ tn->SetBranchAddress("iniQ", &nuance_event->iniQ);
+ tn->SetBranchAddress("finQ", &nuance_event->finQ);
+ tn->SetBranchAddress("lepton0", &nuance_event->lepton0);
+ tn->SetBranchAddress("polar", &nuance_event->polar);
+
+ int channel;
+ double qsq;
+ double w;
+ double x;
+ double y;
+
+ double p_neutrino[4];
+ double p_targ[5];
+ double vertex[4];
+ double start[4];
+ double depth;
+ double flux;
+
+ int n_leptons;
+
+ double p_ltot[5];
+ int lepton[200];
+ double p_lepton[5][200];
+
+ int n_hadrons;
+ double p_htot[5];
+ int hadron[200];
+ double p_hadron[5][200];
+
+ // this->cust_event->SetEventAddress(&nuance_event);
}
//********************************************************************
void InputHandler::PrintStartInput(){
//********************************************************************
LOG(SAM) << " -> Total events = " << nEvents<<std::endl;
LOG(SAM) << " -> Energy Range = " << fluxHist->GetXaxis()->GetXmin()
<< "-" << fluxHist->GetXaxis()->GetXmax() <<" GeV" << std::endl;
LOG(SAM) << " -> Integrated Flux Hist = "
<< fluxHist->Integral(0, fluxHist->GetNbinsX(), "width") << std::endl;
LOG(SAM) << " -> Integrated Event Hist = "
<< eventHist->Integral(0, eventHist->GetNbinsX(), "width") << std::endl;
LOG(SAM) << " -> Integrated XSec Hist = "
<< xsecHist->Integral(0, xsecHist->GetNbinsX(), "width") << std::endl;
if (eventType == 6) return;
// Get First event info
tn->GetEntry(0);
cust_event->CalcKinematics();
LOG(SAM) << " -> Event 0. Neutrino PDG = " << cust_event->PartInfo(0)->fPID << std::endl;
LOG(SAM) << " Target A = " << cust_event->TargetA << std::endl;
LOG(SAM) << " Target Z = " << cust_event->TargetZ << std::endl;
}
//********************************************************************
std::string InputHandler::GetInputStateString(){
//********************************************************************
std::ostringstream state;
state << "T" << eventType << "_PDG" << cust_event->PartInfo(0)->fPID
<< "_Z" << cust_event->TargetZ << "_A" << cust_event->TargetA;
return state.str();
}
//********************************************************************
void InputHandler::ReadEvent(unsigned int i){
//********************************************************************
bool using_events = (eventType == 0 or eventType==5 or eventType==1 or eventType==kEVTSPLINE);
if (using_events){
tn->GetEntry(i);
if (eventType != kEVTSPLINE)
cust_event->CalcKinematics();
cust_event->Index = i;
cur_entry = i;
cust_event->InputWeight = GetInputWeight(i);
} else {
this->GetTreeEntry(i);
}
}
//********************************************************************
void InputHandler::GetTreeEntry(const Long64_t i){
//********************************************************************
if (eventType != kEVTSPLINE)
tn->GetEntry(i);
else
(*(cust_event->dial_coeff)) = spline_list.at(i);
cur_entry = i;
cust_event->InputWeight = GetInputWeight(i);
}
//********************************************************************
double InputHandler::GetInputWeight(const int entry){
//********************************************************************
if (!isJointInput) return 1.0;
double weight = 1.0;
// Find Histogram
for (UInt_t j = 0; j < joint_index_low.size(); j++){
if (entry >= joint_index_low.at(j) and entry < joint_index_high.at(j)){
weight *= joint_index_weight.at(j);
break;
}
}
return weight;
}
//********************************************************************
int InputHandler::GetGenEvents(){
//********************************************************************
if (eventType == 6) return this->splhead->ngen_events;
else return this->GetNEvents();
}
//********************************************************************
double InputHandler::TotalIntegratedFlux(double low, double high, std::string intOpt){
//********************************************************************
int minBin = this->fluxHist->GetXaxis()->FindBin(low);
int maxBin = this->fluxHist->GetXaxis()->FindBin(high);
double integral = this->fluxHist->Integral(minBin, maxBin+1, intOpt.c_str());
return integral;
};
//********************************************************************
double InputHandler::PredictedEventRate(double low, double high, std::string intOpt){
//********************************************************************
int minBin = this->fluxHist->GetXaxis()->FindBin(low);
int maxBin = this->fluxHist->GetXaxis()->FindBin(high);
return this->eventHist->Integral(minBin, maxBin+1, intOpt.c_str());
}
diff --git a/src/FitBase/InputHandler.h b/src/FitBase/InputHandler.h
index be34f96..11577e4 100755
--- a/src/FitBase/InputHandler.h
+++ b/src/FitBase/InputHandler.h
@@ -1,137 +1,139 @@
// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
/*******************************************************************************
* This file is part of NuFiX.
*
* NuFiX is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* NuFiX is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
#ifndef INPUT_HANDLER_H
#define INPUT_HANDLER_H
#include "TObject.h"
#include "FitEvent.h"
#include "FitWeight.h"
#include "FitParameters.h"
#include "PlotUtils.h"
#include "FitUtils.h"
#include "stdint.h"
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <cstring>
#ifdef __GENIE_ENABLED__
#include "Conventions/Units.h"
#endif
class InputHandler {
public:
InputHandler(){};
~InputHandler(){};
InputHandler(std::string handle, std::string infile_name);
std::string ParseInputFile(std::string inputfile);
void ReadBinSplineFile();
void ReadHistogramFile();
void ReadNeutFile();
void ReadNuanceFile();
void ReadGenieFile();
void ReadNuWroFile();
void ReadEventSplineFile();
void ReadJointFile();
FitSplineHead* GetSplineHead();
double PredictedEventRate(double low, double high, std::string intOpt="width");
double TotalIntegratedFlux(double low, double high, std::string intOpt="width");
FitEvent* GetEventPointer(){ return cust_event; };
BaseFitEvt* GetSignalPointer(){ return signal_event; };
int GetNEvents(){ return this->nEvents; };
int GetGenEvents();
void PrintStartInput();
void ReadEvent(unsigned int i);
TH1D* GetFluxHistogram(){return this->fluxHist;};
TH1D* GetEventHistogram(){return this->eventHist;};
TH1D* GetXSecHistogram(){return this->xsecHist;};
std::vector<TH1*> GetFluxList(){ return this->fluxList;};
std::vector<TH1*> GetEventList(){ return this->eventList;};
std::vector<TH1*> GetXSecList(){ return this->xsecList;};
int GetType(){return eventType;};
bool CanIGoFast();
void GetTreeEntry(const Long64_t entry);
std::string GetInputStateString();
int eventType;
double GetInputWeight(const int entry=-1);
protected:
TChain* tn;
BaseFitEvt* signal_event;
FitEvent* cust_event;
FitSplineHead* splhead;
int maxEvents;
int nEvents;
int curevt_i;
// Input Event rate flux/event histograms
TH1D* fluxHist; //!< Flux Histogram
TH1D* eventHist; //!< Event Histogram
TH1D* xsecHist; //!< XSec Histogram
// input root files
TFile* inRootFile; //!< Input ROOT file (e.g NEUT MC)
std::string inFile; ///!< Name of input ROOT file
std::string inType; ///!< Input Type
std::vector<BaseFitEvt*> all_events;
std::string handleName;
#ifdef __NEUT_ENABLED__
NeutVect *neut_event; //!< Pointer to NEUT Events
#endif
#ifdef __NUWRO_ENABLED__
event* nuwro_event; //!< Pointer to NuWro Events (Set to bool if NUWRO disabled)
#endif
#ifdef __GENIE_ENABLED__
GHepRecord* genie_event; //!< Pointer to GENIE GHepRecord
NtpMCEventRecord * mcrec; //!< Pointer to GENIE NTuple Record
#endif
+ NuanceEvent* nuance_event;
+
std::vector<int> joint_index_low;
std::vector<int> joint_index_high;
std::vector<TH1D*> joint_index_hist;
std::vector<double> joint_index_weight;
bool isJointInput;
int cur_entry;
std::vector<TH1*> xsecList;
std::vector<TH1*> eventList;
std::vector<TH1*> fluxList;
std::vector<TArrayD> spline_list;
};
#endif
diff --git a/src/FitBase/NuanceEvent.h b/src/FitBase/NuanceEvent.h
new file mode 100755
index 0000000..f9ddd91
--- /dev/null
+++ b/src/FitBase/NuanceEvent.h
@@ -0,0 +1,63 @@
+// Copyright 2016 L. Pickering, P Stowell, R. Terri, C. Wilkinson, C. Wret
+
+/*******************************************************************************
+* This file is part of NuFiX.
+*
+* NuFiX is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* NuFiX is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with NuFiX. If not, see <http://www.gnu.org/licenses/>.
+*******************************************************************************/
+
+#ifndef NUANCE_H_SEEN
+#define NUANCE_H_SEEN
+
+/*!
+ * \addtogroup FitBase
+ * @{
+ */
+
+class NuanceEvent {
+ public:
+
+ bool cc;
+ bool bound;
+ int neutrino;
+ int target;
+ double iniQ;
+ double finQ;
+ int lepton0;
+ double polar;
+ int channel;
+ double qsq;
+ double w;
+ double x;
+ double y;
+
+ double p_neutrino[4];
+ double p_targ[5];
+ double vertex[4];
+ double start[4];
+ double depth;
+ double flux;
+
+ int n_leptons;
+
+ double p_ltot[5];
+ int lepton[200];
+ double p_lepton[5][200];
+
+ int n_hadrons;
+ double p_htot[5];
+ int hadron[200];
+ double p_hadron[5][200];
+};
+#endif

File Metadata

Mime Type
text/x-diff
Expires
Sun, Feb 23, 2:23 PM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4478424
Default Alt Text
(132 KB)

Event Timeline