Exemplo n.º 1
0
 def addTupleAlg(self):
     """ Add TupleHltDecReports to TopAlg """
     alg = TupleHltDecReports(self._algName)
     seq = Sequence("Hlt")
     algSeq = Sequence("TupleSequence")
     algSeq.Members = [alg]
     seq.Members += [algSeq]
     ApplicationMgr().HistogramPersistency = "ROOT"
     tupleFile = self._filename
     ApplicationMgr().ExtSvc += [NTupleSvc()]
     tup = "FILE1 DATAFILE='" + tupleFile + "' TYP='ROOT' OPT='NEW'"
     NTupleSvc().Output = [tup]
     NTupleSvc().OutputLevel = 1
Exemplo n.º 2
0
def configure(datafiles, catalogs=[], castor=False):
    """
    Job configuration 
    """
    from PhysConf.Filters import LoKi_Filters
    fltrs = LoKi_Filters(
        VOID_Code=
        " 0.5 < CONTAINS('/Event/Charm/Phys/DstarForPromptCharm/Particles') ")
    ##
    ## 1. Static configuration using "Configurables"
    ##

    from Configurables import DaVinci
    davinci = DaVinci(
        DataType='2010',
        InputType='MDST',
        PrintFreq=1000,
        EventPreFilters=fltrs.filters('Filters'),
        HistogramFile='RealDstar_CHARM_Histos.root',
        TupleFile='RealDstar_CHARM.root',
        ##
        Lumi=True)

    from Configurables import CondDB
    CondDB(UseLatestTags=['2010'])

    from Configurables import NTupleSvc
    ntSvc = NTupleSvc()

    ## define the input data:
    setData(datafiles, catalogs, castor)

    ##
    ## 2. Jump into the wonderful world of the actual Gaudi components!
    ##

    ## get the actual application manager (create if needed)
    gaudi = appMgr()

    ## create local algorithm:
    alg = Dstar(
        #
        'Dstar',  ## Algorithm name
        #
        ## RecoStripping-09 conventions!
        RootInTES='/Event/Charm',
        Inputs=['Phys/DstarForPromptCharm/Particles']  ## input particles 
    )

    ## finally inform Application Manager about our algorithm
    userSeq = gaudi.algorithm('GaudiSequencer/DaVinciUserSequence', True)
    userSeq.Members += [alg.name()]

    return SUCCESS
Exemplo n.º 3
0
    def applyConf(self):

        if not self.isPropertySet("Sequencer"):
            raise RuntimeError("ERROR : Sequencer not set")
            
        protoSeq = self.getProp("Sequencer")
        protoSeq.Context = self.getProp("Context")

        from Configurables import ( NTupleSvc, ChargedProtoParticleTupleAlg,
                                    ChargedProtoParticleAddRichInfo,
                                    ChargedProtoParticleAddMuonInfo,
                                    ChargedProtoCombineDLLsAlg )

        # The ntuple maker
        protoChecker = ChargedProtoParticleTupleAlg("ChargedProtoTuple")
        protoChecker.NTupleLUN = "PROTOTUPLE"

        # Fill sequence
        protoSeq.Members += [protoChecker]

        # The output ntuple ROOT file
        NTupleSvc().Output += ["PROTOTUPLE DATAFILE='"+self.getProp("ProtoTupleName")+"' TYP='ROOT' OPT='NEW'"]

        # ANN training ntuple
        if self.getProp("AddANNPIDInfo") :
            from Configurables import ( ANNGlobalPID__ChargedProtoANNPIDTrainingTuple )
            annTuple = ANNGlobalPID__ChargedProtoANNPIDTrainingTuple("ChargedProtoPIDANNTuple")
            annTuple.NTupleLUN = "ANNPIDTUPLE"
            protoSeq.Members += [annTuple]
            NTupleSvc().Output += ["ANNPIDTUPLE DATAFILE='"+self.getProp("ANNTupleName")+"' TYP='ROOT' OPT='NEW'"]
            if self.isPropertySet("OutputLevel"):
                annTuple.OutputLevel = self.getProp("OutputLevel")

        # Set output levels
        if self.isPropertySet("OutputLevel"):
            level = self.getProp("OutputLevel")
            protoChecker.OutputLevel = level
Exemplo n.º 4
0
from Configurables import L0Conf
from Configurables import NTupleSvc
from Configurables import PrChecker2
from Configurables import LoKi__Hybrid__MCTool
from Gaudi.Configuration import GaudiSequencer

# As we haven't ran Moore
L0Conf().EnsureKnownTCK = False

# Required to avoid Loki issues when running PrChecker2
myFactory = LoKi__Hybrid__MCTool("MCHybridFactory")
myFactory.Modules = ["LoKiMC.decorators"]
PrChecker2("PrChecker2").addTool(myFactory)

GaudiSequencer("CheckPatSeq").Members = [
    "PrChecker",
    "PrChecker2",
    "TrackIPResolutionChecker",
    "TrackIPResolutionCheckerNT",
    "VPClusterMonitor"
]

NTupleSvc().Output += ["FILE1 DATAFILE='Brunel-tuples.root' TYP='ROOT' OPT='NEW'"]
#Gauss().Phases = [ 'Generator' , 'Simulation' ] 
Gauss().Phases = ["Generator","GenToMCTree"]


#smear primary vertices timing information
def CkvPVTimeSmearActivate():
    from Configurables import Generation
    from Configurables import BeamSpotMarkovChainSampleVertex
    Generation("Generation").addTool(BeamSpotMarkovChainSampleVertex, name="BeamSpotMarkovChainSampleVertex")
    Generation("Generation").VertexSmearingTool = "BeamSpotMarkovChainSampleVertex"

appendPostConfigAction(CkvPVTimeSmearActivate)


from Configurables import GiGaGeo, GaussSensPlaneDet, TupleTool

#
from Configurables import ApplicationMgr, NTupleSvc 
name = "nInter=1_Bd2KpPimPi0"
name = "nInter=1_Lb2ProtonKmPi0"
name = name+"_Run%i"%(GaussGen.RunNumber,)
NTupleSvc().Output = [ 
        "FILE1 DATAFILE='%s.root' TYP='ROOT' OPT='NEW'"%(name,)
        ]
ApplicationMgr().ExtSvc += [ NTupleSvc() ] 


OutputStream("GaussTape").Output = "DATAFILE='PFN:%s.sim' TYP='POOL_ROOTTREE' OPT='RECREATE'"%(name,)


Exemplo n.º 6
0
dv = DaVinci()
dv.DDDBtag = 'head-20110914'
dv.CondDBtag = 'head-20110914'
dv.DataType = '2011'
dv.Lumi = False
dv.InputType = "MDST" if mDST else "DST"
dv.UserAlgorithms = [dtt]
dv.EvtMax = -1

ApplicationMgr().HistogramPersistency = "ROOT"
from Configurables import HistogramPersistencySvc
HistogramPersistencySvc(OutputFile='histos.root')

from Configurables import NTupleSvc
NTupleSvc().Output += ["DTT DATAFILE='tuples.root' TYPE='ROOT' OPT='NEW'"]
NTupleSvc().OutputLevel = 1

