Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-10 22:50:01

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=Extended2017Plan1
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_PhaseI.root ; then
0036 cmsDriver.py SingleMuPt10_pythia8_cfi \
0037 -s GEN,SIM \
0038 --conditions auto:phase1_2017_realistic \
0039 -n ${events} \
0040 --era Run2_2017 \
0041 --eventcontent FEVTDEBUG \
0042 --datatier GEN-SIM \
0043 --geometry ${geometry}  \
0044 --beamspot NoSmear \
0045 --customise Validation/Geometry/customiseForDumpMaterialAnalyser_ForPhaseI.customiseForMaterialAnalyser_ForPhaseI \
0046 --fileout file:SingleMuPt10_pythia8_cfi_GEN_SIM_PhaseI.root \
0047 --python_filename SingleMuPt10_pythia8_cfi_GEN_SIM_PhaseI.py > SingleMuPt10_pythia8_cfi_GEN_SIM_PhaseI.log 2>&1
0048 
0049     if [ $? -ne 0 ]; then
0050       echo "Error executing the GEN-SIM step, aborting."
0051       exit 1
0052     fi
0053 fi
0054 
0055 # DIGI comes next
0056 
0057 if checkFile SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT_PhaseI.root ; then
0058   cmsDriver.py step2  \
0059 -s DIGI:pdigi_valid,L1,DIGI2RAW,HLT:@relval2017 \
0060 --conditions auto:phase1_2017_realistic \
0061 -n -1 \
0062 --era Run2_2017 \
0063 --eventcontent FEVTDEBUGHLT \
0064 --datatier GEN-SIM-DIGI-RAW \
0065 --geometry ${geometry} \
0066 --nThreads 6 \
0067 --filein file:SingleMuPt10_pythia8_cfi_GEN_SIM_PhaseI.root  \
0068 --fileout file:SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT_PhaseI.root \
0069 --python_filename SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT_PhaseI.py > SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT_PhaseI.log 2>&1
0070 
0071     if [ $? -ne 0 ]; then
0072       echo "Error executing the DIGI step, aborting."
0073       exit 1
0074     fi
0075 fi
0076 
0077 # Reco and special customization
0078 
0079 if checkFile SingleMuPt10_step3_RECO_DQM_PhaseI.root ; then
0080   cmsDriver.py step3  \
0081 -s RAW2DIGI,L1Reco,RECO:reconstruction_trackingOnly,VALIDATION:@trackingOnlyValidation,DQM:@trackingOnlyDQM \
0082 --conditions auto:phase1_2017_realistic \
0083 -n -1 \
0084 --era Run2_2017 \
0085 --eventcontent RECOSIM,DQM \
0086 --datatier GEN-SIM-RECO,DQMIO \
0087 --geometry ${geometry} \
0088 --nThreads 6 \
0089 --filein file:SingleMuPt10_step2_DIGI_L1_DIGI2RAW_HLT_PhaseI.root  \
0090 --fileout file:SingleMuPt10_step3_RECO_DQM_PhaseI.root \
0091 --python_filename SingleMuPt10_step2_RECO_DQM_PhaseI.py  > SingleMuPt10_step3_RECO_DQM_PhaseI.log 2>&1
0092 
0093     if [ $? -ne 0 ]; then
0094       echo "Error executing the RECO step, aborting."
0095       exit 1
0096     fi
0097 fi
0098 
0099 # HARVESTING
0100 
0101 if checkFile DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root ; then
0102   cmsDriver.py step4  \
0103 -s HARVESTING:@trackingOnlyValidation+@trackingOnlyDQM  \
0104 --conditions auto:phase1_2017_realistic \
0105 -n -1   \
0106 --era Run2_2017  \
0107 --scenario pp  \
0108 --filetype DQM  \
0109 --geometry ${geometry} \
0110 --mc  \
0111 --filein file:SingleMuPt10_step3_RECO_DQM_PhaseI_inDQM.root  \
0112 --python_filename SingleMuPt10_step4_HARVESTING_PhaseI.py > SingleMuPt10_step4_HARVESTING_PhaseI.log 2>&1
0113 
0114     if [ $? -ne 0 ]; then
0115       echo "Error executing the HARVESTING step, aborting."
0116       exit 1
0117     fi
0118 fi
0119 
0120 # Neutrino Particle gun
0121 
0122 if checkFile single_neutrino_random.root ; then
0123   cmsRun ../python/single_neutrino_cfg.py
0124   if [ $? -ne 0 ]; then
0125     echo "Error generating single neutrino gun, aborting."
0126     exit 1
0127   fi
0128   if [ ! -e Images ]; then
0129     mkdir Images
0130   fi
0131 fi
0132 
0133 # Make material map for each subdetector from simulation
0134 
0135 for t in BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do
0136   if [ ! -e matbdg_${t}.root ]; then
0137     python3 runP_Tracker.py geom=${geometry} label=$t >& /dev/null &
0138   fi
0139 done
0140 
0141 waitPendingJobs
0142 
0143 # Always run the comparison at this stage, since you are guaranteed that all the ingredients are there
0144 
0145 for t in TrackerSum Pixel Strip InnerTracker BeamPipe Tracker PixBar PixFwdMinus PixFwdPlus TIB TOB TIDB TIDF TEC TkStrct InnerServices; do
0146   python3 MaterialBudget.py -s -d ${t}
0147   if [ $? -ne 0 ]; then
0148     echo "Error while producing simulation material for ${t}, aborting"
0149     exit 1
0150   fi
0151 done
0152 
0153 python MaterialBudget.py -c -r DQM_V0001_R000000001__Global__CMSSW_X_Y_Z__RECO.root -l PhaseIDetector > MaterialBudget_Simul_vs_Reco_PhaseIDetector.log 2>&1