Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
import FWCore.ParameterSet.Config as cms

process = cms.Process("ECALTBH4-GEN-SIM-DIGI")

process.load("FWCore.MessageLogger.MessageLogger_cfi")

process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")

process.RandomNumberGeneratorService = cms.Service("RandomNumberGeneratorService",
    saveFileName = cms.untracked.string(''),
    generator = cms.PSet(
        initialSeed = cms.untracked.uint32(123456789),      
        engineName = cms.untracked.string('HepJamesRandom') 
    ),                                                      
    VtxSmeared = cms.PSet(
        initialSeed = cms.untracked.uint32(98765432),
        engineName = cms.untracked.string('HepJamesRandom')
    ),
    g4SimHits = cms.PSet(
        initialSeed = cms.untracked.uint32(11),
        engineName = cms.untracked.string('HepJamesRandom')
    ),
    SimEcalTBG4Object = cms.PSet(
        initialSeed = cms.untracked.uint32(12),
        engineName = cms.untracked.string('HepJamesRandom')
    ),
    mix = cms.PSet(
        initialSeed = cms.untracked.uint32(12345),
        engineName = cms.untracked.string('HepJamesRandom')
    ),
)

process.randomEngineStateProducer = cms.EDProducer("RandomEngineStateProducer")


process.maxEvents = cms.untracked.PSet(
    input = cms.untracked.int32(10)
)

#Geometry

process.load("SimG4CMS.EcalTestBeam.crystal248_cff")
process.load("Geometry.EcalTestBeam.TBH4GeometryXML_cfi")

process.load("Geometry.CaloEventSetup.CaloGeometry_cff")
process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi")
process.CaloGeometryBuilder.SelectedCalos = ['EcalBarrel']

# No magnetic field

process.load("MagneticField.Engine.uniformMagneticField_cfi")

process.source = cms.Source("EmptySource")

process.generator = cms.EDProducer("FlatRandomEGunProducer",
    PGunParameters = cms.PSet(
        process.common_beam_direction_parameters,
        PartID = cms.vint32(11),
        MinE = cms.double(119.99),
        MaxE = cms.double(120.01)
    ),
    Verbosity = cms.untracked.int32(0), ## set to 1 (or greater)  for printouts

    psethack = cms.string('single electron'),
    AddAntiParticle = cms.bool(False),
)

process.ProductionFilterSequence = cms.Sequence(process.generator)

from IOMC.EventVertexGenerators.VtxSmearedParameters_cfi import *

#
# this module takes input in the units of *cm* and *radian*!!!
#

process.VtxSmeared = cms.EDProducer("BeamProfileVtxGenerator",
    process.common_beam_direction_parameters,
    VtxSmearedCommon,
    BeamSigmaX = cms.double(2.4),
    BeamSigmaY = cms.double(2.4),
    GaussianProfile = cms.bool(False),
    BinX = cms.int32(50),
    BinY = cms.int32(50),
    File       = cms.string('beam.profile'),
    UseFile    = cms.bool(False),
    TimeOffset = cms.double(0.)                      
)

# Geant4, ECAL test beam specific OscarProducer configuration

process.load("SimG4Core.Application.g4SimHits_cfi")

process.g4SimHits.UseMagneticField = cms.bool(False)
process.g4SimHits.Physics.DefaultCutValue = 1.
process.g4SimHits.NonBeamEvent = cms.bool(True)
process.g4SimHits.Generator.HepMCProductLabel = cms.string('generatorSmeared')
process.g4SimHits.Generator.ApplyPCuts = cms.bool(False)
process.g4SimHits.Generator.ApplyEtaCuts = cms.bool(True)
process.g4SimHits.Generator.ApplyPhiCuts = cms.bool(False)
process.g4SimHits.Generator.MaxEtaCut = cms.double(1.5)
process.g4SimHits.Generator.MinEtaCut = cms.double(0.0)
process.g4SimHits.CaloSD.CorrectTOFBeam = cms.bool(True)
process.g4SimHits.CaloSD.BeamPosition = cms.double(-26733.5)
process.g4SimHits.CaloTrkProcessing.TestBeam = cms.bool(True)
process.g4SimHits.StackingAction.MaxTrackTime = cms.double(10000.)
process.g4SimHits.SteppingAction.MaxTrackTime = cms.double(10000.)
process.g4SimHits.CaloSD.TmaxHit = cms.double(10000.)
process.g4SimHits.CaloSD.TmaxHits = cms.vdouble(10000.,10000.,10000.,10000.,10000.)
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
    type = cms.string('EcalTBH4Trigger'),
    verbose = cms.untracked.bool(False),
    #IMPORTANT    #    #    #    #    #    #    #    # NUMBER OF EVENTS TO BE TRIGGERED 
    trigEvents = cms.untracked.int32(5)
))


