File indexing completed on 2024-04-06 12:13:16
0001
0002
0003
0004
0005
0006
0007
0008 ARCHITECTURE=$SCRAM_ARCH
0009 ALPGEN_PATH=$CMS_PATH/sw/$ARCHITECTURE/external/alpgen/213-cms
0010 ALPGEN_BIN_PATH=$ALPGEN_PATH/bin
0011
0012
0013 echo "++++++++++++++++++++"
0014 echo "+ ALPGEN INTERFACE +"
0015 echo "++++++++++++++++++++"
0016 echo ""
0017 echo "Starting basic sanity checks for Alpgen in CMSSW"
0018 echo ""
0019
0020 echo "The Alpgen executables should be found in $ALPGEN_BIN_PATH"
0021 echo "Available executables in $ALPGEN_BIN_PATH:"
0022 ls $ALPGEN_BIN_PATH
0023 echo ""
0024
0025
0026 if ls input.skel &> /dev/null
0027 then \rm input.skel
0028 fi
0029 touch input.skel
0030
0031
0032
0033
0034 create_input_file ()
0035 {
0036
0037 INPUTFILENAME=$LABEL.input
0038 STDOUTFILENAME=$LABEL.stdout
0039 if [[ "$ICKKW" -eq 1 ]]
0040 then
0041 MATCHINGPYTHON=True
0042 else
0043 MATCHINGPYTHON=False
0044 fi
0045 ETCLUS=$(bc <<CalculationLimitString
0046 scale = 4
0047 var1=$ETMIN+5.0
0048 var2=1.2*$ETMIN
0049 if(var1 > var2) var1
0050 if(var1 <= var2) var2
0051 CalculationLimitString
0052 )
0053
0054
0055 cat > input.skel <<EOF
0056 $IMODE ! imode
0057 $LABEL ! label for files
0058 0 ! start with: 0=new grid, 1=previous warmup grid, 2=previous generation grid
0059 10000 2 ! Nevents/iteration, N(warm-up iterations)
0060 100000 ! Nevents generated after warm-up
0061 *** The above 5 lines provide mandatory inputs for all processes
0062 *** (Comment lines are introduced by the three asteriscs)
0063 *** The lines below modify existing defaults for the hard process under study
0064 *** For a complete list of accessible parameters and their values,
0065 *** input 'print 1' (to display on the screen) or 'print 2' to write to file
0066 ih2 $IH2 ! nature of collisions: pp (1) or ppbar (-1)
0067 ebeam $ENERGY ! beam energy in GeV
0068 ickkw $ICKKW ! matching on (1) or off (0)
0069 etajmax 5 ! full rap range for jets
0070 njets $NJETS ! total number of jets
0071 ptjmin $ETMIN ! ptmin for jets
0072 drjmin $DRMIN ! minimum separation for jets
0073 EOF
0074 mv input.skel $INPUTFILENAME
0075 }
0076
0077
0078 run_test()
0079 {
0080
0081 IMODE=1
0082 create_input_file
0083
0084 echo "Testing: $ALPGEN_BIN_PATH/$ALPGEN_EXECUTABLE < $INPUTFILENAME (imode 1)..."
0085 $ALPGEN_BIN_PATH/$ALPGEN_EXECUTABLE < $INPUTFILENAME > $STDOUTFILENAME
0086
0087
0088 IMODE=2
0089 create_input_file
0090 echo "Testing: $ALPGEN_BIN_PATH/$ALPGEN_EXECUTABLE < $INPUTFILENAME (imode 2)..."
0091 echo "++++++++++" >> $STDOUTFILENAME
0092 $ALPGEN_BIN_PATH/$ALPGEN_EXECUTABLE < $INPUTFILENAME >> $STDOUTFILENAME
0093
0094
0095 cat test_TEMPLATE_cfg.py | sed "s/FILENAME/$LABEL/" | sed "s/MATCHING/$MATCHINGPYTHON/" \
0096 | sed "s/EXCLUSIVE/$EXCLUSIVE/" | sed "s/ETMIN/$ETCLUS/" | sed "s/DRMIN/$DRMIN/" > test_cfg.py
0097
0098 echo "Testing: cmsRun test_cfg.py (running both AlpgenSource and AlpgenProducer)..."
0099 cmsRun test_cfg.py > cmsRun.stdout 2> cmsRun.stderr
0100 }
0101
0102
0103 display_test_results()
0104 {
0105
0106 echo -e "\nINPUT FILE: $INPUTFILENAME"
0107 cat $INPUTFILENAME
0108
0109 if [[ "$IH2" -eq 1 ]]
0110 then BEAMCONTENT="proton proton"
0111 elif [[ "$IH2" -eq -1 ]]
0112 then BEAMCONTENT="proton antiproton"
0113 else BEAMCONTENT="unkwown"
0114 fi
0115 echo -e "\nBeam content given as input: $BEAMCONTENT"
0116 echo "Beam content seem by CMSSW: "
0117 grep "PYTHIA will be initialized" cmsRun.stdout
0118
0119 echo -e "\nBeam energy given as input: $ENERGY GeV"
0120 echo -n "Beam energy seem by CMSSW: "
0121 grep energies cmsRun.stdout | awk '{print $3,$4}'
0122
0123 echo -e "\nJet parameters for matching"
0124 echo "Given as input: EXCLUSIVE = $EXCLUSIVE"
0125 echo " ETCLUS = $ETCLUS"
0126 echo " DRMIN = $DRMIN"
0127 echo "Seen by CMSSW:"
0128 grep IEXC cmsRun.stdout
0129 grep ETACLUS cmsRun.stdout
0130 echo "===================="
0131 echo
0132 }
0133
0134
0135
0136
0137 ALPGEN_EXECUTABLE=wjetgen
0138 LABEL=w1j
0139 IH2=-1
0140 ENERGY=980.0
0141 ICKKW=1
0142 NJETS=1
0143 ETMIN=20.0
0144 DRMIN=0.7
0145 EXCLUSIVE=True
0146
0147 run_test
0148 display_test_results
0149
0150
0151
0152 ALPGEN_EXECUTABLE=zjetgen
0153 LABEL=z0j
0154 IH2=1
0155 ENERGY=7000.0
0156 ICKKW=0
0157 NJETS=0
0158 ETMIN=20.0
0159 DRMIN=0.7
0160 EXCLUSIVE=False
0161 run_test
0162 display_test_results
0163
0164
0165 ALPGEN_EXECUTABLE=2Qgen
0166 LABEL=bbbar1j
0167 IH2=1
0168 ENERGY=5000.0
0169 ICKKW=1
0170 NJETS=1
0171 ETMIN=40.0
0172 DRMIN=0.7
0173 EXCLUSIVE=True
0174 run_test
0175 display_test_results