def configure(version):
    from Gaudi.Configuration import (importOptions, ApplicationMgr, MessageSvc)
    from Configurables import DDDBConf, CondDB, CondDBAccessSvc
    dddbConf = DDDBConf()
    cdb = CondDB()

    DBs = []
    for i in range(3):
        data = {"name": "TESTDB%d" % i}
        DBs.append(
            CondDBAccessSvc(
                data["name"],
                ConnectionString="sqlite_file:../data/%(name)s.db/%(name)s" %
                data))

    cdb.PartitionConnectionString["DDDB"] = DBs[0].ConnectionString
    cdb.Tags["DDDB"] = ""
    if version == 1:
        cdb.addAlternative(DBs[1], '/AutoMap/FolderSet2')
    elif version == 2:
        cdb.addAlternative(DBs[2], '/AutoMap/FolderSet3')
    elif version == 3:
        cdb.addAlternative(DBs[1], '/AutoMap/FolderSet2/ObjectA')
    elif version == 4:
        cdb.addLayer(DBs[1])
        cdb.addLayer(DBs[2])
    elif version != 0:
        raise RuntimeError("Invalid version number")

    ApplicationMgr(TopAlg=["LoadDDDB"], EvtSel="NONE")
def configure(use_case="simple"):
    # Common configuration
    import Gaudi.Configuration
    from Configurables import (ApplicationMgr, MessageSvc, DDDBConf, CondDB,
                               CondDBAccessSvc, UpdateManagerSvc)
    DDDBConf()  # detector description
    localDb = CondDBAccessSvc(
        "VeloAlignCondTestDB",
        ConnectionString="sqlite_file:../data/VeloAlignCondTest.db/DDDB",
        DefaultTAG="simple")
    CondDB().addLayer(localDb)  # use local DB

    ApplicationMgr(TopAlg=[], EvtSel="NONE")
    #MessageSvc(OutputLevel = 1)

    if use_case == "simple":
        # nothing to do more
        return
    elif use_case == "override_motion_system":
        # Example of how to move the Velo
        UpdateManagerSvc().ConditionsOverride.append(
            "Conditions/Online/Velo/MotionSystem := double ResolPosY = 100")
    elif use_case == "override_alignment":
        UpdateManagerSvc().ConditionsOverride.append(
            "Conditions/Alignment/Velo/VeloLeft := double_v dPosXYZ = 0 100 0")
    elif use_case == "override_alignment2":
        UpdateManagerSvc().ConditionsOverride.append(
            "Conditions/Alignment/Velo/VeloLeft := double_v YOffsetCoeffs = 20 -5"
        )
        UpdateManagerSvc().ConditionsOverride.append(
            "Conditions/Alignment/Velo/VeloRight := double_v YOffsetCoeffs = 0 1"
        )
def initialise():
    
  # Initialise a few things
  from Configurables import DDDBConf, CondDB, LHCbApp, CondDBAccessSvc
  cDB = CondDB()
  
  #DDDBConf(DataType = "2009")
  #LHCbApp().DDDBtag   = "head-20110303"
  #LHCbApp().CondDBtag = "head-20110524"
  
  #DDDBConf(DataType = "2010")
  #LHCbApp().DDDBtag   = "head-20110721"
  #LHCbApp().CondDBtag = "cond-20140328"

  #DDDBConf(DataType = "2011")
  #LHCbApp().DDDBtag   = "head-20110722" 
  #LHCbApp().CondDBtag = "head-20110722"

  #DDDBConf(DataType = "2012")
  #LHCbApp().DDDBtag   = "dddb-20120831"
  #LHCbApp().CondDBtag = "cond-20121025"

  DDDBConf(DataType = "2015")
  LHCbApp().DDDBtag   = "dddb-20150526"
  LHCbApp().CondDBtag = "cond-20150625"

  # Set message level to info and above only
  msgSvc().setOutputLevel(3)
  
  # Finally, initialize GaudiPython
  GaudiPython.AppMgr().initialize()
示例#4
0
def initialise():

    if not globals()['initialised']:

        import os

        # Check results dir
        if not os.path.exists("results"): os.mkdir("results")

        from ROOT import gROOT
        # No info messages
        gROOT.ProcessLine("gErrorIgnoreLevel = kWarning;")
        # Batch mode (no TCanvas)
        gROOT.SetBatch(True)

        import GaudiPython

        # Initialise a few things
        from Configurables import DDDBConf, CondDB, LHCbApp, CondDBAccessSvc
        cDB = CondDB()

        #DDDBConf(DataType = "2009")
        #LHCbApp().DDDBtag   = "head-20110303"
        #LHCbApp().CondDBtag = "head-20110524"

        #DDDBConf(DataType = "2010")
        #LHCbApp().DDDBtag   = "head-20110303"
        #LHCbApp().CondDBtag = "head-20110524"

        #DDDBConf(DataType = "2011")
        #LHCbApp().DDDBtag   = "head-20110722"
        #LHCbApp().CondDBtag = "head-20110722"
        #LHCbApp().CondDBtag = "HEAD"

        DDDBConf(DataType="2012")
        LHCbApp().DDDBtag = "head-20120413"
        LHCbApp().CondDBtag = "cond-20120730"
        CondDB().addLayer(
            CondDBAccessSvc(
                "2012Aerogel",
                ConnectionString="sqlite_file:2012Aerogel.db/LHCBCOND",
                DefaultTAG="HEAD"))

        # Set message level to info and above only
        msgSvc().setOutputLevel(3)

        # Finally, initialize GaudiPython
        GaudiPython.AppMgr().initialize()

        # Initialise various DeRich objects
        loadRichDet()

        # flag as done
        globals()['initialised'] = True