## Point the EventClockSvc to the RootInTES
## from Configurables import EventClockSvc, OdinTimeDecoder, TimeDecoderList
## EventClockSvc().addTool( TimeDecoderList, name = "EventTimeDecoder" )
## EventClockSvc().EventTimeDecoder.RootInTES = locationRoot

from GaudiConf import IOHelper
if mDST:
    ## IOHelper().inputFiles(['/castor/cern.ch/user/r/raaij/test/Swimming.SwimmingMicroDST.mdst'])
    IOHelper().inputFiles(['Swimming.SwimmingMDST.mdst'])
else:
    IOHelper().inputFiles(
        ['/project/bfys/raaij/cmtuser/Moore_v12r8/scripts/SwimTrigDST.dst'])
Exemplo n.º 7
0
    def __apply_configuration__(self) :

        from Configurables import ( GaudiSequencer, CombineParticles )
        from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

        if not self.isPropertySet("Sequencer") :
            raise RuntimeError("ERROR : Sequence not set")
        seq = self.getProp("Sequencer")

        if self.getProp("RunSelection") :

            # STD particles
            from StandardParticles import StdLooseMuons

            # J/psi -> mu mu
            JPsiMuMuName               = self.__sel_name__
            JPsiMuMu                   = CombineParticles(JPsiMuMuName)
            JPsiMuMu.DecayDescriptor   = "J/psi(1S) -> mu+ mu- "
            JPsiMuMu.CombinationCut    = "(ADAMASS('J/psi(1S)') < 150*MeV)"
            JPsiMuMu.MotherCut         = "(ADMASS('J/psi(1S)') < 130*MeV) & (VFASPF(VCHI2/VDOF)<6) & (PT > 2500*MeV)"
            JPsiMuMu.DaughtersCuts     = {"mu+" : "(PT>1400*MeV)"\
                                          "& (P>5*GeV)"\
                                          "& (TRCHI2DOF<2.0)"\
                                          "& (PPINFO(LHCb.ProtoParticle.MuonBkgLL,-10000)<-2.5)"\
                                          "& (PPINFO(LHCb.ProtoParticle.MuonMuLL,-10000)>-10)"}
            self.setOptions(JPsiMuMu)
            JPsiMuMuSel = Selection( JPsiMuMuName+'Sel',
                                     Algorithm = JPsiMuMu,
                                     RequiredSelections = [StdLooseMuons] )

            # Selection Sequence
            selSeq = SelectionSequence( self.__sel_name__+'Seq', TopSelection = JPsiMuMuSel )

            # Run the selection sequence.
            seq.Members += [selSeq.sequence()]

        # Particle Monitoring plots
        if self.getProp("RunMonitors") :

            from Configurables import ( ParticleMonitor )
            plotter =  ParticleMonitor(self.__sel_name__+"Plots")
            if self.getProp("RunSelection") : 
                plotter.Inputs      = [ 'Phys/'+self.__sel_name__+'Sel' ]
            else:
                musel = "(PT>1400*MeV) & (P>5*GeV) & (TRCHI2DOF<2.0) & "\
                        "(PPINFO(LHCb.ProtoParticle.MuonBkgLL,-10000)<-2.5) & "\
                        "(PPINFO(LHCb.ProtoParticle.MuonMuLL,-10000)>-10)"
                _code = "( ( INTREE( ('mu+'==ID) & "+musel+" ) ) | ( INTREE( ('mu-'==ID) & "+musel+" ) ) )"
                from Configurables import FilterDesktop
                filter = FilterDesktop( name = self.__sel_name__+"RICHFiltered",
                                        Code = _code,
                                        Inputs = self.getProp("Candidates") )
                plotter.Inputs = [ 'Phys/'+filter.name() ]
                seq.Members += [filter]
            plotter.PeakCut     = "(ADMASS('J/psi(1S)')<20*MeV)" # Considering sigma = 13
            plotter.SideBandCut = "(ADMASS('J/psi(1S)')>20*MeV)" # Considering sigma = 13
            plotter.PlotTools   = self.getProp("PlotTools") 
            self.setOptions(plotter)
            seq.Members += [plotter]

        # Make a DST ?
        if self.getProp("MakeSelDST"):

            # Prescale
            from Configurables import DeterministicPrescaler
            scaler = DeterministicPrescaler( self.__sel_name__+'PreScale',
                                             AcceptFraction = self.getProp("DSTPreScaleFraction") )
            seq.Members += [scaler]
            # Write the DST
            MyDSTWriter = SelDSTWriter( self.__sel_name__+"DST",
                                        SelectionSequences = [ selSeq ],
                                        OutputPrefix = self.__sel_name__ )
            seq.Members += [MyDSTWriter.sequence()]

        # MC Performance checking ?
        if self.getProp("MCChecks") :

            from Configurables import ParticleEffPurMoni
            mcPerf = ParticleEffPurMoni(JPsiMuMuName+"MCPerf")
            mcPerf.Inputs = ['Phys/'+self.__sel_name__+'Sel']
            self.setOptions(mcPerf)
            seq.Members += [mcPerf]

        # Ntuple ?
        if self.getProp("MakeNTuple") :

            from Configurables import ( DecayTreeTuple,
                                        TupleToolDecay,
                                        LoKi__Hybrid__FilterCriterion,
                                        LoKi__Hybrid__TupleTool,
                                        TupleToolMCBackgroundInfo,
                                        BackgroundCategory,
                                        TupleToolTrigger,
                                        TupleToolMCTruth,
                                        MCTupleToolKinematic,
                                        MCTupleToolHierarchy,
                                        TupleToolVtxIsoln,
                                        TupleToolP2VV
                                        )
            
            JPsiMuMuTree = DecayTreeTuple( JPsiMuMuName + 'Tuple')
            JPsiMuMuTree.Inputs = [ 'Phys/'+JPsiMuMuName]
            JPsiMuMuTree.Decay = 'J/psi(1S) ->  ^mu+ ^mu- '
            
            # set some names for ntuple branchs
            MyBranch_jpsi  = "jpsi"
            MyBranch_mup   = "mup"
            MyBranch_mum   = "mum"
            
            # label the branches for the particle tools
            JPsiMuMuTree.Branches = {
                MyBranch_jpsi  : "J/psi(1S) : J/psi(1S) ->  mu+ mu- ",
                MyBranch_mup   : "J/psi(1S) ->  ^mu+ mu- ",
                MyBranch_mum   : "J/psi(1S) ->  mu+ ^mu- ",
                }
            
            JPsiMuMuTree.ToolList = [
                "TupleToolEventInfo"
                , "TupleToolGeneration"
                , "TupleToolMCTruth"
                , "TupleToolMCBackgroundInfo"
                , "MCTupleToolKinematic"
                , "TupleToolPrimaries"
                , "TupleToolVtxIsoln"
                , "TupleToolTrackInfo"
                , "TupleToolPid"
                , "TupleToolGeometry"
                , "TupleToolKinematic"
                , "TupleToolPropertime"
                , "TupleToolPid"
                , "TupleToolPrimaries"
                , "TupleToolTrigger"
                ]
            
            JPsiMuMuTree.addTool(BackgroundCategory())
            JPsiMuMuTree.BackgroundCategory.SoftPhotonCut = 2000
            JPsiMuMuTree.OutputLevel = INFO
            JPsiMuMuTree.addTool(TupleToolTrigger())
            JPsiMuMuTree.TupleToolTrigger.VerboseL0 = True
            JPsiMuMuTree.addTool(TupleToolMCTruth())
            JPsiMuMuTree.TupleToolMCTruth.addTool(MCTupleToolKinematic())
            JPsiMuMuTree.TupleToolMCTruth.addTool(MCTupleToolHierarchy())
            JPsiMuMuTree.TupleToolMCTruth.ToolList = [
                "MCTupleToolKinematic" ,
                "MCTupleToolHierarchy"
                ]
            JPsiMuMuTree.TupleToolMCTruth.MCTupleToolKinematic.StoreKineticInfo = True
            JPsiMuMuTree.TupleToolMCTruth.MCTupleToolKinematic.StoreVertexInfo = True
            JPsiMuMuTree.TupleToolMCTruth.MCTupleToolKinematic.StorePropertimeInfo = False
            JPsiMuMuTree.addTool(TupleToolVtxIsoln( OutputLevel = 6 ))
            JPsiMuMuTree.TupleToolVtxIsoln.IP = 2.0
            JPsiMuMuTree.TupleToolVtxIsoln.InputParticles = [ "Phys/StdLooseMuons"]
            
            seq.Members += [JPsiMuMuTree]
            
            JPsiMuMuTree.NTupleLUN = "JPSIMUMU"
            
            from Configurables import NTupleSvc
            NTupleSvc().Output = ["JPSIMUMU DATAFILE='JpsiMuMu_Presel.root'  TYP='ROOT'  OPT='NEW'"]
