Skip to content

Commit

Permalink
Merge pull request #100 from jjacob/master
Browse files Browse the repository at this point in the history
Some (mostly minor) modifications made for the latest 8TeV analysis.
  • Loading branch information
kreczko committed May 30, 2014
2 parents c85bddb + e295efa commit 9aa88a7
Show file tree
Hide file tree
Showing 8 changed files with 1,448 additions and 1,011 deletions.
16 changes: 14 additions & 2 deletions python/master_2011_44X_cfg.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
mc_path = '/storage/TopQuarkGroup/mc/7TeV/LeptonPlus3JetsSkim/'
mc_path = '/storage/TopQuarkGroup/mc/7TeV/v10/LeptonPlus3JetsSkim/'
data_path = '/storage/TopQuarkGroup/data/2011/'
datasets = {'ElectronHad' : [data_path + 'ElectronHad/nTuple_v10_Run2011A-08Nov2011-v1_44X_GoldenJSON_LeptonPlus3Jets',
data_path + 'ElectronHad/nTuple_v10_Run2011B-19Nov2011-v1_44X_GoldenJSON_LeptonPlus3Jets'],
Expand Down Expand Up @@ -49,6 +49,10 @@
}

analysisModes = ['central',
'Electron_down',
'Electron_up',
'Muon_down',
'Muon_up',
'BJet_down',
'BJet_up',
'JES_down',
Expand All @@ -63,8 +67,10 @@

analysisModes.extend(['PDFWeights_%d' % weight for weight in range(1, 45)])

available_settings = ['JESsystematic', 'PUsystematic', 'BTagSystematic', 'LightTagSystematic', 'JetSmearingSystematic', 'custom_file_suffix']
available_settings = ['ElectronScaleFactorSystematic', 'MuonScaleFactorSystematic', 'JESsystematic', 'PUsystematic', 'BTagSystematic', 'LightTagSystematic', 'JetSmearingSystematic', 'custom_file_suffix']
default_settings = {
'ElectronScaleFactorSystematic':0,
'MuonScaleFactorSystematic':0,
'JESsystematic':0,
'PUFile':'PileUp_2011_truth_finebin_68000microbarn.root',
'BTagSystematic':0,
Expand All @@ -75,6 +81,10 @@
}

analysis_settings = {
'Electron_down':{'ElectronScaleFactorSystematic':-1},
'Electron_up':{'ElectronScaleFactorSystematic':1},
'Muon_down':{'MuonScaleFactorSystematic':-1},
'Muon_up':{'MuonScaleFactorSystematic':1},
'BJet_down':{'BTagSystematic':-1},
'BJet_up':{'BTagSystematic':1},
'JES_down':{'JESsystematic':-1},
Expand Down Expand Up @@ -136,6 +146,8 @@ def getAnalysisSettings(analysisMode):

#File for pile-up re-weighting
PUFile = toolsFolder + "data/" + settings['PUFile']
ElectronScaleFactorSystematic = settings['ElectronScaleFactorSystematic']
MuonScaleFactorSystematic = settings['MuonScaleFactorSystematic']
#JES Systematic, the +/- number of uncertainties to vary the jets with
JESsystematic = settings['JESsystematic']
JetSmearingSystematic = settings['JetSmearingSystematic']
Expand Down
20 changes: 16 additions & 4 deletions python/master_2012_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
}

analysisModes = ['central',
'Electron_down',
'Electron_up',
'Muon_down',
'Muon_up',
'BJet_down',
'BJet_up',
'JES_down',
Expand All @@ -86,31 +90,37 @@

analysisModes.extend(['PDFWeights_%d' % weight for weight in range(1, 45)])

available_settings = ['JESsystematic', 'PUsystematic', 'BTagSystematic', 'LightTagSystematic', 'JetSmearingSystematic', 'custom_file_suffix']
available_settings = ['ElectronScaleFactorSystematic', 'MuonScaleFactorSystematic', 'JESsystematic', 'JetSmearingSystematic', 'PUsystematic', 'BTagSystematic', 'LightTagSystematic', 'custom_file_suffix']
default_settings = {
'ElectronScaleFactorSystematic':0,
'MuonScaleFactorSystematic':0,
'JESsystematic':0,
'JetSmearingSystematic':0,
'PUFile':'PileUp_2012_69300_truth_finebin.root',
'BTagSystematic':0,
'LightTagSystematic':0,
'JetSmearingSystematic':0,
'custom_file_suffix':'',
'pdfWeightNumber' : 0,
}

analysis_settings = {
'Electron_down':{'ElectronScaleFactorSystematic':-1},
'Electron_up':{'ElectronScaleFactorSystematic':1},
'Muon_down':{'MuonScaleFactorSystematic':-1},
'Muon_up':{'MuonScaleFactorSystematic':1},
'BJet_down':{'BTagSystematic':-1},
'BJet_up':{'BTagSystematic':1},
'JES_down':{'JESsystematic':-1},
'JES_up':{'JESsystematic':1},
'JetSmearing_up':{'JetSmearingSystematic':1},
'JetSmearing_down':{'JetSmearingSystematic':-1},
'LightJet_down':{'LightTagSystematic':-1},
'LightJet_up':{'LightTagSystematic':1},
'PU_down':{'PUFile':'PileUp_2012_65835_truth_finebin.root',
'custom_file_suffix':'PU_65835mb'
},
'PU_up':{'PUFile':'PileUp_2012_72765_truth_finebin.root',
'custom_file_suffix':'PU_72765mb'},
'JetSmearing_up':{'JetSmearingSystematic':1},
'JetSmearing_down':{'JetSmearingSystematic':-1},
'Test': {'custom_file_suffix':'TESTING'}
}

Expand Down Expand Up @@ -160,6 +170,8 @@ def getAnalysisSettings(analysisMode):

#File for pile-up re-weighting
PUFile = toolsFolder + "data/" + settings['PUFile']
ElectronScaleFactorSystematic = settings['ElectronScaleFactorSystematic']
MuonScaleFactorSystematic = settings['MuonScaleFactorSystematic']
#JES Systematic, the +/- number of uncertainties to vary the jets with
JESsystematic = settings['JESsystematic']
JetSmearingSystematic = settings['JetSmearingSystematic']
Expand Down
28 changes: 17 additions & 11 deletions python/master_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
}

analysisModes = ['central',
'ElectronScaleFactor_down',
'ElectronScaleFactor_up',
'MuonScaleFactor_down',
'MuonScaleFactor_up',
'Electron_down',
'Electron_up',
'Muon_down',
'Muon_up',
'BJet_down',
'BJet_up',
'JES_down',
Expand All @@ -61,28 +61,31 @@
'LightJet_up',
'PU_down',
'PU_up',
'JetSmearing_up',
'JetSmearing_down',
'Test']

analysisModes.extend(['PDFWeights_%d' % weight for weight in range(1, 45)])

available_settings = ['ElectronScaleFactorSystematic', 'MuonScaleFactorSystematic', 'JESsystematic', 'PUsystematic', 'BTagSystematic', 'LightTagSystematic', 'custom_file_suffix']
available_settings = ['ElectronScaleFactorSystematic', 'MuonScaleFactorSystematic', 'JESsystematic', 'PUsystematic', 'BTagSystematic', 'LightTagSystematic', 'JetSmearingSystematic', 'custom_file_suffix']
default_settings = {
'ElectronScaleFactorSystematic':0,
'MuonScaleFactorSystematic':0,
'JESsystematic':0,
'PUFile':'PileUp_2011_truth_finebin_68000microbarn.root',
'BTagSystematic':0,
'LightTagSystematic':0,
'JetSmearingSystematic':0,
'custom_file_suffix':'',
'pdfWeightNumber' : 0,
}

analysis_settings = {
'ElectronScaleFactor_down':{'ElectronScaleFactorSystematic':-1},
'ElectronScaleFactor_up':{'ElectronScaleFactorSystematic':1},
'MuonScaleFactor_down':{'MuonScaleFactorSystematic':-1},
'MuonScaleFactor_up':{'MuonScaleFactorSystematic':1},
'BJet_down':{'BTagSystematic':-1},
'Electron_down':{'ElectronScaleFactorSystematic':-1},
'Electron_up':{'ElectronScaleFactorSystematic':1},
'Muon_down':{'MuonScaleFactorSystematic':-1},
'Muon_up':{'MuonScaleFactorSystematic':1},
'BJet_down':{'BTagSystematic':-1},
'BJet_up':{'BTagSystematic':1},
'JES_down':{'JESsystematic':-1},
'JES_up':{'JESsystematic':1},
Expand All @@ -93,7 +96,9 @@
},
'PU_up':{'PUFile':'PileUp_2011_truth_finebin_71400microbarn.root',
'custom_file_suffix':'PU_71400mb'},
'Test': {'custom_file_suffix':'TESTING'}
'JetSmearing_up':{'JetSmearingSystematic':1},
'JetSmearing_down':{'JetSmearingSystematic':-1},
'Test': {'custom_file_suffix':'TESTING'}
}
for weight in range(1, 45):
weight_txt = 'PDFWeights_%d' % weight
Expand Down Expand Up @@ -144,6 +149,7 @@ def getAnalysisSettings(analysisMode):
MuonScaleFactorSystematic = settings['MuonScaleFactorSystematic']
#JES Systematic, the +/- number of uncertainties to vary the jets with
JESsystematic = settings['JESsystematic']
JetSmearingSystematic = settings['JetSmearingSystematic']
BTagSystematic = settings['BTagSystematic']
LightTagSystematic = settings['LightTagSystematic']
custom_file_suffix = settings['custom_file_suffix']
Expand Down
10 changes: 5 additions & 5 deletions python/test_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#center of mass energy: 7TeV for 2010/2011 data/MC, 8TeV for 2012 data
#this value will be part of the output file name: DataType_CenterOfMassEnergyTeV_lumipb-1_....
centerOfMassEnergy = 7
centerOfMassEnergy = 8
nTuple_version = 10
#number of events to be processed
maxEvents = 10000
Expand Down Expand Up @@ -59,8 +59,8 @@
applyTopPtReweighting = False

