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