示例#5
0
def configure():
    from Gaudi.Configuration import (ApplicationMgr, MessageSvc, ERROR)
    from Configurables import DDDBConf, CondDB, CondDBAccessSvc, EventClockSvc, FakeEventTime
    dddbConf = DDDBConf()
    cdb = CondDB()

    cdb.PartitionConnectionString[
        "DQFLAGS"] = "sqlite_file:../data/DQFLAGS.db/DQFLAGS"
    cdb.Tags["DQFLAGS"] = ""

    ecs = EventClockSvc(InitialTime=toTimeStamp(datetime(2012, 1, 1, 12)))
    ecs.addTool(FakeEventTime, "EventTimeDecoder")
    ecs.EventTimeDecoder.StartTime = ecs.InitialTime
    ecs.EventTimeDecoder.TimeStep = toTimeStamp(timedelta(days=1))

    ApplicationMgr(TopAlg=["LoadDDDB"], EvtSel="NONE")
    MessageSvc(OutputLevel=ERROR)
示例#6
0
 def defineDB(self):
     # Delegate handling of properties to DDDBConf
     self.setOtherProps(DDDBConf(), ["Simulation", "DataType"])
     # Set CondDB tags if given, otherwise use default defined in DDDBConf
     from Configurables import CondDB
     if hasattr(self, "DDDBtag"):
         CondDB().Tags["DDDB"] = self.getProp("DDDBtag")
     if hasattr(self, "CondDBtag"):
         CondDB().Tags["LHCBCOND"] = self.getProp("CondDBtag")
         CondDB().Tags["SIMCOND"] = self.getProp("CondDBtag")
     if hasattr(self, "DQFLAGStag"):
         CondDB().Tags["DQFLAGS"] = self.getProp("DQFLAGStag")
     # Set up a time decoder for real data (Simulation uses FakeEventTime)
     if not self.getProp("Simulation"):
         from Configurables import EventClockSvc
         ecs = EventClockSvc()
         # do not overwrite already set values
         if not ecs.isPropertySet("EventTimeDecoder"):
             ecs.EventTimeDecoder = "OdinTimeDecoder"
示例#7
0
if not interactiveMode:
    print 'Save histograms in \'{0}\''.format(ofname)
else:
    print 'You are running in interactive mode. Histograms will not be stored automatically!'

LHCbApp().DataType = "Upgrade"
LHCbApp().Simulation = True
CondDB().Upgrade = True

if dddbroot is not None:
    dddbroot = dddbroot.strip()
    assert os.path.isfile(dddbroot), 'No such file \'{0}\''.format(dddbroot)

    if dddbroot.endswith('.xml'):
        from Configurables import DDDBConf
        DDDBConf().DbRoot = dddbroot
    else:
        assert dddbroot.endswith('.db'), 'Unsupported format of DDDB'
        CondDB().addLayer(dbFile=dddbroot, dbName="DDDB")
else:
    print 'Using default DDDB'

from Configurables import MessageSvc

MessageSvc().Format = '% F%40W%S%7W%R%T %0W%M'

appMgr = AppMgr(outputlevel=4)
appMgr.ExtSvc += ['TransportSvc']
det = appMgr.detSvc()

transSvc = appMgr.service('TransportSvc', 'ITransportSvc')
示例#8
0
conddb = CondDB()
privatedbPathdb = inpath + "myDDDB"
privatedbPathsc = inpath + "mySIMCOND"
LHCbApp().Simulation = True
LHCbApp().DataType = 'Upgrade'
conddb.Upgrade = True

detectors = ['VP', 'UT', 'FT', 'Ecal', 'Hcal', 'Muon', 'Magnet', 'Tr']
LHCbApp().Detectors = detectors
LHCbApp().DDDBtag = tags['DDDB']
LHCbApp().CondDBtag = tags['CondDB']

if useXML:
    privatedb_pathdb = "/afs/cern.ch/user/c/chombach/VELOUpgrade/DDDB/myDDDBXml/"
    #privatedb_pathdb = "/afs/cern.ch/user/c/chombach/public/forWouter/VeloPixAlign/xml/Conditions/VP/Alignment/Global.xml "
    DDDBConf(DbRoot=privatedb_pathdb + "lhcb.xml")

db = inpath + "DDDB-new.db"
sc = inpath + "SIMCOND-new.db"
conddb.addLayer(dbFile=db, dbName="DDDB")
conddb.addLayer(dbFile=sc, dbName="SIMCOND")
#db = '/afs/cern.ch/user/c/chombach/VELOUpgrade/GiulioScripts/MisGM2.db'
#from Configurables import ( CondDB, CondDBAccessSvc )
#alignCond = CondDBAccessSvc( 'AlignDDDB'  )
#alignCond.ConnectionString = 'sqlite_file:' + db + '/DDDB'
#CondDB().addLayer( alignCond )

Escher().InputType = "DIGI"
Escher().Kalman = True
Escher().Millepede = False
#Escher().TrackContainer = "Rec/Track/Velo" # Velo, VeloR, Long, Upstream, Downstream, Ttrack, Muon or Calo
示例#9
0
####

#NTupleSvc().Output = ["FILE1 DATAFILE='/afs/cern.ch/work/d/delbuono/RootOutput/TestFT.root' TYP='ROOT' OPT='NEW'"]
NTupleSvc().Output = [
    "FILE1 DATAFILE='/afs/cern.ch/user/d/delbuono/cmtuser/Boole_v29r9/Det/FTDet/tests/TestFT.root' TYP='ROOT' OPT='NEW'"
]

#DDDBConf().DbRoot = "/afs/cern.ch/user/f/fpolci/cmtuser/Brunel_v44r5_BeforeHolidays/static_DDDB_VP+UT+FT_v20/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/s/seaso/public/Simulation/upgrade/Gauss-FT/Det/myDDDB-Upgrade-FTMod-July-2014/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/d/delbuono/cmtuser/DDDB_20140606_FT40_ST5/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/d/delbuono/cmtuser/DDDB_20140606_FT42_ST5/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/d/delbuono/cmtuser/test_DDDBupgrade_FTv4/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/d/delbuono/cmtuser/DDDB-20141016_SIM-20140204-vc-md100_42st5/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/d/delbuono/cmtuser/DDDBupgrade_FTv5/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/d/delbuono/cmtuser/DDDB_FTv2_20150424_s20140204_lhcbv38r6/lhcb.xml"
DDDBConf(
).DbRoot = "/afs/cern.ch/user/d/delbuono/cmtuser/DDDB_FTv5_20150424_s20140204_lhcbv38r6/lhcb.xml"