# Test Beam ECAL specific MC info

process.SimEcalTBG4Object = cms.EDProducer("EcalTBMCInfoProducer",
    process.common_beam_direction_parameters,
    CrystalMapFile = cms.FileInPath('Geometry/EcalTestBeam/data/BarrelSM1CrystalCenterElectron120GeV.dat'),
    moduleLabelVtx = cms.untracked.string('generatorSmeared')
)
# Test Beam ECAL hodoscope raw data simulation

process.SimEcalTBHodoscope = cms.EDProducer("TBHodoActiveVolumeRawInfoProducer")

# Test Beam ECAL Event header filling

process.SimEcalEventHeader = cms.EDProducer("FakeTBEventHeaderProducer",
    EcalTBInfoLabel = cms.untracked.string('SimEcalTBG4Object')
)

# Digitization

# no pileup

process.load("SimGeneral.MixingModule.mixNoPU_cfi")

# fake TB conditions

process.load("CalibCalorimetry.EcalTrivialCondModules.EcalTrivialCondRetrieverTB_cfi")

# Test beam unsuppressed digis

process.load("SimCalorimetry.EcalTestBeam.ecaldigi_testbeam_cfi")

# Output

process.output = cms.OutputModule("PoolOutputModule",
    outputCommands = cms.untracked.vstring('keep *', 
        'drop PSimHits_g4SimHits_*_Sim', 
        'keep PCaloHits_g4SimHits_EcalHitsEB_Sim', 
        'keep PCaloHits_g4SimHits_CaloHitsTk_Sim', 
        'keep PCaloHits_g4SimHits_EcalTBH4BeamHits_Sim'),
    fileName = cms.untracked.string('ECALH4TB_detsim_digi.root')
)

# sequences

process.doSimHits = cms.Sequence(process.ProductionFilterSequence*process.VtxSmeared*process.g4SimHits)
process.doSimTB = cms.Sequence(process.SimEcalTBG4Object*process.SimEcalTBHodoscope*process.SimEcalEventHeader)
process.doEcalDigis = cms.Sequence(process.mix)
process.p1 = cms.Path(process.doSimHits*process.doSimTB*process.doEcalDigis)
process.outpath = cms.EndPath(process.output)


# modify the default behavior of the MessageLogger
    
process.MessageLogger.debugModules = cms.untracked.vstring('g4SimHits','generatorSmeared')

#Configuring the G4msg.log output
process.MessageLogger.files = dict( G4msg =  cms.untracked.PSet(
    noTimeStamps = cms.untracked.bool(True)
    #First eliminate unneeded output
    ,threshold = cms.untracked.string('INFO')
    #,DEBUG = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,INFO = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,FwkReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,FwkSummary = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,Root_NoDictionary = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,FwkJob = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,TimeReport = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,TimeModule = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,TimeEvent = cms.untracked.PSet(limit = cms.untracked.int32(0))
    ,MemoryCheck = cms.untracked.PSet(limit = cms.untracked.int32(0))
    #TimeModule, TimeEvent, TimeReport are written to LogAsbolute instead of LogInfo with a category
    #so they cannot be eliminated from any destination (!) unless one uses the summaryOnly option
    #in the Timing Service... at the price of silencing the output needed for the TimingReport profiling
    #
    #Then add the wanted ones:
    ,PhysicsList = cms.untracked.PSet(limit = cms.untracked.int32(-1))
    ,G4cout = cms.untracked.PSet(limit = cms.untracked.int32(-1))
    ,G4cerr = cms.untracked.PSet(limit = cms.untracked.int32(-1))
    ,BeamProfileVtxGenerator = cms.untracked.PSet(limit = cms.untracked.int32(-1))
    )
)
#Add these 3 lines to put back the summary for timing information at the end of the logfile
#(needed for TimeReport report)
process.options = cms.untracked.PSet(
    wantSummary = cms.untracked.bool(True)
)

#process.g4SimHits.G4Commands = cms.vstring('/tracking/verbose 1')