Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:59:56

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 import FWCore.ParameterSet.VarParsing as VarParsing
0004 options = VarParsing.VarParsing()
0005 options.register("isUnitTest",
0006                  False,
0007                  VarParsing.VarParsing.multiplicity.singleton,
0008                  VarParsing.VarParsing.varType.bool,
0009                  "are we running the unit test")
0010 options.parseArguments()
0011 
0012 process = cms.Process("HitEff")
0013 process.load("Configuration.StandardSequences.MagneticField_cff")
0014 process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0015 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0016 process.load('FWCore.MessageService.MessageLogger_cfi')
0017 
0018 from Configuration.AlCa.GlobalTag import GlobalTag
0019 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')  
0020 
0021 process.source = cms.Source("PoolSource", fileNames=cms.untracked.vstring(
0022     # 10 random files, will need the rest later
0023     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/E3D6AECF-3F12-6540-97DC-4A6994CFEBF3.root",
0024     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/242566C3-0540-8C43-8D6E-BB42C1FE0BB5.root",
0025     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/BC8C0839-F645-B948-9040-15FCB5D50472.root",
0026     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/3A806401-2CBC-4345-A5CB-593AABD4BE4E.root",
0027     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/852C3C1E-2BD4-A843-A65B-51110A503FBD.root",
0028     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/B795F9A0-4681-A34A-B879-E33A0DEC8720.root",
0029     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/3A0884F2-A395-C541-8EFB-740C45A57CCE.root",
0030     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/D274E7C1-5A9D-A544-B9B3-6A30166FC16C.root",
0031     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/C4D243DC-2A09-CF42-A050-7678EF4A90D7.root",
0032     "/store/express/Run2018D/StreamExpress/ALCARECO/SiStripCalMinBias-Express-v1/000/325/172/00000/7946A89D-8AC5-6B4F-BAD2-AE3B971865C5.root",
0033     ))
0034 
0035 if(options.isUnitTest):
0036     process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(20))
0037 else:
0038     process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(100000))
0039 
0040 process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")
0041 
0042 process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
0043 process.refitTracks = process.TrackRefitter.clone(src=cms.InputTag("ALCARECOSiStripCalMinBias"))
0044 tracks = cms.InputTag("refitTracks")
0045 
0046 process.hiteff = cms.EDProducer("SiStripHitEfficiencyWorker",
0047     lumiScalers =cms.InputTag("scalersRawToDigi"),
0048     addLumi = cms.untracked.bool(True),
0049     commonMode = cms.InputTag("siStripDigis", "CommonMode"),
0050     addCommonMode = cms.untracked.bool(False),
0051     combinatorialTracks = tracks,
0052     trajectories        = tracks,
0053     siStripClusters     = cms.InputTag("siStripClusters"),
0054     siStripDigis        = cms.InputTag("siStripDigis"),
0055     trackerEvent        = cms.InputTag("MeasurementTrackerEvent"),
0056     # part 2
0057     Layer = cms.int32(0), # =0 means do all layers
0058     Debug = cms.untracked.bool(True),
0059     # do not cut on the total number of tracks
0060     cutOnTracks = cms.bool(True),
0061     trackMultiplicity = cms.uint32(100),
0062     # use or not first and last measurement of a trajectory (biases), default is false
0063     useFirstMeas = cms.bool(False),
0064     useLastMeas = cms.bool(False),
0065     useAllHitsFromTracksWithMissingHits = cms.bool(False),
0066     ## non-default settings
0067     ClusterMatchingMethod = cms.int32(4),   # default 0  case0,1,2,3,4
0068     ClusterTrajDist       = cms.double(15), # default 64
0069     )
0070 
0071 process.load("DQM.SiStripCommon.TkHistoMap_cff")
0072 
0073 ## OLD HITEFF
0074 from CalibTracker.SiStripHitEfficiency.SiStripHitEff_cff import anEff
0075 process.anEff = anEff
0076 process.anEff.Debug = True
0077 process.anEff.combinatorialTracks = tracks
0078 process.anEff.trajectories = tracks
0079 process.TFileService = cms.Service("TFileService",
0080         fileName = cms.string('HitEffTree.root')
0081 )
0082 process.load("CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi")
0083 process.eventInfo = cms.EDAnalyzer(
0084         "ShallowTree",
0085         outputCommands = cms.untracked.vstring(
0086             'drop *',
0087             'keep *_shallowEventRun_*_*',
0088             )
0089         )
0090 ## END OLD HITEFF
0091 
0092 ## TODO double-check in main CalibTree config if hiteff also takes refitted tracks
0093 process.allPath = cms.Path(process.MeasurementTrackerEvent*process.offlineBeamSpot*process.refitTracks
0094         *process.anEff*process.shallowEventRun*process.eventInfo
0095         *process.hiteff)
0096 
0097 # save the DQM plots in the DQMIO format
0098 process.dqmOutput = cms.OutputModule("DQMRootOutputModule",
0099             fileName = cms.untracked.string("DQM.root")
0100             )
0101 # also save in legacy format, for easier comparison
0102 process.dqmSaver = cms.EDAnalyzer("DQMFileSaver",
0103         convention = cms.untracked.string('Offline'),
0104         fileFormat = cms.untracked.string('ROOT'),
0105         producer = cms.untracked.string('DQM'),
0106         workflow = cms.untracked.string('/Harvesting/SiStripHitEfficiency/All'),
0107         dirName = cms.untracked.string('.'),
0108         saveByRun = cms.untracked.int32(1),
0109         saveAtJobEnd = cms.untracked.bool(False),
0110         )
0111 process.HitEffOutput = cms.EndPath(process.dqmOutput*process.dqmSaver)
0112 
0113 if(options.isUnitTest):
0114     process.MessageLogger.cerr.enable = False
0115     process.MessageLogger.TkHistoMap = dict()
0116     process.MessageLogger.SiStripHitEfficiency = dict()  
0117     process.MessageLogger.SiStripHitEfficiencyWorker = dict()  
0118     process.MessageLogger.cout = cms.untracked.PSet(
0119         enable    = cms.untracked.bool(True),        
0120         threshold = cms.untracked.string("INFO"),
0121         enableStatistics = cms.untracked.bool(True),
0122         default   = cms.untracked.PSet(limit = cms.untracked.int32(0)),                       
0123         FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(-1),
0124                                        reportEvery = cms.untracked.int32(1)),
0125         TkHistoMap = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0126         SiStripHitEfficiency = cms.untracked.PSet( limit = cms.untracked.int32(-1)),
0127         SiStripHitEfficiencyWorker = cms.untracked.PSet( limit = cms.untracked.int32(-1))
0128     )
0129 else:
0130     process.MessageLogger = cms.Service(
0131         "MessageLogger",
0132         destinations = cms.untracked.vstring("log_tkhistomap"),
0133         debugModules = cms.untracked.vstring("hiteff", "anEff"),
0134         log_tkhistomap =  cms.untracked.PSet(threshold = cms.untracked.string("DEBUG"),
0135                                              default = cms.untracked.PSet(limit = cms.untracked.int32(-1))),
0136         categories=cms.untracked.vstring("TkHistoMap", 
0137                                          "SiStripHitEfficiency:HitEff", 
0138                                          "SiStripHitEfficiency", 
0139                                          "SiStripHitEfficiencyWorker")
0140     )
0141 # Run the rest of the CT-based sequence with
0142 # cmsRun test/testSiStripHitEffFromCalibTree_cfg.py inputFiles=HitEffTree.root runNumber=325172