#Polci
#EventSelector().Input = ["DATAFILE='/afs/cern.ch/user/o/ogruenbe/public/FT_upgrade/gauss/output/MiniBias_v20_nu25.sim' TYP='POOL_ROOTTREE'"]
##EventSelector().Input = ["DATAFILE='/afs/cern.ch/work/d/dmilanes/digi/FT_upgrade/gauss/output5/MiniBias_v20_nu76.sim' TYP='POOL_ROOTTREE'"]

#datasetName = 'Bs_phiphi_nu38-5degres-24102013'
#EventSelector().Input = ["DATAFILE='/afs/cern.ch/work/d/delbuono/digi/" + datasetName + ".sim'"]
#datasetName = 'bev-Upgrade-FTMod-July2014-v2'
#EventSelector().Input = ["DATAFILE='/afs/cern.ch/work/d/delbuono/digi/Gauss_v46r7p2/" + datasetName + ".sim'"]
#datasetName = 'bev-Upgrade-FTMod-July2014-v4'
#EventSelector().Input = ["DATAFILE='/afs/cern.ch/user/d/delbuono/cmtuser/Gauss_v48r0/" + datasetName + ".sim'"]
#datasetName = 'bev_5000ev-May2015-v5'
#EventSelector().Input = ["DATAFILE='/afs/cern.ch/user/d/delbuono/cmtuser/Gauss_v48r1p1/" + datasetName + ".sim'"]

#DBL v2 v5
示例#10
0
from Configurables import LHCbApp, CondDB, UpdateManagerSvc,DDDBConf
from Gaudi.Configuration import * 

#### $GAUSSOPTS/Gauss-2012.py \
from Gaudi.Configuration import *
importOptions("$APPCONFIGOPTS/Gauss/Sim08-Beam4000GeV-md100-2012-nu2.5.py")
importOptions("$APPCONFIGOPTS/Gauss/DataType-2012.py")
importOptions("$APPCONFIGOPTS/Gauss/RICHRandomHits.py")
importOptions("$APPCONFIGOPTS/Gauss/NoPacking.py")


DDDBConf().DbRoot = "/afs/cern.ch/user/z/zhangy/workdir/EcalUpgrade/GaussDev_v52r2/myDDDB-tutorial/lhcb.xml" 
CondDB().Tags['DDDB'] = 'HEAD'

#--Set database tags 
from Configurables import LHCbApp
LHCbApp().DDDBtag   = "dddb-20171030-3"
LHCbApp().CondDBtag = "sim-20170721-2-vc-md100"

#### $APPCONFIGOPTS/Gauss/Sim08-Beam4000GeV-mu100-2012-nu2.5.py
importOptions("$APPCONFIGOPTS/Gauss/Sim08-Beam4000GeV-mu100-2012-nu2.5.py")

#### $APPCONFIGOPTS/Gauss/DataType-2012.py
from Configurables import Gauss
Gauss().DataType  = "2012"

####Gauss-Job.py
from Gauss.Configuration import *

#--Generator phase, set random numbers
GaussGen = GenInit("GaussGen")
示例#11
0
#  Helper file to illustrate the usage of Check-Overlap algorithm
#  @see DetDesc::CheckOverlap
#  @author Vanya BELYAEV [email protected]
# =============================================================================
"""
Helper file to illustrate the usage of Check-Overlap algorithm
"""
# =============================================================================
__author__ = 'Vanya BELYAEV [email protected]'
__version__ = '1.1'
# =============================================================================

from Gaudi.Configuration import *

from Configurables import DDDBConf
DDDBConf(DataType='2015')

from Configurables import DetDesc__CheckOverlap

check = DetDesc__CheckOverlap(
    'Overlap',
    #
    #Shots = 1000 ,
    Shots=50,
    #
    Volume="/dd/Geometry/LHCb/lvLHCb"
    #Volume = "/dd/Geometry/MagnetRegion/Magnet/Magnet"
)

from Configurables import TransportSvc
示例#12
0
# Configuration file for MC_LHCb_GENERIC RIVET analysis run on LHCb minbias events
from GaudiKernel import SystemOfUnits as units
from Gaudi.Configuration import *
from LHCbKernel.Configuration import *
from Gauss.Configuration import *
from Configurables import Generation, Gauss
from Configurables import RivetAnalysisHandler
# settings database tags independently
from Configurables import DDDBConf, CondDB, LHCbApp
#Need os. to add local directory path to RivetAnalysisHandler options
import os
#importOptions("$GAUSSOPTS/Gauss-DEV.py")

LHCbApp().DDDBtag   = "dddb-20130111"
DDDBConf(DataType = "2012")
CondDB().UseLatestTags = ["2012"]

# End of databases setup
# special beam conditions used for pp collisions at 7 TeV
importOptions("$APPCONFIGOPTS/Gauss/Beam3500GeV-uniformHeadOn-fix1.py")
#importOptions("$DECFILESROOT/options/30000000.py")
importOptions("$LBPYTHIA8ROOT/options/Pythia8.py")
importOptions("$GAUSSOPTS/GenStandAlone.py")
#importOptions("$DECFILESROOT/options/SwitchOffEvtGen.py")
importOptions("$GAUSSOPTS/Gauss-Job.py")

#GaussGen = GenInit("GaussGen")
#GaussGen.RunNumber = 1082
LHCbApp().EvtMax = 1000
LHCbApp().OutputLevel = INFO
Gauss().Histograms = "NONE"
示例#13
0
from Gaudi.Configuration import *
from Configurables import DetCondTest__TestConditionAlg as TestAlg
from Configurables import LHCbAlgsTests__TestTimeDecoderOdin as TimeDecoder
from Configurables import (EventClockSvc, RunChangeHandlerSvc, XmlCnvSvc)
from Configurables import LoadDDDB, DDDBConf, CondDB

import sys
sys.path.append('.')

from rchoption_withhlt2 import calibconds

DDDBConf()  # Configure the detector description
CondDB(IgnoreHeartBeat=True)

EventClockSvc().addTool(TimeDecoder, "EventTimeDecoder")

testAlg = TestAlg("TestCond")
testAlg.Conditions = []
testAlg.Conditions += calibconds  # Load the conditions in rch for testing

