def MakeDecayTreeTulple(name, location, decay_channel, TupleToolList): # create the tuple dtt = DecayTreeTuple(name) dtt.Inputs = [location] dtt.Decay = decay_channel # AddToople tool if TupleToolList is not None and len(TupleToolList) > 0: for TupleTool in TupleToolList: ok_module = TestModule(TupleTool) if ok_module: dtt.addTupleTool(TupleTool) else: print "Cannot add TupleTool {}, did you import it ?".format( TupleTool) return dtt
"TupleToolKinematic", "TupleToolPropertime", "TupleToolRecoStats", "TupleToolTrackInfo", "TupleToolTISTOS", "TupleToolBremInfo", "TupleToolPhotonInfo"#, ,"TupleToolTrackIsolation" , "TupleToolANNPID" ] # Probably need to add many more Tools. LoKi_All=tupleB.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All") LoKi_All.Variables = { 'MINIPCHI2' : "MIPCHI2DV(PRIMARY)", 'MINIP' : "MIPDV(PRIMARY)", 'IPCHI2_OWNPV' : "BPVIPCHI2()", 'IP_OWNPV' : "BPVIP()" } LoKi_lplus=tupleB.lplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_lplus") LoKi_lplus.Variables = { 'PIDmu' : "PIDmu", 'ghost' : "TRGHP", 'TRACK_CHI2' : "TRCHI2DOF", 'NNK' : "PPINFO(PROBNNK)",
def execute_option_file(path): # ================= BEGIN EDIT AREA ======================= tuplename = "Bu2LLK_meLine" simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles" data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles" decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC" branches = { # Dictionary for the branches to write in the tuple "B" : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC", "Psi" : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC", "muplus" : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC", "eminus" : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC", "Kplus" : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC" } toollist = [ "TupleToolBremInfo" #Bremsstrahlung information #, "TupleToolGeometry" #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV) , "TupleToolKinematic" #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT) #, "TupleToolEventInfo" #Event information such as run number, polarity, GPS time etc. #, "TupleToolPropertime" #proper lifetime of reconstructed particles #, "TupleToolAngles" #decay angles of charged tracks #, "TupleToolTrigger" #, "TupleToolTrackInfo" #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track... #, "TupleToolPrimaries" #Number and coordinates of all primary vertices #, "TupleToolDira" #, "TupleToolTrackPosition" #Plot the X/Y position at a given Z (default: 2500 = TTstation) #, "TupleToolRecoStats" #, "TupleToolIsolationTwoBody" #degree of isolation of two particles with common mother from Bsmumu #, "TupleToolANNPID" #V2,V3,... ProbNN variables #, "TupleToolCaloHypo" #, "TupleToolL0Calo" ] # ================= END EDIT AREA ======================= # ================= BEGIN DO NOT EDIT HERE ======================= from Configurables import GaudiSequencer MySequencer = GaudiSequencer('Sequence') #Check whether it is a DST or MDST file import os.path extension = os.path.splitext(path)[1] print extension if extension.lower() == ".dst": DaVinci().InputType = 'DST' elif extension.lower() == ".mdst": DaVinci().InputType = 'MDST' else: raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path)) #Kill some nodes if micro dst-file if DaVinci().InputType == 'MDST': from Configurables import EventNodeKiller eventNodeKiller = EventNodeKiller('DAQkiller') eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec'] MySequencer.Members+=[eventNodeKiller] #DecayTreeTuple -> Fills information about particles, vertices and daughters ntuple = DecayTreeTuple(tuplename) if DaVinci().Simulation is True: # for MC ntuple.Inputs = [simulation_inputstring] elif DaVinci().Simulation is False: # for Tuple ntuple.Inputs = [data_inputstring] else: raise Exception(" `DaVinci().Simulation` not set.") ntuple.Decay = decaydescriptor ntuple.addBranches(branches) ntuple.TupleName = "DecayTree" #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used ntuple.ToolList = toollist MySequencer.Members.append(ntuple) # ================= END DO NOT EDIT HERE ======================= if DaVinci().Simulation is True: from Configurables import BackgroundCategory backgroundinfo = ntuple.addTupleTool("TupleToolMCBackgroundInfo") #Fills the background category backgroundinfo.addTool(BackgroundCategory('BackgroundCategory')) backgroundinfo.BackgroundCategory.SoftPhotonCut = 100000000000. #Ignores all photons MCTruth=ntuple.addTupleTool("TupleToolMCTruth") #Saves information of MC particle associated to the current particle (you can add tools to it itself!) MCTruth.addTupleTool("MCTupleToolHierarchy") #True IDs of mother and grandmother particles # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ================== # LOKI TupleTool LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool") LoKi.Variables = { "ETA" : "ETA", "PHI" : "PHI" #Azimuthal angle } #Track isolation if(False): if DaVinci().InputType != 'MDST': ntuple.ToolList += ["TupleToolTrackIsolation"] # PID TupleTool if(True): pid = ntuple.addTupleTool("TupleToolPid") #PID information for charged particles pid.Verbose = True #More information like isMuonLoose etc. #TISTOS TupleTool if(False): from Configurables import TupleToolTISTOS L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ] ## ['Muon', 'DiMuon', ' Hadron', 'Electron', 'Photon','PhotonHi','ElectronHi'] Hlt1Triggers = [ "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"] Hlt2Triggers = [ ## muon lines "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision", "Hlt2DiMuonDecision", "Hlt2DiMuonLowMassDecision", "Hlt2DiMuonJPsiDecision", "Hlt2DiMuonJPsiHighPTDecision", "Hlt2DiMuonPsi2SDecision", "Hlt2DiMuonDetachedDecision", "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision", ## hadron/Topo lines "Hlt2B2HHDecision", "Hlt2DiMuonBDecision", "Hlt2DiMuonZDecision", "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision", "Hlt2TopoE2BodyBBDTDecision", "Hlt2TopoE3BodyBBDTDecision", "Hlt2TopoE4BodyBBDTDecision", "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision", "Hlt2Topo4BodyBBDTDecision", ##others "Hlt2PassThroughDecision", "Hlt2TransparentDecision", ## inclusive decisions "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision", "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision" ] triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers ntuple.addTupleTool("TupleToolTISTOS") ntuple.TupleToolTISTOS.VerboseL0 = True ntuple.TupleToolTISTOS.VerboseHlt1 = True ntuple.TupleToolTISTOS.VerboseHlt2 = True ntuple.TupleToolTISTOS.FillL0 = True ntuple.TupleToolTISTOS.FillHlt1 = True ntuple.TupleToolTISTOS.FillHlt2 = True ntuple.TupleToolTISTOS.OutputLevel = INFO ntuple.TupleToolTISTOS.TriggerList = triggerList #DecayTreeFitter if(False): fitter = ntuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI") fitter.constrainToOriginVertex = False fitter.daughtersToConstrain = [ "J/psi(1S)" ] fitter.Verbose = True #Isolation tool from Alex weightsfolder = "./" if(False): from Configurables import TupleToolApplyIsolation ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard") ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard" ntuple.B.TupleToolApplyIsolationHard.WeightsFile= weightsfolder+"weightsHard.xml" ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft") ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft" ntuple.B.TupleToolApplyIsolationSoft.WeightsFile= weightsfolder+"weightsSoft.xml" ntuple.B.addTupleTool("TupleToolVtxIsoln") #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3 #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3 #Tool from B2ee if(False): from Configurables import TupleToolMuonVariables ntuple.addTupleTool("TupleToolMuonVariables") if DaVinci().InputType == 'MDST': ntuple.TupleToolMuonVariables.TrackContainer = "/Event/Leptonic/Rec/Track/Best" #Change in case of MDST! ntuple.TupleToolMuonVariables.BDTSRootFile = weightsfolder+"HflatBDTS_7Dec.root" ntuple.TupleToolMuonVariables.BDTSXMLFile = weightsfolder+"TMVA_7Dec.weights.xml" #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters) if(True): #Change this value if you don't want to use this tool from Configurables import TupleToolTrackHits, STOfflinePosition trackhits = ntuple.addTupleTool("TupleToolTrackHits") trackhits.Verbose = True if DaVinci().InputType == 'MDST': from Configurables import MeasurementProvider ntuple.addTool(MeasurementProvider('MeasProvider')) ntuple.MeasProvider.RootInTES = "/Event/Leptonic/" #Change Leptonic for your stream-name in case of MDST trackhits.MeasurementProvider = ntuple.MeasProvider itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition') #avoid crashes from missing IT channels itClusterPosition.DetType = 'IT' #Settings for TupleToolAllPhotons (only works for fullDST files) #Should be always added to only one branch if(DaVinci().InputType == 'DST'): if(True): from Configurables import TupleToolAllPhotons, STOfflinePosition allphotons = ntuple.eminus.addTupleTool("TupleToolAllPhotons") allphotons.MCTruth = True allphotons.PhotonsLocation = "/Event/Phys/StdVeryLooseAllPhotons/Particles" itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition') #avoid crashes from missing IT channels itClusterPosition.DetType = 'IT' #allphotons.PhotonsLocation = "/Event/Phys/StdLooseAllPhotons/Particles" #Settings for TupleToolBremRemover #Should be always added to specific branches if(True): from Configurables import TupleToolBremRemover bremremover = ntuple.eminus.addTupleTool("TupleToolBremRemover") if DaVinci().Simulation is True: bremremover.TRUEP = True #TupleToolTrackKink: Refits the track and outputs kink as point with highest Chi2 variation (should be run last because of the refit) if(False): ntuple.eminus.addTupleTool("TupleToolTrackKink") # ================= END EDIT TUPLETOOLS WITH OPTIONS ================== ################################ ### DaVinci configuration #### ################################ DaVinci().UserAlgorithms = [MySequencer] DaVinci().MoniSequence += [ntuple] DaVinci().EvtMax = -1 DaVinci().SkipEvents = 0 DaVinci().Lumi = True
from GaudiConf import IOHelper from Configurables import DaVinci, DecayTreeTuple from DecayTreeTuple.Configuration import * # Stream and stripping line we want to use stream = 'AllStreams' line = 'D2hhCompleteEventPromptDst2D2RSLine' # Create an ntuple to capture D*+ decays from the StrippingLine line dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKpi') dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)] # Note that we mark all particles, otherwise the branches won't work dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^pi+) ^pi+]CC' track_tool = dtt.addTupleTool('TupleToolTrackInfo') track_tool.Verbose = True dtt.addTupleTool('TupleToolPrimaries') dtt.addBranches({ 'Dstar': '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC', 'D0': '[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC', 'Kminus': '[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC', 'piplus': '[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC', 'pisoft': '[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC' }) dtt.D0.addTupleTool('TupleToolPropertime') # Configure DaVinci DaVinci().UserAlgorithms += [dtt] DaVinci().InputType = 'DST' DaVinci().TupleFile = 'DVntuple.root'
from GaudiConf import IOHelper from Configurables import DaVinci, DecayTreeTuple from DecayTreeTuple.Configuration import * # Stream and stripping line we want to use stream = "AllStreams" line = "D2hhCompleteEventPromptDst2D2RSLine" # Create an ntuple to capture D*+ decays from the StrippingLine line dtt = DecayTreeTuple("TupleDstToD0pi_D0ToKpi") dtt.Inputs = ["/Event/{0}/Phys/{1}/Particles".format(stream, line)] dtt.Decay = "[D*(2010)+ -> (D0 -> K- pi+) pi+]CC" track_tool = dtt.addTupleTool("TupleToolTrackInfo") track_tool.Verbose = True dtt.addTupleTool("TupleToolPrimaries") dtt.addBranches( { "Dstar": "[D*(2010)+ -> (D0 -> K- pi+) pi+]CC", "D0": "[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC", "Kminus": "[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC", "piplus": "[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC", "pisoft": "[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC", } ) dtt.D0.addTupleTool("TupleToolPropertime") # Configure DaVinci DaVinci().UserAlgorithms += [dtt] DaVinci().InputType = "DST"
"TupleToolIsolationTwoBody", "TupleToolRecoStats", "TupleToolAngles", "TupleToolANNPID", "TupleToolMCBackgroundInfo", "TupleToolMCTruth", "TupleToolTrigger", "TupleToolDira", "TupleToolEventInfo", "TupleToolPropertime", "TupleToolRecoStats", ] #Calc Related Info Variables: coneIso = tuple.addTupleTool("TupleToolTrackIsolation") tuple.addTool(TupleToolDecay, name = 'B') # gregs isolation from Configurables import TupleToolApplyIsolation tuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard") tuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard" tuple.B.TupleToolApplyIsolationHard.WeightsFile="/afs/cern.ch/user/m/mboubdir/scratch1/tools/Analysisfiles/python_files/weights_110614_Lc_pX.xml" tuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"] trigger_list = [ 'L0MuonDecision' ,'L0DiMuonDecision' ,'Hlt1TrackAllL0Decision'
#If you apply a selection, this will be the output of a selection sequence object. tuple.Inputs = [Ds_sequence.outputLocation()] tuple.ToolList = ['TupleToolKinematic', 'TupleToolEventInfo', 'TupleToolTrackInfo', 'TupleToolPid', 'TupleToolGeometry', 'TupleToolAngles', ] tuple.InputPrimaryVertices = '/Event/Charm/Rec/Vertex/Primary' # # Other event infos tuple.addTupleTool('LoKi::Hybrid::EvtTupleTool/LoKi_Evt') tuple.LoKi_Evt.VOID_Variables = { "nTracks" : "CONTAINS('/Event/Charm/Rec/Track/Best')", "nPVs" : "CONTAINS('/Event/Charm/Rec/Vertex/Primary')" } # Other variables tuple.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_All') tuple.LoKi_All.Variables = { 'Eta' : 'ETA', 'Phi' : 'PHI', } #Tell DecayTreeTuple the structure of your decay, you must put ^ in front
" [B0 -> ( D0 -> K+ K- ) ( rho(770)0 -> pi+ pi- ) ]CC ", "D": " [B0 -> ^( D0 -> K+ K- ) ( rho(770)0 -> pi+ pi- ) ]CC ", "D0p": " [B0 -> ( D0 -> ^K+ K- ) ( rho(770)0 -> pi+ pi- ) ]CC ", "D0m": " [B0 -> ( D0 -> K+ ^K- ) ( rho(770)0 -> pi+ pi- ) ]CC ", "pip": " [B0 -> ( D0 -> K+ K- ) ( rho(770)0 -> ^pi+ pi- ) ]CC ", "pim": " [B0 -> ( D0 -> K+ K- ) ( rho(770)0 -> pi+ ^pi- ) ]CC ", "rho": " [B0 -> ( D0 -> K+ K- ) ^( rho(770)0 -> pi+ pi- ) ]CC " }) tuple.addTupleTool("TupleToolTISTOS/TupleToolTISTOS") tuple.TupleToolTISTOS.VerboseL0 = True tuple.TupleToolTISTOS.VerboseHlt1 = True tuple.TupleToolTISTOS.VerboseHlt2 = True tuple.TupleToolTISTOS.TriggerList = myTriggerList #Add Loki variables LoKi_DOCA = LoKi__Hybrid__TupleTool("LoKi_DOCA") LoKi_DOCA.Variables = { "MAXDOCA": "LoKi.Particles.PFunA(AMAXDOCA('LoKi::TrgDistanceCalculator'))", "MINDOCA": "LoKi.Particles.PFunA(AMINDOCA('LoKi::TrgDistanceCalculator'))", "DOCA12": "LoKi.Particles.PFunA(ADOCA(1,2))" } LoKi_LT = LoKi__Hybrid__TupleTool("LoKi_LT") LoKi_LT.Variables = {
def execute_option_file(path): # ================= BEGIN EDIT AREA ======================= tuplename = "Bu2LLK_meLine" simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles" data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles" decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC" branches = { # Dictionary for the branches to write in the tuple "B" : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC", "Psi" : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC", "muplus" : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC", "eminus" : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC", "Kplus" : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC" } #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used #use data.addTupleTool('<tool>') in the corresponding section below if you also want to modify the specific tool toollist = [ "TupleToolGeometry" #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV) , "TupleToolKinematic" #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT) , "TupleToolEventInfo" #Event information such as run number, polarity, GPS time etc. #, "TupleToolPropertime" #proper lifetime of reconstructed particles , "TupleToolAngles" #decay angles of charged tracks (i.e. angle in mothers frame, name: CosTheta) #, "TupleToolTrigger" #Saves trigger decision (I prefer to use TupleToolTISTOS) , "TupleToolTISTOS" #Trigger on/independent of signal , "TupleToolTrackInfo" #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track... , "TupleToolPrimaries" #Number and coordinates of all primary vertices , "TupleToolDira" #Angle between secondary minus primary vertex and the mother momentum #, "TupleToolTrackPosition" #Extrapolate track to given z-position (option .Z, default=2500. which is TT) , "TupleToolRecoStats" #Fills reconstruction information like nTracks, nSPDHits, nMuonTracks from RecSummary , "TupleToolBremInfo" #Bremsstrahlung information ] # ================= END EDIT AREA ======================= # ================= BEGIN DO NOT EDIT HERE ======================= from Configurables import GaudiSequencer MySequencer = GaudiSequencer('Sequence') #Check whether it is a DST or MDST file import os.path extension = os.path.splitext(path)[1] print extension if extension.lower() == ".dst": DaVinci().InputType = 'DST' elif extension.lower() == ".mdst": DaVinci().InputType = 'MDST' else: raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path)) #Kill some nodes if micro dst-file if DaVinci().InputType == 'MDST': from Configurables import EventNodeKiller eventNodeKiller = EventNodeKiller('DAQkiller') eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec'] MySequencer.Members+=[eventNodeKiller] #DecayTreeTuple -> Fills information about particles, vertices and daughters ntuple = DecayTreeTuple(tuplename) ntuple.ToolList = toollist if DaVinci().InputType != 'MDST': ntuple.ToolList += ["TupleToolTrackIsolation"] if DaVinci().Simulation is True: ntuple.ToolList +=["TupleToolMCBackgroundInfo"] #Sets the background category MCTruth=ntuple.addTupleTool("TupleToolMCTruth") #Saves information of MC particle associated to the current particle (you can add tools to it itself!) MCTruth.addTupleTool("MCTupleToolHierarchy") #True IDs of mother and grandmother particles if DaVinci().Simulation is True: # for MC ntuple.Inputs = [simulation_inputstring] elif DaVinci().Simulation is False: # for Tuple ntuple.Inputs = [data_inputstring] else: raise Exception(" `DaVinci().Simulation` not set.") ntuple.Decay = decaydescriptor ntuple.addBranches(branches) ntuple.TupleName = "DecayTree" MySequencer.Members.append(ntuple) # ================= END DO NOT EDIT HERE ======================= # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ================== # LOKI TupleTool LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool") LoKi.Variables = { "ETA" : "ETA", #Pseudorapidity "PHI" : "PHI" #Azimuthal angle } # PID TupleTool if(True): pid = ntuple.addTupleTool("TupleToolPid") #PID information for charged particles pid.Verbose = True #More information like isMuonLoose etc. #TISTOS TupleTool if(True): from Configurables import TupleToolTISTOS L0Triggers = ["L0MuonDecision", "L0DiMuonDecision", "L0HadronDecision", "L0ElectronDecision", "L0PhotonDecision" ] ## ['Muon', 'DiMuon', ' Hadron', 'Electron', 'Photon','PhotonHi','ElectronHi'] Hlt1Triggers = [ "Hlt1TrackAllL0Decision", "Hlt1TrackMuonDecision" ,"Hlt1TrackPhotonDecision" ,"Hlt1DiMuonLowMassDecision" ,"Hlt1DiMuonHighMassDecision"] Hlt2Triggers = [ ## muon lines "Hlt2SingleMuonDecision", "Hlt2SingleMuonLowPTDecision", "Hlt2SingleMuonHighPTDecision", "Hlt2DiMuonDecision", "Hlt2DiMuonLowMassDecision", "Hlt2DiMuonJPsiDecision", "Hlt2DiMuonJPsiHighPTDecision", "Hlt2DiMuonPsi2SDecision", "Hlt2DiMuonDetachedDecision", "Hlt2DiMuonDetachedJPsiDecision", "Hlt2DiMuonDetachedHeavyDecision", "Hlt2TriMuonTauDecision", ## hadron/Topo lines "Hlt2B2HHDecision", "Hlt2DiMuonBDecision", "Hlt2DiMuonZDecision", "Hlt2TopoMu2BodyBBDTDecision", "Hlt2TopoMu3BodyBBDTDecision", "Hlt2TopoMu4BodyBBDTDecision", "Hlt2TopoE2BodyBBDTDecision", "Hlt2TopoE3BodyBBDTDecision", "Hlt2TopoE4BodyBBDTDecision", "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision", "Hlt2Topo4BodyBBDTDecision", ##others "Hlt2PassThroughDecision", "Hlt2TransparentDecision", ## inclusive decisions "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision", "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision" ] triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers ntuple.addTool(TupleToolTISTOS) ntuple.TupleToolTISTOS.VerboseL0 = True ntuple.TupleToolTISTOS.VerboseHlt1 = True ntuple.TupleToolTISTOS.VerboseHlt2 = True ntuple.TupleToolTISTOS.FillL0 = True ntuple.TupleToolTISTOS.FillHlt1 = True ntuple.TupleToolTISTOS.FillHlt2 = True ntuple.TupleToolTISTOS.OutputLevel = INFO ntuple.TupleToolTISTOS.TriggerList = triggerList #DecayTreeFitter if(False): fitter = ntuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI") fitter.constrainToOriginVertex = False fitter.daughtersToConstrain = [ "J/psi(1S)" ] fitter.Verbose = True #Isolation if(True): from Configurables import TupleToolApplyIsolation ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard") ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard" ntuple.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml" #ntuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"] ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft") ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft" ntuple.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml" #ntuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"] ntuple.B.addTupleTool("TupleToolVtxIsoln") #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3 #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3 #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters) if(True): #Change this value if you don't want to use this tool from Configurables import TupleToolTrackHits, STOfflinePosition trackhits = ntuple.addTupleTool("TupleToolTrackHits") trackhits.Verbose = True if DaVinci().InputType == 'MDST': from Configurables import MeasurementProvider ntuple.addTool(MeasurementProvider('MeasProvider')) ntuple.MeasProvider.RootInTES = "/Event/Leptonic/" #Change Leptonic for your stream-name in case of MDST trackhits.MeasurementProvider = ntuple.MeasProvider itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition') #avoid crashes from missing IT channels itClusterPosition.DetType = 'IT' # ================= END EDIT TUPLETOOLS WITH OPTIONS ================== #DDDB and CondDB-Tags for DATA (needs to be set for Simulation in runfile.py according to generation->see bookkeeping!) #Always use the latest tags for the given datatype from (the newest are currently not in the database yet, therefore take the default ones!) """ if DaVinci().Simulation is False: if DaVinci().DataType == '2012': DaVinci().CondDBtag = "dddb-20150522-2" DaVinci().DDDBtag = "cond-20150409-1" elif DaVinci().DataType == '2011': DaVinci().CondDBtag = "dddb-20150522-1" DaVinci().DDDBtag = "cond-20150409" """ ################################ ### DaVinci configuration #### ################################ DaVinci().UserAlgorithms = [MySequencer] DaVinci().MoniSequence += [ntuple] DaVinci().EvtMax = -1 DaVinci().Lumi = True
def decay_tree_tuple(name, decay, mothers, intermediate, daughters, inputs, mc): """Return a configured DecayTreeTuple instance. A DecayTreeTuple is configured with the given decay descriptor. The mothers dictionary is used to give exclusive tools to vertices, and it should be, as daughters, a dictionary of tuple branch names to branch descriptors. A typical method call might look like decay_tree_tuple( 'TupleDstToD0pi_D0ToKpi', '[D*(2010)+ -> K- pi+]CC', { 'Dst': '[D*(2010) -> (D0 -> K- pi+) pi+]CC', 'D0': '[D*(2010) -> ^(D0 -> K- pi+) pi+]CC' }, { 'D0_K': '[D*(2010) -> (D0 -> ^K- pi+) pi+]CC', 'D0_pi': '[D*(2010) -> (D0 -> K- ^pi+) pi+]CC', 'Dst_pi': '[D*(2010) -> (D0 -> K- pi+) ^pi+]CC' }, 'Phys/StrippingLineName/Particles' ) Keyword arguments: name -- TDirectory the DecayTreeTuple TTree will be saved in decay -- Decay descriptor mothers -- Branch descriptors to be added to the tuple as mothers; decaying particles daughters -- Branch descriptors to be added to the tuple as daughters; final state particles inputs -- str of list of str, as the value of DecayTreeTuple.Inputs mc -- Extra MC information is included if True """ # Define tuple tools to add tools = [ "TupleToolPropertime", 'TupleToolEventInfo', ] # Extra variables, added using LoKi hybrid tuple tools basic_loki_vars = { 'ETA': 'ETA', 'PHI': 'PHI', 'PT': 'PT', 'ID': 'ID', 'P': 'P', 'Loki_BPVIPCHI2': 'BPVIPCHI2()', 'Loki_MIPCHI2DV': 'MIPCHI2DV(PRIMARY)', } intermediate_loki_vars = { 'Loki_AM34': 'LoKi.Particles.PFunA(AM34)', 'Loki_AM4': 'LoKi.Particles.PFunA(AM4)', 'Loki_BPVDIRA': "BPVDIRA", 'Loki_acosBPVDIRA': "acos(BPVDIRA)", } daughter_loki_vars = { 'PIDK': 'PIDK', 'PIDe': 'PIDe', 'PIDmu': 'PIDmu', 'PIDp': 'PIDp', 'Loki_TRACKCHI2NDOF': 'TRCHI2DOF', 'Loki_TRACKGHOSTPROB': 'TRGHOSTPROB', } mother_loki_vars = { 'M': 'M', 'Loki_BPVVDCHI2': 'BPVVDCHI2', 'Loki_BPVIPCHI2': 'BPVIPCHI2()', 'Loki_DOCAMAX': 'DOCAMAX', 'Loki_AMAXDOCA': "LoKi.Particles.PFunA(AMAXDOCA(''))", 'Loki_AMINDOCA': "LoKi.Particles.PFunA(AMINDOCA(''))", 'Loki_DOCACHI2MAX': 'DOCACHI2MAX', 'Loki_VCHI2NDOF': 'VFASPF(VCHI2/VDOF)', 'Loki_VX': 'VFASPF(VX)', 'Loki_VY': 'VFASPF(VY)', 'Loki_VZ': 'VFASPF(VZ)', 'Loki_SUMPT': 'SUMTREE(PT, ISBASIC)', 'Loki_BPVLTIME': "BPVLTIME()", } # Template DecayTreeTuple t = DecayTreeTuple(name) # Providing str will throw an exception, so wrap it in a list try: t.Inputs = inputs except ValueError: t.Inputs = [inputs] t.Decay = decay # Merge the mother and daughter dictionaries t.addBranches( dict(mothers.items() + intermediate.items() + daughters.items())) # Tools for all branches t.ToolList = tools # Verbose reconstruction information t.addTupleTool('TupleToolANNPID').ANNPIDTunes = ["MC15TuneV1"] # t.addTupleTool('TupleToolRecoStats') # MC truth information if mc: if has_turbo_inputs(t): print 'Adding MC truth information for Turbo' from TeslaTools import TeslaTruthUtils relations = TeslaTruthUtils.getRelLoc("") print 'relations = {}'.format(relations) toollist = ['MCTupleToolPrompt'] rels = [relations] MCTruth = TupleToolMCTruth() #MCTruth.OutputLevel = 1 MCTruth = t.addTupleTool('TupleToolMCTruth') MCTruth.ToolList = toollist MCTruth.addTool(DaVinciSmartAssociator) MCTruth.DaVinciSmartAssociator.RedoNeutral = False MCTruth.DaVinciSmartAssociator.addTool(P2MCPFromProtoP) MCTruth.DaVinciSmartAssociator.P2MCPFromProtoP.Locations = rels MCTruth.addTool(MCMatchObjP2MCRelator) MCTruth.MCMatchObjP2MCRelator.RelTableLocations = rels MCTruth.DaVinciSmartAssociator.addTool(BackgroundCategory) MCTruth.DaVinciSmartAssociator.BackgroundCategory.addTool( P2MCPFromProtoP) MCTruth.DaVinciSmartAssociator.BackgroundCategory.vetoNeutralRedo = True MCTruth.DaVinciSmartAssociator.BackgroundCategory.P2MCPFromProtoP.Locations = rels bkgcat = t.addTupleTool('TupleToolMCBackgroundInfo') bkgcat.addTool(BackgroundCategory) bkgcat.OutputLevel = 10 bkgcat.BackgroundCategory.vetoNeutralRedo = True bkgcat.BackgroundCategory.addTool(P2MCPFromProtoP) bkgcat.BackgroundCategory.P2MCPFromProtoP.Locations = rels t.OutputLevel = 10 else: print 'Adding MC truth information' t.addTupleTool('TupleToolMCTruth') t.addTupleTool('TupleToolMCBackgroundInfo') # Extra information from LoKi hybrid_tt = t.addTupleTool('LoKi::Hybrid::TupleTool/basicLoKiTT') hybrid_tt.Variables = basic_loki_vars hybrid_tt.Preambulo = ['from LoKiTracks.decorators import TrIDC'] # Add mother-specific varaibles to each mother branch for mother in mothers: branch = getattr(t, mother) branch.addTupleTool('LoKi::Hybrid::TupleTool/{0}LoKiTT'.format( mother)).Variables = mother_loki_vars # For some unknown reason this doesn't work with Turbo candidates, so # the information for them has to be added to every branch DictTuple = branch.addTupleTool(LoKi__Hybrid__Dict2Tuple, name="DTFTuple") DictTuple.addTool(DTFDict, name="DTF") DictTuple.Source = "LoKi::Hybrid::DTFDict/DTF" DictTuple.NumVar = 6 * (len(mothers) + len(intermediate) + len(daughters)) # configure the DecayTreeFitter in the usual way DictTuple.DTF.constrainToOriginVertex = True DictTuple.DTF.daughtersToConstrain = ['D0'] DictTuple.DTF.addTool(LoKi__Hybrid__DictOfFunctors, name="dict") DictTuple.DTF.Source = "LoKi::Hybrid::DictOfFunctors/dict" DictTuple.DTF.dict.Variables = { "DTFDict_{}_PT".format(mother): "PT", "DTFDict_{}_ETA".format(mother): "ETA", "DTFDict_{}_PHI".format(mother): "PHI", "DTFDict_{}_P".format(mother): "P", "DTFDict_{}_M".format(mother): "M", } for part, decay in intermediate.items() + daughters.items(): DictTuple.DTF.dict.Variables["DTFDict_{}_PT".format( part)] = "CHILD(PT,'{}')".format(decay) DictTuple.DTF.dict.Variables["DTFDict_{}_ETA".format( part)] = "CHILD(ETA,'{}')".format(decay) DictTuple.DTF.dict.Variables["DTFDict_{}_PHI".format( part)] = "CHILD(PHI,'{}')".format(decay) DictTuple.DTF.dict.Variables["DTFDict_{}_P".format( part)] = "CHILD(P,'{}')".format(decay) DictTuple.DTF.dict.Variables["DTFDict_{}_M".format( part)] = "CHILD(M,'{}')".format(decay) # Add intermediate-specific varaibles to each mother branch mom_int = mother_loki_vars.copy() mom_int.update(intermediate_loki_vars) for mother in intermediate: branch = getattr(t, mother) branch.addTupleTool('LoKi::Hybrid::TupleTool/{0}LoKiTT'.format( mother)).Variables = mom_int # For some unknown reason this doesn't work with Turbo candidates, so # the information for them has to be added to every branch for daughter in daughters: branch = getattr(t, daughter) branch.addTupleTool('LoKi::Hybrid::TupleTool/{0}LoKiTT'.format( daughter)).Variables = daughter_loki_vars return t
##pidtuple.addTool( ANNGlobalPID__ChargedProtoANNPIDTupleTool, name = "Tuple" ) ##pidtuple.Tuple.NTupleLUN = "ANNPIDTUPLE" #DaVinci().UserAlgorithms += [ pidtuple ] from DecayTreeTuple.Configuration import * from Configurables import ( DecayTreeTuple, LoKi__Hybrid__TupleTool, TupleToolTrigger, TupleToolStripping ) tuple = DecayTreeTuple("ANNPID") tuple.Decay = "[pi+]cc" tuple.NTupleLUN = "ANNPIDTUPLE" tuple.Inputs = [ 'Phys/StdAllNoPIDsPions/Particles', 'Phys/StdNoPIDsUpPions/Particles', 'Phys/StdNoPIDsDownPions/Particles' ] tuple.ToolList = [ "TupleToolANNPID", "TupleToolANNPIDTraining", "TupleToolGeometry" ] stripTool = tuple.addTupleTool( TupleToolStripping ) stripTool.TriggerList = [ "StrippingB02DKD2HHHBeauty2CharmLineDecision", "StrippingB02DKD2Pi0HHHMergedBeauty2CharmLineDecision", "StrippingB02DKD2Pi0HHHResolvedBeauty2CharmLineDecision", "StrippingB02DKPiPiD2HHHPIDBeauty2CharmLineDecision", "StrippingB02DPiD2HHHBeauty2CharmLineDecision", "StrippingB02DPiD2Pi0HHHMergedBeauty2CharmLineDecision", "StrippingB02DPiD2Pi0HHHResolvedBeauty2CharmLineDecision", "StrippingB02DPiNoIPD2HHHCFPIDBeauty2CharmLineDecision", "StrippingB02DPiNoIPDs2HHHPIDBeauty2CharmLineDecision", "StrippingB02DPiPiPiD2HHHPIDBeauty2CharmLineDecision", "StrippingB02DPiWSD2HHHBeauty2CharmLineDecision", "StrippingB0d2DTauNuForB2XTauNuAllLinesDecision", "StrippingB0d2DTauNuNonPhysTauForB2XTauNuAllLinesDecision", "StrippingB0d2DTauNuWSForB2XTauNuAllLinesDecision",
JpsiFilterSel = Selection(name='JpsiFilterSel', Algorithm=_jpsiFilter, RequiredSelections=[JpsiSel]) # build the SelectionSequence JpsiSeq = SelectionSequence( 'SeqJpsi', TopSelection=JpsiFilterSel, ) ############# DecayTreeTuple from Configurables import DecayTreeTuple, TupleToolTrigger, TupleToolDecay, TupleToolTISTOS tuple = DecayTreeTuple("Jpsi_Tuple") # tuple.addTupleTool( "TupleToolGeometry") // already default # tuple.addTupleTool( "TupleToolKinematic")// already default tuple.addTupleTool("TupleToolPropertime") tuple.addTupleTool("TupleToolPrimaries") # tuple.addTupleTool( "TupleToolEventInfo")// already default tuple.addTupleTool("TupleToolTrackInfo") tuple.Decay = "J/psi(1S) -> ^mu+ ^mu-" tuple.Inputs = [JpsiSeq.outputLocation()] tuple.addTupleTool(TupleToolTISTOS) tuple.TupleToolTISTOS.TriggerList = [ "Hlt2DiMuonJPsiDecision", "Hlt2DiMuonJPsiHighPTDecision", "Hlt2DiMuonDetachedJPsiDecision" ] tuple.TupleToolTISTOS.VerboseHlt2 = True DaVinci().appendToMainSequence([JpsiSeq.sequence(), tuple]) ################## ######### Debugging
def execute_option_file(path): # ================= BEGIN EDIT AREA ======================= tuplename = "Bu2LLK_meLine" simulation_inputstring = "/Event/AllStreams/Phys/Bu2LLK_meLine/Particles" data_inputstring = "/Event/Leptonic/Phys/Bu2LLK_meLine/Particles" decaydescriptor = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC" branches = { # Dictionary for the branches to write in the tuple "B" : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC", "Psi" : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC", "muplus" : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC", "eminus" : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC", "Kplus" : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC" } toollist = [ "TupleToolBremInfo" #Bremsstrahlung information , "TupleToolGeometry" #geometry of vertex locations (ENDVERTEX, OWNPV, IP_OWNPV, FD_OWNPV, DIRA_OWNPV) , "TupleToolKinematic" #kinematic variables (inv. mass MM, kin. mass M/sqrt(E^2-p^2), P, PX/Y/Z/E, PT) , "TupleToolEventInfo" #Event information such as run number, polarity, GPS time etc. , "TupleToolPropertime" #proper lifetime of reconstructed particles , "TupleToolAngles" #decay angles of charged tracks , "TupleToolTrigger" , "TupleToolTrackInfo" #GhostProb of track and track type (TYPE) - 0 = unknown, 1 = velo track... , "TupleToolPrimaries" #Number and coordinates of all primary vertices , "TupleToolDira" , "TupleToolTrackPosition" #Plot the X/Y position at a given Z (default: 2500 = TTstation) , "TupleToolRecoStats" , "TupleToolBremInfo" #Bremsstrahlung information , "TupleToolIsolationTwoBody" #degree of isolation of two particles with common mother from Bsmumu , "TupleToolANNPID" #V2,V3,... ProbNN variables #, "TupleToolCaloHypo" #, "TupleToolL0Calo" ] # ================= END EDIT AREA ======================= # ================= BEGIN DO NOT EDIT HERE ======================= from Configurables import GaudiSequencer MySequencer = GaudiSequencer('Sequence') #Check whether it is a DST or MDST file import os.path extension = os.path.splitext(path)[1] print extension if extension.lower() == ".dst": DaVinci().InputType = 'DST' elif extension.lower() == ".mdst": DaVinci().InputType = 'MDST' else: raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path)) #Kill some nodes if micro dst-file if DaVinci().InputType == 'MDST': from Configurables import EventNodeKiller eventNodeKiller = EventNodeKiller('DAQkiller') eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec'] MySequencer.Members+=[eventNodeKiller] #DecayTreeTuple -> Fills information about particles, vertices and daughters ntuple = DecayTreeTuple(tuplename) if DaVinci().Simulation is True: # for MC ntuple.Inputs = [simulation_inputstring] elif DaVinci().Simulation is False: # for Tuple ntuple.Inputs = [data_inputstring] else: raise Exception(" `DaVinci().Simulation` not set.") ntuple.Decay = decaydescriptor ntuple.addBranches(branches) ntuple.TupleName = "DecayTree" #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used ntuple.ToolList = toollist MySequencer.Members.append(ntuple) # ================= BEGIN EDIT TUPLETOOLS WITH OPTIONS ================== # LOKI TupleTool LoKi = ntuple.addTupleTool("LoKi::Hybrid::TupleTool") LoKi.Variables = { "ETA" : "ETA", "PHI" : "PHI" #Azimuthal angle } #Isolation tool from Alex weightsfolder = "" if(True): from Configurables import TupleToolApplyIsolation ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard") ntuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard" ntuple.B.TupleToolApplyIsolationHard.WeightsFile= weightsfolder+"weightsHard.xml" ntuple.B.addTupleTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft") ntuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft" ntuple.B.TupleToolApplyIsolationSoft.WeightsFile= weightsfolder+"weightsSoft.xml" ntuple.B.addTupleTool("TupleToolVtxIsoln") #ntuple.B.TupleToolApplyIsolationHard.OutputLevel = 3 #ntuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3 ################################ ### DaVinci configuration #### ################################ DaVinci().UserAlgorithms = [MySequencer] DaVinci().MoniSequence += [ntuple] DaVinci().EvtMax = 200 DaVinci().SkipEvents = 0 DaVinci().Lumi = True
_otherd2kkpi.Preambulo = [ "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC" ] selD2KKPiOther = Selection("DsMinusCandidates", Algorithm = _otherd2kkpi, RequiredSelections=[_otherKaons, _otherPions], OutputBranch="NewEvent/Phys") #selD2KKPiOther.OutputLevel = 1 seqD2KKPiOther = SelectionSequence('MCFilterOther', TopSelection = selD2KKPiOther) othertuple = DecayTreeTuple("Ds2KKPiTuple", RootInTES='/Event/NewEvent') othertuple.Decay = "[D_s+ -> K- K+ pi+]CC" #othertuple.Inputs = [seqD2KKPi.outputLocation()] othertuple.Inputs = ['Phys/SelD2KKPiOther/Particles'] othertuple.ToolList = [] from Configurables import MCMatchObjP2MCRelator othertuple.addTupleTool('TupleToolKinematic') othertuple.addTupleTool('TupleToolPropertime') mcTruth = othertuple.addTupleTool("TupleToolMCTruth") mcTruth.IP2MCPAssociatorTypes = ['MCMatchObjP2MCRelator/MyMCMatcher'] mcTruth.addTool(MCMatchObjP2MCRelator, name='MCMatchObjP2MCRelator') mcTruth.MCMatchObjP2MCRelator.RelTableLocations = ['/Event/NewEvent/Relations/NewEvent/Rec/ProtoP/Charged'] #tuple.addTupleTool("TupleToolPropertime")
trigger_list = [ 'L0MuonDecision', 'L0DiMuonDecision', 'L0HadronDecision', 'Hlt1TrackAllL0Decision', 'Hlt1TrackMuonDecision', 'Hlt1TrackMVADecision', 'Hlt1TwoTrackMVADecision', 'Hlt1TrackMVALooseDecision', 'Hlt1TwoTrackMVALooseDecision', 'Hlt2TopoMu2BodyBBDTDecision', 'Hlt2TopoMu3BodyBBDTDecision', 'Hlt2Topo2BodyDecision', 'Hlt2Topo3BodyDecision', 'Hlt2TopoMu2BodyDecision', 'Hlt2TopoMu3BodyDecision', 'Hlt2TopoMuMu2BodyDecision', 'Hlt2TopoMuMu3BodyDecision', 'Hlt2Topo2BodyBBDTDecision', 'Hlt2Topo3BodyBBDTDecision', 'Hlt2Topo4BodyBBDTDecision', 'Hlt2Topo2BodySimpleBBDTDecision', 'Hlt2Topo3BodySimpleBBDTDecision' ] #trigger config trigger = tuple.addTupleTool(TupleToolTISTOS) trigger.TriggerList = trigger_list trigger.Verbose = True trigger.VerboseL0 = True trigger.VerboseHlt1 = True trigger.VerboseHlt2 = True relinfolocation = '/Event/{0}/Phys/B2XMuMu_Line'.format(stream) LoKiTool = tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKiTool") LoKiTool.Variables = { "InAccMuon": "PPINFO(LHCb.ProtoParticle.InAccMuon, -1)", "ETA": "ETA", "DIRA":
Decision = '{linename}Decision'.format(linename=l.name()) #print Decision DecisionList.append(Decision) print DecisionList from Configurables import DecayTreeTuple from DecayTreeTuple.Configuration import * tuple = DecayTreeTuple() tuple.Decay = "[B_c+ -> K+ pi- pi+]CC" tuple.Inputs = ['Phys/{0}/Particles'.format(line)] tuple.ToolList += ["TupleToolDira"] from Configurables import TupleToolStripping tts = tuple.addTupleTool("TupleToolStripping") tts.StrippingList = DecisionList DaVinci().InputType = 'MDST' DaVinci().RootInTES = '/Event/{0}'.format(stream) DaVinci().UserAlgorithms += [tuple] DaVinci().TupleFile = "Output.root" DaVinci().HistogramFile = "histos.root" DaVinci().DataType = '2015' DaVinci().EvtMax = -1 DaVinci().Lumi = True DaVinci().PrintFreq = 1000 DaVinci().MoniSequence = [tuple] DaVinci().Simulation = False #from GaudiConf import IOHelper
_mainpions = DataOnDemand(Location='Phys/StdMCPions/Particles') # # MC matching # matchD2KKPi = "(mcMatch('D_s+ ==> K- K+ pi+'))" #matchKaons = "(mcMatch('[K+]cc'))" #matchPions = "(mcMatch('[pi+]cc'))" _maind2kkpi = CombineParticles("d2kkpiMain") _maind2kkpi.DecayDescriptor = "D_s+ -> K+ K- pi+" #_d2kkpi.DaughtersCuts = { "pi+" : matchPions, "K+" : matchKaons} _maind2kkpi.MotherCut = matchD2KKPi _maind2kkpi.Preambulo = [ "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC" ] selD2KKPiMain = Selection( "DsPlusCandidates", Algorithm = _maind2kkpi, RequiredSelections=[_mainkaons, _mainpions]) seqD2KKPiMain = SelectionSequence('MCFilterMain',TopSelection = selD2KKPiMain) maintuple = DecayTreeTuple("out") maintuple.Decay = "[D_s+ -> K- K+ pi+]CC" maintuple.Inputs = [seqD2KKPiMain.outputLocation()] mcTruth = maintuple.addTupleTool("TupleToolMCTruth") maintuple.addTupleTool("TupleToolPropertime")
DecayDescriptors=['[D*(2010)+ -> D0 pi+]cc'], CombinationCut=("AM - ACHILD(M,1) < 800*MeV"), MotherCut="(VFASPF(VCHI2/VDOF) < 6)") dst_sel = Selection( 'Sel_DstToD0pi', Algorithm=dst, RequiredSelections=[dz, pions] ) dst_selseq = SelectionSequence( 'SelSeq_DstToD0pi', TopSelection=dst_sel ) dtt_dst = DecayTreeTuple('TupleDstToD0pi_D0ToKpi_PersistReco') dtt_dst.addTupleTool('TupleToolTrackInfo') dtt_dst.Inputs = dst_selseq.outputLocations() dtt_dst.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^pi+) ^pi+]CC' dtt_dst.addBranches({ 'Dst': '[D*(2010)+ -> (D0 -> K- pi+) pi+]CC', 'Dst_pi': '[D*(2010)+ -> (D0 -> K- pi+) ^pi+]CC', 'D0': '[D*(2010)+ -> ^(D0 -> K- pi+) pi+]CC', 'D0_K': '[D*(2010)+ -> (D0 -> ^K- pi+) pi+]CC', 'D0_pi': '[D*(2010)+ -> (D0 -> K- ^pi+) pi+]CC', }) dstar_hybrid = dtt_dst.Dst.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Dstar') dstar_hybrid.Variables = { 'dstar_delta_mass': 'M - CHILD(M,1)', }
def makeTuple(self): """ Make tuple """ from Configurables import FitDecayTrees, DecayTreeTuple, TupleToolDecayTreeFitter, TupleToolDecay, TupleToolTrigger, TupleToolTISTOS, TupleToolPropertime, PropertimeFitter, TupleToolKinematic, TupleToolGeometry, TupleToolEventInfo, TupleToolPrimaries, TupleToolPid, TupleToolTrackInfo, TupleToolRecoStats, TupleToolMCTruth, LoKi__Hybrid__TupleTool, LoKi__Hybrid__EvtTupleTool tuple = DecayTreeTuple('Tuple'+self.name) # I can put as an argument a name if I use more than a DecayTreeTuple tuple.Inputs = [ self.sequence.outputLocation() ] tuple.Decay = self.dec tuple.ToolList = ['TupleToolKinematic', 'TupleToolEventInfo', 'TupleToolTrackInfo', 'TupleToolPid', 'TupleToolGeometry', 'TupleToolAngles', # Helicity angle # 'TupleToolPropertime', #proper time TAU of reco particles ] tuple.InputPrimaryVertices = '/Event/Charm/Rec/Vertex/Primary' # Other event infos tuple.addTupleTool('LoKi::Hybrid::EvtTupleTool/LoKi_Evt') tuple.LoKi_Evt.VOID_Variables = { #"nSPDHits" : " CONTAINS('Raw/Spd/Digits') " , 'nTracks' : " CONTAINS ('Charm/Rec/Track/Best') " , } # # Other variables # tuple.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_All') # tuple.LoKi_All.Variables = { # 'BPVIPCHI2' : 'BPVIPCHI2()', # 'BPVDIRA' : 'BPVDIRA', # 'BPVLTFITCHI2' : 'BPVLTFITCHI2()', # } tuple.addBranches(self.branches) tuple.phi.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_phi") tuple.phi.LoKi_phi.Variables = { 'DOCAMAX' : 'DOCAMAX', "MassDiff_Phi" : "DMASS('phi(1020)')", "BPVDIRA" : "BPVDIRA", "IPS_Phi" : "MIPCHI2DV(PRIMARY)", "VFASPF_CHI2DOF" : "VFASPF(VCHI2/VDOF)", "VFASPF_CHI2" : "VFASPF(VCHI2)", "BPVIPCHI2" : "BPVIPCHI2()", "ADOCA" : "DOCA(1,2)", "ADOCACHI2" : "DOCACHI2(1,2)", "DTF_CHI2_PV" : "DTF_CHI2( True, 'phi(1020)' )", "DTF_NDOF_PV" : "DTF_NDOF( True, 'phi(1020)' )", "DTF_M_PV" : "DTF_FUN ( M, True, 'phi(1020)' )", "DTF_M_Ks1_PV" : "DTF_FUN ( CHILD(M,1), True, 'phi(1020)' )", "DTF_M_Ks2_PV" : "DTF_FUN ( CHILD(M,2), True, 'phi(1020)' )", # "DTF_CTAU_Ks1" : "DTF_CTAU(1, False, 'phi(1020)' )", # "DTF_CTAU_Ks2" : "DTF_CTAU(2, False, 'phi(1020)' )", } def mySharedConf_Ks(branch): atool=branch.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_Ks') atool.Variables = { "BPVDIRA" : "BPVDIRA", "VFASPF_CHI2DOF" : "VFASPF(VCHI2/VDOF)", "VFASPF_CHI2" : "VFASPF(VCHI2)", "BPVIPCHI2" : "BPVIPCHI2()", "BPVVD" : "BPVVD", "BPVVDCHI2" : "BPVVDCHI2", "ADOCA" : "DOCA(1,2)", "ADOCACHI2" : "DOCACHI2(1,2)", 'BPVLTIME' : 'BPVLTIME()', } PropertimeTool = branch.addTupleTool("TupleToolPropertime/Propertime_Ks") mySharedConf_Ks(tuple.Ks1) mySharedConf_Ks(tuple.Ks2) def mySharedConf_pi(branch): atool=branch.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_pi') atool.Variables = { 'TRCHI2DOF' : 'TRCHI2DOF', 'TRGHOSTPROB' : 'TRGHOSTPROB', } mySharedConf_pi(tuple.pi1) mySharedConf_pi(tuple.pi2) mySharedConf_pi(tuple.pi3) mySharedConf_pi(tuple.pi4) # Triggers: tuple.phi.addTupleTool('TupleToolTISTOS/TISTOS') tuple.phi.TISTOS.TriggerList = trigger_list tuple.phi.TISTOS.VerboseL0 = True tuple.phi.TISTOS.VerboseHlt1 = True tuple.phi.TISTOS.VerboseHlt2 = True if dataSample.isMC: from Configurables import MCDecayTreeTuple, MCTupleToolKinematic, TupleToolMCTruth, MCTupleToolHierarchy, MCTupleToolReconstructed, MCTupleToolAngles, TupleToolMCBackgroundInfo tuple.addTupleTool('TupleToolMCTruth/MCTruth') tuple.MCTruth.ToolList = ['MCTupleToolKinematic', 'MCTupleToolHierarchy', 'MCTupleToolReconstructed', 'MCTupleToolAngles', ] tuple.phi.addTupleTool( "TupleToolMCBackgroundInfo") self.sequence.sequence().Members += [tuple]
tup.Decay = '[[B0]CC -> (J/psi(1S) -> e+ ^e-) (K*(892)0 -> K+ pi-)]CC' tup.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, strip)] tup.addBranches({ 'B0': '[[B0]CC -> (J/psi(1S) -> e+ e-) (K*(892)0 -> K+ pi-)]CC', #'Kaon' : '[[B0]CC -> (J/psi(1S) -> e+ e-) (K*(892)0 -> ^K+ pi-)]CC', #'Pion' : '[[B0]CC -> (J/psi(1S) -> e+ e-) (K*(892)0 -> K+ ^pi-)]CC', #'Kstar' : '[[B0]CC -> (J/psi(1S) -> e+ e-) ^(K*(892)0 -> K+ pi-)]CC', #'Jpsi' : '[[B0]CC -> ^(J/psi(1S) -> e+ e-) (K*(892)0 -> K+ pi-)]CC', #'eplus' : '[[B0]CC -> (J/psi(1S) -> ^e+ e-) (K*(892)0 -> K+ pi-)]CC', 'eminus': '[[B0]CC -> (J/psi(1S) -> e+ ^e-) (K*(892)0 -> K+ pi-)]CC' }) tup.ToolList = [] tup.addTupleTool("TupleToolPrimaries") tup.addTupleTool("TupleToolEventInfo") tup.addTupleTool("TupleToolCaloInfo") # (custom) dump of ECAL clusters tup.eminus.addTupleTool("TupleToolKinematic") tup.eminus.addTupleTool("TupleToolPid") tup.eminus.addTupleTool("TupleToolGeometry") tup.eminus.addTupleTool("TupleToolTrackInfo") tup.eminus.addTupleTool("TupleToolBremInfo") # Brem adder information tup.eminus.addTupleTool( "TupleToolInfoAtCalo") # (custom) info on extrapolated position at ECAL mctruthtool = tup.eminus.addTupleTool("TupleToolMCTruth") mctruthtool.ToolList += ["MCTupleToolPhotonDaughters" ] # (custom) info of MC bremphoton daughters nobremtool = tup.eminus.addTupleTool( 'LoKi::Hybrid::TupleTool/nobremtool') # no-bremadder info
from Configurables import DecayTreeTuple from DecayTreeTuple.Configuration import * # Stream and stripping line we want to use stream = 'AllStreams' line = 'D2hhPromptDst2D2KKLine' # Create an ntuple to capture D*+ decays from the StrippingLine line dtt = DecayTreeTuple('TupleDstToD0pi_D0ToKK') dtt.Inputs = ['/Event/{0}/Phys/{1}/Particles'.format(stream, line)] #Phys/{0}/Particles'.format(line)] # for microDST #dtt.Decay = '[D*(2010)+ -> (D0 -> K- K+) pi+]CC' # written like this means tuple tools only runs on the D*(2010)+, to select particles to store information on mark them with a ^, e.g.: dtt.Decay = '[D*(2010)+ -> ^(D0 -> ^K- ^K+) ^pi+]CC' # but this not ideal as we may only want to run some tools on D and some on children, use Branches below # CC means "and also equivalent C conjugated decay" ? # Additional tuple tools: track_tool = dtt.addTupleTool('TupleToolTrackInfo') # Only need to store a tool in a variable if you want to configure it: track_tool.Verbose = True # 'Verbose' - further information dtt.addTupleTool('TupleToolPrimaries') dtt.addBranches({'Dstar' :'[D*(2010)+ -> (D0 -> K- K+) pi+]CC', 'D0' :'[D*(2010)+ -> ^(D0 -> K- K+) pi+]CC', 'Kminus' :'[D*(2010)+ -> (D0 -> ^K- K+) pi+]CC', 'Kplus' :'[D*(2010)+ -> (D0 -> K- ^K+) pi+]CC', 'pisoft' :'[D*(2010)+ -> (D0 -> K- K+) ^pi+]CC'}) # and mark particles which we want to use in dtt.Decay (with ^ ?)!! # Alternativley, use setDescriptorTemplate() to do all this in one line: #dtt.setDescriptorTemplate('${Dstar}[D*(2010)+ -> ${D0}(D0 -> ${Kminus}K- ${Kplus}K+) ${pisoft}pi+]CC') # sets up both dtt.Decay and Branches # Access branches with dtt.PARTICLENAME dtt.D0.addTupleTool('TupleToolPropertime') # e.g. of adding tuple tools to specific particles ''' All tuple tools start with DecayTreeTuple here: https://gitlab.cern.ch/lhcb/Analysis/tree/master/Phys DecayTreeTuple for the more general tools;
"TupleToolPid", "TupleToolAngles", "TupleToolDira", "TupleToolL0Data", "TupleToolDalitz", "TupleToolPhotonInfo", "TupleToolParticleStats", "TupleToolCaloHypo", # MC tuple tools 'TupleToolMCTruth', 'MCTupleToolEventType', 'MCTupleToolPrimaries', 'TupleToolMCBackgroundInfo'] # verbose TupleTools dtt_geo = dtt.addTupleTool("TupleToolGeometry") dtt_geo.Verbose = True dtt_trk = dtt.addTupleTool("TupleToolTrackInfo") dtt_trk.Verbose = True # Mass substitution info dtt_subM = dtt.addTupleTool("TupleToolSubMass") dtt_subM.Substitution += [ 'pi+ => K+' , 'pi+ => p+' , 'K+ => pi+' , 'K+ => p+' , 'p+ => pi+' , 'p+ => K+' , 'gamma => pi0' , 'pi0 =>gamma' ] dtt_subM.DoubleSubstitution += [ 'pi+/pi- => K+/K- ' , 'pi+/pi- => p+/p~- ' , 'pi+/pi- => p+/K- ' , 'pi+/pi- => K+/p~- ' , 'K+/K- => pi+/pi-' , 'K+/K- => p+/p~- ' , 'K+/K- => p+/pi- ' , 'K+/K- => pi+/p~-' ,
tuple = DecayTreeTuple("Incl_Tuple") tuple.Inputs = [stripsel.outputLocation()] tuple.ToolList = [ "TupleToolKinematic" , "TupleToolEventInfo" , "TupleToolRecoStats" , "TupleToolMCBackgroundInfo" , "TupleToolGeometry" , "TupleToolPid" , "TupleToolPropertime" , "TupleToolPrimaries" , "TupleToolTrackInfo" ] MCtruth = tuple.addTupleTool("TupleToolMCTruth") MCtruth.addTupleTool("LoKi::Hybrid::MCTupleTool/LoKi_Photos").Variables = { "nPhotons" : "MCNINTREE(('gamma' == MCABSID))", "photons_TRUEP_X" : "MCSUMTREE(MCPX,('gamma' == MCABSID))", "photons_TRUEP_Y" : "MCSUMTREE(MCPY,('gamma' == MCABSID))", "photons_TRUEP_Z" : "MCSUMTREE(MCPZ,('gamma' == MCABSID))", "photons_TRUEP_E" : "MCSUMTREE(MCE,('gamma'==MCABSID))" } tuple.addBranches ({ "muplus" : "[B0 -> ^mu+ mu-]CC", "muminus" : "[B0 -> mu+ ^mu-]CC", "B0" : "[B0 -> mu+ mu-]CC", }) LoKi_All=tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All")
def makeTuple(self): """ Make tuple """ from Configurables import ( FitDecayTrees, DecayTreeTuple, TupleToolDecayTreeFitter, TupleToolDecay, TupleToolTrigger, TupleToolTISTOS, TupleToolPropertime, PropertimeFitter, TupleToolKinematic, TupleToolGeometry, TupleToolEventInfo, TupleToolPrimaries, TupleToolPid, TupleToolTrackInfo, TupleToolRecoStats, TupleToolMCTruth, LoKi__Hybrid__TupleTool, LoKi__Hybrid__EvtTupleTool, ) tuple = DecayTreeTuple( "Tuple" + self.name ) # I can put as an argument a name if I use more than a DecayTreeTuple tuple.Inputs = [self.sequence.outputLocation()] tuple.Decay = self.dec tuple.ToolList = [ "TupleToolKinematic", "TupleToolEventInfo", "TupleToolTrackInfo", "TupleToolPid", "TupleToolGeometry", "TupleToolAngles", # Helicity angle # 'TupleToolPropertime', #proper time TAU of reco particles ] # Other event infos tuple.addTupleTool("LoKi::Hybrid::EvtTupleTool/LoKi_Evt") if dataSample.isMC: tuple.LoKi_Evt.VOID_Variables = { # "nSPDHits" : " CONTAINS('Raw/Spd/Digits') " , "nTracks": "TrSOURCE('Rec/Track/Best') >> TrSIZE", "nPVs": "CONTAINS('Rec/Vertex/Primary')", } else: tuple.LoKi_Evt.VOID_Variables = { # "nSPDHits" : " CONTAINS('Raw/Spd/Digits') " , "nTracks": "CONTAINS('/Event/Charm/Rec/Track/Best')", "nPVs": "CONTAINS('/Event/Charm/Rec/Vertex/Primary')", } # # Other variables # tuple.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_All') # tuple.LoKi_All.Variables = { # 'BPVIPCHI2' : 'BPVIPCHI2()', # 'BPVDIRA' : 'BPVDIRA', # 'BPVLTFITCHI2' : 'BPVLTFITCHI2()', # } tuple.addBranches(self.branches) tuple.phi.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_phi") tuple.phi.LoKi_phi.Variables = { "DOCAMAX": "DOCAMAX", "MassDiff_Phi": "DMASS('phi(1020)')", "BPVDIRA": "BPVDIRA", "IPS_Phi": "MIPCHI2DV(PRIMARY)", "VFASPF_CHI2DOF": "VFASPF(VCHI2/VDOF)", "VFASPF_CHI2": "VFASPF(VCHI2)", "BPVIPCHI2": "BPVIPCHI2()", "ADOCA": "DOCA(1,2)", "ADOCACHI2": "DOCACHI2(1,2)", "DTF_CTAU_Ks1": "DTF_CTAU(1, True, strings('KS0') )", "DTF_CTAU_Ks2": "DTF_CTAU(2, True, strings('KS0') )", "DTF_DT": "DTF_CTAU(1, True, strings('KS0') )- DTF_CTAU(2, True, strings('KS0') )", "DTF_ADT": "abs(DTF_CTAU(1, True, strings('KS0') )- DTF_CTAU(2, True, strings('KS0') ))", } def mySharedConf_Ks(branch): atool = branch.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_Ks") atool.Variables = { "BPVDIRA": "BPVDIRA", "VFASPF_CHI2DOF": "VFASPF(VCHI2/VDOF)", "VFASPF_CHI2": "VFASPF(VCHI2)", "BPVIPCHI2": "BPVIPCHI2()", "BPVVD": "BPVVD", "BPVVDCHI2": "BPVVDCHI2", "ADOCA": "DOCA(1,2)", "ADOCACHI2": "DOCACHI2(1,2)", "BPVLTIME": "BPVLTIME()", } PropertimeTool = branch.addTupleTool("TupleToolPropertime/Propertime_Ks") mySharedConf_Ks(tuple.Ks1) mySharedConf_Ks(tuple.Ks2) def mySharedConf_pi(branch): atool = branch.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_pi") atool.Variables = {"TRCHI2DOF": "TRCHI2DOF", "TRGHOSTPROB": "TRGHOSTPROB"} mySharedConf_pi(tuple.pi1) mySharedConf_pi(tuple.pi2) mySharedConf_pi(tuple.pi3) mySharedConf_pi(tuple.pi4) # Triggers: tuple.phi.addTupleTool("TupleToolTISTOS/TISTOS") tuple.phi.TISTOS.TriggerList = trigger_list tuple.phi.TISTOS.VerboseL0 = True tuple.phi.TISTOS.VerboseHlt1 = True tuple.phi.TISTOS.VerboseHlt2 = True if dataSample.isMC: from Configurables import ( MCDecayTreeTuple, MCTupleToolKinematic, TupleToolMCTruth, MCTupleToolHierarchy, MCTupleToolReconstructed, MCTupleToolAngles, TupleToolMCBackgroundInfo, ) tuple.addTupleTool("TupleToolMCTruth/MCTruth") tuple.MCTruth.ToolList = [ "MCTupleToolKinematic", "MCTupleToolHierarchy", "MCTupleToolReconstructed", "MCTupleToolAngles", ] tuple.phi.addTupleTool("TupleToolMCBackgroundInfo") self.sequence.sequence().Members += [tuple]
"Lc": "[B- -> ^Lambda_c+ mu-]CC", "p": "[B- -> (Lambda_c+ -> ^p+ K- pi+) mu-]CC", "pi": "[B- -> (Lambda_c+ -> p+ K- ^pi+) mu-]CC", "K": "[B- -> (Lambda_c+ -> p+ ^K- pi+) mu-]CC", "mu": "[B- -> (Lambda_c+ -> p+ K- pi+) ^mu-]CC" }) l0_lines = ['L0HadronDecision', 'L0MuonDecision', 'L0ElectronDecision'] hlt1_lines = ['Hlt1TrackMVADecision', 'Hlt1TwoTrackMVADecision'] hlt2_lines = [ "Hlt2XcMuXForTauB2XcMuDecision", "Hlt2XcMuXForTauB2XcFakeMuDecision" ] LoKi_All = tupleB.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All") LoKi_All.Variables = { 'MINIPCHI2': "MIPCHI2DV(PRIMARY)", 'MINIP': "MIPDV(PRIMARY)", 'IPCHI2_OWNPV': "BPVIPCHI2()", 'IP_OWNPV': "BPVIP()", 'ghost': "TRGHP", 'TRACK_CHI2': "TRCHI2DOF" } tt_taumudiscrvars_b = tupleB.Lb.addTupleTool( "TupleToolTauMuDiscrVarsLcMassConstraint") LoKi_B = tupleB.Lb.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_B") LoKi_B.Variables = { 'DOCAMAX': "DOCAMAX",
def execute_option_file(path): from Configurables import GaudiSequencer MySequencer = GaudiSequencer('Sequence') #Check whether it is a DST or MDST file import os.path extension = os.path.splitext(path)[1] print extension if extension.lower() == ".dst": DaVinci().InputType = 'DST' elif extension.lower() == ".mdst": DaVinci().InputType = 'MDST' else: raise Exception("Extension {extension} of {path} does not match .mdst or .dst".format(extension, path)) #Kill some nodes if micro dst-file if DaVinci().InputType == 'MDST': from Configurables import EventNodeKiller eventNodeKiller = EventNodeKiller('DAQkiller') eventNodeKiller.Nodes = ['/Event/DAQ','/Event/pRec'] MySequencer.Members+=[eventNodeKiller] #Create DecayTreeTuple -> Fills information about particles, vertices and daughters data = DecayTreeTuple('Bu2LLK_meLine') #Set root "folder" for MDST - better don't do this as it most likely causes a crash #Instead set RootInTES for the particular Tool (e.g. TupleToolTrackHits that needs it) #if DaVinci().InputType == 'MDST': # data.RootInTES = "/Event/Leptonic" if DaVinci().Simulation is True: # for MC data.Inputs = ["/Event/AllStreams/Phys/Bu2LLK_meLine/Particles"] elif DaVinci().Simulation is False: # for Tuple data.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_meLine/Particles"] else: raise Exception(" `DaVinci().Simulation` not set.") data.Decay = "[B+ -> ^[J/psi(1S) -> ^mu+ ^e-]CC ^K+]CC" data.addBranches({ "B" : "[B+ -> [J/psi(1S) -> mu+ e-]CC K+]CC", "Psi" : "[B+ -> ^[J/psi(1S) -> mu+ e-]CC K+]CC", "muplus" : "[B+ -> [J/psi(1S) -> ^mu+ e-]CC K+]CC", "eminus" : "[B+ -> [J/psi(1S) -> mu+ ^e-]CC K+]CC", "Kplus" : "[B+ -> [J/psi(1S) -> mu+ mu-]CC ^K+]CC" }) data.TupleName = "DecayTree" #TupleTools #Tools added to the ToolList can not be modified i.e. no other options than the defaults can be used data.ToolList = [ ] #Settings for TupleToolTrackHits (some only are necessary for MDST-files because of other locations of the clusters) if(True): #Change this value if you don't want to use this tool from Configurables import TupleToolTrackHits, STOfflinePosition trackhits = data.addTupleTool("TupleToolTrackHits") if DaVinci().InputType == 'MDST': from Configurables import MeasurementProvider data.addTool(MeasurementProvider('MeasProvider')) data.MeasProvider.RootInTES = "/Event/Leptonic/" #Change Leptonic for your stream-name in case of MDST trackhits.MeasurementProvider = data.MeasProvider itClusterPosition = STOfflinePosition('ToolSvc.ITClusterPosition') #avoid crashes from missing IT channels itClusterPosition.DetType = 'IT' MySequencer.Members.append(data) ################################ ### DaVinci configuration #### ################################ DaVinci().UserAlgorithms = [MySequencer] DaVinci().MoniSequence += [data] DaVinci().EvtMax = 5000 DaVinci().Lumi = True DaVinci().SkipEvents = 0
tuple.Inputs = [seq.outputLocation()] tuple.ToolList = [ "TupleToolKinematic", "TupleToolEventInfo", "TupleToolTrackInfo", "TupleToolPid", "TupleToolGeometry", "TupleToolAngles", ] tuple.InputPrimaryVertices = "/Event/Charm/Rec/Vertex/Primary" # # Other event infos tuple.addTupleTool("LoKi::Hybrid::EvtTupleTool/LoKi_Evt") tuple.LoKi_Evt.VOID_Variables = { "nTracks": "CONTAINS('/Event/Charm/Rec/Track/Best')", "nPVs": "CONTAINS('/Event/Charm/Rec/Vertex/Primary')", } # Other variables tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All") tuple.LoKi_All.Variables = {"Eta": "ETA", "Phi": "PHI"} # Tell DecayTreeTuple the structure of your decay, you must put ^ in front # of particles that you want to write out (apart from head). J/psi->mu+mu- # is a CP eigenstate so we don't need []CC here. tuple.Decay = "[J/psi(1S) -> ^(KS0 -> ^pi+ ^pi-) ^(KS0 -> ^pi+ ^pi-)]CC"
# Use same tags as Gauss (from Gauss/options/Gauss-2012.py) LHCbApp().DDDBtag = "dddb-20180726-2" LHCbApp().CondDBtag = "sim-20160321-2-vc-md100" LHCbApp().Simulation = True # we did not run Moore, so force the TCK check to false. L0Conf().EnsureKnownTCK = False tup = DecayTreeTuple('electrons') tup.Decay = '[e-]CC' #tup.setDescriptorTemplate('${eminus}[e-]CC') tup.Inputs = ["Phys/StdAllLooseElectrons/Particles"] #tup.ReFitPVs = True tup.ToolList = [] tup.addTupleTool("TupleToolKinematic") # Momenta tup.addTupleTool("TupleToolBremInfo") # Info on photon that was BremAdded tup.addTupleTool("TupleToolCaloInfo") # (custom) dump of ECAL clusters tup.addTupleTool( "TupleToolInfoAtCalo") # (custom) info on extrapolated position at ECAL mctruthtool = tup.addTupleTool("TupleToolMCTruth") mctruthtool.ToolList += ["MCTupleToolPhotonDaughters" ] # (custom) info of MC bremphoton daughters nobremtool = tup.addTupleTool('LoKi::Hybrid::TupleTool/nobremtool') nobremtool.Variables = { 'nobrem_P': 'PPINFO(504,-100,-200)', 'nobrem_PT': 'PPINFO(505,-100,-200)', }
tuple.ToolList = [ "TupleToolKinematic" , "TupleToolEventInfo" , "TupleToolRecoStats" , "TupleBuKmmFit" ] tuple.addBranches ({ "Bplus" : "[B+ -> K+ ( J/psi(1S) -> mu+ mu-)]CC", "Kplus" : "[B+ -> ^K+ ( J/psi(1S) -> mu+ mu-)]CC", "Jpsi" : "[B+ -> K+ ^( J/psi(1S) -> mu+ mu-)]CC", "muplus" : "[B+ -> K+ ( J/psi(1S) -> ^mu+ mu-)]CC", "muminus" : "[B+ -> K+ ( J/psi(1S) -> mu+ ^mu-)]CC", }) LoKi_All = tuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_All") LoKi_All.Variables = { 'MINIPCHI2' : "MIPCHI2DV(PRIMARY)", 'MINIP' : "MIPDV(PRIMARY)", 'IPCHI2_OWNPV' : "BPVIPCHI2()", 'IP_OWNPV' : "BPVIP()" } LoKi_muplus = tuple.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_muplus") LoKi_muplus.Variables = { 'PIDmu' : "PIDmu", 'ghost' : "TRGHP", 'TRACK_CHI2' : "TRCHI2DOF", 'NNK' : "PPINFO(PROBNNK)", 'NNpi' : "PPINFO(PROBNNpi)", 'NNmu' : "PPINFO(PROBNNmu)"
ntuple = DecayTreeTuple("TaggingTest") descriptor_B = "[B0 -> ^(J/psi(1S) -> ^mu+ ^mu-) ^(K*(892)0 -> ^K+ ^pi-)]CC" ntuple.Inputs = ['Dimuon/Phys/BetaSBd2JpsiKstarDetachedLine/Particles'] ntuple.Decay = descriptor_B ntuple.addBranches({'B0': descriptor_B}) ntuple.ReFitPVs = True ntuple.ToolList = [ "TupleToolKinematic", "TupleToolPropertime", "TupleToolPrimaries", "TupleToolPid" ] # Configure TupleToolTagging tt_tagging = ntuple.addTupleTool("TupleToolTagging") tt_tagging.UseFTfromDST = False tt_tagging.OutputLevel = INFO tt_tagging.Verbose = True btag = tt_tagging.addTool(BTaggingTool, 'MyBTaggingTool') applyTuning(btag, tuning_version="Summer2019Optimisation_v1_Run2" ) # apply most recent tuning #applyTuning(btag) # apply default tuning tt_tagging.TaggingToolName = btag.getFullName() tt_tagging.AddTagPartsInfo = True # DaVinci configuration DaVinci().TupleFile = "DTT.root" DaVinci().DataType = "2017" DaVinci().Simulation = False DaVinci().UserAlgorithms = [ntuple]
def addTuple(name="", decay="", addendum="", head="/Event/Phys/", dtf=True, resonant=True, shortname="", verbose=[] ): from Configurables import DecayTreeTuple, PrintDecayTree, FilterDesktop, GaudiSequencer, PrintHeader, TESCheck if shortname == "": shortname = name shortname = shortname+"_Tuple"+addendum shortname = shortname.replace("MCMC","MC") seq = GaudiSequencer("Seq"+shortname) if ( not "/"==head[-1] ): head = head+'/' location = head+name+"/Particles" from Configurables import LoKi__HDRFilter if ( "/Event/Phys/" == head ): filter = TESCheck("Check"+shortname,Inputs = [ location ], Stop = False) else : # I am not running the selection, hence the stripping decision must be here filter = LoKi__HDRFilter( "Check"+shortname, Code = "HLT_PASS('Stripping"+name+"Decision')", Location="/Event/Strip/Phys/DecReports" ) #filter.OutputLevel = 1 seq.Members += [ filter ] # PrintHeader(), tuple = DecayTreeTuple(shortname) isMDST = (addendum.upper()=="MDST") if (isMDST): RIT = head.replace("/Phys","") print "RootInTES set to", RIT tuple.RootInTES = RIT tuple.Inputs = [ "Phys/"+name+"/Particles" ] else : tuple.Inputs = [ location ] # tuple.OutputLevel = 1 tuple.ToolList = [] tuple.Decay = decay tg = tuple.addTupleTool("TupleToolGeometry") if not isMDST: tg.FillMultiPV = True tlist = [] if ("e+" in decay): tlist = electronLines() elif ("mu+" in decay): tlist = muonLines() if ( False ): tlist = allLines() print tlist if ( Jpsi2MuMu != decay ): bpsi = (decay.replace("^","")).replace("(J/psi(1S)","^(J/psi(1S)") else : bpsi = "^("+decay.replace("^","")+")" print "J/psi branch is `` ", bpsi, "''" tuple.Branches["Psi"] = bpsi # sort out kstars if "892" in decay: bkstar = (decay.replace("^","")).replace("(K*(892)","^(K*(892)") tuple.Branches["Kstar"] = bkstar Kstar = tuple.addTupleTool("TupleToolDecay/Kstar") from Configurables import TupleToolTISTOS tistos = TupleToolTISTOS(TriggerList = tlist , VerboseHlt1 = True, VerboseHlt2 = True, VerboseL0 = True) Psi = tuple.addTupleTool("TupleToolDecay/Psi") Psi.addTool(tistos) Psi.ToolList += [ "TupleToolTISTOS" ] # if (not isMDST): # vi = tuple.Psi.addTupleTool("TupleToolVtxIsoln") # vi.InputParticles = [ "/Event/Phys/MyGoodPions" ] if ( Jpsi2MuMu == decay ): if (dtf): pvfit = tuple.Psi.addTupleTool("TupleToolDecayTreeFitter/PVFit") # fit with all constraints I can think of pvfit.Verbose = True pvfit.constrainToOriginVertex = True else: B = tuple.addTupleTool("TupleToolDecay/B") if ( Bs2JpsiPhi==decay ): p2vv = B.addTupleTool("TupleToolP2VV") p2vv.Calculator = "Bs2JpsiPhiAngleCalculator" elif ( "K*(892)0" in decay and not Bd2MuMuKstSS==decay ): p2vv = B.addTupleTool("TupleToolP2VV") p2vv.Calculator = "Bd2KstarMuMuAngleCalculator" if (Lambdab2Jpsippi==decay ): B.addTupleTool("TupleToolDalitz") if ('Xi_b-' in decay ): bh = 'Xi_b-' elif ('Xi_b~+' in decay ): bh = 'Xi_b~+' elif ('Lambda_b0' in decay ): bh = 'Lambda_b0' elif ('B0' in decay): bh = 'B0' elif ('B+' in decay ): bh = 'B+' elif ('B_s0' in decay ): bh = 'B_s0' if ('CC' in decay): bh = '['+bh+']cc' print "Branch will be ``", bh+" : "+decay.replace("^",""), "''" tuple.Branches["B"] = "^("+decay.replace("^","")+")" # This is needed for ConstB bhh = bh.replace('[','').replace(']cc','') if (('pi0' not in decay) and ('KS0' not in decay) and ('Lambda0' not in decay)): # B.ToolList += [ "TupleToolAngles"] tta = tuple.addTupleTool("TupleToolAngles") if (not resonant): tta.WRTMother = False # if (( 'K*(892)0' in decay) or ('phi' in decay)): tuple.B.ToolList += [ "TupleToolP2VV" ] # really wants a VV if (dtf): FullFit = B.addTupleTool("TupleToolDecayTreeFitter/FullFit") FullFit.Verbose = True # fills daughters FullFit.constrainToOriginVertex = True FullFit.daughtersToConstrain += [ "J/psi(1S)" ] # even non resonant if ("ConstBFit" in verbose): ConstBFit = B.addTupleTool("TupleToolDecayTreeFitter/ConstBFit") ConstBFit.Verbose = True ConstBFit.constrainToOriginVertex = True ConstBFit.daughtersToConstrain += [ "J/psi(1S)", bhh ] # constrain B as well ConstBFit.UpdateDaughters = True # Maurizio's daughters for d in [ 'KS0', 'pi0', 'Lambda0' ]: if d in decay: FullFit.daughtersToConstrain += [ d ] if ( "ConstBFit" in verbose ): ConstBFit.daughtersToConstrain += [ d ] if (not resonant): NoPsiFit = B.addTupleTool("TupleToolDecayTreeFitter/NoPsiFit") NoPsiFit.Verbose = True NoPsiFit.constrainToOriginVertex = True if (not resonant): #b constraint for calculating qsq ConstBNoPsiFit = B.addTupleTool("TupleToolDecayTreeFitter/ConstBNoPsiFit") ConstBNoPsiFit.Verbose = True ConstBNoPsiFit.constrainToOriginVertex = True ConstBNoPsiFit.daughtersToConstrain += [ bhh ] # constrain B as well ConstBNoPsiFit.UpdateDaughters = True # Maurizio's daughters #if (resonant and ('KS0' in decay or "pi0" in decay or 'Lambda0' in decay)): # OnlyPsiFit = B.addTupleTool("TupleToolDecayTreeFitter/OnlyPsiFit") # OnlyPsiFit.Verbose = True # OnlyPsiFit.constrainToOriginVertex = True # OnlyPsiFit.daughtersToConstrain += [ "J/psi(1S)" ] if ('phi' in decay): substitute1 = { 'Beauty -> Meson (Strange -> ^K+ K-)': 'pi+' } from Configurables import TupleToolDecayTreeFitter subDTF = TupleToolDecayTreeFitter("SubPipKm", Verbose=False, daughtersToConstrain = [ "J/psi(1S)" ], constrainToOriginVertex=True, Substitutions=substitute1) B.addTool(subDTF) B.ToolList += [ "TupleToolDecayTreeFitter/SubPipKm" ] B.addTool(subDTF) substitute2 = { 'Beauty -> Meson (Strange -> K+ ^K-)': 'pi-' } B.addTool(subDTF.clone("SubKpPim",Substitutions=substitute2)) B.ToolList += [ "TupleToolDecayTreeFitter/SubKpPim" ] if ( Lambdab2Jpsippi==decay ): substitute1 = { 'Beauty -> Meson p+ ^pi-': 'K-', 'Beauty -> Meson p~- ^pi+': 'K+' } from Configurables import TupleToolDecayTreeFitter B.addTupleTool(TupleToolDecayTreeFitter("SubpK", Verbose=False, daughtersToConstrain = [ "J/psi(1S)" ], constrainToOriginVertex=True, Substitutions=substitute1)) substitute2 = { 'Beauty -> Meson ^p+ pi-': 'K+', 'Beauty -> Meson ^p~- pi+': 'K-' } B.addTupleTool(TupleToolDecayTreeFitter("SubKpi", Verbose=False, daughtersToConstrain = [ "J/psi(1S)" ], constrainToOriginVertex=True, Substitutions=substitute2)) if ("ConstBFit" in verbose): ConstBSubFit = B.addTupleTool("TupleToolDecayTreeFitter/ConstBSubFit") ConstBSubFit.Substitutions=substitute1 # substitute and then constrain ConstBSubFit.Verbose = True ConstBSubFit.constrainToOriginVertex = True ConstBSubFit.daughtersToConstrain += [ "J/psi(1S)", bhh ] # constrain B as well ConstBSubFit.UpdateDaughters = True # Maurizio's daughters if ( Bd2JpsiKS0==decay ): substitute1 = { 'Beauty -> Meson (Strange -> ^pi+ pi-)' : 'K+' } substitute2 = { 'Beauty -> Meson (Strange -> pi+ ^pi-)' : 'K-' } from Configurables import TupleToolDecayTreeFitter B.addTupleTool(TupleToolDecayTreeFitter("PsiKppim", Verbose=False, daughtersToConstrain = [ "J/psi(1S)" ], constrainToOriginVertex=True, Substitutions=substitute1)) B.addTupleTool(TupleToolDecayTreeFitter("PsiKmpip", Verbose=False, daughtersToConstrain = [ "J/psi(1S)" ], constrainToOriginVertex=True, Substitutions=substitute2)) if ( Bu2JpsiK == decay): substitute2 = { 'Beauty -> Meson ^K+': 'pi+', 'Beauty -> Meson ^K-': 'pi-' } subDTF2 = B.addTupleTool(TupleToolDecayTreeFitter("Subpi", Verbose=False, daughtersToConstrain = [ "J/psi(1S)" ], constrainToOriginVertex=True, Substitutions=substitute2)) if ( Bu2eeK == decay or Bu2MuMuK == decay or Bu2MueK == decay or Bu2eMuK == decay): if Bu2eeK == decay : substitute1 = { "Beauty -> ( J/psi(1S) -> ^e+ X- ) Strange " : "pi+" , "Beauty -> ( J/psi(1S) -> ^e- X+ ) Strange " : "pi-" } elif Bu2MuMuK == decay : substitute1 = { "Beauty -> ( J/psi(1S) -> ^mu+ X- ) Strange " : "pi+" , "Beauty -> ( J/psi(1S) -> ^mu- X+ ) Strange " : "pi-" } elif Bu2MueK == decay : substitute1 = { "Beauty -> ( J/psi(1S) -> ^e+ X- ) Strange " : "pi+" , "Beauty -> ( J/psi(1S) -> ^mu- X+ ) Strange " : "pi-" } elif Bu2eMuK == decay : substitute1 = { "Beauty -> ( J/psi(1S) -> ^mu+ X- ) Strange " : "pi+" , "Beauty -> ( J/psi(1S) -> ^e- X+ ) Strange " : "pi-" } from Configurables import TupleToolDecayTreeFitter subDTF = B.addTupleTool(TupleToolDecayTreeFitter("Subpipi", Verbose=False, constrainToOriginVertex=True, Substitutions=substitute1, UpdateDaughters = True)) # Maurizio's daughters """ if (('KS0' in decay) or ("K*(892)" in decay) or ("Lambda0" in decay)): mh = tuple.addTupleTool("TupleToolMassHypo") if ("KS0" in decay): mh.PIDReplacements = { "pi+" : "p+" } #if ("K*(892)" in decay): # mh.PIDReplacements = { "pi-" : "K+" } if ("Lambda0" in decay): mh.PIDReplacements = { "p+" : "pi+" } """ B.addTool(tistos) B.ToolList += [ "TupleToolTISTOS" ] rs = tuple.addTupleTool("TupleToolRecoStats") rs.Verbose = ("RecoStats" in verbose) ei = tuple.addTupleTool("TupleToolEventInfo") ei.Verbose = ("EventInfo" in verbose) # gives GpsYear, month, day, etc ki = tuple.addTupleTool("TupleToolKinematic") # gives _AtVtx_P ki.Verbose= ("Kinematic" in verbose) tuple.addTupleTool("TupleToolPrimaries") ti = tuple.addTupleTool("TupleToolTrackInfo") ti.Verbose = ("TrackInfo" in verbose) # gives many more chi2 if ( "TrackPosition" in verbose): # extrapolates to TT, IT tp1 = tuple.addTupleTool("TupleToolTrackPosition/TupleToolTrackPositionTT") tp2 = tuple.addTupleTool("TupleToolTrackPosition/TupleToolTrackPositionIT") tp1.ExtraName = "TT" tp2.ExtraName = "IT" tp2.Z = 7800 pid = tuple.addTupleTool("TupleToolPid") pid.Verbose = ("Pid" in verbose) # many more vars in RICH if ("Pid" in verbose) : tuple.addTupleTool("TupleToolANNPID") tuple.addTupleTool("TupleToolL0Calo") if ('e+' in decay): brem = tuple.addTupleTool("TupleToolBremInfo") #isolation if "iso" in verbose : # lines from Greg Ciezarek from configIso import configIso configIso() # this is work in progress #will be comitted to SVN properly at a future date as of 3/4/14 from Configurables import TupleToolApplyIsolation tuple.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard") tuple.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard" tuple.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml" tuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"] tuple.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft") tuple.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft" tuple.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml" tuple.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"] vtxiso = tuple.B.addTupleTool("TupleToolVtxIsoln") tuple.B.TupleToolApplyIsolationHard.OutputLevel = 3 tuple.B.TupleToolApplyIsolationSoft.OutputLevel = 3 tuple.addTupleTool("TupleToolPropertime") if ( "/Event/Phys/" == head): # not reading stripping output tts = tuple.addTupleTool("TupleToolStripping") tuple.addTupleTool("TupleToolPhotonInfo") tuple.addTupleTool("TupleToolPi0Info") # tuple.OutputLevel = 1 if ( addendum == "MC" ): # it's MC! tmc = tuple.addTupleTool("TupleToolMCTruth") #tmc.addTupleTool("MCTupleToolKinematic") tmc.addTupleTool("MCTupleToolHierarchy") tuple.addTupleTool("TupleToolMCBackgroundInfo") if (isMDST): seq.Members += [ #PrintDecayTree( Inputs = [ location]), EventNodeKiller(Nodes=["DAQ"] ) ] if ( addendum == "MC" ): # it's not MC! from Configurables import TrackSmearState as SMEAR smear = SMEAR() # seq.Members += [ smear ] elif (not isMDST): # it's not mdst from Configurables import TrackScaleState as SCALER scaler = SCALER('StateScale') # seq.Members += [ scaler ] seq.Members += [ # PrintDecayTree( Inputs = [ location]), tuple ] return [ seq ]
tuple = DecayTreeTuple() # I can put as an argument a name if I use more than a DecayTreeTuple tuple.Inputs = [ tau_sequence.outputLocation() ] tuple.Decay = dec tuple.ToolList = ['TupleToolKinematic', 'TupleToolEventInfo', 'TupleToolTrackInfo', 'TupleToolPid', 'TupleToolGeometry', 'TupleToolAngles', # Helicity angle #'TupleToolP2VV', # various angles, not useful in my analysis because only default values 'TupleToolPropertime', #proper time TAU of reco particles #'TupleToolPrimaries', #num primary vertices and coords ] # Track isolation tuple.addTupleTool('TupleToolTrackIsolation/TrackIsolation') tuple.TrackIsolation.MinConeAngle = 0.5 tuple.TrackIsolation.MaxConeAngle = 1. tuple.TrackIsolation.StepSize = 0.1 # Other event infos tuple.addTupleTool('LoKi::Hybrid::EvtTupleTool/LoKi_Evt') tuple.LoKi_Evt.VOID_Variables = { "nSPDHits" : " CONTAINS('Raw/Spd/Digits') " , 'nTracks' : " CONTAINS ('Rec/Track/Best') " , } # Other variables tuple.addTupleTool('LoKi::Hybrid::TupleTool/LoKi_All') tuple.LoKi_All.Variables = { 'BPVIPCHI2' : 'BPVIPCHI2()',
KsPiPiTuple.Inputs = [ LooseKsPiPi.outputLocation() ] # decay descriptors KsPiPiTuple.Decay = "KS0 -> ^pi+ ^pi-" # define the tools and configure them KsPiPiTuple.ToolList = [ "TupleToolKinematic" ,"TupleToolGeometry" ,"TupleToolPid" ,"TupleToolANNPID" #,"TupleToolTrackInfo" ,"TupleToolRecoStats" ,"TupleToolTrigger" ,"TupleToolPrimaries" ] KsPiPiTuple.addTupleTool("TupleToolTrackInfo/TupleToolTrackInfo") KsPiPiTuple.TupleToolTrackInfo.Verbose = True # define the list of triggers that could have fired... KsPiPiTuple.addTupleTool("LoKi::Hybrid::TupleTool/LoKiTool") KsPiPiTuple.LoKiTool.Variables = { "eta" : "ETA", "phi" : "PHI", "LV01" : "LV01" } ###################################################################################################### from Configurables import CombineParticles LambdaPPi = CombineParticles("LambdaPPi") LambdaPPi.DecayDescriptor = "[Lambda0 -> p+ pi-]cc" LambdaPPi.CombinationCut = "ADAMASS('Lambda0')<100*MeV"
_d2kkpi.MotherCut = matchD2KKPi _d2kkpi.Preambulo = [ "from LoKiPhysMC.decorators import *", "from PartProp.Nodes import CC" ] SelD2KKPi = Selection( "SelD2KKPi", Algorithm = _d2kkpi, RequiredSelections=[_kaons,_pions]) dumpAlg = DumpAddr(OutputFile='eventaddr.txt', ObjectPath='/Event') SeqD2KKPi = SelectionSequence('MCFilter',TopSelection = SelD2KKPi, PostSelectionAlgs=[dumpAlg]) tuple = DecayTreeTuple("out") tuple.Decay = "[D_s+ -> K- K+ pi+]CC" tuple.Inputs = [SeqD2KKPi.outputLocation()] mcTruth = tuple.addTupleTool("TupleToolMCTruth") tuple.addTupleTool("TupleToolPropertime") checkPV = CheckPV() dstWriter = SelDSTWriter("MyDSTWriter", SelectionSequences = [SeqD2KKPi], OutputFileSuffix = 'EXTRA' ) from Gaudi.Configuration import * from Configurables import DaVinci DaVinci().EvtMax = 10000 DaVinci().PrintFreq = 10 DaVinci().SkipEvents = 0