######################################################################## from os import environ import math from Gaudi.Configuration import * #from GaudiPython import AppMgr from Configurables import DecayTreeTuple, BTaggingTool, SubstitutePID, TrackScaleState from Configurables import CombineParticles, FilterDesktop, TupleToolDecayTreeFitter, TupleToolDecay from Configurables import TupleToolTrigger, BackgroundCategory, TupleToolTISTOS, TupleToolRecoStats, TupleToolTagging from Configurables import DaVinci, HltSelReportsDecoder, HltVertexReportsDecoder, HltDecReportsDecoder, LoKi__Hybrid__TupleTool, TupleToolJets from DecayTreeTuple.Configuration import * from StrippingConf.Configuration import StrippingConf, StrippingStream from StrippingSettings.Utils import strippingConfiguration from StrippingArchive.Utils import buildStreams, cloneLinesFromStream from Configurables import CombineParticles from StrippingArchive import strippingArchive trigger_list = [ 'L0HadronDecision', 'L0ElectronDecision', 'L0ElectronHiDecision', 'L0MuonDecision', 'L0DiMuonDecision', # 'Hlt1SingleMuonNoIPDecision', # 'Hlt1SingleMuonHighPTDecision', # 'Hlt1DiMuonHighMassDecision', # 'Hlt1DiMuonLowMassDecision', 'Hlt1GlobalDecision', 'Hlt1TrackAllL0Decision', 'Hlt1SingleMuonNoIPDecision', 'Hlt1SingleMuonHighPTDecision', 'Hlt1TrackMuonDecision', 'Hlt1MuTrackDecision', # 'Hlt1GlobalDecision', 'Hlt2TopoOSTF2BodyDecision', 'Hlt2TopoOSTF3BodyDecision', 'Hlt2TopoOSTF4BodyDecision', 'Hlt2Topo2BodySimpleDecision', 'Hlt2Topo3BodySimpleDecision', 'Hlt2Topo4BodySimpleDecision', 'Hlt2Topo2BodyBBDTDecision', 'Hlt2Topo3BodyBBDTDecision', 'Hlt2Topo4BodyBBDTDecision', 'Hlt2TopoMu2BodyBBDTDecision', 'Hlt2TopoMu3BodyBBDTDecision', 'Hlt2TopoMu4BodyBBDTDecision', 'Hlt2TopoE2BodyBBDTDecision', 'Hlt2TopoE3BodyBBDTDecision', 'Hlt2TopoE4BodyBBDTDecision', # 'Hlt2MuonFromHLT1Decision', 'Hlt2SingleMuonDecision', # 'Hlt2SingleMuonHighPTDecision', # 'Hlt2SingleMuonLowPTDecision', # 'Hlt2DisplVerticesLowMassSingleDecision', # 'Hlt2DisplVerticesHighMassSingleDecision', # 'Hlt2DisplVerticesDoubleDecision', # 'Hlt2DisplVerticesSinglePostScaledDecision', # 'Hlt2DisplVerticesHighFDSingleDecision', # 'Hlt2DisplVerticesSingleDownDecision', # 'Hlt2DiMuonDecision', # 'Hlt2DiMuonLowMassDecision', # 'Hlt2DiMuonBDecision', 'Hlt2DiMuonDetachedDecision', 'Hlt2MuTrackDecision', 'Hlt2GlobalDecision' ] ########################################################################### # First run the stripping eventNodeKiller = EventNodeKiller('Stripkiller') eventNodeKiller.Nodes = [ '/Event/AllStreams', '/Event/Strip' ] stripping = 'stripping20' #get the configuration dictionary from the database config = strippingConfiguration(stripping) #get the line builders from the archive archive = strippingArchive(stripping) streams = buildStreams(stripping = config, archive = archive) MyStream = StrippingStream("MyStream") MyLines = [ 'Strippingb2LcMuXB2DMuNuXLine' ] for stream in streams: for line in stream.lines: if line.name() in MyLines: print 'Strippingb2LcMuXB2DMuNuXLine' MyStream.appendLines( [ line ] ) from Configurables import ProcStatusCheck filterBadEvents = ProcStatusCheck() sc = StrippingConf( Streams = [ MyStream ], MaxCandidates = 2000, AcceptBadEvents = False, BadEventSelection = filterBadEvents ) ###################################################################################################### ########## Tree for Lc* -> Lc pi pi ################################################################## LcStarMassCut = "(M>2543) & (M<2675)" Lc_star = CombineParticles("Lc_star") Lc_star.Inputs = ["Phys/StdAllLoosePions/Particles", "Phys/Lc2PKPiforB2DMuNuX/Particles"] Lc_star.DecayDescriptors = ["[Lambda_c(2595)+ -> Lambda_c+ pi+ pi-]cc"] Lc_star.MotherCut = LcStarMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) " Lc_star.DaughtersCuts = { "pi+": "PT>0", "pi-": "PT>0", "Lambda_c+": "ADMASS('Lambda_c+') < 50.0 *MeV" } LbMassCut = "(M<6500)" Lb_SL = CombineParticles("Lb_SL") Lb_SL.Inputs = [ "Phys/MuforB2DMuNuX/Particles", "Phys/Lc_star/Particles"] Lb_SL.DecayDescriptors = [ "[Lambda_b0 -> Lambda_c(2595)+ mu-]cc" ] Lb_SL.MotherCut = LbMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) & (BPVDIRA>0.999)" decay0 = "[Lambda_b0 -> ^(Lambda_c(2595)+ -> ^(Lambda_c+ -> ^K- ^p+ ^pi+ ) ^pi+ ^pi-) ^mu- ]CC" Lb_SL_OfflineTree = DecayTreeTuple("Lb_SL_OfflineTree") Lb_SL_OfflineTree.Inputs = ["Phys/Lb_SL/Particles"] Lb_SL_OfflineTree.Decay = decay0 Lb_SL_OfflineTree.Branches = { "Lambda_b0": "[Lambda_b0 -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) mu- ]CC", "Lambda_c_STAR": "[Lambda_b0 -> ^(Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) mu- ]CC", "mu": "[Lambda_b0 -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) ^mu- ]CC", "Lambda_c": "[Lambda_b0 -> (Lambda_c(2595)+ -> ^(Lambda_c+ -> K- p+ pi+ ) pi+ pi-) mu- ]CC", "pi_plus": "[Lambda_b0 -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) ^pi+ pi-) mu- ]CC", "pi_minus": "[Lambda_b0 -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ ^pi-) mu- ]CC", "p": "[Lambda_b0 -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- ^p+ pi+ ) pi+ pi-) mu- ]CC", "pi_Lc": "[Lambda_b0 -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ ^pi+ ) pi+ pi-) mu- ]CC", "K_Lc": "[Lambda_b0 -> (Lambda_c(2595)+ -> (Lambda_c+ -> ^K- p+ pi+ ) pi+ pi-) mu- ]CC" } pi0containers = ['StdLooseMergedPi0', 'StdLoosePi024e', 'StdLoosePi02gee', 'StdLoosePi02gg'] ########## Tree for Lb0 -> (X+ -> Lc*+ pi0) mu- ################################################### X_pi0 = CombineParticles('X_pi0') X_pi0.Inputs = ['Phys/Lc_star/Particles'] for pc in pi0containers: X_pi0.Inputs.append('Phys/%s/Particles' % pc) X_pi0.DecayDescriptors = ['[Sigma_c+ -> Lambda_c(2595)+ pi0]cc'] X_pi0.MotherCut = LbMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) " X_pi0.DaughtersCuts = { "pi0": "(PT>0)", 'Lambda_c(2595)+': '(PT>0)' } X_pi0.CombinationCut = "ACUTDOCA(1.0*mm,'')" Lb_X_pi0 = CombineParticles("Lb_X_pi0") Lb_X_pi0.Inputs = [ "Phys/MuforB2DMuNuX/Particles", "Phys/X_pi0/Particles"] Lb_X_pi0.DecayDescriptors = [ "[Lambda_b0 -> Sigma_c+ mu-]cc" ] Lb_X_pi0.MotherCut = LbMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) & (BPVDIRA>0.999)" decay_pi0 = "[Lambda_b0 -> ^(Sigma_c+ -> ^(Lambda_c(2595)+ -> ^(Lambda_c+ -> ^K- ^p+ ^pi+ ) ^pi+ ^pi-) ^pi0) ^mu- ]CC" Lb_X_pi0_OfflineTree = DecayTreeTuple("Lb_X_pi0_OfflineTree") Lb_X_pi0_OfflineTree.Inputs = ["Phys/Lb_X_pi0/Particles"] Lb_X_pi0_OfflineTree.Decay = decay_pi0 Lb_X_pi0_OfflineTree.Branches = { "Lambda_b0": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi0) mu- ]CC", "X": "[Lambda_b0 -> ^(Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi0) mu- ]CC", "Lambda_c_STAR": "[Lambda_b0 -> (Sigma_c+ -> ^(Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi0) mu- ]CC", "pi0": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) ^pi0) mu- ]CC", "pi_plus": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) ^pi+ pi-) pi0) mu- ]CC", "pi_minus": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ ^pi-) pi0) mu- ]CC", "pi_plus_Lc": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ ^pi+ ) pi+ pi-) pi0) mu- ]CC", "p": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- ^p+ pi+ ) pi+ pi-) pi0) mu- ]CC", "K": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> ^K- p+ pi+ ) pi+ pi-) pi0) mu- ]CC", "mu": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi0) ^mu- ]CC", } ########## Tree for Lb0 -> (X+ -> Lc*+ gamma) mu- ################################################### X_gamma = CombineParticles('X_gamma') X_gamma.Inputs = ['Phys/Lc_star/Particles'] for g in ['StdAllLooseGammaDD', 'StdAllLooseGammaLL', 'StdAllTightGammaDD', 'StdAllTightGammaLL', 'StdAllTightSymGammaDD', 'StdAllTightSymGammaLL', 'StdDiElectronGamma']: X_pi0.Inputs.append('Phys/%s/Particles' % g) X_gamma.DecayDescriptors = ['[Sigma_c+ -> Lambda_c(2595)+ gamma]cc'] X_gamma.MotherCut = LbMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) " X_gamma.DaughtersCuts = { "gamma": "(PT>0)", 'Lambda_c(2595)+': '(PT>0)' } X_gamma.CombinationCut = "ACUTDOCA(1.0*mm,'')" Lb_X_gamma = CombineParticles("Lb_X_gamma") Lb_X_gamma.Inputs = [ "Phys/MuforB2DMuNuX/Particles", "Phys/X_pi0/Particles"] Lb_X_gamma.DecayDescriptors = [ "[Lambda_b0 -> Sigma_c+ mu-]cc" ] Lb_X_gamma.MotherCut = LbMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) & (BPVDIRA>0.999)" decay_gamma = "[Lambda_b0 -> ^(Sigma_c+ -> ^(Lambda_c(2595)+ -> ^(Lambda_c+ -> ^K- ^p+ ^pi+ ) ^pi+ ^pi-) ^gamma) ^mu- ]CC" Lb_X_gamma_OfflineTree = DecayTreeTuple("Lb_X_gamma_OfflineTree") Lb_X_gamma_OfflineTree.Inputs = ["Phys/Lb_X_gamma/Particles"] Lb_X_gamma_OfflineTree.Decay = decay_gamma Lb_X_gamma_OfflineTree.Branches = { "Lambda_b0": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) gamma) mu- ]CC", "X": "[Lambda_b0 -> ^(Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) gamma) mu- ]CC", "Lambda_c_STAR": "[Lambda_b0 -> (Sigma_c+ -> ^(Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) gamma) mu- ]CC", "gamma": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) ^gamma) mu- ]CC", "pi_plus": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) ^pi+ pi-) gamma) mu- ]CC", "pi_minus": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ ^pi-) gamma) mu- ]CC", "pi_plus_Lc": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ ^pi+ ) pi+ pi-) gamma) mu- ]CC", "p": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- ^p+ pi+ ) pi+ pi-) gamma) mu- ]CC", "K": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> ^K- p+ pi+ ) pi+ pi-) gamma) mu- ]CC", "mu": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) gamma) ^mu- ]CC", } ########## Tree for Lb0 -> (X+ -> Lc*+ pi+ pi-) mu- ############################################### X_2pi = CombineParticles('X_2pi') X_2pi.Inputs = ['Phys/Lc_star/Particles', 'Phys/StdAllLoosePions/Particles'] X_2pi.DecayDescriptors = ['[Sigma_c+ -> Lambda_c(2595)+ pi+ pi-]cc'] X_2pi.MotherCut = LbMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) " X_2pi.DaughtersCuts = { "pi+": "(PT>0) & (PROBNNghost<0.4)", 'pi-': "(PT>0) & (PROBNNghost<0.4)", 'Lambda_c(2595)+': '(PT>0)' } X_2pi.CombinationCut = "ACUTDOCA(1.0*mm,'')" Lb_X_2pi = CombineParticles("Lb_X_2pi") Lb_X_2pi.Inputs = [ "Phys/MuforB2DMuNuX/Particles", "Phys/X_2pi/Particles"] Lb_X_2pi.DecayDescriptors = [ "[Lambda_b0 -> Sigma_c+ mu-]cc" ] Lb_X_2pi.MotherCut = LbMassCut + " & (VFASPF(VCHI2/VDOF) < 7.0) & (BPVDIRA>0.999)" decay_2pi = "[Lambda_b0 -> ^(Sigma_c+ -> ^(Lambda_c(2595)+ -> ^(Lambda_c+ -> ^K- ^p+ ^pi+ ) ^pi+ ^pi-) ^pi+ ^pi-) ^mu- ]CC" Lb_X_2pi_OfflineTree = DecayTreeTuple("Lb_X_2pi_OfflineTree") Lb_X_2pi_OfflineTree.Inputs = ["Phys/Lb_X_2pi/Particles"] Lb_X_2pi_OfflineTree.Decay = decay_2pi Lb_X_2pi_OfflineTree.Branches = { "Lambda_b0": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi+ pi-) mu- ]CC", "X": "[Lambda_b0 -> ^(Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi+ pi-) mu- ]CC", "Lambda_c_STAR": "[Lambda_b0 -> (Sigma_c+ -> ^(Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi+ pi-) mu- ]CC", "pi_plus_X": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) ^pi+ pi-) mu- ]CC", "pi_minus_X": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi+ ^pi-) mu- ]CC", "pi_plus": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) ^pi+ pi-) pi+ pi-) mu- ]CC", "pi_minus": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ ^pi-) pi+ pi-) mu- ]CC", "pi_plus_Lc": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ ^pi+ ) pi+ pi-) pi+ pi-) mu- ]CC", "p": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- ^p+ pi+ ) pi+ pi-) pi+ pi-) mu- ]CC", "K": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> ^K- p+ pi+ ) pi+ pi-) pi+ pi-) mu- ]CC", "mu": "[Lambda_b0 -> (Sigma_c+ -> (Lambda_c(2595)+ -> (Lambda_c+ -> K- p+ pi+ ) pi+ pi-) pi+ pi-) ^mu- ]CC", } ############################## Configuring all DecayTreeTuples ####################################### from Configurables import TupleToolNeutrinoReco from Configurables import TupleToolKinematic from Configurables import TupleToolGeometry from Configurables import TupleToolTrackIsolation combine_list = [Lc_star, X_pi0, X_2pi, X_gamma] combine_list += [Lb_X_pi0, Lb_X_2pi, Lb_X_gamma, Lb_SL] DTTlist = [Lb_X_pi0_OfflineTree, Lb_X_2pi_OfflineTree, Lb_X_gamma_OfflineTree, Lb_SL_OfflineTree] for DTT in DTTlist: DTT.ToolList = [ "TupleToolKinematic", "TupleToolPid", "TupleToolGeometry", "TupleToolPrimaries", "TupleToolTrackInfo", "TupleToolEventInfo", "TupleToolRecoStats", "TupleToolAngles", "TupleToolNeutrinoReco", "TupleToolMCBackgroundInfo", "TupleToolMCTruth", "TupleToolJets", 'TupleToolTrigger', 'TupleToolTISTOS', 'TupleToolRICHPid', 'TupleToolDira', 'TupleToolEventInfo', 'TupleToolPropertime', 'TupleToolRecoStats', 'TupleToolTrackPosition' ] DTT.addTool( TupleToolTrigger, name='TupleToolTrigger' ) DTT.TupleToolTrigger.Verbose = True DTT.TupleToolTrigger.TriggerList = trigger_list DTT.addTool( TupleToolTISTOS, name='TupleToolTISTOS' ) DTT.TupleToolTISTOS.Verbose = True DTT.TupleToolTISTOS.TriggerList = trigger_list DTT.ToolList += [ "TupleToolTISTOS" ] DTT.addTool( TupleToolNeutrinoReco, name = "TupleToolNeutrinoReco" ) DTT.TupleToolNeutrinoReco.Verbose = True DTT.TupleToolNeutrinoReco.MotherMass = 5619.5 # MeV DTT.TupleToolNeutrinoReco.ExtraName = 'mLb' DTT.addTool( TupleToolKinematic, name = "TupleToolKinematic" ) DTT.TupleToolKinematic.Verbose = True DTT.addTool( TupleToolGeometry, name = "TupleToolGeometry" ) DTT.TupleToolGeometry.Verbose = True DTT.addTool(TupleToolRecoStats, name="TupleToolRecoStats") DTT.TupleToolRecoStats.Verbose = True DTT.UseLabXSyntax = True DTT.RevertToPositiveID = False DTT.addTupleTool('TupleToolTrackIsolation/TrackIsolation') DTT.TrackIsolation.MinConeAngle = 0.5 DTT.TrackIsolation.MaxConeAngle = 1.5 DTT.TrackIsolation.StepSize = 0.1 DTT.TrackIsolation.Verbose = True ################################################## from Configurables import DaVinci #DaVinci().EventPreFilters = fltrs.filters('Filters') DaVinci().EvtMax = -1 # Number of events DaVinci().SkipEvents = 0 # Events to skip DaVinci().PrintFreq = 10000 DaVinci().Simulation = False DaVinci().Lumi = True DaVinci().appendToMainSequence( [ eventNodeKiller ] ) DaVinci().appendToMainSequence( [ sc.sequence() ] ) DaVinci().UserAlgorithms = [ HltSelReportsDecoder(), HltVertexReportsDecoder(), HltDecReportsDecoder()] # Add particles for part in combine_list: DaVinci().UserAlgorithms.append(part) for DTT in DTTlist: DaVinci().UserAlgorithms.append(DTT) DaVinci().TupleFile = "Lb_Lcstarmunu.root" #DaVinci().CondDBtag = "Sim08-20130503-1-vc-md100" #DaVinci().DDDBtag = "Sim08-20130503-1" #appMgr = AppMgr() #appMgr.initialize() #appMgr.run( DaVinci().EvtMax )