Exemplo n.º 8
0
geosvc = GeoSvc("GeoSvc")
geosvc.compact = geometry_path

##############################################################################
# Event Data Svc
##############################################################################

from Configurables import K4DataSvc
dsvc = K4DataSvc("EventDataSvc", input="test-detsim10.root")

##############################################################################
# NTuple Svc
##############################################################################

from Configurables import NTupleSvc
ntsvc = NTupleSvc("NTupleSvc")
ntsvc.Output = ["MyTuples DATAFILE='result.root' OPT='NEW' TYP='ROOT'"]

##############################################################################
# DumpAlg
##############################################################################

from Configurables import DumpIDAlg
alg = DumpIDAlg("DumpAlg")

from Configurables import PodioInput
podioinput = PodioInput("PodioReader", collections=["EcalBarrelCollection"])

# ApplicationMgr
from Configurables import ApplicationMgr
ApplicationMgr(TopAlg=[podioinput, alg],
Exemplo n.º 9
0
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" ]
   GaudiSequencer("RecoTruthSeq").Members = [ "UnpackMCParticle", "UnpackMCVertex", "PrLHCbID2MCParticle" ]
   GaudiSequencer("MCLinksTrSeq").Members = ["PrTrackAssociator"] 
Exemplo n.º 10
0
    InputLocations=['StdTightMuons'],  ##   input particles 
    PP2MCs=['Relations/Rec/ProtoP/Charged'],  ##   PP -> MC tables
    NTupleLUN="MCMU")

## get input data:
from LoKiExample.Bs2Jpsiphi_mm_data import Inputs as INPUT

## confgure the application itself:
from Configurables import DaVinci
DaVinci(
    DataType='DC06',  ## Data type  
    Simulation=True,  ## Monte Carlo 
    Hlt=False,
    #
    UserAlgorithms=[alg],  ## let DaVinci know about local algorithm
    # delegate this properties to Event Selector
    EvtMax=500,
    SkipEvents=0,
    Input=INPUT,  ## the list of input data files
    # delegate to Histogram Persistency Service
    HistogramFile="PsiPhi_Histos.root")

## n-Tuples
from Configurables import NTupleSvc
svc = NTupleSvc()
svc.Output += ["MCMU DATAFILE='MCMuon_Tuples.root' TYP='ROOT' OPT='NEW'"]

# =============================================================================
# The END
# =============================================================================
Exemplo n.º 11
0
ttsis.ReportStage = "Stripping"

tttt = dtt.D.addTupleTool('TupleToolTISTOS')
tttt.TriggerList = ['Hlt1TrackAllL0Decision', 'Hlt2CharmHadD02HH_D02KPiDecision']
tttt.VerboseHlt1 = True
tttt.VerboseHlt2 = True

dv = DaVinci()
dv.DDDBtag = 'dddb-20120831'
dv.CondDBtag = 'cond-20120831'
dv.DataType = '2012'
dv.Lumi = False
dv.InputType = "MDST" 
dv.UserAlgorithms = [ killer,dtt ]
dv.EvtMax = -1
dv.EnableUnpack = ['Stripping','Reconstruction']
# Where to save the output:
dv.HistogramFile = "histos.root"
dv.Simulation = False

from Configurables import NTupleSvc
NTupleSvc().Output += [ "DTT DATAFILE='SwimD2hhTuple_v14r8.root' TYPE='ROOT' OPT='NEW'"]
NTupleSvc().OutputLevel = 1 

from GaudiConf import IOHelper
IOHelper().inputFiles(['Swimming.SwimStrippingD2hhMDST_v14r8.mdst'])

# Use the CondDB to get the right database tags 
from Configurables import CondDB
CondDB(UseOracle = False, DisableLFC = True)
Exemplo n.º 12
0
# # tell the Data On Demand Service about them
# DataOnDemandSvc().AlgMap[ "/Event/Link/MC/Particles2MCTTHits" ]    = TTAssoc
# DataOnDemandSvc().AlgMap[ "/Event/Link/MC/Particles2MCOTHits" ]    = OTAssoc
# DataOnDemandSvc().AlgMap[ "/Event/Link/MC/Particles2MCITHits" ]    = ITAssoc
# DataOnDemandSvc().NodeMap[ "/Event/Link" ]    = "DataObject"
# DataOnDemandSvc().NodeMap[ "/Event/Link/MC" ] = "DataObject"

#GaudiSequencer("MCLinksTrSeq").Members = ["PrTrackAssociator"]

from Configurables import PatLongLivedTracking as pllt
pllt().WithDebugTool = True
pllt().ForceMCTrack = False
pllt().TimingMeasurement = True

ApplicationMgr().ExtSvc += [NTupleSvc()]
fileName = "~/work/tracking_data/my/Brunel_BdJPsiKs_MagU"
#fileName="Brunel_my_fisher_debug_10kev"
tupleName = "FILE1 DATAFILE='" + fileName + '.root' + "' TYP='ROOT' OPT='NEW'"
NTupleSvc().Output = [tupleName]
NTupleSvc().OutputLevel = 1
from Configurables import TrackAssociator


