Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:26:41

0001 #!/bin/sh
0002 
0003 castorhome="/castor/cern.ch/user/p/pjanot/CMSSW160pre5/"
0004 
0005 # for energy in 1 2 3 4 5 7 9 12 15 20 30 50 100 200 300 500 700 1000
0006 for energy in 30 50 100 200
0007   do
0008   echo "Energy "$energy
0009   
0010   for pid in 211 -211 130 321 -321 2212 -2212 2112 -2112
0011     do
0012 #    echo "PID "$pid
0013     
0014     case $energy in
0015         1)
0016             maxnu=300000
0017             totev=300000
0018             ;;
0019         2)
0020             maxnu=300000
0021             totev=300000
0022             ;;
0023         3)
0024             maxnu=300000
0025             totev=300000
0026             ;;
0027         4)
0028             maxnu=300000
0029             totev=300000
0030             ;;
0031         5)
0032             maxnu=300000
0033             totev=300000
0034             ;;
0035         7)
0036             maxnu=300000
0037             totev=300000
0038             ;;
0039         9)
0040             maxnu=300000
0041             totev=300000
0042             ;;
0043         12)
0044             maxnu=200000
0045             totev=300000
0046             ;;
0047         15)
0048             maxnu=150000
0049             totev=300000
0050             ;;
0051         20)
0052             maxnu=150000
0053             totev=300000
0054             ;;
0055         30)
0056             maxnu=150000
0057             totev=150000
0058             ;;
0059         50)
0060             maxnu=100000
0061             totev=150000
0062             ;;
0063         100)
0064             maxnu=50000
0065             totev=150000
0066             ;;
0067         200)
0068             maxnu=25000
0069             totev=150000
0070             ;;
0071         300)
0072             maxnu=10000
0073             totev=150000
0074             ;;
0075         500)
0076             maxnu=10000
0077             totev=150000
0078             ;;
0079         700)
0080             maxnu=10000
0081             totev=150000
0082             ;;
0083         1000)
0084             maxnu=10000
0085             totev=150000
0086             ;;
0087         *)
0088             maxnu=0
0089             totev=0
0090             ;;
0091     esac
0092 
0093     case $pid in
0094         211)
0095             maxnu=$(( maxnu*1 ))
0096             part="piplus"
0097             ;;
0098         -211)
0099             maxnu=$(( maxnu*1 ))
0100             part="piminus"
0101             ;;
0102         130)
0103             maxnu=$(( maxnu/4 ))
0104             part="K0L"
0105             ;;
0106         321)
0107             maxnu=$(( maxnu/5 ))
0108             part="Kplus"
0109             ;;
0110         -321) 
0111             maxnu=$(( maxnu/5 ))
0112             part="Kminus"
0113             ;;
0114         2212) 
0115             maxnu=$(( maxnu*15 /100 ))
0116             part="p"
0117             ;;
0118         -2212)
0119             maxnu=$(( maxnu*15 /100 ))
0120             part="pbar"
0121             ;;
0122         2112)
0123             maxnu=$(( maxnu*15 /100 ))
0124             part="n"
0125             ;;
0126         -2112)
0127             maxnu=$(( maxnu*15 /100 ))
0128             part="nbar"
0129             ;;
0130         *)
0131             maxnu=$(( maxnu*0 ))
0132             ;;
0133     esac
0134 
0135     if (( maxnu < 10000 )); then
0136         maxnu=10000
0137     fi
0138 
0139     if (( energy == 1 )); then
0140         if (( pid == 2212 || pid == -2212 || pid == 2112 || pid == -2112 )); then
0141             ene="1.4"
0142         else
0143             ene=$energy
0144         fi
0145     else
0146         ene=$energy
0147     fi
0148 
0149     DIRNAME=$castorhome"SingleParticlePID"$pid"-E"$energy
0150     NAME="SingleParticlePID"$pid"-E"$ene
0151     
0152 #    echo "Name "$NAME
0153     inputfilename=$NAME
0154 #    echo $inputfilename        
0155 
0156     File1=$DIRNAME"/"$NAME"_0.root"
0157     File2=$DIRNAME"/"$NAME"_1.root"
0158     File3=$DIRNAME"/"$NAME"_2.root"
0159     File4=$DIRNAME"/"$NAME"_3.root"
0160     File5=$DIRNAME"/"$NAME"_4.root"
0161 
0162 #    echo "File1 "$File1
0163 #    echo "File2 "$File2
0164 #    echo "File3 "$File3
0165 #    echo "File4 "$File4
0166 #    echo "File5 "$File5
0167     
0168     nufile="NuclearInteractions_"$part"_E"$energy".root"
0169     rootfile=$part"_E"$energy".root"
0170     txtfile=$part"_E"$energy".txt"
0171 
0172 #    echo "MAXNU" $maxnu
0173     
0174  
0175     sed -e "s/==INPUTFILE==/$inputfilename/" -e "s/==TOTEV==/$totev/" -e "s/==MAXNU==/$maxnu/" -e "s/==NUFILE==/$nufile/" -e "s/==ROOTFILE==/$rootfile/" NITemplate_cfg.py > tmp_pyfile
0176 #    
0177 #Start to write the script
0178     cat > job_${NAME}.sh << EOF
0179 #!/bin/sh
0180 scramv1 project CMSSW CMSSW_1_6_0_pre6
0181 cd CMSSW_1_6_0_pre6
0182 cd src/
0183 mkdir FastSimulation
0184 cd FastSimulation
0185 mkdir MaterialEffects
0186 cd MaterialEffects
0187 mkdir test
0188 cd test
0189 cp /afs/cern.ch/user/p/pjanot/scratch0/CMSSW_1_6_0_pre6/src/FastSimulation/MaterialEffects/test/*.cc . 
0190 cp /afs/cern.ch/user/p/pjanot/scratch0/CMSSW_1_6_0_pre6/src/FastSimulation/MaterialEffects/test/BuildFile . 
0191 cd ../../
0192 cp -r /afs/cern.ch/user/p/pjanot/scratch0/CMSSW_1_6_0_pre6/src/FastSimulation/EventProducer .
0193 cd ..
0194 scramv1 b -j 4
0195 eval \`scramv1 runtime -sh\`
0196 rfcp $File1 .
0197 rfcp $File2 .
0198 rfcp $File3 .
0199 rfcp $File4 .
0200 rfcp $File5 .
0201 #
0202 #commande pour decoder le .py
0203 cat > Rereco_cfg.py << "EOF"
0204 EOF
0205     
0206 #Ajoute le .py au script
0207 cat tmp_pyfile >> job_${NAME}.sh
0208 #
0209 # On poursuit le script
0210 echo "EOF" >> job_${NAME}.sh
0211 cat >> job_${NAME}.sh << EOF
0212 cmsRun Rereco_cfg.py > $txtfile
0213 
0214 rfcp $nufile $DIRNAME/$nufile
0215 rfcp $rootfile $DIRNAME/$rootfile
0216 cp $nufile /afs/cern.ch/cms/data/CMSSW/FastSimulation/MaterialEffects/data/$nufile
0217 cp $rootfile /afs/cern.ch/cms/data/CMSSW/FastSimulation/MaterialEffects/data/$rootfile
0218 cp $txtfile /afs/cern.ch/cms/data/CMSSW/FastSimulation/MaterialEffects/data/$txtfile
0219 rm *.root
0220 rm *.txt
0221 
0222 EOF
0223 chmod 755 job_${NAME}.sh
0224 bsub -q 1nh -J $NAME $PWD/job_${NAME}.sh
0225 #
0226     
0227   done
0228 done