app = ApplicationMgr()
app.TopAlg = [TestAlg("TestCond")]

app.EvtSel = "NONE"
app.EvtMax = 2

EventDataSvc(ForceLeaves=True)
示例#14
0
from Configurables import Brunel, NTupleSvc, TrackSys, RecMoniConf

Brunel().InputType = "DIGI" # implies also Brunel().Simulation = True
Brunel().WithMC    = True   # implies also Brunel().Simulation = True
Brunel().OutputType   = "NONE"
Brunel().Histograms   = "Expert"
TrackSys().TrackPatRecAlgorithms = [ "Truth", "FastVelo" ]
Brunel().RecoSequence = ["Decoding", "Truth", "VELO" ]
RecMoniConf().MoniSequence = [ ]
Brunel().MCLinksSequence = [ "Tr" ]
Brunel().MCCheckSequence = [ "Fit" ]

from Configurables import DDDBConf
DDDBConf().DbRoot = "/afs/cern.ch/user/o/ogruenbe/public/FT_upgrade/static_DDDB_FT_v4/lhcb.xml"
Brunel().DDDBtag   = "MC11-20111102"
Brunel().CondDBtag = "sim-20111111-vc-md100"

NTupleSvc().Output = ["FILE1 DATAFILE='~/w0/track.root' TYP='ROOT' OPT='NEW'"]

from Configurables import LHCbApp

from Gaudi.Configuration import * 
from GaudiConf import IOHelper

IOHelper().inputFiles(['PFN:root://castorlhcb.cern.ch//castor/cern.ch/user/o/ocallot/Bs_mumu_v4_nu50.digi?svcClass=default'])
Brunel().EvtMax     = 1000

def doMyChanges():
   from Configurables import GaudiSequencer
   GaudiSequencer("CaloBankHandler").Members = []
   GaudiSequencer("RecoDecodingSeq").Members = [ "DecodeVeloRawBuffer/DecodeVeloClusters", "FTRawBankDecoder" ]
    for layer in sipimValPtr:
        for adcID in layer:
            for adcChan in layer[adcID]:
                adcChan[0] = 0


LHCbApp().Simulation = True
CondDB().Upgrade = True
CondDB().addLayer(
    dbFile=
    "/home/ttekampe/SciFi/FTv5/DDDB_FTv5_20150424_s20140204_lhcbv38r6.db",
    dbName="DDDB")

LHCbApp().DDDBtag = "dddb-20150424"
LHCbApp().CondDBtag = "sim-20140204-vc-md100"
DDDBConf(
).DbRoot = "/home/ttekampe/SciFi/FTv5/DDDB_FTv5_20150424_s20140204_lhcbv38r6/lhcb.xml"

#LHCbApp().DDDBtag = "dddb-20150424"
#LHCbApp().CondDBtag = "sim-20140204-vc-md100"

#work around for bug in DB
#CondDB().LoadCALIBDB = 'HLT1'

