diff --git a/.gitignore b/.gitignore index 82c501e6c41..3bd5a0c9043 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ __init__.py .#* #*# *~ +*.sh +*.root +submit.sh diff --git a/test/zmumu/SUSY/SF2015/fitMuonID.py b/test/zmumu/SUSY/SF2015/fitMuonID.py index c3581158cec..6b698ce0ae4 100644 --- a/test/zmumu/SUSY/SF2015/fitMuonID.py +++ b/test/zmumu/SUSY/SF2015/fitMuonID.py @@ -41,13 +41,19 @@ #Preparing the variables #_*_*_*_*_*_*_*_*_*_*_*_* +_mrange = "70" +if (int(id_bins) > 4) and (int(id_bins) < 19): + _mrange = "77" + + Template = cms.EDAnalyzer("TagProbeFitTreeAnalyzer", NumCPU = cms.uint32(1), SaveWorkspace = cms.bool(False), Variables = cms.PSet( - weight = cms.vstring("weight","0","10",""), - mass = cms.vstring("Tag-muon Mass", "70", "130", "GeV/c^{2}"), + weight = cms.vstring("weight","-100","100",""), + #mass = cms.vstring("Tag-muon Mass", "70", "130", "GeV/c^{2}"), + mass = cms.vstring("Tag-muon Mass", _mrange, "130", "GeV/c^{2}"), pt = cms.vstring("muon p_{T}", "0", "1000", "GeV/c"), eta = cms.vstring("muon #eta", "-2.5", "2.5", ""), abseta = cms.vstring("muon |#eta|", "0", "2.5", ""), @@ -85,7 +91,26 @@ LooseMiniIsoVar = cms.vstring("LooseMiniIsoVar" ,"pfCombRelMiniIsoEACorr < 0.4", "pfCombRelMiniIsoEACorr"), TightMiniIsoVar = cms.vstring("TightMiniIsoVar" ,"pfCombRelMiniIsoEACorr < 0.2", "pfCombRelMiniIsoEACorr"), #Multi Iso - MediumMultiIsoVar= cms.vstring("MediumMultIsoVar" ,"pfCombRelMiniIsoEACorr < 0.16 && ( PtRel > 7.2 || PtRatio > 0.76 )", "pfCombRelMiniIsoEACorr", "PtRel", "PtRatio"), + MediumMultiIsoVar= cms.vstring("MediumMultiIsoVar" ,"pfCombRelMiniIsoEACorr < 0.16 && ( PtRel > 7.2 || PtRatio > 0.76 )", "pfCombRelMiniIsoEACorr", "PtRel", "PtRatio"), + + #Stacked requirements + + #Loose + Miniso02 + Loose_plus_MiniIso02Var= cms.vstring("Loose_plus_MiniIso02Var" ,"PF==1 && pfCombRelMiniIsoEACorr < 0.2", "PF", "pfCombRelMiniIsoEACorr"), + #Loose + Miniso02 + TightIP2D + Loose_plus_MiniIso02_puls_TightIP2DVar= cms.vstring("Loose_plus_MiniIso02_puls_TightIP2DVar" ,"PF==1 && pfCombRelMiniIsoEACorr < 0.2 && abs(dxyBS) < 0.02 && abs(dzPV) < 0.1", "PF", "pfCombRelMiniIsoEACorr", "dxyBS", "dzPV"), + #Medium + Miniso02 + Medium_plus_MiniIso02Var= cms.vstring("Medium_plus_MiniIso02Var" ,"Medium==1 && pfCombRelMiniIsoEACorr < 0.2", "Medium", "pfCombRelMiniIsoEACorr"), + #Loose + Miniso02 + TightIP3D + Loose_plus_MiniIso02_puls_TightIP3DVar= cms.vstring("Loose_plus_MiniIso02_puls_TightIP3DVar" ,"PF==1 && pfCombRelMiniIsoEACorr < 0.2 && abs(SIP) < 4", "PF", "pfCombRelMiniIsoEACorr", "SIP"), + #Medium + Miniso02 + TightIP3D + Medium_plus_MiniIso02_puls_TightIP3DVar= cms.vstring("Medium_plus_MiniIso02_puls_TightIP3DVar" ,"Medium==1 && pfCombRelMiniIsoEACorr < 0.2 && abs(SIP) < 4", "Medium", "pfCombRelMiniIsoEACorr", "SIP"), + #Medium + Miniso02 + TightIP2D + Medium_plus_MiniIso02_puls_TightIP2DVar= cms.vstring("Medium_plus_MiniIso02_puls_TightIP2DVar" ,"Medium==1 && pfCombRelMiniIsoEACorr < 0.2 && abs(dxyBS) < 0.02 && abs(dzPV) < 0.1", "Medium", "pfCombRelMiniIsoEACorr", "dxyBS", "dzPV"), + #Medium + MultiIsoMedium + TightIP2D + TightIP3D + Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3DVar= cms.vstring("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3DVar" ,"Medium==1 && pfCombRelMiniIsoEACorr < 0.16 && ( PtRel > 7.2 || PtRatio > 0.76 ) && abs(dxyBS) < 0.02 && abs(dzPV) < 0.1 && abs(SIP) < 4", "Medium", "pfCombRelMiniIsoEACorr", "PtRel", "PtRatio", "dxyBS", "dzPV", "SIP"), + #Loose + MiniIso04 + TightIP2D + Loose_plus_MiniIso04_puls_TightIP2DVar= cms.vstring("Loose_plus_MiniIso04_puls_TightIP2DVar" ,"PF==1 && pfCombRelMiniIsoEACorr < 0.4 && abs(dxyBS) < 0.02 && abs(dzPV) < 0.1", "PF", "pfCombRelMiniIsoEACorr", "dxyBS", "dzPV"), ), #_*_*_*_*_* @@ -104,6 +129,22 @@ TightMiniIso = cms.vstring("TightMiniIso" ,"TightMiniIsoVar", "0.5"), #Multi Iso MediumMultiIso= cms.vstring("MediumMultiIso" ,"MediumMultiIsoVar", "0.5"), + #Loose + Miniso02 + Loose_plus_MiniIso02= cms.vstring("Loose_plus_MiniIso02" ,"Loose_plus_MiniIso02Var", "0.5"), + #Loose + Miniso02 + TightIP2D + Loose_plus_MiniIso02_puls_TightIP2D= cms.vstring("Loose_plus_MiniIso02_puls_TightIP2D", "Loose_plus_MiniIso02_puls_TightIP2DVar" , "0.5"), + #Medium + Miniso02 + Medium_plus_MiniIso02= cms.vstring("Medium_plus_MiniIso02", "Medium_plus_MiniIso02Var", "0.5" ), + #Loose + Miniso02 + TightIP3D + Loose_plus_MiniIso02_puls_TightIP3D= cms.vstring("Loose_plus_MiniIso02_puls_TightIP3D", "Loose_plus_MiniIso02_puls_TightIP3DVar", "0.5" ), + #Medium + Miniso02 + TightIP3D + Medium_plus_MiniIso02_puls_TightIP3D= cms.vstring("Medium_plus_MiniIso02_puls_TightIP3D", "Medium_plus_MiniIso02_puls_TightIP3DVar", "0.5" ), + #Medium + Miniso02 + TightIP2D + Medium_plus_MiniIso02_puls_TightIP2D= cms.vstring("Medium_plus_MiniIso02_puls_TightIP2D", "Medium_plus_MiniIso02_puls_TightIP2DVar", "0.5" ), + #Medium + MultiIsoMedium + TightIP2D + TightIP3D + Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D= cms.vstring("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D", "Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3DVar", "0.5" ), + #Loose + MiniIso04 + TightIP2D + Loose_plus_MiniIso04_puls_TightIP2D= cms.vstring("Loose_plus_MiniIso04_puls_TightIP2D", "Loose_plus_MiniIso04_puls_TightIP2DVar", "0.5" ), ), #_*_*_*_*_*_*_*_*_*_*_*_*_* @@ -135,7 +176,17 @@ "Exponential::backgroundFail(mass, lf[-0.1,-1,0.1])", "efficiency[0.9,0.7,1]", "signalFractionInPassing[0.9]" - ) + ), + vpvPlusCheb = cms.vstring( + "Voigtian::signal1(mass, mean1[90,80,100], width[2.495], sigma1[2,1,3])", + "Voigtian::signal2(mass, mean2[90,80,100], width, sigma2[4,3,10])", + "SUM::signal(vFrac[0.8,0.5,1]*signal1, signal2)", + "RooChebychev::backgroundPass(mass, {a0[0.25,0,0.5], a1[-0.25,-1,0.1],a2[0.,-0.25,0.25]})", + "RooChebychev::backgroundFail(mass, {a0[0.25,0,0.5], a1[-0.25,-1,0.1],a2[0.,-0.25,0.25]})", + "efficiency[0.9,0.7,1]", + "signalFractionInPassing[0.9]" + ) + ), binnedFit = cms.bool(True), @@ -151,7 +202,7 @@ #For ID -ETA_BINS = cms.PSet( +ETA_BINS_INCLUSIVE_PT = cms.PSet( pt = cms.vdouble(10, 500), eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), @@ -160,7 +211,7 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -VTX_BINS_ETA24 = cms.PSet( +VTX_BINS_INCLUSIVE_ETA_PT = cms.PSet( pt = cms.vdouble(10 , 500), abseta = cms.vdouble(0.0, 2.4), tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), @@ -170,8 +221,8 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -PT_ALLETA_BINS1 = cms.PSet( - pt = cms.vdouble(5, 10, 20, 30, 40, 50, 60, 80, 120, 200), +PT_BINS_INCLUSIVE_ETA = cms.PSet( + pt = cms.vdouble(10, 20, 25, 30, 40, 50, 60, 80, 120, 200), abseta = cms.vdouble( 0.0, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), #tag selections @@ -179,50 +230,42 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -PT_ETA_BINS1 = cms.PSet( - pt = cms.vdouble(5, 10, 20, 30, 40, 50, 60, 80, 120, 200), - abseta = cms.vdouble( 0.0, 1.2, 2.4), +PT_ETA_MAP = cms.PSet( + pt = cms.vdouble(10, 20, 25, 30, 40, 50, 60, 120), + abseta = cms.vdouble( 0.0, 0.9, 1.2, 2.1, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), #tag selections tag_pt = cms.vdouble(21, 500), tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -#For IP,ISO on ID -LOOSE_ETA_BINS = cms.PSet( - pt = cms.vdouble(10, 500), - eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), - pair_probeMultiplicity = cms.vdouble(0.5, 1.5), - PF = cms.vstring("pass"), - #tag selections - tag_pt = cms.vdouble(21, 500), - tag_IsoMu20 = cms.vstring("pass"), - tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), -) -LOOSE_VTX_BINS_ETA24 = cms.PSet( - pt = cms.vdouble(10, 500 ), - abseta = cms.vdouble( 0.0, 2.4), - tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), + +ACTIVITY_ETA_MAP_INCLUSIVE_PT = cms.PSet( + pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), + pt = cms.vdouble(10, 500), + abseta = cms.vdouble( 0, 1.2, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), - PF = cms.vstring("pass"), #tag selections tag_pt = cms.vdouble(21, 500), tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -LOOSE_PT_ALLETA_BINS1 = cms.PSet( - pt = cms.vdouble(5, 10, 20, 30, 40, 50, 60, 80, 120, 200), - abseta = cms.vdouble( 0.0, 2.4), + +ACTIVITY_PT_MAP_INCLUSIVE_ETA = cms.PSet( + pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), + pt = cms.vdouble(10, 40, 80, 200), + abseta = cms.vdouble( 0, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), - PF = cms.vstring("pass"), #tag selections tag_pt = cms.vdouble(21, 500), tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -LOOSE_PT_ETA_BINS1 = cms.PSet( - pt = cms.vdouble(5, 10, 20, 30, 40, 50, 60, 80, 120, 200), - abseta = cms.vdouble( 0.0, 1.2, 2.4), + +#For IP,ISO on ID +LOOSE_ETA_BINS_INCLUSIVE_PT = cms.PSet( + pt = cms.vdouble(10, 500), + eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), PF = cms.vstring("pass"), #tag selections @@ -230,10 +273,10 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -LOOSE_PT_ACTIVITY_BARREL = cms.PSet( - pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(10, 500), - abseta = cms.vdouble( 0, 1.2), +LOOSE_VTX_BINS_INCLUSIVE_ETA_PT = cms.PSet( + pt = cms.vdouble(10, 500 ), + abseta = cms.vdouble( 0.0, 2.4), + tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), PF = cms.vstring("pass"), #tag selections @@ -241,10 +284,9 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -LOOSE_PT_ACTIVITY_ENDCAP = cms.PSet( - pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(10, 500), - abseta = cms.vdouble( 1.2, 2.4), +LOOSE_PT_BINS_INCLUSIVE_ETA = cms.PSet( + pt = cms.vdouble(10, 20, 25, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), PF = cms.vstring("pass"), #tag selections @@ -252,11 +294,9 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -# -LOOSE_PT_ACTIVITY_PTLOW = cms.PSet( - pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(10, 40), - abseta = cms.vdouble( 0, 2.4), +LOOSE_PT_ETA_MAP = cms.PSet( + pt = cms.vdouble(10, 20, 25, 30, 40, 50, 60, 120), + abseta = cms.vdouble( 0.0, 0.9, 1.2, 2.1, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), PF = cms.vstring("pass"), #tag selections @@ -264,10 +304,10 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -LOOSE_PT_ACTIVITY_PTMED= cms.PSet( +LOOSE_ACTIVITY_ETA_MAP_INCLUSIVE_PT = cms.PSet( pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(40, 80), - abseta = cms.vdouble( 0, 2.4), + pt = cms.vdouble(10, 500), + abseta = cms.vdouble( 0, 1.2, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), PF = cms.vstring("pass"), #tag selections @@ -275,9 +315,11 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -LOOSE_PT_ACTIVITY_PTHIGH= cms.PSet( + +# +LOOSE_ACTIVITY_PT_MAP_INCLUSIVE_ETA = cms.PSet( pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(80, 200), + pt = cms.vdouble(10, 40, 80, 200), abseta = cms.vdouble( 0, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), PF = cms.vstring("pass"), @@ -286,8 +328,9 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) + #MEDIUM -MEDIUM_ETA_BINS = cms.PSet( +MEDIUM_ETA_BINS_INCLUSIVE_PT = cms.PSet( pt = cms.vdouble(10, 500), eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), @@ -297,7 +340,7 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -MEDIUM_VTX_BINS_ETA24 = cms.PSet( +MEDIUM_VTX_BINS_INCLUSIVE_ETA_PT = cms.PSet( pt = cms.vdouble(10, 500), abseta = cms.vdouble(0.0, 2.4), tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), @@ -308,8 +351,8 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -MEDIUM_PT_ALLETA_BINS1 = cms.PSet( - pt = cms.vdouble(5, 10, 20, 30, 40, 50, 60, 80, 120, 200), +MEDIUM_PT_BINS_INCLUSIVE_ETA = cms.PSet( + pt = cms.vdouble(10, 20, 25, 30, 40, 50, 60, 80, 120, 200), abseta = cms.vdouble( 0.0, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), Medium = cms.vstring("pass"), @@ -318,9 +361,9 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -MEDIUM_PT_ETA_BINS1 = cms.PSet( - pt = cms.vdouble(5, 10, 20, 30, 40, 50, 60, 80, 120, 200), - abseta = cms.vdouble( 0.0, 1.2, 2.4), +MEDIUM_PT_ETA_MAP = cms.PSet( + pt = cms.vdouble(10, 20, 25, 30, 40, 50, 60, 120), + abseta = cms.vdouble( 0.0, 0.9, 1.2, 2.1, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), Medium = cms.vstring("pass"), #tag selections @@ -328,21 +371,10 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) -MEDIUM_PT_ACTIVITY_BARREL = cms.PSet( +MEDIUM_ACTIVITY_ETA_MAP_INCLUSIVE_PT = cms.PSet( pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), pt = cms.vdouble(10, 500), - abseta = cms.vdouble( 0, 1.2), - pair_probeMultiplicity = cms.vdouble(0.5, 1.5), - Medium = cms.vstring("pass"), - #tag selections - tag_pt = cms.vdouble(21, 500), - tag_IsoMu20 = cms.vstring("pass"), - tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), -) -MEDIUM_PT_ACTIVITY_ENDCAP = cms.PSet( - pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(10, 500), - abseta = cms.vdouble( 1.2, 2.4), + abseta = cms.vdouble( 0, 1.2, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), Medium = cms.vstring("pass"), #tag selections @@ -350,32 +382,11 @@ tag_IsoMu20 = cms.vstring("pass"), tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) + # -MEDIUM_PT_ACTIVITY_PTLOW= cms.PSet( - pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(10, 40), - abseta = cms.vdouble( 0, 2.4), - pair_probeMultiplicity = cms.vdouble(0.5, 1.5), - Medium = cms.vstring("pass"), - #tag selections - tag_pt = cms.vdouble(21, 500), - tag_IsoMu20 = cms.vstring("pass"), - tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), -) -MEDIUM_PT_ACTIVITY_PTMED= cms.PSet( - pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(40, 80), - abseta = cms.vdouble( 0, 2.4), - pair_probeMultiplicity = cms.vdouble(0.5, 1.5), - Medium = cms.vstring("pass"), - #tag selections - tag_pt = cms.vdouble(21, 500), - tag_IsoMu20 = cms.vstring("pass"), - tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), -) -MEDIUM_PT_ACTIVITY_PTHIGH= cms.PSet( +MEDIUM_ACTIVITY_PT_MAP_INCLUSIVE_ETA= cms.PSet( pfCombRelActivitydBCorr = cms.vdouble(0, 0.02, 0.05, 0.15, 1, 9999), - pt = cms.vdouble(80, 200), + pt = cms.vdouble(10, 40, 80, 200), abseta = cms.vdouble( 0, 2.4), pair_probeMultiplicity = cms.vdouble(0.5, 1.5), Medium = cms.vstring("pass"), @@ -385,6 +396,7 @@ tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), ) + #_*_*_*_ #Samples #_*_*_*_ @@ -394,7 +406,13 @@ if run == '2015D': process.TnP_MuonID = Template.clone( InputFileNames = cms.vstring( - 'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnp_DATA_25ns_2015D_v3v4_withEAMiniIso_v2.root' + #'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnp_DATA_25ns_2015D_v3v4_withEAMiniIso_v2.root' #original file: full size on eos + #'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnp_DATA_25ns_2015D_v3v4_withEAMiniIso_v2SmallTree.root' #small file with only 5000 events fot test purposes + #'root:///afs/cern.ch/work/g/gaperrin/public/Ntuples_for_Jan/tnpZ_mu_POG_Data_25ns_run2015D_v3p2_withEAMiniIso.root' + '/afs/cern.ch/work/j/jhoss/public/151130_TnP_topUp/tnpZ_Data_25ns_run2015C_v3p31.root', + '/afs/cern.ch/work/j/jhoss/public/151130_TnP_topUp/tnpZ_Data_25ns_run2015D_v3p2.root', + '/afs/cern.ch/work/j/jhoss/public/151130_TnP_topUp/tnpZ_Data_25ns_run2015D_v3p31.root', + '/afs/cern.ch/work/j/jhoss/public/151130_TnP_topUp/tnpZ_Data_25ns_run2015D_v3p3.root' ), InputTreeName = cms.string("fitter_tree"), InputDirectoryName = cms.string("tpTree"), @@ -407,7 +425,10 @@ if order== 'LO': process.TnP_MuonID = Template.clone( InputFileNames = cms.vstring( - 'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnp_MC_25ns_2015D_LO_SmallTree_withNVtxWeights_withEAMiniIso_v2.root' + #'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnp_MC_25ns_2015D_LO_SmallTree_withNVtxWeights_withEAMiniIso_v2.root' + #'root:///afs/cern.ch/work/g/gaperrin/public/Ntuples_for_Jan/tnp_MC_25ns_2015D_LO_SmallTree_withNVtxWeights_withEAMiniIso_v2.root' + #'root:///afs/cern.ch/work/g/gaperrin/public/Ntuples_for_Jan/tnp_MC_25ns_2015D_LO_withNVtxWeights_withEAMiniIso_v2.root' + 'root:///afs/cern.ch/work/j/jhoss/public/151130_TnP_topUp/tnpZ_MC_25ns_madgraphMLM-pythia8_v3p2_withNVtxWeights.root' #LO sample for top up ), InputTreeName = cms.string("fitter_tree"), InputDirectoryName = cms.string("tpTree"), @@ -415,11 +436,16 @@ Efficiencies = cms.PSet(), ) process.TnP_MuonID.WeightVariable = cms.string("weight") - process.TnP_MuonID.Variables.weight = cms.vstring("weight","0","10","") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") elif order == 'NLO': process.TnP_MuonID = Template.clone( InputFileNames = cms.vstring( - 'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnp_MC_25ns_2015D_NLO_SmallTree_withNVtxWeights_WithWeights_withEAMiniIso_v2.root' + #'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnp_MC_25ns_2015D_NLO_SmallTree_withNVtxWeights_WithWeights_withEAMiniIso_v2.root' + #'root://eoscms//eos/cms/store/group/phys_muon/perrin/SUSY/tnpZ_MC_25ns_amcatnloFXFX-pythia8_v3_WithWeights.root' + #'root:///afs/cern.ch/work/j/jhoss/public/tnpZ_MC_25ns_amcatnloFXFX-pythia8_v3_WithWeights.root' # local NLO sample full size 12e6 events + #'root:///afs/cern.ch/work/j/jhoss/public/tnpZ_MC_25ns_amcatnloFXFX-pythia8_v3_WithWeightsSmallTree.root' #local NLO sample with 3e6 events + #'root:///afs/cern.ch/work/j/jhoss/public/tnpZ_MC_25ns_amcatnloFXFX-pythia8_v3_WithWeightsSmallTree_v2.root' #local NLO sample with 9e6 events + '/afs/cern.ch/work/g/gaperrin/public/Ntuples_for_Jan/tnpZ_muPOG_MC_25ns_amcatnloFXFX-pythia8_v3p2_WithWeights_withEAMiniIso.root' ), InputTreeName = cms.string("fitter_tree"), InputDirectoryName = cms.string("tpTree"), @@ -427,7 +453,7 @@ Efficiencies = cms.PSet(), ) process.TnP_MuonID.WeightVariable = cms.string("weight") - process.TnP_MuonID.Variables.weight = cms.vstring("weight","0","10","") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") #_*_*_*_*_*_*_*_*_*_*_*_*_*_* @@ -442,49 +468,49 @@ #Loose ID if id_bins == '1': ID_BINS = [ - (("Loose_noIP"), ("eta", ETA_BINS)), - (("Loose_noIP"), ("vtx_bin1_24", VTX_BINS_ETA24 )), - (("Loose_noIP"), ("pt_alleta_bin1", PT_ALLETA_BINS1)), - (("Loose_noIP"), ("pt_spliteta_bin1", PT_ETA_BINS1)), + #(("Loose_noIP"), ("NUM_LooseID_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + #(("Loose_noIP"), ("NUM_LooseID_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + #(("Loose_noIP"), ("NUM_LooseID_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Loose_noIP"), ("NUM_LooseID_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), ] #Medium ID if id_bins == '2': ID_BINS = [ - (("Medium_noIP"), ("eta", ETA_BINS)), - (("Medium_noIP"), ("vtx_bin1_24", VTX_BINS_ETA24 )), - (("Medium_noIP"), ("pt_alleta_bin1", PT_ALLETA_BINS1)), - (("Medium_noIP"), ("pt_spliteta_bin1", PT_ETA_BINS1)), + #(("Medium_noIP"), ("NUM_MediumID_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + #(("Medium_noIP"), ("NUM_MediumID_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + #(("Medium_noIP"), ("NUM_MediumID_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Medium_noIP"), ("NUM_MediumID_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), ] #_*_ #IPs #_*_ if id_bins == '3': ID_BINS = [ - (("TightIP2D"), ("loose_eta", LOOSE_ETA_BINS)), - (("TightIP2D"), ("loose_vtx_bin1_24", LOOSE_VTX_BINS_ETA24 )), - (("TightIP2D"), ("loose_pt_alleta_bin1", LOOSE_PT_ALLETA_BINS1)), - (("TightIP2D"), ("loose_pt_spliteta_bin1", LOOSE_PT_ETA_BINS1)), - ] -if id_bins == '4': - ID_BINS = [ - (("TightIP2D"), ("medium_eta", MEDIUM_ETA_BINS)), - (("TightIP2D"), ("medium_vtx_bin1_24", MEDIUM_VTX_BINS_ETA24 )), - (("TightIP2D"), ("medium_pt_alleta_bin1", MEDIUM_PT_ALLETA_BINS1)), - (("TightIP2D"), ("medium_pt_spliteta_bin1", MEDIUM_PT_ETA_BINS1)), + #(("TightIP2D"), ("NUM_TightIP2D_DENOM_LooseID_VAR_eta", LOOSE_ETA_BINS_INCLUSIVE_PT )), + #(("TightIP2D"), ("NUM_TightIP2D_DENOM_LooseID_VAR_vtx", LOOSE_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("TightIP2D"), ("NUM_TightIP2D_DENOM_LooseID_VAR_pt", LOOSE_PT_BINS_INCLUSIVE_ETA )), + (("TightIP2D"), ("NUM_TightIP2D_DENOM_LooseID_VAR_map_pt_eta", LOOSE_PT_ETA_MAP )), + ] +if id_bins == '4': + ID_BINS = [ + #(("TightIP2D"), ("NUM_TightIP2D_DENOM_MediumID_VAR_eta", MEDIUM_ETA_BINS_INCLUSIVE_PT )), + #(("TightIP2D"), ("NUM_TightIP2D_DENOM_MediumID_VAR_vtx", MEDIUM_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("TightIP2D"), ("NUM_TightIP2D_DENOM_MediumID_VAR_pt", MEDIUM_PT_BINS_INCLUSIVE_ETA )), + (("TightIP2D"), ("NUM_TightIP2D_DENOM_MediumID_VAR_map_pt_eta", MEDIUM_PT_ETA_MAP )), ] if id_bins == '5': ID_BINS = [ - (("TightIP3D"), ("loose_eta", LOOSE_ETA_BINS)), - (("TightIP3D"), ("loose_vtx_bin1_24", LOOSE_VTX_BINS_ETA24 )), - (("TightIP3D"), ("loose_pt_alleta_bin1", LOOSE_PT_ALLETA_BINS1)), - (("TightIP3D"), ("loose_pt_spliteta_bin1", LOOSE_PT_ETA_BINS1)), + #(("TightIP3D"), ("NUM_TightIP3D_DENOM_LooseID_VAR_eta", LOOSE_ETA_BINS_INCLUSIVE_PT )), + #(("TightIP3D"), ("NUM_TightIP3D_DENOM_LooseID_VAR_vtx", LOOSE_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("TightIP3D"), ("NUM_TightIP3D_DENOM_LooseID_VAR_pt", LOOSE_PT_BINS_INCLUSIVE_ETA )), + (("TightIP3D"), ("NUM_TightIP3D_DENOM_LooseID_VAR_map_pt_eta", LOOSE_PT_ETA_MAP )), ] if id_bins == '6': ID_BINS = [ - (("TightIP3D"), ("medium_eta", MEDIUM_ETA_BINS)), - (("TightIP3D"), ("medium_vtx_bin1_24", MEDIUM_VTX_BINS_ETA24 )), - (("TightIP3D"), ("medium_pt_alleta_bin1", MEDIUM_PT_ALLETA_BINS1)), - (("TightIP3D"), ("medium_pt_spliteta_bin1", MEDIUM_PT_ETA_BINS1)), + #(("TightIP3D"), ("NUM_TightIP3D_DENOM_MediumID_VAR_eta", MEDIUM_ETA_BINS_INCLUSIVE_PT )), + #(("TightIP3D"), ("NUM_TightIP3D_DENOM_MediumID_VAR_vtx", MEDIUM_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("TightIP3D"), ("NUM_TightIP3D_DENOM_MediumID_VAR_pt", MEDIUM_PT_BINS_INCLUSIVE_ETA )), + (("TightIP3D"), ("NUM_TightIP3D_DENOM_MediumID_VAR_map_pt_eta", MEDIUM_PT_ETA_MAP )), ] #_*_* #ISOs @@ -492,55 +518,128 @@ #Loose MiniIso if id_bins == '7': ID_BINS = [ - (("LooseMiniIso"), ("loose_eta", LOOSE_ETA_BINS)), - (("LooseMiniIso"), ("loose_vtx_bin1_24", LOOSE_VTX_BINS_ETA24 )), - (("LooseMiniIso"), ("loose_pt_alleta_bin1", LOOSE_PT_ALLETA_BINS1)), - (("LooseMiniIso"), ("loose_pt_spliteta_bin1", LOOSE_PT_ETA_BINS1)), - (("LooseMiniIso"), ("loose_pt_activity_barrel", LOOSE_PT_ACTIVITY_BARREL)), - (("LooseMiniIso"), ("loose_pt_activity_endcap", LOOSE_PT_ACTIVITY_ENDCAP)), - (("LooseMiniIso"), ("loose_pt_activity_lowpt", LOOSE_PT_ACTIVITY_PTLOW)), - (("LooseMiniIso"), ("loose_pt_activity_medpt", LOOSE_PT_ACTIVITY_PTMED)), - (("LooseMiniIso"), ("loose_pt_activity_highpt", LOOSE_PT_ACTIVITY_PTHIGH)), + #(("LooseMiniIso"), ("NUM_MiniIsoLoose_DENOM_LooseID_VAR_eta", LOOSE_ETA_BINS_INCLUSIVE_PT )), + #(("LooseMiniIso"), ("NUM_MiniIsoLoose_DENOM_LooseID_VAR_vtx", LOOSE_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("LooseMiniIso"), ("NUM_MiniIsoLoose_DENOM_LooseID_VAR_pt", LOOSE_PT_BINS_INCLUSIVE_ETA )), + (("LooseMiniIso"), ("NUM_MiniIsoLoose_DENOM_LooseID_VAR_map_pt_eta", LOOSE_PT_ETA_MAP )), + #(("LooseMiniIso"), ("NUM_MiniIsoLoose_DENOM_LooseID_VAR_map_activity_eta", LOOSE_ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + #(("LooseMiniIso"), ("NUM_MiniIsoLoose_DENOM_LooseID_VAR_map_activity_pt", LOOSE_ACTIVITY_PT_MAP_INCLUSIVE_ETA )), ] #Tight MiniIso if id_bins == '8': ID_BINS = [ - (("TightMiniIso"), ("medium_eta", MEDIUM_ETA_BINS)), - (("TightMiniIso"), ("medium_vtx_bin1_24", MEDIUM_VTX_BINS_ETA24 )), - (("TightMiniIso"), ("medium_pt_alleta_bin1", MEDIUM_PT_ALLETA_BINS1)), - (("TightMiniIso"), ("medium_pt_spliteta_bin1", MEDIUM_PT_ETA_BINS1)), - (("TightMiniIso"), ("medium_pt_activity_barrel", MEDIUM_PT_ACTIVITY_BARREL)), - (("TightMiniIso"), ("medium_pt_activity_endcap", MEDIUM_PT_ACTIVITY_ENDCAP)), - (("TightMiniIso"), ("medium_pt_activity_lowpt", MEDIUM_PT_ACTIVITY_PTLOW)), - (("TightMiniIso"), ("medium_pt_activity_medpt", MEDIUM_PT_ACTIVITY_PTMED)), - (("TightMiniIso"), ("medium_pt_activity_highpt", MEDIUM_PT_ACTIVITY_PTHIGH)), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_MediumID_VAR_eta", MEDIUM_ETA_BINS_INCLUSIVE_PT )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_MediumID_VAR_vtx", MEDIUM_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_MediumID_VAR_pt", MEDIUM_PT_BINS_INCLUSIVE_ETA )), + (("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_MediumID_VAR_map_pt_eta", MEDIUM_PT_ETA_MAP )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_MediumID_VAR_map_activity_eta", MEDIUM_ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_MediumID_VAR_map_activity_pt", MEDIUM_ACTIVITY_PT_MAP_INCLUSIVE_ETA )), ] if id_bins == '9': ID_BINS = [ - (("TightMiniIso"), ("loose_eta", LOOSE_ETA_BINS)), - (("TightMiniIso"), ("loose_vtx_bin1_24", LOOSE_VTX_BINS_ETA24 )), - (("TightMiniIso"), ("loose_pt_alleta_bin1", LOOSE_PT_ALLETA_BINS1)), - (("TightMiniIso"), ("loose_pt_spliteta_bin1", LOOSE_PT_ETA_BINS1)), - (("TightMiniIso"), ("loose_pt_activity_barrel", LOOSE_PT_ACTIVITY_BARREL)), - (("TightMiniIso"), ("loose_pt_activity_endcap", LOOSE_PT_ACTIVITY_ENDCAP)), - (("TightMiniIso"), ("loose_pt_activity_lowpt", LOOSE_PT_ACTIVITY_PTLOW)), - (("TightMiniIso"), ("loose_pt_activity_medpt", LOOSE_PT_ACTIVITY_PTMED)), - (("TightMiniIso"), ("loose_pt_activity_highpt", LOOSE_PT_ACTIVITY_PTHIGH)), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_LooseID_VAR_eta", LOOSE_ETA_BINS_INCLUSIVE_PT )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_LooseID_VAR_vtx", LOOSE_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_LooseID_VAR_pt", LOOSE_PT_BINS_INCLUSIVE_ETA )), + (("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_LooseID_VAR_map_pt_eta", LOOSE_PT_ETA_MAP )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_LooseID_VAR_map_activity_eta", LOOSE_ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + #(("TightMiniIso"), ("NUM_MiniIsoTight_DENOM_LooseID_VAR_map_activity_pt", LOOSE_ACTIVITY_PT_MAP_INCLUSIVE_ETA )), ] #MultiIso if id_bins == '10': ID_BINS = [ - (("MediumMultiIso"), ("medium_eta", MEDIUM_ETA_BINS)), - (("MediumMultiIso"), ("medium_vtx_bin1_24", MEDIUM_VTX_BINS_ETA24 )), - (("MediumMultiIso"), ("medium_pt_alleta_bin1", MEDIUM_PT_ALLETA_BINS1)), - (("MediumMultiIso"), ("medium_pt_spliteta_bin1", MEDIUM_PT_ETA_BINS1)), - (("MediumMultiIso"), ("medium_pt_activity_barrel", MEDIUM_PT_ACTIVITY_BARREL)), - (("MediumMultiIso"), ("medium_pt_activity_endcap", MEDIUM_PT_ACTIVITY_ENDCAP)), - (("MediumMultiIso"), ("medium_pt_activity_lowpt", MEDIUM_PT_ACTIVITY_PTLOW)), - (("MediumMultiIso"), ("medium_pt_activity_medpt", MEDIUM_PT_ACTIVITY_PTMED)), - (("MediumMultiIso"), ("medium_pt_activity_highpt", MEDIUM_PT_ACTIVITY_PTHIGH)), + #(("MediumMultiIso"), ("NUM_MultiIsoMedium_DENOM_MediumID_VAR_eta", MEDIUM_ETA_BINS_INCLUSIVE_PT )), + #(("MediumMultiIso"), ("NUM_MultiIsoMedium_DENOM_MediumID_VAR_vtx", MEDIUM_VTX_BINS_INCLUSIVE_ETA_PT )), + #(("MediumMultiIso"), ("NUM_MultiIsoMedium_DENOM_MediumID_VAR_pt", MEDIUM_PT_BINS_INCLUSIVE_ETA )), + (("MediumMultiIso"), ("NUM_MultiIsoMedium_DENOM_MediumID_VAR_map_pt_eta", MEDIUM_PT_ETA_MAP )), + #(("MediumMultiIso"), ("NUM_MultiIsoMedium_DENOM_MediumID_VAR_map_activity_eta", MEDIUM_ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + #(("MediumMultiIso"), ("NUM_MultiIsoMedium_DENOM_MediumID_VAR_map_activity_pt", MEDIUM_ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] +#Loose+MiniIso02 +if id_bins == '11': + ID_BINS = [ + (("Loose_plus_MiniIso02"), ("NUM_LooseID_plus_MiniIso02_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Loose_plus_MiniIso02"), ("NUM_LooseID_plus_MiniIso02_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Loose_plus_MiniIso02"), ("NUM_LooseID_plus_MiniIso02_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Loose_plus_MiniIso02"), ("NUM_LooseID_plus_MiniIso02_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Loose_plus_MiniIso02"), ("NUM_LooseID_plus_MiniIso02_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Loose_plus_MiniIso02"), ("NUM_LooseID_plus_MiniIso02_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] +#Loose+MiniIso02+TightIP2D +if id_bins == '12': + ID_BINS = [ + (("Loose_plus_MiniIso02_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Loose_plus_MiniIso02_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Loose_plus_MiniIso02_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Loose_plus_MiniIso02_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Loose_plus_MiniIso02_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Loose_plus_MiniIso02_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] +#Medium+MiniIso02 +if id_bins == '13': + ID_BINS = [ + (("Medium_plus_MiniIso02"), ("NUM_MediumID_plus_MiniIso02_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Medium_plus_MiniIso02"), ("NUM_MediumID_plus_MiniIso02_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Medium_plus_MiniIso02"), ("NUM_MediumID_plus_MiniIso02_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Medium_plus_MiniIso02"), ("NUM_MediumID_plus_MiniIso02_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Medium_plus_MiniIso02"), ("NUM_MediumID_plus_MiniIso02_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Medium_plus_MiniIso02"), ("NUM_MediumID_plus_MiniIso02_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] +#Loose+MiniIso02+TightIP3D +if id_bins == '14': + ID_BINS = [ + (("Loose_plus_MiniIso02_puls_TightIP3D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Loose_plus_MiniIso02_puls_TightIP3D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Loose_plus_MiniIso02_puls_TightIP3D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Loose_plus_MiniIso02_puls_TightIP3D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Loose_plus_MiniIso02_puls_TightIP3D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Loose_plus_MiniIso02_puls_TightIP3D"), ("NUM_LooseID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] +#Medium+MiniIso02+TightIP3D +if id_bins == '15': + ID_BINS = [ + (("Medium_plus_MiniIso02_puls_TightIP3D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Medium_plus_MiniIso02_puls_TightIP3D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Medium_plus_MiniIso02_puls_TightIP3D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Medium_plus_MiniIso02_puls_TightIP3D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Medium_plus_MiniIso02_puls_TightIP3D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Medium_plus_MiniIso02_puls_TightIP3D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP3D_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] +#Medium+MiniIso02+TightIP2D +if id_bins == '16': + ID_BINS = [ + (("Medium_plus_MiniIso02_puls_TightIP2D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Medium_plus_MiniIso02_puls_TightIP2D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Medium_plus_MiniIso02_puls_TightIP2D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Medium_plus_MiniIso02_puls_TightIP2D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Medium_plus_MiniIso02_puls_TightIP2D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Medium_plus_MiniIso02_puls_TightIP2D"), ("NUM_MediumID_plus_MiniIso02_puls_TightIP2D_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] +#Medium+MultiIsoMedium+TightIP2D+TightIP3D +if id_bins == '17': + ID_BINS = [ + (("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D"), ("NUM_MediumID_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D"), ("NUM_MediumID_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D"), ("NUM_MediumID_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D"), ("NUM_MediumID_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D"), ("NUM_MediumID_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Medium_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D"), ("NUM_MediumID_plus_MediumMultiIso_plus_TightIP2D_plus_TightIP3D_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), + ] + +#Loose+MiniIso04+TightIP2D +if id_bins == '18': + ID_BINS = [ + (("Loose_plus_MiniIso04_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso04_puls_TightIP2D_DENOM_generalTracks_VAR_eta", ETA_BINS_INCLUSIVE_PT )), + (("Loose_plus_MiniIso04_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso04_puls_TightIP2D_DENOM_generalTracks_VAR_vtx", VTX_BINS_INCLUSIVE_ETA_PT )), + (("Loose_plus_MiniIso04_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso04_puls_TightIP2D_DENOM_generalTracks_VAR_pt", PT_BINS_INCLUSIVE_ETA )), + (("Loose_plus_MiniIso04_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso04_puls_TightIP2D_DENOM_generalTracks_VAR_map_pt_eta", PT_ETA_MAP )), + (("Loose_plus_MiniIso04_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso04_puls_TightIP2D_DENOM_generalTracks_VAR_map_activity_eta", ACTIVITY_ETA_MAP_INCLUSIVE_PT )), + (("Loose_plus_MiniIso04_puls_TightIP2D"), ("NUM_LooseID_plus_MiniIso04_puls_TightIP2D_DENOM_generalTracks_VAR_map_activity_pt", ACTIVITY_PT_MAP_INCLUSIVE_ETA )), ] + + + + #_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_* #Produce the efficiency .root files #_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_* @@ -559,17 +658,32 @@ _output += '/MC' + bs + run + order if not os.path.exists(_output): os.makedirs(_output) - module = process.TnP_MuonID.clone(OutputFileName = cms.string(_output + "/TnP_MuonID_%s_%s.root" % (ID, X))) - shape = "vpvPlusExpo" - DEN = B.clone(); num = ID; + module = process.TnP_MuonID.clone(OutputFileName = cms.string(_output + "/TnP_MuonID_%s.root" % (X))) + shape = cms.vstring("vpvPlusExpo") + #shape = cms.vstring("vpvPlusCheb") + if(("Iso" in ID) and (not "plus" in ID)): + shape = cms.vstring("vpvPlusExpo") + else: + #if not "Iso" in ID: #customize only for ID + if ALLBINS[0].find('VAR_pt') != -1: + shape = cms.vstring("vpvPlusExpo","*pt_bin6*","vpvPlusCheb","*pt_bin7*","vpvPlusCheb","*pt_bin8*","vpvPlusCheb") + if ALLBINS[0].find('VAR_map_pt_eta') != -1: + shape = cms.vstring("vpvPlusExpo","*pt_bin6*","vpvPlusCheb") + + #if (len(B.pt)>=8): #customize only when the pT have the high pt bins + # if "Loose_noIP" in ID: + # shape = cms.vstring("vpvPlusExpo","*pt_bin5*","vpvPlusCheb","*pt_bin6*","vpvPlusCheb","*pt_bin7*","vpvPlusCheb","*pt_bin8*","vpvPlusCheb") + # else: + # shape = cms.vstring("vpvPlusExpo","*pt_bin6*","vpvPlusCheb","*pt_bin7*","vpvPlusCheb","*pt_bin8*","vpvPlusCheb") + DEN = B.clone(); num = ID; #compute isolation efficiency if scenario == 'data_all': setattr(module.Efficiencies, ID+"_"+X, cms.PSet( EfficiencyCategoryAndState = cms.vstring(num,"above"), UnbinnedVariables = cms.vstring("mass"), BinnedVariables = DEN, - BinToPDFmap = cms.vstring(shape) + BinToPDFmap = shape )) setattr(process, "TnP_MuonID_"+ID+"_"+X, module) setattr(process, "run_"+ID+"_"+X, cms.Path(module)) @@ -578,7 +692,7 @@ EfficiencyCategoryAndState = cms.vstring(num,"above"), UnbinnedVariables = cms.vstring("mass","weight"), BinnedVariables = DEN, - BinToPDFmap = cms.vstring(shape) + BinToPDFmap = shape )) setattr(process, "TnP_MuonID_"+ID+"_"+X, module) setattr(process, "run_"+ID+"_"+X, cms.Path(module)) diff --git a/test/zmumu/SUSY/SF2015/make_PtActivityMaps.py b/test/zmumu/SUSY/SF2015/make_PtActivityMaps.py new file mode 100644 index 00000000000..9e3c18fb7db --- /dev/null +++ b/test/zmumu/SUSY/SF2015/make_PtActivityMaps.py @@ -0,0 +1,285 @@ +import ROOT as r +import os +import glob +import sys +from array import * +import numpy as np +import string + +debug = True +nActBins = 5 + +r.gROOT.SetBatch() +r.gStyle.SetOptStat(0) +args = sys.argv[1:] +iteration = '1' +if len(args) > 0: iteration = args[0] +print "The iteration is ", iteration +if len(args) > 0: order = args[1] +_sample1 = '/DATA25ns2015D/' +_sample2 = '/MC25ns2015D' + order + '/' +_folder1 = os.getcwd() + '/Efficiency' + iteration + '/' + _sample1 + '/' +_folder2 = os.getcwd() + '/Efficiency' + iteration + '/' + _sample2 + '/' +_folder_out = os.getcwd() + '/RatioMap' + iteration + '/' + 'DATA_vs_MC' + order + '/' +if not os.path.exists(_folder_out): + os.makedirs(_folder_out) + +_tptree = 'tpTree' + +dir = os.listdir(_folder1) +os.chdir(_folder1) +for file in glob.glob("*map_activity_pt*.root"): + if debug: print 'the file is ', file + if file.find('TnP_MuonID') != -1: + if not os.path.isfile(_folder1 + '/' + file): + if debug: print 'The file ', file, 'doesn\'t exist in ', _folder1 + continue + else: + if debug: print 'The file', file, 'exists !' + f = r.TFile.Open(_folder1+file) + r.gDirectory.cd(_tptree) + for key in r.gDirectory.GetListOfKeys(): + print "The name of the key is", key.GetName() + r.gDirectory.cd(key.GetName()) + r.gDirectory.cd('fit_eff_plots') + PLOTS = r.gDirectory.GetListOfKeys() + PLOTS.ls() + for plot in PLOTS: + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin0_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin0" + actbin0_mc = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin1_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin1" + actbin1_mc = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin2_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin2" + actbin2_mc = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin3_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin3" + actbin3_mc = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin4_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin4" + actbin4_mc = hist + + + if debug: print 'the file is ', file + if file.find('TnP_MuonID') != -1: + if not os.path.isfile(_folder2 + '/' + file): + if debug: print 'The file ', file, 'doesn\'t exist in ', _folder2 + continue + else: + if debug: print 'The file', file, 'exists !' + f = r.TFile.Open(_folder2+file) + r.gDirectory.cd(_tptree) + for key in r.gDirectory.GetListOfKeys(): + print "The name of the key is", key.GetName() + r.gDirectory.cd(key.GetName()) + r.gDirectory.cd('fit_eff_plots') + PLOTS = r.gDirectory.GetListOfKeys() + PLOTS.ls() + for plot in PLOTS: + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin0_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin0" + actbin0_data = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin1_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin1" + actbin1_data = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin2_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin2" + actbin2_data = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin3_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin3" + actbin3_data = hist + if plot.GetName().startswith("pt_PLOT_pfCombRelActivitydBCorr_bin4_"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found actbin4" + actbin4_data = hist + + c1=r.TCanvas("c1","c1",1200,800) + p1 = r.TPad("p1","p1",0.01,0.01,0.99,0.99); + p1.Draw(); + p1.cd(); + p1.SetLogy() + + Map = r.TH2F() + Map = p1.DrawFrame(10,0.001,200,10) + xbins = np.array([10.,40.,80.,200.]) + ybins = np.array([0.001, 0.02, 0.05, 0.15, 1., 10.]) + p1.Update() + + + SFmap = r.TH2F("SFmap", file, 3, xbins, 5, ybins) + + pt_data = 0 + eff_data = 0 + pt_data = r.Double(pt_data) + eff_data = r.Double(eff_data) + + pt_mc = 0 + eff_mc = 0 + pt_mc = r.Double(pt_mc) + eff_mc = r.Double(eff_mc) + + for act in range(nActBins): + for i in range(actbin0_data.GetN()): + if act==0: + actbin0_data.GetPoint(i, pt_data, eff_data) + errh_data = actbin0_data.GetErrorYhigh(i) + errl_data = actbin0_data.GetErrorYlow(i) + actbin0_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = actbin0_mc.GetErrorYhigh(i) + errl_mc = actbin0_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, act+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, act+1, err) + if act==1: + actbin1_data.GetPoint(i, pt_data, eff_data) + errh_data = actbin1_data.GetErrorYhigh(i) + errl_data = actbin1_data.GetErrorYlow(i) + actbin1_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = actbin1_mc.GetErrorYhigh(i) + errl_mc = actbin1_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, act+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, act+1, err) + if act==2: + actbin1_data.GetPoint(i, pt_data, eff_data) + errh_data = actbin2_data.GetErrorYhigh(i) + errl_data = actbin2_data.GetErrorYlow(i) + actbin2_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = actbin2_mc.GetErrorYhigh(i) + errl_mc = actbin2_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, act+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, act+1, err) + if act==3: + actbin3_data.GetPoint(i, pt_data, eff_data) + errh_data = actbin3_data.GetErrorYhigh(i) + errl_data = actbin3_data.GetErrorYlow(i) + actbin3_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = actbin3_mc.GetErrorYhigh(i) + errl_mc = actbin3_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, act+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, act+1, err) + if act==4: + actbin4_data.GetPoint(i, pt_data, eff_data) + errh_data = actbin4_data.GetErrorYhigh(i) + errl_data = actbin4_data.GetErrorYlow(i) + actbin4_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = actbin4_mc.GetErrorYhigh(i) + errl_mc = actbin4_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, act+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, act+1, err) + + + + ncontours = 999 + MyPalette = [] + stops = [0.00, 0.50, 1.00] + red = [0.00, 1.00, 1.00] + green = [0.00, 1.00, 0.00] + blue = [1.00, 1.00, 0.00] + + st = array('d', stops) + re = array('d', red) + gr = array('d', green) + bl = array('d', blue) + + npoints = len(st) + FI = r.TColor.CreateGradientColorTable(npoints, st, re, gr, bl, ncontours) + + nLevels = 999; + levels = [] + zmin = 0.9 + zmax = 1.1 + + for i in range(nLevels): + levels.append(zmin + (zmax - zmin) / (nLevels - 1) * (i)) + levels = array('d', levels) + + SFmap.SetContour(nLevels) + + filename = string.replace(file, '.root', '') + SFmap.SetTitle(file) + SFmap.SetMarkerSize(1.0) + SFmap.Draw("COLZ") + SFmap.GetXaxis().SetTitle("muon p_{T} (GeV/c)") + SFmap.GetXaxis().SetTitleOffset(1.2) + SFmap.GetYaxis().SetTitle("Rel. Activity") + c1.Update() + r.gStyle.SetPaintTextFormat("4.3f") + SFmap.GetZaxis().SetRangeUser(zmin,zmax) + + SFmap.Draw("TEXT E same") + c1.Update() + + fout = r.TFile(_folder_out + file, "RECREATE"); + SFmap.Write(); + c1.SaveAs(_folder_out + filename + '.png') + c1.SaveAs(_folder_out + filename + '.pdf') + + fout.Close(); + + + diff --git a/test/zmumu/SUSY/SF2015/make_PtEtaMaps.py b/test/zmumu/SUSY/SF2015/make_PtEtaMaps.py new file mode 100644 index 00000000000..4a7286488d9 --- /dev/null +++ b/test/zmumu/SUSY/SF2015/make_PtEtaMaps.py @@ -0,0 +1,247 @@ +import ROOT as r +import os +import glob +import sys +from array import * +import numpy as np +import string + +debug = True +nEtaBins = 4 + +r.gROOT.SetBatch() +args = sys.argv[1:] +iteration = '1' +if len(args) > 0: iteration = args[0] +print "The iteration is ", iteration +if len(args) > 0: order = args[1] +_sample1 = '/DATA25ns2015D/' +_sample2 = '/MC25ns2015D' + order + '/' +_folder1 = os.getcwd() + '/Efficiency' + iteration + '/' + _sample1 + '/' +_folder2 = os.getcwd() + '/Efficiency' + iteration + '/' + _sample2 + '/' +_folder_out = os.getcwd() + '/RatioMap' + iteration + '/' + 'DATA_vs_MC' + order + '/' +if not os.path.exists(_folder_out): + os.makedirs(_folder_out) + +_tptree = 'tpTree' + +dir = os.listdir(_folder1) +os.chdir(_folder1) +for file in glob.glob("*map_pt_eta*.root"): + if debug: print 'the file is ', file + if file.find('TnP_MuonID') != -1: + if not os.path.isfile(_folder1 + '/' + file): + if debug: print 'The file ', file, 'doesn\'t exist in ', _folder1 + continue + else: + if debug: print 'The file', file, 'exists !' + f = r.TFile.Open(_folder1+file) + r.gDirectory.cd(_tptree) + for key in r.gDirectory.GetListOfKeys(): + print "The name of the key is", key.GetName() + r.gDirectory.cd(key.GetName()) + r.gDirectory.cd('fit_eff_plots') + PLOTS = r.gDirectory.GetListOfKeys() + PLOTS.ls() + for plot in PLOTS: + if plot.GetName().startswith("pt_abseta_PLOT_pair_probeMultiplicity_bin0"): + print plot.GetName() + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + if hist.GetName().startswith("pt_abseta_PLOT_pair_probeMultiplicity_bin0"): + print "found map" + SFmap = hist + if plot.GetName().startswith("pt_PLOT_abseta_bin0"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found etabin0" + etabin0_data = hist + if plot.GetName().startswith("pt_PLOT_abseta_bin1"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found etabin1" + etabin1_data = hist + if plot.GetName().startswith("pt_PLOT_abseta_bin2"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found etabin2" + etabin2_data = hist + if plot.GetName().startswith("pt_PLOT_abseta_bin3"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found etabin3" + etabin3_data = hist + + + if debug: print 'the file is ', file + if file.find('TnP_MuonID') != -1: + if not os.path.isfile(_folder2 + '/' + file): + if debug: print 'The file ', file, 'doesn\'t exist in ', _folder2 + continue + else: + if debug: print 'The file', file, 'exists !' + f = r.TFile.Open(_folder2+file) + r.gDirectory.cd(_tptree) + for key in r.gDirectory.GetListOfKeys(): + print "The name of the key is", key.GetName() + r.gDirectory.cd(key.GetName()) + r.gDirectory.cd('fit_eff_plots') + PLOTS = r.gDirectory.GetListOfKeys() + PLOTS.ls() + for plot in PLOTS: + if plot.GetName().startswith("pt_PLOT_abseta_bin0"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + etabin0_mc = hist + if plot.GetName().startswith("pt_PLOT_abseta_bin1"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found etabin1" + etabin1_mc = hist + if plot.GetName().startswith("pt_PLOT_abseta_bin2"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found etabin2" + etabin2_mc = hist + if plot.GetName().startswith("pt_PLOT_abseta_bin3"): + canvas = plot.ReadObj() + HISTS = canvas.GetListOfPrimitives() + for hist in HISTS: + print hist + if hist.GetName().startswith("hxy_fit_eff"): + print "found etabin3" + etabin3_mc = hist + + + pt_data = 0 + eff_data = 0 + pt_data = r.Double(pt_data) + eff_data = r.Double(eff_data) + + pt_mc = 0 + eff_mc = 0 + pt_mc = r.Double(pt_mc) + eff_mc = r.Double(eff_mc) + + for eta in range(nEtaBins): + for i in range(etabin0_data.GetN()): + if eta==0: + etabin0_data.GetPoint(i, pt_data, eff_data) + errh_data = etabin0_data.GetErrorYhigh(i) + errl_data = etabin0_data.GetErrorYlow(i) + etabin0_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = etabin0_mc.GetErrorYhigh(i) + errl_mc = etabin0_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, eta+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, eta+1, err) + if eta==1: + etabin1_data.GetPoint(i, pt_data, eff_data) + errh_data = etabin1_data.GetErrorYhigh(i) + errl_data = etabin1_data.GetErrorYlow(i) + etabin1_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = etabin1_mc.GetErrorYhigh(i) + errl_mc = etabin1_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, eta+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, eta+1, err) + if eta==2: + etabin1_data.GetPoint(i, pt_data, eff_data) + errh_data = etabin2_data.GetErrorYhigh(i) + errl_data = etabin2_data.GetErrorYlow(i) + etabin2_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = etabin2_mc.GetErrorYhigh(i) + errl_mc = etabin2_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, eta+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, eta+1, err) + if eta==3: + etabin3_data.GetPoint(i, pt_data, eff_data) + errh_data = etabin3_data.GetErrorYhigh(i) + errl_data = etabin3_data.GetErrorYlow(i) + etabin3_mc.GetPoint(i, pt_mc, eff_mc) + errh_mc = etabin3_mc.GetErrorYhigh(i) + errl_mc = etabin3_mc.GetErrorYlow(i) + a = eff_data/eff_mc * ((errh_data/eff_data)**2 + (errh_mc/eff_mc)**2)**.5 + b = eff_data/eff_mc * ((errl_data/eff_data)**2 + (errl_mc/eff_mc)**2)**.5 + err = max(a,b) + SFmap.SetBinContent(i+1, eta+1, eff_data/eff_mc) + SFmap.SetBinError(i+1, eta+1, err) + + + + + ncontours = 999 + MyPalette = [] + stops = [0.00, 0.50, 1.00] + red = [0.00, 1.00, 1.00] + green = [0.00, 1.00, 0.00] + blue = [1.00, 1.00, 0.00] + + st = array('d', stops) + re = array('d', red) + gr = array('d', green) + bl = array('d', blue) + + npoints = len(st) + FI = r.TColor.CreateGradientColorTable(npoints, st, re, gr, bl, ncontours) + + nLevels = 999; + levels = [] + zmin = 0.9 + zmax = 1.1 + + for i in range(nLevels): + levels.append(zmin + (zmax - zmin) / (nLevels - 1) * (i)) + levels = array('d', levels) + + SFmap.SetContour(nLevels) + + filename = string.replace(file, '.root', '') + c1=r.TCanvas("c1","c1",1200,800) + SFmap.SetTitle(file) + SFmap.SetMarkerSize(1.0) + SFmap.Draw("COLZ") + r.gStyle.SetPaintTextFormat("4.3f") + SFmap.GetZaxis().SetRangeUser(zmin,zmax) + + SFmap.Draw("TEXT E same") + c1.Update() + + fout = r.TFile(_folder_out + file, "RECREATE"); + SFmap.Write(); + c1.SaveAs(_folder_out + filename + '.png') + c1.SaveAs(_folder_out + filename + '.pdf') + + fout.Close(); + + + diff --git a/test/zmumu/SUSY/SF2015/make_ratioplots.C b/test/zmumu/SUSY/SF2015/make_ratioplots.C index 78d0f63df23..e96eae88a6d 100644 --- a/test/zmumu/SUSY/SF2015/make_ratioplots.C +++ b/test/zmumu/SUSY/SF2015/make_ratioplots.C @@ -37,16 +37,21 @@ TH1F* DividTGraphs(TGraphAsymmErrors* gr1, TGraphAsymmErrors* gr2){ } } + //hack to move the last data point in the rel activity plots to visible range if we show the plot only up to 10 + for(int i = 0; i < nbins+1; i++){ + if(xbins[i] == 9999){xbins[i]=9;} + } + + TH1F *h0 = new TH1F("h0","h0",nbins,xbins); TH1F *h1 = new TH1F("h1","h1",nbins,xbins); - TH1F *h2 = new TH1F("h2","h2",nbins,xbins); TGraphAsymmErrors* gr[2] = {gr1, gr2}; - TH1F* h[2] = {h1, h2}; + TH1F* h[2] = {h0, h1}; //Loop over bins to do ratio // for (int k = 0; k < 2; ++k){ - for(int i = 0; i < nbins+1; ++i){ + for(int i = 0; i < nbins; ++i){ // //TGraph // @@ -69,6 +74,12 @@ TH1F* DividTGraphs(TGraphAsymmErrors* gr1, TGraphAsymmErrors* gr2){ //ratio histogram h[0]->Divide(h[1]); + //for (int k = 0; k < nbins+1; ++k){ + // cout << " " << h[0]->GetBinContent(k) << endl; + //} + + delete h[1]; + return h[0]; @@ -82,8 +93,18 @@ int make_ratioplots(TString _file, TString _canvas, TString _path1, TString _pat TString _par = ""; - if(_canvas.Contains("pt_PLOT_abseta_bin0")){_par = "abseta_bin0";} - else if(_canvas.Contains("pt_PLOT_abseta_bin1")){_par = "abseta_bin1";} + if(_canvas.Contains("pt_PLOT_abseta_bin0")){_par = "MapPtEta_abseta_bin0";} + else if(_canvas.Contains("pt_PLOT_abseta_bin1")){_par = "MapPtEta_abseta_bin1";} + else if(_canvas.Contains("pt_PLOT_abseta_bin2")){_par = "MapPtEta_abseta_bin2";} + else if(_canvas.Contains("pt_PLOT_abseta_bin3")){_par = "MapPtEta_abseta_bin3";} + else if(_canvas.Contains("VAR_eta")){_par = "";} + else if(_canvas.Contains("VAR_pt")){_par = "";} + else if(_canvas.Contains("VAR_vtx")){_par = "";} + else if(_canvas.Contains("pfCombRelActivitydBCorr_PLOT_pt_bin0")){_par = "MapActPt_pt_bin0";} + else if(_canvas.Contains("pfCombRelActivitydBCorr_PLOT_pt_bin1")){_par = "MapActPt_pt_bin1";} + else if(_canvas.Contains("pfCombRelActivitydBCorr_PLOT_pt_bin2")){_par = "MapActPt_pt_bin2";} + else if(_canvas.Contains("pfCombRelActivitydBCorr_PLOT_abseta_bin0")){_par = "MapActEta_abseta_bin0";} + else if(_canvas.Contains("pfCombRelActivitydBCorr_PLOT_abseta_bin1")){_par = "MapActEta_abseta_bin1";} //cout<<_file<GetPrimitive("hxy_fit_eff"); TH1F* ratio = DividTGraphs(eff1, eff2); + + ratio->SetDirectory(0); ratio->SetStats(0); int nbins = eff1->GetN(); @@ -109,10 +132,19 @@ int make_ratioplots(TString _file, TString _canvas, TString _path1, TString _pat pad1->SetTopMargin(0.1); pad1->Draw(); pad1->cd(); - eff1->Draw("AP"); - eff1->SetTitle(""); - eff1->GetYaxis()->SetTitle("Efficiency9"); - eff1->GetXaxis()->SetRangeUser(x_low, x_hi); + float eff_min = 0.785; + float eff_max = 1.15; + TString axistitle = eff1->GetXaxis()->GetTitle(); + TH1F* hr; + if( axistitle == "pfCombRelActivitydBCorr"){ + hr = pad1->DrawFrame(0.001,0.07,10.01,1.50); + } + else{ + hr = pad1->DrawFrame(x_low,eff_min,x_hi,eff_max); + } + hr->SetTitle(""); + hr->GetYaxis()->SetTitle("Efficiency"); + hr->GetXaxis()->SetRangeUser(x_low, x_hi); eff1->GetXaxis()->SetLabelOffset(999); eff1->GetXaxis()->SetLabelSize(0); TString _xtitle = eff1->GetXaxis()->GetTitle(); @@ -123,22 +155,73 @@ int make_ratioplots(TString _file, TString _canvas, TString _path1, TString _pat else if (_xtitle.Contains("pfCombAbsActivitydBCorr")){_xtitle = "Abs Activity";} else if (_xtitle.Contains("pfCombRelActivitydBCorr")){_xtitle = "Rel Activity";} else{_xtitle = "Rel Activity";} + hr->GetXaxis()->SetTitle(_xtitle); eff1->GetXaxis()->SetTitle(_xtitle); + TString _title = eff1->GetXaxis()->GetTitle(); - eff1->GetXaxis()->SetTitle(""); - eff1->GetYaxis()->SetRangeUser(0.899, 1.05); - eff1->GetYaxis()->SetTitleSize(27); - eff1->GetYaxis()->SetTitleFont(63); - eff1->GetYaxis()->SetLabelFont(43); - eff1->SetMarkerStyle(20); - eff1->GetYaxis()->SetLabelSize(20); - eff1->GetYaxis()->SetTitleOffset(1.5); + if(_xtitle == "Rel Activity"){ + pad1->SetLogx(); + eff1->GetXaxis()->SetRangeUser(0.001, 10.01); + } + hr->GetXaxis()->SetTitle(""); + if(_xtitle == "Rel Activity"){ + eff1->GetYaxis()->SetRangeUser(0.07, 1.50); + } + else{ + hr->GetYaxis()->SetRangeUser(eff_min, eff_max); + } + hr->GetYaxis()->SetTitleSize(27); + hr->GetYaxis()->SetTitleFont(63); + hr->GetYaxis()->SetLabelFont(43); + hr->SetMarkerStyle(20); + hr->GetYaxis()->SetLabelSize(20); + hr->GetYaxis()->SetTitleOffset(1.5); + eff1->Draw("P"); eff2->Draw("P"); eff2->SetLineColor(4); eff2->SetMarkerStyle(21); eff2->SetMarkerColor(4); - TString _legtext = ""; + TString _legtext1 = ""; + TString _legtext2 = ""; + + if(_canvas.Contains("NUM_LooseID_DENOM")){ _legtext1 = "" ; } + else if(_canvas.Contains("NUM_MediumID_DENOM")){ _legtext1 = "" ; } + else if(_canvas.Contains("NUM_TightIP2D_DENOM")){ _legtext1 = "TightIP2D / " ; } + else if(_canvas.Contains("NUM_TightIP3D_DENOM")){ _legtext1 = "TightIP3D / " ; } + else if(_canvas.Contains("NUM_MiniIsoLoose_DENOM")){ _legtext1 = "MiniIso loose / " ; } + else if(_canvas.Contains("NUM_MiniIsoTight_DENOM")){ _legtext1 = "MiniIso tight / " ; } + else if(_canvas.Contains("NUM_MultiIsoMedium_DENOM")){ _legtext1 = "MultiIso medium / " ; } + else if(_canvas.Contains("MiniIso04")){ _legtext1 = "Loose + MiniIso04 + TightIP2D " ; } + else if(_canvas.Contains("MultiIso") and _canvas.Contains("plus")){ _legtext1 = "Medium + MultiIsoMedium + TightIP2D + TightIP3D" ; } + else if(_canvas.Contains("Medium") and _canvas.Contains("MiniIso02") and _canvas.Contains("TightIP2D") ){ _legtext1 = "Medium + MiniIso02 + TightIP2D" ; } + else if(_canvas.Contains("Medium") and _canvas.Contains("MiniIso02") and _canvas.Contains("TightIP3D") ){ _legtext1 = "Medium + MiniIso02 + TightIP3D" ; } + else if(_canvas.Contains("Loose") and _canvas.Contains("MiniIso02") and _canvas.Contains("TightIP3D") ){ _legtext1 = "Loose + MiniIso02 + TightIP3D" ; } + else if(_canvas.Contains("Medium") and _canvas.Contains("MiniIso02") and not _canvas.Contains("TightIP") ){ _legtext1 = "Medium + MiniIso02" ; } + else if(_canvas.Contains("Loose") and _canvas.Contains("MiniIso02") and _canvas.Contains("TightIP2D") ){ _legtext1 = "Loose + MiniIso02 + TightIP2D" ; } + else if(_canvas.Contains("Loose") and _canvas.Contains("MiniIso02") and not _canvas.Contains("TightIP") ){ _legtext1 = "Loose + MiniIso02" ; } + + if(_canvas.Contains("NUM_LooseID_DENOM") || _canvas.Contains("DENOM_LooseID")){ _legtext1 += "Loose Id \n" ; } + else if(_canvas.Contains("NUM_MediumID_DENOM") || _canvas.Contains("DENOM_MediumID")){ _legtext1 += "Medium Id \n" ;} + + if(_canvas.Contains("VAR_pt")){ _legtext2 += "#||{#eta} #leq 2.4 " ; } + else if(_canvas.Contains("VAR_eta")){ _legtext2 += "p_{T} #geq 10 GeV" ; } + else if(_canvas.Contains("VAR_vtx")){ _legtext2 += "p_{T} #geq 10 GeV, #||{#eta} #leq 2.4" ; } + + else if(_canvas.Contains("VAR_map_pt") && _canvas.Contains("pt_PLOT_abseta_bin0")){ _legtext2 += "0 < #||{#eta} #leq 0.9" ; } + else if(_canvas.Contains("VAR_map_pt") && _canvas.Contains("pt_PLOT_abseta_bin1")){ _legtext2 += "0.9 < #||{#eta} #leq 1.2" ; } + else if(_canvas.Contains("VAR_map_pt") && _canvas.Contains("pt_PLOT_abseta_bin2")){ _legtext2 += "1.2 < #||{#eta} #leq 2.1" ; } + else if(_canvas.Contains("VAR_map_pt") && _canvas.Contains("pt_PLOT_abseta_bin3")){ _legtext2 += "2.1 < #||{#eta} #leq 2.4" ; } + + else if(_canvas.Contains("VAR_map_activity_eta") && _canvas.Contains("pfCombRelActivitydBCorr_PLOT_abseta_bin0")){ _legtext2 += "0 < #||{#eta} #leq 1.2, p_{T} #geq 10 GeV" ; } + else if(_canvas.Contains("VAR_map_activity_eta") && _canvas.Contains("pfCombRelActivitydBCorr_PLOT_abseta_bin1")){ _legtext2 += "1.2 < #||{#eta} #leq 2.4, p_{T} #geq 10 GeV" ; } + + else if(_canvas.Contains("VAR_map_activity_pt") && _canvas.Contains("pfCombRelActivitydBCorr_PLOT_pt_bin0")){ _legtext2 += "10 GeV < p_{T} #leq 40 GeV, #||{#eta} #leq 2.4" ; } + else if(_canvas.Contains("VAR_map_activity_pt") && _canvas.Contains("pfCombRelActivitydBCorr_PLOT_pt_bin1")){ _legtext2 += "40 GeV < p_{T} #leq 80 GeV, #||{#eta} #leq 2.4" ; } + else if(_canvas.Contains("VAR_map_activity_pt") && _canvas.Contains("pfCombRelActivitydBCorr_PLOT_pt_bin2")){ _legtext2 += "80 GeV < p_{T} #leq 200 GeV, #||{#eta} #leq 2.4" ; } + TString _legtext = "#splitline{" + _legtext1 + "}{" + _legtext2 + "}"; + +/* if(_canvas.Contains("/Loose_noIP_eta")){ _legtext = "Loose Id, p_{T} #geq 20 GeV"; }else if(_canvas.Contains("/Loose_noIP_vtx_bin")){ @@ -380,13 +463,15 @@ int make_ratioplots(TString _file, TString _canvas, TString _path1, TString _pat std::cout<<"canvas is"<<_canvas<SetHeader(_legtext); TLegendEntry *header = (TLegendEntry*)leg->GetListOfPrimitives()->First(); //header->SetTextAlign(22); header->SetTextColor(1); header->SetTextFont(43); - header->SetTextSize(16); + header->SetTextSize(14); TString _leg1 = ""; TString _leg2 = ""; if(_path1.Contains("DATA")) _leg1 = "data"; @@ -427,55 +512,96 @@ int make_ratioplots(TString _file, TString _canvas, TString _path1, TString _pat c3->cd(); TPad *pad2 = new TPad("pad2", "pad2", 0, 0., 1, 0.3); - if(_xtitle == "Soft Activity"){ - pad2->SetLogx(); - } pad2->SetTopMargin(0.0); pad2->SetBottomMargin(0.35); pad2->SetGridy(); pad2->Draw(); pad2->cd(); - ratio->SetTitle(""); - ratio->SetLineWidth(2); - ratio->SetLineColor(1); - ratio->SetMarkerStyle(20); - ratio->SetMarkerColor(1); + TH1F* h; + float ymin = 0.950001; + float ymax = 1.049999; + float xmin = 0.001; //eff1->GetXaxis()->GetXmin(); + float enlarge = 0.9; + + //float xmax = eff1->GetXaxis()->GetXmax(); + float xmax = 10.01; + + if(_xtitle == "Rel Activity"){ + h = pad2->DrawFrame(xmin,ymin-enlarge,xmax,ymax+enlarge); + } + else{ + h = pad2->DrawFrame(x_low,ymin,x_hi,ymax); + } + h->SetTitle(""); + h->SetLineWidth(2); + h->SetLineColor(1); + h->SetMarkerStyle(20); + h->SetMarkerColor(1); //ratio->GetYaxis()->SetRangeUser(0.9,1.0999); - ratio->GetYaxis()->SetRangeUser(0.95,1.04999); - //ratio->GetYaxis()->SetRangeUser(0.98,1.01999); - ratio->GetYaxis()->SetTitle("Data/MC"); - ratio->GetYaxis()->SetNdivisions(505); - ratio->GetYaxis()->SetLabelSize(20); - ratio->GetYaxis()->SetTitleFont(63); - ratio->GetYaxis()->SetTitleOffset(1.5); - ratio->GetYaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) - ratio->GetYaxis()->SetTitleSize(27); - ratio->GetXaxis()->SetTitleSize(27); - ratio->GetXaxis()->SetLabelSize(20); - ratio->GetXaxis()->SetTitle(_title); - ratio->GetXaxis()->SetTitleFont(63); - ratio->GetXaxis()->SetTitleSize(27); - ratio->GetXaxis()->SetTitleOffset(3); - ratio->GetXaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) - ratio->Draw(); + if(_xtitle == "Rel Activity"){ + h->GetYaxis()->SetRangeUser(ymin-enlarge,ymax+enlarge); + } + else{ + h->GetYaxis()->SetRangeUser(ymin,ymax); + } + //raftio->GetYaxis()->SetRangeUser(0.98,1.01999); + h->GetYaxis()->SetTitle("Data/MC"); + h->GetYaxis()->SetNdivisions(505); + h->GetYaxis()->SetLabelSize(20); + h->GetYaxis()->SetTitleFont(63); + h->GetYaxis()->SetTitleOffset(1.5); + h->GetYaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) + h->GetYaxis()->SetTitleSize(27); + h->GetXaxis()->SetTitleSize(27); + h->GetXaxis()->SetLabelSize(20); + h->GetXaxis()->SetTitle(_title); + h->GetXaxis()->SetTitleFont(63); + h->GetXaxis()->SetTitleSize(27); + h->GetXaxis()->SetTitleOffset(3); + h->GetXaxis()->SetLabelFont(43); // Absolute font size in pixel (precision 3) + if(_xtitle == "Rel Activity"){ + ratio->GetXaxis()->SetRangeUser(xmin,xmax); + pad2->SetLogx(); + } + else{ + ratio->GetXaxis()->SetRangeUser(x_low,x_hi); + } + + ratio->Draw("same"); + pad2->Update(); + + //cout << "--------------" << endl; + //for (int k = 0; k < ratio->GetSize(); ++k){ + // cout << " " << ratio->GetBinContent(k) << endl; + //} + + float ratio_min = ratio->GetMinimum(0); + float ratio_max = ratio->GetMaximum(); + + TString leg_ratio_text = Form("min: %.3f, max: %.3f",ratio_min, ratio_max); + TLegend* leg_ratio = new TLegend(0.20, 0.86, 0.40 , 0.87); + leg_ratio->SetHeader(leg_ratio_text); + TLegendEntry *header_ratio = (TLegendEntry*)leg_ratio->GetListOfPrimitives()->First(); + //header_ratio->SetTextAlign(22); + header_ratio->SetTextColor(1); + header_ratio->SetTextFont(43); + header_ratio->SetTextSize(16); + leg_ratio->Draw("same"); + CMS_lumi(pad1, 4, 11); c3->Update(); c3->SaveAs(_output + _par + "_" + _file); _file.ReplaceAll("pdf","png"); c3->SaveAs(_output + _par + "_" + _file); - - //TFile *f_out = TFile::Open("TEST.root","recreate"); - //f_out->cd(); - //c3->Write(); + _file.ReplaceAll("png","root"); //_*_*_*_*_*_*_*_*_* //Write SF into file //_*_*_*_*_*_*_*_*_* - - //ofstream myfile; - //myfile.open(_output + - + //TFile *fout = new TFile(_output + _par + "_" + _file, "NEW"); + //ratio->Write(); + //fout->Close(); return 0; diff --git a/test/zmumu/SUSY/SF2015/make_ratioplots.py b/test/zmumu/SUSY/SF2015/make_ratioplots.py index df9b186940a..45305c77b3e 100644 --- a/test/zmumu/SUSY/SF2015/make_ratioplots.py +++ b/test/zmumu/SUSY/SF2015/make_ratioplots.py @@ -25,24 +25,32 @@ def getplotpath(_file, _path, _tptree): print 'plot is', plot.GetName() for par in PAR: if plot.GetName().startswith(par): - print '============\n' - print 'name checked' - print '============\n' + print 'xxxxxxxxxxxxxxxxx' + print "making ratio for ", plot + print 'xxxxxxxxxxxxxxxxx' _canvas = _tptree + '/' + key.GetName() + '/fit_eff_plots' +'/' + plot.GetName() CANVAS.append(_canvas) return CANVAS def getparameter(_file): _par = [] - if _file.find('_eta') != -1: _par.append('eta_PLOT') - elif _file.find('pt_alleta') != -1: _par.append('pt_PLOT') - elif _file.find('pt_spliteta') != -1: + if _file.find('VAR_eta') != -1: _par.append('eta_PLOT') + elif _file.find('VAR_pt') != -1: _par.append('pt_PLOT') + elif _file.find('VAR_map_pt_eta') != -1: _par.append('pt_PLOT_abseta_bin0') _par.append('pt_PLOT_abseta_bin1') + _par.append('pt_PLOT_abseta_bin2') + _par.append('pt_PLOT_abseta_bin3') elif _file.find('pt_highabseta') != -1:_par.append('pt_PLOT') - elif _file.find('_vtx') != -1: _par.append('tag_nVertices_PLOT') + elif _file.find('VAR_vtx') != -1: _par.append('tag_nVertices_PLOT') elif _file.find('_phi') != -1: _par.append('phi_PLOT') - elif _file.find('activity') != -1: _par.append('pfCombRelActivitydBCorr_PLOT') + elif _file.find('VAR_map_activity_eta') != -1: + _par.append('pfCombRelActivitydBCorr_PLOT_abseta_bin0') + _par.append('pfCombRelActivitydBCorr_PLOT_abseta_bin1') + elif _file.find('VAR_map_activity_pt') != -1: + _par.append('pfCombRelActivitydBCorr_PLOT_pt_bin0') + _par.append('pfCombRelActivitydBCorr_PLOT_pt_bin1') + _par.append('pfCombRelActivitydBCorr_PLOT_pt_bin2') else: print "@ERROR: parameter not found !" sys.exit() diff --git a/test/zmumu/SUSY/SF2015/retrieve_plots.py b/test/zmumu/SUSY/SF2015/retrieve_plots.py index 662662664ab..1df0c7cb90a 100644 --- a/test/zmumu/SUSY/SF2015/retrieve_plots.py +++ b/test/zmumu/SUSY/SF2015/retrieve_plots.py @@ -25,7 +25,6 @@ def save_canvas(_folder, _file, _folder_out): r.gDirectory.cd(key2.GetName()) for key3 in r.gDirectory.GetListOfKeys(): c3 = r.gROOT.GetClass(key3.GetClassName()) - #print 'The name is ', key3.GetName() if str(c3).find('TDirectoryFile') != -1 and key3.GetName().find('_eff') == -1: r.gDirectory.cd(key3.GetName()) for key4 in r.gDirectory.GetListOfKeys(): @@ -33,7 +32,6 @@ def save_canvas(_folder, _file, _folder_out): #print 'The class name is ', c4, #print 'The name is ', key4.GetName() if key4.GetName() == 'fit_canvas' and str(c4).find('TCanvas') != -1: - #print 'gonna save the canvas' canvas = key4.ReadObj() #print canvas,type(canvas),canvas.GetClassName() #print 'The name of the folder out is', _folder_out + '/' + key3.GetName() + '.pdf' @@ -52,37 +50,24 @@ def save_canvas(_folder, _file, _folder_out): import sys, os args = sys.argv[1:] -#scenario = "data_all" -#scenario = "mc_all" -#if len(args) > 0: scenario = args[0] -#print "The scenario is ", scenario -iteration = '6' +iteration = '1' if len(args) > 0: iteration = args[0] print "The iteration is ", iteration -#data_sample = "25ns" -#data_sample = "50nsC" -#data_sample = "50nsB" -#if len(args) > 2: data_sample = args[2] -#print "The data sample is ", data_sample - -#_sample = '/DATA25ns2015D/' -_sample = '/MC25ns2015DLO/' +_sample = '/DATA25ns2015D/' +#_sample = '/MC25ns2015DLO/' #_sample = '/MC25ns2015DNLO/' - - -_folder = '' -_folder = os.getcwd() + '/Efficiency' + iteration + _sample - +if len(args) > 1: _sample = args[1] +print "The sample is", _sample +_folder = os.getcwd() + '/Efficiency' + iteration + '/' + _sample + '/' _folder_out = _folder + 'FitPlots/' if not os.path.exists(_folder + '/FitPlots'): os.makedirs(_folder + '/FitPlots') -print 'folder is', _folder -print '_folder_out is', _folder_out dir = os.listdir(_folder) for file in dir: - if file.find('TnP_MuonID') != -1: - save_canvas(_folder, file, _folder_out) + if(file.find('TnP_') != -1 and os.stat(_folder + file).st_size > 9999): + print 'hello' + save_canvas(_folder, file, _folder_out) diff --git a/test/zmumu/SUSY/SF2015/run.sh b/test/zmumu/SUSY/SF2015/run.sh index bd1d2eb32a6..c56eda47ac0 100755 --- a/test/zmumu/SUSY/SF2015/run.sh +++ b/test/zmumu/SUSY/SF2015/run.sh @@ -1,5 +1,5 @@ #!/bin/bash -cd /afs/cern.ch/work/g/gaperrin/private/TnPTutorial/TnPSUSY_v1/CMSSW_7_4_10/src/MuonAnalysis/TagAndProbe/test/zmumu/SUSY/SF2015/ +cd /afs/cern.ch/user/j/jhoss/analysis/CMSSW_7_4_10/src/MuonAnalysis/TagAndProbe/test/zmumu/SUSY/SF2015 eval `scramv1 runtime -sh` -cmsRun fitMuonID.py $1 $2 $3 $4 $5 +cmsRun fitMuonID.py $1 $2 $3 $4 $5 $6 diff --git a/test/zmumu/SUSY/SF2015/submit.sh b/test/zmumu/SUSY/SF2015/submit.sh index c1b68471e1e..8bd92a021b5 100644 --- a/test/zmumu/SUSY/SF2015/submit.sh +++ b/test/zmumu/SUSY/SF2015/submit.sh @@ -1,35 +1,58 @@ #!/bin/bash -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 1 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 2 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 3 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 4 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 5 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 6 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 7 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 8 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 9 data_all 25ns 2015D -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 10 data_all 25ns 2015D -# -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 1 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 2 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 3 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 4 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 5 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 6 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 7 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 8 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 9 mc_all 25ns 2015D NLO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 10 mc_all 25ns 2015D NLO -# -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 1 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 2 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 3 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 4 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 5 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 6 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 7 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 8 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 9 mc_all 25ns 2015D LO -bsub -q 8nh -u pippo1234 run.sh 5pt_9999relact 10 mc_all 25ns 2015D LO +bsub -R "pool>50000" -q 8nh run.sh TopUp_red 1 data_all 25ns 2015D +bsub -R "pool>50000" -q 8nh run.sh TopUp_red 2 data_all 25ns 2015D +bsub -R "pool>50000" -q 8nh run.sh TopUp_red 3 data_all 25ns 2015D +#bsub -R "pool>50000" -q 8nh run.sh TopUp_red 4 data_all 25ns 2015D +bsub -R "pool>50000" -q 8nh run.sh TopUp_red 5 data_all 25ns 2015D +#bsub -R "pool>50000" -q 8nh run.sh TopUp_red 6 data_all 25ns 2015D +bsub -R "pool>50000" -q 8nh run.sh TopUp_red 7 data_all 25ns 2015D +#bsub -R "pool>50000" -q 8nh run.sh TopUp_red 8 data_all 25ns 2015D +bsub -R "pool>50000" -q 8nh run.sh TopUp_red 9 data_all 25ns 2015D +bsub -R "pool>50000" -q 8nh run.sh TopUp_red 10 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 11 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 12 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 13 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 14 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 15 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 16 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 17 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 18 data_all 25ns 2015D +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 1 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 2 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 3 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 4 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 5 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 6 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 7 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 8 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 9 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 10 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 11 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 12 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 13 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 14 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 15 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 16 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 17 mc_all 25ns 2015D LO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 18 mc_all 25ns 2015D LO + +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 1 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 2 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 3 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 4 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 5 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 6 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 7 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 8 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 9 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 10 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 11 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 12 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 13 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 14 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 15 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 16 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 17 mc_all 25ns 2015D NLO +#bsub -R "pool>30000" -q 8nh run.sh TopUp_red 18 mc_all 25ns 2015D NLO diff --git a/test/zmumu/mu_POG/25ns_v2/fitMuonID.py b/test/zmumu/mu_POG/25ns_v2/fitMuonID.py new file mode 100644 index 00000000000..e23c6985619 --- /dev/null +++ b/test/zmumu/mu_POG/25ns_v2/fitMuonID.py @@ -0,0 +1,599 @@ +import FWCore.ParameterSet.Config as cms +### USAGE: +### +### +### +### + +import sys, os +args = sys.argv[1:] +iteration = 'test_tree_path_v2' +if len(args) > 1: iteration = args[1] +print "The iteration is", iteration +id_bins = '1' +if len(args) > 2: id_bins = args[2] +print 'id_bins is', id_bins +scenario = "data_all" +if len(args) > 3: scenario = args[3] +print "Will run scenario ", scenario +bs = '25ns' +if len(args) > 4: bs = args[4] +print 'the bunch spacing is', bs +run = 'data1' +if len(args) > 5: run = args[5] +print 'run is', run +#for MC +order = 'LO' +if len(args) > 6: + if scenario == 'data_all': + print "@WARINING: no order variable is necessasry for data" + order = args[6] +print 'order is', order + + +#import sys, os +#args = sys.argv[1:] +#scenario = "data_all" +#if len(args) > 1: scenario = args[1] +#print "Will run scenario ", scenario +#bs = '25ns' +#if len(args) > 2: +# bs = args[2] +#print 'the bunch spacing is', bs +#run = 'data1' +#if len(args) > 3: +# run = args[3] +#print 'run is', run +#id_bins = '1' +#if len(args) > 4: +# id_bins = args[4] +#print 'id_bins is', id_bins +##for MC +#order = 'LO' +#if len(args) > 5: +# if scenario == 'data_all': +# print "@WARINING: no order variable is necessasry for data" +# order = args[5] +#print 'order is', order + +process = cms.Process("TagProbe") +process.load('FWCore.MessageService.MessageLogger_cfi') +process.source = cms.Source("EmptySource") +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) + +Template = cms.EDAnalyzer("TagProbeFitTreeAnalyzer", + NumCPU = cms.uint32(1), + SaveWorkspace = cms.bool(False), + + Variables = cms.PSet( + weight = cms.vstring("weight","-100","100",""), + mass = cms.vstring("Tag-muon Mass", "70", "130", "GeV/c^{2}"), + pt = cms.vstring("muon p_{T}", "0", "1000", "GeV/c"), + eta = cms.vstring("muon #eta", "-2.5", "2.5", ""), + abseta = cms.vstring("muon |#eta|", "0", "2.5", ""), + phi = cms.vstring("muon #phi at vertex", "-3.1416", "3.1416", ""), + charge = cms.vstring("muon charge", "-2.5", "2.5", ""), + combRelIsoPF04dBeta = cms.vstring("dBeta rel iso dR 0.4", "-2", "9999999", ""), + tag_pt = cms.vstring("Tag p_{T}", "0", "1000", "GeV/c"), + tag_nVertices = cms.vstring("Number of vertices", "0", "999", ""), + tag_abseta = cms.vstring("|eta| of tag muon", "0", "2.5", ""), + tag_combRelIsoPF04dBeta = cms.vstring("Tag dBeta rel iso dR 0.4", "-2", "9999999", ""), + dB = cms.vstring("dB", "-1000", "1000", ""), + dzPV = cms.vstring("dzPV", "-1000", "1000", ""), + dxyBS = cms.vstring("dxyBS", "-1000", "1000", ""), + SIP = cms.vstring("SIP", "-1000", "1000", ""), + pair_probeMultiplicity = cms.vstring("pair_probeMultiplicity", "0","30",""), + ), + + Categories = cms.PSet( + PF = cms.vstring("PF Muon", "dummy[pass=1,fail=0]"), + Medium = cms.vstring("Medium Id. Muon", "dummy[pass=1,fail=0]"), + Tight2012 = cms.vstring("Tight Id. Muon", "dummy[pass=1,fail=0]"), + tag_IsoMu20 = cms.vstring("PF Muon", "dummy[pass=1,fail=0]"), + ), + + Expressions = cms.PSet( + #IP + Loose_noIPVar = cms.vstring("Loose_noIPVar", "PF==1", "PF"), + Medium_noIPVar= cms.vstring("Medium_noIPVar", "Medium==1", "Medium"), + Tight2012_zIPCutVar = cms.vstring("Tight2012_zIPCut", "Tight2012 == 1 && abs(dzPV) < 0.5", "Tight2012", "dzPV"), + ), + + Cuts = cms.PSet( + #IP + Loose_noIP = cms.vstring("Loose_noIP", "Loose_noIPVar", "0.5"), + Medium_noIP= cms.vstring("Medium_noIP", "Medium_noIPVar", "0.5"), + Tight2012_zIPCut = cms.vstring("Tight2012_zIPCut", "Tight2012_zIPCutVar", "0.5"), + #Isolations + LooseIso4 = cms.vstring("LooseIso4" ,"combRelIsoPF04dBeta", "0.25"), + TightIso4 = cms.vstring("TightIso4" ,"combRelIsoPF04dBeta", "0.15"), + ), + + + PDFs = cms.PSet( + voigtPlusExpo = cms.vstring( + "Voigtian::signal(mass, mean[90,80,100], width[2.495], sigma[3,1,20])", + "Exponential::backgroundPass(mass, lp[0,-5,5])", + "Exponential::backgroundFail(mass, lf[0,-5,5])", + "efficiency[0.9,0,1]", + "signalFractionInPassing[0.9]" + ), + vpvPlusExpo = cms.vstring( + "Voigtian::signal1(mass, mean1[90,80,100], width[2.495], sigma1[2,1,3])", + "Voigtian::signal2(mass, mean2[90,80,100], width, sigma2[4,2,10])", + "SUM::signal(vFrac[0.8,0,1]*signal1, signal2)", + "Exponential::backgroundPass(mass, lp[-0.1,-1,0.1])", + "Exponential::backgroundFail(mass, lf[-0.1,-1,0.1])", + "efficiency[0.9,0,1]", + "signalFractionInPassing[0.9]" + ), + vpvPlusExpoMin70 = cms.vstring( + "Voigtian::signal1(mass, mean1[90,80,100], width[2.495], sigma1[2,1,3])", + "Voigtian::signal2(mass, mean2[90,80,100], width, sigma2[4,3,10])", + "SUM::signal(vFrac[0.8,0.5,1]*signal1, signal2)", + "Exponential::backgroundPass(mass, lp[-0.1,-1,0.1])", + "Exponential::backgroundFail(mass, lf[-0.1,-1,0.1])", + "efficiency[0.9,0.7,1]", + "signalFractionInPassing[0.9]" + ), + vpvPlusCheb = cms.vstring( + "Voigtian::signal1(mass, mean1[90,80,100], width[2.495], sigma1[2,1,3])", + "Voigtian::signal2(mass, mean2[90,80,100], width, sigma2[4,3,10])", + "SUM::signal(vFrac[0.8,0.5,1]*signal1, signal2)", + "RooChebychev::backgroundPass(mass, {a0[0.5,0,1], a1[0.5,0,1],a2[0.5,0,1]})", + "RooChebychev::backgroundFail(mass, {a0[0.5,0,1], a1[0.5,0,1],a2[0.5,0,1]})", + "efficiency[0.9,0.7,1]", + "signalFractionInPassing[0.9]" + ) + ), + + binnedFit = cms.bool(True), + binsForFit = cms.uint32(40), + saveDistributionsPlot = cms.bool(False), + + Efficiencies = cms.PSet(), # will be filled later +) + +#_*_*_*_*_*_*_*_*_*_*_*_* +#Denominators and Binning +#_*_*_*_*_*_*_*_*_*_*_*_* +#For ID + +ETA_BINS = cms.PSet( + pt = cms.vdouble(20, 500), + eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +VTX_BINS_ETA24 = cms.PSet( + pt = cms.vdouble( 20, 500 ), + abseta = cms.vdouble( 0.0, 2.4), + tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +PT_ALLETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +PT_ETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 1.2, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), + +) +#Additional study for Medium ID (in selected eta region) +PHI_LOWETA = cms.PSet( + pt = cms.vdouble(20, 500), + eta = cms.vdouble(-2.4, -2.1), + phi = cms.vdouble(-3.1416, -2.618, -2.0944, -1.5708, -1.0472, -0.5236, 0, 0.5236, 1.0472, 1.5708, 2.0944, 2.618, 3.1416), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +PHI_HIGHETA = cms.PSet( + pt = cms.vdouble(20, 500), + eta = cms.vdouble(2.1, 2.4), + phi = cms.vdouble(-3.1416, -2.618, -2.0944, -1.5708, -1.0472, -0.5236, 0, 0.5236, 1.0472, 1.5708, 2.0944, 2.618, 3.1416), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +PT_HIGHABSETA = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble(2.1, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +VTX_HIGHABSETA = cms.PSet( + pt = cms.vdouble( 20, 500 ), + abseta = cms.vdouble(2.1, 2.4), + tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) + +#For IP on ID +LOOSE_ETA_BINS = cms.PSet( + pt = cms.vdouble(20, 500), + eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + PF = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +LOOSE_VTX_BINS_ETA24 = cms.PSet( + pt = cms.vdouble( 20, 500 ), + abseta = cms.vdouble( 0.0, 2.4), + tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + PF = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +LOOSE_PT_ALLETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + PF = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +LOOSE_PT_ETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 1.2, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + PF = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), + +) +#MEDIUM +MEDIUM_ETA_BINS = cms.PSet( + pt = cms.vdouble(20, 500), + eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Medium = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +MEDIUM_VTX_BINS_ETA24 = cms.PSet( + pt = cms.vdouble( 20, 500 ), + abseta = cms.vdouble( 0.0, 2.4), + tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Medium = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +MEDIUM_PT_ALLETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Medium = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +MEDIUM_PT_ETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 1.2, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Medium = cms.vstring("pass"), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), + +) +#TIGHT +TIGHT_ETA_BINS = cms.PSet( + pt = cms.vdouble(20, 500), + eta = cms.vdouble(-2.4, -2.1, -1.6, -1.2, -0.9, -0.3, -0.2, 0.2, 0.3, 0.9, 1.2, 1.6, 2.1, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Tight2012 = cms.vstring("pass"), + dzPV = cms.vdouble(-0.5, 0.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +TIGHT_VTX_BINS_ETA24 = cms.PSet( + pt = cms.vdouble( 20, 500 ), + abseta = cms.vdouble( 0.0, 2.4), + tag_nVertices = cms.vdouble(0.5,2.5,4.5,6.5,8.5,10.5,12.5,14.5,16.5,18.5,20.5,22.5,24.5,26.5,28.5,30.5), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Tight2012 = cms.vstring("pass"), + dzPV = cms.vdouble(-0.5, 0.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +TIGHT_PT_ALLETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Tight2012 = cms.vstring("pass"), + dzPV = cms.vdouble(-0.5, 0.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), +) +TIGHT_PT_ETA_BINS1 = cms.PSet( + pt = cms.vdouble(20, 30, 40, 50, 60, 80, 120, 200), + abseta = cms.vdouble( 0.0, 1.2, 2.4), + pair_probeMultiplicity = cms.vdouble(0.5, 1.5), + Tight2012 = cms.vstring("pass"), + dzPV = cms.vdouble(-0.5, 0.5), + #tag selections + tag_pt = cms.vdouble(21, 500), + tag_IsoMu20 = cms.vstring("pass"), + tag_combRelIsoPF04dBeta = cms.vdouble(-0.5, 0.2), + +) +if scenario == 'data_all': + if run == 'data1': + process.TnP_MuonID = Template.clone( + InputFileNames = cms.vstring( + #'root://eoscms//eos/cms/store/group/phys_muon/TagAndProbe/trees_Data_25ns_run2015D_v3p2/tnpZ_Data_25ns_run2015D_v3p2_part1.root', + #'root://eoscms//eos/cms/store/group/phys_muon/TagAndProbe/trees_Data_25ns_run2015D_v3p2/tnpZ_Data_25ns_run2015D_v3p2_part2.root', + #'root://eoscms//eos/cms/store/group/phys_muon/TagAndProbe/trees_Data_25ns_run2015D_v3p2/tnpZ_Data_25ns_run2015D_v3p2_part3.root' + 'tnpZ_Data_25ns_run2015D_v3p2.root' + ), + InputTreeName = cms.string("fitter_tree"), + InputDirectoryName = cms.string("tpTree"), + OutputFileName = cms.string("TnP_MuonID_%s.root" % scenario), + Efficiencies = cms.PSet(), + ) +elif scenario == 'mc_all': + if bs == '50ns': + if run == '2015B': + if order== 'LO': + process.TnP_MuonID = Template.clone( + InputFileNames = cms.vstring( + 'root://eoscms//eos/cms/store/group/phys_muon/perrin/v3/SmallTree_TnP_trees_aod747_DY_LOmadgraph_50ns_withFixes_withNVtxWeights_2015B.root' + ), + InputTreeName = cms.string("fitter_tree"), + InputDirectoryName = cms.string("tpTree"), + OutputFileName = cms.string("TnP_MuonID_%s.root" % scenario), + Efficiencies = cms.PSet(), + ) + process.TnP_MuonID.WeightVariable = cms.string("weight") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") + elif order == 'NLO': + process.TnP_MuonID = Template.clone( + InputFileNames = cms.vstring( + 'root://eoscms//eos/cms/store/group/phys_muon/perrin/v3/SmallTree_TnP_trees_aod747_DY_amcatnlo_50ns_withFixes_withNVtxWeights_WithWeights_2015B.root' + ), + InputTreeName = cms.string("fitter_tree"), + InputDirectoryName = cms.string("tpTree"), + OutputFileName = cms.string("TnP_MuonID_%s.root" % scenario), + Efficiencies = cms.PSet(), + ) + process.TnP_MuonID.WeightVariable = cms.string("weight") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") + elif run == '2015C': + if order== 'LO': + process.TnP_MuonID = Template.clone( + InputFileNames = cms.vstring( + 'root://eoscms//eos/cms/store/group/phys_muon/perrin/v3/SmallTree_TnP_trees_aod747_DY_LOmadgraph_50ns_withFixes_withNVtxWeights_2015C.root' + ), + InputTreeName = cms.string("fitter_tree"), + InputDirectoryName = cms.string("tpTree"), + OutputFileName = cms.string("TnP_MuonID_%s.root" % scenario), + Efficiencies = cms.PSet(), + ) + process.TnP_MuonID.WeightVariable = cms.string("weight") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") + elif order == 'NLO': + process.TnP_MuonID = Template.clone( + InputFileNames = cms.vstring( + 'root://eoscms//eos/cms/store/group/phys_muon/perrin/v3/SmallTree_TnP_trees_aod747_DY_amcatnlo_50ns_withFixes_withNVtxWeights_WithWeights_2015C.root' + ), + InputTreeName = cms.string("fitter_tree"), + InputDirectoryName = cms.string("tpTree"), + OutputFileName = cms.string("TnP_MuonID_%s.root" % scenario), + Efficiencies = cms.PSet(), + ) + process.TnP_MuonID.WeightVariable = cms.string("weight") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") + elif bs == '25ns': + if run == '2015D': + if order== 'LO': + process.TnP_MuonID = Template.clone( + InputFileNames = cms.vstring( + '/afs/cern.ch/work/g/gaperrin/private/TnP/TnP_v3/CMSSW_7_4_10/src/MuonAnalysis/TagAndProbe/test/zmumu/mu_POG/25ns/tnpZ_MC_25ns_madgraphMLM-pythia8_v3_SmallTree_withNVtxWeights.root' + ), + InputTreeName = cms.string("fitter_tree"), + InputDirectoryName = cms.string("tpTree"), + OutputFileName = cms.string("TnP_MuonID_%s.root" % scenario), + Efficiencies = cms.PSet(), + ) + process.TnP_MuonID.WeightVariable = cms.string("weight") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") + elif order == 'NLO': + process.TnP_MuonID = Template.clone( + InputFileNames = cms.vstring( + '/afs/cern.ch/work/g/gaperrin/private/TnP/TnP_v3/CMSSW_7_4_10/src/MuonAnalysis/TagAndProbe/test/zmumu/mu_POG/25ns/tnpZ_MC_25ns_amcatnloFXFX-pythia8_SmallTree_withNVtxWeights_WithWeights.root' + ), + InputTreeName = cms.string("fitter_tree"), + InputDirectoryName = cms.string("tpTree"), + OutputFileName = cms.string("TnP_MuonID_%s.root" % scenario), + Efficiencies = cms.PSet(), + ) + process.TnP_MuonID.WeightVariable = cms.string("weight") + process.TnP_MuonID.Variables.weight = cms.vstring("weight","-10","10","") + +ID_BINS = [] + +#_*_*_*_*_*_*_*_*_*_* +#IDs +#_*_*_*_*_*_*_*_*_*_* +#Loose ID +if id_bins == '1': + ID_BINS = [ + (("Loose_noIP"), ("NUM_LooseID_DEN_genTracks_PAR_eta", ETA_BINS)), + (("Loose_noIP"), ("NUM_LooseID_DEN_genTracks_PAR_vtx_bin1_24", VTX_BINS_ETA24 )), + (("Loose_noIP"), ("NUM_LooseID_DEN_genTracks_PAR_pt_alleta_bin1", PT_ALLETA_BINS1)), + (("Loose_noIP"), ("NUM_LooseID_DEN_genTracks_PAR_pt_spliteta_bin1", PT_ETA_BINS1)), + ] +#Medium ID +if id_bins == '2': + ID_BINS = [ + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_eta", ETA_BINS)), + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_vtx_bin1_24", VTX_BINS_ETA24 )), + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_pt_alleta_bin1", PT_ALLETA_BINS1)), + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_pt_spliteta_bin1", PT_ETA_BINS1)), + ] +#Tight ID +if id_bins == '3': + ID_BINS = [ + (("Tight2012_zIPCut"), ("NUM_TightIDandIPCut_DEN_genTracks_PAR_eta", ETA_BINS)), + (("Tight2012_zIPCut"), ("NUM_TightIDandIPCut_DEN_genTracks_PAR_vtx_bin1_24", VTX_BINS_ETA24 )), + (("Tight2012_zIPCut"), ("NUM_TightIDandIPCut_DEN_genTracks_PAR_pt_alleta_bin1", PT_ALLETA_BINS1)), + (("Tight2012_zIPCut"), ("NUM_TightIDandIPCut_DEN_genTracks_PAR_pt_spliteta_bin1", PT_ETA_BINS1)), + ] +#Additional studies on Medium ID (in selected eta region) +#Medium ID +if id_bins == '4': + ID_BINS = [ + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_phi_loweta", PHI_LOWETA)), + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_phi_higheta", PHI_HIGHETA )), + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_pt_highabseta", PT_HIGHABSETA)), + (("Medium_noIP"), ("NUM_MediumID_DEN_genTracks_PAR_vtx_highabseta", VTX_HIGHABSETA)), + ] +#_*_*_*_*_*_*_*_*_*_* +#ISOs +#_*_*_*_*_*_*_*_*_*_* +#Loose Iso +if id_bins == '5': + ID_BINS = [ + (("LooseIso4"), ("NUM_LooseRelIso_DEN_LooseID_PAR_eta", LOOSE_ETA_BINS)), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_LooseID_PAR_vtx_bin1_24", LOOSE_VTX_BINS_ETA24 )), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_LooseID_PAR_pt_alleta_bin1", LOOSE_PT_ALLETA_BINS1)), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_LooseID_PAR_pt_spliteta_bin1", LOOSE_PT_ETA_BINS1)), + ] +if id_bins == '6': + ID_BINS = [ + (("LooseIso4"), ("NUM_LooseRelIso_DEN_MediumID_PAR_eta", MEDIUM_ETA_BINS)), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_MediumID_PAR_vtx_bin1_24", MEDIUM_VTX_BINS_ETA24 )), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_MediumID_PAR_pt_alleta_bin1", MEDIUM_PT_ALLETA_BINS1)), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_MediumID_PAR_pt_spliteta_bin1", MEDIUM_PT_ETA_BINS1)), + ] +if id_bins == '7': + ID_BINS = [ + (("LooseIso4"), ("NUM_LooseRelIso_DEN_TightID_PAR_eta", TIGHT_ETA_BINS)), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_TightID_PAR_vtx_bin1_24", TIGHT_VTX_BINS_ETA24 )), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_TightID_PAR_pt_alleta_bin1", TIGHT_PT_ALLETA_BINS1)), + (("LooseIso4"), ("NUM_LooseRelIso_DEN_TightID_PAR_pt_spliteta_bin1", TIGHT_PT_ETA_BINS1)), + ] +#Tight Iso +if id_bins == '8': + ID_BINS = [ + (("TightIso4"), ("NUM_TightRelIso_DEN_TightID_PAR_eta", TIGHT_ETA_BINS)), + (("TightIso4"), ("NUM_TightRelIso_DEN_TightID_PAR_vtx_bin1_24", TIGHT_VTX_BINS_ETA24 )), + (("TightIso4"), ("NUM_TightRelIso_DEN_TightID_PAR_pt_alleta_bin1", TIGHT_PT_ALLETA_BINS1)), + (("TightIso4"), ("NUM_TightRelIso_DEN_TightID_PAR_pt_spliteta_bin1", TIGHT_PT_ETA_BINS1)), + ] +if id_bins == '9': + ID_BINS = [ + (("TightIso4"), ("NUM_TightRelIso_DEN_MediumID_PAR_eta", MEDIUM_ETA_BINS)), + (("TightIso4"), ("NUM_TightRelIso_DEN_MediumID_PAR_vtx_bin1_24", MEDIUM_VTX_BINS_ETA24 )), + (("TightIso4"), ("NUM_TightRelIso_DEN_MediumID_PAR_pt_alleta_bin1", MEDIUM_PT_ALLETA_BINS1)), + (("TightIso4"), ("NUM_TightRelIso_DEN_MediumID_PAR_pt_spliteta_bin1", MEDIUM_PT_ETA_BINS1)), + ] + +for ID, ALLBINS in ID_BINS: + X = ALLBINS[0] + B = ALLBINS[1] + _output = os.getcwd() + '/Efficiency' + iteration + if not os.path.exists(_output): + print 'Creating Efficiency directory where the fits are stored' + os.makedirs(_output) + if scenario == 'data_all': + _output += '/DATA' + bs + run + elif scenario == 'mc_all': + _output += '/MC' + bs + run + order + if not os.path.exists(_output): + os.makedirs(_output) + module = process.TnP_MuonID.clone(OutputFileName = cms.string(_output + "/TnP_%s.root" % (X))) + #shape = "vpvPlusExpo" + shape = "vpvPlusCheb" + DEN = B.clone(); num = ID; + + #compute isolation efficiency + if scenario == 'data_all': + if num.find("Iso4") != -1: + setattr(module.Efficiencies, ID+"_"+X, cms.PSet( + EfficiencyCategoryAndState = cms.vstring(num,"below"), + UnbinnedVariables = cms.vstring("mass"), + BinnedVariables = DEN, + BinToPDFmap = cms.vstring(shape) + )) + else: + setattr(module.Efficiencies, ID+"_"+X, cms.PSet( + EfficiencyCategoryAndState = cms.vstring(num,"above"), + UnbinnedVariables = cms.vstring("mass"), + BinnedVariables = DEN, + BinToPDFmap = cms.vstring(shape) + )) + setattr(process, "TnP_MuonID_"+ID+"_"+X, module) + setattr(process, "run_"+ID+"_"+X, cms.Path(module)) + elif scenario == 'mc_all': + if num.find("Iso4") != -1: + setattr(module.Efficiencies, ID+"_"+X, cms.PSet( + EfficiencyCategoryAndState = cms.vstring(num,"below"), + UnbinnedVariables = cms.vstring("mass","weight"), + BinnedVariables = DEN, + BinToPDFmap = cms.vstring(shape) + )) + else: + setattr(module.Efficiencies, ID+"_"+X, cms.PSet( + EfficiencyCategoryAndState = cms.vstring(num,"above"), + UnbinnedVariables = cms.vstring("mass","weight"), + BinnedVariables = DEN, + BinToPDFmap = cms.vstring(shape) + )) + setattr(process, "TnP_MuonID_"+ID+"_"+X, module) + setattr(process, "run_"+ID+"_"+X, cms.Path(module)) +