From 8d4db631fef5eabcbfdce7d72a17f25080c7d871 Mon Sep 17 00:00:00 2001 From: Jess Wong Wing Yan Date: Sat, 18 Apr 2020 19:24:09 +0200 Subject: [PATCH 1/3] Updated for Photon Loose ID --- etc/config/settings_pho_UL2017_LooseID.py | 349 ++++++++++++++++++++++ libPython/fitUtils.py | 15 +- tnpEGM_fitter_tuning.py | 247 +++++++++++++++ 3 files changed, 608 insertions(+), 3 deletions(-) create mode 100644 etc/config/settings_pho_UL2017_LooseID.py create mode 100644 tnpEGM_fitter_tuning.py diff --git a/etc/config/settings_pho_UL2017_LooseID.py b/etc/config/settings_pho_UL2017_LooseID.py new file mode 100644 index 000000000..5a449f7de --- /dev/null +++ b/etc/config/settings_pho_UL2017_LooseID.py @@ -0,0 +1,349 @@ +############################################################# +########## General settings +############################################################# +# flag to be Tested +flags = { + 'passingLoose100XV2' : '(passingLoose100XV2 == 1)', + 'passingMedium100XV2' : '(passingMedium100XV2 == 1)', + 'passingTight100XV2' : '(passingTight100XV2 == 1)', + 'passingMVA94XV2wp80' : '(passingMVA94XV2wp80 == 1)', + 'passingMVA94XV2wp90' : '(passingMVA94XV2wp90 == 1)', + } + +baseOutDir = 'results/UL2017/tnpPhoID/' + +############################################################# +########## samples definition - preparing the samples +############################################################# +### samples are defined in etc/inputs/tnpSampleDef.py +### not: you can setup another sampleDef File in inputs +import etc.inputs.tnpSampleDef as tnpSamples +tnpTreeDir = 'tnpPhoIDs' + +samplesDef = { + 'data' : tnpSamples.UL2017['data_Run2017B'].clone(), + 'mcNom' : tnpSamples.UL2017['DY_madgraph'].clone(), + 'mcAlt' : tnpSamples.UL2017['DY_amcatnloext'].clone(), + 'tagSel' : tnpSamples.UL2017['DY_madgraph'].clone(), +} +## can add data sample easily +samplesDef['data'].add_sample( tnpSamples.UL2017['data_Run2017C'] ) +samplesDef['data'].add_sample( tnpSamples.UL2017['data_Run2017D'] ) +samplesDef['data'].add_sample( tnpSamples.UL2017['data_Run2017E'] ) +samplesDef['data'].add_sample( tnpSamples.UL2017['data_Run2017F'] ) + +## some sample-based cuts... general cuts defined here after +## require mcTruth on MC DY samples and additional cuts +## all the samples MUST have different names (i.e. sample.name must be different for all) +## if you need to use 2 times the same sample, then rename the second one +#samplesDef['data' ].set_cut('run >= 273726') +samplesDef['data' ].set_tnpTree(tnpTreeDir) +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_tnpTree(tnpTreeDir) +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_tnpTree(tnpTreeDir) +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_tnpTree(tnpTreeDir) + +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_mcTruth() +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_mcTruth() +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_mcTruth() +if not samplesDef['tagSel'] is None: + samplesDef['tagSel'].rename('mcAltSel_DY_madgraph') + samplesDef['tagSel'].set_cut('tag_Ele_pt > 37') + +## set MC weight, simple way (use tree weight) +#weightName = 'totWeight' +#if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_weight(weightName) +#if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_weight(weightName) +#if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_weight(weightName) + +## set MC weight, can use several pileup rw for different data taking + +weightName = 'weights_2017_runBCDEF.totWeight' +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_weight(weightName) +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_weight(weightName) +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_weight(weightName) +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_puTree('/eos/cms/store/group/phys_egamma/swmukher/UL2017/PU_miniAOD/DY_madgraph_pho.pu.puTree.root') +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_puTree('/eos/cms/store/group/phys_egamma/swmukher/UL2017/PU_miniAOD/DY_amcatnloext_pho.pu.puTree.root') +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_puTree('/eos/cms/store/group/phys_egamma/swmukher/UL2017/PU_miniAOD/DY_madgraph_pho.pu.puTree.root') + + + +############################################################# +########## bining definition [can be nD bining] +############################################################# +biningDef = [ + { 'var' : 'ph_sc_eta' , 'type': 'float', 'bins': [-2.5,-2.0,-1.566,-1.4442, -0.8, 0.0, 0.8, 1.4442, 1.566, 2.0, 2.5] }, +# { 'var' : 'ph_et' , 'type': 'float', 'bins': [20,35,50,100,500] }, + { 'var' : 'ph_et' , 'type': 'float', 'bins': [20,35,50,100,200,500] }, +] + +############################################################# +########## Cuts definition for all samples +############################################################# +### cut +cutBase = 'tag_Ele_pt > 35 && abs(tag_sc_eta) < 2.17' + +# can add addtionnal cuts for some bins (first check bin number using tnpEGM --checkBins) +#LS: we removed the met cuts cause JEC not ready for UL2017 +#additionalCuts = { +# 0 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 1 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 2 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 3 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 4 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 5 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 6 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 7 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 8 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 9 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +#} + +#### or remove any additional cut (default) +additionalCuts = None + +############################################################# +########## fitting params to tune fit by hand if necessary +############################################################# +tnpParNomFit = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.9,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.9,0.5,5.0]", + "acmsP[60.,50.,80.]","betaP[0.05,0.01,0.08]","gammaP[0.1, -2, 2]","peakP[90.0]", + "acmsF[60.,50.,80.]","betaF[0.05,0.01,0.08]","gammaF[0.1, -2, 2]","peakF[90.0]", + ] + +tnpParAltSigFit = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ] + +tnpParAltSigFit_addGaus = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,6.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "meanGF[80.0,70.0,100.0]","sigmaGF[15,5.0,125.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,85.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ] + +tnpParAltBkgFit = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.9,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.9,0.5,5.0]", + "alphaP[0.,-5.,5.]", + "alphaF[0.,-5.,5.]", + ] + +tnpParAltBkgFit_Chebychev = [ + "meanP[0.0, -2.0, 2.0]", "sigmaP[0.7, 0.4, 2.0]", + "meanF[0.0, -2.0, 2.0]", "sigmaF[0.7, 0.4, 2.5]", + "p0P[1.100, 0.900, 1.500]", "p1P[0.15, 0.100, 0.900]", "p2P[0.05, 0.000, 0.400]", + "p0F[-0.300, -5.0, 5.0]", "p1F[-0.3, -5.0, 5.0]", "p2F[0.15, -5.0, 5.0]" +] + + +############################################################# +########## fitting params tunning +############################################################# +tnpParNomFitTuneByBin = { +} +tnpParAltSigFitMCTuneByBin = { +11 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +14 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.6,0.5,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[1,-5,5]',"sigmaP_2[1.0,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.9,0.5,15.0]","alphaF[2.0,1.2.5,3.5]",'nF[1,-5,5]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +19 : [ + "meanP[0.1,-5.0,5.0]","sigmaP[0.8,0.5,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[1,-5,10]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[1.0,-5.0,5.0]","sigmaF[1.0,0.5,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[1,-5,10]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +20 : [ + "meanP[-1.1,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +21 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-2.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +23 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[0.7,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,3.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.055,0.01,0.06]","gammaF[0.8, 0.005, 1]","peakF[90.0]", + ], +24 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[1.3,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +25 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-3.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +26 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +28 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-2.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +29 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-2.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +} + +tnpParAltSigFitTuneByBin = { +3 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[1.0,-5.0,5.0]","sigmaF[2,0.7,6.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.6,0.5,0.9]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.05,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +11 : [ + "meanP[1.0,-5.0,5.0]","sigmaP[0.6,0.5,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[1,-5,5]',"sigmaP_2[1.0,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[1.5,-5.0,5.0]","sigmaF[0.9,0.5,15.0]","alphaF[2.0,1.2,3.5]",'nF[1,-5,5]',"sigmaF_2[1.5,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +13 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[2.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,200.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +14 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,200.]","betaF[0.012,0.01,0.06]","gammaF[0.005, 0.001, 1]","peakF[90.0]", + ], +18 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[1.0,-2.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.02,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +19 : [ + "meanP[0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[1.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.02,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.02,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +20 : [ + "meanP[-1.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-3.5,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.55,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +21 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +23 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.5,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,3.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.04,0.005,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +24 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.0,-5.0,5.0]","sigmaF[1.5,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[1.5,0.5,6.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +25 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.02,0.01,0.1]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[100.,50.,300.]","betaF[0.055,0.01,0.06]","gammaF[0.3, 0.005, 1]","peakF[90.0]", + ], +26 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[100.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.02, 0.005, 1]","peakF[90.0]", + ], +28 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[0.5,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +29 : [ + "meanP[0.2,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.55,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[200.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +33 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.02, 0.005, 1]","peakF[90.0]", + ], +35 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.6,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.02,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +} + +tnpParAltBkgFitTuneByBin = { +23 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.9,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.9,0.5,5.0]", + "alphaP[0.,-5.,5.]", + "alphaF[-1.,-5.,5.]", + ], +30 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.6,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.7,0.5,5.0]", + "alphaP[3.,-5.,5.]", + "alphaF[1.,-5.,5.]", + ], +35 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.9,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.7,0.5,5.0]", + "alphaP[0.,-5.,5.]", + "alphaF[1.,-5.,5.]", + ], +36 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.9,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.7,0.5,5.0]", + "alphaP[0.,-5.,5.]", + "alphaF[1.,-5.,5.]", + ], +34 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.6,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.7,0.5,5.0]", + "alphaP[-1.,-5.,5.]", + "alphaF[1.,-5.,5.]", + ], +} + + diff --git a/libPython/fitUtils.py b/libPython/fitUtils.py index 5a0626b26..f827feb13 100644 --- a/libPython/fitUtils.py +++ b/libPython/fitUtils.py @@ -122,7 +122,7 @@ def histFitterNominal( sample, tnpBin, tnpWorkspaceParam ): workspace = rt.vector("string")() for iw in tnpWorkspace: workspace.push_back(iw) - fitter.setWorkspace( workspace ) + fitter.setWorkspace( workspace ,0) title = tnpBin['title'].replace(';',' - ') title = title.replace('probe_sc_eta','#eta_{SC}') @@ -195,7 +195,7 @@ def histFitterAltSig( sample, tnpBin, tnpWorkspaceParam, isaddGaus=0 ): ############################################################# ########## alternate background fitter ############################################################# -def histFitterAltBkg( sample, tnpBin, tnpWorkspaceParam ): +def histFitterAltBkg( sample, tnpBin, tnpWorkspaceParam , isChebychev=0): tnpWorkspaceFunc = [ "Gaussian::sigResPass(x,meanP,sigmaP)", @@ -204,6 +204,15 @@ def histFitterAltBkg( sample, tnpBin, tnpWorkspaceParam ): "Exponential::bkgFail(x, alphaF)", ] + if (isChebychev): + tnpWorkspaceFunc = [] + tnpWorkspaceFunc = [ + "Gaussian::sigResPass(x,meanP,sigmaP)", + "Gaussian::sigResFail(x,meanF,sigmaF)", + "RooChebychev::bkgPass(x, {p0P, p1P, p2P})", + "RooChebychev::bkgFail(x, {p0F, p1F, p2F})", + ] + tnpWorkspace = [] tnpWorkspace.extend(tnpWorkspaceParam) tnpWorkspace.extend(tnpWorkspaceFunc) @@ -235,7 +244,7 @@ def histFitterAltBkg( sample, tnpBin, tnpWorkspaceParam ): workspace = rt.vector("string")() for iw in tnpWorkspace: workspace.push_back(iw) - fitter.setWorkspace( workspace ) + fitter.setWorkspace( workspace ,0) title = tnpBin['title'].replace(';',' - ') title = title.replace('probe_sc_eta','#eta_{SC}') diff --git a/tnpEGM_fitter_tuning.py b/tnpEGM_fitter_tuning.py new file mode 100644 index 000000000..af1614957 --- /dev/null +++ b/tnpEGM_fitter_tuning.py @@ -0,0 +1,247 @@ + +### python specific import +import argparse +import os +import sys +import pickle +import shutil + + +parser = argparse.ArgumentParser(description='tnp EGM fitter') +parser.add_argument('--checkBins' , action='store_true' , help = 'check bining definition') +parser.add_argument('--createBins' , action='store_true' , help = 'create bining definition') +parser.add_argument('--createHists', action='store_true' , help = 'create histograms') +parser.add_argument('--sample' , default='all' , help = 'create histograms (per sample, expert only)') +parser.add_argument('--altSig' , action='store_true' , help = 'alternate signal model fit') +parser.add_argument('--addGaus' , action='store_true' , help = 'add gaussian to alternate signal model failing probe') +parser.add_argument('--altBkgCheby', action='store_true' , help = 'switch to Chebychev as alternate background model.') +parser.add_argument('--altBkg' , action='store_true' , help = 'alternate background model fit') +parser.add_argument('--doFit' , action='store_true' , help = 'fit sample (sample should be defined in settings.py)') +parser.add_argument('--mcSig' , action='store_true' , help = 'fit MC nom [to init fit parama]') +parser.add_argument('--doPlot' , action='store_true' , help = 'plotting') +parser.add_argument('--sumUp' , action='store_true' , help = 'sum up efficiencies') +parser.add_argument('--iBin' , dest = 'binNumber' , type = int, default=-1, help='bin number (to refit individual bin)') +parser.add_argument('--flag' , default = None , help ='WP to test') +parser.add_argument('settings' , default = None , help = 'setting file [mandatory]') + + +args = parser.parse_args() + +print '===> settings %s <===' % args.settings +importSetting = 'import %s as tnpConf' % args.settings.replace('/','.').split('.py')[0] +print importSetting +exec(importSetting) + +### tnp library +import libPython.binUtils as tnpBiner +import libPython.rootUtils as tnpRoot + + +if args.flag is None: + print '[tnpEGM_fitter] flag is MANDATORY, this is the working point as defined in the settings.py' + sys.exit(0) + +if not args.flag in tnpConf.flags.keys() : + print '[tnpEGM_fitter] flag %s not found in flags definitions' % args.flag + print ' --> define in settings first' + print ' In settings I found flags: ' + print tnpConf.flags.keys() + sys.exit(1) + +outputDirectory = '%s/%s/' % (tnpConf.baseOutDir,args.flag) + +print '===> Output directory: ' +print outputDirectory + + +#################################################################### +##### Create (check) Bins +#################################################################### +if args.checkBins: + tnpBins = tnpBiner.createBins(tnpConf.biningDef,tnpConf.cutBase) + tnpBiner.tuneCuts( tnpBins, tnpConf.additionalCuts ) + for ib in range(len(tnpBins['bins'])): + print tnpBins['bins'][ib]['name'] + print ' - cut: ',tnpBins['bins'][ib]['cut'] + sys.exit(0) + +if args.createBins: + if os.path.exists( outputDirectory ): + shutil.rmtree( outputDirectory ) + os.makedirs( outputDirectory ) + tnpBins = tnpBiner.createBins(tnpConf.biningDef,tnpConf.cutBase) + tnpBiner.tuneCuts( tnpBins, tnpConf.additionalCuts ) + pickle.dump( tnpBins, open( '%s/bining.pkl'%(outputDirectory),'wb') ) + print 'created dir: %s ' % outputDirectory + print 'bining created successfully... ' + print 'Note than any additional call to createBins will overwrite directory %s' % outputDirectory + sys.exit(0) + +tnpBins = pickle.load( open( '%s/bining.pkl'%(outputDirectory),'rb') ) + + +#################################################################### +##### Create Histograms +#################################################################### +for s in tnpConf.samplesDef.keys(): + sample = tnpConf.samplesDef[s] + if sample is None: continue + setattr( sample, 'tree' ,'%s/fitter_tree' % tnpConf.tnpTreeDir ) + setattr( sample, 'histFile' , '%s/%s_%s.root' % ( outputDirectory , sample.name, args.flag ) ) + + +if args.createHists: + + import libPython.histUtils as tnpHist + + for sampleType in tnpConf.samplesDef.keys(): + sample = tnpConf.samplesDef[sampleType] + if sample is None : continue + if sampleType == args.sample or args.sample == 'all' : + print 'creating histogram for sample ' + sample.dump() + var = { 'name' : 'pair_mass', 'nbins' : 80, 'min' : 50, 'max': 130 } + if sample.mcTruth: + var = { 'name' : 'pair_mass', 'nbins' : 80, 'min' : 50, 'max': 130 } + tnpHist.makePassFailHistograms( sample, tnpConf.flags[args.flag], tnpBins, var ) + + sys.exit(0) + + +#################################################################### +##### Actual Fitter +#################################################################### +sampleToFit = tnpConf.samplesDef['data'] +if sampleToFit is None: + print '[tnpEGM_fitter, prelim checks]: sample (data or MC) not available... check your settings' + sys.exit(1) + +sampleMC = tnpConf.samplesDef['mcNom'] + +if sampleMC is None: + print '[tnpEGM_fitter, prelim checks]: MC sample not available... check your settings' + sys.exit(1) +for s in tnpConf.samplesDef.keys(): + sample = tnpConf.samplesDef[s] + if sample is None: continue + setattr( sample, 'mcRef' , sampleMC ) + setattr( sample, 'nominalFit', '%s/%s_%s.nominalFit.root' % ( outputDirectory , sample.name, args.flag ) ) + setattr( sample, 'altSigFit' , '%s/%s_%s.altSigFit.root' % ( outputDirectory , sample.name, args.flag ) ) + setattr( sample, 'altBkgFit' , '%s/%s_%s.altBkgFit.root' % ( outputDirectory , sample.name, args.flag ) ) + + + +### change the sample to fit is mc fit +if args.mcSig : + sampleToFit = tnpConf.samplesDef['mcNom'] + +if args.doFit: + sampleToFit.dump() + for ib in range(len(tnpBins['bins'])): + if (args.binNumber >= 0 and ib == args.binNumber) or args.binNumber < 0: + if args.altSig and not args.addGaus: + if args.mcSig and ib in tnpConf.tnpParAltSigFitMCTuneByBin.keys(): + tnpRoot.histFitterAltSig( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFitMCTuneByBin[ib] ) + elif (not args.mcSig) and ib in tnpConf.tnpParAltSigFitTuneByBin.keys(): + tnpRoot.histFitterAltSig( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFitTuneByBin[ib] ) + else: + tnpRoot.histFitterAltSig( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFit ) + elif args.altSig and args.addGaus: + tnpRoot.histFitterAltSig( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltSigFit_addGaus, 1) + elif args.altBkg and not args.altBkgCheby: + if ib in tnpConf.tnpParAltBkgFitTuneByBin.keys(): + tnpRoot.histFitterAltBkg( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltBkgFitTuneByBin[ib] ) + else: + tnpRoot.histFitterAltBkg( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltBkgFit ) + elif args.altBkg and args.altBkgCheby: + tnpRoot.histFitterAltBkg( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParAltBkgFit_Chebychev, 1) + else: + if ib in tnpConf.tnpParNomFitTuneByBin.keys(): + print ('use tuned parameters: ', tnpConf.tnpParNomFitTuneByBin[ib]) + tnpRoot.histFitterNominal( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParNomFitTuneByBin[ib]) + else: + tnpRoot.histFitterNominal( sampleToFit, tnpBins['bins'][ib], tnpConf.tnpParNomFit ) + + args.doPlot = True + +#################################################################### +##### dumping plots +#################################################################### +if args.doPlot: + fileName = sampleToFit.nominalFit + fitType = 'nominalFit' + if args.altSig : + fileName = sampleToFit.altSigFit + fitType = 'altSigFit' + if args.altBkg : + fileName = sampleToFit.altBkgFit + fitType = 'altBkgFit' + + plottingDir = '%s/plots/%s/%s' % (outputDirectory,sampleToFit.name,fitType) + if not os.path.exists( plottingDir ): + os.makedirs( plottingDir ) + shutil.copy('etc/inputs/index.php.listPlots','%s/index.php' % plottingDir) + + for ib in range(len(tnpBins['bins'])): + if (args.binNumber >= 0 and ib == args.binNumber) or args.binNumber < 0: + tnpRoot.histPlotter( fileName, tnpBins['bins'][ib], plottingDir ) + + print ' ===> Plots saved in <=======' +# print 'localhost/%s/' % plottingDir + + +#################################################################### +##### dumping egamma txt file +#################################################################### +if args.sumUp: + sampleToFit.dump() + info = { + 'data' : sampleToFit.histFile, + 'dataNominal' : sampleToFit.nominalFit, + 'dataAltSig' : sampleToFit.altSigFit , + 'dataAltBkg' : sampleToFit.altBkgFit , + 'mcNominal' : sampleToFit.mcRef.histFile, + 'mcAlt' : None, + 'tagSel' : None + } + + if not tnpConf.samplesDef['mcAlt' ] is None: + info['mcAlt' ] = tnpConf.samplesDef['mcAlt' ].histFile + if not tnpConf.samplesDef['tagSel'] is None: + info['tagSel' ] = tnpConf.samplesDef['tagSel'].histFile + + effis = None + effFileName ='%s/egammaEffi.txt' % outputDirectory + fOut = open( effFileName,'w') + + for ib in range(len(tnpBins['bins'])): + effis = tnpRoot.getAllEffi( info, tnpBins['bins'][ib] ) + + ### formatting assuming 2D bining -- to be fixed + v1Range = tnpBins['bins'][ib]['title'].split(';')[1].split('<') + v2Range = tnpBins['bins'][ib]['title'].split(';')[2].split('<') + if ib == 0 : + astr = '### var1 : %s' % v1Range[1] + print astr + fOut.write( astr + '\n' ) + astr = '### var2 : %s' % v2Range[1] + print astr + fOut.write( astr + '\n' ) + + astr = '%+8.3f\t%+8.3f\t%+8.3f\t%+8.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f\t%5.3f' % ( + float(v1Range[0]), float(v1Range[2]), + float(v2Range[0]), float(v2Range[2]), + effis['dataNominal'][0],effis['dataNominal'][1], + effis['mcNominal' ][0],effis['mcNominal' ][1], + effis['dataAltBkg' ][0], + effis['dataAltSig' ][0], + effis['mcAlt' ][0], + effis['tagSel'][0], + ) + print astr + fOut.write( astr + '\n' ) + fOut.close() + + print 'Effis saved in file : ', effFileName + import libPython.EGammaID_scaleFactors as egm_sf + egm_sf.doEGM_SFs(effFileName,sampleToFit.lumi) From 3cd6a54c7de37f95c2f1ca3d6d9b1fa5511c0de9 Mon Sep 17 00:00:00 2001 From: JessWYWong <36486758+JessWYWong@users.noreply.github.com> Date: Sat, 18 Apr 2020 13:42:06 -0400 Subject: [PATCH 2/3] Create README_LooseID.md --- README_LooseID.md | 217 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 README_LooseID.md diff --git a/README_LooseID.md b/README_LooseID.md new file mode 100644 index 000000000..d08b210c4 --- /dev/null +++ b/README_LooseID.md @@ -0,0 +1,217 @@ +# egm_tnp_analysis + + +## Install stable branch + +>git clone -b egm_tnp_CleanedCodeForUL_17March2020 https://github.com/lsoffi/egm_tnp_analysis + +> cd egm_tnp_analysis + +> source etc/scripts/setupUL.sh (need ROOT>6.10) + +> make + +## Quick description + +Package to handle analysis of tnp trees. The main tool is the python fitter + + ===> tnpEGM_fitter.py + +The interface between the user and the fitter is solely done via the settings file + + ===> etc/config/settings.py + - set the flags (i.e. Working points) that can be tested + - set the different samples and location + - set the fitting bins + - set the different cuts to be used + - set the output directory + +Help message: +> python tnpEGM_fitter.py --help + +The settings have always to be passed to the fitter +> python tnpEGM_fitter.py etc/config/settings.py + +Several "settings*.py" files are setup for different eras and are located all in etc/config/ + + +## The different fitting steps +Everything will be done for a specific flag (so the settings can be the same for different flags). Hence, the flag to be used must be specified each time (named myWP in following). + +**1. Create the bining.** To each bin is associated a cut that can be tuned bin by bin in the settings.py + * After setting up the settings.py check bins + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --checkBins + + * if you need additinal cuts for some bins (cleaning cuts), tune cuts in the settings.py, then recheck. + Once satisfied, create the bining + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --createBins + + * CAUTION: when recreacting bins, the output directory is overwritten! So be sure to not redo that once you are at step2 + +**2. Create the histograms** with the different cuts... this is the longest step. Histograms will not be re-done later + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --createHists + +**3. Do your first round of fits.** + * nominal fit + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit + + * MC fit to constrain alternate signal parameters [note this is the only MC fit that makes sense] + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig + + * Alternate signal fit (using constraints from previous fits) + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altSig + + * Alternate background fit (using constraints from previous fits) + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altBkg + +**4. Check fits and redo failed ones.** (there is a web index.php in the plot directory to vizualize from the web) + * can redo a given bin using its bin number ib. + The bin number can be found from --checkBins, directly in the ouput dir (or web interface) + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --iBin ib + + * the initial parameters can be tuned for this particular bin in the settings.py file. + Once the fit is good enough, do not redo all fits, just fix next failed fit. + One can redo any kind of fit bin by bin. For instance the MC with altSig fit (if the constraint parameters were bad in the altSig for instance) + +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig --iBin ib + +**4. Change fits function for 20 < pT < 35 bins + * add an extra Gaussian for altSig +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig --addGaus --iBin 1 +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig --addGaus --iBin 3 +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig --addGaus --iBin 4 +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig --addGaus --iBin 5 +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig --addGaus --iBin 6 +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --mcSig --altSig --addGaus --iBin 8 + +> python tnpEGM_fitter.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altSig --addGaus --iBin 1 +> python tnpEGM_fitter.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altSig --addGaus --iBin 3 +> python tnpEGM_fitter.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altSig --addGaus --iBin 4 +> python tnpEGM_fitter.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altSig --addGaus --iBin 5 +> python tnpEGM_fitter.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altSig --addGaus --iBin 6 +> python tnpEGM_fitter.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altSig --addGaus --iBin 8 + + * rerun altBkg +> python tnpEGM_fitter_tuning.py etc/config/settings_pho_UL2017_LooseID.py --flag passingLoose100XV2 --doFit --altBkg + + +**5. egm txt ouput file.** Once all fits are fine, put everything in the egm format txt file + +> python tnpEGM_fitter_tuning.py etc/config/setting_pho_UL2017_LooseID.py --flag passingLoose100XV2 --sumUp + + +## The settings file + +The settings file includes all the necessary information for a given setup of fit + +**- General settings.** + + * flag: this is the Working point in the tnpTree (pass: flagCut ; fail !flagCut). The name of the flag myWP is the one to be passed +to the fitter. One can handle complex flags with a cut string (root cut string): +> flag = { 'myWP' : myWPCutString } + + * baseOutDir: the output directory (will be created by the fitter) + +**- Sample definition.** + + * tnpTreeDir: the directory in the tnpTree (different for phoID, eleID, reco, hlt) + + * samplesDef: these are the main info + - data: data ntuple + - mcNom: nominal MC sample + - mcAlt: MC for generator syst + - tagSel: usually same as nominal MC + different base cuts: check the tag selection syst + + The sample themselves are defined in etc/inputs/tnpSampleDef.py (the attribute nEvts, lumi are not necessary for the fit per-se and can be omitted). + A list of samples for ICHEP2016 from official egm production is already setup properly in the package. + Then in the settings.py the sample can be specified further: + - sample.set_mctruth() : force mc truth on a MC sample + - sample.rename('xxx') : if a sample is used 2 times (like with 2 different sets of cuts), it has to be renamed for the second use + - sample.set_cut(cut) : add a cut to define the sample (like a run range for data or an additional tag selection for alt tag selection syst) + - sample.set_weight('totWeight') : name of the weight to be used for MC reweighting (totWeight in this example). Note: the tool can handle a pu Tree to reweight a MC with different PU scenario (ask for further explanations and/or settings_rwPU.py example) + + +**- Cuts.** + + * cutBase: Define here the main cut + * additionalCuts: can be used for cleaning cuts (or put additionalCuts = None) + +**- Fitting parameters.** + + Define in this section the init parameters for the different fit, can be tuned to improve convergence. + + +## Changes for UL preparation: + +IMPORTANT-1: one single tnpSampleDef.py file for all eras. + +IMPORTANT-2: I used a specific name system that i would ask you to follow and maintain also in the future for next eras: + +If i want to run on PromptReco2018, then: + +1. In tnpSampleDef.py i add an eos directory called eosPromptReco2018 and a module called PromptReco2018 with files inside + +2. I use a dedicated setting_ele_PromptReco2018.py and setting_pho_PromptReco2018.py where inside: + + 2.1 i specifically call the module PromptReco2018 + + 2.2 I call the output directory results/PromptReco2018/blabla + + +At the moment the eras are: + +LegacyReReco2016 + +ReReco2017 + +PromptReco2018 + +UL2017 + +We will add soon: + +UL2018 + +UL2016 + +==================== + +## Update PU weights + +1. Pileup files have to be computed with: python etc/scripts/pureweight.py + +Here one has to update the name of the directory whre the files will be located and the corresponding names. + + +2.This pyhton uses the following: libPython/puReweighter.py. + +Here one nees to add the PU MC mix numbers that are available here: http://cmslxr.fnal.gov/source/SimGeneral/MixingModule/python/?v=CMSSW_9_4_0 + +One also needs to update sample names here: +etc/inputs/tnpSampleDef.py + +3.The data PU distrubtions can be computed using the following instructions (similar to what is done in step1): + +pileupCalc.py -i /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/PromptReco/Cert_294927-306462_13TeV_PromptReco_Collisions17_JSON.txt --inputLumiJSON /afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/PileUp/pileup_latest.txt --calcMode true --minBiasXsec 69200 --maxPileupBin 100 --numPileupBins 100 pileup_2017_41fb.root + +Other pu files for each run, like pileup_2017_RUNB.root, pileup_2017_RUNC.root etc, can be copied from previous location. The previous location of pu directory can be found in github. For example, in this version, the location is, +/eos/cms/store/group/phys_egamma/swmukher/tnp/ID_V2_2017/PU + + +The nvtx and rho histos are not needed because we will use the pu method (type = 0) for the reweight. + +NB: Before using these py in order to load the needed libraires one has to run: +export PYTHONPATH=$PYTHONPATH:/afs/cern.ch/user/s/soffi/scratch0/TEST/CMSSW-10-0-0-pre3/src/egm_tnp_analysis + + +#### adding remote (Fabrice version) +git remote add origin git@github.com:fcouderc/egm_tnp_analysis.git + From c935a05fd4fd14d70afe2dbb6dfe609769f42ce8 Mon Sep 17 00:00:00 2001 From: Jess Wong Wing Yan Date: Wed, 22 Jul 2020 14:24:57 +0200 Subject: [PATCH 3/3] UL2018 Photon config --- etc/config/settings_pho_UL2018_LooseID.py | 271 ++++++++++++++++++++++ 1 file changed, 271 insertions(+) create mode 100644 etc/config/settings_pho_UL2018_LooseID.py diff --git a/etc/config/settings_pho_UL2018_LooseID.py b/etc/config/settings_pho_UL2018_LooseID.py new file mode 100644 index 000000000..c6a17099c --- /dev/null +++ b/etc/config/settings_pho_UL2018_LooseID.py @@ -0,0 +1,271 @@ +############################################################# +########## General settings +############################################################# +# flag to be Tested +flags = { + 'passingLoose100XV2' : '(passingLoose100XV2 == 1)', + 'passingMedium100XV2' : '(passingMedium100XV2 == 1)', + 'passingTight100XV2' : '(passingTight100XV2 == 1)', + 'passingMVA94XV2wp80' : '(passingMVA94XV2wp80 == 1)', + 'passingMVA94XV2wp90' : '(passingMVA94XV2wp90 == 1)', + } + +baseOutDir = 'results/UL2018/tnpPhoID/' + +############################################################# +########## samples definition - preparing the samples +############################################################# +### samples are defined in etc/inputs/tnpSampleDef.py +### not: you can setup another sampleDef File in inputs +import etc.inputs.tnpSampleDef as tnpSamples +tnpTreeDir = 'tnpPhoIDs' + +samplesDef = { + 'data' : tnpSamples.UL2018['data_Run2018A'].clone(), + 'mcNom' : tnpSamples.UL2018['DY_madgraph'].clone(), + 'mcAlt' : tnpSamples.UL2018['DY_amcatnloext'].clone(), + 'tagSel' : tnpSamples.UL2018['DY_madgraph'].clone(), +} +## can add data sample easily +samplesDef['data'].add_sample( tnpSamples.UL2018['data_Run2018B'] ) +samplesDef['data'].add_sample( tnpSamples.UL2018['data_Run2018C'] ) +samplesDef['data'].add_sample( tnpSamples.UL2018['data_Run2018D'] ) + +## some sample-based cuts... general cuts defined here after +## require mcTruth on MC DY samples and additional cuts +## all the samples MUST have different names (i.e. sample.name must be different for all) +## if you need to use 2 times the same sample, then rename the second one +#samplesDef['data' ].set_cut('run >= 273726') +samplesDef['data' ].set_tnpTree(tnpTreeDir) +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_tnpTree(tnpTreeDir) +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_tnpTree(tnpTreeDir) +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_tnpTree(tnpTreeDir) + +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_mcTruth() +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_mcTruth() +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_mcTruth() +if not samplesDef['tagSel'] is None: + samplesDef['tagSel'].rename('mcAltSel_DY_madgraph') + samplesDef['tagSel'].set_cut('tag_Ele_pt > 37') + +## set MC weight, simple way (use tree weight) +#weightName = 'totWeight' +#if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_weight(weightName) +#if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_weight(weightName) +#if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_weight(weightName) + +## set MC weight, can use several pileup rw for different data taking + +weightName = 'weights_2018_runABCD.totWeight' +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_weight(weightName) +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_weight(weightName) +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_weight(weightName) +if not samplesDef['mcNom' ] is None: samplesDef['mcNom' ].set_puTree('/eos/cms/store/group/phys_egamma/asroy/Tag-and-Probe_Tree/UL2018_MINIAOD_Nm1/PU_Trees/DY_madgraph_pho.pu.puTree.root') +if not samplesDef['mcAlt' ] is None: samplesDef['mcAlt' ].set_puTree('/eos/cms/store/group/phys_egamma/asroy/Tag-and-Probe_Tree/UL2018_MINIAOD_Nm1/PU_Trees/DY_amcatnloext_pho.pu.puTree.root') +if not samplesDef['tagSel'] is None: samplesDef['tagSel'].set_puTree('/eos/cms/store/group/phys_egamma/asroy/Tag-and-Probe_Tree/UL2018_MINIAOD_Nm1/PU_Trees/DY_madgraph_pho.pu.puTree.root') + + + +############################################################# +########## bining definition [can be nD bining] +############################################################# +biningDef = [ + { 'var' : 'ph_sc_eta' , 'type': 'float', 'bins': [-2.5,-2.0,-1.566,-1.4442, -0.8, 0.0, 0.8, 1.4442, 1.566, 2.0, 2.5] }, +# { 'var' : 'ph_et' , 'type': 'float', 'bins': [20,35,50,100,500] }, + { 'var' : 'ph_et' , 'type': 'float', 'bins': [20,35,50,100,200,500] }, +] + +############################################################# +########## Cuts definition for all samples +############################################################# +### cut +cutBase = 'tag_Ele_pt > 35 && abs(tag_sc_eta) < 2.17' + +# can add addtionnal cuts for some bins (first check bin number using tnpEGM --checkBins) +#LS: we removed the met cuts cause JEC not ready for UL2018 +#additionalCuts = { +# 0 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 1 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 2 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 3 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 4 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 5 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 6 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 7 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 8 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +# 9 : 'sqrt( 2*event_met_pfmet*tag_Ele_pt*(1-cos(event_met_pfphi-tag_Ele_phi))) < 45', +#} + +#### or remove any additional cut (default) +additionalCuts = None + +############################################################# +########## fitting params to tune fit by hand if necessary +############################################################# +tnpParNomFit = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.9,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.9,0.5,5.0]", + "acmsP[60.,50.,80.]","betaP[0.05,0.01,0.08]","gammaP[0.1, -2, 2]","peakP[90.0]", + "acmsF[60.,50.,80.]","betaF[0.05,0.01,0.08]","gammaF[0.1, -2, 2]","peakF[90.0]", + ] + +tnpParAltSigFit = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ] + +tnpParAltSigFit_addGaus = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,6.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "meanGF[80.0,70.0,100.0]","sigmaGF[15,5.0,125.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,85.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ] + +tnpParAltBkgFit = [ + "meanP[-0.0,-5.0,5.0]","sigmaP[0.9,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[0.9,0.5,5.0]", + "alphaP[0.,-5.,5.]", + "alphaF[0.,-5.,5.]", + ] + +tnpParAltBkgFit_Chebychev = [ + "meanP[0.0, -2.0, 2.0]", "sigmaP[0.7, 0.4, 2.0]", + "meanF[0.0, -2.0, 2.0]", "sigmaF[0.7, 0.4, 2.5]", + "p0P[1.100, 0.900, 1.500]", "p1P[0.15, 0.100, 0.900]", "p2P[0.05, 0.000, 0.400]", + "p0F[-0.300, -5.0, 5.0]", "p1F[-0.3, -5.0, 5.0]", "p2F[0.15, -5.0, 5.0]" +] + + +############################################################# +########## fitting params tunning +############################################################# +tnpParNomFitTuneByBin = { +} +tnpParAltSigFitMCTuneByBin = { +14 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,10]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +18 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[1.5,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +20 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +21 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-2.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +23 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[0.7,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,3.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.055,0.01,0.06]","gammaF[0.8, 0.005, 1]","peakF[90.0]", + ], +24 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[1.3,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +25 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-3.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +26 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-1.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +28 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-2.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +29 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[-2.0,-3.5,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[-1.0,-3.5,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +} +tnpParAltSigFitTuneByBin = { +14 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[1.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,10]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.02,0.005,0.1]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +18 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.5,-2.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,75.]","betaF[0.02,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +20 : [ + "meanP[-1.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-3.5,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.55,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +21 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +23 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.5,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,3.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,300.]","betaF[0.04,0.005,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +24 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[1.5,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[1.5,0.5,6.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,75.]","betaP[0.04,0.01,0.06]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,150.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +25 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[1.2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[1.2,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.02,0.01,0.1]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[100.,50.,300.]","betaF[0.055,0.01,0.06]","gammaF[0.3, 0.005, 1]","peakF[90.0]", + ], +26 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-1.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[1,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[100.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.02, 0.005, 1]","peakF[90.0]", + ], +28 : [ + "meanP[-0.0,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[0.5,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.51,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[60.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +29 : [ + "meanP[0.2,-5.0,5.0]","sigmaP[1,0.7,6.0]","alphaP[2.0,1.2,3.5]" ,'nP[3,-5,5]',"sigmaP_2[1.5,0.5,6.0]","sosP[1,0.5,5.0]", + "meanF[-0.0,-5.0,5.0]","sigmaF[2,0.7,15.0]","alphaF[2.0,1.2,3.5]",'nF[3,-5,5]',"sigmaF_2[2.0,0.5,6.0]","sosF[0.55,0.5,5.0]", + "acmsP[60.,50.,500.]","betaP[0.03,0.01,1.0]","gammaP[0.1, 0.005, 1]","peakP[90.0]", + "acmsF[200.,50.,500.]","betaF[0.04,0.01,0.06]","gammaF[0.1, 0.005, 1]","peakF[90.0]", + ], +} +tnpParAltBkgFitTuneByBin = {}