CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
customiseReEmulateCaloLayer2.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 static_config = 'L1Trigger.L1TCalorimeter.caloParams_2018_v1_4_cfi'
4 
5 def hwEmulCompHistos(process):
6 
7  process.TFileService = cms.Service("TFileService",
8  fileName = cms.string("l1tCalo_2016_simHistos.root"),
9  closeFileFast = cms.untracked.bool(True)
10  )
11 
12  # histograms
13  process.load('L1Trigger.L1TCalorimeter.l1tStage2CaloAnalyzer_cfi')
14  process.l1tStage2CaloAnalyzer.doEvtDisp = False
15  process.l1tStage2CaloAnalyzer.mpBx = 0
16  process.l1tStage2CaloAnalyzer.dmxBx = 0
17  process.l1tStage2CaloAnalyzer.allBx = False
18  process.l1tStage2CaloAnalyzer.towerToken = cms.InputTag("simCaloStage2Digis", "MP")
19  process.l1tStage2CaloAnalyzer.clusterToken = cms.InputTag("None")
20  process.l1tStage2CaloAnalyzer.mpEGToken = cms.InputTag("simCaloStage2Digis", "MP")
21  process.l1tStage2CaloAnalyzer.mpTauToken = cms.InputTag("simCaloStage2Digis", "MP")
22  process.l1tStage2CaloAnalyzer.mpJetToken = cms.InputTag("simCaloStage2Digis", "MP")
23  process.l1tStage2CaloAnalyzer.mpEtSumToken = cms.InputTag("simCaloStage2Digis", "MP")
24  process.l1tStage2CaloAnalyzer.egToken = cms.InputTag("simCaloStage2Digis")
25  process.l1tStage2CaloAnalyzer.tauToken = cms.InputTag("simCaloStage2Digis")
26  process.l1tStage2CaloAnalyzer.jetToken = cms.InputTag("simCaloStage2Digis")
27  process.l1tStage2CaloAnalyzer.etSumToken = cms.InputTag("simCaloStage2Digis")
28 
29  import L1Trigger.L1TCalorimeter.l1tStage2CaloAnalyzer_cfi
30  process.l1tCaloStage2HwHistos = L1Trigger.L1TCalorimeter.l1tStage2CaloAnalyzer_cfi.l1tStage2CaloAnalyzer.clone()
31  process.l1tCaloStage2HwHistos.doEvtDisp = False
32  process.l1tCaloStage2HwHistos.mpBx = 0
33  process.l1tCaloStage2HwHistos.dmxBx = 0
34  process.l1tCaloStage2HwHistos.allBx = False
35  process.l1tCaloStage2HwHistos.towerToken = cms.InputTag("caloStage2Digis", "CaloTower")
36  process.l1tCaloStage2HwHistos.clusterToken = cms.InputTag("None")
37  process.l1tCaloStage2HwHistos.mpEGToken = cms.InputTag("caloStage2Digis", "MP")
38  process.l1tCaloStage2HwHistos.mpTauToken = cms.InputTag("caloStage2Digis","MP")
39  process.l1tCaloStage2HwHistos.mpJetToken = cms.InputTag("caloStage2Digis", "MP")
40  process.l1tCaloStage2HwHistos.mpEtSumToken = cms.InputTag("caloStage2Digis", "MP")
41  process.l1tCaloStage2HwHistos.egToken = cms.InputTag("caloStage2Digis", "EGamma")
42  process.l1tCaloStage2HwHistos.tauToken = cms.InputTag("caloStage2Digis", "Tau")
43  process.l1tCaloStage2HwHistos.jetToken = cms.InputTag("caloStage2Digis", "Jet")
44  process.l1tCaloStage2HwHistos.etSumToken = cms.InputTag("caloStage2Digis", "EtSum")
45 
46  process.hwEmulHistos = cms.Path(
47  process.l1tStage2CaloAnalyzer
48  +process.l1tCaloStage2HwHistos
49  )
50 
51  process.schedule.append(process.hwEmulHistos)
52 
53  return process
54 
55 
56 def L1NtupleRAWEMU(process):
57 
58  process.load('L1Trigger.L1TNtuples.L1NtupleRAW_cff')
59  process.load('L1Trigger.L1TNtuples.L1NtupleEMU_cff')
60 
61  process.l1ntuplerawemu = cms.Path( process.L1NtupleRAW
62  + process.L1NtupleEMU )
63  process.schedule.append(process.l1ntuplerawemu)
64 
65  return process
66 
67 def reEmul(process, useStatic=False, ntuple=False):
68 
69  process.load('EventFilter.L1TRawToDigi.caloTowersFilter_cfi')
70  process.load('L1Trigger/L1TCalorimeter/simCaloStage2Digis_cfi')
71  if useStatic:
72  process.simCaloStage2Digis.useStaticConfig = True
73  process.load(static_config)
74  else:
75  process.load('L1Trigger.Configuration.SimL1Emulator_cff')
76 
77  if not ntuple:
78  process.filterPath = cms.Path(process.caloTowersFilter)
79  process.skimOutput = cms.OutputModule("PoolOutputModule",
80  #compressionAlgorithm = cms.untracked.string('LZMA'),
81  #compressionLevel = cms.untracked.int32(4),
82  #dropMetaData = cms.untracked.string('NONE'),
83  #fastCloning = cms.untracked.bool(True),
84  fileName = cms.untracked.string("comp.root"),
85  #overrideInputFileSplitLevels = cms.untracked.bool(False),
86  outputCommands = cms.untracked.vstring(
87  'keep *_caloStage2Digis_*_*',
88  'keep *_simCaloStage2Digis_*_*',
89  ),
90  SelectEvents = cms.untracked.PSet(
91  SelectEvents = cms.vstring(
92  'filterPath',
93  )
94  ),
95  )
96  process.output_step = cms.EndPath(process.skimOutput)
97 
98  process.schedule = cms.Schedule(
99  process.filterPath,
100  process.output_step,
101  )
102 
103  process.simCaloStage2Digis.towerToken = cms.InputTag("caloStage2Digis", "CaloTower")
104  process.caloLayer2 = cms.Path(process.simCaloStage2Digis)
105 
106  process.schedule.append(process.caloLayer2)
107 
108  hwEmulCompHistos(process)
109  if ntuple:
110  L1NtupleRAWEMU(process)
111  process.l1ntuplerawemu.insert(0,process.caloTowersFilter)
112 
113  process.caloLayer2.insert(0,process.caloTowersFilter)
114  process.hwEmulHistos.insert(0,process.caloTowersFilter)
115 
116 
117 def valHistosDB(process):
118 
119  reEmul(process, useStatic=False, ntuple=False)
120  return process
121 
122 
123 def valHistosStatic(process):
124 
125  reEmul(process, useStatic=True, ntuple=False)
126  return process
127 
128 def valHistosDBL1Ntuple(process):
129 
130  reEmul(process, useStatic=False, ntuple=True)
131  return process
132 
133 
135 
136  reEmul(process, useStatic=True, ntuple=True)
137  return process
138 
139 
140 
141