Skip to content

Commit

Permalink
choose year dependent scale factor for E/Etrue CC
Browse files Browse the repository at this point in the history
  • Loading branch information
cippy committed Sep 13, 2019
1 parent 2e4e2fa commit 0d928ca
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
4 changes: 3 additions & 1 deletion FillEpsilonPlot/interface/FillEpsilonPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ class FillEpsilonPlot : public edm::EDAnalyzer {
std::string calibMapPath_;
std::string jsonFile_;
std::string fileEoverEtrueContainmentCorrections_;
double scalingEoverEtrueCC_g1_;
double scalingEoverEtrueCC_g2_;
std::string ebContainmentCorrections_;
std::string MVAEBContainmentCorrections_01_;
std::string MVAEBContainmentCorrections_02_;
Expand Down Expand Up @@ -251,7 +253,7 @@ class FillEpsilonPlot : public edm::EDAnalyzer {
double nXtal_2_cut_high_[3];
double S4S9_cut_low_[3];
double S4S9_cut_high_[3];
double SystOrNot_;
int SystOrNot_;

// MC stuff
bool isMC_;
Expand Down
10 changes: 6 additions & 4 deletions FillEpsilonPlot/src/FillEpsilonPlot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ FillEpsilonPlot::FillEpsilonPlot(const edm::ParameterSet& iConfig)
/// parameters from python
Are_pi0_ = iConfig.getUntrackedParameter<bool>("Are_pi0",true);
useContainmentCorrectionsFromEoverEtrue_ = iConfig.getUntrackedParameter<bool>("useContainmentCorrectionsFromEoverEtrue",true);
scalingEoverEtrueCC_g1_ = iConfig.getUntrackedParameter<double>("scalingEoverEtrueCC_g1",1.0);
scalingEoverEtrueCC_g2_ = iConfig.getUntrackedParameter<double>("scalingEoverEtrueCC_g2",1.0);
useMVAContainmentCorrections_ = iConfig.getUntrackedParameter<bool>("useMVAContainmentCorrections",true);
new_pi0ContainmentCorrections_ = iConfig.getUntrackedParameter<bool>("new_pi0ContainmentCorrections",false);

Expand Down Expand Up @@ -1186,8 +1188,8 @@ FillEpsilonPlot::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup
using namespace edm;
nPi0=0;
//For Syst error SystOrNot_=1 or 2, for normal calib is 0
if(SystOrNot_==1. && int(iEvent.id().event())%2!=0 ) return;
else if(SystOrNot_==2. && int(iEvent.id().event())%2==0 ) return;
if(SystOrNot_==1 && int(iEvent.id().event())%2!=0 ) return;
else if(SystOrNot_==2 && int(iEvent.id().event())%2==0 ) return;

iEvent.getByToken ( EBRecHitCollectionToken_, ebHandle);
iEvent.getByToken ( EERecHitCollectionToken_, eeHandle);
Expand Down Expand Up @@ -2349,8 +2351,8 @@ CaloCluster FillEpsilonPlot::getClusterAfterContainmentCorrections(std::vector<C
// However, since the ratio is nearly flat, we divided CC from V1 MC by the mean of the ratio
// it would be better to use a histogram for CC which is already scaled, but this is more straightforward if we want to add other corrections
//float CC_meanRatioV1overV2MC = isSecondPhoton ? 1.006 : 1.01;
float CC_meanRatioV1overV2MC = 1.0;

// float CC_meanRatioV1overV2MC = 1.0;
float CC_meanRatioV1overV2MC = isSecondPhoton ? scalingEoverEtrueCC_g2_ : scalingEoverEtrueCC_g1_;

for (std::vector< std::pair<DetId, float> >::const_iterator it = hitsAndFrac.begin(); it != hitsAndFrac.end(); ++it) {

Expand Down
6 changes: 3 additions & 3 deletions submit/Utilities/deleteEOSfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ if [[ ${host} != *"lxplus"* ]]; then
return 0
fi

iter_ini=3
iter_fin=6 # it is included in sequence below
iter_ini=0
iter_fin=0 # it is included in sequence below

eosPath="/eos/cms/store/group/dpg_ecal/alca_ecalcalib/piZero_Run2/mciprian/"
dirName="AlCaP0_2018_ULrereco_1every2_inverted_ext1_fromIter0"
dirName="AlCaP0_2018_ULrereco_thirdThirdNotUsedFor2018IC_fromIC2018"

# you can use "epsilonPlots_" as pattern to delete all directory with the mass distributions. The ending underscore prevents the merged "*epsilonPlots.root" file
# from being deleted as well (you might want to keep it)
Expand Down
5 changes: 3 additions & 2 deletions submit/getFilesAlCaP0.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#! /bin/bash

thisYear="18" # use 16, 17, 18
thisYear="16" # use 16, 17, 18
dayMonthYear=`date +%d_%m_%Y`
dataset="AlCaP0"
runYear="20${thisYear}"
dataEra="" # keep "" or select an era
#JsonFilter="/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions${thisYear}/13TeV/DCSOnly/json_DCSONLY.txt" # caution to the year
#JsonFilter="/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions18/13TeV/PromptReco/Cert_314472-325175_13TeV_PromptReco_Collisions18_JSON.txt"
JsonFilter="/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions18/13TeV/ReReco/Cert_314472-325175_13TeV_17SeptEarlyReReco2018ABC_PromptEraD_Collisions18_JSON.txt"
#JsonFilter="/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions18/13TeV/ReReco/Cert_314472-325175_13TeV_17SeptEarlyReReco2018ABC_PromptEraD_Collisions18_JSON.txt"
JsonFilter="/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/ReReco/Final/Cert_271036-284044_13TeV_ReReco_07Aug2017_Collisions16_JSON.txt"
firstRunBrilcalc="" # can be empty, otherwise it is used to select a run range for the brilcalc command
lastRunBrilcalc="" # can be empty, otherwise it is used to select a run range for the brilcalc command

Expand Down
2 changes: 2 additions & 0 deletions submit/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ def printFillCfg2( outputfile, pwd , iteration, outputDir, ijob ):

if useContainmentCorrectionsFromEoverEtrue:
outputfile.write("process.analyzerFillEpsilon.useContainmentCorrectionsFromEoverEtrue = cms.untracked.bool( True )\n")
outputfile.write("process.analyzerFillEpsilon.scalingEoverEtrueCC_g1 = cms.untracked.double("+ scalingEoverEtrueCC_g1 +")\n")
outputfile.write("process.analyzerFillEpsilon.scalingEoverEtrueCC_g2 = cms.untracked.double("+ scalingEoverEtrueCC_g2 +")\n")
if copyCCfileToTMP:
copiedCCfile = str(fileEoverEtrueContainmentCorrections.split('/')[-1])
copiedCCfile = "/tmp/" + copiedCCfile.replace(".root","_iter_{ni}_job_{nj}.root".format(ni=iteration, nj=ijob))
Expand Down
14 changes: 9 additions & 5 deletions submit/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@
useCalibrationSelection = True # to use saem selection of calibration when making ntuples (so not to copy all the cuts)
useStreamSelection = False # for now it only work with MakeNtuple4optimization = True, otherwise it is ignored, it is a hardcoded way to use the stream selection below
#InputList and Folder name
inputlist_n = 'InputList/purified_AlCaP0_Run2018_09_07_2019_1every2_inverted.list' if isMC==False else 'InputList/MultiPion_FlatPt-1To15_PhotonPtFilter_RunIIAutumn18DRPremix-102X_upgrade2018_realistic_v15-v2.list' #'InputList/Gun_FlatPt1to15_MultiPion_withPhotonPtFilter_pythia8.list' # 'InputList/purified_AlCaP0_Run2017_B.list' # 'InputList/testMC.list'
dirname = 'AlCaP0_2018_ULrereco_1every2_inverted_ext1_fromIter0' if isMC==False else 'pi0CC_2018_EoverEtrue_foldSM_nFit10_onlyEB_fixGamma2EoverEtrue' #'pi0Gun_MCV2_EoverEtrue_foldSM' #'testMC_all_v2' #'AlCaP0_IC2017_upTo21September2017_2012regression_v2' # 'test'
inputlist_n = 'InputList/purified_AlCaP0_Run2018_09_07_2019_1every2_inverted_thirdThird.list' if isMC==False else 'InputList/MultiPion_FlatPt-1To15_PhotonPtFilter_RunIIAutumn18DRPremix-102X_upgrade2018_realistic_v15-v2.list' #'InputList/Gun_FlatPt1to15_MultiPion_withPhotonPtFilter_pythia8.list' # 'InputList/purified_AlCaP0_Run2017_B.list' # 'InputList/testMC.list'
dirname = 'AlCaP0_2018_ULrereco_thirdThirdNotUsedFor2018IC_fromIC2018' if isMC==False else 'pi0CC_2018_EoverEtrue_foldSM_nFit10_onlyEB_fixGamma2EoverEtrue' #'pi0Gun_MCV2_EoverEtrue_foldSM' #'testMC_all_v2' #'AlCaP0_IC2017_upTo21September2017_2012regression_v2' # 'test'
Silent = False # True->Fill modules is silent; False->Fill modules has a standard output
#TAG, QUEUE and ITERS
NameTag = dirname+'_' #'AlcaP0_2017_v3_' # Tag to the names to avoid overlap
queueForDaemon = 'cmscaf1nw' # Option suggested: 2nw/2nd, 1nw/1nd, cmscaf1nw/cmscaf1nd... even cmscaf2nw
queue = 'cmscaf1nd'
nIterations = 7 if isMC==False else 1 # 7
nIterations = 1 if isMC==False else 1 # 7
#nThread = 4 # if bigger than 1, enable multithreading, but I'm not sure if ECALpro supports it (see methods.py searching nThread)

SubmitFurtherIterationsFromExisting = True
# maybe I don't need the root://eoscms/ prefix if eos is mounted
startingCalibMap = 'root://eoscms//eos/cms/store/group/dpg_ecal/alca_ecalcalib/piZero_Run2/mciprian/AlCaP0_2018_ULrereco_1every2_inverted/iter_0/AlCaP0_2018_ULrereco_1every2_inverted_calibMap.root' # used only if SubmitFurtherIterationsFromExisting is True
startingCalibMap = 'root://eoscms//eos/cms/store/group/dpg_ecal/alca_ecalcalib/piZero_Run2/mciprian/AlCaP0_2018_ULrereco_1every2_ext1_fromIter6/iter_3/AlCaP0_2018_ULrereco_1every2_ext1_fromIter6_calibMap.root' # used only if SubmitFurtherIterationsFromExisting is True
SystOrNot = 0 # can be 0, 1 or 2 to run on all (default), even or odd events. It works only if you submit this new iteration from an existing one, therefore SubmitFurtherIterationsFromExisting must be set true. Tipically 0 is the default and has no real effect, it is like submitting usual iterations.

#N files
ijobmax = 6 if isMC==False else 1 # 5 number of files per job, 1 for MC to avoid loosing too many events due to problematic files
ijobmax = 8 if isMC==False else 1 # 5 number of files per job, 1 for MC to avoid loosing too many events due to problematic files
nHadd = 35 #35 # 35 number of files per hadd
nFit = 2000 if isMC==False else 10 # number of fits done in parallel
useFit_RooMinuit = False if isEoverEtrue else True # if True the fit is done with RooMinuit, otherwise with RooMinimizer. The former is obsolete, but the latter can lead to a CMSSW error which makes the job fail, creating large white strips in the map. This happens often because the fit sees a negative PDF at the border of the fit range, RooFit will try to adjust the fit range to avoid the unphysical region, but after few trials CMSSW throws an error: without CMSSW the fit should actually be able to try several thousands of times before failing
Expand Down Expand Up @@ -331,6 +331,10 @@
#containment corrections
useContainmentCorrectionsFromEoverEtrue = False
fileEoverEtrueContainmentCorrections = ""
# choose a scaling factor, if any, for E/Etrue CC (was needed for 2017 CC: 1.006 (1.01) for photon 2 (1))
scalingEoverEtrueCC_g1 = '1.0'
scalingEoverEtrueCC_g2 = '1.0'
#
if ContainmentCorrection == 'EoverEtrue': # in this case it is better to undefine MVA_REGRESSIO in FillEpsilonPlot.h
useEBContainmentCorrections = 'False'
useEEContainmentCorrections = 'False'
Expand Down

0 comments on commit 0d928ca

Please sign in to comment.