def doIt():
    GaudiSequencer("TrackHLT2SeedPatSeq").Members += [
        TrackAssociator("AssocSeed", TracksInContainer="Rec/Track/Seed")
    ]
    GaudiSequencer("MCLinksUnpackSeq").Members = []
    #   from Configurables import PatChecker
    from Configurables import PrChecker
Exemplo n.º 13
0
def rawDataToNtuple(options):
    #	print options
    required_options = [
        "runNumber", "start", "end", "outputdir", "nEvtsPerStep", "totsteps"
    ]

    for check_opts in required_options:
        if not options.has_key(check_opts):
            print "Please specify minimal options!"
            print "Option \'" + check_opts + "\' is missing!"
            sys.exit()

    start = options["start"]
    end = options["end"]
    runNumber = options["runNumber"]
    outputdir = options["outputdir"]
    totsteps = options["totsteps"]
    nEvtsPerStep = options["nEvtsPerStep"]

    from Configurables import DDDBConf, CondDB, CondDBAccessSvc, NTupleSvc, EventClockSvc, Brunel, LHCbApp
    #	if options.has_key("IgnoreHeartBeat"):
    #		CondDB().IgnoreHeartBeat = options["IgnoreHeartBeat"]

    if options.has_key("addCondDBLayer"):
        altag = "HEAD"
        if options.has_key("addCondDBLayer_tag"):
            altag = options["addCondDBLayer_tag"]
        CondDB().addLayer(
            CondDBAccessSvc("myCond",
                            ConnectionString="sqlite_file:" +
                            options["addCondDBLayer"] + "/LHCBCOND",
                            DefaultTAG=altag))

    # Need this line so as to not get db errors- should be fixed properly at some point
    CondDB().IgnoreHeartBeat = True
    CondDB().EnableRunStampCheck = False

    #	customDBs = glob.glob('/group/rich/ActiveDBSlices/*.db')
    #	for db in customDBs:
    #		CondDB().addLayer( CondDBAccessSvc(os.path.basename(db), ConnectionString="sqlite_file:"+db+"/LHCBCOND", DefaultTAG="HEAD") )

    #	importOptions('$STDOPTS/DecodeRawEvent.py')
    #importOptions("$STDOPTS/RootHist.opts")
    #importOptions("$STDOPTS/RawDataIO.opts")
    #DEBUG by DisplayingHitMaps=False
    from Configurables import MDMRich1Algorithm
    mdmAlg = MDMRich1Algorithm("Rich1MDCS")
    mdmAlg.NumberOfEventsPerStep = nEvtsPerStep
    mdmAlg.StoreHistos = False
    mdmAlg.DEBUG = False

    if options.has_key("StoreHistos"):
        mdmAlg.StoreHistos = options["StoreHistos"]

    if options.has_key("DEBUG"):
        mdmAlg.DEBUG = options["DEBUG"]

    print "start step: " + str(start)
    print "stop step: " + str(end)
    print "processing " + str(nEvtsPerStep * (end - start)) + " events"

    tuplestring = "NTuple_Run%i_Steps%04d-%04d.root" % (runNumber, start, end)

    if options.has_key("TupleName"):
        tuplestring = options["TupleName"]

    histoname = "Histos_Run%i_Steps%04d-%04d.root" % (runNumber, start, end)

    if options.has_key("HistoName"):
        histoname = options["HistoName"]

    if outputdir != "":
        tuplestring = "%s/%s" % (outputdir, tuplestring)
        histoname = "%s/%s" % (outputdir, histoname)

    tuplename = "RICHTUPLE1 DATAFILE=\'%s\' TYP=\'ROOT\' OPT=\'NEW\'" % (
        tuplestring)

    # Currently put in manually. Edit here to use correct db and conddb tags
    LHCbApp().DDDBtag = "dddb-20150724"
    LHCbApp().CondDBtag = "cond-20160123"

    if options.has_key("DDDBtag"):
        LHCbApp().DDDBtag = options["DDDBtag"]
    if options.has_key("CondDBtag"):
        LHCbApp().CondDBtag = options["CondDBtag"]

    #customDBs = glob.glob('/group/rich/ActiveDBSlices/*.db')
    #for db in customDBs:
    #	CondDB().addLayer( CondDBAccessSvc(os.path.basename(db), ConnectionString="sqlite_file:"+db+"/LHCBCOND", DefaultTAG="HEAD") )

    ApplicationMgr().TopAlg += [mdmAlg]
    ApplicationMgr().ExtSvc += ['DataOnDemandSvc']
    ApplicationMgr().EvtMax = end * nEvtsPerStep

    # Timing information for application
    from Configurables import AuditorSvc, SequencerTimerTool
    ApplicationMgr().ExtSvc += ['AuditorSvc']
    ApplicationMgr().AuditAlgorithms = True
    AuditorSvc().Auditors += ['TimingAuditor']
    SequencerTimerTool().OutputLevel = 4

    LHCbApp().TimeStamp = True

    HistogramPersistencySvc().OutputFile = histoname
    NTupleSvc().Output = [tuplename]
    EventSelector().PrintFreq = 10
    EventSelector().PrintFreq = nEvtsPerStep
    EventSelector().FirstEvent = start * nEvtsPerStep
    print "First event: " + str(start * nEvtsPerStep)
    print "Last event: " + str(end * nEvtsPerStep)

    #get data, will look in local cluster first, then on castor
    isLocal = True
    if options.has_key("isLocal"):
        isLocal = options["isLocal"]
    DATA_and_Year = (getData(runNumber, start, end, totsteps, isLocal))

    DATA = DATA_and_Year["DATA"]
    if not len(DATA) > 0:
        print "Data not found in local, switching to CASTOR"
        DATA_and_Year = getData(runNumber, start, end, totsteps, not isLocal)
        DATA = DATA_and_Year["DATA"]
    if not len(DATA) > 0:
        print "DATA not found anywhere!"
        sys.exit()
    LHCbApp.DataType = str(DATA_and_Year["year"])

    EventSelector().Input = DATA
    EventClockSvc().EventTimeDecoder = "OdinTimeDecoder"

    appMgr = GaudiPython.AppMgr()
    appMgr.HistogramPersistency = "ROOT"
    #appMgr.OutputLevel=DEBUG
    evtSvc = appMgr.evtSvc()

    esel = appMgr.evtsel()
    esel.PrintFreq = nEvtsPerStep
    appMgr.initialize()

    appMgr.run(nEvtsPerStep * (end - start))
    appMgr.stop()
    appMgr.finalize()
Exemplo n.º 14
0
from Configurables import DummyDedxSimTool
from Configurables import BetheBlochEquationDedxSimTool

if dedxoption == "DummyDedxSimTool":
    dedx_simtool = DummyDedxSimTool("DummyDedxSimTool")
elif dedxoption == "BetheBlochEquationDedxSimTool":
    dedx_simtool = BetheBlochEquationDedxSimTool("BetheBlochEquationDedxSimTool")
    dedx_simtool.material_Z = 2
    dedx_simtool.material_A = 4
    dedx_simtool.scale = 10
    dedx_simtool.resolution = 0.0001

