Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:32:18

0001 #!/bin/bash
0002 
0003 set -x
0004 
0005 # Check if CMSSW envs are setup
0006 : ${CMSSW_BASE:?'You need to set CMSSW environemnt first.'}
0007 
0008 # DEFAULTS
0009 
0010 events=5000
0011 geometry='Extended2016'
0012 
0013 # ARGUMENT PARSING
0014 
0015 while getopts ":n:" opt; do
0016   case $opt in
0017     n)
0018       echo "Generating $OPTARG events" >&1
0019       events=${OPTARG}
0020       ;;
0021     \?)
0022       echo "Invalid option: -$OPTARG" >&2
0023       exit 1
0024       ;;
0025     :)
0026       echo "Option -$OPTARG requires an argument." >&2
0027       exit 1
0028       ;;
0029   esac
0030 done
0031 
0032 . runMaterialDumpFunctions
0033 
0034 # GEN-SIM goes first
0035 if checkFile SingleMuPt10_pythia8_cfi_GEN_SIM.root ; then
0036   cmsDriver.py SingleMuPt10_pythia8_cfi \
0037 -s GEN,SIM \
0038 --conditions auto:run2_mc \
0039 -n ${events} \
0040 --era Run2_2016 \
0041 --eventcontent FEVTDEBUG \
0042 --datatier GEN-SIM \
0043 --beamspot NoSmear \
0044 --nThreads=4 \
0045 --fileout file:SingleMuPt10_pythia8_cfi_GEN_SIM.root \
0046 --python_filename SingleMuPt10_pythia8_cfi_GEN_SIM.py > SingleMuPt10_pythia8_cfi_GEN_SIM.log 2>&1
0047 
0048     if [ $? -ne 0 ]; then
0049       echo "Error executing the GEN-SIM step, aborting."
0050       exit 1
0051     fi
0052 fi
0053 
0054 # DIGI comes next
0055 
0056 if checkFile SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT.root ; then
0057   cmsDriver.py step2  \
0058 -s DIGI:pdigi_valid,L1,DIGI2RAW,HLT:@relval2016 \
0059 --conditions auto:run2_mc \
0060 -n -1 \
0061 --era Run2_2016 \
0062 --eventcontent FEVTDEBUGHLT \
0063 --datatier GEN-SIM-DIGI-RAW \
0064 --nThreads=4 \
0065 --filein file:SingleMuPt10_pythia8_cfi_GEN_SIM.root  \
0066 --fileout file:SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT.root \
0067 --python_filename SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT.py > SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT.log 2>&1
0068 
0069     if [ $? -ne 0 ]; then
0070       echo "Error executing the DIGI step, aborting."
0071       exit 1
0072     fi
0073 fi
0074 
0075 # Reco and special customization
0076 if checkFile SingleMuPt10_step3_RECO_DQM.root ; then
0077   cmsDriver.py step3  \
0078 -s RAW2DIGI,L1Reco,RECO:reconstruction_trackingOnly,VALIDATION:@trackingOnlyValidation,DQM:@trackingOnlyDQM \
0079 --conditions auto:run2_mc \
0080 -n -1 \
0081 --era Run2_2016 \
0082 --eventcontent RECOSIM,DQM \
0083 --datatier GEN-SIM-RECO,DQMIO \
0084 --nThreads=4 \
0085 --filein file:SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT.root  \
0086 --fileout file:SingleMuPt10_step3_RECO_DQM.root \
0087 --python_filename SingleMuPt10_step2_RECO_DQM.py > SingleMuPt10_step3_RECO_DQM.log 2>&1
0088 
0089     if [ $? -ne 0 ]; then
0090       echo "Error executing the RECO step, aborting."
0091       exit 1
0092     fi
0093 fi
0094 
0095 # HARVESTING
0096 if checkFile DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root ; then
0097   cmsDriver.py step4  \
0098 -s HARVESTING:@trackingOnlyValidation+@trackingOnlyDQM  \
0099 --conditions auto:run2_mc \
0100 -n -1   \
0101 --era Run2_2016  \
0102 --scenario pp  \
0103 --filetype DQM  \
0104 --mc  \
0105 --filein file:SingleMuPt10_step3_RECO_DQM_inDQM.root  \
0106 --python_filename SingleMuPt10_step4_HARVESTING.py > SingleMuPt10_step4_HARVESTING.log 2>&1
0107 
0108     if [ $? -ne 0 ]; then
0109       echo "Error executing the HARVESTING step, aborting."
0110       exit 1
0111     fi
0112 fi
0113 
0114 # Neutrino Particle gun
0115 
0116 if checkFile single_neutrino_random.root ; then
0117   cmsRun ../python/single_neutrino_cfg.py
0118   if [ $? -ne 0 ]; then
0119     echo "Error generating single neutrino gun, aborting."
0120     exit 1
0121   fi
0122   if [ ! -e Images ]; then
0123     mkdir Images
0124   fi
0125 fi
0126 
0127 # Make material map for each subdetector from simulation
0128 
0129 for t in BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do
0130   if [ ! -e matbdg_${t}.root ]; then
0131     python3 runP_Tracker.py geom=${geometry} label=$t >& /dev/null &
0132   fi
0133 done
0134 
0135 waitPendingJobs
0136 
0137 # Always run the comparison at this stage, since you are guaranteed that all the ingredients are there
0138 
0139 for t in BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do
0140   python3 MaterialBudget.py -s -d ${t}
0141   if [ $? -ne 0 ]; then
0142     echo "Error while producing simulation material for ${t}, aborting"
0143     exit 1
0144   fi
0145 done
0146 
0147 if [ ! -e Images ]; then
0148   mkdir Figures
0149 fi
0150 python MaterialBudget.py -c -r DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root -l Run2Detector > MaterialBudget_Simul_vs_Reco_Run2Detector.log 2>&1