cmstas / NanoTools

tools, usage examples for CMS nanoAOD
1 stars 15 forks source link

JERs #11

Closed VourMa closed 2 years ago

VourMa commented 2 years ago

This PR includes an implementation of applying the JER corrections and uncertainties on jets, taken from NanoAODTools.

The JER tags (for UL samples) used for the resolution and the SFs are included in the NanoCORE configuration and there is a script to download the relevant .txt files locally.

The JetResolutionUncertainty class takes care of calculating and applying the corrections and uncertainties, with an example application shown here. The class relies on a few NanoAODTools files, which are now included in the PR, and some CMSSW packages, which are kept as external. To account for that, the Makefile was modified.

Finally, the size of the GenJet array was increased to avoid crashes.

VourMa commented 2 years ago

The PR was tested with CMSSW_10_2_9 on events of the following sample: /ceph/cms/store/user/evourlio/skimOutput/skim2mu_1muPt50_1Mll100_allBranches_allFiles/ZPrimeToMuMuSB_M200_bestfit_TuneCP5_13TeV_Allanach_Y3_5f_madg20UL18MiniAODv2-106X_upgrade2018_realistic_v16_L1v1-v2_private_NANOAODSIM_skim2mu_1muPt50_1Mll100_allBranches_allFiles/merged/merged.root.

A modified version of doAll_ss.C and ScanChain_ss.C was used to print out the jet 4-vector before and after the application of the JER corrections. I quote a few events below. The nominal value seems to make sense, leaving the high-pT jets untouched and making a difference for jets with pT ~ 25 GeV or below. The up variation also seems reasonable, when compared to the nominal value.

Nominal value:

Event 1
--------
Before JERs: (84.3125,-0.176147,-2.72314,6.93359)
After JERs: (84.3125,-0.176147,-2.72314,6.93359)
Before JERs: (83.8125,-1.89185,-0.0590897,5.09375)
After JERs: (83.8125,-1.89185,-0.0590897,5.09375)
Before JERs: (25.125,-1.28467,1.36621,6.54688)
After JERs: (25.125,-1.28467,1.36621,6.54688)
Before JERs: (12.5,-1.07544,-2.6499,3.03125)
After JERs: (12.9756,-1.07544,-2.6499,3.14658)
Before JERs: (12.2422,4.80957,-1.47461,3.44727)
After JERs: (10.286,4.80957,-1.47461,2.89643)
Before JERs: (11.6875,-0.216614,2.61523,3)
After JERs: (11.6875,-0.216614,2.61523,3)
Before JERs: (10.9688,-2.75537,0.0863953,2.22852)
After JERs: (2.91674,-2.75537,0.0863953,0.592592)
Before JERs: (10.2656,-1.6106,-2.9624,1.89258)
After JERs: (10.2656,-1.6106,-2.9624,1.89258)
Before JERs: (10.2344,-4.62012,-0.372559,2.02539)
After JERs: (9.94357,-4.62012,-0.372559,1.96784)
Before JERs: (1.79102,-0.81604,1.12598,0.196533)
After JERs: (1.79102,-0.81604,1.12598,0.196533)
Before JERs: (0.000128746,-0.821533,1.66968,3.69549e-05)
After JERs: (0.00721033,-0.821533,1.66968,0.00206963)

Event 2
--------
Before JERs: (127.062,1.76416,0.926758,12.6484)
After JERs: (127.062,1.76416,0.926758,12.6484)
Before JERs: (112.562,2.10596,-2.18604,6.82422)
After JERs: (112.562,2.10596,-2.18604,6.82422)
Before JERs: (38.7188,0.105362,2.17578,6)
After JERs: (38.7188,0.105362,2.17578,6)
Before JERs: (30.3281,-0.450562,-1.12158,6.41797)
After JERs: (30.3281,-0.450562,-1.12158,6.41797)
Before JERs: (20.8125,-4.45996,0.194733,5.08203)
After JERs: (20.1544,-4.45996,0.194733,4.92133)
Before JERs: (20.3594,3.15674,-1.75049,4.60938)
After JERs: (20.9885,3.15674,-1.75049,4.7518)
Before JERs: (15.7734,1.31592,-1.48608,2.97461)
After JERs: (17.661,1.31592,-1.48608,3.33056)
Before JERs: (14.8047,-3.8999,-0.881958,3.70508)
After JERs: (15.8809,-3.8999,-0.881958,3.97441)
Before JERs: (13.9766,-2.63086,-2.64551,3.14648)
After JERs: (25.589,-2.63086,-2.64551,5.76074)
Before JERs: (11.9297,2.76074,-2.94385,3.08398)
After JERs: (11.3454,2.76074,-2.94385,2.93295)
Before JERs: (11.7578,-4.25684,-0.3078,3.07031)
After JERs: (12.7751,-4.25684,-0.3078,3.33596)
Before JERs: (11.2344,3.45361,-0.503906,2.61328)
After JERs: (13.7032,3.45361,-0.503906,3.18756)
Before JERs: (10.7031,3.94141,2.98584,2.66992)
After JERs: (8.90728,3.94141,2.98584,2.22194)
Before JERs: (10,-0.462097,2.38525,2.79297)
After JERs: (10.552,-0.462097,2.38525,2.94714)
Before JERs: (8.92188,-4.61816,0.829956,2.24414)
After JERs: (9.8176,-4.61816,0.829956,2.46945)
Before JERs: (8.67188,-4.96582,1.53223,2.13672)
After JERs: (11.1264,-4.96582,1.53223,2.74149)
Before JERs: (8.02344,3.70508,1.12988,2.14844)
After JERs: (8.66235,3.70508,1.12988,2.31952)

