From b05d9f5ad2cc04c333860145d8fb8ba0eafd481c Mon Sep 17 00:00:00 2001 From: Salvador Marti I Garcia <salvador.marti@cern.ch> Date: Thu, 25 Mar 2021 08:45:30 +0100 Subject: [PATCH 1/5] allow user selecting alignment tags from 22.0.30 --- .../share/runzmumu_test.py | 117 +++++++++--------- 1 file changed, 60 insertions(+), 57 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py index c95756ccb493..be70e4fac9a7 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py @@ -30,15 +30,14 @@ fillIDAmonitoring = True runAlignment = False PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/data18_13TeV.00352436.physics_Main.merge.DAOD_ZMUMU.f938_m1831_f938_m1982._0027.1"] +#PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/data18_13TeV.00352448.physics_Main.merge.DRAW_ZMUMU.f938_m1831._0568.1"] if (MC_bool): PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/ZmumuMC16_AOD.18379878._000123.pool.root.1"] - #PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/mc16_13TeV.424108.Pythia8B_A14_CTEQ6L1_Jpsimu6.recon.AOD.e5441_s3126_r10724_file_AOD.15269147._001234.pool.root.1"] - #PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/mc16_13TeV.424108.Pythia8B_A14_CTEQ6L1_Jpsimu6.recon.AOD.e5441_e5984_s3126_r12295_tid23570654_00_file004040.pool.root.1"] - #PoolInput = ["/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000001.pool.root.1", "/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000002.pool.root.1", "/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000003.pool.root.1", "/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000004.pool.root.1", "/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000005.pool.root.1", "/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000006.pool.root.1", "/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000007.pool.root.1", "/eos/user/j/jajimene/JPsi_samples/MC16a/AOD.23570656._000008.pool.root.1"] conditionsTag = "default" #conditionsTag = "CONDBR2-BLKPA-2018-14" +#conditionsTag = "CONDBR2-BLKPA-RUN2-03" ########################################################### print (' ========= runzmumu === config == start == ') @@ -105,13 +104,11 @@ print ('\n == runzmumu == final list == ConfigFlags.Input.Files = ',ConfigFlags. print ('\n == runzmumu == final list == jobproperties.AthenaCommonFlags.FilesInput = ',jobproperties.AthenaCommonFlags.FilesInput) # -# use the athen logger +# use the athena logger from AthenaCommon.Logging import logging msg = logging.getLogger('RunZmumu') msg.info('\n == Input list of files: {0}'.format(PoolInput)) -# - ########################### # user given conditions tag if ("default" not in conditionsTag): @@ -119,6 +116,14 @@ if ("default" not in conditionsTag): globalflags.ConditionsTag.set_Value_and_Lock(conditionsTag) globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2016-01-00-01") +########################## +# athena recognizes if input file is data or mc. +# However from 22.0.30 when using data and trying to change alignment tags as soon as one tries: +# from IOVDbSvc.CondDB import conddb +# then athena thinks input is MC --> fix the data type +if not MC_bool: + globalflags.DataSource.set_Value_and_Lock("data") + # from GeoModelSvc.GeoModelSvcConf import GeoModelSvc GeoModelSvc = GeoModelSvc() @@ -157,6 +162,7 @@ if ('21.' in os.getenv("Athena_VERSION") ): print (' == runzmumu == including InDetRecExample/InDetRecConditionsAccess.py') include("InDetRecExample/InDetRecConditionsAccess.py") +########################## # user given alignment constants set if ("NONE" not in inputConstantsFile or userAlignTags): inputCollections = [] @@ -164,54 +170,36 @@ if ("NONE" not in inputConstantsFile or userAlignTags): print (' == runzmumu == setting user inputConstantsFile in == %s' %inputConstantsFile) inputCollections = [inputConstantsFile] + print (' == runzmumu == going to: from IOVDbSvc.CondDB import conddb') from IOVDbSvc.CondDB import conddb - # for debugging - from TRT_ConditionsServices.TRT_ConditionsServicesConf import TRT_AlignDbSvc - TRT_AlignDbSvc.forceUserDBConfig = True - TRT_AlignDbSvc.OutputLevel = VERBOSE - ServiceMgr += TRT_AlignDbSvc() - print (' == runzmumu == TRT_AlignDBSvc ==') - print (TRT_AlignDbSvc) - - if (MC_bool): - print (' == runzmumu == use this set of alignment constants on MC') - #globalflags.ConditionsTag.set_Value_and_Lock("OFLCOND-MC16-SDR-25") - #globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2016-01-00-01") - #conddb.blockFolder("/Indet/Align") - #conddb.blockFolder("/TRT/Align") - #conddb.addFolderWithTag('','<dbConnection>sqlite://X;schema='+inputConstantsFile+';dbname=CONDBR2</dbConnection>/Indet/AlignL3','IndetAlign_test',force=True,className="AlignableTransformContainer"); - conddb.blockFolder("/Indet/Align") - conddb.addFolder("INDET","<dbConnection>sqlite://X;schema="+inputConstantsFile+";dbname=OFLP200</dbConnection>",force=True,className="AlignableTransformContainer") - else: - print (' == runzmumu == use this set of alignment constants on RD') - if (userAlignTags): - print (' == runzmumu == setting userAlignTags == ') - if (False): - 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", "IndetAlignL3-R2dynamic_2018_ReAlign_Initial") - conddb.addOverride("/Indet/IBLDist", "IndetIBLDist-R2dynamic_2018_ReAlign_Initial") - conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1-R2dynamic_2018_ReAlign_Initial") - conddb.addOverride("/TRT/AlignL2", "TRTAlignL2-R2dynamic_2018_ReAlign_Initial") - if (True): - conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID_Run2_Legacy_looser") - conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX_Run2_Legacy_looser") - conddb.addOverride("/Indet/AlignL2/SCT", "IndetAlignL2SCT_Run2_Legacy_looser") - conddb.addOverride("/Indet/AlignL3", "IndetAlignL3_Run2_Legacy_looser") - conddb.addOverride("/Indet/IBLDist", "IndetIBLDist_Run2_Legacy_looser") - conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1_Run2_Legacy_looser") - conddb.addOverride("/TRT/AlignL2", "TRTAlignL2_Run2_Legacy_looser") - if ("NONE" not in inputConstantsFile): - print (' == runzmumu == setting user constants file == %s' %inputConstantsFile) - conddb.blockFolder("/Indet/AlignL1/ID") - conddb.blockFolder("/TRT/AlignL1/TRT") - conddb.addFolder('INDET','/Indet/AlignL1/ID'+'<dbConnection>sqlite://X;schema='+inputConstantsFile+';dbname=CONDBR2</dbConnection><tag>IndetAlignTest</tag>',force=True,className="CondAttrListCollection") - conddb.addFolder('INDET','/TRT/AlignL1/TRT'+'<dbConnection>sqlite://X;schema='+inputConstantsFile+';dbname=CONDBR2</dbConnection><tag>IndetAlignTest</tag>',force=True,className="CondAttrListCollection") - #conddb.blockFolder("/Indet/AlignL3") - #conddb.blockFolder("/TRT/AlignL2") - #conddb.addFolder('INDET','/Indet/AlignL3'+'<dbConnection>sqlite://X;schema='+inputConstantsFile+';dbname=CONDBR2</dbConnection><tag>IndetL3Test</tag>',force=True,className="CondAttrListCollection") + print (' == runzmumu == use this set of alignment constants on RD') + if (userAlignTags): + if (True): + print (' == runzmumu == setting userAlignTags == 2018_ReAlign_Initial ') + 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", "IndetAlignL3-R2dynamic_2018_ReAlign_Initial") + conddb.addOverride("/Indet/IBLDist", "IndetIBLDist-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): + print (' == runzmumu == setting userAlignTags == Run2_Legacy_looser') + conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID_Run2_Legacy_looser") + conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX_Run2_Legacy_looser") + conddb.addOverride("/Indet/AlignL2/SCT", "IndetAlignL2SCT_Run2_Legacy_looser") + conddb.addOverride("/Indet/AlignL3", "IndetAlignL3_Run2_Legacy_looser") + conddb.addOverride("/Indet/IBLDist", "IndetIBLDist_Run2_Legacy_looser") + conddb.addOverride("/TRT/AlignL1/TRT", "TRTAlignL1_Run2_Legacy_looser") + conddb.addOverride("/TRT/AlignL2", "TRTAlignL2_Run2_Legacy_looser") + + if ("NONE" not in inputConstantsFile): + print (' == runzmumu == setting user constants file == %s' %inputConstantsFile) + conddb.blockFolder("/Indet/AlignL1/ID") + conddb.blockFolder("/TRT/AlignL1/TRT") + conddb.addFolder('INDET','/Indet/AlignL1/ID'+'<dbConnection>sqlite://X;schema='+inputConstantsFile+';dbname=CONDBR2</dbConnection><tag>IndetAlignTest</tag>',force=True,className="CondAttrListCollection") + conddb.addFolder('INDET','/TRT/AlignL1/TRT'+'<dbConnection>sqlite://X;schema='+inputConstantsFile+';dbname=CONDBR2</dbConnection><tag>IndetAlignTest</tag>',force=True,className="CondAttrListCollection") from EventSelectorAthenaPool.EventSelectorAthenaPoolConf import CondProxyProvider ServiceMgr += CondProxyProvider() @@ -220,16 +208,33 @@ if ("NONE" not in inputConstantsFile or userAlignTags): # set this to the file containing AlignableTransform objects if len(inputCollections) > 0: ServiceMgr.CondProxyProvider.InputCollections += inputCollections - ServiceMgr.CondProxyProvider.OutputLevel=INFO + ServiceMgr.CondProxyProvider.OutputLevel=INFO print (ServiceMgr.CondProxyProvider) # this preload causes callbacks for read in objects to be activated, # allowing GeoModel to pick up the transforms ServiceMgr.IOVSvc.preLoadData=True ServiceMgr.IOVSvc.OutputLevel=INFO + + print (' == runzmumu == condproxyprovider already set') + + if ("NONE" not in inputConstantsFile): + print (' == runzmumu == setting user constants: inputConstantsFile= %s - completed -' % inputConstantsFile) + if (userAlignTags): + print (' == runzmumu == setting user align tags ') + + # report + print (svcMgr.IOVDbSvc) + print (svcMgr.IOVSvc) - print (' == runzmumu == setting user constants: inputConstantsFile= %s - completed -' % inputConstantsFile) else: - print (' == runzmumu == setting user constants: NO') + print (' == runzmumu == setting user alignment constants or tags: NO user input') + +''' +if not MC_bool: + print (' == runzmumu == setting TRT Status HT (rel22) == ') + from IOVDbSvc.CondDB import conddb + conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/StatusHT","/TRT/Cond/StatusHT",className='TRTCond::StrawStatusMultChanContainer') +''' # main jobOptions include("RecExCommon/RecExCommon_topOptions.py") @@ -237,8 +242,6 @@ include("RecExCommon/RecExCommon_topOptions.py") from PerfMonComps.PerfMonFlags import jobproperties jobproperties.PerfMonFlags.doMonitoring = False -# report -#print (svcMgr.IOVDbSvc) # # Track Selection Tool -- GitLab From 32a86ca25fcdbf67de792235a50fc04e0e7869e1 Mon Sep 17 00:00:00 2001 From: Salvador Marti I Garcia <salvador.marti@cern.ch> Date: Thu, 25 Mar 2021 08:56:24 +0100 Subject: [PATCH 2/5] remove warning message --- .../InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx index dd3691440697..da5e1a8afb64 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx @@ -1119,7 +1119,7 @@ StatusCode IDAlignMonResiduals::fillHistograms() SG::ReadHandle<TrackCollection> inputTracks{m_tracksName}; if (not inputTracks.isValid()) { - ATH_MSG_WARNING ("IDAlignMonResiduals::fillHistograms ** " << m_tracksName.key() << " could not be retrieved"); + ATH_MSG_DEBUG ("IDAlignMonResiduals::fillHistograms ** " << m_tracksName.key() << " could not be retrieved"); return StatusCode::RECOVERABLE; } -- GitLab From 2cf0e9a6c9b9437930206d7bcae36480e8487f37 Mon Sep 17 00:00:00 2001 From: Salvador Marti I Garcia <salvador.marti@cern.ch> Date: Thu, 25 Mar 2021 17:47:53 +0100 Subject: [PATCH 3/5] preparing runzmumu_test.py to work with DRAW_ZMUMU --- .../share/MuonConfig.py | 86 +++++++++++++++++++ .../share/runzmumu_test.py | 69 ++++++++++----- 2 files changed, 135 insertions(+), 20 deletions(-) create mode 100644 InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py new file mode 100644 index 000000000000..d7cdfdd28c85 --- /dev/null +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py @@ -0,0 +1,86 @@ +from MuonRecExample.MuonRecFlags import muonRecFlags + +#-------------------------------------------------------------------------------- +# Input +#-------------------------------------------------------------------------------- +# configure flags so that only Muon Standalone reco is run +import MuonRecExample.MuonRecStandaloneOnlySetup + +#import MuonCombinedRecExample.MuonCombinedRecOnlySetup +from MuonCombinedRecExample.MuonCombinedRecFlags import muonCombinedRecFlags + +from MuonRecExample import MuonRecUtils + +#Need the beam spot for the TrackParticleCreator +if not ('conddb' in dir()): + IOVDbSvc = Service("IOVDbSvc") + from IOVDbSvc.CondDB import conddb +conddb.addFolderSplitOnline("INDET", "/Indet/Onl/Beampos", "/Indet/Beampos", className="AthenaAttributeList") + +from AthenaCommon.AlgSequence import AthSequencer +condSeq = AthSequencer("AthCondSeq") +if not hasattr(condSeq, "BeamSpotCondAlg"): + from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg + condSeq += BeamSpotCondAlg( "BeamSpotCondAlg" ) + +#ToolSvc += MDTCablingDbTool +import MuonCnvExample.MuonCablingConfig + +#-------------------------------------------------------------------------------- +# Output +#-------------------------------------------------------------------------------- +muonRecFlags.doCalibNtuple = False # write calibration ntuple? +### + +#Set to false, because re-reco of muon truth does not work. Lock it because downstream python alters its value to True otherwise. +rec.doTruth.set_Value_and_Lock(False) + +rec.doTrigger = False +rec.doWriteAOD=True + +#Disables PFO Thnning - these cotnainers do not exist, unless you run jet finding +from ParticleBuilderOptions.AODFlags import AODFlags +AODFlags.ThinNegativeEnergyNeutralPFOs.set_Value_and_Lock(False) + +muonRecFlags.doStandalone.set_Value_and_Lock(True) +muonRecFlags.doTrackPerformance = True +muonRecFlags.TrackPerfSummaryLevel = 2 +muonRecFlags.TrackPerfDebugLevel = 5 +muonRecFlags.doCSCs = True +muonRecFlags.doTGCs = False + +muonStandaloneFlags.printSummary = True +muonCombinedRecFlags.doTrackPerformance = True +muonCombinedRecFlags.doMuGirl = True +muonCombinedRecFlags.printSummary = True + + +##### no more flags after this line ##### +try: + include("MuonRecExample/MuonRec_topOptions.py") + ###### put any user finetuning after this line ##### + + + ##### DO NOT ADD ANYTHING AFTER THIS LINE ##### +except: + # print the stacktrace (saving could fail, and would then obscure the real problem) + import traceback + traceback.print_exc() + + # always write config so far for debugging + from AthenaCommon.ConfigurationShelve import saveToAscii + saveToAscii("config.txt") + # add DetFlags + from MuonRecExample.MuonRecUtils import dumpDetFlags + dumpDetFlags("config.txt") + # but still exit with error + import sys + sys.exit(10) +else: + # and write config to include user changes after topOptions + from AthenaCommon.ConfigurationShelve import saveToAscii + saveToAscii("config.txt") + # add DetFlags + from MuonRecExample.MuonRecUtils import dumpDetFlags + dumpDetFlags("config.txt") + diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py index be70e4fac9a7..c7e7c6a2a7fe 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py @@ -20,7 +20,7 @@ userAlignTags = False useIDADynamicFolders = True if (MC_bool): useIDADynamicFolders = False # dynamic folders must be disabled in MC -EvtMax = 1000 # -1 all events +EvtMax = 10 # -1 all events SkipEvents = 0 #fill Alignment monitoring @@ -36,7 +36,7 @@ if (MC_bool): PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/ZmumuMC16_AOD.18379878._000123.pool.root.1"] conditionsTag = "default" -#conditionsTag = "CONDBR2-BLKPA-2018-14" +conditionsTag = "CONDBR2-BLKPA-2018-14" #conditionsTag = "CONDBR2-BLKPA-RUN2-03" ########################################################### @@ -116,6 +116,12 @@ if ("default" not in conditionsTag): globalflags.ConditionsTag.set_Value_and_Lock(conditionsTag) globalflags.DetDescrVersion.set_Value_and_Lock("ATLAS-R2-2016-01-00-01") +# Find out if input is DRAW +inputIsDRAW = False +if any ("DRAW" in infiles for infiles in ConfigFlags.Input.Files): + inputIsDRAW = True + print (' == runzmumu == input is DRAW ') + ########################## # athena recognizes if input file is data or mc. # However from 22.0.30 when using data and trying to change alignment tags as soon as one tries: @@ -123,7 +129,7 @@ if ("default" not in conditionsTag): # then athena thinks input is MC --> fix the data type if not MC_bool: globalflags.DataSource.set_Value_and_Lock("data") - + if (inputIsDRAW): globalflags.InputFormat.set_Value_and_Lock("bytestream") # from GeoModelSvc.GeoModelSvcConf import GeoModelSvc GeoModelSvc = GeoModelSvc() @@ -135,16 +141,23 @@ rec.AutoConfiguration=['everything'] rec.doInDet.set_Value_and_Lock(True) rec.doPerfMon.set_Value_and_Lock(False) # +rec.doBTagging.set_Value_and_Lock(False) +rec.doZdc.set_Value_and_Lock(False) +rec.doLucid.set_Value_and_Lock(False) rec.doTile.set_Value_and_Lock(False) rec.doLArg.set_Value_and_Lock(False) rec.doCalo.set_Value_and_Lock(False) -rec.doMuon.set_Value_and_Lock(False) -rec.doMuonCombined.set_Value_and_Lock(False) +rec.doMuon.set_Value_and_Lock(True) +rec.doMuonCombined.set_Value_and_Lock(True) rec.doEgamma.set_Value_and_Lock(False) -rec.doJetMissingETTag.set_Value_and_Lock(False) -rec.doTrigger.set_Value_and_Lock(False) -# extras -rec.doTruth.set_Value_and_Lock(False) + +if (inputIsDRAW): + # These are not needed for our purposes and can cause athena crash when running over DRAW + print (" == runzmumu == switching off R3LargeD0 and TrackSegmentsDisappearing") + from InDetRecExample.InDetJobProperties import InDetFlags + InDetFlags.doR3LargeD0 = False + InDetFlags.doTrackSegmentsDisappearing = False + # # use dynamic alignment folders? @@ -157,6 +170,7 @@ include("RecExCond/RecExCommon_DetFlags.py") # include("RecExCond/RecExCommon_fl DetFlags.ID_setOn() DetFlags.Calo_setOff() DetFlags.Muon_setOn() + # if ('21.' in os.getenv("Athena_VERSION") ): print (' == runzmumu == including InDetRecExample/InDetRecConditionsAccess.py') @@ -175,7 +189,7 @@ if ("NONE" not in inputConstantsFile or userAlignTags): print (' == runzmumu == use this set of alignment constants on RD') if (userAlignTags): - if (True): + if (False): print (' == runzmumu == setting userAlignTags == 2018_ReAlign_Initial ') conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID-R2dynamic_2018_ReAlign_Initial") conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX-R2dynamic_2018_ReAlign_Initial") @@ -184,7 +198,7 @@ if ("NONE" not in inputConstantsFile or userAlignTags): conddb.addOverride("/Indet/IBLDist", "IndetIBLDist-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 (True): print (' == runzmumu == setting userAlignTags == Run2_Legacy_looser') conddb.addOverride("/Indet/AlignL1/ID", "IndetAlignL1ID_Run2_Legacy_looser") conddb.addOverride("/Indet/AlignL2/PIX", "IndetAlignL2PIX_Run2_Legacy_looser") @@ -229,16 +243,31 @@ if ("NONE" not in inputConstantsFile or userAlignTags): else: print (' == runzmumu == setting user alignment constants or tags: NO user input') -''' -if not MC_bool: - print (' == runzmumu == setting TRT Status HT (rel22) == ') - from IOVDbSvc.CondDB import conddb +################################## +if (inputIsDRAW): + print (' == runzmumu == setting /TRT/Onl/Cond/StatusHT') + try: + conddb + except NameError: + from IOVDbSvc.CondDB import conddb + else: + print (' == runzmumu == conddb already defined') conddb.addFolderSplitOnline("TRT","/TRT/Onl/Cond/StatusHT","/TRT/Cond/StatusHT",className='TRTCond::StrawStatusMultChanContainer') -''' +else: + print (' == runzmumu == no need of /TRT/Onl/Cond/StatusHT') +################################## # main jobOptions include("RecExCommon/RecExCommon_topOptions.py") +# +if ('22.' in os.getenv("Athena_VERSION") and inputIsDRAW): + ToolSvc.InDetAmbiTrackSelectionTool.doEmCaloSeed = False + print (' == runzmumu == include("MuonConfig.py")') + include("MuonConfig.py") # test + #include("MuonRecExample/MuonRec_topOptions.py") + +# from PerfMonComps.PerfMonFlags import jobproperties jobproperties.PerfMonFlags.doMonitoring = False @@ -253,12 +282,12 @@ ToolSvc += m_TrackSelectorTool_TightPrimary print (m_TrackSelectorTool_TightPrimary) # track refitters -print (' ========= runzmumu == including ElectronEoverPTracking.py for defining track fitters') +print (' == runzmumu == including ElectronEoverPTracking.py for defining track fitters') include("InDetPerformanceMonitoring/ElectronEoverPTracking.py") # track to vertex association if ('22.0' in os.getenv("Athena_VERSION")): - print (" ========= runzmumu == trakc to vertex association tool: defining working point ") + print (" == runzmumu == track to vertex association tool: defining working point ") from TrackVertexAssociationTool.TrackVertexAssociationToolConf import CP__TrackVertexAssociationTool t2vatool = CP__TrackVertexAssociationTool(name = "TrackVertexAssociationTool", WorkingPoint="SV_Reject") @@ -268,10 +297,10 @@ ServiceMgr.THistSvc.Output += ["ZmumuValidationUserSel DATAFILE='ZmumuValidation trackrefit1 = MuonRefitterTool if ('22.0' in os.getenv("Athena_VERSION")): - print (' ========= runzmumu == Rel 22 --> trackrefit2 = MuonRefitterToolIDSiOnly') + print (' == runzmumu == Rel 22 --> trackrefit2 = MuonRefitterToolIDSiOnly') trackrefit2 = MuonRefitterToolIDSiOnly else: - print (' ========= runzmumu == Rel 21 --> trackrefit2 = MuonRefitterTool2') + print (' == runzmumu == Rel 21 --> trackrefit2 = MuonRefitterTool2') trackrefit2 = MuonRefitterTool2 from InDetPerformanceMonitoring.InDetPerformanceMonitoringConf import IDPerfMonZmumu -- GitLab From d1646caeaadcaa386502379d7068e72d659bd181 Mon Sep 17 00:00:00 2001 From: Salvador Marti I Garcia <salvador.marti@cern.ch> Date: Thu, 25 Mar 2021 23:08:40 +0100 Subject: [PATCH 4/5] runzmumu_test.py works with DAOD and DRAW (still not muons) --- .../InDetPerformanceMonitoring/share/MuonConfig.py | 1 + .../share/runzmumu_test.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py index d7cdfdd28c85..0f9a7b1ab5e7 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/MuonConfig.py @@ -57,6 +57,7 @@ muonCombinedRecFlags.printSummary = True ##### no more flags after this line ##### try: + print (' == runzmumu == muonconfig == include("MuonRecExample/MuonRec_topOptions.py")') include("MuonRecExample/MuonRec_topOptions.py") ###### put any user finetuning after this line ##### diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py index c7e7c6a2a7fe..06f6c019613e 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/share/runzmumu_test.py @@ -8,7 +8,7 @@ import socket # find hostname with socket.gethostname() print (' == runzmumu == START == TestArea = %s' %os.getenv("TestArea")) ############################### # MC -MC_bool = False +MC_bool = True # user defined ID alignment constants inputConstantsFile = "NONE" @@ -36,7 +36,7 @@ if (MC_bool): PoolInput = ["/eos/user/m/martis/data/InputFileForGridJobs/ZmumuMC16_AOD.18379878._000123.pool.root.1"] conditionsTag = "default" -conditionsTag = "CONDBR2-BLKPA-2018-14" +#conditionsTag = "CONDBR2-BLKPA-2018-14" #conditionsTag = "CONDBR2-BLKPA-RUN2-03" ########################################################### @@ -129,7 +129,7 @@ if any ("DRAW" in infiles for infiles in ConfigFlags.Input.Files): # then athena thinks input is MC --> fix the data type if not MC_bool: globalflags.DataSource.set_Value_and_Lock("data") - if (inputIsDRAW): globalflags.InputFormat.set_Value_and_Lock("bytestream") + # from GeoModelSvc.GeoModelSvcConf import GeoModelSvc GeoModelSvc = GeoModelSvc() @@ -147,8 +147,8 @@ rec.doLucid.set_Value_and_Lock(False) rec.doTile.set_Value_and_Lock(False) rec.doLArg.set_Value_and_Lock(False) rec.doCalo.set_Value_and_Lock(False) -rec.doMuon.set_Value_and_Lock(True) -rec.doMuonCombined.set_Value_and_Lock(True) +rec.doMuon.set_Value_and_Lock(False) +rec.doMuonCombined.set_Value_and_Lock(False) rec.doEgamma.set_Value_and_Lock(False) if (inputIsDRAW): @@ -263,6 +263,8 @@ include("RecExCommon/RecExCommon_topOptions.py") # if ('22.' in os.getenv("Athena_VERSION") and inputIsDRAW): ToolSvc.InDetAmbiTrackSelectionTool.doEmCaloSeed = False + +if ('22.' in os.getenv("Athena_VERSION") and inputIsDRAW and False): print (' == runzmumu == include("MuonConfig.py")') include("MuonConfig.py") # test #include("MuonRecExample/MuonRec_topOptions.py") -- GitLab From fa2d4323186298f50d6b7577e27de0e3bb30c181 Mon Sep 17 00:00:00 2001 From: Salvador Marti I Garcia <salvador.marti@cern.ch> Date: Fri, 26 Mar 2021 00:08:47 +0100 Subject: [PATCH 5/5] add sigma_qOverP variable to refit1 ntuple --- .../InDetPerformanceMonitoring/IDPerfMonZmumu.h | 2 ++ .../src/IDPerfMonZmumu.cxx | 17 ++++++++++++----- .../src/ZmumuEvent.cxx | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h index ac6263a0b813..7299628961b2 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/InDetPerformanceMonitoring/IDPerfMonZmumu.h @@ -190,6 +190,7 @@ class IDPerfMonZmumu : public AthAlgorithm double m_positive_d0{}; double m_positive_z0_err{}; double m_positive_d0_err{}; + double m_positive_sigma_qOverP{}; double m_positive_z0_PV{}; double m_positive_d0_PV{}; double m_positive_z0_PVerr{}; @@ -217,6 +218,7 @@ class IDPerfMonZmumu : public AthAlgorithm double m_negative_d0{}; double m_negative_z0_err{}; double m_negative_d0_err{}; + double m_negative_sigma_qOverP{}; double m_negative_z0_PV{}; double m_negative_d0_PV{}; double m_negative_z0_PVerr{}; diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx index e46da60b240e..03a20e4b1f4e 100755 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx @@ -285,6 +285,7 @@ StatusCode IDPerfMonZmumu::bookTrees() m_defaultTree->Branch("Negative_d0", &m_negative_d0, "Negative_d0/D"); m_defaultTree->Branch("Negative_z0_err", &m_negative_z0_err, "Negative_z0_err/D"); m_defaultTree->Branch("Negative_d0_err", &m_negative_d0_err, "Negative_d0_err/D"); + m_defaultTree->Branch("Positive_Px", &m_positive_px, "Positive_Px/D"); m_defaultTree->Branch("Positive_Py", &m_positive_py, "Positive_Py/D"); m_defaultTree->Branch("Positive_Pz", &m_positive_pz, "Positive_Pz/D"); @@ -371,7 +372,7 @@ StatusCode IDPerfMonZmumu::bookTrees() m_refit1Tree->Branch("Negative_d0", &m_negative_d0, "Negative_d0/D"); m_refit1Tree->Branch("Negative_z0_err", &m_negative_z0_err, "Negative_z0_err/D"); m_refit1Tree->Branch("Negative_d0_err", &m_negative_d0_err, "Negative_d0_err/D"); - + m_refit1Tree->Branch("Negative_sigma_qoverp", &m_negative_sigma_qOverP, "Negative_sigma_qoverp/D"); m_refit1Tree->Branch("Positive_Px", &m_positive_px, "Positive_Px/D"); m_refit1Tree->Branch("Positive_Py", &m_positive_py, "Positive_Py/D"); @@ -380,6 +381,7 @@ StatusCode IDPerfMonZmumu::bookTrees() m_refit1Tree->Branch("Positive_d0", &m_positive_d0, "Positive_d0/D"); m_refit1Tree->Branch("Positive_z0_err", &m_positive_z0_err, "Positive_z0_err/D"); m_refit1Tree->Branch("Positive_d0_err", &m_positive_d0_err, "Positive_d0_err/D"); + m_refit1Tree->Branch("Positive_sigma_qoverp", &m_positive_sigma_qOverP, "Positive_sigma_qoverp/D"); if(m_doIP){ m_refit1Tree->Branch("Negative_d0_PV", &m_negative_d0_PV , "Negative_d0_PV/D"); @@ -1288,7 +1290,7 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp double PVz0res = 0; double PVd0 = 0; double PVz0 = 0; - + double sigma_qOverP = 0; px = trackp->p4().Px(); py = trackp->p4().Py(); @@ -1296,9 +1298,10 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp d0 = trackp->d0(); z0 = trackp->z0(); - d0res = std::sqrt(trackp->definingParametersCovMatrix()(0,0)); - z0res = std::sqrt(trackp->definingParametersCovMatrix()(1,1)); - + d0res = std::sqrt(trackp->definingParametersCovMatrix()(Trk::d0,Trk::d0)); + z0res = std::sqrt(trackp->definingParametersCovMatrix()(Trk::z0,Trk::z0)); + sigma_qOverP = std::sqrt(trackp->definingParametersCovMatrix()(Trk::qOverP,Trk::qOverP)); + if (vertex == nullptr) { ATH_MSG_WARNING("in FillRecParametersTP. WARNING: Vertex is NULL"); return StatusCode::FAILURE; @@ -1340,6 +1343,7 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp m_positive_z0_err = z0res; m_positive_d0 = d0; m_positive_d0_err = d0res; + m_positive_sigma_qOverP = sigma_qOverP; if(m_doIP){ m_positive_z0_PV = PVz0; m_positive_d0_PV = PVd0; @@ -1356,6 +1360,7 @@ StatusCode IDPerfMonZmumu::FillRecParametersTP(const xAOD::TrackParticle* trackp m_negative_z0_err = z0res; m_negative_d0 = d0; m_negative_d0_err = d0res; + m_negative_sigma_qOverP = sigma_qOverP; if(m_doIP){ m_negative_z0_PV = PVz0; m_negative_d0_PV = PVd0; @@ -1784,6 +1789,7 @@ void IDPerfMonZmumu::Clear4MuNtupleVariables() m_positive_z0 = 0.; m_positive_d0_err = 0.; m_positive_z0_err = 0.; + m_positive_sigma_qOverP = 0.; m_positive_1_vtx = 0; m_positive_parent = 0; @@ -1794,6 +1800,7 @@ void IDPerfMonZmumu::Clear4MuNtupleVariables() m_negative_z0 = 0.; m_negative_d0_err = 0.; m_negative_z0_err = 0.; + m_negative_sigma_qOverP = 0.; m_negative_1_vtx = 0; m_negative_parent = 0; diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx index 94c516e82e8a..f4c01fc19014 100644 --- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx +++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/ZmumuEvent.cxx @@ -657,7 +657,7 @@ void ZmumuEvent::finalize() { m_xMuonID.finalize(); - std::cout << " ** ZmumuEvent ** STATS -- " << std::endl + std::cout << " ** ZmumuEvent ** -- STATS -- " << std::endl << " Analyzed events : " << m_analyzedEventCount << std::endl << " Tested muons : " << m_testedMuonCount << std::endl << " Accepted muons : " << m_acceptedMuonCount << std::endl -- GitLab