Skip to content

Exercise B: The Closure Test

christian2nguyen edited this page Jun 7, 2021 · 34 revisions

Why do we need a closure test?

  • “You must not fool yourself, and you are the easiest person to fool" -Feynman
  • The closure test gives the collaboration confidence that your cross-section script is correctly working and doesn't have any lurking bugs giving bad results. This is done by showing that your differential cross-section results are equal to an external MINERvA cross-section script where both differential cross-sections are based on your signal definition. For this exercise, the closure test is performed by comparing the simulation (GENIE Minerva-v1 tune) differential cross-section produced by ExtractCrossSection (pretending it's your personal method) to the simulation (GENIE Minerva-v1 tune) differential cross-section produced by GENIEXSECEXTRACT (MINERvA's standardized method).

Step 1a

  • Create a text file with the paths to each MC root files - that is practice your vim and terminal command skills. I do something like ls <path> > filenameMC.txt then I add the full path to each line using visual mode in vim.
  • From the Event Rate step you should have produced an MC root file, with this root file you want to extract a cross-section using ExtractCrossSection , by running this command ExtractCrossSection 1 runEventLoopMC.root runEventLoopMC.root

Step 1b

  • You want to now use GENIEXSECEXTRACT to extract a cross-section to compare too. In the /test directory you run runXSecLooper MCTextFile.txt

Step 1c

  • Once you have two root files, one from runXSecLooper (GENIEXSECEXTRACT) and the other from ExtractCrossSection (Your cross-section script) you want to check that they produce the same result (to about 0.1%) the easiest way to do this visually is to make a ratio plot of the cross-sections. Typically, you'll use your own plotting scripts and make "pretty plots", but you can also do this quickly by using Root interactively.
  • First you want to open root with two attached root files, this can be done by root -l file1.root file2.root
  • Next you want to make a histogram object so you can perform operations on it. The Root files are label as _file0, _file1, ...
  • These objects(_fileN) are TFiles and you can perform c++ operations just as in a script
  • From each object you want to get the histogram (MnvH1D) that is the cross-section and take the ratio and draw() it!

Step 2

This is the step you show to the whole collaboration to show that your analysis closes. You could skip straight to this step and maybe even succeed if you're lucky. But you'd have a lot of debugging to do if you failed. Most analyses do fail step 2 the first time they try to run it.

Your Task

Solution

  • to make ratio interactively
  • _file0->cd()
  • auto denominator = (PlotUtils::MnvH1D*)(gDirectory->Get("nameofhist1"))
  • _file1->cd()
  • auto numerator = (PlotUtils::MnvH1D*)(gDirectory->Get("nameofhist2"))
  • numerator->Divide(numerator, denominator)
  • numerator->Draw()