Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2D plotting changes #15

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

2D plotting changes #15

wants to merge 6 commits into from

Conversation

abasnet97
Copy link
Contributor

This PR pertains to the changes made to the 2D plotting methods in EFTPlotter script to handle duplicate point removal as a result of implementation of random starting points for 2D scans in MultiDimFit method. There are two main changes here:

  1. In parse_nll.py script, get_unique_points() has been slightly modified to take multiple scan_var_val (instead of just 1 value for 1d plotting)
  2. In EFTPlotter.py script, since the way 2D color maps and contour plots are made is slightly different than the way 1D plotting is done, I created a new function that takes multiple grid scan jobs, hadds all the root files, then loops inside the TTree in the hadded root file to select only the grid scan point with the least deltaNLL value. The function then writes these unique points to a new tree which is subsequently written to a new root file called "tmp.root" that is later on used for 2D plottings.
    Both the changes have been tested in multiple cases, and they work as expected.

Copy link
Contributor

@bryates bryates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I just have one comment.

@abasnet97
Copy link
Contributor Author

UPDATE: In commit ba67d63, I have modified LLPlot2DEFT() method to get rid of the tmp.root file once it is no longer needed.

Copy link
Contributor

@bryates bryates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry this went unnoticed for so long @abasnet97. I think all the changes look good. If you can confirm that this still runs without issue, feel free to merge it.

@abasnet97
Copy link
Contributor Author

@bryates, I have checked that things still work fine with this branch. I was able to run LLPlot2DEFT and ContourPlotEFT methods to make sure that the root file we get from combine after running 2D random starting point produce plots without any errors.

I have also merged changes from master and cleaned the conflicts. Let me know if you would like me to do some more checks before we can get this merged to master.

rootFile = ROOT.TFile.Open('../fit_files/higgsCombine{}.MultiDimFit.root'.format(name))
limitTree = rootFile.Get('limit')
rootFile = self.CreateNewLimitTreefor2DScan(name_lst,wcs)
limitTree = rootFile.limit
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line actually works? I would have expected it to be

limitTree = rootFile.Get('limit')

@@ -185,6 +191,28 @@ def GetWCsNLLFromRoot(self,base_name_lst,wc,unique=False):
return [graphwcs,graphnlls]


def CreateNewLimitTreefor2DScan(self,name_lst,wc_lst):
graphwcs, graphnlls = self.GetWCsNLLFromRoot(name_lst,wc_lst,unique=True)
newRootFile = ROOT.TFile("tmp.root","RECREATE") #temporary root file with new limit tree
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be more efficient to pass around the tree instead of making a temporary file. Don't worry about doing that in this PR, but maybe just something to think about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good idea. I think my logic back then was that this function would allow us to dump out a root file (if need be), and we could investigate the TTree inside this file if we wanted to. Since this was 2 years ago, I definitely didn't have as good of an understanding of the code as I have now, so I would probably have opted for a different way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants