Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:12:03

0001 #!/bin/bash
0002 
0003 date
0004 # needed to allow the loop on *.png without using "*.png" as value
0005 shopt -s nullglob
0006 
0007 if [ $# -ne 2 ]; then
0008     afstokenchecker.sh "You have to provide a <tag-search-string>, a <DB>!!!"
0009     exit
0010 fi
0011 
0012 afstokenchecker.sh "Starting execution of Monitor_GlobalTags_V2 $1 $2"
0013 
0014 #Example: SEARCHSTRING=SiStrip
0015 SEARCHSTRING=$1
0016 #Example: DB=cms_orcoff_prod
0017 DB=$2
0018 DBTAGCOLLECTION=DBTagCollection.txt
0019 GLOBALTAGCOLLECTION=GlobalTags.txt
0020 DBTAGDIR=DBTagCollection
0021 GLOBALTAGDIR=GlobalTags
0022 STORAGEDIR=CondDBMonitoring
0023 STORAGEPATH=/afs/cern.ch/cms/tracker/sistrcalib/WWW/$STORAGEDIR
0024 WORKDIR=$PWD
0025 
0026 # Creation of all needed directories if not existing yet
0027 if [ ! -d "$STORAGEPATH/$DB" ]; then 
0028     afstokenchecker.sh "Creating directory $STORAGEPATH/$DB"
0029     mkdir $STORAGEPATH/$DB;
0030 fi
0031 
0032 if [ ! -d "$STORAGEPATH/$DB/$GLOBALTAGDIR" ]; then 
0033     afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$GLOBALTAGDIR"
0034     mkdir $STORAGEPATH/$DB/$GLOBALTAGDIR; 
0035 fi
0036 
0037 # Access of all Global Tags contained in the given DB account
0038 afstokenchecker.sh "Preparing list of Global Tags"
0039 rm -rf $GLOBALTAGCOLLECTION
0040 conddb --db $DB --nocolors listGTs | grep " GT " | awk '{print $1}' > $GLOBALTAGCOLLECTION
0041 
0042 
0043 # Loop on all Global Tags
0044 for globaltag in `cat $GLOBALTAGCOLLECTION`; do
0045 
0046     afstokenchecker.sh "Processing Global Tag $globaltag";
0047 
0048     if [ -d "$STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag" ]; then
0049 # already known GT: check if the directory is empty otherwise skip it
0050         NOTONLYNOISERATIOS=false
0051         for file in `ls $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag/`; do
0052             if [ $file != "NoiseRatios" ] && [ $file != "RunInfo" ]; then
0053                 NOTONLYNOISERATIOS=true
0054                 continue
0055             fi
0056         done
0057         if [ "$NOTONLYNOISERATIOS" == "true" ]; then
0058             continue
0059         fi
0060         afstokenchecker.sh "Directory $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag contains only NoiseRatios: to be processed";
0061     else
0062         afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag";
0063         mkdir $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag;
0064     fi
0065         
0066     rm -f $DBTAGCOLLECTION
0067     conddb --db $DB --nocolors list $globaltag | grep $SEARCHSTRING > $DBTAGCOLLECTION
0068 
0069     while read tagstring; do
0070 
0071         if [ `echo $tagstring | wc -w` -eq 0 ]; then
0072             continue
0073         fi
0074 
0075         TAG=`echo $tagstring | awk '{print $3}'`
0076         RECORD=`echo $tagstring | awk '{print $1}'`
0077         LABEL=`echo $tagstring | awk '{print $2}'`
0078         OBJECT="ToBeDefined"
0079 #       OBJECT=`echo $tagstring | awk '{print $3}' | sed -e "s@object:@@g"`
0080         ACCOUNT="CMS_CONDITIONS"
0081         TAGSUBDIR="Unknown"
0082 
0083     if      [ `echo $TAG | grep "Noise" | wc -w` -gt 0 ]; then
0084         TAGSUBDIR=SiStripNoise
0085     else if [ `echo $TAG | grep "Pedestal" | wc -w` -gt 0 ]; then
0086         TAGSUBDIR=SiStripPedestal
0087     else if [ `echo $TAG | grep "Gain" | wc -w` -gt 0 ]; then
0088         TAGSUBDIR=SiStripApvGain
0089     else if [ `echo $TAG | grep "Bad" | wc -w` -gt 0 ]; then
0090         TAGSUBDIR=SiStripBadChannel
0091     else if [ `echo $TAG | grep "Cabling" | wc -w` -gt 0 ]; then
0092         TAGSUBDIR=SiStripFedCabling
0093     else if [ `echo $TAG | grep "Lorentz" | wc -w` -gt 0 ]; then
0094         TAGSUBDIR=SiStripLorentzAngle
0095     else if [ `echo $TAG | grep "BackPlane" | wc -w` -gt 0 ]; then
0096         TAGSUBDIR=SiStripBackPlaneCorrection
0097     else if [ `echo $TAG | grep "Threshold" | wc -w` -gt 0 ]; then
0098         TAGSUBDIR=SiStripThreshold
0099     else if [ `echo $TAG | grep "VOff" | wc -w` -gt 0 ]; then
0100         TAGSUBDIR=SiStripVoltage
0101     else if [ `echo $TAG | grep "Latency" | wc -w` -gt 0 ]; then
0102         TAGSUBDIR=SiStripLatency
0103     else if [ `echo $TAG | grep "Shift" | wc -w` -gt 0 ]; then
0104         TAGSUBDIR=SiStripShiftAndCrosstalk
0105     else if [ `echo $TAG | grep "APVPhaseOffsets" | wc -w` -gt 0 ]; then
0106         TAGSUBDIR=SiStripAPVPhaseOffsets
0107     else if [ `echo $TAG | grep "AlCaRecoTriggerBits" | wc -w` -gt 0 ]; then
0108         TAGSUBDIR=SiStripDQM
0109     else
0110         TAGSUBDIR=Unknown
0111         afstokenchecker.sh "Unknown tag type $TAG: skipped";
0112         continue
0113     fi
0114     fi
0115     fi
0116     fi
0117     fi
0118     fi
0119     fi
0120     fi
0121     fi
0122     fi
0123     fi
0124     fi
0125     fi
0126 #       echo "$tagstring";
0127 #       echo "$TAG $RECORD $OBJECT $ACCOUNT $TAGSUBDIR";
0128 
0129         # Creation of links between the DB-Tag and the respective Global Tags
0130         if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG" ]; then
0131             afstokenchecker.sh "Tag $TAG is unknown: skipped";
0132             echo "$tagstring";
0133             continue
0134         fi
0135         if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG/RelatedGlobalTags" ]; then
0136             afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG/RelatedGlobalTags";
0137             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG/RelatedGlobalTags;
0138         fi
0139         if [ ! -f $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag/$TAG ] || [ ! -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG/RelatedGlobalTags/$globaltag ]; then
0140             afstokenchecker.sh "Creating a link between $globaltag and $TAG";
0141 
0142             cd $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag;
0143             
0144             RECORDANDOBJECTNAME="Record name: $RECORD Label name: $LABEL Object Name: $OBJECT"
0145             echo $RECORDANDOBJECTNAME 
0146             
0147             rm -f $TAG; 
0148             cat >> $TAG << EOF
0149 <html>
0150 <body>
0151 <a href="https://test-stripdbmonitor.web.cern.ch/test-stripdbmonitor/$STORAGEDIR/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG">https://test-stripdbmonitor.web.cern.ch/test-stripdbmonitor/$STORAGEDIR/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG</a>
0152 <br />
0153 $RECORDANDOBJECTNAME
0154 </body>
0155 </html>
0156 EOF
0157             
0158             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$TAG/RelatedGlobalTags;
0159             
0160             rm -f $globaltag;
0161             cat >> $globaltag << EOF
0162 <html>
0163 <body>
0164 <a href="https://test-stripdbmonitor.web.cern.ch/test-stripdbmonitor/$STORAGEDIR/$DB/$GLOBALTAGDIR/$globaltag">https://test-stripdbmonitor.web.cern.ch/test-stripdbmonitor/$STORAGEDIR/$DB/$GLOBALTAGDIR/$globaltag</a>
0165 </body>
0166 </html>
0167 EOF
0168         fi
0169         
0170         cd $WORKDIR;
0171         
0172     done < $DBTAGCOLLECTION;
0173     
0174     
0175 done;