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