File indexing completed on 2024-04-06 11:56:24
0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003
0004 process = cms.Process("TBDtest")
0005
0006
0007 process.load("FWCore.MessageService.MessageLogger_cfi")
0008 process.MessageLogger.cerr.FwkReport.reportEvery = 10000
0009
0010 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
0011 process.load("RecoTracker.FinalTrackSelectors.TrackerTrackHitFilter_cff")
0012 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
0013 process.load("RecoTracker.Configuration.RecoTracker_cff")
0014 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cff")
0015 process.load("Configuration.StandardSequences.MagneticField_cff")
0016 process.load("Configuration.StandardSequences.Reconstruction_cff")
0017 process.load("Configuration.StandardSequences.Services_cff")
0018 process.load('Configuration.Geometry.GeometryRecoDB_cff')
0019 process.load("TrackingTools.TransientTrack.TransientTrackBuilder_cfi")
0020 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0021
0022
0023 from RecoTracker.GeometryESProducer.TrackerRecoGeometryESProducer_cfi import *
0024
0025
0026 from Geometry.MuonNumbering.muonNumberingInitialization_cfi import *
0027 from RecoMuon.DetLayers.muonDetLayerGeometry_cfi import *
0028
0029
0030 from Geometry.TrackerGeometryBuilder.idealForDigiTrackerGeometry_cff import *
0031 from Geometry.CSCGeometryBuilder.idealForDigiCscGeometry_cff import *
0032 from Geometry.DTGeometryBuilder.idealForDigiDtGeometry_cff import *
0033
0034 from Configuration.AlCa.GlobalTag import GlobalTag
0035 process.GlobalTag = GlobalTag(process.GlobalTag, "92X_dataRun2_Prompt_v2", '')
0036
0037
0038
0039
0040 import FWCore.PythonUtilities.LumiList as LumiList
0041
0042 lumiSecs = cms.untracked.VLuminosityBlockRange()
0043
0044
0045 readFiles = cms.untracked.vstring()
0046 readFiles.extend(
0047 [
0048 '/store/data/Run2017A/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/296/074/00000/22482926-304B-E711-802D-02163E011E07.root',
0049 '/store/data/Run2017A/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/296/116/00000/8E618859-214C-E711-80E5-02163E01A2CA.root',
0050 '/store/data/Run2017A/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v2/000/296/168/00000/6CD539ED-664C-E711-8ADB-02163E019B32.root',
0051 '/store/data/Run2017A/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v2/000/296/172/00000/4848F119-574C-E711-BECE-02163E01A6C9.root',
0052 '/store/data/Run2017A/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v2/000/296/173/00000/1C60AD2B-6B4C-E711-B956-02163E019D21.root',
0053 '/store/data/Run2017A/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v2/000/296/174/00000/B4CAA428-6F4C-E711-BE3A-02163E019CC4.root',
0054 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/292/00000/D6E5FC1A-2B59-E711-9CDD-02163E0120DD.root',
0055 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/293/00000/CCBA5DE5-2F59-E711-BE7E-02163E0143BC.root',
0056 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/296/00000/F8F2DBC5-2159-E711-94A0-02163E0127C7.root',
0057 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/308/00000/A4CA2410-1A59-E711-9FCC-02163E0129A2.root',
0058 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/316/00000/9CAAA3AC-0859-E711-9B38-02163E014310.root',
0059 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/359/00000/6EC237E0-8859-E711-A1A4-02163E011939.root',
0060 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/411/00000/64D101B3-185A-E711-98BF-02163E01375A.root',
0061 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/424/00000/C6F85109-525A-E711-878D-02163E014135.root',
0062 '/store/data/Run2017B/DoubleMuon/ALCARECO/TkAlZMuMu-PromptReco-v1/000/297/425/00000/D0C30579-4F5A-E711-A637-02163E01445D.root'
0063 ]
0064 )
0065 process.source = cms.Source("PoolSource",
0066 lumisToProcess = lumiSecs,
0067 fileNames = readFiles
0068 )
0069 process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(15500))
0070
0071 process.source.skipEvents=cms.untracked.uint32(0*-1/1)
0072 process.options = cms.untracked.PSet(
0073 SkipEvent = cms.untracked.vstring( "ProductNotFound" )
0074 )
0075
0076 strflag="ZMuMu"
0077 strflaglower=strflag.lower()
0078
0079 strflagopts="TBDconstraint:fullconstr"
0080
0081
0082 from Alignment.HIPAlignmentAlgorithm.OptionParser.HipPyOptionParser import HipPyOptionParser
0083 from Alignment.HIPAlignmentAlgorithm.OptionParser.HipPyOptionParser import matchPSetsByRecord
0084 from Alignment.HIPAlignmentAlgorithm.OptionParser.HipPyOptionParser import mergeVPSets
0085 optpy=HipPyOptionParser(strflag,strflagopts)
0086
0087
0088
0089 strtrackcollname=optpy.trkcoll
0090
0091
0092 if hasattr(optpy, "GlobalTag"):
0093 process.GlobalTag.globaltag = optpy.GlobalTag
0094 if hasattr(optpy, "GTtoGet"):
0095 process.GlobalTag.toGet = mergeVPSets(process.GlobalTag.toGet, optpy.GTtoGet, matchPSetsByRecord)
0096
0097
0098
0099 strTTRHBuilder = "WithAngleAndTemplate"
0100 if "generic" in optpy.CPEtype:
0101 strTTRHBuilder = "WithTrackAngle"
0102
0103
0104 import Alignment.CommonAlignment.tools.trackselectionRefitting as TrackRefitterSequencer
0105
0106 strTBDConstrainer=None
0107 if hasattr(optpy, "TBDconstraint"):
0108 strtbdconstr=optpy.TBDconstraint
0109 if "momconstr" in strtbdconstr:
0110 process.load("RecoTracker.TrackProducer.TwoBodyDecayMomConstraintProducer_cff")
0111 process.TwoBodyDecayMomConstraint.src = "AlignmentTrackSelector"
0112 process.TwoBodyDecayMomConstraint.primaryMass = cms.double(91.1876)
0113 process.TwoBodyDecayMomConstraint.primaryWidth = cms.double(1.4)
0114
0115
0116 process.TwoBodyDecayMomConstraint.rescaleError = cms.double(1.0)
0117 process.TwoBodyDecayMomConstraint.chi2Cut = cms.double(99999.)
0118
0119 strTBDConstrainer="TwoBodyDecayMomConstraint,momentum"
0120
0121 elif "fullconstr" in strtbdconstr:
0122 process.load("RecoTracker.TrackProducer.TwoBodyDecayConstraintProducer_cff")
0123 process.TwoBodyDecayConstraint.src = "AlignmentTrackSelector"
0124 process.TwoBodyDecayConstraint.primaryMass = cms.double(91.1876)
0125 process.TwoBodyDecayConstraint.primaryWidth = cms.double(1.4)
0126
0127 process.TwoBodyDecayConstraint.sigmaPositionCut = cms.double(0.5)
0128 process.TwoBodyDecayConstraint.rescaleError = cms.double(1.0)
0129 process.TwoBodyDecayConstraint.chi2Cut = cms.double(99999.)
0130
0131 strTBDConstrainer="TwoBodyDecayConstraint,trackParameters"
0132
0133 if strTBDConstrainer is not None:
0134 print("strTBDConstrainer=",strTBDConstrainer)
0135
0136 process.TrackRefitterSequence = TrackRefitterSequencer.getSequence(
0137 process,
0138 strtrackcollname,
0139 TTRHBuilder = strTTRHBuilder,
0140 usePixelQualityFlag = None,
0141 openMassWindow = False,
0142 cosmicsDecoMode = False,
0143 cosmicsZeroTesla = False,
0144
0145 momentumConstraint = strTBDConstrainer,
0146 cosmicTrackSplitting = False,
0147 use_d0cut = True
0148 )
0149
0150
0151 process.HighPurityTrackSelector.pMin = 0.0
0152 process.AlignmentTrackSelector.pMin = 0.0
0153 process.AlignmentTrackSelector.ptMin = 15.0
0154 process.AlignmentTrackSelector.etaMin = -3.0
0155 process.AlignmentTrackSelector.etaMax = 3.0
0156 process.AlignmentTrackSelector.nHitMin = 15
0157 process.AlignmentTrackSelector.minHitsPerSubDet.inPIXEL = cms.int32(1)
0158 process.AlignmentTrackSelector.TwoBodyDecaySelector.daughterMass = 0.105658
0159 process.AlignmentTrackSelector.TwoBodyDecaySelector.minXMass = 80.0
0160 process.AlignmentTrackSelector.TwoBodyDecaySelector.maxXMass = 100.0
0161
0162
0163 print(process.TrackRefitterSequence)
0164 subproc=[
0165 "offlineBeamSpot",
0166 "HighPurityTrackSelector",
0167 "FirstTrackRefitter",
0168 "TrackerTrackHitFilter",
0169 "HitFilteredTracksTrackFitter",
0170 "AlignmentTrackSelector",
0171 "TwoBodyDecayConstraint",
0172 "TwoBodyDecayMomConstraint",
0173 "FinalTrackRefitter"
0174 ]
0175 moduleSum=None
0176 for sp in subproc:
0177 if hasattr(process, sp):
0178 print("\n\tAttributes for process.{}".format(sp))
0179 if moduleSum is None:
0180 moduleSum=getattr(process,sp)
0181 else:
0182 moduleSum+=getattr(process,sp)
0183 for v in vars(getattr(process,sp)):
0184 print(v,":",getattr(getattr(process,sp),v))
0185
0186 process.TrackRefitterSequence = cms.Sequence(moduleSum)
0187 print("Final process path:",process.TrackRefitterSequence)
0188 process.p = cms.Path(process.TrackRefitterSequence)
0189
0190
0191 TAG = strflag
0192 if strflagopts:
0193 TAG = TAG + "_" + strflagopts
0194 TAG = TAG.replace(':','_')
0195 TAG = TAG.strip()
0196 print("Output file:","analyzed_{0}.root".format(TAG))
0197 process.Analyzer = cms.EDAnalyzer(
0198 "HIPTwoBodyDecayAnalyzer",
0199 alcarecotracks = cms.InputTag(strtrackcollname),
0200 refit1tracks = cms.InputTag("FirstTrackRefitter"),
0201 refit2tracks = cms.InputTag("HitFilteredTracksTrackFitter"),
0202 finaltracks = cms.InputTag("FinalTrackRefitter")
0203 )
0204
0205 process.options = cms.untracked.PSet(
0206 SkipEvent = cms.untracked.vstring( "ProductNotFound" )
0207 )
0208 process.TFileService = cms.Service('TFileService',
0209 fileName=cms.string("analyzed_{0}.root".format(TAG))
0210 )
0211 process.outpath = cms.EndPath(process.Analyzer)