Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-01 22:52:10

0001 from __future__ import print_function
0002 #
0003 # cfg file to pack (DigiToRaw) a GT DAQ record, unpack (RawToDigi) it back
0004 # and compare the two set of digis
0005 #
0006 # V M Ghete 2009-04-06
0007 
0008 import FWCore.ParameterSet.Config as cms
0009 
0010 # process
0011 process = cms.Process('TestGtPackUnpackAnalyzer')
0012 
0013 ###################### user choices ######################
0014 
0015 
0016 # choose the type of sample used (True for RelVal, False for data)
0017 useRelValSample = True 
0018 #useRelValSample=False 
0019 
0020 # actual GlobalTag must be appropriate for the sample use
0021 
0022 if useRelValSample == True :
0023     useGlobalTag = 'IDEAL_V12'
0024     #useGlobalTag='STARTUP_V9'
0025 else :
0026     useGlobalTag = 'CRAFT_ALL_V12'
0027 
0028 # change to True to use local files
0029 #     the type of file should match the choice of useRelValSample and useGlobalTag
0030 useLocalFiles = False 
0031 
0032 ###################### end user choices ###################
0033 
0034 
0035 # number of events to be processed and source file
0036 process.maxEvents = cms.untracked.PSet(
0037     input=cms.untracked.int32(10)
0038 )
0039 
0040 readFiles = cms.untracked.vstring()
0041 secFiles = cms.untracked.vstring() 
0042 process.source = cms.Source ('PoolSource', fileNames=readFiles, secondaryFileNames=secFiles)
0043 
0044 # type of sample used (True for RelVal, False for data)
0045 
0046 if useRelValSample == True :
0047     if useGlobalTag.count('IDEAL') :
0048 
0049         #/RelValTTbar/CMSSW_2_2_4_IDEAL_V11_v1/GEN-SIM-DIGI-RAW-HLTDEBUG
0050         dataset = cms.untracked.vstring('RelValTTbar_CMSSW_2_2_4_IDEAL_V11_v1')
0051         
0052         readFiles.extend([
0053             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/IDEAL_V11_v1/0000/02697009-5CF3-DD11-A862-001D09F2423B.root',
0054             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/IDEAL_V11_v1/0000/064657A8-59F3-DD11-ACA5-000423D991F0.root',
0055             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/IDEAL_V11_v1/0000/0817F6DE-5BF3-DD11-880D-0019DB29C5FC.root',
0056             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/IDEAL_V11_v1/0000/0899697C-5AF3-DD11-9D21-001617DBD472.root'
0057             ]);
0058 
0059 
0060         secFiles.extend([
0061             ])
0062 
0063     elif useGlobalTag.count('STARTUP') :
0064 
0065         #/RelValTTbar/CMSSW_2_2_4_STARTUP_V8_v1/GEN-SIM-DIGI-RAW-HLTDEBUG
0066         dataset = cms.untracked.vstring('RelValTTbar_CMSSW_2_2_4_STARTUP_V8_v1')
0067         
0068         readFiles.extend([
0069             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/STARTUP_V8_v1/0000/069AA022-5BF3-DD11-9A56-001617E30D12.root',
0070             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/STARTUP_V8_v1/0000/08DA99A6-5AF3-DD11-AAC1-001D09F24493.root',
0071             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/STARTUP_V8_v1/0000/0A725E15-5BF3-DD11-8B4B-000423D99CEE.root',
0072             '/store/relval/CMSSW_2_2_4/RelValTTbar/GEN-SIM-DIGI-RAW-HLTDEBUG/STARTUP_V8_v1/0000/0AF5B676-5AF3-DD11-A22F-001617DBCF1E.root'
0073             ]);
0074 
0075 
0076         secFiles.extend([
0077             ])
0078     else :
0079         print('Error: Global Tag ', useGlobalTag, ' not defined.')    
0080 
0081 else : 
0082 
0083     # data
0084     dataset = '/Cosmics/Commissioning09-v1/RAW'
0085     print('   Running on set: '+ dataset)    
0086     
0087     readFiles.extend( [
0088        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/00BD9A1F-B908-DE11-8B2C-000423D94A04.root',
0089        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/025E8B48-B608-DE11-A0EE-00161757BF42.root',
0090        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/027AA271-D208-DE11-9A7F-001617DBD5AC.root',
0091        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/04281D2F-D108-DE11-9A27-000423D944DC.root',
0092        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/065B0C1C-C008-DE11-A32B-001617E30F48.root',
0093        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/08B1054B-BD08-DE11-AF8B-001617C3B78C.root',
0094        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/0C055C33-D108-DE11-B678-001617C3B73A.root',
0095        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/0E480977-D208-DE11-BA78-001617C3B6E2.root',
0096        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/0E79251B-B908-DE11-83FF-000423D99CEE.root',
0097        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/101B8CA0-B508-DE11-B614-000423D99160.root',
0098        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/12C62C71-BF08-DE11-A48C-000423D99614.root',
0099        '/store/data/Commissioning09/Cosmics/RAW/v1/000/076/966/16A77E08-B008-DE11-9121-000423D8F63C.root'
0100         ]);
0101 
0102     secFiles.extend([
0103         ])
0104 
0105 if useLocalFiles :
0106     readFiles = 'file:/afs/cern.ch/user/g/ghete/scratch0/CmsswTestFiles/testGt_PackUnpackAnalyzer_source.root.root'
0107 
0108 
0109 # load and configure modules via Global Tag
0110 # https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions
0111 
0112 process.load("Configuration.StandardSequences.GeometryDB_cff")
0113 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0114 
0115 process.GlobalTag.globaltag = useGlobalTag
0116 
0117 # remove FakeConditions when GTag is OK
0118 process.load('L1Trigger.Configuration.L1Trigger_FakeConditions_cff')
0119 
0120 #
0121 # pack.......
0122 #
0123 
0124 process.load("EventFilter.L1GlobalTriggerRawToDigi.l1GtPack_cfi")
0125 
0126 # input tag for GT readout collection: 
0127 # input tag for GMT readout collection: 
0128 #     source        = hardware record
0129 
0130 if useRelValSample == True :
0131     daqGtInputTagPack = 'simGtDigis'
0132     muGmtInputTagPack = 'simGmtDigis'
0133 else :
0134     daqGtInputTagPack = 'l1GtUnpack'
0135     muGmtInputTagPack = 'l1GtUnpack'
0136 
0137 process.l1GtPack.DaqGtInputTag = daqGtInputTagPack
0138 process.l1GtPack.MuGmtInputTag = muGmtInputTagPack
0139 
0140 # mask for active boards (actually 16 bits)
0141 #      if bit is zero, the corresponding board will not be packed
0142 #      default: no board masked: ActiveBoardsMask = 0xFFFF
0143 
0144 # no board masked (default)
0145 #process.l1GtPack.ActiveBoardsMask = 0xFFFF
0146     
0147 # GTFE only in the record
0148 #process.l1GtPack.ActiveBoardsMask = 0x0000
0149 
0150 # GTFE + FDL 
0151 #process.l1GtPack.ActiveBoardsMask = 0x0001
0152      
0153 # GTFE + GMT 
0154 #process.l1GtPack.ActiveBoardsMask = 0x0100
0155 
0156 # GTFE + FDL + GMT 
0157 #process.l1GtPack.ActiveBoardsMask = 0x0101
0158 
0159 # set it to verbose
0160 process.l1GtPack.Verbosity = cms.untracked.int32(1)
0161 
0162 #
0163 # unpack.......
0164 #
0165 
0166 import EventFilter.L1GlobalTriggerRawToDigi.l1GtUnpack_cfi
0167 process.gtPackedUnpack = EventFilter.L1GlobalTriggerRawToDigi.l1GtUnpack_cfi.l1GtUnpack.clone()
0168 
0169 # input tag for GT and GMT readout collections in the packed data: 
0170 process.gtPackedUnpack.DaqGtInputTag = 'l1GtPack'
0171 
0172 # Active Boards Mask
0173 # no board masked (default)
0174 #process.gtPackedUnpack.ActiveBoardsMask = 0xFFFF
0175 
0176 # GTFE only in the record
0177 #process.gtPackedUnpack.ActiveBoardsMask = 0x0000
0178 
0179 # GTFE + FDL 
0180 #process.gtPackedUnpack.ActiveBoardsMask = 0x0001
0181 
0182 # GTFE + GMT 
0183 #process.gtPackedUnpack.ActiveBoardsMask = 0x0100
0184 
0185 # GTFE + FDL + GMT 
0186 #process.gtPackedUnpack.ActiveBoardsMask = 0x0101
0187 
0188 # BxInEvent to be unpacked
0189 
0190 # all available BxInEvent (default)
0191 #process.gtPackedUnpack.UnpackBxInEvent = -1 
0192 
0193 # BxInEvent = 0 (L1A)
0194 #process.gtPackedUnpack.UnpackBxInEvent = 1 
0195 
0196 # 3 BxInEvent (F, 0, 1)  
0197 #process.gtPackedUnpack.UnpackBxInEvent = 3 
0198 
0199 #
0200 # compare the initial and final digis .......
0201 #
0202 process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtPackUnpackAnalyzer_cfi")
0203 
0204 # input tag for the initial GT DAQ record: must match the pack label
0205 # input tag for the initial GMT readout collection: must match the pack label 
0206 
0207 process.l1GtPackUnpackAnalyzer.InitialDaqGtInputTag = daqGtInputTagPack
0208 process.l1GtPackUnpackAnalyzer.InitialMuGmtInputTag = muGmtInputTagPack
0209 
0210 # input tag for the final GT DAQ and GMT records:  must match the unpack label 
0211 #     GT unpacker:  gtPackedUnpack (cloned unpacker from L1GtPackUnpackAnalyzer.cfg)
0212 #process.l1GtPackUnpackAnalyzer.FinalGtGmtInputTag = 'gtPackedUnpack'
0213 
0214 # path to be run
0215 if useRelValSample == True :
0216     process.p = cms.Path(process.l1GtPack*process.gtPackedUnpack*process.l1GtPackUnpackAnalyzer)
0217 else :
0218     process.p = cms.Path(process.l1GtPack*process.gtPackedUnpack*process.l1GtPackUnpackAnalyzer)
0219     # FIXME unpack first raw data
0220 
0221 # Message Logger
0222 process.load('FWCore.MessageService.MessageLogger_cfi')
0223 process.MessageLogger.debugModules = [ 'l1GtPack', 'l1GtUnpack', 'l1GtPackUnpackAnalyzer']
0224 process.MessageLogger.cerr.enable = False
0225 process.MessageLogger.files.L1GtPackUnpackAnalyzer = cms.untracked.PSet(
0226     threshold=cms.untracked.string('DEBUG'),
0227     #threshold = cms.untracked.string('INFO'),
0228     #threshold = cms.untracked.string('ERROR'),
0229     DEBUG=cms.untracked.PSet(
0230         limit=cms.untracked.int32(-1)
0231     ),
0232     INFO=cms.untracked.PSet(
0233         limit=cms.untracked.int32(-1)
0234     ),
0235     WARNING=cms.untracked.PSet(
0236         limit=cms.untracked.int32(-1)
0237     ),
0238     ERROR=cms.untracked.PSet(
0239         limit=cms.untracked.int32(-1)
0240     ),
0241     default = cms.untracked.PSet( 
0242         limit=cms.untracked.int32(-1)  
0243     )
0244 )
0245 
0246 # summary
0247 process.options = cms.untracked.PSet(
0248     wantSummary = cms.untracked.bool(True)
0249 )
0250 
0251 
0252 # output 
0253 process.outputL1GtPackUnpack = cms.OutputModule("PoolOutputModule",
0254     fileName = cms.untracked.string('L1GtPackUnpackAnalyzer.root'),
0255     # keep only emulated data, packed data, unpacked data in the ROOT file
0256     outputCommands = cms.untracked.vstring('drop *', 
0257         'keep *_simGtDigis_*_*', 
0258         'keep *_simGmtDigis_*_*', 
0259         'keep *_l1GtPack_*_*', 
0260         'keep *_l1GtPackedUnpack_*_*')
0261 )
0262 
0263 process.outpath = cms.EndPath(process.outputL1GtPackUnpack)