def tuple_spec_data(name, sel_seq, template, B_meson='b', weights='./weights_soft.xml', tools=[ "TupleToolKinematic", "TupleToolPrimaries", "TupleToolEventInfo", "TupleToolTrackInfo", "TupleToolRecoStats" ], trigger_list=[ # L0 'L0HadronDecision', 'L0MuonDecision', 'L0DiMuonDecision', 'L0ElectronDecision', # HLT 1 'Hlt1TrackMVADecision', 'Hlt1TwoTrackMVADecision', 'Hlt1TrackMuonDecision', # HLT 2 'Hlt2DiMuonDetachedHeavyDecision', ] ): tp = DecayTreeTuple(name) tp.NTupleDir = '' # From Greg, might be interesting tp.TupleName = name tp_input = sel_seq if isinstance(sel_seq, str) else sel_seq.outputLocation() tp.Inputs = [tp_input] tp.setDescriptorTemplate(template) tp.ToolList += tools tt_pid = really_add_tool(tp, 'TupleToolPid') tt_pid.Verbose = True tt_geo = really_add_tool(tp, 'TupleToolGeometry') tt_geo.Verbose = True tt_tistos = really_add_tool(tp, 'TupleToolTISTOS') tt_tistos.Verbose = True tt_tistos.TriggerList = trigger_list tt_l0_calo = really_add_tool(tp, 'TupleToolL0Calo') tt_l0_calo.WhichCalo = "HCAL" tt_l0_calo.TriggerClusterLocation = "/Event/Trig/L0/Calo" tt_app_iso = getattr(tp, B_meson).addTupleTool('TupleToolApplyIsolation') tt_app_iso.WeightsFile = weights return tp
def makeDecayTreeTuple( location, decay, alg_name, tuple_name ): tuple = DecayTreeTuple( alg_name ) dectype = alg_name[-2:] #triggerList = list(l0hlt1List) #if 'KK' == dectype: # for trigger in hlt2List_KK: # triggerList.append( trigger + 'Decision') #elif 'Pi' == dectype: # for trigger in hlt2List_Pi: # triggerList.append( trigger + 'Decision') #elif 'RS' == dectype or 'WS' == dectype: # for trigger in hlt2List_KPi: # triggerList.append( trigger + 'Decision') print alg_name, triggerList #tuple = DecayTreeTuple('TupleKK') tuple.ToolList = [ "TupleToolPropertime", "TupleToolKinematic", #"TupleToolPropertime/MyPropertimeTool", "TupleToolGeometry", "TupleToolEventInfo", "TupleToolPrimaries", "TupleToolTISTOS", #"TupleToolTrigger", "TupleToolPid", "TupleToolTrackInfo", "TupleToolRecoStats", #"TupleToolGeneration" ] #tuple.addTool( TupleToolPropertime( name="MyPropertimeTool" ) ) #tuple.MyPropertimeTool.ToolName = "PropertimeFitter/MyPropertimeFitter" #tuple.MyPropertimeTool.ExtraName = "MassConstraint" #tuple.MyPropertimeTool.addTool( PropertimeFitter( name = "MyPropertimeFitter" ) ) #tuple.MyPropertimeTool.MyPropertimeFitter.applyBMassConstraint = True tuple.Inputs = [ location ]#_strippingOutput] #tuple.InputLocations = [ location ]#_strippingOutput] tuple.Decay = decay #tuple.Decay = "[D0 -> ^K- ^pi+]CC" tuple.TupleName = tuple_name #tuple.TupleName = "D0KKTuple" tuple.addTool( TupleToolPropertime() ) tuple.TupleToolPropertime.FitToPV = True #tuple.addTool( TupleToolTrigger() ) #tuple.TupleToolTrigger.TriggerList = triggerList #tuple.TupleToolTrigger.VerboseL0 = True #tuple.TupleToolTrigger.VerboseHlt1 = True #tuple.TupleToolTrigger.VerboseHlt2 = True #tuple.TupleToolTrigger.Verbose = True tuple.addTool( TupleToolTISTOS() ) tuple.TupleToolTISTOS.VerboseL0 = True tuple.TupleToolTISTOS.VerboseHlt1 = True tuple.TupleToolTISTOS.VerboseHlt2 = True tuple.TupleToolTISTOS.Verbose = True tuple.TupleToolTISTOS.TriggerList = triggerList return tuple
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
# J/psi n-tuple # # @author Bilas Pal # @date 2010-11-01 ###### ######################################################################## from Gaudi.Configuration import * # # DecayTreeTuple # from Configurables import DecayTreeTuple, LoKi__Hybrid__TupleTool, TupleToolDecay, TupleToolTrigger, TupleToolTISTOS, TupleToolTagging from Configurables import FitDecayTrees, TupleToolGeometry tuple = DecayTreeTuple('Lb2JpsiLTree') tuple.Inputs = [ 'Phys/Bs2Jpsif0' ] tuple.TupleName = "mytree" tuple.ToolList = [ "TupleToolGeometry", "TupleToolKinematic", "TupleToolEventInfo", # "TupleToolTISTOS", "TupleToolPid", "TupleToolTrackInfo", # "TupleToolTagging" ] tistos = TupleToolTISTOS("tistos") tistos.VerboseL0 = 1 tistos.VerboseHlt1 = 1 tistos.VerboseHlt2 = 1 tistos.TriggerList = [
# J/psi n-tuple # # @author Bilas Pal # @date 2010-11-01 ###### ######################################################################## from Gaudi.Configuration import * # # DecayTreeTuple # from Configurables import DecayTreeTuple, LoKi__Hybrid__TupleTool, TupleToolDecay, TupleToolTrigger, TupleToolTISTOS, TupleToolTagging, MCDecayTreeTuple from Configurables import FitDecayTrees, TupleToolGeometry tuple = DecayTreeTuple('Lb2JpsiLTree') tuple.Inputs = [ 'Phys/Bs2Jpsif0' ] tuple.TupleName = "mytree" tuple.ToolList = [ "TupleToolGeometry", "TupleToolKinematic", "TupleToolEventInfo", # "TupleToolTISTOS", "TupleToolPid", "TupleToolTrackInfo", # "TupleToolTagging" ] tistos = TupleToolTISTOS("tistos") tistos.VerboseL0 = 1 tistos.VerboseHlt1 = 1 tistos.VerboseHlt2 = 1 tistos.TriggerList = [
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 = ['DAQ','pRec'] MySequencer.Members+=[eventNodeKiller] #DecayTreeTuple data = DecayTreeTuple('Bu2LLK_mmLine') data.ToolList = [ "TupleToolGeometry" , "TupleToolKinematic" , "TupleToolEventInfo" , "TupleToolPropertime" , "TupleToolTrigger" , "TupleToolTISTOS" , "TupleToolPid" , "TupleToolTrackInfo" , "TupleToolPrimaries" , "TupleToolDira" , "TupleToolTrackPosition" , "TupleToolRecoStats" ] if DaVinci().InputType != 'MDST': data.ToolList += ["TupleToolTrackIsolation"] if DaVinci().Simulation is True: data.ToolList +=[ "TupleToolMCBackgroundInfo" , "TupleToolMCTruth" ] 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", "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision", "Hlt2Topo4BodyBBDTDecision", ##others "Hlt2PassThroughDecision", "Hlt2TransparentDecision", ## inclusive decisions "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision", "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision" ] triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers data.addTool(TupleToolTISTOS) data.TupleToolTISTOS.VerboseL0 = True data.TupleToolTISTOS.VerboseHlt1 = True data.TupleToolTISTOS.VerboseHlt2 = True data.TupleToolTISTOS.FillL0 = True data.TupleToolTISTOS.FillHlt1 = True data.TupleToolTISTOS.FillHlt2 = True data.TupleToolTISTOS.OutputLevel = INFO data.TupleToolTISTOS.TriggerList = triggerList if DaVinci().Simulation is True: # for MC data.Inputs = ["/Event/AllStreams/Phys/Bu2LLK_mmLine/Particles"] elif DaVinci().Simulation is False: # for Tuple data.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_mmLine/Particles"] else: raise Exception(" `DaVinci().Simulation` not set.") data.Decay = "[B+ -> ^(J/psi(1S) -> ^mu+ ^mu-) ^K+]CC" data.addBranches({ "B" : "[B+ -> (J/psi(1S) -> mu+ mu-) K+]CC", "Psi" : "[B+ -> ^(J/psi(1S) -> mu+ mu-) K+]CC", "muplus" : "[B+ -> (J/psi(1S) -> ^mu+ mu-) K+]CC", "muminus" : "[B+ -> (J/psi(1S) -> mu+ ^mu-) K+]CC", "Kplus" : "[B+ -> (J/psi(1S) -> mu+ mu-) ^K+]CC" }) data.TupleName = "DecayTree" #DecayTreeFitter fitter = data.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI") fitter.constrainToOriginVertex = False fitter.daughtersToConstrain = [ "J/psi(1S)" ] fitter.Verbose = True #Isolation data.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationHard") data.B.TupleToolApplyIsolationHard.OutputSuffix="_Hard" data.B.TupleToolApplyIsolationHard.WeightsFile="weightsHard.xml" data.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationHard"] data.B.addTool(TupleToolApplyIsolation, name="TupleToolApplyIsolationSoft") data.B.TupleToolApplyIsolationSoft.OutputSuffix="_Soft" data.B.TupleToolApplyIsolationSoft.WeightsFile="weightsSoft.xml" data.B.ToolList+=["TupleToolApplyIsolation/TupleToolApplyIsolationSoft"] vtxiso = data.B.addTupleTool("TupleToolVtxIsoln") #data.B.TupleToolApplyIsolationHard.OutputLevel = 3 #data.B.TupleToolApplyIsolationSoft.OutputLevel = 3 MySequencer.Members.append(data) #EventTuple for simulation """ if DaVinci().Simulation is True: etuple = EventTuple() etuple.ToolList=["TupleToolEventInfo"] MySequencer.Members.append(etuple) """ #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 += [data] DaVinci().EvtMax = -1 DaVinci().Lumi = True
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
print "tuple input :",dttuple.Inputs print "number of events:", DaVinci().EvtMax a = "->" dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^pi+]CC" branch_definitions = { "D" : "[D+ "+a+" pi- pi+ pi+]CC", "pi1": "[D+ "+a+" ^pi- pi+ pi+]CC", "pi2": "[D+ "+a+" pi- ^pi+ pi+]CC", "pi3": "[D+ "+a+" pi- pi+ ^pi+]CC", } dttuple.addBranches(branch_definitions) dttuple.TupleName = "DPiPiPi_NTuple" dttuple.addTool(TupleToolTISTOS()) dttuple.TupleToolTISTOS.VerboseL0 = True dttuple.TupleToolTISTOS.VerboseHlt1 = True dttuple.TupleToolTISTOS.VerboseHlt2 = True dttuple.TupleToolTISTOS.Verbose = True ttmhk = TupleToolMassHypo("KaonHypo") ttmhk.PIDReplacements = { "pi+" : "K+"} #ttmhk.CC = True dttuple.D.addTool(ttmhk) dttuple.D.ToolList += ["TupleToolMassHypo/KaonHypo"] ttmhm = TupleToolMassHypo("MuonHypo") ttmhm.PIDReplacements = { "pi+" : "mu+"}
,"MPPi": "WM('p+','pi-')" ,"MPiP": "WM('pi+','p~-')" ,"MPK": "WM('p+','K-')" ,"MKP": "WM('K+','p~-')" } preseltuple.Decay = "B0 -> ^pi+ ^pi-" preseltuple.TupleName = "PreSelB2HH" evttuple = EventTuple("EventInfo") evttuple.ToolList += [ "TupleToolEventInfo" ,"TupleToolTrigger" ] evttuple.addTool(TupleToolTrigger())
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 execute_option_file(): Tuple = DecayTreeTuple('Bu2LLK_eeLine2') Tuple.ToolList = [ "TupleToolGeometry" , "TupleToolKinematic" , "TupleToolEventInfo" , "TupleToolPropertime" , "TupleToolTrigger" , "TupleToolTISTOS" , "TupleToolPid" , "TupleToolTrackInfo" , "TupleToolPrimaries" , "TupleToolDira" , "TupleToolTrackIsolation" , "TupleToolTrackPosition" , "TupleToolRecoStats" ] if DaVinci().Simulation is True: Tuple.ToolList +=[ "TupleToolMCBackgroundInfo" , "TupleToolMCTruth" ] 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", "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision", "Hlt2Topo4BodyBBDTDecision", ##others "Hlt2PassThroughDecision", "Hlt2TransparentDecision", ## inclusive decisions "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision", "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision" ] triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers Tuple.addTool(TupleToolTISTOS) Tuple.TupleToolTISTOS.VerboseL0 = True Tuple.TupleToolTISTOS.VerboseHlt1 = True Tuple.TupleToolTISTOS.VerboseHlt2 = True Tuple.TupleToolTISTOS.FillL0 = True Tuple.TupleToolTISTOS.FillHlt1 = True Tuple.TupleToolTISTOS.FillHlt2 = True Tuple.TupleToolTISTOS.OutputLevel = INFO Tuple.TupleToolTISTOS.TriggerList = triggerList if DaVinci().Simulation is True: # for MC Tuple.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_eeLine2/Particles"] elif DaVinci().Simulation is False: # for Tuple Tuple.Inputs = ["/Event/Leptonic/Phys/Bu2LLK_eeLine2/Particles"] else: raise Exception(" `DaVinci().Simulation` not set.") Tuple.Decay = "[B+ -> ^(J/psi(1S) -> ^e+ ^e-) ^K+]CC" Tuple.addBranches({ "B" : "[B+ -> (J/psi(1S) -> e+ e-) K+]CC", "Psi" : "[B+ -> ^(J/psi(1S) -> e+ e-) K+]CC", "eplus" : "[B+ -> (J/psi(1S) -> ^e+ e-) K+]CC", "eminus" : "[B+ -> (J/psi(1S) -> e+ ^e-) K+]CC", "Kplus" : "[B+ -> (J/psi(1S) -> e+ e-) ^K+]CC" }) Tuple.TupleName = "DecayTree" #DecayTreeFitter fitter = Tuple.B.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI") fitter.constrainToOriginVertex = False fitter.daughtersToConstrain = [ "J/psi(1S)" ] fitter.Verbose = True #Isolation 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 ################################ ### DaVinci configuration #### ################################ DaVinci().InputType = 'DST' DaVinci().UserAlgorithms = [Tuple] DaVinci().MoniSequence += [Tuple] DaVinci().EvtMax = -1 DaVinci().Lumi = True
def execute(stripRun, stripConf, stripLine, dataType, hltReport, tupleDecay, evtMax, mag, outputType="ntuple", strippingStream = "Charm"): #0 "pi" "pi" #1 "mu" "mu" #2 "K" "pi" #3 "e" "mu" #4 "K" "mu" stripLines = { "kkpi":0, "kpipi":1, "pipipi":2, "kpipios":3, "kkk":4, "kkpios":5, "hhh":6, } lineNumber = stripLines[stripLine] # Now build the stream from StrippingConf.StrippingStream import StrippingStream ss = StrippingStream("ByTom") from StrippingSelections import StrippingD2hhh_conf line = False if stripConf == "default" or stripConf == "def": from StrippingArchive import Utils D2HHHConf, default_config = Utils.lineBuilderAndConf("stripping20","D2hhh") def_str_no_pre = default_config for key, val in def_str_no_pre.iteritems(): if "Prescale" in key: def_str_no_pre[key] = 1.0 D2HHHConf = StrippingD2hhh_conf.D2hhhConf('D2hhh',def_str_no_pre) D2hhhLines = D2HHHConf.lines() for line in D2hhhLines : print line.name(), line.outputLocation() ss.appendLines( [D2hhhLines[lineNumber]] ) stripOutputLoc = D2hhhLines[lineNumber].outputLocation() else: raise ValueError("Unknown value of stripConf: %s"%stripConf) from StrippingConf.Configuration import StrippingConf conf = StrippingConf( Streams = [ ss ] ) from Configurables import StrippingReport sr = StrippingReport(Selections = conf.selections()) MessageSvc().Format = "% F%60W%S%7W%R%T %0W%M" from Configurables import DaVinci from Configurables import LoKi__HDRFilter as StripFilter strfilter = StripFilter( 'StripPassFilter', Code="HLT_PASS('"+D2hhhLines[lineNumber].name()+"Decision')", Location="/Event/Strip/Phys/DecReports" ) #strfilter = StripFilter( 'StripPassFilter', Code="HLT_PASS('StrippingD2hhh_PPPLineDecision')", Location="/Event/Strip/Phys/DecReports" ) DaVinci().EventPreFilters += [strfilter] DaVinci().PrintFreq = 500 DaVinci().HistogramFile = 'DV_histos.root' DaVinci().TupleFile = "DPiPiPi_NTuple.root" DaVinci().EvtMax = evtMax storeExp = StoreExplorerAlg() storeExp.Load = 1 storeExp.PrintFreq = 10.0 #DaVinci().appendToMainSequence( [ storeExp ] ) if stripRun: #from Configurables import bankKiller #bk = bankKiller( "KillHltBanks", BankTypes = [ "Evt/Strip/Phys/DecReports", "Evt/AllStreams" ] ) #DaVinci().appendToMainSequence( [ bk ] ) from Configurables import EventNodeKiller enk = EventNodeKiller() enk.Nodes=[ "Event/Strip/Phys/DecReports", "Event/AllStreams"] DaVinci().appendToMainSequence( [ enk ] ) #DaVinci().appendToMainSequence( [ storeExp ] ) DaVinci().appendToMainSequence( [ conf.sequence() ] ) DaVinci().appendToMainSequence( [ sr ] ) if hltReport: from Configurables import ReadHltReport DaVinci().appendToMainSequence( [ ReadHltReport() ] ) DaVinci().InputType = 'MDST' DaVinci().RootInTES = "/Event/Charm" a = "->" if dataType == "MC10": DaVinci().DataType = "2010" DaVinci().Simulation = True DaVinci().DDDBtag = "head-20101206" if mag == "up": DaVinci().CondDBtag = "sim-20101210-vc-mu100" elif mag == "down": DaVinci().CondDBtag = "sim-20101210-vc-md100" DaVinci().Lumi = False elif dataType == "MC11": DaVinci().DataType = "2011" DaVinci().Simulation = True DaVinci().DDDBtag = "MC11-20111102" if mag == "up": DaVinci().CondDBtag = "sim-20111111-vc-mu100" elif mag == "down": DaVinci().CondDBtag = "sim-20111111-vc-md100" DaVinci().Lumi = False elif dataType == "MC11a": DaVinci().DataType = "2011" DaVinci().Simulation = True DaVinci().DDDBtag = "MC11-20111102" if mag == "up": DaVinci().CondDBtag = "sim-20111111-vc-mu100" elif mag == "down": DaVinci().CondDBtag = "sim-20111111-vc-md100" DaVinci().Lumi = False elif dataType == "MC2012": DaVinci().DataType = "2012" DaVinci().Simulation = True DaVinci().DDDBtag = "Sim08-20130503-1" if mag == "up": DaVinci().CondDBtag = "Sim08-20130503-1-vc-mu100" elif mag == "down": DaVinci().CondDBtag = "Sim08-20130503-1-vc-md100" DaVinci().Lumi = False elif dataType == "MC2011": DaVinci().DataType = "2011" DaVinci().Simulation = True DaVinci().DDDBtag = "Sim08-20130503" if mag == "up": DaVinci().CondDBtag = "Sim08-20130503-vc-mu100" elif mag == "down": DaVinci().CondDBtag = "Sim08-20130503-vc-md100" DaVinci().Lumi = False elif dataType == "data2012": a = "->" DaVinci().DataType = "2012" DaVinci().Simulation = False #DaVinci().DDDBtag = "dddb-20130111" #if mag == "up": #DaVinci().CondDBtag = "cond-20130114" #elif mag == "down": #DaVinci().CondDBtag = "cond-20130114" DaVinci().Lumi = True elif dataType == "data2011": a = "->" DaVinci().DataType = "2011" DaVinci().Simulation = False #DaVinci().DDDBtag = "dddb-20130111" #if mag == "up": #DaVinci().CondDBtag = "cond-20130114" #elif mag == "down": #DaVinci().CondDBtag = "cond-20130114" DaVinci().Lumi = True elif dataType == "data": sys.exit("correct the dataType to include the year") from Configurables import DecayTreeTuple from Configurables import TupleToolTISTOS from Configurables import TupleToolMassHypo, TupleToolSubMass if outputType in ["ntuple", "nt", "tuple", "root"]: print "stripOutputLoc:",stripOutputLoc dttuple = DecayTreeTuple( "DPiPiPi_NTuple" ) dttuple.ToolList = ["TupleToolGeometry", "TupleToolEventInfo", "TupleToolKinematic", #"TupleToolPrimaries", "TupleToolPropertime", "TupleToolAngles", "TupleToolPid", #"TupleToolRICHPid", "TupleToolDecay", #"TupleToolTrigger", #"TupleToolTrackPosition", #"TupleToolTrackInfo", #"TupleToolRecoStats", "TupleToolDira", "TupleToolDalitz", "TupleToolSubMass", ] dttuple.Inputs = [ stripOutputLoc ] print "tuple input :",dttuple.Inputs print "number of events:", DaVinci().EvtMax #[D+ -> pi- pi+ pi+]CC if tupleDecay == "pipipi": dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^pi+]CC" dttuple.addBranches ({ "D": "[D+ "+a+" pi- pi+ pi+]CC", "x1": "[D+ "+a+" ^pi- pi+ pi+]CC", "x2": "[D+ "+a+" pi- ^pi+ pi+]CC", "x3": "[D+ "+a+" pi- pi+ ^pi+]CC", }) elif tupleDecay == "kpipios": dttuple.Decay = "[D+ "+a+" ^pi- ^pi+ ^K+]CC" dttuple.addBranches ({ "D": "[D+ "+a+" pi- pi+ K+]CC", "x1": "[D+ "+a+" ^pi- pi+ K+]CC", "x2": "[D+ "+a+" pi- ^pi+ K+]CC", "x3": "[D+ "+a+" pi- pi+ ^K+]CC", }) elif tupleDecay == "ds2phipi": dttuple.Decay = "[D+ "+a+" ^mu+ ^mu- ^pi+]CC" dttuple.addBranches ({ "D": "[D+ "+a+" mu+ mu- pi+]CC", "x1": "[D+ "+a+" ^mu+ mu- pi+]CC", "x2": "[D+ "+a+" mu+ ^mu- pi+]CC", "x3": "[D+ "+a+" mu+ mu- ^pi+]CC", }) #if tupleDecay == "eta": #dttuple.Decay = "[(D+ "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi+),(D- "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi-)]" #dttuple.addBranches ({ #"D": "[(D+ "+a+" (eta "+a+" pi+ pi-) pi+),(D- "+a+" (eta "+a+" pi+ pi-) pi-)]", #"eta": "[(D+ "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi+),(D- "+a+" ^(eta "+a+" ^pi+ ^pi-) ^pi-)]", #"pip": "[(D+ "+a+" (eta "+a+" ^pi+ pi-) pi+),(D- "+a+" (eta "+a+" ^pi+ pi-) pi-)]", #"pim": "[(D+ "+a+" (eta "+a+" pi+ ^pi-) pi+),(D- "+a+" (eta "+a+" pi+ ^pi-) pi-)]", #"pi": "[(D+ "+a+" (eta "+a+" pi+ pi-) ^pi+),(D- "+a+" (eta "+a+" pi+ pi-) ^pi-)]", #}) dttuple.TupleName = "DPiPiPi_NTuple" ttmhk = TupleToolMassHypo("KaonHypo") ttmhk.PIDReplacements = { "pi+" : "K+"} #ttmhk.CC = True dttuple.D.addTool(ttmhk) dttuple.D.ToolList += ["TupleToolMassHypo/KaonHypo"] ttmhm = TupleToolMassHypo("MuonHypo") ttmhm.PIDReplacements = { "pi+" : "mu+"} #ttmhm.CC = True dttuple.D.addTool(ttmhm) dttuple.D.ToolList += ["TupleToolMassHypo/MuonHypo"] dttuple.addTool(TupleToolTISTOS()) dttuple.TupleToolTISTOS.VerboseL0 = True dttuple.TupleToolTISTOS.VerboseHlt1 = True dttuple.TupleToolTISTOS.VerboseHlt2 = True dttuple.TupleToolTISTOS.Verbose = True dttuple.ToolList += ["TupleToolTISTOS"] dttuple.TupleToolTISTOS.TriggerList = [ "L0CALODecision", "L0ElectronDecision", "L0PhotonDecision", "L0HadronDecision", "L0MuonDecision", "Hlt1TrackMuonDecision", "Hlt1TrackAllL0Decision", "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision", "Hlt2Topo4BodyBBDTDecision", 'Hlt2CharmHadD2HHHDecision', ] #+ [ trigger_name+"Decision" for trigger_name in # ["L0CALO","L0ElectronNoSPD","L0PhotonNoSPD","L0HadronNoSPD","L0MuonNoSPD","L0DiMuonNoSPD","L0Electron","L0ElectronHi","L0Photon","L0PhotonHi","L0Hadron","L0Muon","L0DiMuon","L0HighSumETJet","L0B1gas","L0B2gas",]\ # + ["Hlt1MBMicroBiasVelo","Hlt1Global","Hlt1DiMuonHighMass","Hlt1DiMuonLowMass","Hlt1SingleMuonNoIP","Hlt1SingleMuonHighPT","Hlt1TrackAllL0","Hlt1TrackMuon","Hlt1TrackPhoton","Hlt1Lumi","Hlt1LumiMidBeamCrossing","Hlt1MBNoBias","Hlt1MBMicroBiasVeloRateLimited","Hlt1MBMicroBiasTStation","Hlt1MBMicroBiasTStationRateLimited","Hlt1L0Any","Hlt1L0AnyRateLimited","Hlt1L0AnyNoSPD","Hlt1L0AnyNoSPDRateLimited","Hlt1NoPVPassThrough","Hlt1DiProton","Hlt1DiProtonLowMult","Hlt1BeamGasNoBeamBeam1","Hlt1BeamGasNoBeamBeam2","Hlt1BeamGasBeam1","Hlt1BeamGasBeam2","Hlt1BeamGasCrossingEnhancedBeam1","Hlt1BeamGasCrossingEnhancedBeam2","Hlt1BeamGasCrossingForcedReco","Hlt1ODINTechnical","Hlt1Tell1Error","Hlt1VeloClosingMicroBias","Hlt1BeamGasCrossingParasitic","Hlt1ErrorEvent","Hlt1SingleElectronNoIP","Hlt1TrackForwardPassThrough","Hlt1TrackForwardPassThroughLoose","Hlt1CharmCalibrationNoBias","Hlt1L0HighSumETJet","Hlt1BeamGasCrossingForcedRecoFullZ","Hlt1BeamGasHighRhoVertices","Hlt1VertexDisplVertex","Hlt1TrackAllL0Tight","Hlt1HighPtJetsSinglePV","Hlt1L0PU","Hlt1L0CALO",]\ # + ["Hlt2SingleElectronTFLowPt","Hlt2SingleElectronTFHighPt","Hlt2DiElectronHighMass","Hlt2DiElectronB","Hlt2B2HHLTUnbiased","Hlt2Topo2BodySimple","Hlt2Topo3BodySimple","Hlt2Topo4BodySimple","Hlt2Topo2BodyBBDT","Hlt2Topo3BodyBBDT","Hlt2Topo4BodyBBDT","Hlt2TopoMu2BodyBBDT","Hlt2TopoMu3BodyBBDT","Hlt2TopoMu4BodyBBDT","Hlt2TopoE2BodyBBDT","Hlt2TopoE3BodyBBDT","Hlt2TopoE4BodyBBDT","Hlt2IncPhi","Hlt2IncPhiSidebands","Hlt2CharmHadD02HHKsLL","Hlt2Dst2PiD02PiPi","Hlt2Dst2PiD02MuMu","Hlt2Dst2PiD02KMu","Hlt2Dst2PiD02KPi","Hlt2PassThrough","Hlt2Transparent","Hlt2Forward","Hlt2DebugEvent","Hlt2CharmHadD02HH_D02PiPi","Hlt2CharmHadD02HH_D02PiPiWideMass","Hlt2CharmHadD02HH_D02KK","Hlt2CharmHadD02HH_D02KKWideMass","Hlt2CharmHadD02HH_D02KPi","Hlt2CharmHadD02HH_D02KPiWideMass","Hlt2ExpressJPsi","Hlt2ExpressJPsiTagProbe","Hlt2ExpressLambda","Hlt2ExpressKS","Hlt2ExpressDs2PhiPi","Hlt2ExpressBeamHalo","Hlt2ExpressDStar2D0Pi","Hlt2ExpressHLT1Physics","Hlt2Bs2PhiGamma","Hlt2Bs2PhiGammaWideBMass","Hlt2Bd2KstGamma","Hlt2Bd2KstGammaWideKMass","Hlt2Bd2KstGammaWideBMass","Hlt2CharmHadD2KS0H_D2KS0Pi","Hlt2CharmHadD2KS0H_D2KS0K","Hlt2CharmRareDecayD02MuMu","Hlt2B2HH","Hlt2MuonFromHLT1","Hlt2SingleMuon","Hlt2SingleMuonHighPT","Hlt2SingleMuonLowPT","Hlt2DiProton","Hlt2DiProtonTF","Hlt2DiProtonLowMult","Hlt2DiProtonLowMultTF","Hlt2CharmSemilepD02HMuNu_D02KMuNuWS","Hlt2CharmSemilepD02HMuNu_D02PiMuNuWS","Hlt2CharmSemilepD02HMuNu_D02KMuNu","Hlt2CharmSemilepD02HMuNu_D02PiMuNu","Hlt2TFBc2JpsiMuX","Hlt2TFBc2JpsiMuXSignal","Hlt2DisplVerticesLowMassSingle","Hlt2DisplVerticesHighMassSingle","Hlt2DisplVerticesDouble","Hlt2DisplVerticesSinglePostScaled","Hlt2DisplVerticesHighFDSingle","Hlt2DisplVerticesSingleDown","Hlt2CharmSemilepD2HMuMu","Hlt2CharmSemilepD2HMuMuWideMass","Hlt2B2HHPi0_Merged","Hlt2CharmHadD2HHH","Hlt2CharmHadD2HHHWideMass","Hlt2DiMuon","Hlt2DiMuonLowMass","Hlt2DiMuonJPsi","Hlt2DiMuonJPsiHighPT","Hlt2DiMuonPsi2S","Hlt2DiMuonB","Hlt2DiMuonZ","Hlt2DiMuonDY1","Hlt2DiMuonDY2","Hlt2DiMuonDY3","Hlt2DiMuonDY4","Hlt2DiMuonDetached","Hlt2DiMuonDetachedHeavy","Hlt2DiMuonDetachedJPsi","Hlt2DiMuonNoPV","Hlt2TriMuonDetached","Hlt2TriMuonTau","Hlt2CharmSemilepD02HHMuMu","Hlt2CharmSemilepD02HHMuMuWideMass","Hlt2CharmHadD02HHHH","Hlt2CharmHadD02HHHHWideMass","Hlt2ErrorEvent","Hlt2Global","Hlt2diPhotonDiMuon","Hlt2LowMultMuon","Hlt2LowMultHadron","Hlt2LowMultPhoton","Hlt2LowMultElectron","Hlt2SingleTFElectron","Hlt2SingleTFVHighPtElectron","Hlt2B2HHLTUnbiasedDetached","Hlt2CharmHadLambdaC2KPPi","Hlt2SingleMuonVHighPT","Hlt2CharmSemilepD02HMuNu_D02KMuNuTight","Hlt2CharmHadMinBiasLambdaC2KPPi","Hlt2CharmHadMinBiasD02KPi","Hlt2CharmHadMinBiasD02KK","Hlt2CharmHadMinBiasDplus2hhh","Hlt2CharmHadMinBiasLambdaC2LambdaPi","Hlt2DisplVerticesSingle","Hlt2DisplVerticesDoublePostScaled","Hlt2DisplVerticesSingleHighMassPostScaled","Hlt2DisplVerticesSingleHighFDPostScaled","Hlt2DisplVerticesSingleMVPostScaled","Hlt2RadiativeTopoTrackTOS","Hlt2RadiativeTopoPhotonL0","Hlt2DiMuonPsi2SHighPT","Hlt2DoubleDiMuon","Hlt2DiMuonAndMuon","Hlt2DiMuonAndGamma","Hlt2DiMuonAndD0","Hlt2DiMuonAndDp","Hlt2DiMuonAndDs","Hlt2DiMuonAndLc","Hlt2CharmSemilepD02HHMuMuHardHadronsSoftMuons","Hlt2CharmSemilepD02HHMuMuHardHadronsSoftMuonsWideMass","Hlt2CharmSemilepD02HHMuMuHardHadronsAndMuons","Hlt2CharmSemilepD02HHMuMuHardHadronsAndMuonsWideMass","Hlt2TopoRad2BodyBBDT","Hlt2TopoRad2plus1BodyBBDT","Hlt2Lumi","Hlt2LowMultHadron_nofilter","Hlt2LowMultElectron_nofilter","Hlt2CharmHadD02HHKsDD","Hlt2CharmHadD2KS0KS0","Hlt2CharmHadD2KS0KS0WideMass","Hlt2ExpressD02KPi","Hlt2CharmHadLambdaC2KPPiWideMass","Hlt2CharmHadLambdaC2KPK","Hlt2CharmHadLambdaC2KPKWideMass","Hlt2CharmHadLambdaC2PiPPi","Hlt2CharmHadLambdaC2PiPPiWideMass","Hlt2CharmHadLambdaC2PiPK","Hlt2CharmHadLambdaC2PiPKWideMass","Hlt2CharmHadD2KS0H_D2KS0DDPi","Hlt2CharmHadD2KS0H_D2KS0DDK","Hlt2DiPhi","Hlt2CharmHadD02HHHHDstNoHltOne_4pi","Hlt2CharmHadD02HHHHDstNoHltOne_4piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_K3pi","Hlt2CharmHadD02HHHHDstNoHltOne_K3piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_KKpipi","Hlt2CharmHadD02HHHHDstNoHltOne_KKpipiWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_2K2pi","Hlt2CharmHadD02HHHHDstNoHltOne_2K2piWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_3Kpi","Hlt2CharmHadD02HHHHDstNoHltOne_3KpiWideMass","Hlt2CharmHadD02HHHHDstNoHltOne_Ch2","Hlt2CharmHadD02HHHHDstNoHltOne_Ch2WideMass","Hlt2CharmSemilep3bodyD2PiMuMu","Hlt2CharmSemilep3bodyD2PiMuMuSS","Hlt2CharmSemilep3bodyD2KMuMu","Hlt2CharmSemilep3bodyD2KMuMuSS","Hlt2CharmSemilep3bodyLambdac2PMuMu","Hlt2CharmSemilep3bodyLambdac2PMuMuSS","Hlt2LambdaC_LambdaC2Lambda0LLPi","Hlt2LambdaC_LambdaC2Lambda0LLK","Hlt2LambdaC_LambdaC2Lambda0DDPi","Hlt2LambdaC_LambdaC2Lambda0DDK","Hlt2RadiativeTopoTrack","Hlt2RadiativeTopoPhoton","Hlt2CharmHadD02HHHHDst_4pi","Hlt2CharmHadD02HHHHDst_4piWideMass","Hlt2CharmHadD02HHHHDst_K3pi","Hlt2CharmHadD02HHHHDst_K3piWideMass","Hlt2CharmHadD02HHHHDst_KKpipi","Hlt2CharmHadD02HHHHDst_KKpipiWideMass","Hlt2CharmHadD02HHHHDst_2K2pi","Hlt2CharmHadD02HHHHDst_2K2piWideMass","Hlt2CharmHadD02HHHHDst_3Kpi","Hlt2CharmHadD02HHHHDst_3KpiWideMass","Hlt2CharmHadD02HHHHDst_Ch2","Hlt2CharmHadD02HHHHDst_Ch2WideMass","Hlt2CharmSemilepD02PiPiMuMu","Hlt2CharmSemilepD02KKMuMu","Hlt2CharmSemilepD02KPiMuMu","Hlt2CharmHadD02HHHH_4pi","Hlt2CharmHadD02HHHH_4piWideMass","Hlt2CharmHadD02HHHH_K3pi","Hlt2CharmHadD02HHHH_K3piWideMass","Hlt2CharmHadD02HHHH_KKpipi","Hlt2CharmHadD02HHHH_KKpipiWideMass","Hlt2CharmHadD02HHHH_2K2pi","Hlt2CharmHadD02HHHH_2K2piWideMass","Hlt2CharmHadD02HHHH_3Kpi","Hlt2CharmHadD02HHHH_3KpiWideMass","Hlt2CharmHadD02HHHH_Ch2","Hlt2CharmHadD02HHHH_Ch2WideMass","Hlt2DiMuonDetachedPsi2S","Hlt2CharmHadD02HHXDst_hhX","Hlt2CharmHadD02HHXDst_hhXWideMass","Hlt2LowMultD2KPi","Hlt2LowMultD2KPiPi","Hlt2LowMultD2K3Pi","Hlt2LowMultChiC2HH","Hlt2LowMultChiC2HHHH","Hlt2LowMultD2KPiWS","Hlt2LowMultD2KPiPiWS","Hlt2LowMultD2K3PiWS","Hlt2LowMultChiC2HHWS","Hlt2LowMultChiC2HHHHWS","Hlt2LowMultDDInc","Hlt2DisplVerticesSingleLoosePS","Hlt2DisplVerticesSingleHighFD","Hlt2DisplVerticesSingleVeryHighFD","Hlt2DisplVerticesSingleHighMass","Hlt2DisplVerticesSinglePS","Hlt2DisplVerticesDoublePS","Hlt2CharmHadD2HHHKsLL","Hlt2CharmHadD2HHHKsDD","Hlt2KshortToMuMuPiPi","Hlt2LowMultChiC2PP","Hlt2LowMultDDIncCP","Hlt2LowMultDDIncVF","Hlt2LowMultLMR2HH","Hlt2HighPtJets","Hlt2ChargedHyperon_Xi2Lambda0LLPi","Hlt2ChargedHyperon_Xi2Lambda0LLMu","Hlt2ChargedHyperon_Omega2Lambda0LLK","Hlt2ChargedHyperon_Xi2Lambda0DDPi","Hlt2ChargedHyperon_Xi2Lambda0DDMu","Hlt2ChargedHyperon_Omega2Lambda0DDK","Hlt2CharmHadD02HHXDst_BaryonhhX","Hlt2CharmHadD02HHXDst_BaryonhhXWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSLL","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSLLWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0LL","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0LLWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSDD","Hlt2CharmHadD02HHXDst_BaryonhhXWithKSDDWideMass","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0DD","Hlt2CharmHadD02HHXDst_BaryonhhXWithLambda0DDWideMass","Hlt2CharmHadD02HHXDst_LeptonhhX","Hlt2CharmHadD02HHXDst_LeptonhhXWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSLL","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSLLWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0LL","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0LLWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSDD","Hlt2CharmHadD02HHXDst_LeptonhhXWithKSDDWideMass","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0DD","Hlt2CharmHadD02HHXDst_LeptonhhXWithLambda0DDWideMass"] # ] from Configurables import LoKi__Hybrid__TupleTool LoKi_DTFMASS = LoKi__Hybrid__TupleTool("LoKi_DTFMASS") LoKi_DTFMASS.Variables = { "DTF_CHI2" : "DTF_CHI2( True )", "DTF_NDOF" : "DTF_NDOF( True )", "DTF_D_M" : "DTF_FUN ( M , True )", "DTF_D_MM" : "DTF_FUN ( MM , True )", "DTF_D_P" : "DTF_FUN ( P , True )", "DTF_D_PT" : "DTF_FUN ( PT , True )", "DTF_D_PE" : "DTF_FUN ( E , True )", "DTF_D_PX" : "DTF_FUN ( PX , True )", "DTF_D_PY" : "DTF_FUN ( PY , True )", "DTF_D_PZ" : "DTF_FUN ( PZ , True )", "DTF_x1_M" : "DTF_FUN ( CHILD(M,1) , True )", "DTF_x1_MM" : "DTF_FUN ( CHILD(MM,1) , True )", "DTF_x1_P" : "DTF_FUN ( CHILD(P,1) , True )", "DTF_x1_PT" : "DTF_FUN ( CHILD(PT,1) , True )", "DTF_x1_PE" : "DTF_FUN ( CHILD(E,1) , True )", "DTF_x1_PX" : "DTF_FUN ( CHILD(PX,1) , True )", "DTF_x1_PY" : "DTF_FUN ( CHILD(PY,1) , True )", "DTF_x1_PZ" : "DTF_FUN ( CHILD(PZ,1) , True )", "DTF_x2_M" : "DTF_FUN ( CHILD(M,2) , True )", "DTF_x2_MM" : "DTF_FUN ( CHILD(MM,2) , True )", "DTF_x2_P" : "DTF_FUN ( CHILD(P,2) , True )", "DTF_x2_PT" : "DTF_FUN ( CHILD(PT,2) , True )", "DTF_x2_PE" : "DTF_FUN ( CHILD(E,2) , True )", "DTF_x2_PX" : "DTF_FUN ( CHILD(PX,2) , True )", "DTF_x2_PY" : "DTF_FUN ( CHILD(PY,2) , True )", "DTF_x2_PZ" : "DTF_FUN ( CHILD(PZ,2) , True )", "DTF_x3_M" : "DTF_FUN ( CHILD(M,3) , True )", "DTF_x3_MM" : "DTF_FUN ( CHILD(MM,3) , True )", "DTF_x3_P" : "DTF_FUN ( CHILD(P,3) , True )", "DTF_x3_PT" : "DTF_FUN ( CHILD(PT,3) , True )", "DTF_x3_PE" : "DTF_FUN ( CHILD(E,3) , True )", "DTF_x3_PX" : "DTF_FUN ( CHILD(PX,3) , True )", "DTF_x3_PY" : "DTF_FUN ( CHILD(PY,3) , True )", "DTF_x3_PZ" : "DTF_FUN ( CHILD(PZ,3) , True )", } dttuple.D.ToolList+=["LoKi::Hybrid::TupleTool/LoKi_DTFMASS"] dttuple.D.addTool(LoKi_DTFMASS) if "MC" in dataType: from Configurables import TupleToolMCBackgroundInfo dttuple.addTool(TupleToolMCBackgroundInfo, name="TupleToolMCBackgroundInfo") dttuple.TupleToolMCBackgroundInfo.Verbose=True dttuple.addTool(TupleToolMCTruth, name="truth") dttuple.truth.ToolList += ["MCTupleToolHierarchy", "MCTupleToolKinematic"] dttuple.ToolList+=["TupleToolMCBackgroundInfo/TupleToolMCBackgroundInfo"] dttuple.ToolList+=["TupleToolMCTruth/truth"] DaVinci().appendToMainSequence( [ dttuple ] ) elif outputType == "dst": from Configurables import SelDSTWriter if stripRun: dst_Sel = AutomaticData(Location = stripOutputLoc) else: dst_Sel = AutomaticData(Location = "/Event/"+strippingStream+"/" + stripOutputLoc) dst_Filter = FilterDesktop('dst_Filter', Code = "ALL") dst_FilterSel = Selection(name = line.name().replace("Stripping",""), Algorithm = dst_Filter, RequiredSelections = [ dst_Sel ]) dst_Seq = SelectionSequence('lsdata', TopSelection = dst_FilterSel, ) dstw = SelDSTWriter("DSTWriter") dstw.OutputFileSuffix = "PiPiPi" #dstw.CopyProtoParticles = False dstw.SelectionSequences = [dst_Seq] #dstw.CopyL0DUReport = False #dstw.CopyHltDecReports = False #dstw.CopyMCTruth = True #dstw.CopyBTags = True DaVinci().appendToMainSequence( [ dstw.sequence() ] )
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
def execute_option_file(): B2JpsiK = DecayTreeTuple('B2JpsiK') B2JpsiK.ToolList = [ "TupleToolGeometry" , "TupleToolKinematic" , "TupleToolEventInfo" , "TupleToolPropertime" , "TupleToolTrigger" , "TupleToolTISTOS" , "TupleToolPid" , "TupleToolTrackInfo" , "TupleToolPrimaries" , "TupleToolDira" , "TupleToolTrackIsolation" , "TupleToolTrackPosition" , "TupleToolRecoStats" ] if DaVinci().Simulation is True: B2JpsiK.ToolList +=[ "TupleToolMCBackgroundInfo" , "TupleToolMCTruth" ] 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", "Hlt2Topo2BodyBBDTDecision", "Hlt2Topo3BodyBBDTDecision", "Hlt2Topo4BodyBBDTDecision", ##others "Hlt2PassThroughDecision", "Hlt2TransparentDecision", ## inclusive decisions "Hlt2DiMuonDY.*Decision","Hlt2TopoE.*Decision", "Hlt2Topo.*Decision", "Hlt2Charm.*Decision", "Hlt2DiElectron.*Decision" ] triggerList = L0Triggers + Hlt1Triggers + Hlt2Triggers B2JpsiK.addTool(TupleToolTISTOS) B2JpsiK.TupleToolTISTOS.VerboseL0 = True B2JpsiK.TupleToolTISTOS.VerboseHlt1 = True B2JpsiK.TupleToolTISTOS.VerboseHlt2 = True B2JpsiK.TupleToolTISTOS.FillL0 = True B2JpsiK.TupleToolTISTOS.FillHlt1 = True B2JpsiK.TupleToolTISTOS.FillHlt2 = True B2JpsiK.TupleToolTISTOS.OutputLevel = INFO B2JpsiK.TupleToolTISTOS.TriggerList = triggerList if DaVinci().Simulation is True: # for MC B2JpsiK.Inputs = ["/Event/AllStreams/Phys/Bs2MuMuLinesBu2JPsiKLine/Particles"] elif DaVinci().Simulation is False: # for Data B2JpsiK.Inputs = ["/Event/Dimuon/Phys/Bs2MuMuLinesBu2JPsiKLine/Particles"] else: raise Exception(" `DaVinci().Simulation` not set.") B2JpsiK.Decay = "[B+ -> ^(J/psi(1S) -> ^mu+ ^mu-) ^K+]CC" B2JpsiK.addBranches({ "Bplus" : "[B+ -> (J/psi(1S) -> mu+ mu-) K+]CC", "Jpsi" : "[B+ -> ^(J/psi(1S) -> mu+ mu-) K+]CC", "muplus" : "[B+ -> (J/psi(1S) -> ^mu+ mu-) K+]CC", "muminus" : "[B+ -> (J/psi(1S) -> mu+ ^mu-) K+]CC", "Kplus" : "[B+ -> (J/psi(1S) -> mu+ mu-) ^K+]CC" }) B2JpsiK.TupleName = "default" fitter = B2JpsiK.Bplus.addTupleTool("TupleToolDecayTreeFitter/FIX_JPSI") fitter.constrainToOriginVertex = False fitter.daughtersToConstrain = [ "J/psi(1S)" ] fitter.Verbose = True ################################ ### DaVinci configuration #### ################################ DaVinci().InputType = 'DST' DaVinci().UserAlgorithms = [B2JpsiK] DaVinci().MoniSequence += [B2JpsiK] DaVinci().EvtMax = -1 DaVinci().Lumi = True