Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:55

0001 #!/bin/bash -f
0002 
0003 #CreateIndex ()
0004 #{
0005 #    COUNTER=0
0006 #    LASTUPDATE=`date`
0007 #
0008 #    for Plot in `ls *.png`; do
0009 #        if [[ $COUNTER%2 -eq 0 ]]; then
0010 #            cat >> index_new.html  << EOF
0011 #<TR> <TD align=center> <a href="$Plot"><img src="$Plot"hspace=5 vspace=5 border=0 style="width: 90%" ALT="$Plot"></a> 
0012 #  <br> $Plot </TD>
0013 #EOF
0014 #        else
0015 #            cat >> index_new.html  << EOF
0016 #  <TD align=center> <a href="$Plot"><img src="$Plot"hspace=5 vspace=5 border=0 style="width: 90%" ALT="$Plot"></a> 
0017 #  <br> $Plot </TD> </TR> 
0018 #EOF
0019 #        fi
0020 #
0021 #        let COUNTER++
0022 #    done
0023 #
0024 #    cat /afs/cern.ch/cms/tracker/sistrvalidation/WWW/template_index_foot.html | sed -e "s@insertDate@$LASTUPDATE@g" >> index_new.html
0025 #
0026 #    mv -f index_new.html index.html
0027 #}
0028 
0029 CreateIndex ()
0030 {  
0031     LASTUPDATE=`date`
0032     
0033             cat >> index_new.html  << EOF
0034 <TR> <TD align=center> <a href="SiStripHitEffTKMapBad.png"><img src="SiStripHitEffTKMapBad.png"hspace=5 vspace=5 border=0 style="width: 90%" ALT="SiStripHitEffTKMapBad.png"></a> 
0035   <br> SiStripHitEffTKMapBad.png </TD>
0036 EOF
0037 
0038             cat >> index_new.html  << EOF
0039   <TD align=center> <a href="SiStripHitEffTKMap.png"><img src="SiStripHitEffTKMap.png"hspace=5 vspace=5 border=0 style="width: 90%" ALT="SiStripHitEffTKMap.png"></a> 
0040   <br> SiStripHitEffTKMap.png </TD> </TR> 
0041 EOF
0042 
0043             cat >> index_new.html  << EOF
0044   <TR><TD align=center> <a href="Summary.png"><img src="Summary.png"hspace=5 vspace=5 border=0 style="width: 90%" ALT="Summary.png"></a> 
0045   <br> Summary.png </TD> </TR> 
0046 EOF
0047 
0048     cat /afs/cern.ch/cms/tracker/sistrvalidation/WWW/template_index_foot.html | sed -e "s@insertDate@$LASTUPDATE@g" >> index_new.html
0049 
0050     mv -f index_new.html index.html
0051 }
0052 
0053 if [ $# != 1 ]; then
0054   echo "Usage: $0 CalibTreeFullPath"
0055   echo "Runs the Hit Efficiency Study"
0056   exit 0;
0057 fi
0058 
0059 fullpath=$1
0060 echo "The full file path is $fullpath"
0061 
0062 #Create a macro file to execute to extract the run number
0063 rm -f run_extract.C
0064 echo '{' >> run_extract.C
0065 #echo 'TFile* f = TFile::Open("'rfio:$1'");' >> run_extract.C
0066 echo 'TFile* f = TFile::Open("'rfio:$1'");' >> run_extract.C
0067 echo 'f->cd("anEff");' >> run_extract.C
0068 echo 'CalibTree = (TTree*)(gDirectory->Get("traj"));' >> run_extract.C
0069 echo 'TLeaf* runLf = CalibTree->GetLeaf("run");' >> run_extract.C
0070 echo 'CalibTree->GetEvent(1);' >> run_extract.C
0071 echo 'double runno = (double)runLf->GetValue();' >> run_extract.C
0072 echo 'cout << runno << endl;' >> run_extract.C
0073 echo '}'>> run_extract.C
0074 
0075 root -b -l << EOF >& runnumber1.txt
0076 .x run_extract.C
0077 .q
0078 EOF
0079 
0080 runnumber=`cat runnumber1.txt`
0081 echo "The run number is $runnumber"
0082 
0083 rm -f runnumber1.txt
0084 
0085 cp dbfile_31X_IdealConditions.db dbfile.db
0086 #cp dbfile_31X_IdealConditions.db fakedb.db
0087 
0088 cp SiStripHitEff_template.py "SiStripHitEff_run$runnumber.py"
0089 sed -i "s/newrun/$runnumber/g" "SiStripHitEff_run$runnumber.py"
0090 sed -i "s|newfilelocation|$fullpath|g" "SiStripHitEff_run$runnumber.py"
0091 
0092 #cp Summary_template.py "Summary_run$runnumber.py"
0093 #sed -i "s/newrun/$runnumber/g" "Summary_run$runnumber.py"
0094 #sed -i "s|newfilelocation|$fullpath|g" "Summary_run$runnumber.py"
0095 
0096 cmsRun "SiStripHitEff_run$runnumber.py" >& "run_$runnumber.log" 
0097 #cmsRun "Summary_run$runnumber.py" >& "runSummary_$runnumber.log"
0098 
0099 cat run_$runnumber.log | awk 'BEGIN{doprint=0}{if(match($0,"New IOV")!=0) doprint=1;if(match($0,"%MSG")!=0) {doprint=0;} if(match($0,"Message")!=0) {doprint=0;} if(doprint==1) print $0}' > InefficientModules_$runnumber.txt
0100 cat run_$runnumber.log | awk 'BEGIN{doprint=0}{if(match($0,"occupancy")!=0) doprint=1;if(match($0,"efficiency")!=0) doprint=1; if(match($0,"%MSG")!=0) {doprint=0;} if(match($0,"tempfilename")!=0) {doprint=0;} if(match($0,"New IOV")!=0) {doprint=0;} if(match($0,"generation")!=0) {doprint=0;} if(doprint==1) print $0}' > EfficiencyResults_$runnumber.txt
0101 
0102 #rm run_$runnumber.log
0103 
0104 rm -f run_extract.C
0105 
0106 #Now publish all of the relevant files
0107 #Create the relevant directories on a per run basis
0108 mkdir "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERCALIB/SiStrip/CalibrationValidation/HitEfficiency/run_$runnumber"
0109 mkdir "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber"
0110 mkdir "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/cfg"
0111 mkdir "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/Plots"
0112 mkdir "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/sqlite"
0113 mkdir "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/QualityLog"
0114 
0115 #Move the config file
0116 mv "SiStripHitEff_run$runnumber.py" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/cfg"
0117 #mv "plotHitEffSummary_run$runnumber.C" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/cfg"
0118 
0119 #Move the log files
0120 mv "InefficientModules_$runnumber.txt" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/QualityLog"
0121 mv "EfficiencyResults_$runnumber.txt" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/QualityLog"
0122 
0123 #Move the root file containing hot cold maps
0124 mv "SiStripHitEffHistos_run$runnumber.root" "/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERCALIB/SiStrip/CalibrationValidation/HitEfficiency/run_$runnumber"
0125 
0126 #Generate an index.html file to hold the TKMaps
0127 cat /afs/cern.ch/cms/tracker/sistrvalidation/WWW/template_index_header.html | sed -e "s@insertPageName@Validation Plots --- Hit Efficiency Study --- Tracker Maps@g" > index_new.html
0128 CreateIndex
0129 
0130 mv index.html "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/Plots"
0131 mv "SiStripHitEffTKMapBad.png" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/Plots"
0132 mv "SiStripHitEffTKMap.png" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/Plots"
0133 mv "Summary.png" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/Plots/Summary.png"
0134 
0135 # Create the sqlite- and metadata-files
0136 echo "Preparing the sqlite and metadata files"
0137 
0138 ID1=`uuidgen -t`
0139 cp dbfile.db SiStripHitEffBadModules@${ID1}.db
0140 cat template_SiStripHitEffBadModules.txt | sed -e "s@insertFirstRun@$runnumber@g" -e "s@insertIOV@$runnumber@" > SiStripHitEffBadModules@${ID1}.txt
0141 
0142 mv "SiStripHitEffBadModules@${ID1}.db" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/sqlite"
0143 mv "SiStripHitEffBadModules@${ID1}.txt" "/afs/cern.ch/cms/tracker/sistrvalidation/WWW/CalibrationValidation/HitEfficiency/run_$runnumber/sqlite"