CMS 3D CMS Logo

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