From 01c9114253215837dad1231612d70e74e6e0220e Mon Sep 17 00:00:00 2001 From: Carlo Battilana Date: Mon, 3 Apr 2023 16:58:30 +0200 Subject: [PATCH] Fix documentation and add GEM OH status flat table producer --- .../plugins/MuDigiFlatTableProducers.cc | 4 ++ .../python/customiseMuNtuples_cff.py | 25 ++++++++ .../MuonTools/python/nano_mu_digi_cff.py | 60 ++++++++++++++----- .../python/nano_mu_local_reco_cff.py | 35 ++++++----- .../MuonTools/python/nano_mu_reco_cff.py | 14 ++--- 5 files changed, 101 insertions(+), 37 deletions(-) diff --git a/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc b/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc index d701ad4d939e8..33c0b58b0c643 100644 --- a/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc +++ b/DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc @@ -24,6 +24,9 @@ using RPCDigiFlatTableProducer = MuDigiBaseProducer; #include "DataFormats/GEMDigi/interface/GEMDigiCollection.h" using GEMDigiFlatTableProducer = MuDigiBaseProducer; +#include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h" +using GEMOHStatusFlatTableProducer = MuDigiBaseProducer; + #include "FWCore/PluginManager/interface/ModuleDef.h" #include "FWCore/Framework/interface/MakerMacros.h" @@ -32,3 +35,4 @@ DEFINE_FWK_MODULE(CSCALCTDigiFlatTableProducer); DEFINE_FWK_MODULE(DTDigiFlatTableProducer); DEFINE_FWK_MODULE(RPCDigiFlatTableProducer); DEFINE_FWK_MODULE(GEMDigiFlatTableProducer); +DEFINE_FWK_MODULE(GEMOHStatusFlatTableProducer); diff --git a/DPGAnalysis/MuonTools/python/customiseMuNtuples_cff.py b/DPGAnalysis/MuonTools/python/customiseMuNtuples_cff.py index 419c58afd4cc2..6630cafce20d2 100644 --- a/DPGAnalysis/MuonTools/python/customiseMuNtuples_cff.py +++ b/DPGAnalysis/MuonTools/python/customiseMuNtuples_cff.py @@ -10,3 +10,28 @@ def customiseForRunningOnMC(process, pathName) : process.muNtupleTwinMuxInThFiller.dtTpTag = "none" return process + +def customiseForMuonWorkflow(process) : + print("[customiseForMuonWorkflow]: adding VarParsing") + + import FWCore.ParameterSet.VarParsing as VarParsing + options = VarParsing.VarParsing() + + options.register('globalTag', + '130X_dataRun3_Express_v1', #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.string, + "Global Tag") + + options.register('nEvents', + 100, #default value + VarParsing.VarParsing.multiplicity.singleton, + VarParsing.VarParsing.varType.int, + "Maximum number of processed events") + + options.parseArguments() + + process.GlobalTag.globaltag = cms.string(options.globalTag) + process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(options.nEvents)) + + return process \ No newline at end of file diff --git a/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py b/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py index 396f9e45fcf96..b7cb2d7d3baa3 100644 --- a/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py +++ b/DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py @@ -5,13 +5,14 @@ from DPGAnalysis.MuonTools.dtDigiFlatTableProducer_cfi import dtDigiFlatTableProducer -dtDigiFlatTableProducer.name = "dtDigi_t" +dtDigiFlatTableProducer.name = "dtDigiT" dtDigiFlatTableProducer.src = "muonDTDigis" +dtDigiFlatTableProducer.doc = "DT digi information" dtDigiFlatTableProducer.variables = cms.PSet( time = Var("time()", float, doc = "digi time"), wire = Var("wire()", "int8", doc="wire - [1:X] range" - "
X varies for different chambers SLs and layers") + "
(X varies for different chambers SLs and layers)") ) dtDigiFlatTableProducer.detIdVariables = cms.PSet( @@ -29,23 +30,24 @@ from DPGAnalysis.MuonTools.rpcDigiFlatTableProducer_cfi import rpcDigiFlatTableProducer -rpcDigiFlatTableProducer.name = "rpcDigi_t" +rpcDigiFlatTableProducer.name = "rpcDigiT" rpcDigiFlatTableProducer.src = "muonRPCDigis" +rpcDigiFlatTableProducer.doc = "RPC digi information" rpcDigiFlatTableProducer.variables = cms.PSet( - strip = Var("strip()", "uint8", doc = "strip number fired in a given BX"), - bx = Var("bx()", int, doc="bunch crossing number") + strip = Var("strip()", "uint8", doc = "index of the readout strip associated to the digi"), + bx = Var("bx()", int, doc="bunch crossing associated to the digi") ) rpcDigiFlatTableProducer.detIdVariables = cms.PSet( - region = DetIdVar("region()", "int8", doc = "0: barrel, +-1: endcap"), + region = DetIdVar("region()", "int8", doc = "0: barrel, +/-1: endcap"), ring = DetIdVar("ring()", "int8", doc = "ring id:" - "
wheel number in barrel (from -2 to +2)" - "
ring number in endcap (from 1 to 3)"), + "
wheel number in barrel - [-2:+2] range" + "
ring number in endcap - [1:3] range"), station = DetIdVar("station()", "int8", doc = "chambers at same R in barrel, chambers at same Z ion endcap"), layer = DetIdVar("layer()", "int8", doc = "layer id:" - "
in station 1 and 2 for barrel, we have two layers of chambers:" - "
layer 1 is the inner chamber and layer 2 is the outer chamber"), + "
barrel stations 1 and 2, have two layers of chambers " + "(layer 1 is the inner chamber and layer 2 is the outer chamber)"), sector = DetIdVar("sector()", "int8", doc = "group of chambers at same phi"), subsector = DetIdVar("subsector()", "int8", doc = "Some sectors are divided along the phi direction in subsectors " "(from 1 to 4 in Barrel, from 1 to 6 in Endcap)"), @@ -56,23 +58,51 @@ from DPGAnalysis.MuonTools.gemDigiFlatTableProducer_cfi import gemDigiFlatTableProducer -gemDigiFlatTableProducer.name = "gemDigi_t" +gemDigiFlatTableProducer.name = "gemDigiT" gemDigiFlatTableProducer.src = "muonGEMDigis" +gemDigiFlatTableProducer.doc = "GEM digi information" gemDigiFlatTableProducer.variables = cms.PSet( strip = Var("strip()", "int8", doc = "index of the readout strip associated to the digi"), - bx = Var("bx()", "int8", doc="bunch crossing number") + bx = Var("bx()", "int8", doc="bunch crossing associated to the digi") ) gemDigiFlatTableProducer.detIdVariables = cms.PSet( - station = DetIdVar("station()", "int8", doc = "GEM station
always 1 for GE1/1)"), + station = DetIdVar("station()", "int8", doc = "GEM station
(always 1 for GE1/1)"), region = DetIdVar("region()", "int8", doc = "GE11 region where the digi is detected" - "
(int, positive endcap: +1, negative endcap: -1"), + "
(int, positive endcap: +1, negative endcap: -1)"), roll = DetIdVar("roll()", "int8", doc = "roll id (also known as eta partition)" - "
(partitions numbered from 1 to 8") + "
(partitions numbered from 1 to 8)") +) + + + +from DPGAnalysis.MuonTools.gemohStatusFlatTableProducer_cfi import gemohStatusFlatTableProducer + +gemohStatusFlatTableProducer.name = "gemOHStatusT" +gemohStatusFlatTableProducer.src = "muonGEMDigis:OHStatus:" +gemohStatusFlatTableProducer.doc = "GEM OH status information" + + +gemohStatusFlatTableProducer.variables = cms.PSet( +chamberType = Var("chamberType()", "int", doc = "two digits number that specifies the module within a chamber
11,12 for GE1/1 chambers layer 1,2
21,22,23,24 for GE2/1 chambers module 1,2,3,4"), +vfatMask = Var("vfatMask()", "uint", doc = "24 bit word that specifies the VFAT Mask
nth bit == 0 means that the VFAT_n was masked from the DAQ in the event"), +zsMask = Var("zsMask()", "uint", doc = "24 bit word that specifies the Zero Suppression
nth bit == 1 means that the VFAT_n was zero suppressed"), +missingVFATs = Var("missingVFATs()", "uint", doc = "24 bit word that specifies the missing VFAT mask
nth bit == 1 means that the VFAT_n was expected in the payload but not found"), +errors = Var("errors()", "uint16", doc = "code for GEM OH errors
non-zero values indicate errors"), +warnings = Var("warnings()", "uint16", doc = "code for GEM OH warnings
non-zero values indicate warnings") +) + +gemohStatusFlatTableProducer.detIdVariables = cms.PSet( + station = DetIdVar("station()", "int8", doc = "GEM station
always 1 for GE1/1)"), + region = DetIdVar("region()", "int8", doc = "region with which the GEMOHStatus is associated" + "
int, positive endcap: +1, negative endcap: -1"), + chamber = DetIdVar("chamber()", "int8", doc = "chamber with which the GEMOHStatus is associated"), + layer = DetIdVar("layer()", "int8", doc = "layer with which the GEMOHStatus is associated
either 1 or 2 for GE1/1 and GE2/1") ) muDigiProducers = cms.Sequence(dtDigiFlatTableProducer + rpcDigiFlatTableProducer + gemDigiFlatTableProducer + + gemohStatusFlatTableProducer ) diff --git a/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py b/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py index 0dae09ed012f2..57bf81dbb0c74 100644 --- a/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py +++ b/DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py @@ -5,8 +5,9 @@ from PhysicsTools.NanoAOD.common_cff import * from DPGAnalysis.MuonTools.common_cff import * -dtSegmentFlatTableProducer.name = "dtSeg_t" +dtSegmentFlatTableProducer.name = "dtSegmentT" dtSegmentFlatTableProducer.src = "dt4DSegments" +dtSegmentFlatTableProducer.doc = "DT segment information" dtSegmentFlatTableProducer.variables = cms.PSet( seg4D_hasPhi = Var("hasPhi()", bool, doc = "has segment phi view - bool"), @@ -48,8 +49,9 @@ from DPGAnalysis.MuonTools.rpcRecHitFlatTableProducer_cfi import rpcRecHitFlatTableProducer -rpcRecHitFlatTableProducer.name = "rpcRecHit_t" +rpcRecHitFlatTableProducer.name = "rpcRecHitT" rpcRecHitFlatTableProducer.src = "rpcRecHits" +rpcRecHitFlatTableProducer.doc = "RPC rec-hit information" rpcRecHitFlatTableProducer.variables = cms.PSet( bx = Var("BunchX()", int, doc="bunch crossing number"), @@ -80,31 +82,33 @@ from DPGAnalysis.MuonTools.gemRecHitFlatTableProducer_cfi import gemRecHitFlatTableProducer -gemRecHitFlatTableProducer.name = "gemRecHit_t" +gemRecHitFlatTableProducer.name = "gemRecHitT" gemRecHitFlatTableProducer.src = "gemRecHits" +gemRecHitFlatTableProducer.doc = "GEM rec-hit information" gemRecHitFlatTableProducer.variables = cms.PSet( - loc_r = Var("localPosition().perp()", float, doc = "hit position r in local coordinates - cm"), + bx = Var("BunchX()", int, doc="bunch crossing number"), + clusterSize = Var("clusterSize()", "int8", doc = "number of strips in the cluster"), loc_x = Var("localPosition().x()", float, doc = "hit position x in local coordinates - cm"), + firstClusterStrip = Var("firstClusterStrip()", "int8", doc = "lowest-numbered strip in the cluster"), loc_phi = Var("localPosition().phi().value()", float, doc = "hit position phi in local coordinates - rad"), - loc_x = Var("localPosition().x()", float, doc = "hit position x in local coordinates - cm"), loc_y = Var("localPosition().y()", float, doc = "hit position y in local coordinates - cm"), loc_z = Var("localPosition().z()", float, doc = "hit position z in local coordinates - cm"), ) gemRecHitFlatTableProducer.detIdVariables = cms.PSet( roll = DetIdVar("roll()", "int8", doc = "roll id, also known as eta partition:" - "
(partitions numbered from 1 to 8"), + "
(partitions numbered from 1 to 8)"), region = DetIdVar("region()", "int8", doc = "GE11 region where the hit is reconstructed" - "
(int, positive endcap: +1, negative endcap: -1"), + "
(int, positive endcap: +1, negative endcap: -1)"), chamber = DetIdVar("chamber()", "int8", doc = "GE11 superchamber where the hit is reconstructed" - "
(chambers numbered from 0 to 35"), + "
(chambers numbered from 0 to 35)"), layer = DetIdVar("layer()", "int8", doc = "GE11 layer where the hit is reconstructed" - "
(layer1: 1, layer2: 2") + "
(layer1: 1, layer2: 2)") ) gemRecHitFlatTableProducer.globalPosVariables = cms.PSet( g_r = GlobGeomVar("perp()", doc = "hit position r in global coordinates - cm"), - g_phi = GlobGeomVar("phi().value()", doc = "hit position phi in global coordinates - rad"), + g_phi = GlobGeomVar("phi().value()", doc = "hit position phi in global coordinates - radians [-pi:pi]"), g_x = GlobGeomVar("x()", doc = "hit position x in global coordinates - cm"), g_y = GlobGeomVar("y()", doc = "hit position y in global coordinates - cm"), g_z = GlobGeomVar("z()", doc = "hit position z in global coordinates - cm") @@ -112,12 +116,13 @@ from DPGAnalysis.MuonTools.gemSegmentFlatTableProducer_cfi import gemSegmentFlatTableProducer -gemSegmentFlatTableProducer.name = "gemSeg_t" +gemSegmentFlatTableProducer.name = "gemSegT" gemSegmentFlatTableProducer.src = "gemSegments" +gemSegmentFlatTableProducer.doc = "GEM segment information" gemSegmentFlatTableProducer.variables = cms.PSet( - chi2 = Var("chi2()", int, doc = ""), - time = Var("bunchX()", int, doc="bunch crossing number"), + chi2 = Var("chi2()", int, doc = "chi2 from segment fit"), + bx = Var("bunchX()", int, doc="bunch crossing number"), posLoc_x = Var("localPosition().x()", float, doc = "position x in local coordinates - cm"), posLoc_y = Var("localPosition().y()", float, doc = "position y in local coordinates - cm"), posLoc_z = Var("localPosition().z()", float, doc = "position z in local coordinates - cm"), @@ -128,9 +133,9 @@ gemSegmentFlatTableProducer.detIdVariables = cms.PSet( region = DetIdVar("region()", "int8", doc = "GE11 region where the hit is reconstructed" - "
(int, positive endcap: +1, negative endcap: -1"), + "
(int, positive endcap: +1, negative endcap: -1)"), ring = DetIdVar("ring()", "int8", doc = ""), - station = DetIdVar("station()", "int8", doc = "GEM station
always 1 for GE1/1)"), + station = DetIdVar("station()", "int8", doc = "GEM station
(always 1 for GE1/1)"), ) gemSegmentFlatTableProducer.globalPosVariables = cms.PSet( diff --git a/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py b/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py index 303cede7aeb78..bfe2df7473d0c 100644 --- a/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py +++ b/DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py @@ -10,12 +10,12 @@ muonFlatTableProducer = simpleCandidateFlatTableProducer.clone( src = cms.InputTag("patMuons"), - name = cms.string("muon_t"), - doc = cms.string("..."), + name = cms.string("muonT"), + doc = cms.string("DT digi information"), variables = cms.PSet(CandVars, # CB is this including eta - isGlobal = Var("isGlobalMuon", bool, doc="muon is global muon"), - isTracker = Var("isTrackerMuon", bool, doc="muon is tracker muon"), + isGlobal = Var("isGlobalMuon", bool, doc="muon is a global muon"), + isTracker = Var("isTrackerMuon", bool, doc="muon is a tracker muon"), # isTrackerArb = Var("muon::isGoodMuon(muon, muon::TrackerMuonArbitrated)", bool, doc="muon is tracker muon arbitrated"), isStandalone = Var("isStandAloneMuon", bool, doc="muon is a standalone muon"), isRPC = Var("isRPCMuon", bool, doc="muon is an RPC muon"), @@ -25,8 +25,8 @@ isMedium = Var("passed('CutBasedIdMedium')", bool, doc="Medium muon ID"), isTight = Var("passed('CutBasedIdTight')", bool, doc="Tight muon ID"), - pfIso04 = Var("(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt", float, doc="Relative tracker isolation (0.3 cone)", precision=6), - trkIso03 = Var("isolationR03().sumPt/tunePMuonBestTrack().pt", float, doc="Relative PF-isolation (delta beta corrected, 0.4 cone)", precision=6), + pfIso04 = Var("(pfIsolationR04().sumChargedHadronPt + max(pfIsolationR04().sumNeutralHadronEt + pfIsolationR04().sumPhotonEt - pfIsolationR04().sumPUPt/2,0.0))/pt", float, doc="Relative PF-isolation (delta beta corrected, 0.4 cone)", precision=6), + trkIso03 = Var("isolationR03().sumPt/tunePMuonBestTrack().pt", float, doc="Relative tracker isolation (0.3 cone)", precision=6), trk_dz = Var(f"?!innerTrack().isNull()? dB('PVDZ') : {defaults.FLOAT}", float, doc="dz (with sign) wrt first PV - cm", precision=10), trk_dxy = Var(f"?!innerTrack().isNull()? dB('PV2D') : {defaults.FLOAT}", float, doc="dxy (with sign) wrt first PV - cm", precision=10), @@ -36,7 +36,7 @@ trk_numberOfValidPixelHits = Var(f"?!innerTrack().isNull()? innerTrack().hitPattern().numberOfValidPixelHits() : {defaults.INT_POS}", "int8", doc="number of valid pixel hits"), trk_numberOfValidTrackerLayers = Var(f"?!innerTrack().isNull()? innerTrack().hitPattern().trackerLayersWithMeasurement() : {defaults.INT_POS}", "int8", doc="number of valid tracker layers"), - trk_validFraction = Var(f"?!innerTrack().isNull()? innerTrack().validFraction() : {defaults.FLOAT_POS}", "int8", doc="number of valid pixel hits"), + trk_validFraction = Var(f"?!innerTrack().isNull()? innerTrack().validFraction() : {defaults.FLOAT_POS}", "int8", doc="fraction of tracker layer with muon hits"), trkMu_stationMask = Var("stationMask()", "uint8", doc="bit map of stations with tracks within given distance (in cm) of chamber edges"), trkMu_numberOfMatchedStations = Var("numberOfMatchedStations()", "int8", doc="number of matched DT/CSC stations"),