Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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