From 4d5e96616c48c34e4ef151ce8bf21a53e7cd8494 Mon Sep 17 00:00:00 2001 From: Anthony Morley <anthony.morley@cern.ch> Date: Thu, 27 Oct 2016 14:03:02 +0200 Subject: [PATCH] Various updates and fixes (InDetBeamSpotExample-00-00-83) Former-commit-id: f14e6d7673b4806b459d61da8e388d24ee4e2727 --- .../InDetBeamSpotExample/bin/beamspotman.py | 20 +++++++----- .../InDetBeamSpotExample/bin/beamspotnt.py | 11 ++++--- .../InDetBeamSpotExample/cron/cronsetup.sh | 7 +++-- .../python/BeamSpotData.py | 2 +- .../InDetBeamSpotExample/python/COOLUtils.py | 13 ++++---- .../python/ExtractLBFileMap.py | 3 +- .../InDetBeamSpotExample/python/JobRunner.py | 2 +- .../python/PostProcessing.py | 2 ++ .../InDetBeamSpotExample/python/ROOTUtils.py | 25 ++++++--------- .../InDetBeamSpotExample/roofit/ROOTUtils.py | 25 ++++++--------- .../share/ReadInDetRecFragment.py | 31 ++++++++++++++----- .../share/VertexTemplate.py | 10 ++++-- .../InDetBeamSpotExample/www/beamspotnt.py | 11 ++++--- 13 files changed, 91 insertions(+), 71 deletions(-) diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotman.py b/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotman.py index 117dd1c37de..bf131016535 100755 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotman.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotman.py @@ -5,7 +5,7 @@ beamspotman is a command line utility to do typical beam spot related tasks. """ __author__ = 'Juerg Beringer' -__version__ = '$Id: beamspotman.py 759523 2016-07-04 12:49:24Z amorley $' +__version__ = '$Id: beamspotman.py 780766 2016-10-27 14:03:02Z amorley $' __usage__ = '''%prog [options] command [args ...] Commands are: @@ -47,6 +47,7 @@ mctag STATUS POSX POSY POSZ Create an sqlite file containing a MC ta # - authorize USERID # - deauthorize USERID + proddir = '/afs/cern.ch/user/a/atlidbs/jobs' produserfile = '/private/produsers.dat' prodcoolpasswdfile = '/private/coolinfo.dat' @@ -1349,11 +1350,15 @@ if cmd=='runaod' and len(args)==5: elif os.path.isfile(inputdata): # read in the file names from the text file for line in open(inputdata,'r'): + + if line.split('/')[1] == 'castor': + files.append('root://castoratlas/'+line.rstrip()) + else: files.append('root://eosatlas/'+line.rstrip()) - + # Check if files, matching pattern, exist if not files: sys.exit('No files existing in directory %s matching "%s"' % (inputdata, options.filter)) - + # Get file-LB mapping lbMap = {} if options.lbfilemap: @@ -1375,14 +1380,14 @@ if cmd=='runaod' and len(args)==5: jobFileDict = {} jobLBDict = {} jobParams = {} - + if options.pseudoLbFile: # Extract start and end times of real LBs from InDetBeamSpotExample.COOLUtils import COOLQuery coolQuery = COOLQuery() from InDetBeamSpotExample.Utils import getRunFromName lbTimes = coolQuery.getLbTimes( getRunFromName(dsname, None, True) ) - + # Loop over pseudo LBs with open(options.pseudoLbFile) as pLbFile: for line in pLbFile: @@ -1412,7 +1417,6 @@ if cmd=='runaod' and len(args)==5: if not sum([lb for lb in lbs if lb in rlbs]): continue filenames.append(f) - try: jobLBDict[jobId].extend([lb for lb in rlbs if not lb in jobLBDict[jobId]]) jobFileDict[jobId].extend([f for f in filenames if not f in jobFileDict[jobId]]) @@ -1441,7 +1445,7 @@ if cmd=='runaod' and len(args)==5: if not f in jobFileDict[jobId]: jobFileDict[jobId].append(f) jobLBDict[jobId].append(lbnr) - + # Submit bunched jobs for i in sorted(jobFileDict.keys()): jobnr = i*lbperjob+1 # use first LB number as job number @@ -1469,7 +1473,7 @@ if cmd=='runaod' and len(args)==5: inputfiles=files, joboptionpath=jobopts, filesperjob=len(files), - batchqueue='1nw' if options.pseudoLbFile else 'atlasb1', # run on different queue for VdM scans to avoid cloggin up normal queue # '1nw' '2nd' + batchqueue='atlasb1_long' if options.pseudoLbFile else 'atlasb1', # run on different queue for VdM scans to avoid cloggin up normal queue # '1nw' '2nd' addinputtopoolcatalog=True, taskpostprocsteps=options.postprocsteps, autoconfparams='DetDescrVersion', diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotnt.py b/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotnt.py index 52fdbebe6dc..bca59a5fda0 100755 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotnt.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/bin/beamspotnt.py @@ -5,7 +5,7 @@ beamspotnt is a command line utility for beam spot ntuples. """ __author__ = 'Juerg Beringer' -__version__ = '$Id: beamspotnt.py 759523 2016-07-04 12:49:24Z amorley $' +__version__ = '$Id: beamspotnt.py 780766 2016-10-27 14:03:02Z amorley $' __usage__ = '''%prog [options] command [args ...] Commands are: @@ -362,9 +362,13 @@ def fillInMissingLbs(allBSResultsInNt, lbSize): if(lastValidEntry >= 0): if allBSResultsInNt[nextValidEntry].lbStart != allBSResultsInNt[lastValidEntry].lbEnd + 1: - print "Missing Lumi block from {:>5d} to {:>5d}".format( allBSResultsInNt[lastValidEntry].lbEnd, allBSResultsInNt[nextValidEntry].lbStart + 1) + print "Missing Lumi block from {:>5d} to {:>5d}".format( allBSResultsInNt[lastValidEntry].lbEnd + 1 , allBSResultsInNt[nextValidEntry].lbStart) + + if allBSResultsInNt[nextValidEntry].lbStart - allBSResultsInNt[lastValidEntry].lbEnd + 1 > lbSize: print "--Lumi block gap too large wont fill in the gap" + elif (allBSResultsInNt[nextValidEntry].lbStart-1) - (allBSResultsInNt[lastValidEntry].lbEnd+1) < 0 : + print "Missing Lumi block is invalid from {:>5d} to {:>5d}".format( allBSResultsInNt[lastValidEntry].lbEnd+1, allBSResultsInNt[nextValidEntry].lbStart -1) else: varList = ['posX','posY','posZ','sigmaX','sigmaY','sigmaZ','tiltX','tiltY','rhoXY','sigmaXY'] calc = BeamSpotAverage(varList ,weightedAverage=True) @@ -1190,6 +1194,7 @@ if cmd=='merge' and len(args)==2: allBSResultsInNt.sort() if options.useAve: cleanUpLowStat( allBSResultsInNt, averagenVtx, lbSize * 10) + allBSResultsInNt.sort() fillInMissingLbs(allBSResultsInNt, lbSize * 10) for b in allBSResultsInNt: @@ -1370,8 +1375,6 @@ if cmd=='ave' and len(args)==1: cmdOk = True - - # # Different histograms of beam spot variables # diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/cron/cronsetup.sh b/InnerDetector/InDetExample/InDetBeamSpotExample/cron/cronsetup.sh index 32fbc13b1bd..e29de1e7928 100755 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/cron/cronsetup.sh +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/cron/cronsetup.sh @@ -14,13 +14,14 @@ echo "------------------------------" echo "Host name = ${HOSTNAME}" echo "------------------------------" echo "/usr/kerberos/bin/klist:" -/usr/kerberos/bin/klist +#/usr/kerberos/bin/klist +/usr/bin/klist echo "------------------------------" echo "/usr/kerberos/bin/kvno host/lxadm10.cern.ch" -/usr/kerberos/bin/kvno host/lxadm10.cern.ch +/usr/bin/kvno host/lxadm10.cern.ch echo "------------------------------" echo "/usr/sue/bin/tokens" -/usr/sue/bin/tokens +/usr/bin/tokens echo "------------------------------" echo "/usr/bin/id" /usr/bin/id diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py index 5f4a4c864f1..10b4a85d09e 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/BeamSpotData.py @@ -9,7 +9,7 @@ Frontier outside of CERN. For example: setenv FRONTIER_SERVER "(serverurl=http://squid-frontier.usatlas.bnl.gov:23128/frontieratbnl)" """ __author__ = 'Juerg Beringer' -__version__ = '$Id: BeamSpotData.py 759523 2016-07-04 12:49:24Z amorley $' +__version__ = '$Id: BeamSpotData.py 759522 2016-07-04 12:47:58Z amorley $' import time import copy diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py index 5b1075c9405..ab3a004cee2 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/COOLUtils.py @@ -1,11 +1,11 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# $Id: COOLUtils.py 667995 2015-05-19 06:01:05Z mhance $ +# $Id: COOLUtils.py 780766 2016-10-27 14:03:02Z amorley $ """ Miscellaneous utilities related to COOL. """ __author__ = 'Juerg Beringer' -__version__ = '$Id: COOLUtils.py 667995 2015-05-19 06:01:05Z mhance $' +__version__ = '$Id: COOLUtils.py 780766 2016-10-27 14:03:02Z amorley $' import os, time,sys @@ -97,8 +97,6 @@ def writeBeamSpotEntry(folderHandle, tag='nominal', payload['tiltYErr'] = float(tiltYErr) payload['sigmaXYErr'] = float(sigmaXYErr) - - if tag=='HEAD': folderHandle[1].storeObject(since,until,payload,0) else: @@ -122,7 +120,7 @@ def COOLToUnixTime(coolTime): # class COOLQuery: """Utility to query COOL to retrieve start and end time of run and LBs.""" - def __init__(self,useOracle=True,debug=True): + def __init__(self,useOracle=False,debug=True): self.tdaqdbname='COOLONL_TDAQ/CONDBR2' self.coolpath='/TDAQ/RunCtrl' @@ -136,10 +134,13 @@ class COOLQuery: self.oracle = useOracle self.debug = debug + print 'open cool db' self.cooldb = AtlCoolLib.indirectOpen(self.tdaqdbname, True, self.oracle, self.debug) + print 'open cooltrig db' self.cooltrigdb = AtlCoolLib.indirectOpen(self.trigdbname, True, self.oracle, self.debug) + print 'open cooldcs db' self.cooldcsdb = AtlCoolLib.indirectOpen(self.dcsdbname, True, self.oracle, self.debug) - + self.lbDictCache = {'runnr': None, 'lbDict': None} def __del__(self): diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ExtractLBFileMap.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ExtractLBFileMap.py index c02d265a5bb..eba583f8922 100755 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ExtractLBFileMap.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ExtractLBFileMap.py @@ -78,7 +78,6 @@ def extractFromFiles(fileNames): try: f = ROOT.TFile.Open (fileName) assert f.IsOpen() - isNewDataHdr = True tree = f.Get ('MetaDataHdr') @@ -128,6 +127,7 @@ def extractFromFiles(fileNames): lbDict[fname].append(lb) except KeyError: lbDict[fname] = [lb] + #print 'Added lbs for Dict' except Exception, e: print "## Caught exception [%s] !!" % str(e.__class__) @@ -149,5 +149,4 @@ def extractFromFiles(fileNames): print sys.exc_info()[1] sc = 1 pass - return lbDict diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py index c0a7be46d4e..f0584c834ab 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/JobRunner.py @@ -11,7 +11,7 @@ Jobs can run interactively, on different batch systems, or on the Grid. Written by Juerg Beringer (LBNL) in 2008. """ __author__ = 'Juerg Beringer' -__version__ = '$Id: JobRunner.py 759523 2016-07-04 12:49:24Z amorley $' +__version__ = '$Id: JobRunner.py 747883 2016-05-18 06:58:10Z amorley $' import math import os diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py index 1b32e24c727..361fb537458 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/PostProcessing.py @@ -61,6 +61,8 @@ def doPostProcessing(taskman,taskDict,postprocSteps,postprocLib,forceRun=False,j if not postprocSteps: return [] # nothing to do + #update again from DataBase + prePostProcStatus = taskman.getStatus(dsName,taskName) # Don't run postprocessing if status is already postprocessing if prePostProcStatus>=TaskManager.StatusCodes['POSTPROCRUNNING'] and not forceRun: print 'Exiting postprocessing without doing anything: task %s/%s status is %s\n' % (dsName,taskName,getKey(TaskManager.StatusCodes,prePostProcStatus)) diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py index adc2fa19e3b..e23d107be08 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/python/ROOTUtils.py @@ -1,11 +1,11 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# $Id: ROOTUtils.py 721731 2016-02-03 22:26:53Z beringer $ +# $Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $ """ Miscellaneous utilities for PyROOT. """ __author__ = 'Juerg Beringer' -__version__ = '$Id: ROOTUtils.py 721731 2016-02-03 22:26:53Z beringer $' +__version__ = '$Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $' import ROOT @@ -311,26 +311,19 @@ def atlasLabel(x,y,isPreliminary=False,color=1,offset=0.115,isForApproval=False, l.SetTextSize(size) l.SetTextColor(color) l.DrawLatex(x,y,"ATLAS") + + p = ROOT.TLatex() + p.SetNDC() + p.SetTextFont(42) + p.SetTextSize(size) + p.SetTextColor(color) + if customstring != "": - p = ROOT.TLatex() - p.SetNDC() - p.SetTextFont(42) - p.SetTextColor(color) p.DrawLatex(x+offset,y,customstring) else: if (isPreliminary): - p = ROOT.TLatex() - p.SetNDC() - p.SetTextFont(42) - p.SetTextSize(size) - p.SetTextColor(color) p.DrawLatex(x+offset,y,"Preliminary") if (isForApproval): - p = ROOT.TLatex() - p.SetNDC() - p.SetTextFont(42) - p.SetTextSize(size) - p.SetTextColor(color) #p.DrawLatex(x+offset,y,"Internal for approval") p.DrawLatex(x+offset,y,"Internal") diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/roofit/ROOTUtils.py b/InnerDetector/InDetExample/InDetBeamSpotExample/roofit/ROOTUtils.py index adc2fa19e3b..e23d107be08 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/roofit/ROOTUtils.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/roofit/ROOTUtils.py @@ -1,11 +1,11 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# $Id: ROOTUtils.py 721731 2016-02-03 22:26:53Z beringer $ +# $Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $ """ Miscellaneous utilities for PyROOT. """ __author__ = 'Juerg Beringer' -__version__ = '$Id: ROOTUtils.py 721731 2016-02-03 22:26:53Z beringer $' +__version__ = '$Id: ROOTUtils.py 759047 2016-07-01 00:45:13Z beringer $' import ROOT @@ -311,26 +311,19 @@ def atlasLabel(x,y,isPreliminary=False,color=1,offset=0.115,isForApproval=False, l.SetTextSize(size) l.SetTextColor(color) l.DrawLatex(x,y,"ATLAS") + + p = ROOT.TLatex() + p.SetNDC() + p.SetTextFont(42) + p.SetTextSize(size) + p.SetTextColor(color) + if customstring != "": - p = ROOT.TLatex() - p.SetNDC() - p.SetTextFont(42) - p.SetTextColor(color) p.DrawLatex(x+offset,y,customstring) else: if (isPreliminary): - p = ROOT.TLatex() - p.SetNDC() - p.SetTextFont(42) - p.SetTextSize(size) - p.SetTextColor(color) p.DrawLatex(x+offset,y,"Preliminary") if (isForApproval): - p = ROOT.TLatex() - p.SetNDC() - p.SetTextFont(42) - p.SetTextSize(size) - p.SetTextColor(color) #p.DrawLatex(x+offset,y,"Internal for approval") p.DrawLatex(x+offset,y,"Internal") diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py b/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py index 5cc476c1994..e79da5cfbae 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/share/ReadInDetRecFragment.py @@ -1,4 +1,4 @@ -# $Id: ReadInDetRecFragment.py 714548 2015-12-14 16:30:23Z amorley $ +# $Id: ReadInDetRecFragment.py 780766 2016-10-27 14:03:02Z amorley $ # # Job option fragment for JobRunner templates to setup InDet # environment following InDetRecExample/ReadInDet_jobOptions.py @@ -9,7 +9,7 @@ # # Written by Juerg Beringer in November 2009. # -print "InDetBeamSpotExample INFO Using $Id: ReadInDetRecFragment.py 714548 2015-12-14 16:30:23Z amorley $" +print "InDetBeamSpotExample INFO Using $Id: ReadInDetRecFragment.py 780766 2016-10-27 14:03:02Z amorley $" # Default values (please put a default for EACH jobConfig parameter @@ -63,7 +63,7 @@ if not 'griduser' in jobConfig: jobConfig['griduser'] = '' readESD = jobConfig['doPatternRecoAndTracking'] or jobConfig['doPrimaryVertexing'] readAOD = not readESD doWriteESD = False and readESD -doWriteAOD = jobConfig['doPatternRecoAndTracking'] or jobConfig['doPrimaryVertexing'] or jobConfig['doForceWriteDPD'] +doWriteAOD = False # jobConfig['doPatternRecoAndTracking'] or jobConfig['doPrimaryVertexing'] or jobConfig['doForceWriteDPD'] print jobConfig['inputfiles'] @@ -80,9 +80,9 @@ doRefitTracks = False and readESD # --- redo the pattern reco and the tracking (do not use that in conjunction with doRefitTracks above) redoPatternRecoAndTracking = jobConfig['doPatternRecoAndTracking'] and not doRefitTracks and readESD # --- redo primary vertexing (will be set to true later automatically if you redid the tracking and want to redo the TrackParticle creation) -reDoPrimaryVertexing = jobConfig['doPrimaryVertexing'] or redoPatternRecoAndTracking or jobConfig['doVertexStandalone'] +reDoPrimaryVertexing = False #jobConfig['doPrimaryVertexing'] or redoPatternRecoAndTracking or jobConfig['doVertexStandalone'] # --- redo particle creation (recommended after revertexing on ESD, otherwise trackparticles are inconsistent) -reDoParticleCreation = (redoPatternRecoAndTracking or reDoPrimaryVertexing) and not jobConfig['doVertexStandalone'] +reDoParticleCreation = False #(redoPatternRecoAndTracking or reDoPrimaryVertexing) and not jobConfig['doVertexStandalone'] # --- redo conversion finding reDoConversions = False # --- redo V0 finding @@ -172,8 +172,8 @@ if not jobConfig['hasMag']: from AthenaCommon.DetFlags import DetFlags from InDetRecExample.InDetJobProperties import InDetFlags # --- switch on InnerDetector -#DetFlags.ID_setOn() -DetFlags.ID_setOff() +DetFlags.ID_setOn() +#DetFlags.ID_setOff() # --- and switch off all the rest DetFlags.Calo_setOff() DetFlags.Muon_setOff() @@ -195,7 +195,8 @@ if not jobConfig['hasSCT']: else: DetFlags.SCT_setOff() DetFlags.detdescr.SCT_setOn() -#DetFlags.TRT_setOff() + +DetFlags.TRT_setOff() #DetFlags.detdescr.TRT_setOn() # --- printout if jobConfig['doPrintIndetConfig']: @@ -247,6 +248,10 @@ InDetFlags.doRefit = doRefitTracks InDetFlags.doLowBetaFinder = False InDetFlags.doPrintConfigurables = jobConfig['doPrintIndetConfig'] +### Key flag -- this will create the unconstrained beamspot collection on the fly from standard xAOD::TrackParticles +InDetFlags.doVertexFindingForMonitoring = jobConfig['doPrimaryVertexing'] + + # Standard monitoring InDetFlags.doMonitoringGlobal = jobConfig['doMonitoringGlobal'] @@ -297,6 +302,16 @@ if jobConfig['doPrintIndetConfig']: InDetKeys.print_JobProperties() +if jobConfig['doPrimaryVertexing'] : + jobConfig['VertexContainer'] = InDetKeys.PrimaryVerticesWithoutBeamConstraint() + from OutputStreamAthenaPool.MultipleStreamManager import MSMgr + RefittedVertexStream = MSMgr.NewPoolRootStream( "RefittedVertexStream", "RefittedVertex.pool.root" ) + RefittedVertexStream.AddItem( 'xAOD::VertexContainer#'+InDetKeys.PrimaryVerticesWithoutBeamConstraint() ) + RefittedVertexStream.AddItem( 'xAOD::VertexAuxContainer#'+InDetKeys.PrimaryVerticesWithoutBeamConstraint()+'Aux.-vxTrackAtVertex' ) + RefittedVertexStream.AddItem( 'xAOD::EventInfo#EventInfo' ) + RefittedVertexStream.AddItem( 'xAOD::EventAuxInfo#EventInfoAux.' ) + + #-------------------------------------------------------------- # enable statistics for reading ESD testing #-------------------------------------------------------------- diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/share/VertexTemplate.py b/InnerDetector/InDetExample/InDetBeamSpotExample/share/VertexTemplate.py index 4108122b1a9..7de91c68759 100644 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/share/VertexTemplate.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/share/VertexTemplate.py @@ -1,11 +1,11 @@ -# $Id: VertexTemplate.py 714548 2015-12-14 16:30:23Z amorley $ +# $Id: VertexTemplate.py 780766 2016-10-27 14:03:02Z amorley $ # # Top-level job options file to run the vertex-based beamspot algorithm # from AOD files using a JobRunner. # # Written by Juerg Beringer in July 2008. # -print "InDetBeamSpotExample INFO Using $Id: VertexTemplate.py 714548 2015-12-14 16:30:23Z amorley $" +print "InDetBeamSpotExample INFO Using $Id: VertexTemplate.py 780766 2016-10-27 14:03:02Z amorley $" # Default values (please put a default for EACH jobConfig parameter # so that the template can be used easily without JobRunner) @@ -61,6 +61,8 @@ if not 'BeamSpotToolList' in jobConfig: jobConfig['BeamSpotToolList #Fit Options for RooFit only if not 'RooFitMaxTransverseErr' in jobConfig: jobConfig['RooFitMaxTransverseErr'] = 0.05 +if not 'FixWidth' in jobConfig: jobConfig['FixWidth'] = False + # General job setup include("InDetBeamSpotExample/AutoConfFragment.py") include("InDetBeamSpotExample/ReadInDetRecFragment.py") @@ -89,17 +91,21 @@ ToolSvc += CfgMgr.InDet__InDetBeamSpotVertex(name = 'InDetBeamSpotVer OutlierRhoFail = 0.8, InitParK = jobConfig['InitialKFactor'], FixParK = jobConfig['ConstantKFactor'], + FixWidth = jobConfig['FixWidth'], TruncatedRMS = jobConfig['TruncatedRMS'], SetInitialRMS = jobConfig['SetInitialRMS'], OutputLevel = min(INFO,jobConfig['outputlevel'])) +print ToolSvc.InDetBeamSpotVertex + ToolSvc += CfgMgr.InDet__InDetBeamSpotRooFit(name = 'InDetBeamSpotRooFit', OutputLevel = min(INFO,jobConfig['outputlevel']), InitialKFactor = jobConfig['InitialKFactor'], ConstantKFactor = jobConfig['ConstantKFactor'], vtxResCut = jobConfig['RooFitMaxTransverseErr']) +print ToolSvc.InDetBeamSpotRooFit topSequence += CfgMgr.InDet__InDetBeamSpotFinder(name = 'InDetBeamSpotFinder', #job options diff --git a/InnerDetector/InDetExample/InDetBeamSpotExample/www/beamspotnt.py b/InnerDetector/InDetExample/InDetBeamSpotExample/www/beamspotnt.py index 52fdbebe6dc..bca59a5fda0 100755 --- a/InnerDetector/InDetExample/InDetBeamSpotExample/www/beamspotnt.py +++ b/InnerDetector/InDetExample/InDetBeamSpotExample/www/beamspotnt.py @@ -5,7 +5,7 @@ beamspotnt is a command line utility for beam spot ntuples. """ __author__ = 'Juerg Beringer' -__version__ = '$Id: beamspotnt.py 759523 2016-07-04 12:49:24Z amorley $' +__version__ = '$Id: beamspotnt.py 780766 2016-10-27 14:03:02Z amorley $' __usage__ = '''%prog [options] command [args ...] Commands are: @@ -362,9 +362,13 @@ def fillInMissingLbs(allBSResultsInNt, lbSize): if(lastValidEntry >= 0): if allBSResultsInNt[nextValidEntry].lbStart != allBSResultsInNt[lastValidEntry].lbEnd + 1: - print "Missing Lumi block from {:>5d} to {:>5d}".format( allBSResultsInNt[lastValidEntry].lbEnd, allBSResultsInNt[nextValidEntry].lbStart + 1) + print "Missing Lumi block from {:>5d} to {:>5d}".format( allBSResultsInNt[lastValidEntry].lbEnd + 1 , allBSResultsInNt[nextValidEntry].lbStart) + + if allBSResultsInNt[nextValidEntry].lbStart - allBSResultsInNt[lastValidEntry].lbEnd + 1 > lbSize: print "--Lumi block gap too large wont fill in the gap" + elif (allBSResultsInNt[nextValidEntry].lbStart-1) - (allBSResultsInNt[lastValidEntry].lbEnd+1) < 0 : + print "Missing Lumi block is invalid from {:>5d} to {:>5d}".format( allBSResultsInNt[lastValidEntry].lbEnd+1, allBSResultsInNt[nextValidEntry].lbStart -1) else: varList = ['posX','posY','posZ','sigmaX','sigmaY','sigmaZ','tiltX','tiltY','rhoXY','sigmaXY'] calc = BeamSpotAverage(varList ,weightedAverage=True) @@ -1190,6 +1194,7 @@ if cmd=='merge' and len(args)==2: allBSResultsInNt.sort() if options.useAve: cleanUpLowStat( allBSResultsInNt, averagenVtx, lbSize * 10) + allBSResultsInNt.sort() fillInMissingLbs(allBSResultsInNt, lbSize * 10) for b in allBSResultsInNt: @@ -1370,8 +1375,6 @@ if cmd=='ave' and len(args)==1: cmdOk = True - - # # Different histograms of beam spot variables # -- GitLab