Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes/impovements towards the first production version of the custom muon DPG NANO #43065

Merged
merged 3 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_nano.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,33 @@ def subnext(self):
steps['MuonEG2023MINIAOD13.0'] = { 'INPUT':InputInfo(location='STD',ls=run3_lumis,
dataSet='/MuonEG/Run2023C-PromptReco-v4/MINIAOD')}

steps['ZMuSkim2023DRAWRECO13.0'] = { 'INPUT':InputInfo(location='STD',ls={ 370775: [[1, 168]]},
dataSet='/Muon0/Run2023D-ZMu-PromptReco-v2/RAW-RECO')}

steps['ZeroBias2023DRAW13.0']={'INPUT':InputInfo(location='STD', ls={369978: [[1, 800]]},
dataSet='/ZeroBias/Run2023D-v1/RAW')}

steps['NANO_data13.0']=merge([{'--era':'Run3',
'--conditions':'auto:run3_data'},
_NANO_data])

steps['NANO_data13.0_prompt']=merge([{'--customise' : 'PhysicsTools/NanoAOD/nano_cff.nanoL1TrigObjCustomize', '-n' : '1000'},
steps['NANO_data13.0']])

steps['muDPGNANO_data13.0']=merge([{'-s' : 'RAW2DIGI,NANO:@MUDPG',
'--conditions':'auto:run3_data',
'-n' : '100',
'--era' : 'Run3',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD'}])

steps['muDPGNANOBkg_data13.0']=merge([{'-s' : 'RAW2DIGI,NANO:@MUDPGBKG',
'--conditions':'auto:run3_data',
'-n' : '100',
'--era' : 'Run3',
'--datatier':'NANOAOD',
'--eventcontent':'NANOAOD'}])

###current release cycle workflows : 13.2
steps['TTBarMINIAOD13.2'] = {'INPUT':InputInfo(location='STD',
## dataset below to be replaced with a 13.2 relval sample when available
Expand Down Expand Up @@ -208,6 +228,8 @@ def subnext(self):
_wfn.subnext()
workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0', 'HRV_NANO_data']]
workflows[_wfn()] = ['NANOdata130Xrun3', ['MuonEG2023MINIAOD13.0', 'NANO_data13.0_prompt', 'HRV_NANO_data']]
workflows[_wfn()] = ['muDPGNANO130Xrun3', ['ZMuSkim2023DRAWRECO13.0', 'muDPGNANO_data13.0']]
workflows[_wfn()] = ['muDPGNANOBkg130Xrun3', ['ZeroBias2023DRAW13.0', 'muDPGNANOBkg_data13.0']]

_wfn.next()
################
Expand Down
8 changes: 6 additions & 2 deletions DPGAnalysis/MuonTools/plugins/MuCSCTnPFlatTableProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
#include "TrackingTools/Records/interface/TransientTrackRecord.h"
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
#include "TrackingTools/GeomPropagators/interface/Propagator.h"
#include "TrackingTools/TrajectoryParametrization/interface/GlobalTrajectoryParameters.h"
#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h"

class MuonServiceProxy;

Expand Down Expand Up @@ -383,9 +381,13 @@ void MuCSCTnPFlatTableProducer::fillTable(edm::Event& ev) {
m_chamberEndcap.push_back(endcapCSC * 1);

Int_t iiStationFail = 0;
Int_t iiStation0Pass = 0;
for (int iiStationZ = 0; iiStationZ < 6; iiStationZ++) {
UChar_t stationCSC = iiStationZ > 2 ? iiStationZ - 2 : 0;
UChar_t ringCSC = 0;
// Could monitor this problem here if necessary;
if (stationCSC == 0 && iiStation0Pass > 0)
continue;
TrajectoryStateOnSurface tsos = surfExtrapTrkSam(track, ec ? MEZ[iiStationZ] : -MEZ[iiStationZ]);

if (tsos.isValid()) {
Expand All @@ -407,6 +409,8 @@ void MuCSCTnPFlatTableProducer::fillTable(edm::Event& ev) {
tsos = surfExtrapTrkSam(track, Layer3Surface.position().z());

if (tsos.isValid()) {
if (stationCSC == 0)
iiStation0Pass++;
// Fill track intersection denominator information
LocalPoint localTTIntPoint = Layer3Surface.toLocal(tsos.freeState()->position());
const CSCLayerGeometry* layerGeoma = m_cscGeometry->chamber(Layer0Id)->layer(3)->geometry();
Expand Down
11 changes: 10 additions & 1 deletion DPGAnalysis/MuonTools/plugins/MuDTMuonExtTableProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,16 @@ void MuDTMuonExtTableProducer::fillTable(edm::Event& ev) {
tabMatches->setDoc("RECO muon matches_* vectors");

addColumn(tabMatches, "x", matches_x, "x position of the extrapolated track on the matched DT chamber");
addColumn(tabMatches, "y", matches_y, "x position of the extrapolated track on the matched DT chamber");
addColumn(tabMatches, "y", matches_y, "y position of the extrapolated track on the matched DT chamber");

addColumn(tabMatches,
"edgeX",
matches_edgeX,
"distance in x of the extrapolated track to the matched DT chamber border (<0 == inside the chamber)");
addColumn(tabMatches,
"edgeY",
matches_edgeY,
"distance in y of the extrapolated track to the matched DT chamber border (<0 == inside the chamber)");

addColumn(tabMatches, "wheel", matches_wheel, "matched DT chamber wheel");
addColumn(tabMatches, "sector", matches_sector, "matched DT chamber sector");
Expand Down
5 changes: 2 additions & 3 deletions DPGAnalysis/MuonTools/plugins/MuGEMMuonExtTableProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ void MuGEMMuonExtTableProducer::fillTable(edm::Event& ev) {
continue;
}

const auto&& start_state =
is_insideout ? transient_track.outermostMeasurementState() : transient_track.innermostMeasurementState();
auto& propagator = is_incoming ? propagator_along : propagator_opposite;
const auto&& start_state = transient_track.innermostMeasurementState();
auto& propagator = propagator_any;

auto recHitMu = outerTrackRef->recHitsBegin();
auto recHitMuEnd = outerTrackRef->recHitsEnd();
Expand Down
7 changes: 5 additions & 2 deletions DPGAnalysis/MuonTools/python/muNtupleProducerBkg_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

from PhysicsTools.NanoAOD.common_cff import *

from DPGAnalysis.MuonTools.nano_mu_global_cff import *
from DPGAnalysis.MuonTools.nano_mu_digi_cff import *

muNtupleProducerBkg = cms.Sequence(muDigiProducersBkg)
muDPGNanoProducerBkg = cms.Sequence(lhcInfoTableProducer
+ lumiTableProducer
+ muDigiProducersBkg)

def nanoAOD_customizeCommon(process) :
def muDPGNanoBkgCustomize(process) :

if hasattr(process, "NANOAODoutput"):
process.NANOAODoutput.outputCommands.append("keep nanoaodFlatTable_*Table*_*_*")
Expand Down
17 changes: 15 additions & 2 deletions DPGAnalysis/MuonTools/python/muNtupleProducer_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,32 @@

from PhysicsTools.NanoAOD.common_cff import *

from DPGAnalysis.MuonTools.nano_mu_global_cff import *
from DPGAnalysis.MuonTools.nano_mu_digi_cff import *
from DPGAnalysis.MuonTools.nano_mu_local_reco_cff import *
from DPGAnalysis.MuonTools.nano_mu_reco_cff import *
from DPGAnalysis.MuonTools.nano_mu_l1t_cff import *
from DPGAnalysis.MuonTools.nano_mu_l1t_cff import *

muNtupleProducer = cms.Sequence(muDigiProducers
muDPGNanoProducer = cms.Sequence(lhcInfoTableProducer
+ lumiTableProducer
+ muDigiProducers
+ muLocalRecoProducers
+ muRecoProducers
+ muL1TriggerProducers
)

def nanoAOD_customizeCommon(process) :
def muDPGNanoCustomize(process) :

if hasattr(process, "dtrpcPointFlatTableProducer") and \
hasattr(process, "cscrpcPointFlatTableProducer") and \
hasattr(process, "RawToDigiTask"):
process.load("RecoLocalMuon.RPCRecHit.rpcPointProducer_cff")
process.rpcPointProducer.dt4DSegments = 'dt4DSegments'
process.rpcPointProducer.cscSegments = 'cscSegments'
process.rpcPointProducer.ExtrapolatedRegion = 0.6
process.RawToDigiTask.add(process.rpcPointProducer)

if hasattr(process, "muGEMMuonExtTableProducer") or hasattr(process, "muCSCTnPFlatTableProducer"):
process.load("TrackingTools/TransientTrack/TransientTrackBuilder_cfi")
process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi")
Expand Down
15 changes: 15 additions & 0 deletions DPGAnalysis/MuonTools/python/nano_mu_global_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import FWCore.ParameterSet.Config as cms

from PhysicsTools.NanoAOD.common_cff import *

lumiTableProducer = cms.EDProducer("SimpleOnlineLuminosityFlatTableProducer",
src = cms.InputTag("onlineMetaDataDigis"),
name = cms.string("lumi"),
doc = cms.string("Online luminosity information"),
variables = cms.PSet(
instLumi = Var( "instLumi()", "double", doc = "Instantaneous luminosity"),
avgPileUp = Var( "avgPileUp()", "double", doc = "Average PU")
)
)

lhcInfoTableProducer = cms.EDProducer("LHCInfoProducer")
81 changes: 81 additions & 0 deletions DPGAnalysis/MuonTools/python/nano_mu_local_reco_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,85 @@
rawId = DetIdVar("rawId()", "uint", doc = "unique detector unit ID")
)

dtrpcPointFlatTableProducer = rpcRecHitFlatTableProducer.clone(name = 'dtrpcPointProducer', src = cms.InputTag('rpcPointProducer','RPCDTExtrapolatedPoints'), doc = "DT extrapolated point on RPC")

dtrpcPointFlatTableProducer.variables = cms.PSet(
coordX = Var("localPosition().x()", float, doc = "position x in local coordinates - cm"),
coordY = Var("localPosition().y()", float, doc = "position y in local coordinates - cm"),
coordZ = Var("localPosition().z()", float, doc = "position z in local coordinates - cm"),
)

dtrpcPointFlatTableProducer.detIdVariables = cms.PSet(
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)"),
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"),
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)"),
roll = DetIdVar("roll()", "int8", doc = "roll id (also known as eta partition):"
"<br />each chamber is divided along the strip direction"),
rawId = DetIdVar("rawId()", "uint", doc = "unique detector unit ID")
)
cscrpcPointFlatTableProducer = rpcRecHitFlatTableProducer.clone(name = 'cscToRpc',
src = cms.InputTag('rpcPointProducer','RPCCSCExtrapolatedPoints'),
doc = "CSC segment extrapolated on RPC")

cscrpcPointFlatTableProducer.variables = cms.PSet(
coordX = Var("localPosition().x()", float, doc = "position x in local coordinates - cm"),
coordY = Var("localPosition().y()", float, doc = "position y in local coordinates - cm"),
coordZ = Var("localPosition().z()", float, doc = "position z in local coordinates - cm"),
)

cscrpcPointFlatTableProducer.detIdVariables = cms.PSet(
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)"),
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"),
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)"),
roll = DetIdVar("roll()", "int8", doc = "roll id (also known as eta partition):"
"<br />each chamber is divided along the strip direction"),
rawId = DetIdVar("rawId()", "uint", doc = "unique detector unit ID")
)

dtrpcPointFlatTableProducer = rpcRecHitFlatTableProducer.clone(name = 'dtToRpc',
src = cms.InputTag('rpcPointProducer','RPCDTExtrapolatedPoints'),
doc = "DT segment extrapolated on RPC")

dtrpcPointFlatTableProducer.variables = cms.PSet(
coordX = Var("localPosition().x()", float, doc = "position x in local coordinates - cm"),
coordY = Var("localPosition().y()", float, doc = "position y in local coordinates - cm"),
coordZ = Var("localPosition().z()", float, doc = "position z in local coordinates - cm"),
)

dtrpcPointFlatTableProducer.detIdVariables = cms.PSet(
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)"),
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"),
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)"),
roll = DetIdVar("roll()", "int8", doc = "roll id (also known as eta partition):"
"<br />each chamber is divided along the strip direction"),
rawId = DetIdVar("rawId()", "uint", doc = "unique detector unit ID")
)


from DPGAnalysis.MuonTools.gemRecHitFlatTableProducer_cfi import gemRecHitFlatTableProducer

gemRecHitFlatTableProducer.name = "gemRecHit"
Expand Down Expand Up @@ -156,6 +235,8 @@
)

muLocalRecoProducers = cms.Sequence(rpcRecHitFlatTableProducer
+ dtrpcPointFlatTableProducer
+ cscrpcPointFlatTableProducer
+ gemRecHitFlatTableProducer
+ dtSegmentFlatTableProducer
+ muDTSegmentExtTableProducer
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/NanoAOD/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<use name="DataFormats/Candidate"/>
<use name="DataFormats/L1TGlobal"/>
<use name="DataFormats/NanoAOD"/>
<use name="DataFormats/OnlineMetaData"/>
<use name="DataFormats/PatCandidates"/>
<use name="DataFormats/ProtonReco"/>
<use name="FWCore/Framework"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ typedef SimpleFlatTableProducer<CTPPSLocalTrackLite> SimpleLocalTrackFlatTablePr
#include "DataFormats/Math/interface/Point3D.h"
typedef EventSingletonSimpleFlatTableProducer<math::XYZPointF> SimpleXYZPointFlatTableProducer;

#include "DataFormats/OnlineMetaData/interface/OnlineLuminosityRecord.h"
typedef EventSingletonSimpleFlatTableProducer<OnlineLuminosityRecord> SimpleOnlineLuminosityFlatTableProducer;

#include "DataFormats/BeamSpot/interface/BeamSpot.h"
typedef EventSingletonSimpleFlatTableProducer<reco::BeamSpot> SimpleBeamspotFlatTableProducer;

Expand Down Expand Up @@ -62,6 +65,7 @@ DEFINE_FWK_MODULE(SimpleHTXSFlatTableProducer);
DEFINE_FWK_MODULE(SimpleProtonTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimpleLocalTrackFlatTableProducer);
DEFINE_FWK_MODULE(SimpleXYZPointFlatTableProducer);
DEFINE_FWK_MODULE(SimpleOnlineLuminosityFlatTableProducer);
DEFINE_FWK_MODULE(SimpleBeamspotFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1EGFlatTableProducer);
DEFINE_FWK_MODULE(SimpleTriggerL1JetFlatTableProducer);
Expand Down
5 changes: 5 additions & 0 deletions PhysicsTools/NanoAOD/python/autoNANO.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ def expandNanoMapping(seqList, mapping, key):
# L1 flavours: add tables through customize, supposed to be combined with PHYS
'L1' : {'customize': 'nanoL1TrigObjCustomize'},
'L1FULL' : {'customize': 'nanoL1TrigObjCustomizeFull'},
# MUDPG flavours: use their own sequence
'MUDPG' : {'sequence': 'muDPGNanoProducer',
'customize': 'muDPGNanoCustomize'},
'MUDPGBKG' : {'sequence': 'muDPGNanoProducerBkg',
'customize': 'muDPGNanoBkgCustomize'},
# PromptReco config: PHYS+L1
'Prompt' : {'sequence': '@PHYS',
'customize': '@PHYS+@L1'}
Expand Down
5 changes: 5 additions & 0 deletions PhysicsTools/NanoAOD/python/nano_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,8 @@ def nanoL1TrigObjCustomize(process):
def nanoL1TrigObjCustomizeFull(process):
process.nanoTableTaskCommon.add(process.l1TablesTask)
return process

### muon DPG NANO flavour sequences and customize functions
from DPGAnalysis.MuonTools.muNtupleProducer_cff import *
from DPGAnalysis.MuonTools.muNtupleProducerBkg_cff import *