Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:31:46

0001 #!/bin/bash
0002 
0003 #nsls /castor/cern.ch/cms/emuslice/2006/ > Runs.txt 
0004 ls /tmp/csccalib > Runs.txt
0005 grep -e Saturation Runs.txt > AllSaturationRuns.txt 
0006 grep -e "RUI" AllSaturationRuns.txt > GoodSaturationRuns.txt
0007 grep -e "RUI" AllSaturationRuns.txt > GoodSaturationRunsDummy.txt
0008 
0009 #Runs and RunsDummy begin as copies. while runs stays open, 
0010 #the lines from RunsDummy are removed as they are processed. 
0011 #grep -e "csc_00000508*" GoodSaturationRuns_.txt > GoodSaturationRuns.txt
0012 #grep -e "csc_00000508*" GoodSaturationRuns_.txt > GoodSaturationRunsDummy.txt
0013 
0014 echo " ";
0015 echo "will process runs: ";
0016 cat GoodSaturationRuns.txt;
0017 echo " ";
0018 
0019 #loop over ALL runs that you have grepped for. 
0020 cat GoodSaturationRuns.txt | while read line  
0021 do 
0022    #put into tempFile.txt all files from the same run. 
0023    grep -e "${line:9:4}" GoodSaturationRunsDummy.txt > tempFile.txt;
0024    #these two variables and if statment ensure that the next loop will
0025    #only run for a non-zero file size, i.e. if there are runs in tempFile.txt
0026    FILESIZE=$(stat -c%s tempFile.txt);
0027    MINSIZE=1
0028    if [ $FILESIZE -gt $MINSIZE ]; then
0029        #loop over all runs in tempFile.txt
0030 #       cat tempFile.txt | while read line
0031 #       do
0032          #rfcp each file in tempFile.txt
0033          #echo "copying $line from castor";
0034          #rfcp "/castor/cern.ch/cms/emuslice/2006/$line" "/tmp/csccalib/$line";
0035          #echo "copied $line from castor";
0036  #      done
0037        #Create a .cfg file, based on tempFile.txt. it will output CSCsaturation.cfg, which
0038        #will put all files from tempFile.txt in the .cfg for input to cmsRun. 
0039        #this will also rewrite GoodSaturationRunsDummy.txt to exclude the runs found in tempFile.txt,
0040        #which exlcudes multiple processing
0041        echo "creating config with perl";
0042        perl ConfigChanges.pl "/tmp/csccalib/$line";
0043        perl CreateConfigSaturation.pl; 
0044        echo "perl done, starting job";
0045        #run the cms job
0046        cmsRun CSCsaturation.cfg;
0047        #execute the root macro 
0048        #root saturationMacro.C
0049        #clean out the /tmp/csccalib directory 
0050        #rm /tmp/csccalib/csc* 
0051    else  
0052        echo "**** tempFile is empty  ****";
0053    fi 
0054 
0055 done  
0056 
0057 rm Runs.txt
0058 rm AllSaturationRuns.txt 
0059 rm GoodSaturationRuns.txt
0060 rm GoodSaturationRunsDummy.txt
0061 rm tempFile.txt
0062 
0063 #cd /afs/cern.ch/cms/CSC/html/csccalib
0064 #perl CreateTree_Items.pl 
0065 #cd -