From 04a362bed63d49bcb14cb080836e4882ce52007d Mon Sep 17 00:00:00 2001 From: Salvador Marti Date: Mon, 15 Apr 2019 22:33:42 +0200 Subject: [PATCH 1/8] acZmumu.py: improved run number handling --- .../AutomatedCheck/acZmumu.py | 50 ++++++++-- .../share/runzmumu_UserConstants.py | 95 +++++++++++-------- 2 files changed, 97 insertions(+), 48 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py index 84c7eac41ae..f1c8b72ed90 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py @@ -6,7 +6,8 @@ m_athenaVersion = "" m_testArea = "" m_theUser = "" m_scriptName = "runzmumu_UserConstants.py" -m_savingFile = "acZmumu_commands.txt" +m_savingFile = "acZmumu_history.txt" +m_reconmerge = "merge" #"%" # options m_minEvents = 10000 @@ -19,6 +20,7 @@ m_dataType = "DESDM_MCP" m_dataProject = "data17_13TeV" m_userFiles = 0 # this means all the files m_amitag = "%" +m_physicsType = "physics_Main" ################################################################################################### def findListOfDataSets(): @@ -26,8 +28,10 @@ def findListOfDataSets(): listOfDataSets = [] #ami list datasets data18_13TeV.%.physics_Main.merge.DESDM_ZMUMU% - theAMIsearchCommand = "ami list datasets %s.%%.physics_Main.merge.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_dataType, m_amitag) - #theAMIsearchCommand = "ami list datasets %s.%%.physics_Main.merge.%s.%%" %(m_dataProject, m_dataType) + #theAMIsearchCommand = "ami list datasets %s.%%.physics_Main.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_reconmerge, m_dataType, m_amitag) + #theAMIsearchCommand = "ami list datasets %s.%%.%s.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_physicsType, m_reconmerge, m_dataType, m_amitag) + theAMIsearchCommand = "ami list datasets %s.%%.%s.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_physicsType, m_reconmerge, m_dataType, m_amitag) + #theAMIsearchCommand = "ami list datasets %s.%%.physics_HardProbes.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_reconmerge, m_dataType, m_amitag) print (" AMI data set search command: \n --> %s" %(theAMIsearchCommand)) amiReturn = os.popen(theAMIsearchCommand).readlines() @@ -83,6 +87,7 @@ def getYear (): ################################################################################################### def preliminaries (): import os + import sys global m_storingFolder global m_athenaVersion global m_testArea @@ -109,6 +114,11 @@ def preliminaries (): m_storingFolder = folderName print (" Storing output in folder: %s" %(m_storingFolder)) + # verify proper order of run numbers + if (m_lastRun < m_firstRun): + print (" ** ERROR ** last run %d < first run %d \n" %(m_lastRun, m_firstRun)) + sys.exit(" >> STOP excution due to bad run number ordering") + return ################################################################################################### @@ -222,14 +232,14 @@ def crossCheckInfo(infoFromAMI, infoFromRecordsFile): if (runInAMI == runInFile): runFound = True print (" crosscheckInfo: ami run %d found in file list? %r" %(runInAMI,runFound)) - if (not runFound or runToAdd): + if (not runFound): listOfNewRuns.append(runInAMI) - else: + #else: # maybe run is found but the analysis is not completed # the logics must be formulated - if ("NEW" in infoFromRecordsFile[runInFile]["status"]): - # this run is pending - listOfPendingRuns.append(runInAMI) + #if ("NEW" in infoFromRecordsFile[runInFile]["status"]): + # this run is pending + #listOfPendingRuns.append(runInAMI) print (" List of new runs has: %d items " %len(listOfNewRuns)) @@ -280,6 +290,7 @@ def submitGridJobs (infoFromAMI, listOfNewRuns, listOfPendingRuns): theCommand = getGridSubmissionCommand(runNumber, infoFromAMI) print (" GRID submission command: \n %s" %(theCommand)) listOfSubmittedRuns.append(runNumber) + print (" testArea: %s" %(m_testArea)) if (m_submitExec): print (" m_submitExec = True --> jobs would be submmited"); # move to the submission folder @@ -300,6 +311,20 @@ def getAthenaBasics (): testArea = "" try: testArea = os.getenv("TestArea","") + # make sure this points to the athena folder + if ("athena" not in testArea.split()[-1]): + tempTestArea = testArea.split("/") + #print "tempTestArea = ", tempTestArea + #print " old last = ", tempTestArea[-1] + tempTestArea[-1] = "athena" + # reform the string + #print " new last = ", tempTestArea[-1] + newTestArea = "" + for tempword in tempTestArea: + if (len(tempword)>0): + newTestArea = "%s/%s" %(newTestArea, tempword) + #print " newTestArea: %s" %newTestArea + testArea = newTestArea except: print (" ERROR ** no Athena TestArea defined --> job submission is not possible. STOP execution") exit() @@ -346,9 +371,10 @@ def getGridSubmissionCommand(runNumber, infoFromAMI): theInput = "--inDS=%s" %(infoFromAMI[runNumber]["dataset"]) theOutput = "--outDS=user.%s.%s_%s_%d_Zmumu_%s_%d " %(m_theUser, m_athenaVersion, m_dataProject, runNumber, m_userLabel, infoFromAMI[runNumber]["attempt"]) #theOptions = "--nfiles %d --useShortLivedReplicas --forceStaged --nFilesPerJob %d" %(infoFromAMI[runNumber]["nfiles"], 20) - theOptions = "--nfiles %d --useShortLivedReplicas --forceStaged" %(infoFromAMI[runNumber]["nfiles"]) + theOptions = "--nfiles %d --useShortLivedReplicas --forceStaged --excludedSite=ANALY_HPC2N,ANALY_RHUL_SL6,ANALY_IHEP" %(infoFromAMI[runNumber]["nfiles"]) theCommand = "pathena %s %s %s %s" %(theScript, theInput, theOutput, theOptions) + print "%s " %theCommand return theCommand @@ -379,6 +405,7 @@ def welcomeBanner (): print (" ** min events: %d" %m_minEvents) print (" ** min Run: %d" %m_firstRun) print (" ** max Run: %d" %m_lastRun) + print (" ** physics type: %s" %m_physicsType) print (" ** data type: %s" %m_dataType) if (m_userFiles == 0): print (" ** use all available files ") @@ -409,6 +436,7 @@ def optParsing(): p_userFiles = m_userFiles p_amitag = m_amitag p_dataProject = m_dataProject + p_physicsType = m_physicsType parser = OptionParser() parser.add_option("--amiTag", dest="p_amitag", help="Name of the requested AMI tag (example: r10258_r10258_p3399). Wild card is also possible. Default %s" %(p_amitag), default = p_amitag) @@ -418,8 +446,9 @@ def optParsing(): parser.add_option("--firstRun", dest="p_firstRun", help="First run number (inclusive). Default %s" %(p_firstRun), default = p_firstRun) parser.add_option("--lastRun", dest="p_lastRun", help="Last run number (inclusive). Default %s" %(p_lastRun), default = p_lastRun) parser.add_option("--minEvents", dest="p_minEvents", help="Minimum number of events. Default %s" %(p_minEvents), default = p_minEvents) - parser.add_option("--run", dest="p_userRun", help="Run number in case of targetting a single run. Default %s" %(p_userRun), default = p_userRun) parser.add_option("--nFiles", dest="p_userFiles", help="User defined number of files. Default %s = all the available files" %(p_userFiles), default = p_userFiles) + parser.add_option("--run", dest="p_userRun", help="Run number in case of targetting a single run. Default %s" %(p_userRun), default = p_userRun) + parser.add_option("--physicsType", dest="p_physicsType", help="Physics type to use (physics_Main, Hardprobes...) Default %s" %(p_physicsType), default = p_physicsType) parser.add_option("--userLabel", dest="p_userLabel", help="User defined label. Default %s" %(p_userLabel), default = p_userLabel) (config, sys.argv[1:]) = parser.parse_args(sys.argv[1:]) @@ -474,6 +503,7 @@ if __name__ == '__main__': m_userFiles = int(config.p_userFiles) m_amitag = config.p_amitag m_dataProject = config.p_dataProject + m_physicsType = config.p_physicsType welcomeBanner () preliminaries () diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py index 9c87fc18348..91cd6eb41cd 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py @@ -12,7 +12,7 @@ print ' == runzmumu == Rel21 init command: ',theCommand print ' output: ', theOutput # WorkDir_PLATFORM = "x86_64-slc6-gcc62-opt" -Athena_VERSION = "21.0.68" +Athena_VERSION = "21.0.69" try: WorkDir_PLATFORM= os.getenv("WorkDir_PLATFORM") except: @@ -20,7 +20,7 @@ except: try: Athena_VERSION = os.getenv("Athena_VERSION") except: - Athena_VERSION = "21.0.68" + Athena_VERSION = "21.0.69" ############################### # enable outputs zmumuval = True @@ -32,20 +32,22 @@ monitoringAllTracks = True useGRL = False # MC -MC_bool = False +MC_bool = True # do Trigger DoTrigger = False # where to run -grid = True +grid_bool = False # handle input constants -readPool = True -readLocalDynamicDB = True +readPool = False # default True +readLocalDynamicDB = False # default False -inputConstants = "step7_Iter1_AlignmentConstants.root" -inputdb = "step7_Iter1_mycool.db" +#inputConstants = "step8_Iter1_AlignmentConstants.root" +#inputdb = "step8_Iter1_mycool.db" +inputConstants = "ReAlign_2018_L6_Step28_L3.root" +inputdb = "Javi_Test_mycool.db" #inputConstants = "MisalignmentSet11_p01.pool.root" #inputConstants = "AlignmentConstants_Galo_2018BaseLine.root" if (readPool): @@ -68,12 +70,12 @@ if (MC_bool): useIDADynamicFolders = False # dynamic folders must be disabled in print ' ========= runzmumu === config == start == ' print ' == MC_bool =', MC_bool +print ' == grid_bool =', grid_bool print ' == globalAlignmentMon = ', globalAlignmentMon print ' == useConfigConditions = ', useConfigConditions print ' == useWeightInMonitoring =', useWeightInMonitoring print ' == useIDADynamicFolders =', useIDADynamicFolders print ' == useGRL =', useGRL -print ' == grid =',grid print ' == readPool =',readPool if (readPool): print ' == inputConstants =',inputConstants @@ -84,7 +86,7 @@ print ' ========= runzmumu === config == end == ' #include("InDetSimpleVisual/GetDetectorPositions.py") -if grid == True: +if (grid_bool): #PoolInput = [ "/afs/cern.ch/work/w/wollrath/private/IDAlignment/inputFiles/data16_13TeV/AOD.11063137._018527.pool.root.1" ] #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1"] #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data15_5TeV/DESDM_ZMUMU.11207033._000001.pool.root.1"] @@ -93,24 +95,28 @@ if grid == True: #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0027.1", # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0028.1", # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0029.1"] - PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0027.1", - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0127.1"] + #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0027.1", + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0127.1"] + #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/ZmumuAOD2018/data18_13TeV.00358395.physics_Main.merge.DAOD_ZMUMU.f961_m1831_f961_m2018._0027.1"] + PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/InputFileForGridJobs/data18_13TeV.00348354.physics_Main.merge.DESDM_ZMUMU.f920_m1831_f920_m1951._0001.1"] + else: #PoolInput = [ "/home/jw1095/storage/IDAlignment/inputFiles/data17_13TeV/data17_13TeV.00327265.physics_Main.merge.DESDM_ZMUMU.f832_m1616_f832_m1816._0518.1" ] if (MC_bool): - PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1" - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001884.pool.root.1", - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001883.pool.root.1", - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001300.pool.root.1", - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001200.pool.root.1", - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001100.pool.root.1", - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001101.pool.root.1", - "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001000.pool.root.1"] + PoolInput = ["/eos/user/m/martis/data/mc16_13TeV/folder_mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.ESD.e3601_s3126_r10201/ESD.13642341._000503.pool.root.1"] + # PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1" + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001884.pool.root.1", + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001883.pool.root.1", + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001300.pool.root.1", + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001200.pool.root.1", + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001100.pool.root.1", + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001101.pool.root.1", + # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001000.pool.root.1"] else: PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data16_13TeV/data16_13TeV.00303338.physics_Main.merge.DESDM_MCP.f716_m1624._0001.1"] -EvtMax= -1 -#EvtMax= 100 +#EvtMax= -1 +EvtMax= 100 SkipEvents = 0 @@ -145,7 +151,8 @@ myConditionsTag = "auto-configured" if (useConfigConditions): if not MC_bool: # --> real data #myConditionsTag = "CONDBR2-BLKPA-2016-21" # Hide 21/03/17 - myConditionsTag = "CONDBR2-BLKPA-2018-07" + #myConditionsTag = "CONDBR2-BLKPA-2018-07" + myConditionsTag = "CONDBR2-BLKPA-2018-04" # For Javi test (27/August/2018) print " == runzmumu == globalflags.ConditionsTag -> manually configured to ", myConditionsTag globalflags.ConditionsTag.set_Value_and_Lock(myConditionsTag) #else: @@ -209,19 +216,18 @@ DetFlags.Muon_setOn() from IOVDbSvc.CondDB import conddb if (useIDADynamicFolders): if (False): - print (" == runzmumu == configuring data17_1stBatch_Initial family ") - conddb.addOverride("/Indet/AlignL1/ID" ,"InDetAlignL1_ID_R2dynamic_data17_1stBatch_Initial") - conddb.addOverride("/Indet/AlignL2/PIX" ,"InDetAlignL2PIX_R2dynamic_data17_1stBatch_Initial") - conddb.addOverride("/Indet/AlignL2/SCT" ,"InDetAlignL2SCT_R2dynamic_data17_1stBatch_Initial") - conddb.addOverride("/Indet/AlignL3" ,"InDetAlignL3_R2dynamic_data17_1stBatch_Initial") - conddb.addOverride("/Indet/IBLDist", "InDetAlignIBLDist_R2dynamic_data17_2ndBatch_Initial") - conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1_R2dynamic_data17_1stBatch_Initial") - conddb.addOverride("/TRT/AlignL2", "TRTAlignL2_R2dynamic_data17_1stBatch_Initial") - if (True): + print (" == runzmumu == configuring 2018 ReAlign family ") + conddb.addOverride("/Indet/AlignL1/ID" ,"IndetAlignL1ID-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/AlignL2/PIX" ,"IndetAlignL2PIX-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/AlignL2/SCT" ,"IndetAlignL2SCT-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/AlignL3" ,"IndetIBLDist-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/IBLDist", "IndetAlignL3-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/TRT/AlignL2", "TRTAlignL2-R2dynamic_2018_ReAlign_Initial") + if (False): if readPool : conddb.blockFolder("/Indet/AlignL3") conddb.blockFolder("/TRT/AlignL2") - if readLocalDynamicDB : conddb.blockFolder("/Indet/AlignL1/ID") conddb.blockFolder("/Indet/AlignL2/PIX") @@ -234,6 +240,18 @@ if (useIDADynamicFolders): conddb.addFolderWithTag('','sqlite://X;schema='+inputdb+';dbname=CONDBR2/Indet/AlignL2/SCT','IndetL2SCTTest',True); conddb.addFolderWithTag('','sqlite://X;schema='+inputdb+';dbname=CONDBR2/TRT/AlignL1/TRT','IndetL1TRTTest',True); conddb.addFolderWithTag('','sqlite://X;schema='+inputdb+';dbname=CONDBR2/Indet/IBLDist','IndetIBLDist',True); + + if (False): # --> ReAlign 2018 default True + print (" == runzmumu == tags + SiL3 + TRTL2.... ") + conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/AlignL2/SCT", "IndetAlignL2SCT-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/IBLDist", "IndetIBLDist-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1-R2dynamic_2018_ReAlign_Initial") + if readPool : + conddb.blockFolder("/Indet/AlignL3") + conddb.blockFolder("/TRT/AlignL2") + ## @@ -306,7 +324,7 @@ if zmumuval == True: OutputTracksName = "SelectedMuons", isMC = MC_bool, # If set to True, the truth parameters will be filled, have a look into FillTruthParameters doRefit = True, #True for evaluation of new alignment constants / False for update of weak mode recommendations -- refits tracks according to provided conditions db and/or external root file containing alignment constants - doIPextrToPV = False, # True for IP resolution studies, extrapolates IP parameters to primary vertex + doIPextrToPV = True, # True for IP resolution studies, extrapolates IP parameters to primary vertex UseTrackSelectionTool = False, # If set to True, it will use the specified TrackSelectionTool in the next Line TrackSelectionTool = m_TrackSelectorTool_TightPrimary, TrackParticleName = 'InnerDetectorTrackParticles', # Currently does not do anything, code fills IndetTrackParticles and CombinedTrackParticles Trees @@ -318,10 +336,10 @@ if zmumuval == True: doIsoSelection = True, doIPSelection = True, #loose selection to have Z and JPsi in the n tuple - MassWindowLow = 50., - MassWindowHigh = 140., - PtLeadingMuon = 15., - PtSecondMuon = 15., + MassWindowLow = 1., + MassWindowHigh = 180., + PtLeadingMuon = 4., #15., + PtSecondMuon = 4., #15., OpeningAngle = 0.01, # in radians. 1 radian ~60 deg OutputLevel = INFO) job += iDPerfMonZmumu @@ -389,3 +407,4 @@ if (zmumuval and globalAlignmentMon): StoreGateSvc = Service("StoreGateSvc") StoreGateSvc.Dump = False # True in case of debug ** WARNING ** very large output include("InDetPerformanceMonitoring/TrackMonitoring.py") + #include("TrackMonitoring.py") -- GitLab From 7ccca5629766d4d083161ce83a58bf8395291a56 Mon Sep 17 00:00:00 2001 From: Salvador Marti Date: Wed, 17 Apr 2019 15:09:19 +0200 Subject: [PATCH 2/8] acZmumu.py: remove some excluded sites from the list --- .../InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py index f1c8b72ed90..33f6cd32088 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py @@ -21,6 +21,7 @@ m_dataProject = "data17_13TeV" m_userFiles = 0 # this means all the files m_amitag = "%" m_physicsType = "physics_Main" +m_isMC = False ################################################################################################### def findListOfDataSets(): @@ -292,7 +293,7 @@ def submitGridJobs (infoFromAMI, listOfNewRuns, listOfPendingRuns): listOfSubmittedRuns.append(runNumber) print (" testArea: %s" %(m_testArea)) if (m_submitExec): - print (" m_submitExec = True --> jobs would be submmited"); + print (" m_submitExec = True --> job to be submmited"); # move to the submission folder submissionPath = "%s/run" %(m_testArea) os.chdir(submissionPath) @@ -371,7 +372,7 @@ def getGridSubmissionCommand(runNumber, infoFromAMI): theInput = "--inDS=%s" %(infoFromAMI[runNumber]["dataset"]) theOutput = "--outDS=user.%s.%s_%s_%d_Zmumu_%s_%d " %(m_theUser, m_athenaVersion, m_dataProject, runNumber, m_userLabel, infoFromAMI[runNumber]["attempt"]) #theOptions = "--nfiles %d --useShortLivedReplicas --forceStaged --nFilesPerJob %d" %(infoFromAMI[runNumber]["nfiles"], 20) - theOptions = "--nfiles %d --useShortLivedReplicas --forceStaged --excludedSite=ANALY_HPC2N,ANALY_RHUL_SL6,ANALY_IHEP" %(infoFromAMI[runNumber]["nfiles"]) + theOptions = "--nfiles %d --useShortLivedReplicas --forceStaged --excludedSite=ANALY_HPC2N" %(infoFromAMI[runNumber]["nfiles"]) theCommand = "pathena %s %s %s %s" %(theScript, theInput, theOutput, theOptions) print "%s " %theCommand @@ -401,6 +402,7 @@ def welcomeBanner (): print ("\n") print (" config:") print (" ** Exec: %r" %m_submitExec) + print (" ** using MC? %r" %m_isMC) print (" ** data project: %s " %m_dataProject) print (" ** min events: %d" %m_minEvents) print (" ** min Run: %d" %m_firstRun) @@ -437,6 +439,7 @@ def optParsing(): p_amitag = m_amitag p_dataProject = m_dataProject p_physicsType = m_physicsType + p_isMC = m_isMC parser = OptionParser() parser.add_option("--amiTag", dest="p_amitag", help="Name of the requested AMI tag (example: r10258_r10258_p3399). Wild card is also possible. Default %s" %(p_amitag), default = p_amitag) @@ -445,6 +448,7 @@ def optParsing(): parser.add_option("--EXEC", dest="p_submitExec", help="Submit the Grid jobs. Default: no submission", action="store_true", default = False) parser.add_option("--firstRun", dest="p_firstRun", help="First run number (inclusive). Default %s" %(p_firstRun), default = p_firstRun) parser.add_option("--lastRun", dest="p_lastRun", help="Last run number (inclusive). Default %s" %(p_lastRun), default = p_lastRun) + parser.add_option("--MC", dest="p_isMC", help="Use MC. The data set must be provided in full. Default: no MC", action="store_true", default = p_isMC) parser.add_option("--minEvents", dest="p_minEvents", help="Minimum number of events. Default %s" %(p_minEvents), default = p_minEvents) parser.add_option("--nFiles", dest="p_userFiles", help="User defined number of files. Default %s = all the available files" %(p_userFiles), default = p_userFiles) parser.add_option("--run", dest="p_userRun", help="Run number in case of targetting a single run. Default %s" %(p_userRun), default = p_userRun) @@ -504,6 +508,7 @@ if __name__ == '__main__': m_amitag = config.p_amitag m_dataProject = config.p_dataProject m_physicsType = config.p_physicsType + m_isMC = config.p_isMC welcomeBanner () preliminaries () -- GitLab From b3e442ebbf2e2871dd354a5f27550effa9f57024 Mon Sep 17 00:00:00 2001 From: Salvador Marti Date: Wed, 17 Apr 2019 15:10:20 +0200 Subject: [PATCH 3/8] IDPerfMonZmumu: add some protection to avoid NULL pointers --- .../IDPerfMonZmumu.h | 8 +- .../src/IDPerfMonZmumu.cxx | 99 ++++++++++++++----- 2 files changed, 79 insertions(+), 28 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h index 8b40d69fb2a..b26b7eecbb2 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h @@ -1,6 +1,3 @@ -/* - * Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration - */ #ifndef IDPERFMON_ZMUMU_H #define IDPERFMON_ZMUMU_H @@ -167,6 +164,7 @@ StatusCode FillTruthParameters(const xAOD::TrackParticle* track); mutable unsigned int m_runNumber; mutable unsigned int m_evtNumber; mutable unsigned int m_lumi_block; + mutable unsigned int m_event_mu; double m_positive_px; double m_positive_py; @@ -194,6 +192,10 @@ StatusCode FillTruthParameters(const xAOD::TrackParticle* track); double m_negative_z0_PVerr; double m_negative_d0_PVerr; + double m_pv_x; + double m_pv_y; + double m_pv_z; + mutable unsigned int m_nTrkInVtx; int m_triggerPrescale; diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx index 5c20c7dee9f..6262a8ebdf6 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx @@ -96,9 +96,9 @@ IDPerfMonZmumu::IDPerfMonZmumu(const std::string& name, declareProperty("doIPSelection", m_doIPSelection = true ); declareProperty("isMC", m_isMC = false); declareProperty("doRefit", m_doRefit = false); - declareProperty("doIPextrToPV" , m_doIP = false); - declareProperty("BeamCondSvc", m_beamSpotSvc); - declareProperty ( "Extrapolator", m_extrapolator ); + declareProperty("doIPextrToPV", m_doIP = false); + declareProperty("BeamCondSvc", m_beamSpotSvc); + declareProperty("Extrapolator", m_extrapolator ); declareProperty("MassWindowLow", m_MassWindowLow = 60.0, "Lower cut in mu+mu- invariant mass" ); declareProperty("MassWindowHigh", m_MassWindowHigh = 120.0, "Upper cut in mu+mu- invariant mass" ); declareProperty("OpeningAngle", m_OpeningAngleCut = 0.2, "Opening angle between the two muons (in radians)"); @@ -165,7 +165,7 @@ StatusCode IDPerfMonZmumu::initialize() ATH_MSG_FATAL("Unable to retrieve " << m_TrackRefitter1 ); return StatusCode::FAILURE; } else { - ATH_MSG_INFO("Retrieved tool" << m_TrackRefitter1 ); + ATH_MSG_INFO("Retrieved tool m_TrackRefitter1: " << m_TrackRefitter1 ); } // Retrieve the second fitter @@ -173,15 +173,15 @@ StatusCode IDPerfMonZmumu::initialize() ATH_MSG_FATAL("Unable to retrieve " << m_TrackRefitter2 ); return StatusCode::FAILURE; } else { - ATH_MSG_INFO("Retrieved tool" << m_TrackRefitter2 ); + ATH_MSG_INFO("Retrieved tool m_TrackRefitter2: " << m_TrackRefitter2 ); } if (m_trackToVertexTool.retrieve().isFailure()) { - ATH_MSG_FATAL("Unable to retrieve " << m_trackToVertexTool ); + ATH_MSG_FATAL("Unable to retrieve m_trackToVertexTool " << m_trackToVertexTool ); return StatusCode::FAILURE; } else { - ATH_MSG_INFO("Retrieved tool" << m_trackToVertexTool ); + ATH_MSG_INFO("Retrieved tool m_trackToVertexTool " << m_trackToVertexTool ); } if(m_useTrackSelectionTool){ @@ -209,6 +209,7 @@ StatusCode IDPerfMonZmumu::initialize() m_defaultTree->Branch("runNumber" , &m_runNumber, "runNumber/I"); m_defaultTree->Branch("eventNumber" , &m_evtNumber, "eventNumber/I"); m_defaultTree->Branch("lumi_block" , &m_lumi_block, "lumi_block/I"); + m_defaultTree->Branch("mu" , &m_event_mu, "mu/I"); m_defaultTree->Branch("Negative_Px", &m_negative_px, "Negative_Px/D"); m_defaultTree->Branch("Negative_Py", &m_negative_py, "Negative_Py/D"); @@ -225,8 +226,7 @@ StatusCode IDPerfMonZmumu::initialize() m_defaultTree->Branch("Positive_z0_err", &m_positive_z0_err, "Positive_z0_err/D"); m_defaultTree->Branch("Positive_d0_err", &m_positive_d0_err, "Positive_d0_err/D"); - if(m_doIP){ - + if (m_doIP) { m_defaultTree->Branch("Negative_d0_PV", &m_negative_d0_PV , "Negative_d0_PV/D"); m_defaultTree->Branch("Negative_z0_PV", &m_negative_z0_PV , "Negative_z0_PV/D"); m_defaultTree->Branch("Positive_z0_PV", &m_positive_z0_PV, "Positive_z0_PV/D"); @@ -236,6 +236,11 @@ StatusCode IDPerfMonZmumu::initialize() m_defaultTree->Branch("Negative_z0_PVerr", &m_negative_z0_PVerr, "Negative_z0_PVerr/D"); m_defaultTree->Branch("Positive_z0_PVerr", &m_positive_z0_PVerr, "Positive_z0_PVerr/D"); m_defaultTree->Branch("Positive_d0_PVerr", &m_positive_d0_PVerr, "Positive_d0_PVerr/D"); + + m_defaultTree->Branch("pv_x", &m_pv_x , "pv_x/D"); + m_defaultTree->Branch("pv_y", &m_pv_y , "pv_y/D"); + m_defaultTree->Branch("pv_z", &m_pv_z , "pv_z/D"); + m_defaultTree->Branch("nTrkInVtx", &m_nTrkInVtx, "nTrkInVrx/I"); } } @@ -246,7 +251,8 @@ StatusCode IDPerfMonZmumu::initialize() m_IDTree->Branch("runNumber" , &m_runNumber, "runNumber/I"); m_IDTree->Branch("eventNumber" , &m_evtNumber, "eventNumber/I"); - m_IDTree->Branch("lumi_block" , &m_lumi_block, "lumi_block/I"); + m_IDTree->Branch("lumi_bLock" , &m_lumi_block, "lumi_block/I"); + m_IDTree->Branch("mu" , &m_event_mu, "mu/I"); m_IDTree->Branch("Negative_Px", &m_negative_px, "Negative_Px/D"); m_IDTree->Branch("Negative_Py", &m_negative_py, "Negative_Py/D"); @@ -274,10 +280,12 @@ StatusCode IDPerfMonZmumu::initialize() m_IDTree->Branch("Negative_z0_PVerr", &m_negative_z0_PVerr, "Negative_z0_PVerr/D"); m_IDTree->Branch("Positive_z0_PVerr", &m_positive_z0_PVerr, "Positive_z0_PVerr/D"); m_IDTree->Branch("Positive_d0_PVerr", &m_positive_d0_PVerr, "Positive_d0_PVerr/D"); - } - - + m_IDTree->Branch("pv_x", &m_pv_x , "pv_x/D"); + m_IDTree->Branch("pv_y", &m_pv_y , "pv_y/D"); + m_IDTree->Branch("pv_z", &m_pv_z , "pv_z/D"); + m_IDTree->Branch("nTrkInVtx", &m_nTrkInVtx, "nTrkInVrx/I"); + } } if( m_doRefit && m_refit1Tree == 0){ @@ -288,6 +296,7 @@ StatusCode IDPerfMonZmumu::initialize() m_refit1Tree->Branch("runNumber" , &m_runNumber, "runNumber/I"); m_refit1Tree->Branch("eventNumber" , &m_evtNumber, "eventNumber/I"); m_refit1Tree->Branch("lumi_block" , &m_lumi_block, "lumi_block/I"); + m_refit1Tree->Branch("mu" , &m_event_mu, "mu/I"); m_refit1Tree->Branch("preScale" , &m_triggerPrescale, "preScale/I"); m_refit1Tree->Branch("Negative_Px", &m_negative_px, "Negative_Px/D"); @@ -318,9 +327,12 @@ StatusCode IDPerfMonZmumu::initialize() m_refit1Tree->Branch("Negative_z0_PVerr", &m_negative_z0_PVerr , "Negative_z0_PVerr/D"); m_refit1Tree->Branch("Positive_z0_PVerr", &m_positive_z0_PVerr, "Positive_z0_PVerr/D"); m_refit1Tree->Branch("Positive_d0_PVerr", &m_positive_d0_PVerr, "Positive_d0_PVerr/D"); - } - + m_refit1Tree->Branch("pv_x", &m_pv_x , "pv_x/D"); + m_refit1Tree->Branch("pv_y", &m_pv_y , "pv_y/D"); + m_refit1Tree->Branch("pv_z", &m_pv_z , "pv_z/D"); + m_refit1Tree->Branch("nTrkInVtx", &m_nTrkInVtx, "nTrkInVrx/I"); + } } if( m_doRefit && m_refit2Tree == 0){ @@ -331,6 +343,7 @@ StatusCode IDPerfMonZmumu::initialize() m_refit2Tree->Branch("runNumber" , &m_runNumber, "runNumber/I"); m_refit2Tree->Branch("eventNumber" , &m_evtNumber, "eventNumber/I"); m_refit2Tree->Branch("lumi_block" , &m_lumi_block, "lumi_block/I"); + m_refit2Tree->Branch("mu" , &m_event_mu, "mu/I"); m_refit2Tree->Branch("preScale" , &m_triggerPrescale, "preScale/I"); m_refit2Tree->Branch("Negative_Px", &m_negative_px, "Negative_Px/D"); @@ -363,11 +376,13 @@ StatusCode IDPerfMonZmumu::initialize() m_refit2Tree->Branch("Negative_d0_PVerr", &m_negative_d0_PVerr, "Negative_d0_PVerr/D"); m_refit2Tree->Branch("Positive_z0_PVerr", &m_positive_z0_PVerr, "Positive_z0_PVerr/D"); m_refit2Tree->Branch("Positive_d0_PVerr", &m_positive_d0_PVerr, "Positive_d0_PVerr/D"); - } + m_refit2Tree->Branch("pv_x", &m_pv_x , "pv_x/D"); + m_refit2Tree->Branch("pv_y", &m_pv_y , "pv_y/D"); + m_refit2Tree->Branch("pv_z", &m_pv_z , "pv_z/D"); - - + m_refit2Tree->Branch("nTrkInVtx", &m_nTrkInVtx, "nTrkInVrx/I"); + } } // if( m_meStacoTree == 0){ @@ -400,6 +415,7 @@ StatusCode IDPerfMonZmumu::initialize() m_combTree->Branch("runNumber" , &m_runNumber, "runNumber/I"); m_combTree->Branch("eventNumber" , &m_evtNumber, "eventNumber/I"); m_combTree->Branch("lumi_block" , &m_lumi_block, "lumi_block/I"); + m_combTree->Branch("mu" , &m_event_mu, "mu/I"); m_combTree->Branch("preScale" , &m_triggerPrescale, "preScale/I"); m_combTree->Branch("Negative_Px", &m_negative_px, "Negative_Px/D"); @@ -430,6 +446,12 @@ StatusCode IDPerfMonZmumu::initialize() m_combTree->Branch("Negative_d0_PVerr", &m_negative_d0_PVerr, "Negative_d0_PVerr/D"); m_combTree->Branch("Positive_z0_PVerr", &m_positive_z0_PVerr, "Positive_z0_PVerr/D"); m_combTree->Branch("Positive_d0_PVerr", &m_positive_d0_PVerr, "Positive_d0_PVerr/D"); + + m_combTree->Branch("pv_x", &m_pv_x , "pv_x/D"); + m_combTree->Branch("pv_y", &m_pv_y , "pv_y/D"); + m_combTree->Branch("pv_z", &m_pv_z , "pv_z/D"); + + m_combTree->Branch("nTrkInVtx", &m_nTrkInVtx, "nTrkInVrx/I"); } } @@ -565,6 +587,7 @@ StatusCode IDPerfMonZmumu::execute() m_runNumber = eventInfo->event_ID()->run_number(); m_evtNumber = eventInfo->event_ID()->event_number(); m_lumi_block = eventInfo->event_ID()->lumi_block(); + m_event_mu = eventInfo->actualInteractionsPerCrossing(); ATH_MSG_DEBUG(" Execute() starting on --> Run: " << m_runNumber << " event: " << m_evtNumber); } @@ -932,7 +955,7 @@ bool IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp, cons } if (m_doRemoval && !trackp_for_unbias){ - return false; + return StatusCode::FAILURE; } @@ -965,18 +988,26 @@ bool IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp, cons //z0res = -99; //Absolutely need to get the covariance matrix z0res = trackp->definingParametersCovMatrix()(1,1); - - if(m_doIP){ + if (vertex == NULL) { + ATH_MSG_INFO("in FillRecParametersTP. WARNING: Vertex is NULL"); + return false; + } + if (m_trackToVertexIPEstimator == 0) { + ATH_MSG_INFO("in FillRecParametersTP. WARNING: m_trackToVertexIPEstimator is NULL"); + return false; + } + if(m_doIP && vertex != NULL && m_trackToVertexIPEstimator != 0){ const Trk::ImpactParametersAndSigma* iPandSigma(NULL); ATH_MSG_INFO("using the trackToVertexIPEstimator"); //Calling the estimate(trackp,newtrackp,vertex,doRemoval) - //The first track is used to unbias the vertex, the second to get the estrapolation - iPandSigma = m_trackToVertexIPEstimator->estimate(trackp_for_unbias,trackp,vertex,m_doRemoval); + //The first track is used to unbias the vertex, the second to get the extrapolation + iPandSigma = m_trackToVertexIPEstimator->estimate(trackp_for_unbias, trackp, vertex, m_doRemoval); + ATH_MSG_INFO("return from the trackToVertexIPEstimator->estimate()"); - if( iPandSigma==0 ){ + if( iPandSigma == NULL ){ ATH_MSG_WARNING ("FillRecParametersTP::trackToVertexIPEstimator failed !"); - return false; + return StatusCode::FAILURE; } else{ ATH_MSG_DEBUG("FillRecParametersTP::trackToVertexIPEstimator success !"); @@ -1042,6 +1073,10 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac const Trk::Perigee* trkPerigee = track->perigeeParameters(); const Trk::Perigee* trk_for_unbiasPerigee = &(trackp_for_unbias->perigeeParameters()); + // const AmgSymMatrix(5)* covariance = trkPerigee ? trkPerigee->covariance() : NULL; + // if (covariance == NULL) { + // if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No measured perigee parameters assigned to the track" << endreq; + // } double px = 0; double py = 0; @@ -1049,6 +1084,9 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac double d0 = 0; double z0 = 0; + double d0res = 999.; + double z0res = 999.; + double d0_err = 999.; double z0_err = 999.; @@ -1060,6 +1098,7 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac if(trkPerigee){ + // std::cout << "################## >>> does not fail trkperigee" << std::endl; double qOverP = trkPerigee->parameters()[Trk::qOverP]; if (qOverP) { px = trkPerigee->momentum().x(); @@ -1108,8 +1147,15 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac ATH_MSG_DEBUG("FillRecParameters::trackToVertexIPEstimator success !"); PVd0 = iPandSigma->IPd0; PVd0res = iPandSigma->PVsigmad0; + d0res = iPandSigma->sigmad0; //-> Check who are these motherfuckers PVz0 = iPandSigma->IPz0; PVz0res = iPandSigma->PVsigmaz0; + z0res = iPandSigma->sigmaz0; //-> Check who are these motherfuckers + + m_pv_x = vertex->x(); + m_pv_y = vertex->y(); + m_pv_z = vertex->z(); + m_nTrkInVtx = vertex->nTrackParticles(); } } @@ -1145,6 +1191,9 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac } ATH_MSG_DEBUG("(Filled charge == -1 ) (reco)-> px : "<< px <<" py: "< Date: Wed, 17 Apr 2019 17:06:19 +0200 Subject: [PATCH 4/8] acZmumu.py: define a dataset by name. Helpful for MC datasets --- .../AutomatedCheck/acZmumu.py | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py index 33f6cd32088..14c62a09616 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py @@ -21,7 +21,8 @@ m_dataProject = "data17_13TeV" m_userFiles = 0 # this means all the files m_amitag = "%" m_physicsType = "physics_Main" -m_isMC = False +m_usingMC = False +m_mcDataSetName = "mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.ESD.e3601_s3126_r10201" ################################################################################################### def findListOfDataSets(): @@ -33,8 +34,12 @@ def findListOfDataSets(): #theAMIsearchCommand = "ami list datasets %s.%%.%s.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_physicsType, m_reconmerge, m_dataType, m_amitag) theAMIsearchCommand = "ami list datasets %s.%%.%s.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_physicsType, m_reconmerge, m_dataType, m_amitag) #theAMIsearchCommand = "ami list datasets %s.%%.physics_HardProbes.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_reconmerge, m_dataType, m_amitag) - print (" AMI data set search command: \n --> %s" %(theAMIsearchCommand)) + + # case of using MC + theAMIsearchCommand = "ami list datasets %s --order run_number --fields events,nfiles" %(m_mcDataSetName) + + print (" AMI data set search command: \n --> %s" %(theAMIsearchCommand)) amiReturn = os.popen(theAMIsearchCommand).readlines() for theLine in amiReturn: @@ -402,7 +407,9 @@ def welcomeBanner (): print ("\n") print (" config:") print (" ** Exec: %r" %m_submitExec) - print (" ** using MC? %r" %m_isMC) + print (" ** using MC? %r" %m_usingMC) + if (m_usingMC): + print (" ** mc data set %s" %m_mcDataSetName) print (" ** data project: %s " %m_dataProject) print (" ** min events: %d" %m_minEvents) print (" ** min Run: %d" %m_firstRun) @@ -439,16 +446,18 @@ def optParsing(): p_amitag = m_amitag p_dataProject = m_dataProject p_physicsType = m_physicsType - p_isMC = m_isMC + p_usingMC = m_usingMC + p_mcDataSetName = m_mcDataSetName parser = OptionParser() parser.add_option("--amiTag", dest="p_amitag", help="Name of the requested AMI tag (example: r10258_r10258_p3399). Wild card is also possible. Default %s" %(p_amitag), default = p_amitag) parser.add_option("--dataProject", dest="p_dataProject", help="data project of the data sets (examples: data17_13TeV). Default %s" %(p_dataProject), default = p_dataProject) parser.add_option("--dataType", dest="p_dataType", help="User defined data type (examples: DAOD_ZMUMU, DESDM_MCP). Default %s" %(p_dataType), default = p_dataType) + parser.add_option("--dataSet", dest="p_mcDataSetName", help="User defined full data set name", default = p_mcDataSetName) parser.add_option("--EXEC", dest="p_submitExec", help="Submit the Grid jobs. Default: no submission", action="store_true", default = False) parser.add_option("--firstRun", dest="p_firstRun", help="First run number (inclusive). Default %s" %(p_firstRun), default = p_firstRun) parser.add_option("--lastRun", dest="p_lastRun", help="Last run number (inclusive). Default %s" %(p_lastRun), default = p_lastRun) - parser.add_option("--MC", dest="p_isMC", help="Use MC. The data set must be provided in full. Default: no MC", action="store_true", default = p_isMC) + parser.add_option("--MC", dest="p_usingMC", help="Use MC. The data set must be provided in full. Default: no MC", action="store_true", default = p_usingMC) parser.add_option("--minEvents", dest="p_minEvents", help="Minimum number of events. Default %s" %(p_minEvents), default = p_minEvents) parser.add_option("--nFiles", dest="p_userFiles", help="User defined number of files. Default %s = all the available files" %(p_userFiles), default = p_userFiles) parser.add_option("--run", dest="p_userRun", help="Run number in case of targetting a single run. Default %s" %(p_userRun), default = p_userRun) @@ -508,7 +517,8 @@ if __name__ == '__main__': m_amitag = config.p_amitag m_dataProject = config.p_dataProject m_physicsType = config.p_physicsType - m_isMC = config.p_isMC + m_usingMC = config.p_usingMC + m_mcDataSetName = config.p_mcDataSetName welcomeBanner () preliminaries () -- GitLab From 480e08a1b1685ca6affc40531a257c27d133b961 Mon Sep 17 00:00:00 2001 From: Salvador Marti Date: Wed, 17 Apr 2019 17:07:03 +0200 Subject: [PATCH 5/8] runzmumu: set to use RD by default --- .../share/runzmumu_UserConstants.py | 38 ++++--------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py index 91cd6eb41cd..9f1d3b64697 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py @@ -32,13 +32,13 @@ monitoringAllTracks = True useGRL = False # MC -MC_bool = True +MC_bool = False # do Trigger DoTrigger = False # where to run -grid_bool = False +grid_bool = True # handle input constants readPool = False # default True @@ -87,33 +87,9 @@ print ' ========= runzmumu === config == end == ' #include("InDetSimpleVisual/GetDetectorPositions.py") if (grid_bool): - #PoolInput = [ "/afs/cern.ch/work/w/wollrath/private/IDAlignment/inputFiles/data16_13TeV/AOD.11063137._018527.pool.root.1" ] - #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1"] - #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data15_5TeV/DESDM_ZMUMU.11207033._000001.pool.root.1"] - #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_ZMUMU/data18_13TeV.00348354.physics_Main.merge.DESDM_ZMUMU.f920_m1831_f920_m1951._0001.1"] - #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00349977.physics_Main.merge.DESDM_MCP.f933_m1964._0027.1"] - #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0027.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0028.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350013.physics_Main.merge.DESDM_MCP.f933_m1964._0029.1"] - #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0027.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data18_13TeV/DESDM_MCP/data18_13TeV.00350923.physics_Main.merge.DESDM_MCP.f937_m1976._0127.1"] - #PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/ZmumuAOD2018/data18_13TeV.00358395.physics_Main.merge.DAOD_ZMUMU.f961_m1831_f961_m2018._0027.1"] - PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/InputFileForGridJobs/data18_13TeV.00348354.physics_Main.merge.DESDM_ZMUMU.f920_m1831_f920_m1951._0001.1"] - -else: - #PoolInput = [ "/home/jw1095/storage/IDAlignment/inputFiles/data17_13TeV/data17_13TeV.00327265.physics_Main.merge.DESDM_ZMUMU.f832_m1616_f832_m1816._0518.1" ] - if (MC_bool): - PoolInput = ["/eos/user/m/martis/data/mc16_13TeV/folder_mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.ESD.e3601_s3126_r10201/ESD.13642341._000503.pool.root.1"] - # PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._000001.pool.root.1" - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001884.pool.root.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001883.pool.root.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001300.pool.root.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001200.pool.root.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001100.pool.root.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001101.pool.root.1", - # "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/mc15_13TeV/ESD.09385287._001000.pool.root.1"] - else: - PoolInput = [ "/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/data16_13TeV/data16_13TeV.00303338.physics_Main.merge.DESDM_MCP.f716_m1624._0001.1"] + PoolInput = ["/afs/cern.ch/user/m/martis/mywork/ZmumuNtuples/InputFileForGridJobs/data18_13TeV.00348354.physics_Main.merge.DESDM_ZMUMU.f920_m1831_f920_m1951._0001.1"] +if (MC_bool): + PoolInput = ["/eos/user/m/martis/data/mc16_13TeV/folder_mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.ESD.e3601_s3126_r10201/ESD.13642341._000503.pool.root.1"] #EvtMax= -1 EvtMax= 100 @@ -357,8 +333,8 @@ if zmumuval == True: ZmumuMon = DiMuMon (name = "ZmumuMon_NoTrig", resonName = "Zmumu", minInvmass = 10., - maxInvmass = 120., - nMassBins = 60, + maxInvmass = 180., + nMassBins = 80, triggerChainName = "NoTrig", regions = ["All","BB","EAEA","ECEC"], varsVSmean = varsVSmeanZmumu, -- GitLab From 22c53b6b109ac603a2be6673cf655816fe4cc167 Mon Sep 17 00:00:00 2001 From: Salvador Marti Date: Wed, 17 Apr 2019 17:08:30 +0200 Subject: [PATCH 6/8] IDPerfMonZmumu: remove some swering and do not reset the event_mu when do_IP --- .../src/IDPerfMonZmumu.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx index 6262a8ebdf6..ddb4e4636c5 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx @@ -580,10 +580,10 @@ StatusCode IDPerfMonZmumu::execute() ATH_MSG_DEBUG("Retrieving event info."); const EventInfo * eventInfo; - if (evtStore()->retrieve(eventInfo).isFailure()) + if (evtStore()->retrieve(eventInfo).isFailure()) { ATH_MSG_ERROR("Could not retrieve event info."); - else - { + } + else { m_runNumber = eventInfo->event_ID()->run_number(); m_evtNumber = eventInfo->event_ID()->event_number(); m_lumi_block = eventInfo->event_ID()->lumi_block(); @@ -1147,10 +1147,10 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac ATH_MSG_DEBUG("FillRecParameters::trackToVertexIPEstimator success !"); PVd0 = iPandSigma->IPd0; PVd0res = iPandSigma->PVsigmad0; - d0res = iPandSigma->sigmad0; //-> Check who are these motherfuckers + d0res = iPandSigma->sigmad0; //-> ? PVz0 = iPandSigma->IPz0; PVz0res = iPandSigma->PVsigmaz0; - z0res = iPandSigma->sigmaz0; //-> Check who are these motherfuckers + z0res = iPandSigma->sigmaz0; //-> ? m_pv_x = vertex->x(); m_pv_y = vertex->y(); @@ -1191,7 +1191,8 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac } ATH_MSG_DEBUG("(Filled charge == -1 ) (reco)-> px : "<< px <<" py: "< Date: Wed, 17 Apr 2019 18:30:27 +0200 Subject: [PATCH 7/8] acZmumu.py: add missing if statement --- .../InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py index 14c62a09616..e8e9ddbb119 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py @@ -36,9 +36,9 @@ def findListOfDataSets(): #theAMIsearchCommand = "ami list datasets %s.%%.physics_HardProbes.%s.%s.%s --order run_number --fields events,nfiles" %(m_dataProject, m_reconmerge, m_dataType, m_amitag) # case of using MC - theAMIsearchCommand = "ami list datasets %s --order run_number --fields events,nfiles" %(m_mcDataSetName) + if (m_usingMC): + theAMIsearchCommand = "ami list datasets %s --order run_number --fields events,nfiles" %(m_mcDataSetName) - print (" AMI data set search command: \n --> %s" %(theAMIsearchCommand)) amiReturn = os.popen(theAMIsearchCommand).readlines() -- GitLab From a194b1be6a312aeabeb8b48cfb00cfea3edf0457 Mon Sep 17 00:00:00 2001 From: Salvador Marti Date: Thu, 18 Apr 2019 09:57:48 +0200 Subject: [PATCH 8/8] IDPerMonZmumu: clear compilation warnings --- .../src/IDPerfMonZmumu.cxx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx index ddb4e4636c5..3126c5969ff 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx @@ -1084,9 +1084,6 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac double d0 = 0; double z0 = 0; - double d0res = 999.; - double z0res = 999.; - double d0_err = 999.; double z0_err = 999.; @@ -1097,7 +1094,7 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac - if(trkPerigee){ + if (trkPerigee != NULL){ // std::cout << "################## >>> does not fail trkperigee" << std::endl; double qOverP = trkPerigee->parameters()[Trk::qOverP]; if (qOverP) { @@ -1131,10 +1128,9 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac // std::cout << " -- atBL -- px: " << px << " py: " << py << " pz: " << pz << " d0: "<< d0 << " z0: "<< z0 << std::endl; delete atBL; } - else - { - ATH_MSG_WARNING("FillRecParameters::Failed extrapolation to the BeamLine"); - } + else { + ATH_MSG_WARNING("FillRecParameters::Failed extrapolation to the BeamLine"); + } if(m_doIP && vertex && track->perigeeParameters()){ //I assume that the vertex is the same of the original track const Trk::ImpactParametersAndSigma* iPandSigma(NULL); @@ -1147,10 +1143,10 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac ATH_MSG_DEBUG("FillRecParameters::trackToVertexIPEstimator success !"); PVd0 = iPandSigma->IPd0; PVd0res = iPandSigma->PVsigmad0; - d0res = iPandSigma->sigmad0; //-> ? + //d0res = iPandSigma->sigmad0; //-> ? PVz0 = iPandSigma->IPz0; PVz0res = iPandSigma->PVsigmaz0; - z0res = iPandSigma->sigmaz0; //-> ? + //z0res = iPandSigma->sigmaz0; //-> ? m_pv_x = vertex->x(); m_pv_y = vertex->y(); -- GitLab