Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:04

0001 from __future__ import print_function
0002 #
0003 # cfg file to run L1 Global Trigger emulator on a file containing the output of the 
0004 # GCT system and GMT system ("digi"), followed by the L1 trigger report
0005 # options set in "user choices"
0006 #
0007 #
0008 # V M Ghete 2009-03-03
0009 
0010 import FWCore.ParameterSet.Config as cms
0011 import sys
0012 
0013 process = cms.Process("L1GtEmulTrigReport")
0014 
0015 # import number of events, sample and global tag 
0016 print('\n')
0017 from L1Trigger.GlobalTriggerAnalyzer.UserOptions_cff import *
0018 if errorUserOptions == True :
0019     print('\nError returned by UserOptions_cff\n')
0020     sys.exit()
0021 
0022 # L1 menu selection via L1Trigger_custom - expert choice, do it only if you know what you do
0023 # if True, modify correspondingly L1Trigger_custom
0024 
0025 customL1Menu = True
0026 customL1Menu = False
0027 
0028 if customL1Menu == True :
0029     from L1Trigger.Configuration.L1Trigger_custom import customiseL1Menu
0030     process=customiseL1Menu(process)
0031 
0032 # reset all prescale factors and masks
0033 from L1Trigger.Configuration.L1Trigger_custom import customiseResetPrescalesAndMasks
0034 process = customiseResetPrescalesAndMasks(process)
0035 
0036 # source according to data type
0037 if dataType == 'StreamFile' :
0038     process.source = cms.Source("NewEventStreamFileReader", fileNames=readFiles)
0039 else :        
0040     process.source = cms.Source ('PoolSource', 
0041                                  fileNames=readFiles, 
0042                                  secondaryFileNames=secFiles,
0043                                  lumisToProcess = selectedLumis,
0044                                  eventsToProcess = selectedEvents
0045                                  )
0046 
0047 
0048 # number of events to be processed and source file
0049 process.maxEvents = cms.untracked.PSet(
0050     input=cms.untracked.int32(maxNumberEvents)
0051 )
0052 
0053 #
0054 # load and configure modules via Global Tag
0055 # https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrontierConditions
0056 
0057 process.load('Configuration.StandardSequences.GeometryDB_cff')
0058 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0059 
0060 process.GlobalTag.globaltag = useGlobalTag
0061 
0062 # processes to be run
0063 
0064 # Global Trigger emulator
0065 import L1Trigger.GlobalTrigger.gtDigis_cfi
0066 process.l1GtEmulDigis = L1Trigger.GlobalTrigger.gtDigis_cfi.gtDigis.clone()
0067 
0068 
0069 # input tag for GMT readout collection: 
0070 #     gmtDigis = GMT emulator (default)
0071 #     l1GtUnpack     = GT unpacker (common GT/GMT unpacker)
0072 if useRelValSample == True :
0073     process.l1GtEmulDigis.GmtInputTag = 'simGmtDigis'
0074 else :
0075     process.l1GtEmulDigis.GmtInputTag = 'gtDigis'
0076    
0077 
0078 # input tag for GCT readout collections: 
0079 #     gctDigis = GCT emulator (default) 
0080 if useRelValSample == True :
0081     process.l1GtEmulDigis.GctInputTag = 'simGctDigis'
0082 else :
0083     process.l1GtEmulDigis.GctInputTag = 'gctDigis'
0084 
0085 # input tag for CASTOR record 
0086 #     castorL1Digis =  CASTOR
0087 #process.l1GtEmulDigis.CastorInputTag = cms.InputTag("castorL1Digis")
0088     
0089 # technical triggers: a vector of input tags, one tag per each technical 
0090 # trigger producer 
0091 # 
0092 # by default: empty vector
0093     
0094 # Example:
0095 # TechnicalTriggersInputTags = cms.VInputTag(cms.InputTag('aTechTrigDigis'), 
0096 #                                            cms.InputTag('anotherTechTriggerDigis')),
0097 if useRelValSample == True :
0098     process.l1GtEmulDigis.TechnicalTriggersInputTags = cms.VInputTag(
0099                                         cms.InputTag( 'simBscDigis' ), 
0100                                         cms.InputTag( 'simRpcTechTrigDigis' ),
0101                                         cms.InputTag( 'simHcalTechTrigDigis' )
0102                                         )
0103 else :
0104     process.l1GtEmulDigis.TechnicalTriggersInputTags = cms.VInputTag()
0105     
0106 
0107 # logical flag to produce the L1 GT DAQ readout record
0108 #     if true, produce the record (default)
0109 #process.l1GtEmulDigis.ProduceL1GtDaqRecord = False
0110     
0111 # logical flag to produce the L1 GT EVM readout record
0112 #     if true, produce the record (default)
0113 #process.l1GtEmulDigis.ProduceL1GtEvmRecord = False
0114 
0115 # logical flag to produce the L1 GT object map record
0116 #     if true, produce the record (default)
0117 #process.l1GtEmulDigis.ProduceL1GtObjectMapRecord = False
0118 
0119 # logical flag to write the PSB content in the  L1 GT DAQ record
0120 #     if true, write the PSB content in the record (default)
0121 #process.l1GtEmulDigis.WritePsbL1GtDaqRecord = False
0122 
0123 # logical flag to read the technical trigger records
0124 #     if true, it will read via getMany the available records (default)
0125 #process.l1GtEmulDigis.ReadTechnicalTriggerRecords = False
0126 
0127 # number of "bunch crossing in the event" (BxInEvent) to be emulated
0128 # symmetric around L1Accept (BxInEvent = 0):
0129 #    1 (BxInEvent = 0); 3 (F 0 1) (standard record); 5 (E F 0 1 2) (debug record)
0130 # even numbers (except 0) "rounded" to the nearest lower odd number
0131 # negative value: emulate TotalBxInEvent as given in EventSetup  
0132 process.l1GtEmulDigis.EmulateBxInEvent = 1
0133  
0134 # number of BXs in the event corresponding to alternative 0 and 1 in altNrBxBoard()
0135 # EmulateBxInEvent >= max(RecordLength[0], RecordLength[1])
0136 # negative values: take the numbers from event setup, from L1GtParameters
0137 process.l1GtEmulDigis.RecordLength = cms.vint32(3, 5)
0138 
0139 # alternative for number of BX per active board in GT DAQ record: 0 or 1
0140 # the position is identical with the active board bit
0141 process.l1GtEmulDigis.AlternativeNrBxBoardDaq = 0x101 
0142 
0143 # alternative for number of BX per active board in GT EVM record: 0 or 1
0144 # the position is identical with the active board bit
0145 process.l1GtEmulDigis.AlternativeNrBxBoardEvm = 0x2 
0146 
0147 # length of BST record (in bytes) from parameter set
0148 # negative value: take the value from EventSetup      
0149 #process.l1GtEmulDigis.BstLengthBytes = 52
0150 
0151 # run algorithm triggers 
0152 #     if true, unprescaled (all prescale factors 1)
0153 #     will overwrite the event setup
0154 process.l1GtEmulDigis.AlgorithmTriggersUnprescaled = True
0155     
0156 #     if true, unmasked - all enabled (all trigger masks set to 0)
0157 #     will overwrite the event setup
0158 process.l1GtEmulDigis.AlgorithmTriggersUnmasked = True
0159 
0160 # run technical triggers
0161 #     if true, unprescaled (all prescale factors 1)
0162 #     will overwrite the event setup
0163 process.l1GtEmulDigis.TechnicalTriggersUnprescaled = True
0164     
0165 #     if true, unmasked - all enabled (all trigger masks set to 0)
0166 #     will overwrite the event setup
0167 process.l1GtEmulDigis.TechnicalTriggersUnmasked = True
0168 
0169 #     if true, veto unmasked - all enabled (all trigger veto masks set to 0)
0170 #     will overwrite the event setup
0171 process.l1GtEmulDigis.TechnicalTriggersVetoUnmasked = True
0172 
0173 
0174 # 
0175 process.l1GtEmulDigis.Verbosity = cms.untracked.int32(1)
0176 
0177 #
0178 # l1GtTrigReport module
0179 #
0180 
0181 process.load("L1Trigger.GlobalTriggerAnalyzer.l1GtTrigReport_cfi")
0182  
0183 # boolean flag to select the input record
0184 # if true, it will use L1GlobalTriggerRecord 
0185 #process.l1GtTrigReport.UseL1GlobalTriggerRecord = True
0186 
0187 # input tag for GT record: 
0188 #   GT emulator:    gtDigis (DAQ record)
0189 #   GT unpacker:    gtDigis (DAQ record)
0190 #   GT lite record: l1GtRecord 
0191 process.l1GtTrigReport.L1GtRecordInputTag = "l1GtEmulDigis"
0192 
0193 #process.l1GtTrigReport.PrintVerbosity = 10
0194 #process.l1GtTrigReport.PrintOutput = 1
0195 
0196 # path to be run
0197 
0198 # for RAW data, run first the RAWTODIGI 
0199 if (dataType == 'RAW') and not (useRelValSample) :
0200     process.load('Configuration/StandardSequences/RawToDigi_Data_cff')
0201     # unpack five BX for GCT
0202     process.gctDigis.numberOfGctSamplesToUnpack = cms.uint32(5)
0203     #
0204     process.p = cms.Path(process.RawToDigi+process.l1GtEmulDigis*process.l1GtTrigReport)
0205 elif (dataType == 'RAW') and (useRelValSample) :
0206     process.load('Configuration/StandardSequences/RawToDigi_cff')
0207     process.p = cms.Path(process.RawToDigi+process.l1GtEmulDigis*process.l1GtTrigReport)    
0208 else :        
0209     # path to be run for RECO
0210     process.p = cms.Path(process.l1GtEmulDigis*process.l1GtTrigReport)
0211 
0212 
0213 # Message Logger
0214 process.load('FWCore.MessageService.MessageLogger_cfi')
0215 process.MessageLogger.debugModules = ['l1GtEmulDigis', 'l1GtTrigReport']
0216 process.MessageLogger.cerr.enable = False
0217 
0218 process.MessageLogger.files.L1GtEmulTrigReport_errors = cms.untracked.PSet( 
0219         threshold = cms.untracked.string('ERROR'),
0220         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(-1) ),
0221         L1GlobalTrigger = cms.untracked.PSet( limit = cms.untracked.int32(-1) ) 
0222        )
0223 
0224 process.MessageLogger.files.L1GtEmulTrigReport_warnings = cms.untracked.PSet( 
0225         threshold = cms.untracked.string('WARNING'),
0226         WARNING = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0227         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0228         L1GlobalTrigger = cms.untracked.PSet( limit = cms.untracked.int32(-1) ) 
0229         )
0230 
0231 process.MessageLogger.files.L1GtEmulTrigReport_info = cms.untracked.PSet( 
0232         threshold = cms.untracked.string('INFO'),
0233         INFO = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0234         WARNING = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0235         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0236         L1GtTrigReport = cms.untracked.PSet( limit = cms.untracked.int32(-1) ) 
0237         )
0238 
0239 process.MessageLogger.files.L1GtEmulTrigReport = cms.untracked.PSet( 
0240         threshold = cms.untracked.string('DEBUG'),
0241         DEBUG = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0242         INFO = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0243         WARNING = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0244         ERROR = cms.untracked.PSet( limit = cms.untracked.int32(0) ),
0245         L1GlobalTrigger = cms.untracked.PSet( limit = cms.untracked.int32(-1) ) 
0246         )
0247 
0248 # output 
0249 
0250 # keep GMT, GCT and GT output records
0251 # update labels if InputTags are replaced above
0252 
0253 process.outputL1GlobalTrigger = cms.OutputModule("PoolOutputModule",
0254     fileName = cms.untracked.string('testGt_Emulator_GctGmtFile_output.root'),
0255     outputCommands = cms.untracked.vstring('drop *', 
0256         'keep *_simGmtDigis_*_*', 
0257         'keep *_simGctDigis_*_*', 
0258         'keep *_l1GtEmulDigis_*_*')
0259 )
0260 
0261 process.outpath = cms.EndPath(process.outputL1GlobalTrigger)