Skip to content

Commit

Permalink
Merge pull request #3 from hatakeyamak/PFValidationUpdate
Browse files Browse the repository at this point in the history
Pf validation update
  • Loading branch information
chosila authored Mar 10, 2020
2 parents 2e12079 + 7e3c57a commit 4723b88
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 73 deletions.
22 changes: 8 additions & 14 deletions Validation/RecoParticleFlow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Set up the work area
for lxplus with SLC7 (default since April 2019)

~~~
export SCRAM_ARCH=slc7_amd64_gcc700
# for SLC6 use 'slc6_amd64_gcc700' instead above
export SCRAM_ARCH=slc7_amd64_gcc820
cmsrel CMSSW_11_0_0
cd CMSSW_11_0_0
cmsenv
Expand All @@ -35,14 +34,14 @@ Create input file lists under test/tmp/das_cache
(You can modify which datasets are being used in the end of datasets.py script)

~~~
python test/datasets.py
cd test; python datasets.py; cd ..
~~~

Proceed to RECO step, about 30 minutes

This is necessary if you need to re-reco events to test introduced changes to PF reco.

Note 1: the default era & condition is now set to 2018. Change CONDITIONS and
Note 1: the default era & condition is now set to 2021. Change CONDITIONS and
ERA in test/run_relval.sh when trying other era, before trying the above commands.

Note 2: the execution will fail if the destination directory (test/tmp/QCD etc.)
Expand Down Expand Up @@ -123,18 +122,17 @@ be included in the DQM step, so delete files you don't want to study.



Note that the default era, condition, and samples are now set to 2018. Change CONDITIONS and ERA in test/run_relval.sh when trying other era, before trying the above commands. Also check (and if necessary, update) input samples and conf.Site.storageSite specified in $CMSSW_BASE/src/Validation/RecoParticleFlow/crab/multicrab.py (default storage site is T2_US_Caltech, but change it to your favorite site you have access to. use crab checkwrite --site=<site> to check your permission).
Note that the default era, condition, and samples are now set to 2021. Change CONDITIONS and ERA in test/run_relval.sh when trying other era, before trying the above commands. Also check (and if necessary, update) input samples and conf.Site.storageSite specified in $CMSSW_BASE/src/Validation/RecoParticleFlow/crab/multicrab.py (default storage site is T2_US_Caltech, but change it to your favorite site you have access to. use crab checkwrite --site=<site> to check your permission).
Take note that the CMSSW python configuration for running the RECO sequence is dumped into `crab/step3_dump.py`.


# Running DQM steps from existing MINIAOD samples

~~~
# For example (default for 2018):
#CONDITIONS=auto:phase1_2017_realistic ERA=Run2_2017 # for 2017 scenarios
# For example (default for 2021):
#CONDITIONS=auto:phase1_2018_realistic ERA=Run2_2018 # for 2018 scenarios
CONDITIONS=auto:phase1_2021_realistic ERA=Run3 # for run 3
#CONDITIONS=auto:phase2_realistic ERA=Phase2C8 # for phase2
#CONDITIONS=auto:phase2_realistic ERA=Phase2C9 # for phase2
#Running with 2 threads allows to use more memory on grid
NTHREADS=2 TMPDIR=tmp
Expand All @@ -149,13 +147,9 @@ make -p tmp/NuGunPU; cd tmp/NuGunPU
# Make a text file for input files. For example:

