diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/AutomatedCheck/acZmumu.py index 84c7eac41ae7a1462a02e7db29249309567de53c..e8e9ddbb119bd154f4bea17ba69f0b387e55a534 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,9 @@ m_dataType = "DESDM_MCP" m_dataProject = "data17_13TeV" m_userFiles = 0 # this means all the files m_amitag = "%" +m_physicsType = "physics_Main" +m_usingMC = False +m_mcDataSetName = "mc16_13TeV.361107.PowhegPythia8EvtGen_AZNLOCTEQ6L1_Zmumu.recon.ESD.e3601_s3126_r10201" ################################################################################################### def findListOfDataSets(): @@ -26,10 +30,16 @@ 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) - print (" AMI data set search command: \n --> %s" %(theAMIsearchCommand)) + #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) + + # case of using MC + 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() for theLine in amiReturn: @@ -83,6 +93,7 @@ def getYear (): ################################################################################################### def preliminaries (): import os + import sys global m_storingFolder global m_athenaVersion global m_testArea @@ -109,6 +120,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 +238,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,8 +296,9 @@ 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"); + print (" m_submitExec = True --> job to be submmited"); # move to the submission folder submissionPath = "%s/run" %(m_testArea) os.chdir(submissionPath) @@ -300,6 +317,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 +377,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" %(infoFromAMI[runNumber]["nfiles"]) theCommand = "pathena %s %s %s %s" %(theScript, theInput, theOutput, theOptions) + print "%s " %theCommand return theCommand @@ -375,10 +407,14 @@ def welcomeBanner (): print ("\n") print (" config:") print (" ** Exec: %r" %m_submitExec) + 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) 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,17 +445,23 @@ def optParsing(): p_userFiles = m_userFiles p_amitag = m_amitag p_dataProject = m_dataProject + p_physicsType = m_physicsType + 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_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("--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 +516,9 @@ if __name__ == '__main__': m_userFiles = int(config.p_userFiles) m_amitag = config.p_amitag m_dataProject = config.p_dataProject + m_physicsType = config.p_physicsType + m_usingMC = config.p_usingMC + m_mcDataSetName = config.p_mcDataSetName welcomeBanner () preliminaries () diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h index 8b40d69fb2a7c8e9c12b82a0d2af48f1040f1e31..b26b7eecbb2f230ae6d3ca4156dad0f0ce9c635a 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/share/runzmumu_UserConstants.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_UserConstants.py index 9c87fc183489dee7646db40d8123a5ef287ead4b..9f1d3b64697b0afda64a8db608e99d58cce3cb6c 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 @@ -38,14 +38,16 @@ MC_bool = False DoTrigger = False # where to run -grid = True +grid_bool = True # 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,33 +86,13 @@ print ' ========= runzmumu === config == end == ' #include("InDetSimpleVisual/GetDetectorPositions.py") -if grid == True: - #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"] -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"] - 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 +if (grid_bool): + 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 SkipEvents = 0 @@ -145,7 +127,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 +192,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 +216,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 +300,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 +312,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 @@ -339,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, @@ -389,3 +383,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") diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx index 5c20c7dee9fddb1ecbf71d7d91fa523e9e5d487c..3126c5969ff6aa0c65ef8ec206b702b1ec4c80d9 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"); } } @@ -558,13 +580,14 @@ 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(); + 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; @@ -1059,7 +1094,8 @@ 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) { px = trkPerigee->momentum().x(); @@ -1092,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); @@ -1108,8 +1143,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; //-> ? PVz0 = iPandSigma->IPz0; PVz0res = iPandSigma->PVsigmaz0; + //z0res = iPandSigma->sigmaz0; //-> ? + + m_pv_x = vertex->x(); + m_pv_y = vertex->y(); + m_pv_z = vertex->z(); + m_nTrkInVtx = vertex->nTrackParticles(); } } @@ -1146,6 +1188,10 @@ bool IDPerfMonZmumu::FillRecParameters(const Trk::Track* track, const xAOD::Trac ATH_MSG_DEBUG("(Filled charge == -1 ) (reco)-> px : "<< px <<" py: "<