Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:08:54

0001 #!/bin/bash
0002 
0003 # needed to allow the loop on *.png without using "*.png" as value
0004 shopt -s nullglob
0005 date
0006 
0007 if [ $# -ne 5 ]; then
0008     afstokenchecker.sh "You have to provide a <tag_search_string>, a <DB>, an <Account>, a <GTAccount> and the <FrontierPath> !!!"
0009     exit
0010 fi
0011 
0012 afstokenchecker.sh "Starting execution of MonitorDB_NewDirStructure_KeepTagLinks $1 $2 $3 $4"
0013 
0014 #Example: SEARCHSTRING=SiStrip
0015 SEARCHSTRING=$1
0016 #Example: DB=cms_orcoff_prod
0017 DB=$2
0018 #Example: ACCOUNT=CMS_COND_21X_STRIP
0019 ACCOUNT=$3
0020 #Example: GTACCOUNT=CMS_COND_21X_GLOBALTAG
0021 GTACCOUNT=$4
0022 #Example: FRONTIER=FrontierProd
0023 FRONTIER=$5
0024 DBTAGCOLLECTION=DBTagsIn_${DB}_${ACCOUNT}.txt
0025 GLOBALTAGCOLLECTION=GlobalTagsForDBTag.txt
0026 DBTAGDIR=DBTagCollection
0027 GLOBALTAGDIR=GlobalTags
0028 STORAGEPATH=/afs/cern.ch/cms/tracker/sistrcalib/WWW/CondDBMonitoring
0029 WORKDIR=$PWD
0030 
0031 #Function to publish png pictures on the web. Will be used at the end of the script:
0032 CreateIndex ()
0033 {
0034     cp /afs/cern.ch/cms/tracker/sistrcalib/WWW/index_new.html .
0035 
0036     COUNTER=0
0037     LASTUPDATE=`date`
0038 
0039     for Plot in *.png; do
0040         if [[ $COUNTER%2 -eq 0 ]]; then
0041             cat >> index_new.html  << EOF
0042 <TR> <TD align=center> <a href="$Plot"><img src="$Plot"hspace=5 vspace=5 border=0 style="width: 90%" ALT="$Plot"></a> 
0043   <br> $Plot </TD>
0044 EOF
0045         else
0046             cat >> index_new.html  << EOF
0047   <TD align=center> <a href="$Plot"><img src="$Plot"hspace=5 vspace=5 border=0 style="width: 90%" ALT="$Plot"></a> 
0048   <br> $Plot </TD> </TR> 
0049 EOF
0050         fi
0051 
0052         let COUNTER++
0053     done
0054 
0055     cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_foot.html | sed -e "s@insertDate@$LASTUPDATE@g" >> index_new.html
0056 
0057     mv -f index_new.html index.html
0058 }
0059 
0060 # Creation of all needed directories if not existing yet
0061 if [ ! -d "$STORAGEPATH/$DB" ]; then 
0062     afstokenchecker.sh "Creating directory $STORAGEPATH/$DB"
0063     mkdir $STORAGEPATH/$DB;
0064 fi
0065 
0066 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT" ]; then 
0067     afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT"
0068     mkdir $STORAGEPATH/$DB/$ACCOUNT; 
0069 fi
0070 
0071 if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR" ]; then 
0072     afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR"
0073     mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR; 
0074 fi
0075 
0076 # Creation of Global Tag directory from scratch to have always up-to-date information (and no old links that are obsolete)
0077 if [ ! -d "$STORAGEPATH/$DB/$GLOBALTAGDIR" ]; then 
0078     afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$GLOBALTAGDIR"
0079     mkdir $STORAGEPATH/$DB/$GLOBALTAGDIR; 
0080 fi
0081 
0082 # Access of all SiStrip Tags uploaded to the given DB account
0083 cmscond_list_iov -c frontier://cmsfrontier.cern.ch:8000/$FRONTIER/$ACCOUNT -P /afs/cern.ch/cms/DB/conddb -a | grep $SEARCHSTRING | awk '{if(match($0,"V0")!=0) {} else {print $0}}' > $DBTAGCOLLECTION # Access via Frontier
0084 #cmscond_list_iov -c frontier://cmsfrontier.cern.ch:8000/$FRONTIER/$ACCOUNT -P /afs/cern.ch/cms/DB/conddb -a | grep $SEARCHSTRING | awk '{print $0}' > $DBTAGCOLLECTION # Access via Frontier
0085 
0086 # Loop on all DB Tags
0087 for tag in `cat $DBTAGCOLLECTION`; do
0088 
0089     afstokenchecker.sh "Processing DB-Tag $tag";
0090 
0091     NEWTAG=False
0092     NEWIOV=False
0093     CFGISSAVED=False
0094 
0095     # Discover which kind of tag is processed
0096     MONITOR_NOISE=False
0097     MONITOR_PEDESTAL=False
0098     MONITOR_GAIN=False
0099     MONITOR_QUALITY=False
0100     MONITOR_CABLING=False
0101     MONITOR_LA=False
0102     MONITOR_BP=False
0103     MONITOR_THRESHOLD=False
0104     MONITOR_LATENCY=False
0105     MONITOR_SHIFTANDCROSSTALK=False
0106     MONITOR_APVPHASEOFFSETS=False
0107     MONITOR_ALCARECOTRIGGERBITS=False
0108 
0109     LOGDESTINATION=cout
0110     QUALITYLOGDEST=QualityInfo
0111     CABLINGLOGDEST=CablingInfo
0112     CONDLOGDEST=Dummy
0113 
0114     RECORDFORQUALITY=Dummy
0115 
0116     MONITORCUMULATIVE=False
0117     USEACTIVEDETID=False
0118     CREATETRENDS=False
0119 
0120     if      [ `echo $tag | grep "Noise" | wc -w` -gt 0 ]; then
0121         MONITOR_NOISE=True
0122         USEACTIVEDETID=True
0123         RECORD=SiStripNoisesRcd
0124         TAGSUBDIR=SiStripNoise
0125         MONITORCUMULATIVE=True
0126     else if [ `echo $tag | grep "Pedestal" | wc -w` -gt 0 ]; then
0127         MONITOR_PEDESTAL=True
0128         USEACTIVEDETID=True
0129         RECORD=SiStripPedestalsRcd
0130         TAGSUBDIR=SiStripPedestal
0131     else if [ `echo $tag | grep "Gain" | wc -w` -gt 0 ]; then
0132         MONITOR_GAIN=True
0133         USEACTIVEDETID=True
0134         RECORD=SiStripApvGainRcd
0135         TAGSUBDIR=SiStripApvGain
0136     else if [ `echo $tag | grep "Bad" | wc -w` -gt 0 ]; then
0137         MONITOR_QUALITY=True
0138         USEACTIVEDETID=True
0139         RECORD=SiStripBadChannelRcd
0140         TAGSUBDIR=SiStripBadChannel
0141         LOGDESTINATION=Reader
0142         QUALITYLOGDEST=QualityInfo
0143         CREATETRENDS=True
0144     else if [ `echo $tag | grep "Cabling" | wc -w` -gt 0 ]; then
0145         MONITOR_CABLING=True
0146         USEACTIVEDETID=True
0147         RECORD=SiStripFedCablingRcd
0148         RECORDFORQUALITY=SiStripDetCablingRcd
0149         TAGSUBDIR=SiStripFedCabling
0150         LOGDESTINATION=Reader
0151         QUALITYLOGDEST=QualityInfoFromCabling
0152         CABLINGLOGDEST=CablingInfo
0153         CREATETRENDS=True
0154     else if [ `echo $tag | grep "Lorentz" | wc -w` -gt 0 ]; then
0155         MONITOR_LA=True
0156         USEACTIVEDETID=False
0157         RECORD=SiStripLorentzAngleRcd
0158         TAGSUBDIR=SiStripLorentzAngle
0159     else if [ `echo $tag | grep "BackPlane" | wc -w` -gt 0 ]; then
0160         MONITOR_BP=True
0161         USEACTIVEDETID=False
0162         RECORD=SiStripBackPlaneCorrectionRcd
0163         TAGSUBDIR=SiStripBackPlaneCorrection
0164     else if [ `echo $tag | grep "Threshold" | wc -w` -gt 0 ]; then
0165         MONITOR_THRESHOLD=True
0166         USEACTIVEDETID=True
0167         RECORD=SiStripThresholdRcd
0168         TAGSUBDIR=SiStripThreshold
0169     else if [ `echo $tag | grep "VOff" | wc -w` -gt 0 ]; then
0170         MONITOR_QUALITY=True
0171         USEACTIVEDETID=True
0172         RECORD=SiStripDetVOffRcd
0173         TAGSUBDIR=SiStripVoltage
0174         LOGDESTINATION=Reader
0175         CREATETRENDS=True
0176     else if [ `echo $tag | grep "Latency" | wc -w` -gt 0 ]; then
0177         MONITOR_LATENCY=True
0178         RECORD=SiStripLatencyRcd
0179         TAGSUBDIR=SiStripLatency
0180         LOGDESTINATION=Reader
0181         CONDLOGDEST=LatencyInfo
0182     else if [ `echo $tag | grep "Shift" | wc -w` -gt 0 ]; then
0183         MONITOR_SHIFTANDCROSSTALK=True
0184         RECORD=SiStripConfObjectRcd
0185         TAGSUBDIR=SiStripShiftAndCrosstalk
0186         LOGDESTINATION=Reader
0187         CONDLOGDEST=ShiftAndCrosstalkInfo
0188     else if [ `echo $tag | grep "APVPhaseOffsets" | wc -w` -gt 0 ]; then
0189         MONITOR_APVPHASEOFFSETS=True
0190         RECORD=SiStripConfObjectRcd
0191         TAGSUBDIR=SiStripAPVPhaseOffsets
0192         LOGDESTINATION=Reader
0193         CONDLOGDEST=APVPhaseOffsetsInfo
0194     else if [ `echo $tag | grep "AlCaRecoTriggerBits" | wc -w` -gt 0 ]; then
0195         MONITOR_ALCARECOTRIGGERBITS=True
0196         RECORD=AlCaRecoTriggerBitsRcd
0197         TAGSUBDIR=SiStripDQM
0198     else
0199         USEACTIVEDETID=False
0200         RECORD=Unknown
0201         TAGSUBDIR=Unknown
0202 
0203     fi
0204     fi
0205     fi
0206     fi
0207     fi
0208     fi
0209     fi
0210     fi
0211     fi
0212     fi
0213     fi
0214     fi
0215     fi
0216 
0217     # Creation of DB-Tag directory if not existing yet
0218     if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR" ]; then 
0219         afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR"
0220         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR; 
0221     fi
0222 
0223     if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag" ]; then 
0224         afstokenchecker.sh "Creating directory $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag"
0225         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag;
0226 
0227         NEWTAG=True
0228     fi
0229 
0230     if [ "$RECORD" = "Unknown" ]; then
0231         afstokenchecker.sh "Unknown strip tag. Processing skipped!"
0232         continue
0233     fi
0234 
0235     # Get the list of IoVs for the given DB-Tag
0236     afstokenchecker.sh "Getting the list of IOVs for the given DB tag..."
0237     iov_list_tag.py -c frontier://cmsfrontier.cern.ch:8000/$FRONTIER/$ACCOUNT -P /afs/cern.ch/cms/DB/conddb -t $tag > list_Iov.txt # Access via Frontier
0238 
0239     # Access DB for the given DB-Tag and dump values in a root-file and histograms in .png if not existing yet
0240     afstokenchecker.sh "Now the values are retrieved from the DB..."
0241     
0242     if [ ! -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/rootfiles" ]; then
0243         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/rootfiles;
0244         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/Documentation;
0245         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/cfg;
0246         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots;
0247         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB;
0248         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB;
0249         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID;
0250         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC;
0251 
0252         for i in {1..4}; do
0253             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i;
0254 
0255             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0256                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i/Profile;
0257             fi
0258             if [ "$MONITORCUMULATIVE" = "True" ]; then
0259                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i/Cumulative;
0260             fi
0261             if [ "$CREATETRENDS" = "True" ]; then
0262                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i/Trends;
0263             fi
0264         done
0265 
0266         for i in {1..6}; do
0267             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i;
0268 
0269             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0270                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i/Profile;
0271             fi
0272             if [ "$MONITORCUMULATIVE" = "True" ]; then
0273                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i/Cumulative;
0274             fi
0275             if [ "$CREATETRENDS" = "True" ]; then
0276                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i/Trends;
0277             fi
0278         done
0279 
0280         for i in {1..2}; do
0281             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i;
0282             for j in {1..3}; do
0283                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j;
0284 
0285                 if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0286                     mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j/Profile;
0287                 fi
0288                 if [ "$MONITORCUMULATIVE" = "True" ]; then
0289                     mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j/Cumulative;
0290                 fi
0291                 if [ "$CREATETRENDS" = "True" ]; then
0292                     mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j/Trends;
0293                 fi
0294             done
0295         done
0296 
0297         for i in {1..2}; do
0298             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i;
0299             for j in {1..9}; do
0300                 mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j;
0301 
0302                 if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0303                     mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j/Profile;
0304                 fi
0305                 if [ "$MONITORCUMULATIVE" = "True" ]; then
0306                     mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j/Cumulative;
0307                 fi
0308                 if [ "$CREATETRENDS" = "True" ]; then
0309                     mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j/Trends;
0310                 fi
0311             done
0312         done
0313 
0314         if [ "$MONITOR_QUALITY" = "True" ] || [ "$MONITOR_CABLING" = "True" ]; then
0315             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Trends
0316             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Trends;
0317             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Trends;
0318             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side1/Trends;
0319             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side2/Trends;
0320             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side1/Trends;
0321             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side2/Trends;
0322             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary
0323         fi
0324 
0325 
0326         mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TrackerMap;
0327 
0328         if [ "$MONITOR_QUALITY" = "True" ]; then
0329             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadAPVs
0330             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadFibers
0331             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadModules
0332             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadStrips
0333             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/QualityLog
0334         fi
0335 
0336         if [ "$MONITOR_CABLING" = "True" ]; then
0337             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/CablingLog
0338         fi
0339 
0340         if [ "$MONITOR_LATENCY" = "True" ]; then
0341             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/LatencyLog
0342         fi
0343 
0344         if [ "$MONITOR_SHIFTANDCROSSTALK" = "True" ]; then
0345             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/ShiftAndCrosstalkLog
0346         fi
0347 
0348         if [ "$MONITOR_APVPHASEOFFSETS" = "True" ]; then
0349             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/APVPhaseOffsetsLog
0350         fi
0351 
0352         if [ "$MONITOR_ALCARECOTRIGGERBITS" = "True" ]; then
0353             mkdir $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/AlCaRecoTriggerBitsLog
0354         fi
0355 
0356     fi
0357 
0358 #    if [ `ls *.png | wc -w` -gt 0 ]; then
0359     if [ `echo *.png | wc -w` -gt 0 ]; then
0360         rm *.png;
0361     fi
0362 
0363 #    if [ "$RECORD" = "SiStripDetVOffRcd" ] && [ "$NEWTAG" = "True" ]; then
0364 #       ROOTFILE="${tag}_Timestamp_XYZ.root"
0365 #       cat template_DBReader_cfg.py | sed -e "s@insertRun@insertTimestamp@g" -e "s@runnumber@timestamp@g" -e "s@insertLog@$LOGDESTINATION@g" -e "s@insertDB@$DB@g" -e "s@insertFrontier@$FRONTIER@g" -e "s@insertAccount@$ACCOUNT@g" -e "s@insertTag@$tag@g" -e "s@insertRecord@$RECORD@g" -e "s@insertOutFile@$ROOTFILE@g" -e "s@insertPedestalMon@$MONITOR_PEDESTAL@g" -e "s@insertNoiseMon@$MONITOR_NOISE@g" -e "s@insertQualityMon@$MONITOR_QUALITY@g" -e "s@insertGainMon@$MONITOR_GAIN@g" -e "s@insertCablingMon@$MONITOR_CABLING@g" -e "s@insertLorentzAngleMon@$MONITOR_LA@g" -e "s@insertThresholdMon@$MONITOR_THRESHOLD@g" -e "s@insertMonitorCumulative@$MONITORCUMULATIVE@g" -e "s@insertActiveDetId@$USEACTIVEDETID@g"> DBReader_cfg.py
0366 #       cat >> DBReader_cfg.py  << EOF
0367 #
0368 #process.SiStripQualityESProducer = cms.ESProducer("SiStripQualityESProducer",
0369 #   ReduceGranularity = cms.bool(False),
0370 #   PrintDebugOutput = cms.bool(False),
0371 #   UseEmptyRunInfo = cms.bool(False),
0372 #   ListOfRecordToMerge = cms.VPSet(cms.PSet(
0373 #   record = cms.string('$RECORD'),
0374 #   tag = cms.string('')
0375 #   ))
0376 #)
0377 #
0378 #process.stat = cms.EDAnalyzer("SiStripQualityStatistics",
0379 #    TkMapFileName = cms.untracked.string(''),
0380 #    dataLabel = cms.untracked.string('')
0381 #)
0382 #
0383 #process.e = cms.EndPath(process.stat)
0384 #EOF
0385 #
0386 #       cp DBReader_cfg.py $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/cfg/${tag}_cfg.py
0387 #
0388 #       cat >> ${tag}_documentation << EOF
0389 #<html>
0390 #<body>
0391 #<a href="https://twiki.cern.ch/twiki/bin/view/CMS/StripTrackerDBTagsForCalibrations#${tag}">https://twiki.cern.ch/twiki/bin/view/CMS/StripTrackerDBTagsForCalibrations#${tag}</a>
0392 #</body>
0393 #</html>
0394 #EOF
0395 #
0396 #       mv ${tag}_documentation $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/Documentation;
0397 #
0398 #       rm $LOGDESTINATION.log
0399 #       continue
0400 #    fi
0401 
0402     # Process each IOV of the given DB-Tag seperately
0403     for IOV_number in `cat list_Iov.txt`; do
0404 
0405         if [ "$IOV_number" = "Total" ] || [ $IOV_number -gt 100000000 ]; then  # do not loop on time-based IOVs 
0406             continue
0407         fi
0408         
0409         ROOTFILE="${tag}_Run_${IOV_number}.root"
0410 
0411         if [ -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/rootfiles/$ROOTFILE ]; then # Skip IOVs already processed. Take only new ones.
0412             continue
0413         fi
0414 
0415         if [ "$MONITOR_LATENCY" = "True" ] && [ -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/LatencyLog/LatencyInfo_Run${IOV_number}.txt ]; then # Skip IOVs already processed. Take only new ones.
0416             continue
0417         fi
0418 
0419         if [ "$MONITOR_SHIFTANDCROSSTALK" = "True" ] && [ -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/ShiftAndCrosstalkLog/ShiftAndCrosstalkInfo_Run${IOV_number}.txt ]; then # Skip IOVs already processed. Take only new ones.
0420             continue
0421         fi
0422 
0423         if [ "$MONITOR_APVPHASEOFFSETS" = "True" ] && [ -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/APVPhaseOffsetsLog/APVPhaseOffsetsInfo_Run${IOV_number}.txt ]; then # Skip IOVs already processed. Take only new ones.
0424             continue
0425         fi
0426 
0427         if [ "$MONITOR_ALCARECOTRIGGERBITS" = "True" ] && [ -f $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/AlCaRecoTriggerBitsLog/AlCaRecoTriggerBitsInfo_Run${IOV_number}.txt ]; then # Skip IOVs already processed. Take only new ones.
0428             continue
0429         fi
0430 
0431         afstokenchecker.sh "New IOV $IOV_number found. Being processed..."
0432 
0433         NEWIOV=True
0434 
0435         afstokenchecker.sh "Executing cmsRun. Stay tuned ..."
0436         CMSRUNCOMMAND="cmsRun ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/test/DBReader_conddbmonitoring_generic_cfg.py print logDestination=$LOGDESTINATION qualityLogDestination=$QUALITYLOGDEST cablingLogDestination=$CABLINGLOGDEST condLogDestination=$CONDLOGDEST outputRootFile=$ROOTFILE connectionString=frontier://$FRONTIER/$ACCOUNT recordName=$RECORD recordForQualityName=$RECORDFORQUALITY tagName=$tag runNumber=$IOV_number LatencyMon=$MONITOR_LATENCY ALCARecoTriggerBitsMon=$MONITOR_ALCARECOTRIGGERBITS ShiftAndCrosstalkMon=$MONITOR_SHIFTANDCROSSTALK APVPhaseOffsetsMon=$MONITOR_APVPHASEOFFSETS PedestalMon=$MONITOR_PEDESTAL NoiseMon=$MONITOR_NOISE QualityMon=$MONITOR_QUALITY CablingMon=$MONITOR_CABLING GainMon=$MONITOR_GAIN LorentzAngleMon=$MONITOR_LA BackPlaneCorrectionMon=$MONITOR_BP ThresholdMon=$MONITOR_THRESHOLD MonitorCumulative=$MONITORCUMULATIVE ActiveDetId=$USEACTIVEDETID"
0437         $CMSRUNCOMMAND
0438 
0439         afstokenchecker.sh "cmsRun finished. Now moving the files to the corresponding directories ..."
0440 
0441         cp ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/test/DBReader_conddbmonitoring_generic_cfg.py DBReader_cfg.py
0442         cat >> DBReader_cfg.py << EOF 
0443 #
0444 # $CMSRUNCOMMAND
0445 #
0446 EOF
0447 
0448         mv DBReader_cfg.py $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/cfg/${tag}_cfg.py
0449         CFGISSAVED=True
0450 
0451         if [ "$NEWTAG" = "True" ]; then
0452             cat >> ${tag}_documentation << EOF
0453 <html>
0454 <body>
0455 <a href="https://twiki.cern.ch/twiki/bin/view/CMS/StripTrackerDBTagsForCalibrations#${tag}">https://twiki.cern.ch/twiki/bin/view/CMS/StripTrackerDBTagsForCalibrations#${tag}</a>
0456 </body>
0457 </html>
0458 EOF
0459 
0460             mv ${tag}_documentation $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/Documentation;
0461         fi
0462 
0463         if [ -f $ROOTFILE ]; then mv $ROOTFILE $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/rootfiles; fi
0464 
0465         if [ "$MONITOR_QUALITY" = "True" ]; then
0466 #           cat $LOGDESTINATION.log | awk 'BEGIN{doprint=0}{if(match($0,"New IOV")!=0) doprint=1;if(match($0,"%MSG")!=0) {doprint=0;} if(doprint==1) print $0}' > QualityInfo_Run${IOV_number}.txt
0467             mv $QUALITYLOGDEST.log QualityInfo_Run${IOV_number}.txt
0468             mv QualityInfo_Run${IOV_number}.txt $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/QualityLog/
0469 
0470         fi
0471 
0472         if [ "$MONITOR_CABLING" = "True" ]; then
0473             if [ "$ACCOUNT" != "CMS_COND_21X_STRIP" ]; then
0474 #               cat $LOGDESTINATION.log | awk 'BEGIN{doprint=0}{if(match($0,"beginRun")!=0) doprint=1;if(match($0,"%MSG")!=0) {doprint=0;} if(doprint==1) print $0}' > CablingInfo_Run${IOV_number}.txt
0475                 mv $CABLINGLOGDEST.log CablingInfo_Run${IOV_number}.txt
0476                 mv CablingInfo_Run${IOV_number}.txt $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/CablingLog/
0477             fi
0478 
0479 #           cat $LOGDESTINATION.log | awk 'BEGIN{doprint=0}{if(match($0,"New IOV")!=0) doprint=1;if(match($0,"%MSG")!=0) {doprint=0;} if(doprint==1) print $0}' > QualityInfoFromCabling_Run${IOV_number}.txt
0480             mv $QUALITYLOGDEST.log QualityInfoFromCabling_Run${IOV_number}.txt
0481             mv QualityInfoFromCabling_Run${IOV_number}.txt $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/CablingLog/
0482 
0483         fi
0484 
0485         if [ "$MONITOR_LATENCY" = "True" ]; then
0486 #           cat $LOGDESTINATION.log | awk 'BEGIN{doprint=0}{if(match($0,"PrintSummary")!=0) doprint=1;if(match($0,"PrintDebug")!=0) doprint=1;if(match($0,"%MSG")!=0) {doprint=0;} if(doprint==1) print $0}' > LatencyInfo_Run${IOV_number}.txt
0487             mv $CONDLOGDEST.log LatencyInfo_Run${IOV_number}.txt
0488             mv LatencyInfo_Run${IOV_number}.txt $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/LatencyLog/
0489 
0490         fi
0491 
0492         if [ "$MONITOR_SHIFTANDCROSSTALK" = "True" ]; then
0493 #           cat $LOGDESTINATION.log | awk 'BEGIN{doprint=0}{if(match($0,"PrintSummary")!=0) doprint=1;if(match($0,"PrintDebug")!=0) doprint=1;if(match($0,"%MSG")!=0) {doprint=0;} if(doprint==1) print $0}' > ShiftAndCrosstalkInfo_Run${IOV_number}.txt
0494             mv $CONDLOGDEST.log ShiftAndCrosstalkInfo_Run${IOV_number}.txt
0495             mv ShiftAndCrosstalkInfo_Run${IOV_number}.txt $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/ShiftAndCrosstalkLog/
0496 
0497         fi
0498 
0499         if [ "$MONITOR_APVPHASEOFFSETS" = "True" ]; then
0500 #           cat $LOGDESTINATION.log | awk 'BEGIN{doprint=0}{if(match($0,"PrintSummary")!=0) doprint=1;if(match($0,"PrintDebug")!=0) doprint=1;if(match($0,"%MSG")!=0) {doprint=0;} if(doprint==1) print $0}' > APVPhaseOffsetsInfo_Run${IOV_number}.txt
0501             mv $CONDLOGDEST.log APVPhaseOffsetsInfo_Run${IOV_number}.txt
0502             mv APVPhaseOffsetsInfo_Run${IOV_number}.txt $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/APVPhaseOffsetsLog/
0503 
0504         fi
0505 
0506         if [ "$MONITOR_ALCARECOTRIGGERBITS" = "True" ]; then
0507             mv AlCaRecoTriggerBitsInfo_Run${IOV_number}.txt $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/AlCaRecoTriggerBitsLog/
0508         fi
0509 
0510     if [ -f $LOGDESTINATION.log ]; then rm $LOGDESTINATION.log;  fi
0511     if [ -f $QUALITYLOGDEST.log ]; then rm $QUALITYLOGDEST.log;  fi
0512     if [ -f $CABLINGLOGDEST.log ]; then rm $CABLINGLOGDEST.log;  fi
0513     if [ -f $CONDLOGDEST.log ]; then    rm $CONDLOGDEST.log;  fi
0514         
0515 
0516         for Plot in `ls *.png | grep TIB`; do
0517             PNGNAME=`echo ${Plot#*_*_*_*_*_} | gawk -F . '{print $1}'`
0518             LAYER=`echo ${PNGNAME#*_*_} | gawk -F _ '{print $1}'`
0519             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0520                 if [ `echo $Plot | grep Cumulative` ]; then
0521                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$LAYER/Cumulative/${PNGNAME}__Run${IOV_number}.png;
0522                 else
0523                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$LAYER/Profile/${PNGNAME}__Run${IOV_number}.png;
0524                 fi
0525             else
0526                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$LAYER/${PNGNAME}__Run${IOV_number}.png;
0527             fi
0528         done;
0529 
0530         for Plot in `ls *.png | grep TOB`; do
0531             PNGNAME=`echo ${Plot#*_*_*_*_*_} | gawk -F . '{print $1}'`
0532             LAYER=`echo ${PNGNAME#*_*_} | gawk -F _ '{print $1}'`
0533             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0534                 if [ `echo $Plot | grep Cumulative` ]; then
0535                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$LAYER/Cumulative/${PNGNAME}__Run${IOV_number}.png;
0536                 else
0537                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$LAYER/Profile/${PNGNAME}__Run${IOV_number}.png;
0538                 fi
0539             else
0540                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$LAYER/${PNGNAME}__Run${IOV_number}.png;
0541             fi
0542         done;
0543 
0544         for Plot in `ls *.png | grep TID`; do
0545             PNGNAME=`echo ${Plot#*_*_*_*_*_} | gawk -F . '{print $1}'`
0546             SIDE=`echo ${PNGNAME#*_*_} | gawk -F _ '{print $1}'`
0547             DISK=`echo ${PNGNAME#*_*_*_*_*_*_} | gawk -F _ '{print $1}'`
0548             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0549                 if [ `echo $Plot | grep Cumulative` ]; then
0550                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$SIDE/Disk$DISK/Cumulative/${PNGNAME}__Run${IOV_number}.png;
0551                 else
0552                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$SIDE/Disk$DISK/Profile/${PNGNAME}__Run${IOV_number}.png;
0553                 fi
0554             else
0555                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$SIDE/Disk$DISK/${PNGNAME}__Run${IOV_number}.png;
0556             fi
0557         done;
0558 
0559         for Plot in `ls *.png | grep TEC`; do
0560             PNGNAME=`echo ${Plot#*_*_*_*_*_} | gawk -F . '{print $1}'`
0561             SIDE=`echo ${PNGNAME#*_*_} | gawk -F _ '{print $1}'`
0562             DISK=`echo ${PNGNAME#*_*_*_*_*_*_} | gawk -F _ '{print $1}'`
0563             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0564                 if [ `echo $Plot | grep Cumulative` ]; then
0565                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$SIDE/Disk$DISK/Cumulative/${PNGNAME}__Run${IOV_number}.png;
0566                 else
0567                     mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$SIDE/Disk$DISK/Profile/${PNGNAME}__Run${IOV_number}.png;
0568                 fi
0569             else
0570                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$SIDE/Disk$DISK/${PNGNAME}__Run${IOV_number}.png;
0571             fi
0572         done;
0573 
0574         for Plot in `ls *.png | grep TkMap`; do
0575             #PNGNAME=`echo $Plot | gawk -F . '{print $1}'`
0576             mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TrackerMap/$Plot;
0577         done;
0578 
0579         for Plot in `ls *.png | grep Bad`; do
0580             PNGNAME=`echo ${Plot#*_} | gawk -F . '{print $1}'`
0581             if      [ `echo $PNGNAME | grep Apvs` ]; then
0582                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadAPVs/${PNGNAME}__Run${IOV_number}.png;
0583             else if [ `echo $PNGNAME | grep Fibers` ]; then
0584                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadFibers/${PNGNAME}__Run${IOV_number}.png;
0585             else if [ `echo $PNGNAME | grep Modules` ]; then
0586                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadModules/${PNGNAME}__Run${IOV_number}.png;
0587             else if [ `echo $PNGNAME | grep Strips` ]; then
0588                 mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadStrips/${PNGNAME}__Run${IOV_number}.png;
0589             fi
0590             fi
0591             fi
0592             fi
0593         done;
0594 
0595         for Plot in `ls *.png | grep Cabling`; do
0596             PNGNAME=`echo ${Plot#*_} | gawk -F . '{print $1}'`
0597             mv $Plot $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/${PNGNAME}__Run${IOV_number}.png;
0598         done;
0599    
0600         #cd $WORKDIR;
0601 
0602     done;
0603 
0604     # Run the Trends and Publish all histograms on a web page
0605     if [ "$NEWTAG" = "True" ] || [ "$NEWIOV" = "True" ]; then
0606 
0607         if [ "$CREATETRENDS" = "True" ]; then
0608             afstokenchecker.sh "Creating the Trend Plots ..."
0609 
0610             getOfflineDQMData.sh $DB $ACCOUNT $TAGSUBDIR $tag $STORAGEPATH
0611 
0612             afstokenchecker.sh "Moving Trend Plots Using the script moveTrendPlots..."
0613 
0614             moveTrendPlots.sh $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag
0615 
0616 
0617         fi
0618 
0619         afstokenchecker.sh "Publishing the new tag $tag (or the new IOV) on the web ..."
0620 
0621         for i in {1..4}; do
0622             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0623             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TIB Layer $i --- Summary Report@g" > index_new.html
0624             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0625                 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i/Profile;
0626                 CreateIndex
0627 
0628                 if [ "$MONITORCUMULATIVE" = "True" ]; then
0629                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i/Cumulative;
0630                     CreateIndex
0631                 fi
0632 
0633                 if [ "$CREATETRENDS" = "True" ]; then
0634                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i/Trends;
0635                     CreateIndex
0636                 fi
0637             else
0638                 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Layer$i;
0639                 CreateIndex
0640             fi
0641         done
0642 
0643         for i in {1..6}; do
0644             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0645             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TOB Layer $i --- Summary Report@g" > index_new.html
0646             if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0647                 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i/Profile;
0648                 CreateIndex
0649 
0650                 if [ "$MONITORCUMULATIVE" = "True" ]; then
0651                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i/Cumulative;
0652                     CreateIndex
0653                 fi
0654 
0655                 if [ "$CREATETRENDS" = "True" ]; then
0656                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i/Trends;
0657                     CreateIndex
0658                 fi
0659             else
0660                 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Layer$i;
0661                 CreateIndex
0662             fi
0663         done
0664 
0665         for i in {1..2}; do
0666             for j in {1..3}; do
0667                 cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0668                 cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TID Side $i Disk $j --- Summary Report@g" > index_new.html
0669                 if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0670                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j/Profile;
0671                     CreateIndex
0672 
0673                     if [ "$MONITORCUMULATIVE" = "True" ]; then
0674                         cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j/Cumulative;
0675                         CreateIndex
0676                     fi
0677 
0678                     if [ "$CREATETRENDS" = "True" ]; then
0679                         cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j/Trends;
0680                         CreateIndex
0681                     fi
0682                 else
0683                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Disk$j;
0684                     CreateIndex
0685                 fi
0686             done
0687         done
0688 
0689         for i in {1..2}; do
0690             for j in {1..9}; do
0691                 cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0692                 cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TEC Side $i Disk $j --- Summary Report@g" > index_new.html
0693                 if [ "$MONITORCUMULATIVE" = "True" ] || [ "$CREATETRENDS" = "True" ]; then
0694                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j/Profile;
0695                     CreateIndex
0696 
0697                     if [ "$MONITORCUMULATIVE" = "True" ]; then
0698                         cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j/Cumulative;
0699                         CreateIndex
0700                     fi
0701 
0702                     if [ "$CREATETRENDS" = "True" ]; then
0703                         cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j/Trends;
0704                         CreateIndex
0705                     fi
0706                 else
0707                     cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Disk$j;
0708                     CreateIndex
0709                 fi
0710             done
0711         done
0712 
0713         if [ "$CREATETRENDS" = "True" ]; then
0714             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0715             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- Full Strip Tracker --- Trend Plots@g" > index_new.html
0716             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Trends;
0717             CreateIndex
0718 
0719             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0720             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TIB --- Trend Plots@g" > index_new.html
0721             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TIB/Trends;
0722             CreateIndex
0723 
0724             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0725             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TOB --- Trend Plots@g" > index_new.html
0726             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TOB/Trends;
0727             CreateIndex
0728 
0729             for i in {1..2}; do
0730                 cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0731                 cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TID Side $i --- Trend Plots@g" > index_new.html
0732                 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TID/Side$i/Trends;
0733                 CreateIndex
0734 
0735                 cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0736                 cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- TEC Side $i --- Trend Plots@g" > index_new.html
0737                 cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TEC/Side$i/Trends;
0738                 CreateIndex
0739             done
0740         fi
0741 
0742         if [ "$MONITOR_QUALITY" = "True" ]; then
0743             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0744             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- Bad APVs --- Summary Report@g" > index_new.html
0745             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadAPVs;
0746             CreateIndex
0747 
0748             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0749             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- Bad Fibers --- Summary Report@g" > index_new.html
0750             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadFibers;
0751             CreateIndex
0752             
0753             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0754             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- Bad Modules --- Summary Report@g" > index_new.html
0755             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadModules;
0756             CreateIndex
0757 
0758             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0759             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- Bad Strips --- Summary Report@g" > index_new.html
0760             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/BadStrips;
0761             CreateIndex
0762                 
0763         fi
0764     
0765         if [ "$MONITOR_CABLING" = "True" ]; then
0766             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0767             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- Summary Report@g" > index_new.html
0768             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/Summary/;
0769             CreateIndex
0770                 
0771         fi
0772 
0773         if [ -d "$STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TrackerMap" ]; then
0774             cd /afs/cern.ch/cms/tracker/sistrcalib/WWW;
0775             cat ${CMSSW_BASE}/src/DQM/SiStripMonitorSummary/data/template_index_header.html | sed -e "s@insertPageName@$tag --- Tracker Maps for all IOVs ---@g" > index_new.html
0776             cd $STORAGEPATH/$DB/$ACCOUNT/$DBTAGDIR/$TAGSUBDIR/$tag/plots/TrackerMap;
0777             CreateIndex
0778 
0779         fi
0780 
0781     fi
0782 
0783     cd $WORKDIR;
0784 
0785 done;