Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:31:34

0001 #! /bin/tcsh
0002 
0003 cmsenv
0004 
0005 echo " START Geometry Validation"
0006 
0007 # $1 is the Global Tag
0008 # $2 is the scenario
0009 # $3 is "round" to round values in comparisons  to 0 if < |1.e7|.
0010 # Omit this option to show differences down to |1.e-23|.
0011 
0012 set roundFlag = ''
0013 if ($#argv == 0) then
0014     set gtag="auto:run1_mc"
0015     set geometry="GeometryExtended"
0016 else if($#argv == 1) then
0017     set gtag=`echo ${1}`
0018     set geometry="GeometryExtended"
0019 else if ($#argv == 2) then
0020     set gtag=`echo ${1}`
0021     set geometry=`echo ${2}`
0022 else if ($#argv == 3) then 
0023     set gtag=`echo ${1}`
0024     set geometry=`echo ${2}`
0025     set roundFlag = `echo ${3}`
0026 endif
0027 echo GlobalTag = ${gtag}
0028 echo geometry = ${geometry}
0029 echo roundFlag = ${roundFlag}
0030 
0031 set tolerance = '1.0e-7'
0032 # If rounding enabled, tolerance for numerical comparisons. Absolute values less than this are set to 0.
0033 
0034 #global tag gtag is assumed to be of the form GeometryWORD such as GeometryExtended or GeometryIdeal
0035 #as of 3.4.X loaded objects in the DB, these correspond to condlabels Extended, Ideal, etc...
0036 # Run 2 Extended condlabel corresponds to GeometryExtended2015 scenario. 
0037 set condlabel = `(echo $geometry | sed -e '{s/Geometry//g}' -e '{s/Plan//g}' -e '{s/[0-9]*//g}')`
0038 echo ${condlabel} " geometry label from db"
0039 
0040 set workArea = `(echo $geometry)`
0041 mkdir ${workArea}
0042 cd ${workArea}
0043 set myDir=`pwd`
0044 echo $myDir
0045 
0046 cp $CMSSW_RELEASE_BASE/src/CondTools/Geometry/test/writehelpers/geometryxmlwriter.py .
0047 echo $geometry
0048 sed -i "{s/GeometryExtended/${geometry}/}" geometryxmlwriter.py >  GeometryValidation.log
0049 cmsRun geometryxmlwriter.py >>  GeometryValidation.log
0050 
0051 cp $CMSSW_RELEASE_BASE/src/CondTools/Geometry/test/geometrywriter.py .
0052 # cp $CMSSW_BASE/src/CondTools/Geometry/test/geometrywriter.py .
0053 sed -i "{s/GeometryExtended/${geometry}/}" geometrywriter.py >>  GeometryValidation.log
0054 sed -i "{s/geTagXX.xml/geSingleBigFile.xml/g}" geometrywriter.py >>  GeometryValidation.log
0055 cmsRun geometrywriter.py >>  GeometryValidation.log
0056 if ( -e myfile.db ) then
0057     echo "The local DB file is present" | tee -a GeometryValidation.log
0058 else
0059     echo "ERROR the local DB file is not present" | tee -a GeometryValidation.log
0060     exit
0061 endif
0062 
0063 echo "Start compare the content of GT and the local DB" | tee -a GeometryValidation.log
0064 
0065 # (MEC:1) The following two tests with the diff below them actually make
0066 # sure that the Global Tag (GT) and Local DB XML file blobs are fine... 
0067 # meaning that the full simulation geometry source is fine (XML blob)
0068 # as well as the reco geometries.
0069 cp $CMSSW_RELEASE_BASE/src/CondTools/Geometry/test/geometrytest_local.py .
0070 sed -i "{/process.GlobalTag.globaltag/d}" geometrytest_local.py >> GeometryValidation.log
0071 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" geometrytest_local.py >> GeometryValidation.log
0072 
0073 cmsRun geometrytest_local.py > outLocalDB.log
0074 if ( -s outLocalDB.log ) then
0075     echo "Local DB access run ok" | tee -a GeometryValidation.log
0076 else
0077     echo "ERROR the output of Local DB access test is empty" | tee -a GeometryValidation.log
0078     exit
0079 endif
0080 
0081 cp $CMSSW_RELEASE_BASE/src/CondTools/Geometry/test/geometrytest_db.py .
0082 sed -i "{/process.GlobalTag.globaltag/d}" geometrytest_db.py >> GeometryValidation.log 
0083 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" geometrytest_db.py >> GeometryValidation.log
0084 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" geometrytest_db.py >> GeometryValidation.log 
0085 cmsRun geometrytest_db.py > outGTDB.log
0086 if ( -s outGTDB.log ) then
0087     echo "GT DB access run ok" | tee -a GeometryValidation.log
0088 else
0089     echo "ERROR the output of GT DB access test is empty" | tee -a GeometryValidation.log
0090     exit
0091 endif
0092 
0093 diff outLocalDB.log outGTDB.log > logDiffLocalvsGT.log
0094 if ( -s logDiffLocalvsGT.log ) then
0095     echo "WARNING THE CONTENT OF GLOBAL TAG MAY BE DIFFERENT WITH RESPECT TO THE LOCAL DB FILE" | tee -a GeometryValidation.log
0096     cp $CMSSW_BASE/src/Validation/Geometry/test/dddvsdb/sortXML.sh .
0097     cp $CMSSW_BASE/src/Validation/Geometry/test/dddvsdb/sortCompositeMaterials.py .
0098     ./sortXML.sh outLocalDB.log localdb.xml
0099     ./sortXML.sh outGTDB.log gtdb.xml
0100     diff localdb.xml gtdb.xml > logDiffLocXMLvsGTXML.log
0101     sort  localdb.xml > localdb.sort
0102     sort gtdb.xml > gtdb.sort
0103     diff localdb.sort gtdb.sort > logDiffLocvsGTSort.log
0104     echo Examine logDiffLocXMLvsGTXML.log to see the differences in the local and GT XML files. | tee -a GeometryValidation.log
0105     echo Examine logDiffLocvsGTSort.log to see the differences in sorted content of the local and GT XML files. | tee -a GeometryValidation.log
0106     echo The two XML files may have real differences, or they may have identical content that is simply re-arranged. | tee -a GeometryValidation.log
0107     echo Examining these log files can help you determine whether the XML files have significant differences. | tee -a GeometryValidation.log
0108 endif
0109 
0110 echo "End compare the content of GT and the local DB" | tee -a GeometryValidation.log
0111 
0112 echo "Start Tracker RECO geometry validation" | tee -a GeometryValidation.log
0113 
0114 mkdir tkdb
0115 mkdir tkdblocal
0116 mkdir tkddd
0117 
0118 cp myfile.db tkdblocal
0119 
0120 cd tkdb
0121 cp $CMSSW_RELEASE_BASE/src/Geometry/TrackerGeometryBuilder/test/python/testTrackerModuleInfoDB_cfg.py .
0122 sed -i "{/process.GlobalTag.globaltag/d}" testTrackerModuleInfoDB_cfg.py >> ../GeometryValidation.log
0123 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testTrackerModuleInfoDB_cfg.py >> ../GeometryValidation.log 
0124 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testTrackerModuleInfoDB_cfg.py >> ../GeometryValidation.log 
0125 if ( "${roundFlag}" == round ) then                                                               
0126   sed -i "/tolerance/s/1.0e-23/${tolerance}/" testTrackerModuleInfoDB_cfg.py >> GeometryValidation.log
0127 endif
0128 cmsRun testTrackerModuleInfoDB_cfg.py >> ../GeometryValidation.log
0129 mv testTrackerModuleInfoDB_cfg.py ../
0130 if ( -s ModuleInfo.log ) then
0131     echo "TK test from DB run ok" | tee -a ../GeometryValidation.log
0132 else
0133     echo "ERROR the output of TK test from DB is empty" | tee -a ../GeometryValidation.log
0134     exit
0135 endif
0136 
0137 cd ../tkdblocal
0138 cp $CMSSW_RELEASE_BASE/src/Geometry/TrackerGeometryBuilder/test/python/trackerModuleInfoLocalDB_cfg.py .
0139 # cp $CMSSW_BASE/src/Geometry/TrackerGeometryBuilder/test/python/trackerModuleInfoLocalDB_cfg.py .
0140 sed -i "{/process.GlobalTag.globaltag/d}" trackerModuleInfoLocalDB_cfg.py >> ../GeometryValidation.log
0141 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" trackerModuleInfoLocalDB_cfg.py >> ../GeometryValidation.log 
0142 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" trackerModuleInfoLocalDB_cfg.py >> ../GeometryValidation.log 
0143 if ( "${roundFlag}" == round ) then                                                               
0144   sed -i "/tolerance/s/1.0e-23/${tolerance}/" trackerModuleInfoLocalDB_cfg.py >> GeometryValidation.log
0145 endif
0146 cmsRun trackerModuleInfoLocalDB_cfg.py >> ../GeometryValidation.log
0147 mv trackerModuleInfoLocalDB_cfg.py ../
0148 if ( -s ModuleInfo.log ) then
0149     echo "TK test from Local DB run ok" | tee -a ../GeometryValidation.log
0150 else
0151     echo "ERROR the output of TK test from Local DB is empty" | tee -a ../GeometryValidation.log
0152     exit
0153 endif
0154 
0155 cd ../tkddd
0156 cp $CMSSW_RELEASE_BASE/src/Geometry/TrackerGeometryBuilder/test/python/testTrackerModuleInfoDDD_cfg.py .
0157 sed -i "{s/GeometryExtended/${geometry}/}" testTrackerModuleInfoDDD_cfg.py >>  ../GeometryValidation.log
0158 sed -i "{/process.GlobalTag.globaltag/d}" testTrackerModuleInfoDDD_cfg.py >> ../GeometryValidation.log
0159 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testTrackerModuleInfoDDD_cfg.py >> ../GeometryValidation.log 
0160 if ( "${roundFlag}" == round ) then                                                               
0161   sed -i "/tolerance/s/1.0e-23/${tolerance}/" testTrackerModuleInfoDDD_cfg.py >> GeometryValidation.log
0162 endif
0163 cmsRun testTrackerModuleInfoDDD_cfg.py >> ../GeometryValidation.log
0164 mv testTrackerModuleInfoDDD_cfg.py ../
0165 if ( -s ModuleInfo.log ) then
0166     echo "TK test from DDD run ok" | tee -a ../GeometryValidation.log
0167 else
0168     echo "ERROR the output of TK test from DDD is empty" | tee -a ../GeometryValidation.log
0169     exit
0170 endif
0171 
0172 cd ../
0173 rm -f tkdblocal/myfile.db
0174 diff -r tkdb/ tkddd/ > logTkDiffGTvsDDD.log
0175 if ( -s logTkDiffGTvsDDD.log ) then
0176     echo "WARNING THE TRACKER RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND GT DB" | tee -a GeometryValidation.log
0177 endif
0178 
0179 diff -r tkdblocal/ tkddd/ > logTkDiffLocalvsDDD.log
0180 if ( -s logTkDiffLocalvsDDD.log ) then
0181     echo "WARNING THE TRACKER RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND LOCAL DB" | tee -a GeometryValidation.log
0182 endif
0183 
0184 diff -r tkdb/ tkdblocal/ > logTkDiffGTvsLocal.log
0185 if ( -s logTkDiffGTvsLocal.log ) then
0186     echo "WARNING THE TRACKER RECO GEOMETRY IS DIFFERENT BETWEEN GT DB AND LOCAL DB" | tee -a GeometryValidation.log
0187 endif
0188 
0189 echo "End Tracker RECO geometry validation" | tee -a GeometryValidation.log
0190 
0191 echo "Start DT RECO geometry validation" | tee -a GeometryValidation.log
0192 
0193 # cp $CMSSW_BASE/src/Geometry/DTGeometry/test/testDTGeometryFromDB_cfg.py .  
0194 cp $CMSSW_RELEASE_BASE/src/Geometry/DTGeometry/test/testDTGeometryFromDB_cfg.py .  
0195 sed -i "{/process.GlobalTag.globaltag/d}" testDTGeometryFromDB_cfg.py >> GeometryValidation.log
0196 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testDTGeometryFromDB_cfg.py >> GeometryValidation.log 
0197 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testDTGeometryFromDB_cfg.py >> GeometryValidation.log
0198 if ( "${roundFlag}" == round ) then                                                               
0199   sed -i "/tolerance/s/1.0e-23/${tolerance}/" testDTGeometryFromDB_cfg.py >> GeometryValidation.log
0200 endif
0201 cmsRun testDTGeometryFromDB_cfg.py > outDB_DT.log
0202 if ( -s outDB_DT.log ) then
0203     echo "DT test from DB run ok" | tee -a GeometryValidation.log
0204 else
0205     echo "ERROR the output of DT test from DB is empty" | tee -a GeometryValidation.log
0206     exit
0207 endif
0208 
0209 # cp $CMSSW_BASE/src/Geometry/DTGeometry/test/testDTGeometryFromLocalDB_cfg.py .  
0210 cp $CMSSW_RELEASE_BASE/src/Geometry/DTGeometry/test/testDTGeometryFromLocalDB_cfg.py .  
0211 sed -i "{/process.GlobalTag.globaltag/d}" testDTGeometryFromLocalDB_cfg.py >> GeometryValidation.log
0212 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testDTGeometryFromLocalDB_cfg.py >> GeometryValidation.log 
0213 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testDTGeometryFromLocalDB_cfg.py >> GeometryValidation.log 
0214 if ( "${roundFlag}" == round ) then                                                               
0215   sed -i "/tolerance/s/1.0e-23/${tolerance}/" testDTGeometryFromLocalDB_cfg.py >> GeometryValidation.log
0216 endif
0217 cmsRun testDTGeometryFromLocalDB_cfg.py > outLocalDB_DT.log
0218 if ( -s outDB_DT.log ) then
0219     echo "DT test from Local DB run ok" | tee -a GeometryValidation.log
0220 else
0221     echo "ERROR the output of DT test from Local DB is empty" | tee -a GeometryValidation.log
0222     exit
0223 endif
0224 
0225 # cp $CMSSW_BASE/src/Geometry/DTGeometry/test/testDTGeometry_cfg.py .
0226 cp $CMSSW_RELEASE_BASE/src/Geometry/DTGeometry/test/testDTGeometry_cfg.py .
0227 sed -i "{s/GeometryExtended/${geometry}/}" testDTGeometry_cfg.py >>  GeometryValidation.log
0228 sed -i "{/process.GlobalTag.globaltag/d}" testDTGeometry_cfg.py >> GeometryValidation.log
0229 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testDTGeometry_cfg.py >> GeometryValidation.log 
0230 if ( "${roundFlag}" == round ) then                                                               
0231   sed -i "/tolerance/s/1.0e-23/${tolerance}/" testDTGeometry_cfg.py >> GeometryValidation.log
0232 endif
0233 cmsRun testDTGeometry_cfg.py > outDDD_DT.log
0234 if ( -s outDDD_DT.log ) then
0235     echo "DT test from DDD run ok" | tee -a GeometryValidation.log
0236 else
0237     echo "ERROR the output of DT test from DDD is empty" | tee -a GeometryValidation.log
0238     exit
0239 endif
0240 
0241 diff --ignore-matching-lines='Geometry node for DTGeom' outDB_DT.log outDDD_DT.log > logDTDiffGTvsDDD.log
0242 if ( -s logDTDiffGTvsDDD.log ) then
0243     echo "WARNING THE DT RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND GT DB" | tee -a GeometryValidation.log
0244 endif
0245 
0246 diff --ignore-matching-lines='Geometry node for DTGeom' outLocalDB_DT.log outDDD_DT.log > logDTDiffLocalvsDDD.log
0247 if ( -s logDTDiffLocalvsDDD.log ) then
0248     echo "WARNING THE DT RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND LOCAL DB" | tee -a GeometryValidation.log
0249 endif
0250 
0251 diff --ignore-matching-lines='Geometry node for DTGeom' outDB_DT.log outLocalDB_DT.log > logDTDiffGTvsLocal.log
0252 if ( -s logDTDiffGTvsLocal.log ) then
0253     echo "WARNING THE DT RECO GEOMETRY IS DIFFERENT BETWEEN GT DB AND  LOCAL DB" | tee -a GeometryValidation.log
0254 endif
0255 
0256 echo "End DT RECO geometry validation" | tee -a GeometryValidation.log
0257 
0258 echo "Start CSC RECO geometry validation" | tee -a GeometryValidation.log
0259 
0260 cp $CMSSW_RELEASE_BASE/src/Geometry/CSCGeometry/test/testCSCGeometryFromDB_cfg.py .  
0261 sed -i "{/process.GlobalTag.globaltag/d}" testCSCGeometryFromDB_cfg.py >> GeometryValidation.log
0262 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testCSCGeometryFromDB_cfg.py >> GeometryValidation.log 
0263 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testCSCGeometryFromDB_cfg.py >> GeometryValidation.log 
0264 cmsRun testCSCGeometryFromDB_cfg.py > outDB_CSC.log
0265 if ( -s outDB_CSC.log ) then
0266     echo "CSC test from GT DB run ok" | tee -a GeometryValidation.log
0267 else
0268     echo "ERROR the output of CSC test from GT DB is empty" | tee -a GeometryValidation.log
0269     exit
0270 endif
0271 
0272 cp $CMSSW_RELEASE_BASE/src/Geometry/CSCGeometry/test/testCSCGeometryFromLocalDB_cfg.py .  
0273 sed -i "{/process.GlobalTag.globaltag/d}" testCSCGeometryFromLocalDB_cfg.py >> GeometryValidation.log
0274 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testCSCGeometryFromLocalDB_cfg.py >> GeometryValidation.log 
0275 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testCSCGeometryFromLocalDB_cfg.py >> GeometryValidation.log 
0276 cmsRun testCSCGeometryFromLocalDB_cfg.py > outLocalDB_CSC.log
0277 if ( -s outLocalDB_CSC.log ) then
0278     echo "CSC test from Local DB run ok" | tee -a GeometryValidation.log
0279 else
0280     echo "ERROR the output of CSC test from Local DB is empty" | tee -a GeometryValidation.log
0281     exit
0282 endif
0283 
0284 cp $CMSSW_RELEASE_BASE/src/Geometry/CSCGeometry/test/testCSCGeometry_cfg.py .
0285 sed -i "{s/GeometryExtended/${geometry}/}" testCSCGeometry_cfg.py >>  GeometryValidation.log
0286 sed -i "{/process.GlobalTag.globaltag/d}" testCSCGeometry_cfg.py >> GeometryValidation.log
0287 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testCSCGeometry_cfg.py >> GeometryValidation.log 
0288 cmsRun testCSCGeometry_cfg.py > outDDD_CSC.log
0289 if ( -s outDDD_CSC.log ) then
0290     echo "CSC test from DDD run ok" | tee -a GeometryValidation.log
0291 else
0292     echo "ERROR the output of CSC test from DDD is empty" | tee -a GeometryValidation.log
0293     exit
0294 endif
0295 
0296 diff --ignore-matching-lines='Geometry node for CSCGeom' outDB_CSC.log outDDD_CSC.log > logCSCDiffGTvsDDD.log
0297 if ( -s logCSCDiffGTvsDDD.log ) then
0298     echo "WARNING THE CSC RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND GT DB" | tee -a GeometryValidation.log
0299 endif
0300 
0301 diff --ignore-matching-lines='Geometry node for CSCGeom' outLocalDB_CSC.log outDDD_CSC.log > logCSCDiffLocalvsDDD.log
0302 if ( -s logCSCDiffLocalvsDDD.log ) then
0303     echo "WARNING THE CSC RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND LOCAL DB" | tee -a GeometryValidation.log
0304 endif
0305 
0306 diff --ignore-matching-lines='Geometry node for CSCGeom' outLocalDB_CSC.log outDB_CSC.log > logCSCDiffLocalvsGT.log
0307 if ( -s logCSCDiffLocalvsGT.log ) then
0308     echo "WARNING THE CSC RECO GEOMETRY IS DIFFERENT BETWEEN GT DB AND LOCAL DB" | tee -a GeometryValidation.log
0309 endif
0310 
0311 echo "End CSC RECO geometry validation" | tee -a GeometryValidation.log
0312 
0313 echo "Start RPC RECO geometry validation" | tee -a GeometryValidation.log
0314 
0315 cp $CMSSW_RELEASE_BASE/src/Geometry/RPCGeometry/test/testRPCGeometryFromDB_cfg.py .  
0316 sed -i "{/process.GlobalTag.globaltag/d}" testRPCGeometryFromDB_cfg.py >> GeometryValidation.log
0317 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testRPCGeometryFromDB_cfg.py >> GeometryValidation.log 
0318 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testRPCGeometryFromDB_cfg.py >> GeometryValidation.log 
0319 cmsRun testRPCGeometryFromDB_cfg.py > outDB_RPC.log
0320 if ( -s outDB_RPC.log ) then
0321     echo "RPC test from GT DB run ok" | tee -a GeometryValidation.log
0322 else
0323     echo "ERROR the output of RPC test from GT DB is empty" | tee -a GeometryValidation.log
0324     exit
0325 endif
0326 
0327 cp $CMSSW_RELEASE_BASE/src/Geometry/RPCGeometry/test/testRPCGeometryFromLocalDB_cfg.py .  
0328 sed -i "{/process.GlobalTag.globaltag/d}" testRPCGeometryFromLocalDB_cfg.py >> GeometryValidation.log
0329 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testRPCGeometryFromLocalDB_cfg.py >> GeometryValidation.log 
0330 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testRPCGeometryFromLocalDB_cfg.py >> GeometryValidation.log 
0331 cmsRun testRPCGeometryFromLocalDB_cfg.py > outLocalDB_RPC.log
0332 if ( -s outLocalDB_RPC.log ) then
0333     echo "RPC test from Local DB run ok" | tee -a GeometryValidation.log
0334 else
0335     echo "ERROR the output of RPC test from Local DB is empty" | tee -a GeometryValidation.log
0336     exit
0337 endif
0338 
0339 cp $CMSSW_RELEASE_BASE/src/Geometry/RPCGeometry/test/testRPCGeometry_cfg.py .
0340 sed -i "{s/GeometryExtended/${geometry}/}" testRPCGeometry_cfg.py >>  GeometryValidation.log
0341 sed -i "{/process.GlobalTag.globaltag/d}" testRPCGeometry_cfg.py >> GeometryValidation.log
0342 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testRPCGeometry_cfg.py >> GeometryValidation.log 
0343 cmsRun testRPCGeometry_cfg.py > outDDD_RPC.log
0344 if ( -s outDDD_RPC.log ) then
0345     echo "RPC test from DDD run ok" | tee -a GeometryValidation.log
0346 else
0347     echo "ERROR the output of RPC test from DDD is empty" | tee -a GeometryValidation.log
0348     exit
0349 endif
0350 
0351 diff --ignore-matching-lines='Geometry node for RPCGeom' outDB_RPC.log outDDD_RPC.log > logRPCDiffGTvsDDD.log
0352 if ( -s logRPCDiffGTvsDDD.log ) then
0353     echo "WARNING THE RPC RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND GT DB" | tee -a GeometryValidation.log
0354 endif
0355 
0356 diff --ignore-matching-lines='Geometry node for RPCGeom' outLocalDB_RPC.log outDDD_RPC.log > logRPCDiffLocalvsDDD.log
0357 if ( -s logRPCDiffLocalvsDDD.log ) then
0358     echo "WARNING THE RPC RECO GEOMETRY IS DIFFERENT BETWEEN DDD AND LOCAL DB" | tee -a GeometryValidation.log
0359 endif
0360 
0361 diff --ignore-matching-lines='Geometry node for RPCGeom' outLocalDB_RPC.log outDB_RPC.log > logRPCDiffLocalvsDB.log
0362 if ( -s logRPCDiffLocalvsDB.log ) then
0363     echo "WARNING THE RPC RECO GEOMETRY IS DIFFERENT BETWEEN GT DB AND LOCAL DB" | tee -a GeometryValidation.log
0364 endif
0365 
0366 echo "End RPC RECO geometry validation" | tee -a GeometryValidation.log
0367 
0368 echo "Start CALO RECO geometry validation" | tee -a GeometryValidation.log
0369 
0370 cp myfile.db $CMSSW_BASE/src/Geometry/CaloEventSetup/test/
0371 cd $CMSSW_BASE/src/Geometry/CaloEventSetup/
0372 cd data
0373 wget -i download.url
0374 cd ../test
0375 source setup.scr >> ${myDir}/GeometryValidation.log
0376 sed -i "{s/GeometryExtended/${geometry}/}" runTestCaloGeometryDDD_cfg.py >> ${myDir}/GeometryValidation.log
0377 sed -i "{/process.GlobalTag.globaltag/d}" runTestCaloGeometryDDD_cfg.py >> ${myDir}/GeometryValidation.log
0378 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" runTestCaloGeometryDDD_cfg.py >> ${myDir}/GeometryValidation.log 
0379 cmsRun runTestCaloGeometryDDD_cfg.py > GeometryCaloValidationDDD.log
0380 if ( -s GeometryCaloValidationDDD.log ) then
0381     echo "CALO test from DDD run ok" | tee -a ${myDir}/GeometryValidation.log
0382 else
0383     echo "ERROR the output of CALO test from DDD is empty" | tee -a ${myDir}/GeometryValidation.log
0384     exit
0385 endif
0386 
0387 sed -i "{/process.GlobalTag.globaltag/d}" runTestCaloGeometryDB_cfg.py >> ${myDir}/GeometryValidation.log
0388 sed -i "s/auto:startup/${gtag}/" runTestCaloGeometryDB_cfg.py >> ${myDir}/GeometryValidation.log 
0389 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" runTestCaloGeometryDB_cfg.py >> ${myDir}/GeometryValidation.log 
0390 cmsRun runTestCaloGeometryDB_cfg.py > GeometryCaloValidationDB.log
0391 if ( -s GeometryCaloValidationDB.log ) then
0392     echo "CALO test from GT DB run ok" | tee -a ${myDir}/GeometryValidation.log
0393 else
0394     echo "ERROR the output of CALO test from GT DB is empty" | tee -a ${myDir}/GeometryValidation.log
0395     exit
0396 endif
0397 
0398 sed -i "{/process.GlobalTag.globaltag/d}" runTestCaloGeometryLocalDB_cfg.py >> ${myDir}/GeometryValidation.log
0399 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" runTestCaloGeometryLocalDB_cfg.py >> ${myDir}/GeometryValidation.log 
0400 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" runTestCaloGeometryLocalDB_cfg.py >> ${myDir}/GeometryValidation.log 
0401 cmsRun runTestCaloGeometryLocalDB_cfg.py > GeometryCaloValidationLocal.log
0402 if ( -s GeometryCaloValidationLocal.log ) then
0403     echo "CALO Local test from Local DB run ok" | tee -a ${myDir}/GeometryValidation.log
0404 else
0405     echo "ERROR the output of CALO test from Local DB is empty" | tee -a ${myDir}/GeometryValidation.log
0406     exit
0407 endif
0408 cd ${myDir}
0409 
0410 less $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationDDD.log >> GeometryValidation.log
0411 less $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationDB.log >> GeometryValidation.log
0412 less $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationLocal.log >> GeometryValidation.log
0413 
0414 grep 'BIG DISAGREEMENT FOUND' $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationDDD.log > CALODDDError.log 
0415 grep 'BIG DISAGREEMENT FOUND' $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationDB.log > CALODBError.log 
0416 grep 'BIG DISAGREEMENT FOUND' $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationLocal.log > CALOLocalError.log 
0417 
0418 rm -f $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationDDD.log
0419 rm -f $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationDB.log
0420 rm -f $CMSSW_BASE/src/Geometry/CaloEventSetup/test/GeometryCaloValidationLocal.log
0421 source $CMSSW_BASE/src/Geometry/CaloEventSetup/test/clean.scr
0422 
0423 if ( -s CALODDDError.log ) then                                                               
0424     echo "WARNING THE CALO GEOMETRY IS DIFFERENT BETWEEN DDD AND REF" | tee -a GeometryValidation.log                                                                                  
0425 endif                                                                                                      
0426 
0427 if ( -s CALODBError.log ) then                                                               
0428     echo "WARNING THE CALO GEOMETRY IS DIFFERENT BETWEEN GT DB AND REF" | tee -a GeometryValidation.log                                                                                  
0429 endif                                                                                                      
0430 
0431 if ( -s CALOLocalError.log ) then                                                               
0432     echo "WARNING THE CALO GEOMETRY IS DIFFERENT BETWEEN LOCAL DB AND REF" | tee -a GeometryValidation.log                                                                                  
0433 endif                                                                                                      
0434                                                                                               
0435 echo "End CALO RECO geometry validation" | tee -a GeometryValidation.log
0436 
0437 echo "Start Simulation geometry validation" | tee -a GeometryValidation.log
0438 
0439 # (MEC:2) see (MEC:1) Since the global tag versus the local database
0440 # blobs have been verified, it is possible to argue that 
0441 # there is really no reason to check those two blobs using this method.
0442 # However, in this test, the actual DDD is built and dumped for each 
0443 # of standard (STD, i.e. the list of smaller xml files), the "BIG" XML
0444 # File (BDB, i.e. the one prepped to become a blob), the local database
0445 # file blob (LocDB, after Big is loaded into the local database), and
0446 # the file blob that comes from the global tag that was provided to the 
0447 # script (GTDB, could be same or older version).
0448 
0449 # Old version. Is it obsolete?
0450 # echo "Here I am " > readXML.expected
0451 # echo "Top Most LogicalPart =cms:OCMS " >> readXML.expected
0452 # echo " mat=materials:Air" >> readXML.expected
0453 # echo " solid=cms:OCMS   Polycone_rrz: 0 6.28319 -450000 0 1000 -27000 0 1000 -27000 0 17500 27000 0 17500 27000 0 1000 450000 0 1000 " >> readXML.expected
0454 # echo "After the GeoHistory in the output file dumpGeoHistoryOnRead you will see x, y, z, r11, r12, r13, r21, r22, r23, r31, r32, r33" >> readXML.expected
0455 # echo "finished" >> readXML.expected
0456 
0457 if ( ${geometry} == GeometryExtended2021 ) then                                                               
0458   cat > readXML.expected <<END_OF_TEXT  
0459 Here I am 
0460 Top Most LogicalPart =cms:OCMS 
0461  mat=materials:Air
0462  solid=cms:OCMS   Box:  xhalf[cm]=10100 yhalf[cm]=10100 zhalf[cm]=45000
0463 After the GeoHistory in the output file dumpGeoHistoryOnRead you will see x, y, z, r11, r12, r13, r21, r22, r23, r31, r32, r33
0464 finished
0465 END_OF_TEXT
0466 
0467 else
0468 
0469   cat > readXML.expected <<END_OF_TEXT  
0470 Here I am 
0471 Top Most LogicalPart =cms:OCMS 
0472  mat=materials:Air
0473  solid=cms:OCMS   Polycone_rrz:  startPhi[deg]=0 dPhi[deg]=360 Sizes[cm]=-45000 0 100 -2700 0 100 -2700 0 1750 2700 0 1750 2700 0 100 45000 0 100 
0474 After the GeoHistory in the output file dumpGeoHistoryOnRead you will see x, y, z, r11, r12, r13, r21, r22, r23, r31, r32, r33
0475 finished
0476 END_OF_TEXT
0477 
0478 endif
0479 
0480 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/readExtendedAndDump.py .
0481 sed -i "{s/GeometryExtended/${geometry}/}" readExtendedAndDump.py >>  GeometryValidation.log
0482 cmsRun readExtendedAndDump.py > readXMLAndDump.log
0483 
0484 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testReadXMLFromGTDB.py .
0485 # cp $CMSSW_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testReadXMLFromGTDB.py .
0486 sed -i "{/process.GlobalTag.globaltag/d}" testReadXMLFromGTDB.py >> GeometryValidation.log
0487 sed -i "{/process.XMLFromDBSource.label/d}" testReadXMLFromGTDB.py >> GeometryValidation.log
0488 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testReadXMLFromGTDB.py >> GeometryValidation.log
0489 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('${condlabel}')" testReadXMLFromGTDB.py >> GeometryValidation.log
0490 cmsRun testReadXMLFromGTDB.py > readXMLfromGTDB.log
0491 
0492 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testReadXMLFromDB.py .
0493 # cp $CMSSW_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testReadXMLFromDB.py .
0494 sed -i "{/process.GlobalTag.globaltag/d}" testReadXMLFromDB.py >> GeometryValidation.log
0495 sed -i "{/process.XMLFromDBSource.label/d}" testReadXMLFromDB.py >> GeometryValidation.log
0496 sed -i "/FrontierConditions_GlobalTag_cff/ a\from Configuration.AlCa.GlobalTag import GlobalTag\nprocess.GlobalTag = GlobalTag(process.GlobalTag, '${gtag}', '')" testReadXMLFromDB.py >> GeometryValidation.log
0497 sed -i "/FrontierConditions_GlobalTag_cff/ a\process.XMLFromDBSource.label = cms.string('')" testReadXMLFromDB.py >> GeometryValidation.log
0498 cmsRun testReadXMLFromDB.py > readXMLfromLocDB.log
0499 
0500 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/readBigXMLAndDump.py .
0501 sed -i "{/geomXMLFiles = cms.vstring('GeometryReaders\/XMLIdealGeometryESSource\/test\/fred.xml'),/d}" readBigXMLAndDump.py >> GeometryValidation.log
0502 sed -i "/XMLIdealGeometryESSource/ a\\t\tgeomXMLFiles=cms.vstring('${workArea}\/geSingleBigFile.xml')," readBigXMLAndDump.py >>  GeometryValidation.log
0503 cmsRun readBigXMLAndDump.py > readBigXMLAndDump.log
0504 
0505 diff readXMLAndDump.log readXML.expected > diffreadXMLSTD.log
0506 diff readXMLfromGTDB.log readXML.expected > diffreadXMLGTDB.log
0507 diff readXMLfromLocDB.log readXML.expected > diffreadXMLLocDB.log
0508 diff readBigXMLAndDump.log readXML.expected > diffreadXMLBDB.log
0509 
0510 if ( -s diffreadXMLSTD.log ) then
0511     echo "ERROR THE MULTI-XML FILE GEOMETRY WAS NOT DUMPED PROPERLY." | tee -a GeometryValidation.log
0512     exit
0513 else
0514     echo "GeometryFile dump from multiple XML files done."
0515 endif
0516 
0517 if ( -s diffreadXMLGTDB.log ) then
0518     echo "ERROR THE GLOBAL TAG DATABASE GEOMETRY WAS NOT DUMPED PROPERLY." | tee -a GeometryValidation.log
0519     exit
0520 else
0521     echo "GeometryFile dump from global tag database done."
0522 endif
0523 
0524 if ( -s diffreadXMLLocDB.log ) then
0525     echo "ERROR THE LOCAL DATABASE GEOMETRY WAS NOT DUMPED PROPERLY." | tee -a GeometryValidation.log
0526     exit
0527 else
0528     echo "GeometryFile dump from local database done."
0529 endif
0530 
0531 if ( -s diffreadXMLBDB.log ) then
0532     echo "ERROR THE BIG SINGLE XML FILE WAS NOT DUMPED PROPERLY." | tee -a GeometryValidation.log
0533     exit
0534 else
0535     echo "GeometryFile dump from big single XML file done."
0536 endif
0537 
0538 #    ,dumpFile1 = cms.string("workarea/xml/dumpSTD")
0539 #    ,dumpFile2 = cms.string("workarea/db/dumpBDB")
0540 #dumpBDB                            dumpGTDB
0541 #dumpLocDB                          dumpSTD
0542 #>>> processing event # run: 1 lumi: 1 event: 1 time 1
0543 #>>> processed 1 events
0544 
0545 echo ">>> processing event # run: 1 lumi: 1 event: 1 time 1" >compDDdumperrors.expected
0546 echo ">>> processed 1 events" >>compDDdumperrors.expected
0547 
0548 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testCompareDumpFiles.py .
0549 sed -i "{/dumpFile1 /d}" testCompareDumpFiles.py
0550 sed -i "{/dumpFile2 /d}" testCompareDumpFiles.py
0551 sed -i "/TestCompareDDDumpFiles/ a\dumpFile1=cms.string\('./dumpSTD'\)\, dumpFile2=cms.string\('./dumpBDB'\)," testCompareDumpFiles.py
0552 cmsRun testCompareDumpFiles.py > tcdfSTDvsBDB.log
0553 
0554 
0555 if (-s tcdfSTDvsBDB.log || -s diffcompSTDvsBDB.log ) then
0556     echo "WARNING THE GEOMETRYFILE IS DIFFERENT BETWEEN STD XML AND BIG SINGLE XML." | tee -a GeometryValidation.log
0557 endif
0558 
0559 rm testCompareDumpFiles.py
0560 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testCompareDumpFiles.py .
0561 sed -i "{/dumpFile1 /d}" testCompareDumpFiles.py
0562 sed -i "{/dumpFile2 /d}" testCompareDumpFiles.py
0563 sed -i "/TestCompareDDDumpFiles/ a\dumpFile1=cms.string\('./dumpSTD'\)\, dumpFile2=cms.string\('./dumpLocDB'\)," testCompareDumpFiles.py
0564 cmsRun testCompareDumpFiles.py > tcdfSTDvsLocDB.log
0565 
0566 diff compDDdumperrors.log compDDdumperrors.expected > diffcompSTDvsLocDB.log
0567 if (-s tcdfSTDvsLocDB.log || -s diffcompSTDvsLocDB.log ) then
0568     echo "WARNING THE GEOMETRYFILE IS DIFFERENT BETWEEN STD XML AND LOCAL DATABASE BLOB." | tee -a GeometryValidation.log
0569 endif
0570 
0571 rm testCompareDumpFiles.py
0572 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testCompareDumpFiles.py .
0573 sed -i "{/dumpFile1 /d}" testCompareDumpFiles.py
0574 sed -i "{/dumpFile2 /d}" testCompareDumpFiles.py
0575 sed -i "/TestCompareDDDumpFiles/ a\dumpFile1=cms.string\('./dumpSTD'\)\, dumpFile2=cms.string\('./dumpGTDB'\)," testCompareDumpFiles.py
0576 cmsRun testCompareDumpFiles.py > tcdfSTDvsGTDB.log
0577 
0578 diff compDDdumperrors.log compDDdumperrors.expected > diffcompSTDvsGTDB.log
0579 if (-s tcdfSTDvsGTDB.log || -s diffcompSTDvsGTDB.log ) then
0580     echo "WARNING THE GEOMETRYFILE IS DIFFERENT BETWEEN STD XML AND GLOBALTAG DATABASE BLOB." | tee -a GeometryValidation.log
0581 endif
0582 
0583 rm testCompareDumpFiles.py
0584 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testCompareDumpFiles.py .
0585 sed -i "{/dumpFile1 /d}" testCompareDumpFiles.py
0586 sed -i "{/dumpFile2 /d}" testCompareDumpFiles.py
0587 sed -i "/TestCompareDDDumpFiles/ a\dumpFile1=cms.string\('./dumpBDB'\)\, dumpFile2=cms.string\('./dumpLocDB'\)," testCompareDumpFiles.py
0588 cmsRun testCompareDumpFiles.py > tcdfBDBvsLocDB.log
0589 
0590 diff compDDdumperrors.log compDDdumperrors.expected > diffcompBDBvsLocDB.log
0591 if (-s tcdfBDBvsLocDB.log || -s diffcompBDBvsLocDB.log ) then
0592     echo "WARNING THE GEOMETRYFILE IS DIFFERENT BETWEEN SINGLE BIG XML FILE AND LOCAL DATABASE BLOB." | tee -a GeometryValidation.log
0593 endif
0594 
0595 rm testCompareDumpFiles.py
0596 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testCompareDumpFiles.py .
0597 sed -i "{/dumpFile1 /d}" testCompareDumpFiles.py
0598 sed -i "{/dumpFile2 /d}" testCompareDumpFiles.py
0599 sed -i "/TestCompareDDDumpFiles/ a\dumpFile1=cms.string\('./dumpBDB'\)\, dumpFile2=cms.string\('./dumpGTDB'\)," testCompareDumpFiles.py
0600 cmsRun testCompareDumpFiles.py > tcdfBDBvsGTDB.log
0601 
0602 diff compDDdumperrors.log compDDdumperrors.expected > diffcompBDBvsGTDB.log
0603 if (-s tcdfBDBvsGTDB.log || -s diffcompBDBvsGTDB.log ) then
0604     echo "WARNING THE GEOMETRYFILE IS DIFFERENT BETWEEN SINGLE BIG XML FILE AND GLOBALTAG DATABASE BLOB."  | tee -a GeometryValidation.log
0605 endif
0606 
0607 rm testCompareDumpFiles.py
0608 cp $CMSSW_RELEASE_BASE/src/GeometryReaders/XMLIdealGeometryESSource/test/testCompareDumpFiles.py .
0609 sed -i "{/dumpFile1 /d}" testCompareDumpFiles.py
0610 sed -i "{/dumpFile2 /d}" testCompareDumpFiles.py
0611 sed -i "/TestCompareDDDumpFiles/ a\dumpFile1=cms.string\('./dumpLocDB'\)\, dumpFile2=cms.string\('./dumpGTDB'\)," testCompareDumpFiles.py
0612 cmsRun testCompareDumpFiles.py > tcdfLocDBvsGTDB.log
0613 
0614 diff compDDdumperrors.log compDDdumperrors.expected > diffcompLocDBvsGTDB.log
0615 if (-s tcdfLocDBvsGTDB.log || -s diffcompLocDBvsGTDB.log ) then
0616     echo "WARNING THE GEOMETRYFILE IS DIFFERENT BETWEEN LOCAL AND GLOBALTAG DATABASE BLOBS."  | tee -a GeometryValidation.log
0617 endif
0618 
0619 echo "End Simulation geometry validation" | tee -a GeometryValidation.log