Up Variation:

Event 1
--------
Before JERs: (84.3125,-0.176147,-2.72314,6.93359)
After JERs: (84.3125,-0.176147,-2.72314,6.93359)
Before JERs: (83.8125,-1.89185,-0.0590897,5.09375)
After JERs: (83.8125,-1.89185,-0.0590897,5.09375)
Before JERs: (25.125,-1.28467,1.36621,6.54688)
After JERs: (25.125,-1.28467,1.36621,6.54688)
Before JERs: (12.5,-1.07544,-2.6499,3.03125)
After JERs: (13.0351,-1.07544,-2.6499,3.16102)
Before JERs: (12.2422,4.80957,-1.47461,3.44727)
After JERs: (7.57161,4.80957,-1.47461,2.13208)
Before JERs: (11.6875,-0.216614,2.61523,3)
After JERs: (11.6875,-0.216614,2.61523,3)
Before JERs: (10.9688,-2.75537,0.0863953,2.22852)
After JERs: (1.82232,-2.75537,0.0863953,0.370241)
Before JERs: (10.2656,-1.6106,-2.9624,1.89258)
After JERs: (10.2656,-1.6106,-2.9624,1.89258)
Before JERs: (10.2344,-4.62012,-0.372559,2.02539)
After JERs: (9.54004,-4.62012,-0.372559,1.88798)
Before JERs: (1.79102,-0.81604,1.12598,0.196533)
After JERs: (1.79102,-0.81604,1.12598,0.196533)
Before JERs: (0.000128746,-0.821533,1.66968,3.69549e-05)
After JERs: (0.00721033,-0.821533,1.66968,0.00206963)

Event 2
--------
Before JERs: (127.062,1.76416,0.926758,12.6484)
After JERs: (127.062,1.76416,0.926758,12.6484)
Before JERs: (112.562,2.10596,-2.18604,6.82422)
After JERs: (112.562,2.10596,-2.18604,6.82422)
Before JERs: (38.7188,0.105362,2.17578,6)
After JERs: (38.7188,0.105362,2.17578,6)
Before JERs: (30.3281,-0.450562,-1.12158,6.41797)
After JERs: (30.3281,-0.450562,-1.12158,6.41797)
Before JERs: (20.8125,-4.45996,0.194733,5.08203)
After JERs: (19.2411,-4.45996,0.194733,4.69833)
Before JERs: (20.3594,3.15674,-1.75049,4.60938)
After JERs: (21.8614,3.15674,-1.75049,4.94943)
Before JERs: (15.7734,1.31592,-1.48608,2.97461)
After JERs: (17.7499,1.31592,-1.48608,3.34734)
Before JERs: (14.8047,-3.8999,-0.881958,3.70508)
After JERs: (17.3742,-3.8999,-0.881958,4.34814)
Before JERs: (13.9766,-2.63086,-2.64551,3.14648)
After JERs: (28.2576,-2.63086,-2.64551,6.36152)
Before JERs: (11.9297,2.76074,-2.94385,3.08398)
After JERs: (11.266,2.76074,-2.94385,2.91242)
Before JERs: (11.7578,-4.25684,-0.3078,3.07031)
After JERs: (14.1867,-4.25684,-0.3078,3.70457)
Before JERs: (11.2344,3.45361,-0.503906,2.61328)
After JERs: (17.1289,3.45361,-0.503906,3.98443)
Before JERs: (10.7031,3.94141,2.98584,2.66992)
After JERs: (6.41533,3.94141,2.98584,1.60032)
Before JERs: (10,-0.462097,2.38525,2.79297)
After JERs: (10.5732,-0.462097,2.38525,2.95306)
Before JERs: (8.92188,-4.61816,0.829956,2.24414)
After JERs: (11.0605,-4.61816,0.829956,2.78208)
Before JERs: (8.67188,-4.96582,1.53223,2.13672)
After JERs: (14.5322,-4.96582,1.53223,3.58069)
Before JERs: (8.02344,3.70508,1.12988,2.14844)
After JERs: (9.54891,3.70508,1.12988,2.55691)