#Lepton Scale Factors
ElectronScaleFactorSystematic = -1
MuonScaleFactorSystematic = -1
ElectronScaleFactorSystematic = 0
MuonScaleFactorSystematic = 0

#Jet Energy Resolutions files (L7 corrections)
bJetResoFile = toolsFolder + "data/bJetReso.root"
Expand All @@ -70,12 +70,12 @@
useHitFit = False
produceFitterASCIIoutput = False
inputFiles = [
# '/storage/TopQuarkGroup/data/2012/SingleElectron/nTuple_v10_Run2012D-22Jan2013-v1_AOD_GoldenJSON_LeptonPlus3Jets/*.root' # 53X 8TeV data
'/storage/TopQuarkGroup/data/2012/SingleElectron/nTuple_v10_Run2012D-22Jan2013-v1_AOD_GoldenJSON_LeptonPlus3Jets/*.root' # 53X 8TeV data
# '/storage/TopQuarkGroup/mc/8TeV/LeptonPlus3JetsSkim/TTJets_MassiveBinDECAY_TuneZ2star_8TeV-madgraph-tauola/nTuple_v10_Summer12_DR53X-PU_S10_START53_V7C-v1_LeptonPlus3Jets/*.root' #53X 8TeV MC
# '/storage/TopQuarkGroup/data/2011/ElectronHad/nTuple_v10_Run2011A-12Oct2013-v1_53X_GoldenJSON_LeptonPlus3Jets/*.root' # 53X 7TeV data
# ''53X 7TeV MC not available yet
# '/storage/TopQuarkGroup/data/2011/ElectronHad/nTuple_v10_Run2011B-19Nov2011-v1_44X_GoldenJSON_LeptonPlus3Jets/*.root' #44X 7TeV data
'/storage/TopQuarkGroup/mc/7TeV/v10/LeptonPlus3JetsSkim/TTJets_TuneZ2_7TeV-madgraph-tauola_with_genjet_properties/nTuple_v10_Fall11-PU_S6_START44_V9B-v1_LeptonPlus3Jets/*.root' #44X 7TeV MC
# '/storage/TopQuarkGroup/mc/7TeV/v10/LeptonPlus3JetsSkim/TTJets_TuneZ2_7TeV-madgraph-tauola_with_genjet_properties/nTuple_v10_Fall11-PU_S6_START44_V9B-v1_LeptonPlus3Jets/*.root' #44X 7TeV MC
]

