import FWCore.ParameterSet.Config as cms

# configuration to model pileup for initial physics phase
from SimGeneral.MixingModule.mixObjects_cfi import theMixObjects
from SimGeneral.MixingModule.mixPoolSource_cfi import *
from SimGeneral.MixingModule.digitizers_cfi import *

mix = cms.EDProducer("MixingModule",
    digitizers = cms.PSet(theDigitizers),
    LabelPlayback = cms.string(''),
    maxBunch = cms.int32(3),
    minBunch = cms.int32(-12), ## in terms of 25 nsec

    bunchspace = cms.int32(25), ##ns
    mixProdStep1 = cms.bool(False),
    mixProdStep2 = cms.bool(False),

    playback = cms.untracked.bool(False),
    useCurrentProcessOnly = cms.bool(False),

    input = cms.SecSource("EmbeddedRootSource",
        type = cms.string('probFunction'),
        nbPileupEvents = cms.PSet(
          probFunctionVariable = cms.vint32(0, 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),
	  probValue = cms.vdouble(
      0,
      9.62366e-05,
      0.000114197,
      0.000134913,
      0.000231518,
      0.00060477,
      0.000293912,
      0.000498086,
      0.000428207,
      0.000397567,
      0.000673966,
      0.000921706,
      0.000939553,
      0.00123681,
      0.00134677,
      0.0013111,
      0.00129396,
      0.00123714,
      0.00134814,
      0.00160606,
      0.00192138,
      0.00233791,
      0.00267774,
      0.00280918,
      0.0031197,
      0.0043562,
      0.00751272,
      0.0136892,
      0.0231778,
      0.0345168,
      0.0449839,
      0.0523745,
      0.0562289,
      0.0574614,
      0.0572404,
      0.0563041,
      0.0549491,
      0.0532784,
      0.0513576,
      0.0492327,
      0.0469169,
      0.0443847,
      0.0415475,
      0.0382496,
      0.0343446,
      0.0298547,
      0.0250429,
      0.0203144,
      0.0160256,
      0.0123618,
      0.00935279,
      0.00695715,
      0.00511836,
      0.00377423,
      0.00284529,
      0.0022352,
      0.00184568,
      0.00159325,
      0.0014179,
      0.00128249,
      0.00116709,
      0.00106237,
      0.000964582,
      0.000872513,
      0.000785909,
      0.00070481,
      0.000629288,
      0.000559369,
      0.000495015,
      0.000436122,
      0.000382531,
      0.000334038,
      0.000290399,
      0.000251341,
      0.000216572,
      0.000185785,
      0.000158667,
      0.000134907,
      0.000114197,
      9.62366e-05,
      8.07416e-05,
      6.74411e-05,
      5.60817e-05,
      4.64288e-05,
      3.8267e-05,
      3.14001e-05,
      2.56511e-05,
      2.08618e-05,
      1.68915e-05,
      1.36161e-05,
      1.09272e-05,
      8.73039e-06,
      6.9443e-06,
      5.49912e-06,
      4.33538e-06,
      3.40276e-06,
      2.65892e-06,
      2.06847e-06,
      1.602e-06,
      1.23523e-06),
          histoFileName = cms.untracked.string('histProbFunction.root'),
        ),
	sequential = cms.untracked.bool(False),
        manage_OOT = cms.untracked.bool(True),  ## manage out-of-time pileup
        ## setting this to True means that the out-of-time pileup
        ## will have a different distribution than in-time, given
        ## by what is described on the next line:
        OOT_type = cms.untracked.string('Poisson'),  ## generate OOT with a Poisson matching the number chosen for in-time
        #OOT_type = cms.untracked.string('fixed'),  ## generate OOT with a fixed distribution
        #intFixed_OOT = cms.untracked.int32(2),
        fileNames = FileNames
    ),
    mixObjects = cms.PSet(theMixObjects)
)



