#
# Options specific for a given job
# ie. setting of random number seed and name of output files
#

event_type = "12113100" #SigMC
#event_type = "12143401" #RefMC
#event_type = "12113446" #PHSP

from Gauss.Configuration import *
importOptions("$APPCONFIGOPTS/Gauss/Beam6500GeV-md100-2017-nu1.6.py")
importOptions("$DECFILESROOT/options/"+event_type+".py")
importOptions("$LBPYTHIA8ROOT/options/Pythia8.py")


#--Generator phase, set random numbers
GaussGen = GenInit("GaussGen")
GaussGen.FirstEventNumber = 1
GaussGen.RunNumber        = 1234

#--Number of events
LHCbApp().EvtMax = 100000
LHCbApp().DDDBtag = 'dddb-20170721-3'
LHCbApp().CondDBtag = 'sim-20170721-2-vc-md100'
LHCbApp().OutputLevel = WARNING
MessageSvc().OutputLevel = WARNING

#Gauss().OutputType = 'NONE'
#Gauss().Histograms = 'NONE'
#--Set name of output files for given job (uncomment the lines)
#  Note that if you do not set it Gauss will make a name based on event type,
#  number of events and the date
#idFile = 'GaussTest'
#HistogramPersistencySvc().OutputFile = idFile+'-histos.root'
#
#OutputStream("GaussTape").Output = "DATAFILE='PFN:%s.sim' TYP='POOL_ROOTTREE' OPT='RECREATE'"%idFile

#GenMonitor = GaudiSequencer( "GenMonitor" )
#SimMonitor = GaudiSequencer( "SimMonitor" )
#GenMonitor.Members += [ "GaussMonitor::CheckLifeTimeHepMC/HepMCLifeTime" ]
#SimMonitor.Members += [ "GaussMonitor::CheckLifeTimeMC/MCLifeTime" ]

gtos = GenerationToSimulation()
gtos.SkipGeant = True
gs = GaudiSequencer("GenMonitor")
MCTruthStream = OutputStream("MCTruthStream")
MCTruthStream.ItemList += [ "/Event/Gen#1", "/Event/Gen/HepMCEvents#1", "/Event/MC#1", "/Event/MC/Header#1", "/Event/MC/Particles#1", "/Event/MC/Vertices#1" ]
MCTruthStream.Output = "DATAFILE='MCTruth.sim' TYP='POOL_ROOTTREE' OPT='RECREATE'"
gs.Members += [ SimInit(), gtos, MCTruthStream ]

Gauss().Phases = ["Generator"]
#Gauss().Phases = ["Generator","GenToMCTree"]
Gauss().OutputType = 'NONE'
Gauss().Histograms = 'NONE'
