diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py index ec872d2e4d45128e53852581f1b9324a677bb6b5..ded67f632b6768a9ac2135b6845fb70d2e62f5e8 100644 --- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py +++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/Iterator.py @@ -20,7 +20,7 @@ from distutils import dir_util ##### Here is where the party starts! ######################################################################################################################## def run(whichRich): - start_time = time() + start_time = time() # this is a default, will be updated when the CONFIGURE command is received ### define the communicator who will communicate with the run-control com = Communicator('ALIGNITER') @@ -87,6 +87,7 @@ def run(whichRich): ######################################################################################################################## if command.startswith('configure') and state == State.NOT_READY: print "CONFIGURE command received at " + strftime("%Y-%m-%d %H:%M:%S", gmtime()) + " UTC" + start_time = time() # sets the timer to zero on every CONFIGURE setupHelper = SetupHelper(alignConf) xmlHelper = XMLFileHelper(alignConf) ssretr = SaveSetRetriever("LHCbA", "AligWrk_Rich" + str(whichRich)) @@ -197,7 +198,7 @@ def run(whichRich): print "INFO Alignment has converged after the ", n_it, "th iteration!" else: print "INFO Alignment has reached its maximum number of iterations and has not converged. :(" - elapsed_time = time() - start_time # Elapsed time since run(whichRich) was called + elapsed_time = time() - start_time # Elapsed time since CONFIGURE (not START!) if updateHelper.updateDecision(n_it): updateHelper.updateDB() setupHelper.finalize(conv, n_it, compareXML, elapsed_time, True) @@ -235,7 +236,7 @@ def run(whichRich): elif command.startswith('stop') and state in (State.RUNNING, State.READY): print "STOP command received at " + strftime("%Y-%m-%d %H:%M:%S", gmtime()) + " UTC" - elapsed_time = time() - start_time # Elapsed time since run(whichRich) was called + elapsed_time = time() - start_time # Elapsed time since CONFIGURE (not START!) setupHelper.finalize(conv, n_it, compareXML, elapsed_time, False) state = State.READY elif command.startswith('reset'): diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py index 8f70f662d4b7a6c54c5755e54eee918b6e1262b4..5660334f9ff2a73aeb95415d384d5aef7778a65b 100644 --- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py +++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/RichAnalyzer.py @@ -114,7 +114,9 @@ def patchBrunel(true_online_version, alignConf, n): brunel.CondDBtag = ConditionsMap.CondDBTag brunel.Histograms = "Expert" brunel.DataType = "2016" - brunel.UseDBSnapshot = True + # brunel.UseDBSnapshot = True + # 20180419 - Recommendation by Roel to avoid missing HPD QE error, due to move of QEs to Online DB + brunel.UseDBSnapshot = False brunel.OutputType='NONE' @@ -197,11 +199,11 @@ def patchBrunel(true_online_version, alignConf, n): EventLoopMgr().Warnings = False # Hack by Chris - #print "# Warning using CKThetaQuartzRefractCorrections = [ 0,-0.0001,0 ]" from Configurables import RichRecSysConf rConf = RichRecSysConf("RichOfflineRec") - #rConf.richTools().photonReco().CKThetaQuartzRefractCorrections = [ 0,-0.001,0 ] - rConf.richTools().photonReco().CKThetaQuartzRefractCorrections = [ -0.00625, 0.000247332, 2.9e-5 ] + # 2017-04-18 Chris suggests removing CKThetaQuartzRefractCorrections: + # print "# Warning using CKThetaQuartzRefractCorrections = ( -0.00625, 0.000247332, 2.9e-5 )" + # rConf.richTools().photonReco().CKThetaQuartzRefractCorrections = ( -0.00625, 0.000247332, 2.9e-5 ) rConf.setProp("PidConfig", "None") # Need a postConfigAction to apply the correct condtions @@ -239,7 +241,7 @@ def patchBrunel(true_online_version, alignConf, n): ## 2017-03-22 We now also want our special monitor with RichRecQC "TightMirror" cuts [similar to hacked RichRecQC we used in 2016] to run. ##### RichRecQCConf ("OfflineRichMoni").addMonitor("PhotonMonitoringAlignOnline") # i.e. this is NOT a default monitor ## Added the next line on 2016-04-08, to Open up the CK res plot range, for the Wide photon selection - RichRecQCConf ("OfflineRichMoni").CKThetaResRange = [ 0.05, 0.008, 0.004 ] + RichRecQCConf ("OfflineRichMoni").CKThetaResRange = ( 0.05, 0.008, 0.004 ) ############################################################################################## RichRecQCConf ("OfflineRichMoni").removeMonitor("TracklessRingAngles" ) RichRecQCConf ("OfflineRichMoni").removeMonitor("TracklessRingPeakSearch") @@ -275,7 +277,7 @@ def patchBrunel(true_online_version, alignConf, n): RichAlign.R1NTupleProduce = False deltatheta = alignConf.getProp("deltaThetaWindow")/1000. - RichAlign.DeltaThetaRange = [0.04,deltatheta, deltatheta ] + RichAlign.DeltaThetaRange = [ 0.04, deltatheta, deltatheta ] brunel.OutputLevel = MSG_INFO brunel.PrintFreq = 100 diff --git a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/SetupHelper.py b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/SetupHelper.py index bc6a6127bcb5d2c4a739faf1422524c4bd4b65bb..6f9602357e0e775eb18cb98594c51b5744c2974d 100644 --- a/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/SetupHelper.py +++ b/Rich/RichMirrorAlignmentOnline/python/PyMirrAlignOnline/SetupHelper.py @@ -82,6 +82,9 @@ class SetupHelper: #def writeInLogbook(Fill, activity, updated = False, file2upload=None, version = None, bigVariations=None): def writeInLogbook(self, conv, n_it, elapsed_time, summaryFile, ChangeWRTDBFile, ckResSummaryFile, DBUpdated, nEvents): + hh, r = divmod(elapsed_time, 3600) + mm, ss = divmod(r, 60) + elapsed_time_str = "{:0>2}:{:0>2}:{:05.2f}".format(int(hh),int(mm),ss) host = 'lblogbook.cern.ch' port = 8080 username = 'common Common\\!' @@ -97,14 +100,14 @@ class SetupHelper: text += " for RICH" text += str(self.whichRich) if conv: - text += " converged in " - text += str(elapsed_time) - text += " seconds. " + text += " ran for " + text += elapsed_time_str + text += " and converged. " subject = 'Alignment converged' else: text += " ran for " - text += str(elapsed_time) - text += " seconds and did not converge. " + text += elapsed_time_str + text += " and did not converge. " text += "We processed " text += str(nEvents) text += " events from the RICH" @@ -151,6 +154,10 @@ class SetupHelper: return 0 def writeSummary(self, conv, n_it, elapsed_time, summaryFile, DBUpdated, nEvents): + hh, r = divmod(elapsed_time, 3600) + mm, ss = divmod(r, 60) + elapsed_time_str = "{:0>2}:{:0>2}:{:05.2f}".format(int(hh),int(mm),ss) + import OnlineEnv as Online runs = Online.DeferredRuns hasi = '' @@ -183,7 +190,7 @@ class SetupHelper: args += 'stopToleranceSecZ = ' + str(self.alignConf.getProp('stopToleranceSecZ')) + '\n' args += '\n' args += 'Number of events = ' + str(nEvents) + '\n' - args += 'Elapsed time = ' + str(elapsed_time) + ' seconds' + '\n' + args += 'Elapsed time = ' + elapsed_time_str + '\n' args += 'DB updated = ' + str(DBUpdated) + '\n' f.write(args) f.close()