#relative Path from calling BAT to the TopQuarkAnalysis folder
Expand Down
8 changes: 7 additions & 1 deletion src/HistHelpers/HistogramManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,19 @@ const std::string HistogramManager::assembleFilename(DataType::value type) const
std::string jetAlgo = JetAlgorithm::names[Globals::jetAlgorithm];
std::string metAlgo = METAlgorithm::names[Globals::metAlgorithm];
std::string muonAlgo = MuonAlgorithm::names[Globals::muonAlgorithm];
std::string electronSyst = (Globals::ElectronScaleFactorSystematic > 0) ? "_plusElectron" : "_minusElectron";
std::string muonSyst = (Globals::MuonScaleFactorSystematic > 0) ? "_plusMuon" : "_minusMuon";
std::string jesSyst = (Globals::JESsystematic > 0) ? "_plusJES" : "_minusJES";
std::string jetSmearingSyst = (Globals::JetSmearingSystematic > 0) ? "_plusJER" : "_minusJER";
std::string bjetSyst = (Globals::BJetSystematic > 0) ? "_plusBjet" : "_minusBJet";
std::string lightJetSyst = (Globals::LightJetSystematic > 0) ? "_plusLightJet" : "_minusLightJet";
std::string suffix = Globals::custom_file_suffix;
std::string pdfWeight =
(Globals::pdfWeightNumber != 0) ? "_PDF_" + boost::lexical_cast<std::string>(Globals::pdfWeightNumber) : "";
if (Globals::ElectronScaleFactorSystematic == 0)
electronSyst = "";
if (Globals::MuonScaleFactorSystematic == 0)
muonSyst = "";
if (Globals::JESsystematic == 0)
jesSyst = "";
if (Globals::JetSmearingSystematic == 0)
Expand All @@ -336,7 +342,7 @@ const std::string HistogramManager::assembleFilename(DataType::value type) const

