Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-27 03:18:07

0001 import FWCore.ParameterSet.Config as cms
0002 import os
0003 
0004 mySample = "g4"
0005 mySection = "0"
0006 myEvent = "100"
0007 mySeed = "32789"
0008 myEnergy = "20"
0009 
0010 # condor_output_vtx50 -------------------------------------
0011 # vertex sigma 5.0 : not much different at this time.
0012 myParList = cms.vdouble(1.006, 1.0, 0.0, 1.82790e+00, 3.66237e+00, 0.965, 1.0)
0013 myNameTag = mySample + "_" + myEnergy + "_" + mySection
0014 
0015 process = cms.Process("TBSim")
0016 
0017 
0018 
0019 
0020 process.load("FWCore.MessageLogger.MessageLogger_cfi")
0021 
0022     
0023 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0024 
0025 process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
0026     saveFileName = cms.untracked.string(''),
0027     theSource = cms.PSet(
0028         initialSeed = cms.untracked.uint32(7824367),      
0029         engineName = cms.untracked.string('HepJamesRandom') 
0030     ),                                                      
0031     generator = cms.PSet(
0032         initialSeed = cms.untracked.uint32(int(mySeed)),      
0033         engineName = cms.untracked.string('HepJamesRandom') 
0034     ),                                                      
0035     VtxSmeared = cms.PSet(
0036         initialSeed = cms.untracked.uint32(98765432),
0037         engineName = cms.untracked.string('HepJamesRandom')
0038     ),
0039     g4SimHits = cms.PSet(
0040         initialSeed = cms.untracked.uint32(11),
0041         engineName = cms.untracked.string('HepJamesRandom')
0042     ),
0043     SimEcalTBG4Object = cms.PSet(
0044         initialSeed = cms.untracked.uint32(12),
0045         engineName = cms.untracked.string('HepJamesRandom')
0046     ),
0047     mix = cms.PSet(
0048         initialSeed = cms.untracked.uint32(12345),
0049         engineName = cms.untracked.string('HepJamesRandom')
0050     ),
0051 )
0052 
0053 process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")
0054 
0055 
0056 process.maxEvents = cms.untracked.PSet(
0057     input = cms.untracked.int32(int(myEvent)*10)
0058 )
0059 
0060 #Geometry
0061 
0062 #process.load("SimG4CMS.EcalTestBeam.crystal248_cff")
0063 process.common_beam_direction_parameters = cms.PSet(
0064     BeamMeanY = cms.double(0.0),
0065     BeamMeanX = cms.double(0.0),
0066     MinEta = cms.double(0.221605),
0067     MaxEta = cms.double(0.221605),
0068     MinPhi = cms.double(0.0467487),
0069     MaxPhi = cms.double(0.0467487),
0070 #    Psi    = cms.double(999.9),
0071     BeamPosition = cms.double(-26733.5)
0072 )
0073 
0074 
0075 
0076 #process.load("Geometry.EcalTestBeam.TBH4GeometryXML_cfi")
0077 process.MuonNumberingInitialization = cms.ESProducer("MuonNumberingInitialization")
0078 process.XMLIdealGeometryESSource = cms.ESSource("XMLIdealGeometryESSource",
0079     geomXMLFiles = cms.vstring('Geometry/CMSCommonData/data/materials.xml', 
0080         'Geometry/CMSCommonData/data/rotations.xml', 
0081         'Geometry/EcalTestBeam/data/ebcon.xml', 
0082         'Geometry/EcalCommonData/data/ebrot.xml', 
0083         'Geometry/EcalTestBeam/data/eregalgo.xml', 
0084         'Geometry/EcalCommonData/data/ebalgo.xml', 
0085         'Geometry/EcalTestBeam/data/tbrot.xml',
0086         'Geometry/EcalTestBeam/data/TBH4.xml', 
0087         'Geometry/EcalTestBeam/data/TBH4ecalsens.xml', 
0088         'Geometry/HcalSimData/data/CaloUtil.xml', 
0089         #'Geometry/EcalSimData/data/EcalProdCuts.xml', 
0090         #'Geometry/EcalTestBeam/data/TBH4ProdCuts.xml',
0091         'SimG4Core/GFlash/TB/gflashTBH4ProdCuts.xml',
0092         'Geometry/CMSCommonData/data/FieldParameters.xml'),
0093     rootNodeName = cms.string('TBH4:OCMS')
0094 )
0095 
0096 
0097 process.load("Geometry.CaloEventSetup.CaloGeometry_cff")
0098 process.load("Geometry.CaloEventSetup.CaloTopology_cfi")
0099 process.load("Geometry.EcalMapping.EcalMapping_cfi")
0100 process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi")
0101 process.CaloGeometryBuilder.SelectedCalos = ['EcalBarrel']
0102 #, 'EcalEndcap']
0103 
0104 
0105 # No magnetic field
0106 
0107 process.load("MagneticField.Engine.uniformMagneticField_cfi")
0108 
0109 process.source = cms.Source("EmptySource")
0110 
0111 process.generator = cms.EDProducer("FlatRandomEGunProducer",
0112     PGunParameters = cms.PSet(
0113         process.common_beam_direction_parameters,
0114         PartID = cms.vint32(11),
0115         MinE = cms.double(float(myEnergy)),
0116         MaxE = cms.double(float(myEnergy))
0117     ),
0118     Verbosity = cms.untracked.int32(0), ## set to 1 (or greater)  for printouts
0119 
0120     psethack = cms.string('single electron'),
0121     AddAntiParticle = cms.bool(False),
0122 )
0123 
0124 process.ProductionFilterSequence = cms.Sequence(process.generator)
0125 
0126 from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import *
0127 
0128 #
0129 # this module takes input in the units of *cm* and *radian*!!!
0130 #
0131 
0132 process.VtxSmeared = cms.EDProducer("BeamProfileVtxGenerator",
0133     process.common_beam_direction_parameters,
0134     VtxSmearedCommon,
0135 #    BeamSigmaX = cms.double(2.4),
0136 #    BeamSigmaY = cms.double(2.4),
0137 #    GaussianProfile = cms.bool(False),
0138     BeamSigmaX = cms.double(5.0),
0139     BeamSigmaY = cms.double(5.0),
0140     Psi             = cms.double(999.9),
0141     GaussianProfile = cms.bool(True),
0142     BinX = cms.int32(50),
0143     BinY = cms.int32(50),
0144     File       = cms.string('beam.profile'),
0145     UseFile    = cms.bool(False),
0146     TimeOffset = cms.double(0.)                      
0147 )
0148 
0149 # Geant4, ECAL test beam specific OscarProducer configuration
0150 
0151 process.load("SimG4Core.Application.g4SimHits_cfi")
0152 
0153 process.g4SimHits.UseMagneticField = cms.bool(False)
0154 process.g4SimHits.Physics.DefaultCutValue = 1.
0155 process.g4SimHits.NonBeamEvent = cms.bool(True)
0156 process.g4SimHits.Generator.HepMCProductLabel = cms.string('generatorSmeared')
0157 process.g4SimHits.Generator.ApplyPCuts = cms.bool(False)
0158 process.g4SimHits.Generator.ApplyEtaCuts = cms.bool(True)
0159 process.g4SimHits.Generator.ApplyPhiCuts = cms.bool(False)
0160 process.g4SimHits.Generator.MaxEtaCut = cms.double(1.5)
0161 process.g4SimHits.Generator.MinEtaCut = cms.double(0.0)
0162 process.g4SimHits.CaloSD.CorrectTOFBeam = cms.bool(True)
0163 process.g4SimHits.CaloSD.BeamPosition = cms.double(-26733.5)
0164 process.g4SimHits.CaloTrkProcessing.TestBeam = cms.bool(True)
0165 process.g4SimHits.StackingAction.MaxTrackTime = cms.double(10000.)
0166 process.g4SimHits.SteppingAction.MaxTrackTime = cms.double(10000.)
0167 process.g4SimHits.CaloSD.TmaxHit = cms.double(10000.)
0168 process.g4SimHits.CaloSD.TmaxHits = cms.vdouble(10000.,10000.,10000.,10000.,10000.)
0169 process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
0170     type = cms.string('EcalTBH4Trigger'),
0171     verbose = cms.untracked.bool(False),
0172     #IMPORTANT    #    #    #    #    #    #    #    # NUMBER OF EVENTS TO BE TRIGGERED 
0173     trigEvents = cms.untracked.int32(int(myEvent))
0174 ))
0175 
0176 
0177 # Test Beam ECAL specific MC info
0178 
0179 process.SimEcalTBG4Object = cms.EDProducer("EcalTBMCInfoProducer",
0180     process.common_beam_direction_parameters,
0181     CrystalMapFile = cms.FileInPath('Geometry/EcalTestBeam/data/BarrelSM1CrystalCenterElectron120GeV.dat'),
0182     moduleLabelVtx = cms.untracked.string('generatorSmeared')
0183 )
0184 
0185 # Test Beam ECAL hodoscope raw data simulation
0186 
0187 process.SimEcalTBHodoscope = cms.EDProducer("TBHodoActiveVolumeRawInfoProducer")
0188 
0189 # Test Beam ECAL Event header filling
0190 
0191 process.SimEcalEventHeader = cms.EDProducer("FakeTBEventHeaderProducer",
0192     EcalTBInfoLabel = cms.untracked.string('SimEcalTBG4Object')
0193 )
0194 
0195 # Digitization
0196 
0197 # no pileup
0198 
0199 process.load("SimGeneral.MixingModule.mixNoPU_cfi")
0200 
0201 # fake TB conditions
0202 
0203 process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetrieverTB_cfi")
0204 
0205 process.load("CalibCalorimetry.EcalTrivialCondModules.ESTrivialCondRetriever_cfi")
0206 
0207 # Test beam unsuppressed digis
0208 
0209 process.load("SimCalorimetry.EcalTestBeam.ecaldigi_testbeam_cfi")
0210 
0211 # local reco
0212 process.load("Configuration.EcalTB.localReco_tbsim_cff")
0213  
0214 # ntuplizer for TB data format
0215 #process.treeProducerCalibSimul = cms.EDFilter("TreeProducerCalibSimul",
0216 #    rootfile = cms.untracked.string("treeTB_"+myNameTag+".root"),
0217 #    eventHeaderCollection = cms.string(''),
0218 #    eventHeaderProducer = cms.string('SimEcalEventHeader'),
0219 #    txtfile = cms.untracked.string("treeTB_"+myNameTag+".txt"),
0220 #    EBRecHitCollection = cms.string('EcalRecHitsEB'),
0221 #    tdcRecInfoCollection = cms.string('EcalTBTDCRecInfo'),
0222 #    xtalInBeam = cms.untracked.int32(248),
0223 #    hodoRecInfoProducer = cms.string('ecalTBSimHodoscopeReconstructor'),
0224 #    hodoRecInfoCollection = cms.string('EcalTBHodoscopeRecInfo'),
0225 #    RecHitProducer = cms.string('ecalTBSimRecHit'),
0226 #    tdcRecInfoProducer = cms.string('ecalTBSimTDCReconstructor')
0227 #)
0228 
0229 # turning on/off Gflash
0230 if mySample == "gf":
0231     process.ecal_notCont_sim.EBs25notContainment = 1.0
0232     process.ecal_notCont_sim.EEs25notContainment = 1.0
0233     process.g4SimHits.Physics.type = 'SimG4Core/Physics/GFlash'
0234     process.g4SimHits.Physics.GFlash = cms.PSet(
0235         bField = cms.double(0.0),
0236         GflashEMShowerModel = cms.bool(True),
0237         GflashHadronShowerModel = cms.bool(True),
0238         GflashHistogram = cms.bool(True),
0239         GflashHistogramName = cms.string("gflash_histogram_"+myNameTag+".root"),
0240         GflashHadronPhysics = cms.string('QGSP_BERT'),
0241         GflashHcalOuter = cms.bool(True),
0242         GflashExportToFastSim = cms.bool(False),
0243         watcherOn = cms.bool(False),
0244         Verbosity = cms.untracked.int32(0),
0245         tuning_pList = myParList
0246     )
0247 
0248 print("physics type : ", process.g4SimHits.Physics.type)
0249 
0250 # sequences
0251 process.doSimHits = cms.Sequence(process.ProductionFilterSequence*process.VtxSmeared*process.g4SimHits)
0252 process.doSimTB = cms.Sequence(process.SimEcalTBG4Object*process.SimEcalTBHodoscope*process.SimEcalEventHeader)
0253 process.doEcalDigis = cms.Sequence(process.mix)
0254 #process.p1 = cms.Path(process.doSimHits*process.doSimTB*process.doEcalDigis*process.localReco_tbsim*process.treeProducerCalibSimul)
0255 process.p1 = cms.Path(process.doSimHits*process.doSimTB*process.doEcalDigis*process.localReco_tbsim)
0256 
0257 
0258 
0259 # modify the default behavior of the MessageLogger
0260     
0261 #process.MessageLogger.debugModule = cms.untracked.vstring('g4SimHits','generatorSmeared')
0262 
0263 #Configuring the G4msg.log output
0264 process.MessageLogger.files = dict(G4msg =  cms.untracked.PSet(
0265     noTimeStamps = cms.untracked.bool(True)
0266     #First eliminate unneeded output
0267     ,threshold = cms.untracked.string('INFO')
0268     #,DEBUG = cms.untracked.PSet(limit = cms.untracked.int32(0))
0269     ,INFO = cms.untracked.PSet(limit = cms.untracked.int32(0))
0270     ,FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
0271     ,FwkSummary = cms.untracked.PSet(limit = cms.untracked.int32(0))
0272     ,Root_NoDictionary = cms.untracked.PSet(limit = cms.untracked.int32(0))
0273     ,FwkJob = cms.untracked.PSet(limit = cms.untracked.int32(0))
0274     ,TimeReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
0275     ,TimeModule = cms.untracked.PSet(limit = cms.untracked.int32(0))
0276     ,TimeEvent = cms.untracked.PSet(limit = cms.untracked.int32(0))
0277     ,MemoryCheck = cms.untracked.PSet(limit = cms.untracked.int32(0))
0278     #TimeModule, TimeEvent, TimeReport are written to LogAsbolute instead of LogInfo with a category
0279     #so they cannot be eliminated from any destination (!) unless one uses the summaryOnly option
0280     #in the Timing Service... at the price of silencing the output needed for the TimingReport profiling
0281     #
0282     #Then add the wanted ones:
0283     ,PhysicsList = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0284     ,G4cout = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0285     ,G4cerr = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0286     ,BeamProfileVtxGenerator = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0287     )
0288 )
0289 
0290 #Add these 3 lines to put back the summary for timing information at the end of the logfile
0291 #(needed for TimeReport report)
0292 process.options = cms.untracked.PSet(
0293     wantSummary = cms.untracked.bool(True)
0294 )
0295 
0296 
0297 #if not hasattr(process,"options") :
0298 process.options = cms.untracked.PSet()
0299 process.options.SkipEvent = cms.untracked.vstring('EventCorruption')
0300 
0301