Skip to content

Commit

Permalink
Fix documentation and add GEM OH status flat table producer
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlo Battilana committed Apr 5, 2023
1 parent a4872b0 commit 01c9114
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 37 deletions.
4 changes: 4 additions & 0 deletions DPGAnalysis/MuonTools/plugins/MuDigiFlatTableProducers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ using RPCDigiFlatTableProducer = MuDigiBaseProducer<RPCDetId,RPCDigi>;
#include "DataFormats/GEMDigi/interface/GEMDigiCollection.h"
using GEMDigiFlatTableProducer = MuDigiBaseProducer<GEMDetId,GEMDigi>;

#include "DataFormats/GEMDigi/interface/GEMOHStatusCollection.h"
using GEMOHStatusFlatTableProducer = MuDigiBaseProducer<GEMDetId,GEMOHStatus>;

#include "FWCore/PluginManager/interface/ModuleDef.h"
#include "FWCore/Framework/interface/MakerMacros.h"

Expand All @@ -32,3 +35,4 @@ DEFINE_FWK_MODULE(CSCALCTDigiFlatTableProducer);
DEFINE_FWK_MODULE(DTDigiFlatTableProducer);
DEFINE_FWK_MODULE(RPCDigiFlatTableProducer);
DEFINE_FWK_MODULE(GEMDigiFlatTableProducer);
DEFINE_FWK_MODULE(GEMOHStatusFlatTableProducer);
25 changes: 25 additions & 0 deletions DPGAnalysis/MuonTools/python/customiseMuNtuples_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
60 changes: 45 additions & 15 deletions DPGAnalysis/MuonTools/python/nano_mu_digi_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
"<br />X varies for different chambers SLs and layers")
"<br />(X varies for different chambers SLs and layers)")
)

dtDigiFlatTableProducer.detIdVariables = cms.PSet(
Expand All @@ -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:"
"<br />wheel number in barrel (from -2 to +2)"
"<br />ring number in endcap (from 1 to 3)"),
"<br />wheel number in barrel - [-2:+2] range"
"<br />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:"
"<br />in station 1 and 2 for barrel, we have two layers of chambers:"
"<br />layer 1 is the inner chamber and layer 2 is the outer chamber"),
"<br />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)"),
Expand All @@ -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 <br />always 1 for GE1/1)"),
station = DetIdVar("station()", "int8", doc = "GEM station <br />(always 1 for GE1/1)"),
region = DetIdVar("region()", "int8", doc = "GE11 region where the digi is detected"
"<br />(int, positive endcap: +1, negative endcap: -1"),
"<br />(int, positive endcap: +1, negative endcap: -1)"),
roll = DetIdVar("roll()", "int8", doc = "roll id (also known as eta partition)"
"<br />(partitions numbered from 1 to 8")
"<br />(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<br /> 11,12 for GE1/1 chambers layer 1,2<br /> 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<br /> 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<br /> 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<br /> 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<br /> non-zero values indicate errors"),
warnings = Var("warnings()", "uint16", doc = "code for GEM OH warnings<br /> non-zero values indicate warnings")
)

gemohStatusFlatTableProducer.detIdVariables = cms.PSet(
station = DetIdVar("station()", "int8", doc = "GEM station <br />always 1 for GE1/1)"),
region = DetIdVar("region()", "int8", doc = "region with which the GEMOHStatus is associated"
"<br />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<br /> either 1 or 2 for GE1/1 and GE2/1")
)

muDigiProducers = cms.Sequence(dtDigiFlatTableProducer
+ rpcDigiFlatTableProducer
+ gemDigiFlatTableProducer
+ gemohStatusFlatTableProducer
)
35 changes: 20 additions & 15 deletions DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -80,44 +82,47 @@

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:"
"<br />(partitions numbered from 1 to 8"),
"<br />(partitions numbered from 1 to 8)"),
region = DetIdVar("region()", "int8", doc = "GE11 region where the hit is reconstructed"
"<br />(int, positive endcap: +1, negative endcap: -1"),
"<br />(int, positive endcap: +1, negative endcap: -1)"),
chamber = DetIdVar("chamber()", "int8", doc = "GE11 superchamber where the hit is reconstructed"
"<br />(chambers numbered from 0 to 35"),
"<br />(chambers numbered from 0 to 35)"),
layer = DetIdVar("layer()", "int8", doc = "GE11 layer where the hit is reconstructed"
"<br />(layer1: 1, layer2: 2")
"<br />(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")
)

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"),
Expand All @@ -128,9 +133,9 @@

gemSegmentFlatTableProducer.detIdVariables = cms.PSet(
region = DetIdVar("region()", "int8", doc = "GE11 region where the hit is reconstructed"
"<br />(int, positive endcap: +1, negative endcap: -1"),
"<br />(int, positive endcap: +1, negative endcap: -1)"),
ring = DetIdVar("ring()", "int8", doc = ""),
station = DetIdVar("station()", "int8", doc = "GEM station <br />always 1 for GE1/1)"),
station = DetIdVar("station()", "int8", doc = "GEM station <br />(always 1 for GE1/1)"),
)

gemSegmentFlatTableProducer.globalPosVariables = cms.PSet(
Expand Down
14 changes: 7 additions & 7 deletions DPGAnalysis/MuonTools/python/nano_mu_reco_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand All @@ -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),
Expand All @@ -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"),
Expand Down

0 comments on commit 01c9114

Please sign in to comment.