Skip to content

Commit 87204c2

Browse files
committed
improved way to replace input file in ED filter
1 parent b10cc27 commit 87204c2

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

run_fpmc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
cd fpmc/
33
source setup_lxplus.sh
44
./fpmc-hepmc \
5-
--cfg Datacards/dataQED_WW \
5+
--cfg Datacards/dataDPE_Dijets \
66
--comenergy 13000 \
7-
--fileout dataWW.hepmc \
8-
--nevents 10
7+
--fileout data_dijets.hepmc \
8+
--nevents 100

run_sim.sh

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11

22
# Details here: https://twiki.cern.ch/twiki/bin/view/Sandbox/PpsCepStudies#FPMC
3+
4+
# variable JOBNAME is been used for IO filenames from simulation and event sample used as input:
5+
#
6+
# $JOBNAME.hepmc: input event sample from FPMC
7+
# $JOBNAME.py: config file for cmsRun
8+
# $JOBNAME.root: output file from simulation
9+
310
CMSSW=CMSSW_8_0_1
411
AREA=$PWD/$CMSSW/src/
5-
OUTPUTFILE=dataWW.py
6-
INPUTFILE=dataWW.hepmc
12+
JOBNAME=data_dijets
13+
NEVENTS=100
714

8-
cp fpmc/$INPUTFILE $AREA
15+
echo "Copying event sample"
16+
cp fpmc/$JOBNAME.hepmc $AREA
917

1018
cd $AREA
19+
echo "Setting up CMSSW environment"
1120
eval `scramv1 runtime -sh`
1221

22+
echo "Creating configuration file from cmsDriver"
1323
cmsDriver.py \
1424
readHepMC_cff.py \
15-
-n 10 \
25+
-n $((NEVENTS)) \
1626
--fast \
1727
--conditions auto:run2_mc \
1828
--eventcontent AODSIM \
@@ -23,29 +33,34 @@ cmsDriver.py \
2333
--era Run2_25ns \
2434
--customise FastSimulation/PPSFastSim/customise_FastSimCTPPS_cff.customise \
2535
--no_exec \
26-
--fileout=dataWW.root \
27-
--python_filename=$OUTPUTFILE
36+
--fileout="$JOBNAME".root \
37+
--python_filename="$JOBNAME".py
2838

2939
# Replace input file:
3040

31-
sed -i -e 's/FPMC_WW_Inclusive_13TeV/dataWW/g' Configuration/Generator/python/readHepMC_cff.py
41+
echo "Replacing input filename for hepMC format"
42+
sed -i 's/file:.*.hepmc/file:'"$JOBNAME"'.hepmc/g' Configuration/Generator/python/readHepMC_cff.py
3243

3344
# modify the resulting driver (in this examples, 'readHepMC_cff_py_GEN_SIM_RECOBEFMIX_DIGI_RECO.py')
3445
# by adding the following line, with 'source' as the input HepMC sample:
3546
# process.VtxSmeared.src = 'source'
3647

37-
sed '94iprocess.VtxSmeared.src = "'$INPUTFILE'"' $OUTPUTFILE > test.py
38-
mv test.py $OUTPUTFILE
48+
echo "Adding hepMC event sample for simulation"
49+
sed '94iprocess.VtxSmeared.src = '"\"$JOBNAME"'.hepmc\"' "$JOBNAME".py > test.py
50+
mv test.py $JOBNAME.py
3951

4052
# filter has to be modified to include specific channels; for WW see:
4153
# https://raw.githubusercontent.com/uerj-cms-cep-studies/tmp/master/inputHepMC.cc
54+
echo "Fetching ED filter"
4255
mkdir inputHepMC
4356
cd inputHepMC
4457
mkedfltr inputHepMC
4558
cd ..
4659

4760
# when ready, run:
61+
echo "Compiling CMSSW area"
4862
scram b -j 8
4963
# and:
50-
cmsRun dataWW.py
64+
echo "Running job"
65+
cmsRun $JOBNAME.py
5166
# or equivalent driver.

0 commit comments

Comments
 (0)