##############################################################################
from Configurables import NTupleSvc
ntsvc = NTupleSvc("NTupleSvc")
ntsvc.Output = ["MyTuples DATAFILE='DCH_digi_ana.root' OPT='NEW' TYP='ROOT'"]
##############################################################################
from Configurables import DCHDigiAlg
dCHDigiAlg = DCHDigiAlg("DCHDigiAlg")
dCHDigiAlg.readout = "DriftChamberHitsCollection"
dCHDigiAlg.drift_velocity = 40#um/ns
dCHDigiAlg.mom_threshold = 0 #GeV
dCHDigiAlg.SimDCHitCollection = "DriftChamberHitsCollection"
dCHDigiAlg.DigiDCHitCollection = "DigiDCHitsCollection"
dCHDigiAlg.AssociationCollection = "DCHAssociationCollectio"
dCHDigiAlg.WriteAna  = True

##############################################################################
# POD I/O
##############################################################################
Exemplo n.º 15
0
    "Track:SubsetTracks",
    "Track:MarlinTrkTracks",
    "Vertex:KinkVertices",
    "Vertex:ProngVertices",
    "Vertex:V0Vertices",
    "ReconstructedParticle:KinkRecoParticles",
    "ReconstructedParticle:ProngRecoParticles",
    "ReconstructedParticle:V0RecoParticles"
]
##############################################################################
from Configurables import GearSvc
gearSvc = GearSvc("GearSvc")
gearSvc.GearXMLFile = "Detector/DetCEPCv4/compact/FullDetGear.xml"
##############################################################################
from Configurables import NTupleSvc
ntsvc = NTupleSvc("NTupleSvc")
ntsvc.Output = ["MyTuples DATAFILE='LCIO_Pan_ana.root' OPT='NEW' TYP='ROOT'"]
##############################################################################
from Configurables import PandoraPFAlg