~~~
dasgoclient --query="file dataset=/RelValQCD_FlatPt_15_3000HS_13/CMSSW_11_0_0-106X_upgrade2018_realistic_v4-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-110X_mcRun3_2021_realistic_v6-v1/MINIAODSIM" > step3_filelist.txt
#(or
dasgoclient --query="file dataset=/RelValQCD_FlatPt_15_3000HS_13/CMSSW_11_0_0-PU25ns_106X_upgrade2018_realistic_v4-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValNuGun/CMSSW_11_0_0-PU25ns_106X_upgrade2018_realistic_v4-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValQCD_Pt-15To7000_Flat_14TeV/CMSSW_11_0_0-106X_upgrade2023_realistic_v2_2023D41noPU-v2/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValQCD_Pt-15To7000_Flat_14TeV/CMSSW_11_0_0-PU25ns_106X_upgrade2023_realistic_v2_2023D41PU200-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValNuGun/CMSSW_11_0_0-PU25ns_106X_upgrade2023_realistic_v2_2023D41PU200-v1/MINIAODSIM" > step3_filelist.txt
dasgoclient --query="file dataset=/RelValQCD_Pt15To7000_Flat_14TeV/CMSSW_11_0_0-110X_mcRun4_realistic_v2_2026D49noPU-v1/MINIAODSIM" > step3_filelist.txt
or using the list of files from your crab output areas.
#)
cat step3_filelist.txt
Expand Down
8 changes: 0 additions & 8 deletions Validation/RecoParticleFlow/plugins/PFJetAnalyzerDQM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,6 @@ void PFJetAnalyzerDQM::prepareGenJetPlots(const std::vector<edm::ParameterSet>&
const auto etabin_low = pset.getParameter<double>("etaBinLow");
const auto etabin_high = pset.getParameter<double>("etaBinHigh");

/* for (auto v : ptbins) {
std::cout << " " << v;
}
std::cout << std::endl;
*/

genJetPlots.push_back(Plot1DInBinVariable(
name,
title,
Expand Down Expand Up @@ -258,8 +252,6 @@ void PFJetAnalyzerDQM::fillJetResponse(edm::View<pat::Jet>& recoJetCollection, e
}

void PFJetAnalyzerDQM::bookHistograms(DQMStore::IBooker& booker, edm::Run const&, edm::EventSetup const&) {
//std::cout << "PFJetAnalyzerDQM booking response histograms" << std::endl;

booker.setCurrentFolder("ParticleFlow/JetResponse/" + jetCollectionName + "/JEC/");
for (auto& plot : jetResponsePlots) {
plot.book(booker);
Expand Down
13 changes: 3 additions & 10 deletions Validation/RecoParticleFlow/test/crab/multicrab.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@ def submit(config):
with open(config.General.workArea + "/crab_" + config.General.requestName + "/crab_config.py", "w") as fi:
fi.write(config.pythonise_())

#samples = [
# ("/RelValQCD_FlatPt_15_3000HS_13/CMSSW_10_6_0-106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "QCD_noPU"),
# ("/RelValQCD_FlatPt_15_3000HS_13/CMSSW_10_6_0-PU25ns_106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "QCD_PU"),
# #("/RelValZMM_13/CMSSW_10_6_0-106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "ZMM"),
# #("/RelValMinBias_13/CMSSW_10_6_0-106X_upgrade2018_design_v3-v1/GEN-SIM-DIGI-RAW", "MinBias"),
# ("/RelValNuGun/CMSSW_10_6_0-PU25ns_106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "NuGun_PU"),
#]
#
samples = [
("/RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "QCD_noPU"),
(" /RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "QCD_PU"),
(" /RelValNuGun/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "NuGun_PU"),
("/RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "QCD_PU"),
#("/RelValZMM_14/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "ZMM_PU"),
("/RelValNuGun/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "NuGun_PU"),
]

if __name__ == "__main__":
Expand Down
8 changes: 4 additions & 4 deletions Validation/RecoParticleFlow/test/crab/multicrab_phase2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def submit(config):
fi.write(config.pythonise_())

samples = [
("/RelValQCD_Pt-15To7000_Flat_14TeV/CMSSW_10_6_0-106X_upgrade2023_realistic_v2_2023D41noPU-v2/GEN-SIM-DIGI-RAW", "QCD_noPU_phase2"),
("/RelValQCD_Pt-15To7000_Flat_14TeV/CMSSW_10_6_0-PU25ns_106X_upgrade2023_realistic_v2_2023D41PU200-v1/GEN-SIM-DIGI-RAW", "QCD_PU_phase2"),
#("/RelValZMM_14/CMSSW_10_6_0-106X_upgrade2023_realistic_v2_2023D41noPU-v2/GEN-SIM-DIGI-RAW", "ZMM_phase2"),
("/RelValNuGun/CMSSW_10_6_0-PU25ns_106X_upgrade2023_realistic_v2_2023D41PU200-v1/GEN-SIM-DIGI-RAW", "NuGun_PU_phase2"),
("/RelValQCD_Pt15To7000_Flat_14TeV/CMSSW_11_0_0-110X_mcRun4_realistic_v2_2026D49noPU-v1/GEN-SIM-DIGI-RAW", "QCD_noPU_phase2"),
("/RelValQCD_Pt15To7000_Flat_14TeV/CMSSW_11_0_0-PU25ns_110X_mcRun4_realistic_v3_2026D49PU200-v1/GEN-SIM-DIGI-RAW", "QCD_PU_phase2"),
#("/RelValZMM_14/CMSSW_11_0_0-PU25ns_110X_mcRun4_realistic_v3_2026D49PU200-v1/GEN-SIM-DIGI-RAW", "ZMM_PU_phase2"),
("/RelValNuGun/CMSSW_11_0_0-PU25ns_110X_mcRun4_realistic_v3_2026D49PU200-v1/GEN-SIM-DIGI-RAW", "NuGun_PU_phase2"),
]

if __name__ == "__main__":
Expand Down
42 changes: 18 additions & 24 deletions Validation/RecoParticleFlow/test/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ def import_ROOT():
class Dataset:

"""Datatype that represents a DAS dataset
Attributes:
global_file_prefix (string): The ROOT TFile prefix that allows to open an LFN (/store/...)
name (string): The DAS name of the dataset
process (string): The nickname for the physics process that this dataset belongs to
"""

def __init__(self, name, process, global_file_prefix, cache_location, use_cache, tmpdir):
"""Summary
Args:
name (string): The DAS name of the dataset
process (string): The nickname for the physics process that this dataset belongs to
Expand All @@ -56,7 +56,7 @@ def __init__(self, name, process, global_file_prefix, cache_location, use_cache,

def __repr__(self):
"""
Returns:
string: The string representation of the Dataset
"""
Expand All @@ -65,7 +65,7 @@ def __repr__(self):

def escape_name(self):
"""Removes any slashes and other characters from the name such that it can be used as a filename
Returns:
string: The DAS name usable as a filename
"""
Expand All @@ -76,48 +76,48 @@ def escape_name(self):

def get_das_cache_filename(self):
"""Summary
Returns:
TYPE: Description
"""

return os.path.join(self.tmpdir, "das_cache", self.process + ".txt")
#return os.path.join(self.tmpdir, "das_cache", self.process + ".txt", self.escape_name() + ".txt")

def get_filenames(self):
"""Summary
Args:
njob (TYPE): Description
Returns:
TYPE: Description
"""
ret = None
with open(self.get_das_cache_filename(), "r") as fi:
ret = [self.global_file_prefix + li.strip() for li in fi.readlines()]
return ret

def cache_das_filenames(self):
"""Summary
Returns:
TYPE: Description
"""
LOG_MODULE_NAME.info("caching dataset {0}".format(self.name))
ret = subprocess.check_output('dasgoclient -dasmaps /tmp --query="file dataset={0}" --limit=0'.format(self.name), shell=True)
ret = subprocess.check_output('dasgoclient --query="file dataset={0}" --limit=0'.format(self.name), shell=True)

target_dir = os.path.dirname(self.get_das_cache_filename())
if not os.path.exists(target_dir):
os.makedirs(target_dir)

nfiles = 0
with open(self.get_das_cache_filename(), "w") as fi:
for line in ret.split("\n"):
if line.endswith(".root"):
fi.write(self.global_file_prefix + line + "\n")
nfiles += 1

LOG_MODULE_NAME.info("retrieved {0} files from DAS".format(nfiles))

return
Expand All @@ -129,16 +129,10 @@ def cache_das_filenames(self):
#prefix = "root://xrootd-cms.infn.it//"
tmpdir = "tmp"
datasets = [
#Dataset("/RelValQCD_FlatPt_15_3000HS_13/CMSSW_10_6_0-106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "QCD_noPU", prefix, None, False, tmpdir),
#Dataset("/RelValQCD_FlatPt_15_3000HS_13/CMSSW_10_6_0-PU25ns_106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "QCD_PU", prefix, None, False, tmpdir),
#Dataset("/RelValZMM_13/CMSSW_10_6_0-106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "ZMM", prefix, None, False, tmpdir),
#Dataset("/RelValMinBias_13/CMSSW_10_6_0-106X_upgrade2018_design_v3-v1/GEN-SIM-DIGI-RAW", "MinBias", prefix, None, False, tmpdir),
#Dataset("/RelValNuGun/CMSSW_10_6_0-PU25ns_106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "NuGun_PU", prefix, None, False, tmpdir)
Dataset("/RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "QCD_noPU", prefix, None, False, tmpdir),
Dataset("/RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "QCD_PU", prefix, None, False, tmpdir),
Dataset("/RelValZMM_13/CMSSW_11_1_0-106X_upgrade2018_realistic_v4-v1/GEN-SIM-DIGI-RAW", "ZMM", prefix, None, False, tmpdir),
Dataset("/RelValMinBias_13/CMSSW_11_1_0-106X_upgrade2018_design_v3-v1/GEN-SIM-DIGI-RAW", "MinBias", prefix, None, False, tmpdir),
Dataset("/RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "QCD_noPU", prefix, None, False, tmpdir),
Dataset("/RelValQCD_FlatPt_15_3000HS_14/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "QCD_PU", prefix, None, False, tmpdir),
Dataset("/RelValZMM_14/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "ZMM_PU", prefix, None, False, tmpdir),
Dataset("/RelValNuGun/CMSSW_11_0_0_patch1-PU_110X_mcRun3_2021_realistic_v6-v1/GEN-SIM-DIGI-RAW", "NuGun_PU", prefix, None, False, tmpdir)]

for ds in datasets:
ds.cache_das_filenames()
22 changes: 9 additions & 13 deletions Validation/RecoParticleFlow/test/run_relval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@ if [ -z "$PERJOB" ]; then
fi

#
#set default conditions - phase1 run3
CONDITIONS=auto:phase1_2021_realistic ERA=Run3
#CONDITIONS=auto:phase1_2018_realistic ERA=Run2_2018 GEOM=DB:Extended
#set default conditions - run3 2021
CONDITIONS=auto:phase1_2021_realistic ERA=Run3 GEOM=DB.Extended
#
#conditions - 2017
#CONDITIONS=auto:phase1_2017_realistic ERA=Run2_2017,run2_nanoAOD_94XMiniAODv1 GEOM=DB.Extended
#conditions - 2018
#CONDITIONS=auto:phase1_2018_realistic ERA=Run2_2018 GEOM=DB.Extended
#
#conditions - phase2
#CONDITIONS=auto:phase2_realistic ERA=Phase2C8 GEOM=Extended2023D41
#CONDITIONS=auto:phase2_realistic ERA=Phase2C9 GEOM=Extended2026D49

#Running with 2 threads allows to use more memory on grid
NTHREADS=2

#Argument parsing
if [ "$#" -ne 3 ]; then
echo "Must pass exactly 3 arguments: run_relval.sh [QCD|QCDPU|ZMM|MinBias|NuGunPU] [reco|dqm] [njob]"
echo "Must pass exactly 3 arguments: run_relval.sh [QCD|QCDPU|ZMMPU|NuGunPU] [reco|dqm] [njob]"
exit 0
fi

Expand Down Expand Up @@ -63,20 +62,17 @@ if [ "$1" == "QCD" ]; then
elif [ "$1" == "QCDPU" ]; then
INPUT_FILELIST=${CMSSW_BASE}/src/Validation/RecoParticleFlow/test/tmp/das_cache/QCD_PU.txt
NAME=QCDPU
elif [ "$1" == "ZMM" ]; then
INPUT_FILELIST=${CMSSW_BASE}/src/Validation/RecoParticleFlow/test/tmp/das_cache/ZMM.txt
elif [ "$1" == "ZMMPU" ]; then
INPUT_FILELIST=${CMSSW_BASE}/src/Validation/RecoParticleFlow/test/tmp/das_cache/ZMM_PU.txt
NAME=ZMM
elif [ "$1" == "MinBias" ]; then
INPUT_FILELIST=${CMSSW_BASE}/src/Validation/RecoParticleFlow/test/tmp/das_cache/MinBias.txt
NAME=MinBias
elif [ "$1" == "NuGunPU" ]; then
INPUT_FILELIST=${CMSSW_BASE}/src/Validation/RecoParticleFlow/test/tmp/das_cache/NuGun_PU.txt
NAME=NuGunPU
elif [ "$1" == "conf" ]; then # special switch for creating conf file,
INPUT_FILELIST=${CMSSW_BASE}/src/Validation/RecoParticleFlow/test/tmp/das_cache/NuGun_PU.txt # dummy
NAME=conf
else
echo "Argument 1 must be [QCD|QCDPU|ZMM|MinBias|NuGunPU|conf] but was $1"
echo "Argument 1 must be [QCD|QCDPU|ZMMPU|NuGunPU|conf] but was $1"
exit 1
fi

Expand Down

0 comments on commit 4723b88

Please sign in to comment.