CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/SimCalorimetry/EcalTestBeam/python/ecalTB2006H4_GenSimDigiReco_cfg.py

Go to the documentation of this file.
00001 import FWCore.ParameterSet.Config as cms
00002 import os
00003 
00004 mySample = "g4"
00005 mySection = "0"
00006 myEvent = "100"
00007 mySeed = "32789"
00008 myEnergy = "20"
00009 
00010 # condor_output_vtx50 -------------------------------------
00011 # vertex sigma 5.0 : not much different at this time.
00012 myParList = cms.vdouble(1.006, 1.0, 0.0, 1.82790e+00, 3.66237e+00, 0.965, 1.0)
00013 myNameTag = mySample + "_" + myEnergy + "_" + mySection
00014 
00015 process = cms.Process("TBSim")
00016 
00017 
00018 
00019 
00020 process.load("FWCore.MessageLogger.MessageLogger_cfi")
00021 
00022     
00023 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
00024 
00025 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
00026     saveFileName = cms.untracked.string(''),
00027     theSource = cms.PSet(
00028         initialSeed = cms.untracked.uint32(7824367),      
00029         engineName = cms.untracked.string('HepJamesRandom') 
00030     ),                                                      
00031     generator = cms.PSet(
00032         initialSeed = cms.untracked.uint32(int(mySeed)),      
00033         engineName = cms.untracked.string('HepJamesRandom') 
00034     ),                                                      
00035     VtxSmeared = cms.PSet(
00036         initialSeed = cms.untracked.uint32(98765432),
00037         engineName = cms.untracked.string('HepJamesRandom')
00038     ),
00039     g4SimHits = cms.PSet(
00040         initialSeed = cms.untracked.uint32(11),
00041         engineName = cms.untracked.string('HepJamesRandom')
00042     ),
00043     SimEcalTBG4Object = cms.PSet(
00044         initialSeed = cms.untracked.uint32(12),
00045         engineName = cms.untracked.string('HepJamesRandom')
00046     ),
00047     mix = cms.PSet(
00048         initialSeed = cms.untracked.uint32(12345),
00049         engineName = cms.untracked.string('HepJamesRandom')
00050     ),
00051     simEcalUnsuppressedDigis = cms.PSet(
00052         initialSeed = cms.untracked.uint32(1234567),
00053         engineName = cms.untracked.string('HepJamesRandom')
00054     ),
00055 )
00056 
00057 process.RandomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")
00058 
00059 
00060 process.maxEvents = cms.untracked.PSet(
00061     input = cms.untracked.int32(int(myEvent)*10)
00062 )
00063 
00064 #Geometry
00065 
00066 #process.load("SimG4CMS.EcalTestBeam.crystal248_cff")
00067 process.common_beam_direction_parameters = cms.PSet(
00068     BeamMeanY = cms.double(0.0),
00069     BeamMeanX = cms.double(0.0),
00070     MinEta = cms.double(0.221605),
00071     MaxEta = cms.double(0.221605),
00072     MinPhi = cms.double(0.0467487),
00073     MaxPhi = cms.double(0.0467487),
00074 #    Psi    = cms.double(999.9),
00075     BeamPosition = cms.double(-26733.5)
00076 )
00077 
00078 
00079 
00080 #process.load("Geometry.EcalTestBeam.TBH4GeometryXML_cfi")
00081 process.MuonNumberingInitialization = cms.ESProducer("MuonNumberingInitialization")
00082 process.XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
00083     geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml', 
00084         'Geometry/CMSCommonData/data/rotations.xml', 
00085         'Geometry/EcalTestBeam/data/ebcon.xml', 
00086         'Geometry/EcalCommonData/data/ebrot.xml', 
00087         'Geometry/EcalTestBeam/data/eregalgo.xml', 
00088         'Geometry/EcalCommonData/data/ebalgo.xml', 
00089         'Geometry/EcalTestBeam/data/tbrot.xml',
00090         'Geometry/EcalTestBeam/data/TBH4.xml', 
00091         'Geometry/EcalTestBeam/data/TBH4ecalsens.xml', 
00092         'Geometry/HcalSimData/data/CaloUtil.xml', 
00093         #'Geometry/EcalSimData/data/EcalProdCuts.xml', 
00094         #'Geometry/EcalTestBeam/data/TBH4ProdCuts.xml',
00095         'SimG4Core/GFlash/TB/gflashTBH4ProdCuts.xml',
00096         'Geometry/CMSCommonData/data/FieldParameters.xml'),
00097     rootNodeName = cms.string('TBH4:OCMS')
00098 )
00099 
00100 
00101 process.load("Geometry.CaloEventSetup.CaloGeometry_cff")
00102 process.load("Geometry.CaloEventSetup.CaloTopology_cfi")
00103 process.load("Geometry.EcalMapping.EcalMapping_cfi")
00104 process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi")
00105 process.CaloGeometryBuilder.SelectedCalos = ['EcalBarrel']
00106 #, 'EcalEndcap']
00107 
00108 
00109 # No magnetic field
00110 
00111 process.load("MagneticField.Engine.uniformMagneticField_cfi")
00112 
00113 process.source = cms.Source("EmptySource")
00114 
00115 process.generator = cms.EDProducer("FlatRandomEGunProducer",
00116     PGunParameters = cms.PSet(
00117         process.common_beam_direction_parameters,
00118         PartID = cms.vint32(11),
00119         MinE = cms.double(float(myEnergy)),
00120         MaxE = cms.double(float(myEnergy))
00121     ),
00122     Verbosity = cms.untracked.int32(0), ## set to 1 (or greater)  for printouts
00123 
00124     psethack = cms.string('single electron'),
00125     AddAntiParticle = cms.bool(False),
00126 )
00127 
00128 process.ProductionFilterSequence = cms.Sequence(process.generator)
00129 
00130 from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import *
00131 
00132 #
00133 # this module takes input in the units of *cm* and *radian*!!!
00134 #
00135 
00136 process.VtxSmeared = cms.EDProducer("BeamProfileVtxGenerator",
00137     process.common_beam_direction_parameters,
00138     VtxSmearedCommon,
00139 #    BeamSigmaX = cms.double(2.4),
00140 #    BeamSigmaY = cms.double(2.4),
00141 #    GaussianProfile = cms.bool(False),
00142     BeamSigmaX = cms.double(5.0),
00143     BeamSigmaY = cms.double(5.0),
00144     Psi             = cms.double(999.9),
00145     GaussianProfile = cms.bool(True),
00146     BinX = cms.int32(50),
00147     BinY = cms.int32(50),
00148     File       = cms.string('beam.profile'),
00149     UseFile    = cms.bool(False),
00150     TimeOffset = cms.double(0.)                      
00151 )
00152 
00153 # Geant4, ECAL test beam specific OscarProducer Configuration
00154 
00155 process.load("SimG4Core.Application.g4SimHits_cfi")
00156 
00157 process.g4SimHits.UseMagneticField = cms.bool(False)
00158 process.g4SimHits.Physics.DefaultCutValue = 1.
00159 process.g4SimHits.NonBeamEvent = cms.bool(True)
00160 process.g4SimHits.generator.HepMCProductLabel = cms.string('generator')
00161 process.g4SimHits.generator.ApplyPCuts = cms.bool(False)
00162 process.g4SimHits.generator.ApplyEtaCuts = cms.bool(True)
00163 process.g4SimHits.generator.ApplyPhiCuts = cms.bool(False)
00164 process.g4SimHits.generator.MaxEtaCut = cms.double(1.5)
00165 process.g4SimHits.generator.MinEtaCut = cms.double(0.0)
00166 process.g4SimHits.CaloSD.CorrectTOFBeam = cms.bool(True)
00167 process.g4SimHits.CaloSD.BeamPosition = cms.double(-26733.5)
00168 process.g4SimHits.CaloTrkProcessing.TestBeam = cms.bool(True)
00169 process.g4SimHits.StackingAction.MaxTrackTime = cms.double(10000.)
00170 process.g4SimHits.SteppingAction.MaxTrackTime = cms.double(10000.)
00171 process.g4SimHits.CaloSD.TmaxHit = cms.double(10000.)
00172 process.g4SimHits.CaloSD.TmaxHits = cms.vdouble(10000.,10000.,10000.,10000.,10000.)
00173 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
00174     type = cms.string('EcalTBH4Trigger'),
00175     verbose = cms.untracked.bool(False),
00176     #IMPORTANT    #    #    #    #    #    #    #    # NUMBER OF EVENTS TO BE TRIGGERED 
00177     trigEvents = cms.untracked.int32(int(myEvent))
00178 ))
00179 
00180 
00181 # Test Beam ECAL specific MC info
00182 
00183 process.SimEcalTBG4Object = cms.EDProducer("EcalTBMCInfoProducer",
00184     process.common_beam_direction_parameters,
00185     CrystalMapFile = cms.FileInPath('Geometry/EcalTestBeam/data/BarrelSM1CrystalCenterElectron120GeV.dat'),
00186     moduleLabelVtx = cms.untracked.string('generator')
00187 )
00188 
00189 # Test Beam ECAL hodoscope raw data simulation
00190 
00191 process.SimEcalTBHodoscope = cms.EDProducer("TBHodoActiveVolumeRawInfoProducer")
00192 
00193 # Test Beam ECAL Event header filling
00194 
00195 process.SimEcalEventHeader = cms.EDProducer("FakeTBEventHeaderProducer",
00196     EcalTBInfoLabel = cms.untracked.string('SimEcalTBG4Object')
00197 )
00198 
00199 # Digitization
00200 
00201 # no pileup
00202 
00203 process.load("SimGeneral.MixingModule.mixNoPU_cfi")
00204 
00205 # fake TB conditions
00206 
00207 process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetrieverTB_cfi")
00208 
00209 process.load("CalibCalorimetry.EcalTrivialCondModules.ESTrivialCondRetriever_cfi")
00210 
00211 # Test beam unsuppressed digis
00212 
00213 process.load("SimCalorimetry.EcalTestBeam.ecaldigi_testbeam_cfi")
00214 
00215 # local reco
00216 process.load("Configuration.EcalTB.localReco_tbsim_cff")
00217  
00218 # ntuplizer for TB data format
00219 #process.TreeProducerCalibSimul = cms.EDFilter("TreeProducerCalibSimul",
00220 #    rootfile = cms.untracked.string("treeTB_"+myNameTag+".root"),
00221 #    eventHeaderCollection = cms.string(''),
00222 #    eventHeaderProducer = cms.string('SimEcalEventHeader'),
00223 #    txtfile = cms.untracked.string("treeTB_"+myNameTag+".txt"),
00224 #    EBRecHitCollection = cms.string('EcalRecHitsEB'),
00225 #    tdcRecInfoCollection = cms.string('EcalTBTDCRecInfo'),
00226 #    xtalInBeam = cms.untracked.int32(248),
00227 #    hodoRecInfoProducer = cms.string('ecalTBSimHodoscopeReconstructor'),
00228 #    hodoRecInfoCollection = cms.string('EcalTBHodoscopeRecInfo'),
00229 #    RecHitProducer = cms.string('ecalTBSimRecHit'),
00230 #    tdcRecInfoProducer = cms.string('ecalTBSimTDCReconstructor')
00231 #)
00232 
00233 # turning on/off Gflash
00234 if mySample == "gf":
00235     process.ecal_notCont_sim.EBs25notContainment = 1.0
00236     process.ecal_notCont_sim.EEs25notContainment = 1.0
00237     process.g4SimHits.Physics.type = 'SimG4Core/Physics/GFlash'
00238     process.g4SimHits.Physics.GFlash = cms.PSet(
00239         bField = cms.double(0.0),
00240         GflashEMShowerModel = cms.bool(True),
00241         GflashHadronShowerModel = cms.bool(True),
00242         GflashHistogram = cms.bool(True),
00243         GflashHistogramName = cms.string("gflash_histogram_"+myNameTag+".root"),
00244         GflashHadronPhysics = cms.string('QGSP_BERT'),
00245         GflashHcalOuter = cms.bool(True),
00246         GflashExportToFastSim = cms.bool(False),
00247         watcherOn = cms.bool(False),
00248         Verbosity = cms.untracked.int32(0),
00249         tuning_pList = myParList
00250     )
00251 
00252 print "physics type : ", process.g4SimHits.Physics.type
00253 
00254 # sequences
00255 process.doSimHits = cms.Sequence(process.ProductionFilterSequence*process.VtxSmeared*process.g4SimHits)
00256 process.doSimTB = cms.Sequence(process.SimEcalTBG4Object*process.SimEcalTBHodoscope*process.SimEcalEventHeader)
00257 process.doEcalDigis = cms.Sequence(process.mix*process.simEcalUnsuppressedDigis)
00258 #process.p1 = cms.Path(process.doSimHits*process.doSimTB*process.doEcalDigis*process.localReco_tbsim*process.TreeProducerCalibSimul)
00259 process.p1 = cms.Path(process.doSimHits*process.doSimTB*process.doEcalDigis*process.localReco_tbsim)
00260 
00261 
00262 
00263 # modify the default behavior of the MessageLogger
00264     
00265 process.MessageLogger.destinations=cms.untracked.vstring('cout'
00266                                                          ,'cerr'
00267                                                          ,'G4msg'
00268                                                          )
00269 process.MessageLogger.categories=cms.untracked.vstring('FwkJob'
00270                                                        ,'FwkReport'
00271                                                        ,'FwkSummary'
00272                                                        ,'Root_NoDictionary'
00273                                                        ,'TimeReport'
00274                                                        ,'TimeModule'
00275                                                        ,'TimeEvent'
00276                                                        ,'MemoryCheck'
00277                                                        ,'PhysicsList'
00278                                                        ,'G4cout'
00279                                                        ,'G4cerr'
00280                                                        ,'BeamProfileVtxGenerator'
00281                                                        )
00282 
00283 #process.MessageLogger.debugModule = cms.untracked.vstring('g4SimHits','VtxSmeared')
00284 
00285 #Configuring the G4msg.log output
00286 process.MessageLogger.G4msg =  cms.untracked.PSet(
00287     noTimeStamps = cms.untracked.bool(True)
00288     #First eliminate unneeded output
00289     ,threshold = cms.untracked.string('INFO')
00290     #,DEBUG = cms.untracked.PSet(limit = cms.untracked.int32(0))
00291     ,INFO = cms.untracked.PSet(limit = cms.untracked.int32(0))
00292     ,FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
00293     ,FwkSummary = cms.untracked.PSet(limit = cms.untracked.int32(0))
00294     ,Root_NoDictionary = cms.untracked.PSet(limit = cms.untracked.int32(0))
00295     ,FwkJob = cms.untracked.PSet(limit = cms.untracked.int32(0))
00296     ,TimeReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
00297     ,TimeModule = cms.untracked.PSet(limit = cms.untracked.int32(0))
00298     ,TimeEvent = cms.untracked.PSet(limit = cms.untracked.int32(0))
00299     ,MemoryCheck = cms.untracked.PSet(limit = cms.untracked.int32(0))
00300     #TimeModule, TimeEvent, TimeReport are written to LogAsbolute instead of LogInfo with a category
00301     #so they cannot be eliminated from any destination (!) unless one uses the summaryOnly option
00302     #in the Timing Service... at the price of silencing the output needed for the TimingReport profiling
00303     #
00304     #Then add the wanted ones:
00305     ,PhysicsList = cms.untracked.PSet(limit = cms.untracked.int32(-1))
00306     ,G4cout = cms.untracked.PSet(limit = cms.untracked.int32(-1))
00307     ,G4cerr = cms.untracked.PSet(limit = cms.untracked.int32(-1))
00308     ,BeamProfileVtxGenerator = cms.untracked.PSet(limit = cms.untracked.int32(-1))
00309     )
00310 
00311 #Add these 3 lines to put back the summary for timing information at the end of the logfile
00312 #(needed for TimeReport report)
00313 process.options = cms.untracked.PSet(
00314     wantSummary = cms.untracked.bool(True)
00315 )
00316 
00317 
00318 #if not hasattr(process,"options") :
00319 process.options = cms.untracked.PSet()
00320 process.options.SkipEvent = cms.untracked.vstring('EventCorruption')
00321 
00322