CMS 3D CMS Logo

ecalTB2006H4_GenSimDigiReco_cfg.py
Go to the documentation of this file.
1 from __future__ import print_function
2 import FWCore.ParameterSet.Config as cms
3 import os
4 
5 mySample = "g4"
6 mySection = "0"
7 myEvent = "100"
8 mySeed = "32789"
9 myEnergy = "20"
10 
11 # condor_output_vtx50 -------------------------------------
12 # vertex sigma 5.0 : not much different at this time.
13 myParList = cms.vdouble(1.006, 1.0, 0.0, 1.82790e+00, 3.66237e+00, 0.965, 1.0)
14 myNameTag = mySample + "_" + myEnergy + "_" + mySection
15 
16 process = cms.Process("TBSim")
17 
18 
19 
20 
21 process.load("FWCore.MessageLogger.MessageLogger_cfi")
22 
23 
24 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
25 
26 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
27  saveFileName = cms.untracked.string(''),
28  theSource = cms.PSet(
29  initialSeed = cms.untracked.uint32(7824367),
30  engineName = cms.untracked.string('HepJamesRandom')
31  ),
32  generator = cms.PSet(
33  initialSeed = cms.untracked.uint32(int(mySeed)),
34  engineName = cms.untracked.string('HepJamesRandom')
35  ),
36  VtxSmeared = cms.PSet(
37  initialSeed = cms.untracked.uint32(98765432),
38  engineName = cms.untracked.string('HepJamesRandom')
39  ),
40  g4SimHits = cms.PSet(
41  initialSeed = cms.untracked.uint32(11),
42  engineName = cms.untracked.string('HepJamesRandom')
43  ),
44  SimEcalTBG4Object = cms.PSet(
45  initialSeed = cms.untracked.uint32(12),
46  engineName = cms.untracked.string('HepJamesRandom')
47  ),
48  mix = cms.PSet(
49  initialSeed = cms.untracked.uint32(12345),
50  engineName = cms.untracked.string('HepJamesRandom')
51  ),
52 )
53 
54 process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")
55 
56 
57 process.maxEvents = cms.untracked.PSet(
58  input = cms.untracked.int32(int(myEvent)*10)
59 )
60 
61 #Geometry
62 
63 #process.load("SimG4CMS.EcalTestBeam.crystal248_cff")
64 process.common_beam_direction_parameters = cms.PSet(
65  BeamMeanY = cms.double(0.0),
66  BeamMeanX = cms.double(0.0),
67  MinEta = cms.double(0.221605),
68  MaxEta = cms.double(0.221605),
69  MinPhi = cms.double(0.0467487),
70  MaxPhi = cms.double(0.0467487),
71 # Psi = cms.double(999.9),
72  BeamPosition = cms.double(-26733.5)
73 )
74 
75 
76 
77 #process.load("Geometry.EcalTestBeam.TBH4GeometryXML_cfi")
78 process.MuonNumberingInitialization = cms.ESProducer("MuonNumberingInitialization")
79 process.XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
80  geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml',
81  'Geometry/CMSCommonData/data/rotations.xml',
82  'Geometry/EcalTestBeam/data/ebcon.xml',
83  'Geometry/EcalCommonData/data/ebrot.xml',
84  'Geometry/EcalTestBeam/data/eregalgo.xml',
85  'Geometry/EcalCommonData/data/ebalgo.xml',
86  'Geometry/EcalTestBeam/data/tbrot.xml',
87  'Geometry/EcalTestBeam/data/TBH4.xml',
88  'Geometry/EcalTestBeam/data/TBH4ecalsens.xml',
89  'Geometry/HcalSimData/data/CaloUtil.xml',
90  #'Geometry/EcalSimData/data/EcalProdCuts.xml',
91  #'Geometry/EcalTestBeam/data/TBH4ProdCuts.xml',
92  'SimG4Core/GFlash/TB/gflashTBH4ProdCuts.xml',
93  'Geometry/CMSCommonData/data/FieldParameters.xml'),
94  rootNodeName = cms.string('TBH4:OCMS')
95 )
96 
97 
98 process.load("Geometry.CaloEventSetup.CaloGeometry_cff")
99 process.load("Geometry.CaloEventSetup.CaloTopology_cfi")
100 process.load("Geometry.EcalMapping.EcalMapping_cfi")
101 process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi")
102 process.CaloGeometryBuilder.SelectedCalos = ['EcalBarrel']
103 #, 'EcalEndcap']
104 
105 
106 # No magnetic field
107 
108 process.load("MagneticField.Engine.uniformMagneticField_cfi")
109 
110 process.source = cms.Source("EmptySource")
111 
112 process.generator = cms.EDProducer("FlatRandomEGunProducer",
113  PGunParameters = cms.PSet(
114  process.common_beam_direction_parameters,
115  PartID = cms.vint32(11),
116  MinE = cms.double(float(myEnergy)),
117  MaxE = cms.double(float(myEnergy))
118  ),
119  Verbosity = cms.untracked.int32(0), ## set to 1 (or greater) for printouts
120 
121  psethack = cms.string('single electron'),
122  AddAntiParticle = cms.bool(False),
123 )
124 
125 process.ProductionFilterSequence = cms.Sequence(process.generator)
126 
128 
129 #
130 # this module takes input in the units of *cm* and *radian*!!!
131 #
132 
133 process.VtxSmeared = cms.EDProducer("BeamProfileVtxGenerator",
134  process.common_beam_direction_parameters,
135  VtxSmearedCommon,
136 # BeamSigmaX = cms.double(2.4),
137 # BeamSigmaY = cms.double(2.4),
138 # GaussianProfile = cms.bool(False),
139  BeamSigmaX = cms.double(5.0),
140  BeamSigmaY = cms.double(5.0),
141  Psi = cms.double(999.9),
142  GaussianProfile = cms.bool(True),
143  BinX = cms.int32(50),
144  BinY = cms.int32(50),
145  File = cms.string('beam.profile'),
146  UseFile = cms.bool(False),
147  TimeOffset = cms.double(0.)
148 )
149 
150 # Geant4, ECAL test beam specific OscarProducer configuration
151 
152 process.load("SimG4Core.Application.g4SimHits_cfi")
153 
154 process.g4SimHits.UseMagneticField = cms.bool(False)
155 process.g4SimHits.Physics.DefaultCutValue = 1.
156 process.g4SimHits.NonBeamEvent = cms.bool(True)
157 process.g4SimHits.Generator.HepMCProductLabel = cms.string('generatorSmeared')
158 process.g4SimHits.Generator.ApplyPCuts = cms.bool(False)
159 process.g4SimHits.Generator.ApplyEtaCuts = cms.bool(True)
160 process.g4SimHits.Generator.ApplyPhiCuts = cms.bool(False)
161 process.g4SimHits.Generator.MaxEtaCut = cms.double(1.5)
162 process.g4SimHits.Generator.MinEtaCut = cms.double(0.0)
163 process.g4SimHits.CaloSD.CorrectTOFBeam = cms.bool(True)
164 process.g4SimHits.CaloSD.BeamPosition = cms.double(-26733.5)
165 process.g4SimHits.CaloTrkProcessing.TestBeam = cms.bool(True)
166 process.g4SimHits.StackingAction.MaxTrackTime = cms.double(10000.)
167 process.g4SimHits.SteppingAction.MaxTrackTime = cms.double(10000.)
168 process.g4SimHits.CaloSD.TmaxHit = cms.double(10000.)
169 process.g4SimHits.CaloSD.TmaxHits = cms.vdouble(10000.,10000.,10000.,10000.,10000.)
170 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
171  type = cms.string('EcalTBH4Trigger'),
172  verbose = cms.untracked.bool(False),
173  #IMPORTANT # # # # # # # # NUMBER OF EVENTS TO BE TRIGGERED
174  trigEvents = cms.untracked.int32(int(myEvent))
175 ))
176 
177 
178 # Test Beam ECAL specific MC info
179 
180 process.SimEcalTBG4Object = cms.EDProducer("EcalTBMCInfoProducer",
181  process.common_beam_direction_parameters,
182  CrystalMapFile = cms.FileInPath('Geometry/EcalTestBeam/data/BarrelSM1CrystalCenterElectron120GeV.dat'),
183  moduleLabelVtx = cms.untracked.string('generatorSmeared')
184 )
185 
186 # Test Beam ECAL hodoscope raw data simulation
187 
188 process.SimEcalTBHodoscope = cms.EDProducer("TBHodoActiveVolumeRawInfoProducer")
189 
190 # Test Beam ECAL Event header filling
191 
192 process.SimEcalEventHeader = cms.EDProducer("FakeTBEventHeaderProducer",
193  EcalTBInfoLabel = cms.untracked.string('SimEcalTBG4Object')
194 )
195 
196 # Digitization
197 
198 # no pileup
199 
200 process.load("SimGeneral.MixingModule.mixNoPU_cfi")
201 
202 # fake TB conditions
203 
204 process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetrieverTB_cfi")
205 
206 process.load("CalibCalorimetry.EcalTrivialCondModules.ESTrivialCondRetriever_cfi")
207 
208 # Test beam unsuppressed digis
209 
210 process.load("SimCalorimetry.EcalTestBeam.ecaldigi_testbeam_cfi")
211 
212 # local reco
213 process.load("Configuration.EcalTB.localReco_tbsim_cff")
214 
215 # ntuplizer for TB data format
216 #process.treeProducerCalibSimul = cms.EDFilter("TreeProducerCalibSimul",
217 # rootfile = cms.untracked.string("treeTB_"+myNameTag+".root"),
218 # eventHeaderCollection = cms.string(''),
219 # eventHeaderProducer = cms.string('SimEcalEventHeader'),
220 # txtfile = cms.untracked.string("treeTB_"+myNameTag+".txt"),
221 # EBRecHitCollection = cms.string('EcalRecHitsEB'),
222 # tdcRecInfoCollection = cms.string('EcalTBTDCRecInfo'),
223 # xtalInBeam = cms.untracked.int32(248),
224 # hodoRecInfoProducer = cms.string('ecalTBSimHodoscopeReconstructor'),
225 # hodoRecInfoCollection = cms.string('EcalTBHodoscopeRecInfo'),
226 # RecHitProducer = cms.string('ecalTBSimRecHit'),
227 # tdcRecInfoProducer = cms.string('ecalTBSimTDCReconstructor')
228 #)
229 
230 # turning on/off Gflash
231 if mySample == "gf":
232  process.ecal_notCont_sim.EBs25notContainment = 1.0
233  process.ecal_notCont_sim.EEs25notContainment = 1.0
234  process.g4SimHits.Physics.type = 'SimG4Core/Physics/GFlash'
235  process.g4SimHits.Physics.GFlash = cms.PSet(
236  bField = cms.double(0.0),
237  GflashEMShowerModel = cms.bool(True),
238  GflashHadronShowerModel = cms.bool(True),
239  GflashHistogram = cms.bool(True),
240  GflashHistogramName = cms.string("gflash_histogram_"+myNameTag+".root"),
241  GflashHadronPhysics = cms.string('QGSP_BERT'),
242  GflashHcalOuter = cms.bool(True),
243  GflashExportToFastSim = cms.bool(False),
244  watcherOn = cms.bool(False),
245  Verbosity = cms.untracked.int32(0),
246  tuning_pList = myParList
247  )
248 
249 print("physics type : ", process.g4SimHits.Physics.type)
250 
251 # sequences
252 process.doSimHits = cms.Sequence(process.ProductionFilterSequence*process.VtxSmeared*process.g4SimHits)
253 process.doSimTB = cms.Sequence(process.SimEcalTBG4Object*process.SimEcalTBHodoscope*process.SimEcalEventHeader)
254 process.doEcalDigis = cms.Sequence(process.mix)
255 #process.p1 = cms.Path(process.doSimHits*process.doSimTB*process.doEcalDigis*process.localReco_tbsim*process.treeProducerCalibSimul)
256 process.p1 = cms.Path(process.doSimHits*process.doSimTB*process.doEcalDigis*process.localReco_tbsim)
257 
258 
259 
260 # modify the default behavior of the MessageLogger
261 
262 process.MessageLogger.destinations=cms.untracked.vstring('cout'
263  ,'cerr'
264  ,'G4msg'
265  )
266 process.MessageLogger.categories=cms.untracked.vstring('FwkJob'
267  ,'FwkReport'
268  ,'FwkSummary'
269  ,'Root_NoDictionary'
270  ,'TimeReport'
271  ,'TimeModule'
272  ,'TimeEvent'
273  ,'MemoryCheck'
274  ,'PhysicsList'
275  ,'G4cout'
276  ,'G4cerr'
277  ,'BeamProfileVtxGenerator'
278  )
279 
280 #process.MessageLogger.debugModule = cms.untracked.vstring('g4SimHits','generatorSmeared')
281 
282 #Configuring the G4msg.log output
283 process.MessageLogger.G4msg = cms.untracked.PSet(
284  noTimeStamps = cms.untracked.bool(True)
285  #First eliminate unneeded output
286  ,threshold = cms.untracked.string('INFO')
287  #,DEBUG = cms.untracked.PSet(limit = cms.untracked.int32(0))
288  ,INFO = cms.untracked.PSet(limit = cms.untracked.int32(0))
289  ,FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
290  ,FwkSummary = cms.untracked.PSet(limit = cms.untracked.int32(0))
291  ,Root_NoDictionary = cms.untracked.PSet(limit = cms.untracked.int32(0))
292  ,FwkJob = cms.untracked.PSet(limit = cms.untracked.int32(0))
293  ,TimeReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
294  ,TimeModule = cms.untracked.PSet(limit = cms.untracked.int32(0))
295  ,TimeEvent = cms.untracked.PSet(limit = cms.untracked.int32(0))
296  ,MemoryCheck = cms.untracked.PSet(limit = cms.untracked.int32(0))
297  #TimeModule, TimeEvent, TimeReport are written to LogAsbolute instead of LogInfo with a category
298  #so they cannot be eliminated from any destination (!) unless one uses the summaryOnly option
299  #in the Timing Service... at the price of silencing the output needed for the TimingReport profiling
300  #
301  #Then add the wanted ones:
302  ,PhysicsList = cms.untracked.PSet(limit = cms.untracked.int32(-1))
303  ,G4cout = cms.untracked.PSet(limit = cms.untracked.int32(-1))
304  ,G4cerr = cms.untracked.PSet(limit = cms.untracked.int32(-1))
305  ,BeamProfileVtxGenerator = cms.untracked.PSet(limit = cms.untracked.int32(-1))
306  )
307 
308 #Add these 3 lines to put back the summary for timing information at the end of the logfile
309 #(needed for TimeReport report)
310 process.options = cms.untracked.PSet(
311  wantSummary = cms.untracked.bool(True)
312 )
313 
314 
315 #if not hasattr(process,"options") :
316 process.options = cms.untracked.PSet()
317 process.options.SkipEvent = cms.untracked.vstring('EventCorruption')
318 
319 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66
set to 1 (or greater) for printouts