# Configure all the unpacking, algorithms, tags and input files
appConf = ApplicationMgr()
appConf.ExtSvc += [
    'ToolSvc', 'DataOnDemandSvc'
    #,'NTupleSvc'
]
appConf.TopAlg += [
    "MCFTDepositCreator", "MCFTDigitCreator"
示例#16
0
##############################################################################
# File for running Gauss with latest tags, using the default configuration
#
# Syntax is:
#   gaudirun.py Gauss-DEV.py <someInputJobConfiguration>.py
##############################################################################

from Configurables import Gauss
theApp = Gauss()

#--Use latest database tags
from Configurables import DDDBConf, CondDB, LHCbApp

LHCbApp().DDDBtag = "dddb-20150724"  # Must be set for selecting VELO
# geometry list in Gauss()

Gauss().DataType = "2015"
DDDBConf(DataType="2015")
CondDB().UseLatestTags = ["2015"]
示例#17
0
    def defineDB(self):
        # Delegate handling of properties to DDDBConf. This is normally done from LHCbApp.
        self.setOtherProps(DDDBConf(), ["Simulation", "UseOracle", "DataType"])
        # Set the CondDB tags if not using defaults. This is normally done from LHCbApp.
        from Configurables import CondDB
        if hasattr(self, "DDDBTag"):
            CondDB().Tags["DDDB"] = self.getProp("DDDBTag")
        if hasattr(self, "CondDBtag"):
            CondDB().Tags["LHCBCOND"] = self.getProp("CondDBTag")
            CondDB().Tags["SIMCOND"] = self.getProp("CondDBTag")

        condDBtag = self.getProp("CondDBTag")

        ## For all DC06 cases, use latest DC06 tag
        #if condDBtag.find( "DC06" ) != -1:
        #    importOptions( "$DDDBROOT/options/DC06.py" )
        #else:
        #    CondDBAccessSvc( "DDDB"    , DefaultTAG = condDBtag )
        #    CondDBAccessSvc( "LHCBCOND", DefaultTAG = condDBtag )

        ## Always DC06 magnetic field for now....
        #from Configurables import MagneticFieldSvc
        #MagneticFieldSvc().FieldMapFile = os.environ['FIELDMAPROOT']+'/cdf/field047.cdf'

        ## No way to check whether conditions make sense
        ## Nor does UpdateManagerSvc throw FAILURE
        ## instead it gives a warning of unused conditions.
        if self.getProp("CondDBOverride"):
            from Configurables import UpdateManagerSvc
            UpdateManagerSvc().ConditionsOverride += self.getProp(
                "CondDBOverride")

        ## No need to check whether path makes sense
        ## CondDBAccessSvc throws FAILURE if path is unknown / invalid
        if self.getProp("AlternativeDDDB"):
            ## Check there's a tag.
            ## No need to check for conditions overlay
            ## CondDBDispatcherSvc throws error
            if self.getProp("AlternativeDDDBTag"):
                myDDDB = CondDBAccessSvc("DDDB").clone(
                    "MyDDDB",
                    ConnectionString="sqlite_file:%s" %
                    expandvars(self.getProp("AlternativeDDDB")),
                    DefaultTAG=self.getProp("AlternativeDDDBTag"))
                addCondDBAlternative(myDDDB,
                                     self.getProp("AlternativeDDDBOverlay"))
            else:
                print "WARNING: Need to specify a tag for alternative DDDB!"

        if self.getProp(
                "AlternativeCondDB") and not self.getProp("CondDBOverride"):
            ## Check there's a tag.
            ## No need to check for conditions overlay
            ## CondDBDispatcherSvc throws error
            if self.getProp("AlternativeCondDBTag") is not None:
                myCondDB = CondDBAccessSvc("LHCBCOND").clone(
                    "MyLHCBCOND",
                    ConnectionString="sqlite_file:%s" %
                    expandvars(self.getProp("AlternativeCondDB")),
                    DefaultTAG=self.getProp("AlternativeCondDBTag"))
                listOfOverlays = self.getProp("AlternativeCondDBOverlays")
                if listOfOverlays:
                    for d in listOfOverlays:
                        addCondDBAlternative(myCondDB, d)
                else:
                    addCondDBAlternative(myCondDB, "/Conditions")

            else:
                print "WARNING: Need to specify a tag for alternative CondDB!"
#############################################################
##
##  Compare exisiting condDB value to new measurement
##
##  Author: T. Blake
##
#############################################################

from ROOT import TCanvas, TH1F, TH2F
import os, sys

from Gaudi.Configuration import *
from Configurables import DDDBConf, CondDB, CondDBAccessSvc

DDDBConf(DataType="2010")
CondDB()

from rootStyle import applyRootStyle
applyRootStyle()

from pyHPDXMLParsingUtils import *

import GaudiPython
app = GaudiPython.AppMgr()
det = app.detSvc()


def usage(argv):
    print 'Usage: python ' + argv[0] + ' <xml 0> ... <xml n>'
    sys.exit(2)
示例#19
0
def setup_Target_GaussJob(physList,
                          targetThick,
                          targetMat,
                          projEng,
                          projID,
                          nEvts=10000):

    from Configurables import LHCbApp
    from Configurables import DDDBConf
    from Configurables import CondDB
    from Configurables import Gauss

    target = 'Target_' + str(targetThick) + 'mm' + targetMat

    Gauss()

    DDDBConf().DbRoot = "conddb:/TargetsDet.xml"
    if 'v45' not in os.environ["GAUSSROOT"]:
        CondDB().LoadCALIBDB = "HLT1"
    CondDB().Upgrade = True
    LHCbApp().DDDBtag = "dddb-20140120"
    LHCbApp().CondDBtag = "sim-20131108-vc-md100"
    LHCbApp().Simulation = True

    # For testing only
    #DDDBConf(DbRoot = "/afs/cern.ch/user/s/seaso/public/Simulation/
    #upgrade/Gauss_Target/DB/myDDDB-Upgrade-TargetGeom-January2014/TargetsDet.xml")

    Gauss.DetectorGeo = {"Detectors": []}
    Gauss.DetectorSim = {"Detectors": []}
    Gauss.DetectorMoni = {"Detectors": []}

    Gauss.DataType = "Upgrade"
    Gauss.PhysicsList = {
        "Em": 'NoCuts',
        "Hadron": physList,
        "GeneralPhys": True,
        "LHCbPhys": True
    }

    # --- activate special targets geometry
    appendPostConfigAction(targetGeo)

    # --- Switch off delta rays
    Gauss.DeltaRays = False

    # --- activate GaussTargetMultiplicity tool
    appendPostConfigAction(addMyTool)

    # --- Configure the tool
    from Configurables import GiGa, GiGaTrackActionSequence, GaussTargetMultiplicity
    giga = GiGa()
    giga.addTool(GiGaTrackActionSequence("TrackSeq"), name="TrackSeq")
    giga.TrackSeq.addTool(GaussTargetMultiplicity)
    giga.TrackSeq.GaussTargetMultiplicity.InteractionVolumeName = [
        "/dd/Structure/TargetDet/" + target + "#pv" +
        target.replace('Target', 'Targ')
    ]
    giga.TrackSeq.GaussTargetMultiplicity.InteractionVolumeString = [target]
    giga.TrackSeq.GaussTargetMultiplicity.TargetMaterial = [targetMat]
    giga.TrackSeq.GaussTargetMultiplicity.TargetThickness = [targetThick]
    giga.TrackSeq.GaussTargetMultiplicity.PhysicsList = [physList]
    giga.TrackSeq.GaussTargetMultiplicity.ProjectileEnergy = [projEng]
    giga.TrackSeq.GaussTargetMultiplicity.ProjectilePdgID = [particles[projID]]

    #giga.TrackSeq.GaussTargetMultiplicity.OutputLevel = DEBUG

    from Configurables import CondDB, LHCbApp, DDDBConf, CondDBAccessSvc
    from Configurables import Gauss

    Gauss().Production = 'PGUN'

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

    #--Number of events
    LHCbApp().EvtMax = nEvts

    Gauss().Production = 'PGUN'

    Gauss().OutputType = 'NONE'
    Gauss().Histograms = 'NONE'

    #--- Save ntuple with hadronic cross section information
    ApplicationMgr().ExtSvc += ["NTupleSvc"]
    NTupleSvc().Output = [
        "FILE1 DATAFILE='Multi_{particle}_in{material}.root' TYP='ROOT' OPT='NEW'"
        .format(particle=projID, material=targetMat)
    ]
 def setUp(self):
     unittest.TestCase.setUp(self)
     self.DDDB = DDDBConf()
     self.CondDB = CondDB()
from Configurables import LHCbApp, CondDB, UpdateManagerSvc, DDDBConf, GenInit
from Gaudi.Configuration import *

#from model Sim09g Model for 2018 - MD -
importOptions("$APPCONFIGOPTS/Gauss/Beam6500GeV-md100-2018-nu1.6.py")
importOptions("$APPCONFIGOPTS/Gauss/EnableSpillover-25ns.py")
importOptions("$APPCONFIGOPTS/Gauss/DataType-2017.py")
importOptions("$APPCONFIGOPTS/Gauss/RICHRandomHits.py")
importOptions("$LBPYTHIA8ROOT/options/Pythia8.py")
importOptions("$APPCONFIGOPTS/Gauss/G4PL_FTFP_BERT_EmNoCuts.py")
importOptions("$DECFILESROOT/options/30000000.py")

DDDBConf(
).DbRoot = "/afs/cern.ch/user/z/zhangy/workdir/EcalUpgrade/GaussDev_v52r2/DDDB-runI-II/lhcb.xml"
CondDB().Tags['DDDB'] = 'HEAD'

#--Set database tags
from Configurables import LHCbApp

LHCbApp().DDDBtag = "dddb-20170721-3"
LHCbApp().CondDBtag = "sim-20190430-vc-mu100"

LHCbApp().DDDBtag = "dddb-20171030-3"
LHCbApp().CondDBtag = "sim-20170721-2-vc-md100"

from Configurables import Gauss
Gauss().DataType = "2012"

####Gauss-Job.py
#--Generator phase, set random numbers
GaussGen = GenInit("GaussGen")
示例#22
0
from Configurables import LHCbApp, CondDB, UpdateManagerSvc,DDDBConf
from Gaudi.Configuration import *
import os

#Use Oliver's XML DDDB describing the FT detector
#DDDBConf().DbRoot = "/afs/cern.ch/user/o/ogruenbe/public/FT_upgrade/myDDDB-LHCb-Feb2012/lhcb.xml"
#-- the above is a running target, therefore use the following snaphot:
DDDBConf().DbRoot = "/afs/cern.ch/user/p/phopchev/public/FT/DDDBSlice_FT_v3/lhcb.xml"

CondDB().Tags['DDDB'] = 'HEAD'


lhcbApp = LHCbApp()
lhcbApp.Simulation = True

'''
lhcbApp.DataType = '2011'
lhcbApp.DDDBtag = "head-20110914"
lhcbApp.CondDBtag = "sim-20111020-vc-md100"
#dataDir = os.environ['PANORAMIXDATA']
#EventSelector().Input = ["DATAFILE='PFN:"+dataDir+"/2011_Bs2DsmuX.dst' TYP='POOL_ROOTTREE'"]
'''

lhcbApp.DataType = "2011"
lhcbApp.DDDBtag = "MC11-20111102"
lhcbApp.CondDBtag = "sim-20111111-vc-md100"
EventSelector().Input = ["DATAFILE='/castor/cern.ch/user/o/ogruenbe/Bs_mumu_v3.sim' TYP='POOL_ROOTTREE'"]

### Set fake event time to avoid useless ERROR messages from the EventClockSvc (no DAQ/RawEvent as it is MC)
from Configurables import EventClockSvc
EventClockSvc().EventTimeDecoder = 'FakeEventTime'
from GaudiKernel.ProcessJobOptions import importOptions

from Gaudi.Configuration import *

from Configurables import Boole, LHCbApp, CondDB  #, GaudiSequencer
from Configurables import MCFTDepositCreator, MCFTDigitCreator, FTClusterCreator
#from Configurables import MCFTDepositMonitor, MCFTDigitMonitor, FTClusterMonitor
from Configurables import FTRawBankEncoder, FTRawBankDecoder
from Configurables import L0Conf, DDDBConf
L0Conf().TCK = '0x002A'

#CondDB().Upgrade    = True
DDDBConf(
).DbRoot = "/afs/cern.ch/user/o/ogruenbe/public/FT_upgrade/test_DDDBupgrade_FT_v20/lhcb.xml"
#DDDBConf().DbRoot   = "/afs/cern.ch/user/c/cogneras/scratch0/DDDBUpgrade-v20/lhcb.xml"
LHCbApp().DDDBtag = "dddb-20130408"
LHCbApp().CondDBtag = "simcond-20121001-vc-md100"

#-- Event input
#DDDBConf().DbRoot = "/afs/cern.ch/user/o/ogruenbe/public/FT_upgrade/test_DDDBupgrade_FT_v20/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/o/ogruenbe/public/FT_upgrade/test_DDDB_FT_v20/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/c/cogneras/public/forFT/DDDB/lhcb.xml"
#DDDBConf().DbRoot = "/afs/cern.ch/user/s/szczypka/public/upgrade/forFT/DDDB/lhcb.xml"
#LHCbApp().DDDBtag   = "dddb-20130408"
#LHCbApp().CondDBtag = "simcond-20121001-vc-md100"

#Datasetname="Bs_mumu_v6_nu325"
#Datasetname="Bs_mumu_v6_nu65"

#Datasetname="MiniBias_v6_nu325"
#Datasetname="MiniBias_v6_nu65"
示例#24
0
#  @author Vanya BELYAEV [email protected]
#  @date   2008-12-02
# =============================================================================
"""
The configurationi file to run QMTest for the package Kernel/PartProp
"""
# =============================================================================
__author__ = "Vanya BELYAEV [email protected]"
__version__ = "CVS tag $Name: not supported by cvs2svn $, version $Revision$"
# =============================================================================

from Gaudi.Configuration import *
from Configurables import ApplicationMgr
from Configurables import LHCb__ParticlePropertySvc as PPS
from Configurables import LHCb__Example__PartPropAlg as PPA

## needed for the proper access to Particle table  from DDDB
from Configurables import DDDBConf
DDDBConf()  # use the default Configuration of DDDB

ApplicationMgr(TopAlg=[PPA()], EvtSel="NONE", EvtMax=1)

# theApp.ExtSvc += [
#     PPS ( ParticlePropertiesFile =
#          "$PARAM_HOME/ParamFiles/v7r3/data/ParticleTable.txt"
#          ) ]

# =============================================================================
# The END
# =============================================================================
示例#25
0
      break
  if excl :
    continue
  detxml = k[k.rfind('/')+1:]
  det = detxml[:detxml.rfind('.xml')]
  det = det.lower()
  dets.append(det)
print "Moving to Offline DB the following detector Data ",dets
ecs = EventClockSvc()
ecs.InitialTime = RunOption.RunStartTime*1000000000
ecs.addTool(FakeEventTime,"EventTimeDecoder")
ecs.EventTimeDecoder.StartTime = ecs.InitialTime
ecs.EventTimeDecoder.TimeStep = 10

#xmlCnvSvc = XmlCnvSvc(AllowGenericConversion = True)
DDDBConf()
#detDataSvc = DetectorDataSvc()
#DetectorPersistencySvc( CnvServices = [ xmlCnvSvc ] )
cdb = CondDB()
cdb.RunChangeHandlerConditions=CondMap.ConditionMap
cdb.EnableRunChangeHandler = True
cdb.EnableRunStampCheck=False
cdb.UseDBSnapshot = True
cdb.Tags = { "DDDB" : RunOption.DDDBTag,
                "LHCBCOND" : RunOption.CondDbTag,
                "ONLINE" : 'fake'}
cdb.IgnoreHeartBeat = True
dbxalg = DBXferAlg()
dbxalg.RunNumber = RunOption.RunNumber
dbxalg.RunStartTime = RunOption.RunStartTime*1000000000
dbxalg.OnlineXmlDir = RunOption.OutputDirectory
示例#26
0
    def __apply_configuration__(self):
        GaudiKernel.ProcessJobOptions.PrintOff()
        # verify mutually exclusive settings:
        #  eg.  Online vs. any L0 setting
        #       Online vs. generateConfig
        #       Online vs. DB tags...
        #       Online vs. EvtMax, SkipEvents, DataType, ...
        #       Online requires UseTCK
        # L0 decoding to look in a single place
        # L0Conf().RawEventLocations = ['DAQ/RawEvent']
        #L0DUFromRawAlg("L0DUFromRaw").Hlt1 = True
        deprecationwarning = ""
        for prop in self.getProperties():
            if prop in self._propertyDocDct:
                doc = self._propertyDocDct[prop]
                if "DEPRECATED" in doc and self.isPropertySet(prop):
                    deprecationwarning = deprecationwarning + "You are trying to set the deprecated property Moore()." + prop
                    if " use " in doc and len(doc[doc.find("use"):].strip()):
                        deprecationwarning = deprecationwarning + " please " + doc[
                            doc.find("use"):].strip() + " instead"
                    deprecationwarning = deprecationwarning + "\n"
        if len(deprecationwarning.strip()):
            raise DeprecationWarning(deprecationwarning.strip())

        #check nothing strange is set for running online
        if self.getProp("RunOnline"):
            #things
            for prop, set in [("generateConfig", False), ("EvtMax", -1)]:
                self._throwIfNotSet(self, prop, set,
                                    " because you're running in Online mode!")
            for prop, set in [("DisableMonitors", False)]:
                self._throwIfNotSet(MooreExpert(), prop, set,
                                    " because you're running in Online mode!")

        #check nothing strange is running to generate a TCK
        if self.getProp("generateConfig"):
            for prop, set in [("Hlt2Independent", False)]:
                self._throwIfNotSet(
                    MooreExpert(), prop, set,
                    " because you're trying to generate a TCK!")
            for prop, set in [("OutputLevel", WARNING), ("UseTCK", False)]:
                self._throwIfNotSet(
                    self, prop, set,
                    " because you're trying to generate a TCK!")

        if not self.getProp("RunOnline"): self._l0()

        from Configurables import MooreInitSvc
        ApplicationMgr().ExtSvc.append(MooreInitSvc())
        #from Configurables import LbAppInit
        #ApplicationMgr().TopAlg.append(LbAppInit(PreloadGeometry=True))
        ### Could be that MooreOnline has already populated the TopAlg with the Hlt Sequencer...
        hlt = GaudiSequencer('Hlt')
        if hlt not in ApplicationMgr().TopAlg:
            ApplicationMgr().TopAlg.append(hlt)

        # forward some settings...
        # WARNING: this triggers setup of /dd -- could be avoided in PA only mode...
        app = LHCbApp()
        self.setOtherProps(app,
                           ['EvtMax', 'SkipEvents', 'Simulation', 'DataType'])

        # this was a hack. Someone thought setOtherProps did not work?
        #app.CondDBtag = self.getProp('CondDBtag')
        #app.DDDBtag   = self.getProp('DDDBtag')
        self.setOtherProps(app, ['CondDBtag', 'DDDBtag'])
        # Get the event time (for CondDb) from ODIN
        from DAQSys.Configuration import SetEvtClock
        SetEvtClock("ODIN")
        #from Configurables import EventClockSvc
        #import time
        #EventClockSvc().InitialTime = int(time.time()*1e9)  #now
        from Configurables import DDDBConf
        if not DDDBConf().isPropertySet("InitialTime"):
            DDDBConf().InitialTime = "Now"

        # make sure we don't pick up small variations of the read current
        # Need a defined HistogramPersistency to read some calibration inputs!!!
        ApplicationMgr().HistogramPersistency = 'ROOT'

        #set the decoders to read from the default location
        self._setRawEventLocations()

        self._configureDQTags()

        if self.getProp('UseTCK'):
            self._config_with_tck()
            self._split(useTCK=True)
        else:
            self._config_with_hltconf()
            self._split(useTCK=False)

        self._definePersistency()
        self._configureDataOnDemand()

        if self.getProp("Simulation") or MooreExpert().getProp(
                "DisableMonitors"):
            self._suppressMonitoring()

        if not self.getProp("RunOnline"):
            self._profile()
            if self.getProp("generateConfig"): self._generateConfig()
            self._configureInput()

        # Configure EndSequence and output through HltOutputConf
        self._configureOutput()

        #last thing, set output levels
        self._outputLevel()
示例#27
0
from Configurables import ( LHCbApp, PhysConf, AnalysisConf,
                            DstConf, LumiAlgsConf, DDDBConf )

#LHCbApp().DDDBtag   = "dddb-20150724"
#LHCbApp().CondDBtag = "cond-20150805"

# Can be enabled for next full stack release
PhysConf().OutputLevel     = appMgr.OutputLevel
#AnalysisConf().OutputLevel = appMgr.OutputLevel

datatype =  "2015"
PhysConf().DataType      = datatype
AnalysisConf().DataType  = datatype
LumiAlgsConf().DataType  = datatype
DDDBConf().DataType      = datatype

inputType = "DST"
LumiAlgsConf().InputType = inputType
PhysConf().InputType     = inputType

unPack = ["Reconstruction"]
PhysConf().EnableUnpack = unPack
DstConf().EnableUnpack  = unPack

lumiSeq = GaudiSequencer("LumiSeq")
LumiAlgsConf().LumiSequencer = lumiSeq

appMgr.TopAlg += [ PhysConf().initSequence(),
                   AnalysisConf().initSequence(),
                   sc.sequence(), lumiSeq ]
示例#28
0
def CreateLifetimeMapCode(config=None, bRetLists=False):
    global codePreamble, codeMakePair, codePostamble, outStream, analysisName, timestampFormat, dataType, dddbTag, bUseLatestCondDB
    if not config is None:
        dataType = config[0]  #year
        dddbTag = config[1]  #DDDB tag
    lbApp = LHCbApp()
    lbApp.DDDBtag = dddbTag
    DDDBConf(DataType=dataType)
    if bUseLatestCondDB:
        CondDB().UseLatestTags = [dataType]
    gaudi = AppMgr()
    gaudi.initialize()
    pps = gaudi.ppSvc()
    if len(pps.all()) == 0:
        eprint(
            "ERROR: No particles returned from Particle Property Service!\n",
            'err')
        return False
    pmap = {}
    pids = []
    for p in pps.all():
        #if p.name().startswith('anti-'):
        #    continue
        pid = p.pid().pid()
        if pid < 0 or pmap.has_key(pid):
            apid = ((pid < 0) and (-pid) or pid)
            if pmap.has_key(apid):
                nlft = "%.8E" % (p.lifetime() / SystemOfUnits.s)
                olft = "%.8E" % (pmap[apid])
                if nlft.startswith(olft):
                    continue
                else:
                    eprint(
                        "(anti-)/Particle lifetimes differ [%d] (%s vs. %s). Use asymmetric algorithm with PID:Lifetime map."
                        % (pid, nlft, olft), 'warn')
                    if pid > 0:
                        pmap[-pid] = pmap[pid]
                        del pmap[pid]
            else:
                pid = apid
        #if len(str(pid)) > 7: #????
        #    print ("Ignored " + str(p))
        #    continue
        if pid > 79 and pid < 101:
            eprint('Ignoring generator dependent PIDs in interval [80-100].')
            eprint(str(p))
            continue
        if len(str(pid)) > 9:  #ignore nuclei
            eprint("Ignoring nucleus " + str(p))
            continue
        lft = p.lifetime()
        if lft < 0.0:
            eprint("Negative lifetime! " + str(p), 'err')
            continue
        if pmap.has_key(pid):
            eprint("Duplicate particle in list with PID " + str(pid), 'warn')
            continue
        if lft < 1.0e-32:
            if not pid in pids:
                pids.append(pid)
            continue
        #express lifetime in seconds
        lft = lft / SystemOfUnits.s
        pmap[pid] = lft
    if not bRetLists:
        if not outStream is None:
            if os.path.isfile(outStream):
                eprint("File '%s' already exists." % (outStream))
                ans = raw_input('Do you really want to overwrite (yes/no)? ')
                if ans.lower() == 'no':
                    eprint('Aborting execution. Please, rename output file.',
                           'warn')
                    exit(9)
            fp = open(outStream, "w")
        else:
            fp = sys.stdout
        fp.write(codePreamble %
                 (dddbTag, dataType,
                  datetime.datetime.utcnow().strftime(timestampFormat)))
        fp.write("  ")
        sortedKeys = pmap.keys()
        sortedKeys.sort()
        k = 2
        for pdgid in sortedKeys:
            svdbl = "%.8E" % (pmap[pdgid])
            smant = svdbl[0:svdbl.rfind('E') - 1]
            sexp = svdbl[svdbl.rfind('E'):]
            smant = smant.rstrip('0')
            svdbl = (smant + sexp)
            spair = codeMakePair % (pdgid, svdbl)
            lts = len(spair)
            k += lts
            if k > 80:
                k = lts
                fp.write("\n  ")
            fp.write(spair)
        fp.write("\n  return true;\n}\n")
        fp.flush()
        if len(pids) > 0:
            pids.sort()
            fp.write(codePreamble2 % (len(pids), analysisName, len(pids)))
            k = 0
            jj = 0
            for jj in xrange(0, len(pids)):
                ii = pids[jj]
                #ignore partons and particle ids below 100
                if ii <= 100:
                    continue
                spid = "%u" % (ii)
                if jj < len(pids) - 1:
                    spid += ","
                k += len(spid)
                fp.write(spid)
                if k > 80:
                    fp.write("\n")
                    k = 0
            fp.write("};\n")
        if not outStream is None:
            fp.flush()
            fp.close()
    gaudi.finalize()
    gaudi.exit()
    del gaudi, lbApp
    return (pmap, pids)
示例#29
0
from Gaudi.Configuration import *
from Configurables import LHCbApp, CondDB, DDDBConf

dataType = "2011"

DDDBConf(DataType=dataType)
CondDB(IgnoreHeartBeat=True)

if "UseLatestTags" in CondDB().__slots__:
    CondDB().UseLatestTags = [dataType]
else:
    CondDB().useLatestTags(DataType=dataType, OnlyGlobalTags=False)
示例#30
0
## @file
#  Small script forcing a time-out in the access to the
from Gaudi.Configuration import *
from Configurables import CondDB, CondDBAccessSvc, DDDBConf

DDDBConf(DataType="2008")

#DDDB = CondDBAccessSvc("DDDB")
#DDDB.ConnectionTimeOut = 5

partitions = ['DDDB', 'ONLINE_2008', 'LHCBCOND', 'DQFLAGS']
msg = MessageSvc(OutputLevel=WARNING)
msg.setDebug.extend(partitions)
msg.setVerbose.extend([p + '.TimeOutChecker' for p in partitions])

import GaudiPython
app = GaudiPython.AppMgr()
app.initialize()
app.start()

import time
app.detSvc()["/dd/Conditions/Online/LHCb"]  # access the DB
print "TEST ===> start"
reader = app.service('CondDBCnvSvc', GaudiPython.gbl.ICondDBReader)
reader.disconnect()
print "TEST ===> reconnect"
app.detSvc()["/dd/Conditions/Online/LHCb/Tick"]  # access the DB
print "TEST ===> end"