CMS 3D CMS Logo

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