"""
##############################################################################
#                                                                            #
#  Hit integration over ROI per sector                                       #
#                                                                            #
#  @package Tell1/Vetra                                                      #
#  @author Christan Elsasser                                                 #
#  @date   09/06/2012                                                        #
#                                                                            #
##############################################################################
"""

from GaudiKernel.ProcessJobOptions import importOptions

from Configurables import GaudiSequencer
from TrackSys.Configuration import *
from Configurables import ( TrackSys, RecSysConf )
from Configurables import TrackContainerCopy
from Configurables import Velo__VeloTrackMonitor
from Configurables import EventClockSvc
from Configurables import Vetra
from Configurables import VetraRecoConf
from Configurables import ST__STDumpADCs
 


generalOutputLevel = 2

Vetra().MainSequence = [ GaudiSequencer('HitIntegrator')]
#GaudiSequencer('VetraSequencer').IgnoreFilterPassed = True

## TrackSys().ExcludedLayers = ["TTbX"]
## TrackSys().TrackPatRecAlgorithms = TrackSys().DefaultPatRecAlgorithms
## VetraRecoConf().Sequence = RecSysConf().DefaultTrackingSubdets # = ["Decoding", "VELO","TT","IT","OT","Tr","Vertex"]

## from Configurables import CondDB, CondDBAccessSvc, CondDBTimeSwitchSvc
## connection="sqlite_file:$STSQLDDDBROOT/db/STCOND.db/COND"
## CondDB().addLayer( CondDBAccessSvc("COND", ConnectionString = connection) )



## importOptions('$HOME/cmtuser/Vetra_v12r2/ST/STVetraAnalysis/options/TTEmulator.py')
#importOptions('$HOME/cmtuser/Vetra_v12r2/ST/STVetraAnalysis/options/ITEmulator.py')


from Configurables import STHitIntegrator

HitIntegrator = STHitIntegrator()
HitIntegrator.DetType = "TT"
HitIntegrator.Layer   = "TTaU"
HitIntegrator.MaxX = 800.0
HitIntegrator.MaxY = 800.0
HitIntegrator.OutputLevel = 3


#GaudiSequencer('HitIntegrator').Members = [ GaudiSequencer('EmuTTSeq'), GaudiSequencer('EmuTTSeqPrev'), GaudiSequencer('EmuTTSeqNext'),HitIntegrator ]
#GaudiSequencer('HitIntegrator').IgnoreFilterPassed = True#ReturnOK = True


GaudiSequencer('HitIntegrator').Members = [HitIntegrator ]
GaudiSequencer('HitIntegrator').IgnoreFilterPassed = True#ReturnOK = True



#path = "/afs/cern.ch/work/e/elsasser/Aging/TT/TTbX"
path = "."
histoname = "Histo.root"
tuplename = "Tuple.root"

Vetra().EvtMax = 0
#Vetra().PrintFreq = 100
Vetra().OutputLevel = INFO
Vetra().HistogramFile = histoname
Vetra().TupleFile = tuplename
vetra = Vetra()

def doMyChanges():
    from Configurables import VetraInit, FilterByBankType
    bankFilter = FilterByBankType()
    bankFilter.BankNames = [ "TTFull", "ITFull" ]
    from Configurables import LoKi__ODINFilter
    odinFilter = LoKi__ODINFilter('BBODINFilter', Code = " LHCb.ODIN.BeamCrossing == ODIN_BXTYP ")
    GaudiSequencer( 'Init' ).Members = [   VetraInit(), odinFilter, bankFilter   ]
appendPostConfigAction(doMyChanges)



