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 <DB>, an <Account>, a <GTAccount> and the <FrontierPath> !!!"
0009 exit
0010 fi
0011
0012 afstokenchecker.sh "Starting execution of Monitor_NoiseRatios $1 $2 $3 $4"
0013
0014
0015 DB=$1
0016
0017 ACCOUNT=$2
0018
0019 GTACCOUNT=$3
0020
0021 FRONTIER=$4
0022 DBTAGCOLLECTION=DBTagsIn_${DB}_${ACCOUNT}.txt
0023 GLOBALTAGCOLLECTION=GlobalTagsForDBAccount.txt
0024 DBTAGDIR=DBTagCollection
0025 GLOBALTAGDIR=GlobalTags
0026 STORAGEPATH=/afs/cern.ch/cms/tracker/sistrcalib/WWW/CondDBMonitoring
0027 WORKDIR=$PWD
0028
0029
0030 CreateIndex ()
0031 {
0032 cp /afs/cern.ch/cms/tracker/sistrcalib/WWW/index_new.html .
0033
0034 COUNTER=0
0035 LASTUPDATE=`date`
0036
0037 for Plot in *.png; do
0038 if [[ $COUNTER%2 -eq 0 ]]; then
0039 cat >> index_new.html << EOF
0040 <TR> <TD align=center> <a href="$Plot"><img src="$Plot"hspace=5 vspace=5 border=0 style="width: 90%" ALT="$Plot"></a>
0041 <br> $Plot </TD>
0042 EOF
0043 else
0044 cat >> index_new.html << EOF
0045 <TD align=center> <a href="$Plot"><img src="$Plot"hspace=5 vspace=5 border=0 style="width: 90%" ALT="$Plot"></a>
0046 <br> $Plot </TD> </TR>
0047 EOF
0048 fi
0049
0050 let COUNTER++
0051 done
0052
0053 cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_foot.html | sed -e "s@insertDate@$LASTUPDATE@g" >> index_new.html
0054
0055 mv -f index_new.html index.html
0056 }
0057
0058
0059 if [ ! -d "$STORAGEPATH/$DB" ]; then
0060 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB"
0061 mkdir $STORAGEPATH/$DB;
0062 fi
0063
0064 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT" ]; then
0065 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT"
0066 mkdir $STORAGEPATH/$DB/$ACCOUNT;
0067 fi
0068
0069 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR" ]; then
0070 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR"
0071 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR;
0072 fi
0073
0074
0075
0076 declare -a checkedtags;
0077
0078
0079 cmscond_tagtree_list -c frontier://cmsfrontier.cern.ch:8000/$FRONTIER/$GTACCOUNT -P /afs/cern.ch/cms/DB/conddb | grep tree | awk '{print $2}' > $GLOBALTAGCOLLECTION
0080
0081 TAGSUBDIR=SiStripNoise
0082
0083
0084 for globaltag in `cat $GLOBALTAGCOLLECTION`; do
0085
0086 afstokenchecker.sh "Processing Global Tag $globaltag";
0087
0088 NEWTAG=False
0089 NEWIOV=False
0090 CFGISSAVED=False
0091 LOGDESTINATION=cout
0092
0093 NOISETAGANDOBJECT=`cmscond_tagtree_list -c frontier://cmsfrontier.cern.ch:8000/$FRONTIER/$GTACCOUNT -P /afs/cern.ch/cms/DB/conddb -T $globaltag | grep SiStripNoise | grep $ACCOUNT | awk '{printf "%s %s",$3,$5}'`
0094
0095 if [ `echo $NOISETAGANDOBJECT | wc -w` -eq 0 ]; then
0096 continue
0097 fi
0098
0099 NOISETAG=`echo $NOISETAGANDOBJECT | awk '{print $1}' | sed -e "s@tag:@@g"`
0100 NOISEOBJECT=`echo $NOISETAGANDOBJECT | awk '{print $2}' | sed -e "s@object:@@g"`
0101
0102 if [ `echo $NOISETAG | grep Ideal | wc -w` -gt 0 ]; then
0103 continue
0104 fi
0105
0106
0107 GAINTAGANDOBJECT=`cmscond_tagtree_list -c frontier://cmsfrontier.cern.ch:8000/$FRONTIER/$GTACCOUNT -P /afs/cern.ch/cms/DB/conddb -T $globaltag | grep "record:SiStripApvGainRcd" | grep $ACCOUNT | awk '{printf "%s %s",$3,$5}'`
0108
0109 if [ `echo $GAINTAGANDOBJECT | wc -w` -eq 0 ]; then
0110 continue
0111 fi
0112
0113 GAINTAG=`echo $GAINTAGANDOBJECT | awk '{print $1}' | sed -e "s@tag:@@g"`
0114 GAINOBJECT=`echo $GAINTAGANDOBJECT | awk '{print $2}' | sed -e "s@object:@@g"`
0115
0116 tag=${NOISETAG}_${GAINTAG}
0117
0118 if [ `expr index "$tag" " "` -ne 0 ]; then
0119 afstokenchecker.sh "WARNING!! $tag has blank spaces"
0120 fi
0121
0122
0123
0124 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR" ]; then
0125 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR"
0126 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR;
0127 fi
0128
0129 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios" ]; then
0130 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios"
0131 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios;
0132 fi
0133
0134 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag" ]; then
0135 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag"
0136 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag;
0137
0138 NEWTAG=True
0139 fi
0140
0141 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/RelatedGlobalTags" ]; then
0142 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/RelatedGlobalTags"
0143 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/RelatedGlobalTags;
0144 fi
0145
0146
0147 if [ ! -d "$STORAGEPATH/$DB/$GLOBALTAGDIR" ]; then
0148 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$GLOBALTAGDIR"
0149 mkdir $STORAGEPATH/$DB/$GLOBALTAGDIR;
0150 fi
0151
0152 if [ ! -d "$STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag" ]; then
0153 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag"
0154 mkdir $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag;
0155 fi
0156
0157 if [ ! -d "$STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag/NoiseRatios" ]; then
0158 afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag/NoiseRatios"
0159 mkdir $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag/NoiseRatios;
0160 fi
0161
0162
0163 if [ ! -f $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag/NoiseRatios/$tag ] || [ ! -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/RelatedGlobalTags/$globaltag ]; then
0164 cd $STORAGEPATH/$DB/$GLOBALTAGDIR/$globaltag/NoiseRatios;
0165 rm -f $tag;
0166 cat >> $tag << EOF
0167 <html>
0168 <body>
0169 <a href="https://test-stripdbmonitor.web.cern.ch/test-stripdbmonitor/CondDBMonitoring/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag">https://test-stripdbmonitor.web.cern.ch/test-stripdbmonitor/CondDBMonitoring/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag</a>
0170 </body>
0171 </html>
0172 EOF
0173
0174 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/RelatedGlobalTags;
0175 rm -f $globaltag;
0176 cat >> $globaltag << EOF
0177 <html>
0178 <body>
0179 <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>
0180 </body>
0181 </html>
0182 EOF
0183
0184 fi
0185
0186 cd $WORKDIR;
0187
0188
0189
0190 ALREADYCHECKED=0;
0191
0192 for checkedtag in ${checkedtags[*]}; do
0193 if [ $checkedtag == $tag ]; then
0194 ALREADYCHECKED=1
0195 fi
0196 done
0197
0198 if [ $ALREADYCHECKED -eq 1 ]; then
0199 date "+[%c] Tags $tag already checked: skip"
0200 continue
0201 fi
0202
0203 checkedtags[${
0204
0205
0206 iov_list_tag.py -c frontier://cmsfrontier.cern.ch:8000/$FRONTIER/$ACCOUNT -P /afs/cern.ch/cms/DB/conddb -t $NOISETAG > list_Iov.txt
0207
0208
0209 afstokenchecker.sh "Now the values of $tag are retrieved from the DB..."
0210
0211 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/rootfiles" ]; then
0212 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/rootfiles;
0213 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/cfg;
0214 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/plots;
0215 fi
0216
0217
0218
0219
0220
0221
0222 for OldPlot in *.png; do
0223 rm $OldPlot;
0224 done;
0225
0226
0227 for IOV_number in `cat list_Iov.txt`; do
0228
0229 if [ $IOV_number -eq 1 ]; then
0230 FirstRun=$IOV_number
0231 continue
0232 fi
0233
0234 SecondRun=$IOV_number
0235
0236 ROOTFILE="${tag}_Run_${IOV_number}.root"
0237
0238 if [ -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/rootfiles/$ROOTFILE ]; then
0239 FirstRun=$IOV_number
0240 continue
0241 fi
0242
0243 afstokenchecker.sh "New IOV $IOV_number found. Being processed..."
0244
0245 NEWIOV=True
0246
0247 afstokenchecker.sh "Executing cmsRun. Stay tuned ..."
0248
0249 CMSRUNCOMMAND="cmsRun ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/test/SiStripCorrelateNoise_conddbmonitoring_cfg.py print connectionString=frontier://$FRONTIER/$ACCOUNT noiseTagName=$NOISETAG gainTagName=$GAINTAG firstRunNumber=$FirstRun secondRunNumber=$SecondRun"
0250 $CMSRUNCOMMAND
0251
0252 FirstRun=$IOV_number
0253
0254 afstokenchecker.sh "cmsRun finished. Now moving the files to the corresponding directories ..."
0255
0256
0257 cp ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/test/SiStripCorrelateNoise_conddbmonitoring_cfg.py SiStripCorrelateNoise_cfg.py
0258 cat >> SiStripCorrelateNoise_cfg.py <<EOF
0259
0260
0261
0262 EOF
0263 mv SiStripCorrelateNoise_cfg.py $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/cfg/${tag}_cfg.py
0264 CFGISSAVED=True
0265
0266
0267 mv correlTest.root $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/rootfiles/$ROOTFILE;
0268
0269 rm out.log
0270
0271 for Plot in *.png; do
0272 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/plots;
0273 done;
0274
0275
0276
0277
0278 done;
0279
0280
0281 if [ "$NEWTAG" = "True" ] || [ "$NEWIOV" = "True" ]; then
0282
0283 afstokenchecker.sh "Publishing the new tag $tag (or the new IOV) on the web ..."
0284
0285 cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0286 cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@Noise Ratios for $NOISETAG and $GAINTAG@g" > index_new.html
0287
0288 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/NoiseRatios/$tag/plots;
0289 CreateIndex
0290
0291 fi
0292
0293 cd $WORKDIR;
0294
0295 done;