str << name << "_" << Globals::luminosity << "pb";
str << "_" << electronAlgo << "_" << muonAlgo << "_" << jetAlgo << "_" << metAlgo;
str << jesSyst << jetSmearingSyst << pdfWeight << bjetSyst << lightJetSyst << suffix << ".root";
str << electronSyst << muonSyst << jesSyst << jetSmearingSyst << pdfWeight << bjetSyst << lightJetSyst << suffix << ".root";
return str.str();

}
Expand Down
44 changes: 22 additions & 22 deletions src/RecoObjects/Electron.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,31 +438,31 @@ double Electron::getEfficiencyCorrection(bool qcd, int electron_scale_factor_sys
double correction(1.);
double electronEta(eta());

if(Globals::energyInTeV == 7){
// hard coded values since pickle file not available...not updated because I couldn't find any values on twikis!
if (electronEta < -1.5)
correction = 1.003;
else if (electronEta >= -1.5 && electronEta < -1.2)
correction = 0.980;
else if (electronEta >= -1.2 && electronEta < -0.9)
correction = 0.941;
else if (electronEta >= -0.9 && electronEta < 0)
correction = 0.974;
else if (electronEta >= 0 && electronEta < 0.9)
correction = 0.977;
else if (electronEta >= 0.9 && electronEta < 1.2)
correction = 0.939;
else if (electronEta >= 1.2 && electronEta < 1.5)
correction = 0.967;
else if (electronEta >= 1.5)
correction = 1.023;
}
// if(Globals::energyInTeV == 7){
// // hard coded values since pickle file not available...not updated because I couldn't find any values on twikis!
// if (electronEta < -1.5)
// correction = 1.003;
// else if (electronEta >= -1.5 && electronEta < -1.2)
// correction = 0.980;
// else if (electronEta >= -1.2 && electronEta < -0.9)
// correction = 0.941;
// else if (electronEta >= -0.9 && electronEta < 0)
// correction = 0.974;
// else if (electronEta >= 0 && electronEta < 0.9)
// correction = 0.977;
// else if (electronEta >= 0.9 && electronEta < 1.2)
// correction = 0.939;
// else if (electronEta >= 1.2 && electronEta < 1.5)
// correction = 0.967;
// else if (electronEta >= 1.5)
// correction = 1.023;
// }
//8TeV scale factors from https://twiki.cern.ch/twiki/bin/viewauth/CMS/KoPFAElectronTagAndProbe
//Only factors from PromptReco available (in the "Efficiency for e+jet channel (promptreco)" section)
//Specifically: ID & Iso: "ID/Isolation efficiency" sub-section
//Specifically: Trigger: "Trigger efficiency" sub-section
//These values are hard coded because, unlike for Muons, there is no pickle file provided.
else if(qcd == false){ //corrections for (ID & Iso) and Trigger respectively
// else if(qcd == false){ //corrections for (ID & Iso) and Trigger respectively
if(fabs(electronEta)<0.8) {
if(20<=pt() && pt()<30) { //Note: Trigger scale factors only provided down to electron pt of 30GeV in the link above, so I have used the same as for the 30GeV-40GeV range.
switch (electron_scale_factor_systematic) {
Expand Down Expand Up @@ -559,7 +559,7 @@ double Electron::getEfficiencyCorrection(bool qcd, int electron_scale_factor_sys
correction = (0.959+0.003)*(0.988+0.002);
break;
default:
correction = 0.954*0.988;
correction = 0.959*0.988;
}
}
}
Expand Down Expand Up @@ -613,7 +613,7 @@ double Electron::getEfficiencyCorrection(bool qcd, int electron_scale_factor_sys
}
}
}
}
// }
//ID scale factor for QCD is technically irrelevant since we use conversion veto for QCD, but ID and isolation scale factors are provided as one so unable to split them to remove the ID scale factor.
// else if(qcd == true){
// }
Expand Down
Loading

0 comments on commit 9aa88a7

Please sign in to comment.