Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:19

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 from Alignment.OfflineValidation.TkAlAllInOneTool.defaultInputFiles_cff import filesDefaultData_JetHTRun2018DHcalIsoTrk
0004 
0005 options = VarParsing.VarParsing("analysis")
0006 
0007 options.register ('GlobalTag',
0008                   'auto:run2_data',
0009                   VarParsing.VarParsing.multiplicity.singleton,  # singleton or list
0010                   VarParsing.VarParsing.varType.string,          # string, int, or float
0011                   "Global Tag to be used")
0012 
0013 options.register('unitTest',
0014                  False, # default value
0015                  VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0016                  VarParsing.VarParsing.varType.bool, # string, int, or float
0017                  "is it a unit test?")
0018 options.parseArguments()
0019 
0020 process = cms.Process("EnergyOverMomentumTree")
0021 
0022 ####################################################################
0023 # initialize MessageLogger and output report
0024 ####################################################################
0025 process.load("FWCore.MessageService.MessageLogger_cfi")
0026 #process.MessageLogger.cerr.threshold = 'ERROR'
0027 process.MessageLogger.cerr.FwkReport.reportEvery = 100
0028 process.MessageLogger.TrackRefitter=dict()
0029 
0030 process.options = cms.untracked.PSet( wantSummary = cms.untracked.bool(False) )
0031 
0032 # define input files
0033 process.source = cms.Source("PoolSource", fileNames = filesDefaultData_JetHTRun2018DHcalIsoTrk)
0034 
0035 process.maxEvents = cms.untracked.PSet(
0036     input = cms.untracked.int32(options.maxEvents)
0037 )
0038 
0039 print( "conditionGT       : ", options.GlobalTag)
0040 print( "maxEvents         : ", options.maxEvents)
0041 
0042 ####################################################################
0043 # load configuration files
0044 ####################################################################
0045 process.load("Configuration.StandardSequences.MagneticField_cff")
0046 process.load("Configuration.Geometry.GeometryRecoDB_cff")
0047 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0048 
0049 from Configuration.AlCa.GlobalTag import GlobalTag
0050 process.GlobalTag = GlobalTag(process.GlobalTag, options.GlobalTag, '')
0051 
0052 jsonFile = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions18/13TeV/Legacy_2018/Cert_314472-325175_13TeV_Legacy2018_Collisions18_JSON.txt'
0053 
0054 if(options.unitTest):
0055     print('This is a unit test, will not json filter')
0056     pass
0057 else:
0058     import FWCore.PythonUtilities.LumiList as LumiList
0059     import FWCore.ParameterSet.Types as CfgTypes
0060     print("JSON used: %s " % jsonFile)
0061     myLumis = LumiList.LumiList(filename = jsonFile).getCMSSWString().split(',')
0062     process.source.lumisToProcess = CfgTypes.untracked(CfgTypes.VLuminosityBlockRange())
0063     process.source.lumisToProcess.extend(myLumis)
0064 
0065 #from TrackingTools.TrackAssociator.default_cfi import *
0066 process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagator_cfi")
0067 process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAny_cfi")
0068 process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorAlong_cfi")
0069 process.load("TrackPropagation.SteppingHelixPropagator.SteppingHelixPropagatorOpposite_cfi")
0070 process.load("TrackingTools.TrackAssociator.DetIdAssociatorESProducer_cff")
0071 from TrackingTools.TrackAssociator.default_cfi import *
0072 #process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_noesprefer_cff")
0073 
0074 ####################################################################
0075 # choose geometry
0076 ####################################################################
0077 from CondCore.CondDB.CondDB_cfi import CondDB
0078 CondDB.connect = cms.string("frontier://FrontierProd/CMS_CONDITIONS")
0079 
0080 process.trackerAlignment = cms.ESSource("PoolDBESSource",
0081                     CondDB,
0082                                         toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentRcd"),
0083                                                                    tag = cms.string("TrackerAlignment_v28_offline")
0084                                                                )))
0085 process.es_prefer_trackerAlignment = cms.ESPrefer("PoolDBESSource", "trackerAlignment")
0086 
0087 process.trackerAPE = cms.ESSource("PoolDBESSource",
0088                                   CondDB,
0089                                   toGet = cms.VPSet(cms.PSet(record = cms.string("TrackerAlignmentErrorRcd"),
0090                                                                  tag = cms.string("TrackerAlignmentExtendedErrors_v15_offline_IOVs")
0091                                                          )))
0092 #process.es_prefer_TrackerAPE = cms.ESPrefer("PoolDBESSource", "trackerAPE")
0093 
0094 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")
0095 
0096 ####################################################################
0097 # configure alignment track selector
0098 ####################################################################
0099 process.load("Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi")
0100 process.AlignmentTrackSelector.src = cms.InputTag('TkAlIsoProdFilter') # 'TkAlIsoProd' # trackCollection' # 'ALCARECOTkAlZMuMu' # 'ALCARECOTkAlMinBias' # adjust to input file
0101 process.AlignmentTrackSelector.ptMin = 1.
0102 process.AlignmentTrackSelector.etaMin = -5.
0103 process.AlignmentTrackSelector.etaMax = 5.
0104 process.AlignmentTrackSelector.nHitMin = 5
0105 process.AlignmentTrackSelector.chi2nMax = 100.
0106 #process.AlignmentTrackSelector.applyNHighestPt = True
0107 #process.AlignmentTrackSelector.nHighestPt = 2
0108 
0109 ####################################################################
0110 # configure track refitter
0111 ####################################################################
0112 process.load("RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi")
0113 process.MeasurementTrackerEvent.pixelClusterProducer = "TkAlIsoProdFilter"
0114 process.MeasurementTrackerEvent.stripClusterProducer = "TkAlIsoProdFilter"
0115 #process.MeasurementTrackerEvent.inactivePixelDetectorLabels = cms.VInputTag([''])
0116 #process.MeasurementTrackerEvent.inactiveStripDetectorLabels = cms.VInputTag([''])
0117 
0118 import RecoTracker.TrackProducer.TrackRefitters_cff
0119 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
0120 process.TrackRefitter.src = cms.InputTag('AlignmentTrackSelector')
0121 process.TrackRefitter.TrajectoryInEvent = True
0122 process.TrackRefitter.NavigationSchool = ''
0123 
0124 ####################################################################
0125 # configure tree writer
0126 ####################################################################
0127 
0128 # uncomment following block in case it is run over the HcalCalIsoTrk AlCaReco
0129 # TrackAssociatorParameterBlock.TrackAssociatorParameters.EBRecHitCollectionLabel = cms.InputTag("IsoProd", "IsoTrackEcalRecHitCollection")
0130 # TrackAssociatorParameterBlock.TrackAssociatorParameters.EERecHitCollectionLabel = cms.InputTag("IsoProd", "IsoTrackEcalRecHitCollection")
0131 # TrackAssociatorParameterBlock.TrackAssociatorParameters.HBHERecHitCollectionLabel = cms.InputTag("IsoProd", "IsoTrackHBHERecHitCollection")
0132 # TrackAssociatorParameterBlock.TrackAssociatorParameters.HORecHitCollectionLabel = cms.InputTag("IsoProd", "IsoTrackHORecHitCollection")
0133 
0134 TrackAssociatorParameterBlock.TrackAssociatorParameters.EERecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEE")
0135 TrackAssociatorParameterBlock.TrackAssociatorParameters.EBRecHitCollectionLabel = cms.InputTag("ecalRecHit","EcalRecHitsEB")
0136 TrackAssociatorParameterBlock.TrackAssociatorParameters.HBHERecHitCollectionLabel = cms.InputTag("hbhereco")
0137 TrackAssociatorParameterBlock.TrackAssociatorParameters.useHO = cms.bool(False)  # no HO hits saved in the alcareco
0138 
0139 process.energyOverMomentumTree = cms.EDAnalyzer('EopTreeWriter',
0140                                                 TrackAssociatorParameterBlock,
0141                                                 src = cms.InputTag('TrackRefitter'))
0142 
0143 ####################################################################
0144 # output file
0145 ####################################################################
0146 process.TFileService = cms.Service("TFileService",
0147     fileName = cms.string('test_EopTree.root')
0148 )
0149 
0150 ####################################################################
0151 # Path
0152 ####################################################################
0153 process.p = cms.Path(process.MeasurementTrackerEvent*
0154                      process.offlineBeamSpot*
0155                      process.AlignmentTrackSelector*
0156                      process.TrackRefitter*
0157                      process.energyOverMomentumTree)