pandoralg = PandoraPFAlg("PandoraPFAlg")
pandoralg.debug = False
pandoralg.use_dd4hep_geo = False
pandoralg.use_dd4hep_decoder = False
pandoralg.use_preshower = False
pandoralg.WriteAna = True
pandoralg.collections = [
    "MCParticle:MCParticle", "CalorimeterHit:ECALBarrel",
    "CalorimeterHit:ECALEndcap", "CalorimeterHit:ECALOther",
    "CalorimeterHit:HCALBarrel", "CalorimeterHit:HCALEndcap",
    "CalorimeterHit:HCALOther", "CalorimeterHit:MUON", "CalorimeterHit:LCAL",
Exemplo n.º 16
0
    def __apply_configuration__(self):

        from Configurables import (GaudiSequencer, CombineParticles,
                                   OfflineVertexFitter)
        from PhysSelPython.Wrappers import Selection, SelectionSequence, DataOnDemand

        seq = self.getProp("Sequencer")
        if seq == None: raise RuntimeError("ERROR : Sequence not set")

        if self.getProp("RunSelection"):

            # STD particles
            from StandardParticles import StdNoPIDsPions, StdNoPIDsKaons

            # phi -> K+ K-
            Phi2KKName = self.__sel_name__ + "_Phi2KK"
            Phi2KK = CombineParticles(Phi2KKName)
            Phi2KK.DecayDescriptor = "phi(1020) -> K+ K-"
            Phi2KK.CombinationCut = "(ADAMASS('phi(1020)')<75*MeV)"
            Phi2KK.MotherCut = "(ADMASS('phi(1020)')<50*MeV) & (BPVVDCHI2>60) & (MIPDV(PRIMARY)<0.5) & (VFASPF(VCHI2) < 20)"
            Phi2KK.DaughtersCuts = {
                "K+":
                "(PT>300*MeV) & (P>2*GeV) & (MIPDV(PRIMARY) < 0.5) &  (BPVIPCHI2() > 20)",
                "K-":
                "(PT>300*MeV) & (P>2*GeV) & (MIPDV(PRIMARY) < 0.5) &  (BPVIPCHI2() > 20)"
            }
            self.setOptions(Phi2KK)
            Phi2KKSel = Selection(Phi2KKName + 'Sel',
                                  Algorithm=Phi2KK,
                                  RequiredSelections=[StdNoPIDsKaons])

            # Bs -> J/psi phi
            Ds2piPhiName = self.__sel_name__
            Ds2piPhi = CombineParticles(Ds2piPhiName)
            Ds2piPhi.DecayDescriptor = "[D_s+ -> pi+ phi(1020)]cc"
            Ds2piPhi.addTool(OfflineVertexFitter)
            Ds2piPhi.ParticleCombiners.update({"": "OfflineVertexFitter"})
            Ds2piPhi.OfflineVertexFitter.useResonanceVertex = True
            Ds2piPhi.CombinationCut = "(ADAMASS('D_s+')<75*MeV)"
            Ds2piPhi.MotherCut = "(ADMASS('D_s+')<50*MeV) & (BPVDIRA>0.9999) & (BPVVDCHI2>85) & (MIPDV(PRIMARY)<0.1) &  (VFASPF(VCHI2) < 10)"
            Ds2piPhi.DaughtersCuts = {
                "pi+":
                "(PT>300*MeV) & (P>2*GeV) & (MIPDV(PRIMARY) >0.1) & (BPVIPCHI2() > 20)"
            }
            self.setOptions(Ds2piPhi)
            Ds2piPhiSel = Selection(
                Ds2piPhiName + 'Sel',
                Algorithm=Ds2piPhi,
                RequiredSelections=[Phi2KKSel, StdNoPIDsPions])

            # Selection Sequence
            selSeq = SelectionSequence(self.__sel_name__ + 'Seq',
                                       TopSelection=Ds2piPhiSel)

            # Run the selection sequence.
            seq.Members += [selSeq.sequence()]

        # Particle Monitoring plots
        if self.getProp("RunMonitors"):

            from Configurables import ParticleMonitor
            plotter = ParticleMonitor(self.__sel_name__ + "Plots")
            if self.getProp("RunSelection"):
                plotter.Inputs = ['Phys/' + self.__sel_name__ + 'Sel']
            else:
                plotter.Inputs = self.getProp("Candidates")
            plotter.PeakCut = "(ADMASS('D_s+')<100*MeV)"
            plotter.SideBandCut = "(ADMASS('D_s+')>100*MeV)"
            plotter.PlotTools = self.getProp("PlotTools")
            self.setOptions(plotter)
            seq.Members += [plotter]

        # Make a DST ?
        if self.getProp("MakeSelDST"):

            # Prescale
            from Configurables import DeterministicPrescaler
            scaler = DeterministicPrescaler(
                self.__sel_name__ + 'PreScale',
                AcceptFraction=self.getProp("DSTPreScaleFraction"))
            seq.Members += [scaler]
            # Write the DST
            MyDSTWriter = SelDSTWriter(self.__sel_name__ + "DST",
                                       SelectionSequences=[selSeq],
                                       OutputPrefix=self.__sel_name__)
            seq.Members += [MyDSTWriter.sequence()]

        # MC Performance checking ?
        if self.getProp("MCChecks"):

            from Configurables import ParticleEffPurMoni
            mcPerf = ParticleEffPurMoni(Ds2piPhiName + "MCPerf")
            mcPerf.Inputs = ['Phys/' + self.__sel_name__ + 'Sel']
            self.setOptions(mcPerf)
            seq.Members += [mcPerf]

        # Ntuple ?
        if self.getProp("MakeNTuple"):

            outputLevel = INFO

            from Configurables import (
                DecayTreeTuple, TupleToolDecay, TupleToolMCTruth,
                TupleToolMCBackgroundInfo, TupleToolGeometry,
                TupleToolKinematic, TupleToolPrimaries, TupleToolEventInfo,
                MCTupleToolHierarchy, MCTupleToolKinematic, TupleToolPid,
                TupleToolTrackInfo, TupleToolVtxIsoln, LoKi__Hybrid__TupleTool)

            Tuple = DecayTreeTuple(Ds2piPhiName + "Tuple")
            Tuple.Inputs = ["Phys/" + Ds2piPhiName]
            Tuple.Decay = "[D_s+ -> ^pi+ (^phi(1020) => ^K+ ^K-)]cc"
            Tuple.Branches = {
                "pion": "[D_s+ -> ^pi+ (phi(1020) => K+ K-)]cc",
                "kaonplus": "[D_s+ -> pi+ (phi(1020) => ^K+ K-)]cc",
                "kaonminus": "[D_s+ -> pi+ (phi(1020) => K+ ^K-)]cc",
                "phi": "[D_s+ -> pi+ (^phi(1020) => K+ K-)]cc",
                "D_s": "[D_s+]cc :[D_s+ -> pi+ (phi(1020) => K+ K-)]cc"
            }

            Tuple.addTool(TupleToolDecay, name='pion')
            Tuple.addTool(TupleToolDecay, name='phi')
            Tuple.addTool(TupleToolDecay, name='kaonplus')
            Tuple.addTool(TupleToolDecay, name='kaonminus')
            Tuple.addTool(TupleToolDecay, name='D_s')

            # k+ specific
            kaonplusLoKiTool = LoKi__Hybrid__TupleTool('kaonplusLoKiTool')
            kaonplusLoKiTool.Variables = {
                "LOKI_PIDK": "PIDK",
                "LOKI_PIDe": "PIDe",
                "LOKI_PIDpi": "PIDpi",
                "LOKI_PIDp": "PIDp",
                "LOKI_PIDmu": "PIDmu",
                "LOKI_PIDK_PIDpi": "PIDK-PIDpi",
                "LOKI_PIDK_PIDe": "PIDK-PIDe",
                "LOKI_PIDK_PIDmu": "PIDK-PIDmu",
                "LOKI_PIDK_PIDp": "PIDK-PIDp"
            }

            Tuple.kaonplus.addTool(kaonplusLoKiTool, name='kaonplusLoKiTool')
            Tuple.kaonplus.ToolList = [
                'LoKi::Hybrid::TupleTool/kaonplusLoKiTool'
            ]

            # k- specific
            kaonminusLoKiTool = LoKi__Hybrid__TupleTool('kaonminusLoKiTool')
            kaonminusLoKiTool.Variables = {
                "LOKI_PIDK": "PIDK",
                "LOKI_PIDe": "PIDe",
                "LOKI_PIDpi": "PIDpi",
                "LOKI_PIDp": "PIDp",
                "LOKI_PIDmu": "PIDmu",
                "LOKI_PIDK_PIDpi": "PIDK-PIDpi",
                "LOKI_PIDK_PIDe": "PIDK-PIDe",
                "LOKI_PIDK_PIDmu": "PIDK-PIDmu",
                "LOKI_PIDK_PIDp": "PIDK-PIDp"
            }

            Tuple.kaonminus.addTool(kaonminusLoKiTool,
                                    name='kaonminusLoKiTool')
            Tuple.kaonminus.ToolList = [
                'LoKi::Hybrid::TupleTool/kaonminusLoKiTool'
            ]

            # pi+ specific
            pionLoKiTool = LoKi__Hybrid__TupleTool('pionLoKiTool')
            pionLoKiTool.Variables = {
                "LOKI_PIDK": "PIDK",
                "LOKI_PIDe": "PIDe",
                "LOKI_PIDpi": "PIDpi",
                "LOKI_PIDp": "PIDp",
                "LOKI_PIDmu": "PIDmu",
                "LOKI_PIDpi_PIDK": "PIDpi-PIDK",
                "LOKI_PIDpi_PIDe": "PIDpi-PIDe",
                "LOKI_PIDpi_PIDmu": "PIDpi-PIDmu",
                "LOKI_PIDpi_PIDp": "PIDpi-PIDp"
            }

            Tuple.pion.addTool(pionLoKiTool, name='pionLoKiTool')
            Tuple.pion.ToolList = ['LoKi::Hybrid::TupleTool/pionLoKiTool']

            # phi specific
            phiLoKiTool = LoKi__Hybrid__TupleTool('phiLoKiTool')
            phiLoKiTool.Variables = {}

            Tuple.phi.addTool(phiLoKiTool, name='phiLoKiTool')
            Tuple.phi.ToolList = ['LoKi::Hybrid::TupleTool/phiLoKiTool']

            # D_s specific
            DsLoKiTool = LoKi__Hybrid__TupleTool('DsLoKiTool')
            DsLoKiTool.Variables = {}

            Tuple.D_s.addTool(DsLoKiTool, name='DsLoKiTool')
            Tuple.D_s.ToolList = ["LoKi::Hybrid::TupleTool/DsLoKiTool"]

            # Common to all particles
            LoKiTool = LoKi__Hybrid__TupleTool('LoKiTool')
            LoKiTool.Variables = {
                "LOKI_ABSID": "ABSID",
                "LOKI_BPVIPCHI2": "BPVIPCHI2()",
                "LOKI_BPVDIRA": "BPVDIRA",
                "LOKI_BPVLTFITCHI2":
                "BPVLTFITCHI2('PropertimeFitter/properTime:PUBLIC')",
                "LOKI_BPVLTCHI2":
                "BPVLTCHI2('PropertimeFitter/properTime:PUBLIC')",
                "LOKI_BPVLTIME":
                "BPVLTIME('PropertimeFitter/properTime:PUBLIC')",
                "LOKI_BPVVDCHI2": "BPVVDCHI2",
                "LOKI_ID": "ID",
                "LOKI_MIPDV_PRIMARY": "MIPDV(PRIMARY)",
                "LOKI_MIPCHI2DV_PRIMARY": "MIPCHI2DV(PRIMARY)",
                "LOKI_MM": "MM",
                "LOKI_M": "M",
                "LOKI_P": "P",
                "LOKI_PT": "PT",
                "LOKI_TRCHI2": "TRCHI2",
                "LOKI_TRCHI2DOF": "TRCHI2DOF",
                "LOKI_VFASPF_VCHI2": "VFASPF(VCHI2)",
                "LOKI_VFASPF_VDOF": "VFASPF(VDOF)"
            }

            Tuple.addTool(LoKiTool, name='LoKiTool')
            Tuple.ToolList = [
                "LoKi::Hybrid::TupleTool/LoKiTool", "TupleToolEventInfo",
                "TupleToolGeometry", "TupleToolKinematic",
                "TupleToolMCBackgroundInfo", "TupleToolPid",
                "TupleToolPrimaries", "TupleToolTrackInfo",
                "TupleToolVtxIsoln", "TupleToolMCTruth"
            ]

            Tuple.addTool(TupleToolEventInfo)
            Tuple.TupleToolEventInfo.OutputLevel = outputLevel

            Tuple.addTool(TupleToolGeometry)
            Tuple.TupleToolGeometry.OutputLevel = outputLevel

            Tuple.addTool(TupleToolKinematic)
            Tuple.TupleToolKinematic.OutputLevel = outputLevel

            Tuple.addTool(TupleToolMCBackgroundInfo)
            Tuple.TupleToolMCBackgroundInfo.OutputLevel = outputLevel

            Tuple.addTool(MCTupleToolHierarchy)
            Tuple.MCTupleToolHierarchy.OutputLevel = outputLevel

            Tuple.addTool(TupleToolMCTruth)
            Tuple.TupleToolMCTruth.OutputLevel = outputLevel
            Tuple.TupleToolMCTruth.addTool(MCTupleToolKinematic())
            Tuple.TupleToolMCTruth.addTool(MCTupleToolHierarchy())
            Tuple.TupleToolMCTruth.ToolList = [
                "MCTupleToolKinematic", "MCTupleToolHierarchy"
            ]
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.StoreKineticInfo = True
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.StoreVertexInfo = True
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.StorePropertimeInfo = True
            Tuple.TupleToolMCTruth.MCTupleToolKinematic.OutputLevel = outputLevel

            Tuple.addTool(TupleToolPid)
            Tuple.TupleToolPid.OutputLevel = outputLevel

            Tuple.addTool(TupleToolPrimaries)
            Tuple.TupleToolPrimaries.OutputLevel = outputLevel

            Tuple.addTool(TupleToolTrackInfo)
            Tuple.TupleToolTrackInfo.OutputLevel = outputLevel

            Tuple.addTool(TupleToolVtxIsoln)
            Tuple.TupleToolVtxIsoln.OutputLevel = outputLevel

            seq.Members += [Tuple]

            Tuple.NTupleLUN = "DSPHIPI"

            from Configurables import NTupleSvc
            NTupleSvc().Output = [
                "DSPHIPI DATAFILE='DsToPhiPi.root'  TYP='ROOT'  OPT='NEW'"
            ]
Exemplo n.º 17
0
    def expertMonitoring(self, sequence):

        # Define the RICH ntuple file
        if self.getProp("NTupleProduce"):
            from Configurables import NTupleSvc
            NTupleSvc().Output += [
                "RICHTUPLE1 DATAFILE='rich.tuples.root' TYP='ROOT' OPT='NEW'"
            ]

        checks = self.getHistoOptions("Monitors")
        tkTypes = self.getTrackTypes("RecoTrackTypes")

        check = "RichFuncCKResPlots"
        if check in checks:
            if "HistoProduce" in self.richTools().ckResolution().properties():
                self.richTools().ckResolution(
                ).HistoProduce = self.getProp("Histograms") != "None"

        check = "RichPixelPositions"
        if check in checks:
            from Configurables import Rich__Rec__MC__PixelPositionMonitor
            seq = self.newSeq(sequence, check)
            seq.Members += [
                Rich__Rec__MC__PixelPositionMonitor("RiRecPixelPosMoni")
            ]

        check = "HPDHitPlots"
        if check in checks:
            from Configurables import (Rich__Rec__HPDHitsMoni, GaudiSequencer)
            seq = self.newSeq(sequence, check)
            seq.IgnoreFilterPassed = True
            seq.Members += [Rich__Rec__HPDHitsMoni("HPDHitsMoni")]
            if not self.getProp("Simulation"):
                lSeq = self.newSeq(seq, check + "L0")
                lSeq.ReturnOK = True
                lSeq.Members = self.l0Filters() + [
                    Rich__Rec__HPDHitsMoni("HPDL0HitsMoni")
                ]

        check = "RichTrackGeometry"
        if check in checks:
            from Configurables import Rich__Rec__MC__TrackGeomMoni
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRec" + self.trackSelName(trackType) + "GeomMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__TrackGeomMoni, name,
                                       trackType)
                ]

        check = "RichTrackResolution"
        if check in checks:
            from Configurables import Rich__Rec__MC__TrackResolutionMoni
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRec" + self.trackSelName(trackType) + "TkResMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__TrackResolutionMoni,
                                       name, trackType)
                ]

        check = "RichCKThetaResolution"
        if check in checks:
            from Configurables import Rich__Rec__MC__CherenkovAngleMonitor
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRecPhotAng" + self.trackSelName(trackType) + "Moni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__CherenkovAngleMonitor,
                                       name, trackType)
                ]

        check = "RichTrackCKResolutions"
        if check in checks:
            from Configurables import Rich__Rec__MC__CherenkovResMoni
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRec" + self.trackSelName(trackType) + "CKResMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__CherenkovResMoni, name,
                                       trackType)
                ]

        check = "RichPhotonSignal"
        if check in checks:
            from Configurables import Rich__Rec__MC__PhotonSignalMonitor
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRecPhotSig" + self.trackSelName(trackType) + "TkMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__PhotonSignalMonitor,
                                       name, trackType)
                ]

        check = "RichPhotonGeometry"
        if check in checks:
            from Configurables import Rich__Rec__MC__PhotonGeomMonitor
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRecPhotGeom" + self.trackSelName(
                    trackType) + "TkMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__PhotonGeomMonitor, name,
                                       trackType)
                ]

        check = "RichPhotonTrajectory"
        if check in checks:
            from Configurables import Rich__Rec__MC__PhotonTrajectoryMonitor
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRecPhotTraj" + self.trackSelName(
                    trackType) + "TkMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__PhotonTrajectoryMonitor,
                                       name, trackType)
                ]

        check = "RichPhotonRecoCompare"
        if check in checks:
            from Configurables import Rich__Rec__MC__PhotonRecoCompare
            seq = self.newSeq(sequence, check)
            self.toolRegistry().Tools += [
                "Rich::Rec::PhotonRecoUsingQuarticSoln/BaselinePhotonReco"
            ]
            for trackType in tkTypes:
                name = "RiRecPhotCompare" + self.trackSelName(
                    trackType) + "TkMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__PhotonRecoCompare, name,
                                       trackType)
                ]

        check = "PhotonRecoEfficiency"
        if check in checks:

            recotools = [
                "Rich::Rec::PhotonCreator/ForcedRichPhotonCreator",
                "Rich::Rec::PhotonRecoUsingQuarticSoln/ForcedPhotonReco",
                "Rich::Rec::SimplePhotonPredictor/ForcedRichPhotonPredictor"
            ]
            self.toolRegistry().Tools += recotools
            self.recoConf().toolRegistry().Tools += recotools

            seq = self.newSeq(sequence, check)

            for trackType in tkTypes:

                context = self.getTrackContext(trackType)

                from Configurables import (Rich__Rec__PhotonCreator,
                                           Rich__Rec__SimplePhotonPredictor)
                forcedCreator = Rich__Rec__PhotonCreator(
                    context + ".ForcedRichPhotonCreator")
                forcedCreator.MinAllowedCherenkovTheta = [0.0, 0.0, 0.0]
                forcedCreator.MaxAllowedCherenkovTheta = [999, 999, 999]
                forcedCreator.MinPhotonProbability = [1e-99, 1e-99, 1e-99]
                forcedCreator.NSigma = [999, 999, 999]
                forcedCreator.PhotonPredictor = "ForcedRichPhotonPredictor"
                forcedCreator.PhotonRecoTool = "ForcedPhotonReco"
                forcedPredictor = Rich__Rec__SimplePhotonPredictor(
                    context + ".ForcedRichPhotonPredictor")
                forcedPredictor.MinTrackROI = [0.0, 0.0, 0.0]
                forcedPredictor.MaxTrackROI = [9999, 9999, 9999]

                from Configurables import Rich__Rec__MC__PhotonRecoEffMonitor
                name = "RiRecPhotEff" + self.trackSelName(trackType) + "TkMoni"
                mon = self.createMonitor(Rich__Rec__MC__PhotonRecoEffMonitor,
                                         name, trackType)
                seq.Members += [mon]

        check = "RichPhotonRayTracingTests"
        if check in checks:
            from Configurables import Rich__Rec__MC__PhotonRayTraceTest
            seq = self.newSeq(sequence, check)
            self.toolRegistry().Tools += [
                "Rich::Rec::PhotonRecoUsingQuarticSoln/BaselinePhotonReco"
            ]
            for trackType in tkTypes:
                name = "RiRecPhotRayTrace" + self.trackSelName(
                    trackType) + "TkMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__PhotonRayTraceTest, name,
                                       trackType)
                ]

        check = "RichTrackRayTracingTests"
        if check in checks:
            from Configurables import Rich__Rec__MC__PhotonRecoRayTraceTest
            seq = self.newSeq(sequence, check)
            moniA = Rich__Rec__MC__PhotonRecoRayTraceTest(
                "PhotRayTraceTestSimple")
            moniA.FullHPDsInRayTracing = False
            moniB = Rich__Rec__MC__PhotonRecoRayTraceTest(
                "PhotRayTraceTestFull")
            moniB.FullHPDsInRayTracing = True
            seq.Members += [moniA, moniB]

        check = "RichStereoFitterTests"
        if check in checks:
            from Configurables import Rich__Rec__MC__StereoPhotonFitTest
            seq = self.newSeq(sequence, check)
            for trackType in tkTypes:
                name = "RiRecStereoFitter" + self.trackSelName(
                    trackType) + "TkMoni"
                seq.Members += [
                    self.createMonitor(Rich__Rec__MC__StereoPhotonFitTest,
                                       name, trackType)
                ]

        check = "RichGhostTracks"
        if check in checks:
            from Configurables import Rich__Rec__MC__GhostTrackMoni
            seq = self.newSeq(sequence, check)
            seq.Members += [
                self.createMonitor(Rich__Rec__MC__GhostTrackMoni,
                                   "RichGhostsMoni")
            ]

        check = "RichDataObjectChecks"
        if check in checks:
            from Configurables import Rich__Rec__DataObjVerifier
            seq = self.newSeq(sequence, check)
            moni = Rich__Rec__DataObjVerifier("RichRecObjPrint")
            moni.PrintPixels = True
            moni.PrintTracks = True
            moni.PrintSegments = True
            moni.PrintPhotons = True
            seq.Members += [moni]

        check = "RichRecoTiming"
        if check in checks:
            from Configurables import (AuditorSvc, ChronoAuditor,
                                       Rich__Rec__TimeMonitor)

            # Enable ChronoAuditor
            chronoAuditor = "ChronoAuditor"
            if chronoAuditor not in AuditorSvc().Auditors:
                AuditorSvc().Auditors += [chronoAuditor]
            ChronoAuditor().Enable = True

            seq = self.newSeq(sequence, check)

            cont = self.getProp("Context")

            # RICH reconstruction only (tracks,pixels,photons)
            moni = self.createMonitor(Rich__Rec__TimeMonitor, "RichRecoTime")
            moni.TimingName = "RichRecInit" + cont + "Seq"
            moni.Algorithms = [moni.TimingName]
            seq.Members += [moni]

            # RICH PID only
            moni = self.createMonitor(Rich__Rec__TimeMonitor, "RichPIDTime")
            moni.TimingName = "Rich" + cont + "PIDSeq"
            moni.Algorithms = [moni.TimingName]
            seq.Members += [moni]

            # overall RICH reconstruction
            moni = self.createMonitor(Rich__Rec__TimeMonitor,
                                      "OverallRichTime")
            moni.TimingName = "RecoRICHSeq"
            moni.Algorithms = [moni.TimingName]
            seq.Members += [moni]

            # overall track reconstruction
            moni = self.createMonitor(Rich__Rec__TimeMonitor,
                                      "OverallTrackTime")
            moni.TimingName = "RecoTrSeq"
            moni.Algorithms = [moni.TimingName]
            seq.Members += [moni]

        check = "RichTracksToTextFile"
        if check in checks:

            from Configurables import Rich__Rec__MC__DumpRichTracksToTextFileAlg as RichTracksToText
            moni = self.createMonitor(RichTracksToText, "RichTracksToText")
            sequence.Members += [moni]

        check = "RichHitsToTextFile"
        if check in checks:

            from Configurables import Rich__Rec__MC__DumpRichHitsToTextFileAlg as RichHitsToText
            moni = self.createMonitor(RichHitsToText, "RichHitsToText")
            sequence.Members += [moni]

        check = "RichPerfFromData"
        if check in checks:
            pass
Exemplo n.º 18
0
from Configurables import LHCbApp, ApplicationMgr, DataOnDemandSvc, Boole
from Configurables import SimConf, DigiConf, DecodeRawEvent
from Configurables import CondDB, DDDBConf

# ROOT persistency for histograms
importOptions('$STDOPTS/RootHist.opts')
from Configurables import RootHistCnv__PersSvc

RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True
# RootHistSvc('RootHistSvc').OutputFile = 'histo.root'
HistogramPersistencySvc().OutputFile = fileName.replace(".root",
                                                        "") + '_histos.root'

from Configurables import NTupleSvc

NTupleSvc().Output = [
    "FILE1 DATAFILE='" + fileName.replace(".root", "") +
    "_tuple.root' TYP='ROOT' OPT='NEW'"
]

from LinkerInstances.eventassoc import *
import ROOT as R
import array


def resetSipmVals(sipimValPtr):
    for layer in sipimValPtr:
        for adcID in layer:
            for adcChan in layer[adcID]:
                adcChan[0] = 0