def associateSequence(prefix,debug): from Gaudi.Configuration import GaudiSequencer from Configurables import TrackAssociator, ChargedPP2MC base = "/Event/Turbo/" protos = prefix + "Protos" tracks = prefix + "Tracks" protocont = base + protos trackcont = base + tracks relloc = "Relations/Turbo/" + protos assoctr = TrackAssociator(prefix+"AssocTr") assoctr.TracksInContainer = trackcont assocpp=ChargedPP2MC(prefix+"ProtoAssocPP") assocpp.RootInTES=base assocpp.TrackLocations = [ trackcont ] assocpp.InputData = [ protocont ] assocpp.OutputTable = relloc if debug == True: assocpp.OutputLevel = 2 assoctr.OutputLevel = 2 # Add it to a selection sequence seq = GaudiSequencer(prefix+'SeqP2MC') seq.Members += [assoctr,assocpp] return seq
#makeAllParticles("SmrdNoPIDKaons", "Best", "kaon") from Configurables import TrackSmeared output = "Smeared" #/Rec/Track/Smeared TrackSmeared("TrackSmearing").OutputLocation = output TrackSmeared("TrackSmearing").smear = True TrackSmeared("TrackSmearing").makePlots = True TrackSmeared("TrackSmearing").OutputLevel = 2 TrackSmeared("TrackSmearing").smearProto = True TrackSmearingSeq = GaudiSequencer("TrackSmearingSeq") #Preserve MC from Configurables import TrackToDST, ChargedPP2MC, TrackAssociator assoctr = TrackAssociator(output+"AssocTr") assoctr.TracksInContainer = "Rec/Track/"+output assocpp=ChargedPP2MC(output+"AssocPP") assocpp.TrackLocations = [ "Rec/Track/"+output ] assocpp.InputData = [ "Rec/ProtoP/"+output+"ProtoPMaker" ] assocpp.OutputTable = "Relations/Rec/ProtoP/"+output+"ProtoPMaker" TrackSmearingSeq.Members = [ TrackSmeared("TrackSmearing") , assoctr, assocpp ] from Configurables import CombinedParticleMaker from CommonParticles.Utils import * from Configurables import ProtoParticleCALOFilter ## create the algorithm algorithm = CombinedParticleMaker ( 'SmrdLoosePions' , Particle = 'pion' ) # configure the track selector selector = trackSelector ( algorithm ) ## add this line,
def _configureOutput(self): fname = self.getProp('outputFile') if not fname : return #retrieve the persistency persistency=None if hasattr(self, "Persistency"): if self.getProp("Persistency") is not None: persistency=self.getProp("Persistency") from GaudiConf import IOExtension, IOHelper iox=IOExtension(persistency) writer = InputCopyStream(self.writerName) writer.OutputLevel = self.getProp('OutputLevel') seq=GaudiSequencer('TeslaReportAlgoSeq') writer.RequireAlgs += ['TeslaReportAlgoSeq'] # make use of PrintDuplicates algorithm from Configurables import PrintDuplicates dplic = PrintDuplicates("TurboDuplicates") dplic.OutputLevel = self.getProp('OutputLevel') # if self.getProp('Mode') is "Online": from DAQSys.Decoders import DecoderDB Hlt1VertexReportsDecoder=DecoderDB["HltVertexReportsDecoder/Hlt1VertexReportsDecoder"].setup() Hlt2VertexReportsDecoder=DecoderDB["HltVertexReportsDecoder/Hlt2VertexReportsDecoder"].setup() Hlt2SelReportsDecoder=DecoderDB["HltSelReportsDecoder/Hlt2SelReportsDecoder"].setup() seq.Members += [ Hlt1VertexReportsDecoder, Hlt2VertexReportsDecoder, Hlt2SelReportsDecoder ] # lines = self.getProp('TriggerLines') trig1 = self._configureReportAlg(lines) seq.Members+=[trig1] for l in lines: # IF NOT PACKING NEED TO SET THE LOCATIONS IN THE REPORT ALGORITHM if not self.getProp('Pack'): writer.OptItemList+=[ self.base + l + "/Particles#99" , self.base + l + "/Vertices#99" , self.base + l + "/_ReFitPVs#99" , self.base + l + "/Particle2VertexRelations#99" ] dplic.Inputs+=[self.base + l + "/Particles"] if not self.getProp('Pack'): writer.OptItemList+=[ self.base + "Protos#99" ,self.base + "Tracks#99" ,self.base + "RichPIDs#99" ,self.base + "MuonPIDs#99" ,self.base + "CaloHypos#99" ,self.base + "CaloClusters#99" ] inputType = self.getProp('InputType') if (inputType=='XDST') or (inputType=='LDST'): assocpp=ChargedPP2MC("TurboProtoAssocPP") assocpp.OutputLevel = self.getProp('OutputLevel') assocpp.TrackLocations = [] assocpp.InputData = [] assocpp.VetoEmpty=True tesROOT="/Event/"+self.base outputPPLoc = tesROOT+'Relations/Turbo/' assocpp.RootInTES=tesROOT truthSeq = self._configureTruth(assocpp) seq.Members += [ truthSeq ] if not self.getProp('Pack'): writer.OptItemList+=[ outputPPLoc + 'Protos' + '#99' ] seq.Members+=[assocpp] NeutralProtoSeq = GaudiSequencer("NeutralTruthSequencer") ## Add the digits associator outputDigiLoc = tesROOT + "Digi2MCP" from Configurables import CaloDigit2MCLinks2Table assocdigits = CaloDigit2MCLinks2Table("TurboDigitAssoc") assocdigits.OutputLevel = self.getProp('OutputLevel') outputiDigiLoc = tesROOT + "Relations/CaloDigits" assocdigits.Output = outputDigiLoc ## Add the cluster associator ## Finally configure the neutral PP2MC associator NeutralProtoSeq.Members+=[assocdigits] clustLoc = self.base + "CaloClusters" protoLoc = self.base + "Protos" self._configureDigitsTruth() protoneutral, retSeq = self._configureClustersAndProtosTruth(outputDigiLoc) NeutralProtoSeq.Members+=[retSeq] if not self.getProp('Pack'): writer.OptItemList+=[ protoneutral + '#99' ] seq.Members+=[NeutralProtoSeq] # Add shared places to writer if not self.getProp('Pack'): writer.OptItemList+=[ self.base + "Primary#99" , self.base + "Rec/Summary#99" ] if self.getProp('Pack'): packer = PackParticlesAndVertices( name = "TurboPacker", InputStream = "/Event"+"/"+self.base.rstrip('/'), DeleteInput = False, EnableCheck = False, AlwaysCreateOutput = True) seq.Members +=[packer] from Configurables import PackCaloHypo as PackCaloHypos hypopacker = PackCaloHypos( name = "PackCaloHypos", AlwaysCreateOutput = True, DeleteInput = False, OutputLevel = self.getProp('OutputLevel'), InputName = self.base+"CaloHypos", OutputName = self.base+"pRec/neutral/Hypos" ) from Configurables import DataPacking__Pack_LHCb__CaloClusterPacker_ as PackCaloClusters clusterpacker = PackCaloClusters( name = "PackCaloClusters", AlwaysCreateOutput = True, DeleteInput = False, OutputLevel = self.getProp('OutputLevel'), InputName = self.base+"CaloClusters", OutputName = self.base+"pRec/neutral/Clusters" ) seq.Members +=[hypopacker,clusterpacker] writer.OptItemList+=[ self.base+"pPhys/Particles#99" ,self.base+"pPhys/Vertices#99" ,self.base+"pPhys/RecVertices#99" ,self.base+"pPhys/Relations#99" ,self.base+"pPhys/PP2MCPRelations#99" ,self.base+"pPhys/PartToRelatedInfoRelations#99" ,self.base+"pRec/Track/Custom#99" ,self.base+"pRec/Muon/CustomPIDs#99" ,self.base+"pRec/Rich/CustomPIDs#99" ,self.base+"pRec/ProtoP/Custom#99" ,self.base+"pRec/neutral/Hypos#99" ,self.base+"pRec/neutral/Clusters#99" ,self.base+"Rec/Summary#99" ] packer.OutputLevel = self.getProp('OutputLevel') self.teslaSeq.Members += [ seq ] if self.getProp('DuplicateCheck'): self.teslaSeq.Members += [dplic] IOHelper(persistency,persistency).outStream(fname,writer,writeFSR=self.getProp('WriteFSR'))
def makeMyProtoP(trackcont): unpacker = UnpackTrack(trackcont + "UnpackTrack") unpacker.InputName = "pRec/Track/" + trackcont unpacker.OutputName = "Rec/Track/" + trackcont refitter = TrackSmeared(trackcont + "TrackSmeared") refitter.InputLocation = "Rec/Track/" + trackcont refitter.OutputLocation = "Refit" refitter.smear = 1 #refitter.makePlots = 1 #refitter.OutputLevel = 2 #idalg = MuonIDAlg("BestIDalg") #idalg.OutputLevel = 0 #cm=ConfiguredMuonIDs.ConfiguredMuonIDs(data=DaVinci().getProp("DataType")) #cm.configureMuonIDAlg(idalg) #idalg.TrackLocation = "Rec/Track/Refit" #idalg.MuonIDLocation = "Rec/Muon/MuonPID/Refit" downprotoseq = GaudiSequencer(trackcont + "ProtoPSeq") downprotos = ChargedProtoParticleMaker(trackcont + "ProtoPMaker") downprotos.InputTrackLocation = ["Rec/Track/Refit"] downprotos.OutputProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker" downprotos.addTool(DelegatingTrackSelector, name="TrackSelector") #downprotos.OutputLevel = 0 tracktypes = ["Long", "Upstream", "Downstream", "Ttrack", "Velo", "VeloR"] downprotos.TrackSelector.TrackTypes = tracktypes selector = downprotos.TrackSelector for tsname in tracktypes: selector.addTool(TrackSelector, name=tsname) ts = getattr(selector, tsname) # Set Cuts ts.TrackTypes = [tsname] #set up associators #addmuonpid = ChargedProtoParticleAddMuonInfo("Bestaddmuoninfo") #addmuonpid.InputMuonPIDLocation = "Rec/Muon/MuonPID/Refit" #addmuonpid.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" #addmuonpid.OutputLevel = 0 addrichpid = ChargedProtoParticleAddRichInfo("Bestaddrichinfo") addrichpid.InputRichPIDLocation = "Rec/Rich/Refit" #addrichpid.InputRichPIDLocation = "Rec/Rich/"+trackcont addrichpid.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker" #addcalopid = ChargedProtoParticleAddCaloInfo("Bestaddcaloinfo") #addcalopid.InputRichCALOLocation = "Rec/Rich/Refit" #addcalopid.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" combinedll = ChargedProtoCombineDLLsAlg("BestCombineDLL") combinedll.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker" assoctr = TrackAssociator(trackcont + "AssocTr") #assoctr.TracksInContainer = "Rec/Track/"+trackcont assoctr.TracksInContainer = "Rec/Track/Refit" assocpp = ChargedPP2MC(trackcont + "AssocPP") #assocpp.TrackLocations = [ "Rec/Track/"+trackcont ] assocpp.TrackLocations = ["Rec/Track/Refit"] assocpp.InputData = ["Rec/ProtoP/" + trackcont + "ProtoPMaker"] #assocpp.InputData = [ "Rec/ProtoP/Refit" ] assocpp.OutputTable = "Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker" # DST post treatment TrackToDST(trackcont + "TrackToDST").TracksInContainer = "Rec/Track/" + trackcont #downprotoseq.Members += [ TrackToDST(trackcont+"TrackToDST"), assoctr, downprotos, assocpp,addrichpid,combinedll ] if not DaVinci().Simulation: downprotoseq.Members += [ TrackToDST(trackcont + "TrackToDST"), downprotos, addrichpid, combinedll ] DataOnDemandSvc().AlgMap.update({ "/Event/Rec/Track/" + trackcont: unpacker.getFullName(), "/Event/Rec/Track/Refit": refitter.getFullName(), "/Event/Rec/Rich/Refit": downprotoseq.getFullName(), "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker": downprotoseq.getFullName(), "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker": downprotoseq.getFullName() }) else: if (DaVinci().Simulation): downprotoseq.Members += [ TrackToDST(trackcont + "TrackToDST"), assoctr, downprotos, addrichpid, combinedll, assocpp ] DataOnDemandSvc().AlgMap.update({ "/Event/Rec/Track/" + trackcont: unpacker.getFullName(), "/Event/Rec/Track/Refit": refitter.getFullName(), "/Event/Rec/Rich/Refit": downprotoseq.getFullName(), "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker": downprotoseq.getFullName(), "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker": downprotoseq.getFullName() })
## configure Data-On-Demand service locations = updateDoD ( algorithm ) ## finally: define the symbol StdNoPIDsDownMuons = algorithm ## MCTRUTH MATCHING myprotos = ChargedProtoParticleMaker("MyProtoParticles", Inputs = ["Rec/Track/Best"], Output = "Rec/ProtoP/MyProtoParticles") protop_locations = [myprotos.Output] charged = ChargedPP2MC("myprotos") charged.InputData = protop_locations #ChargedPP2MC().InputData = protop_locations myseq = GaudiSequencer("myseq") #myseq.Members +=[myprotos,ChargedPP2MC()] myseq.Members +=[myprotos,charged] DaVinci().UserAlgorithms+=[myseq] ## def get_mcpar(proto): LinkRef = GaudiPython.gbl.LHCb.LinkReference() linker = TES["Link/Rec/ProtoP/MyProtoParticles/PP2MC"] ok = linker.firstReference(proto.key(), None ,LinkRef) if not ok: return 0 return TES["MC/Particles"][LinkRef.objectKey()]
else: dst_file_name = '/scratch29/KsPiPiee/' + magnet + '/00037694_000000' + i + '_1.allstreams.dst' if os.path.isfile(dst_file_name): dst_file.append(dst_file_name) DaVinci().Input = dst_file ## MCTRUTH MATCHING myprotos = ChargedProtoParticleMaker("MyProtoParticles", Inputs=["Rec/Track/Best"], Output="Rec/ProtoP/MyProtoParticles") protop_locations = [myprotos.Output] ChargedPP2MC().InputData = protop_locations myseq = GaudiSequencer("myseq") myseq.Members += [myprotos, ChargedPP2MC()] DaVinci().UserAlgorithms += [myseq] ############ gaudi = GaudiPython.AppMgr() gaudi.initialize() TES = gaudi.evtsvc() ## GET MCPAR FROM PROTO def get_mcpar(proto): LinkRef = GaudiPython.gbl.LHCb.LinkReference() linker = TES["Link/Rec/ProtoP/MyProtoParticles/PP2MC"]
def makeMyProtoP(trackcont): unpacker = UnpackTrack(trackcont + "UnpackTrack") unpacker.InputName = "pRec/Track/" + trackcont unpacker.OutputName = "Rec/Track/" + trackcont smeartracks = TrackSmeared(trackcont + "TrackSmeared") smeartracks.InputLocation = "Rec/Track/" + trackcont outputLocation = "Smeared" smeartracks.OutputLocation = outputLocation smeartracks.smearCopied = True smeartracks.smear = 1 #smeartracks.makePlots = 1 #smeartracks.OutputLevel = 2 protoseq = GaudiSequencer(trackcont + "ProtoPSeq") protos = ChargedProtoParticleMaker(trackcont + "ProtoPMaker") protos.InputTrackLocation = ["Rec/Track/" + outputLocation] protos.OutputProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker" protos.addTool(DelegatingTrackSelector, name="TrackSelector") #protos.OutputLevel = 0 tracktypes = ["Long", "Upstream", "Downstream", "Ttrack", "Velo", "VeloR"] protos.TrackSelector.TrackTypes = tracktypes selector = protos.TrackSelector for tsname in tracktypes: selector.addTool(TrackSelector, name=tsname) ts = getattr(selector, tsname) # Set Cuts ts.TrackTypes = [tsname] # Add PID information idalg = MuonIDAlg("BestIDalg") #idalg.OutputLevel = 5 cm = ConfiguredMuonIDs.ConfiguredMuonIDs( data=DaVinci().getProp("DataType")) cm.configureMuonIDAlg(idalg) idalg.TrackLocation = "Rec/Track/" + outputLocation idalg.MuonIDLocation = "Rec/Muon/MuonPID/" + outputLocation from Configurables import ( ChargedProtoParticleAddRichInfo, ChargedProtoParticleAddMuonInfo, ChargedProtoParticleAddEcalInfo, ChargedProtoParticleAddBremInfo, ChargedProtoParticleAddHcalInfo, ChargedProtoParticleAddPrsInfo, ChargedProtoParticleAddSpdInfo, ChargedProtoParticleAddVeloInfo, ChargedProtoCombineDLLsAlg) addmuonpid = ChargedProtoParticleAddMuonInfo("Bestaddmuoninfo") addmuonpid.InputMuonPIDLocation = "Rec/Muon/MuonPID/" + outputLocation addmuonpid.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker" addrichpid = ChargedProtoParticleAddRichInfo("Bestaddrichinfo") addrichpid.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker" # The rich pid is added to the track in TrackSmeared, thus only kaon pion pid is consistent # the others are not implemented. The modes smearBest and smearProto don't have the problems #addcalopid = ChargedProtoParticleAddCaloInfo("Bestaddcaloinfo") #addcalopid.InputRichCALOLocation = "Rec/Rich/"+outputLocation #addcalopid.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" #ecal = ChargedProtoParticleAddEcalInfo("ChargedProtoPAddEcal") #ecal.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" #brem = ChargedProtoParticleAddBremInfo("ChargedProtoPAddBrem") #brem.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" #hcal = ChargedProtoParticleAddHcalInfo("ChargedProtoPAddHcal") #hcal.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" #prs = ChargedProtoParticleAddPrsInfo("ChargedProtoPAddPrs") #prs.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" #spd = ChargedProtoParticleAddSpdInfo("ChargedProtoPAddSpd") #spd.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" #velo = ChargedProtoParticleAddVeloInfo("ChargedProtoPAddVeloDEDX") #velo.ProtoParticleLocation = "Rec/ProtoP/"+trackcont+"ProtoPMaker" combinedll = ChargedProtoCombineDLLsAlg("BestCombineDLL") combinedll.ProtoParticleLocation = "Rec/ProtoP/" + trackcont + "ProtoPMaker" #set up associators assoctr = TrackAssociator(trackcont + "AssocTr") assoctr.TracksInContainer = "Rec/Track/" + outputLocation assocpp = ChargedPP2MC(trackcont + "AssocPP") assocpp.TrackLocations = ["Rec/Track/" + outputLocation] assocpp.InputData = ["Rec/ProtoP/" + trackcont + "ProtoPMaker"] assocpp.OutputTable = "Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker" # DST post treatment TrackToDST(trackcont + "TrackToDST").TracksInContainer = "Rec/Track/" + trackcont if not DaVinci().Simulation: protoseq.Members += [TrackToDST(trackcont + "TrackToDST"), protos] protoseq.Members += [ ecal, brem, hcal, prs, spd, velo, addrichpid, addmuonpid, combinedll ] DataOnDemandSvc().AlgMap.update({ "/Event/Rec/Track/" + trackcont: unpacker.getFullName(), "/Event/Rec/Track/" + outputLocation: smeartracks.getFullName(), "/Event/Rec/Rich/" + outputLocation: protoseq.getFullName(), "/Event/Rec/Muon/MuonPID/" + outputLocation: idalg.getFullName(), "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker": protoseq.getFullName(), "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker": protoseq.getFullName() }) else: if (DaVinci().Simulation): protoseq.Members += [ TrackToDST(trackcont + "TrackToDST"), assoctr, protos ] #protoseq.Members += [ ecal,brem,hcal,prs,spd,velo,addrichpid,addmuonpid,combinedll,assocpp ] protoseq.Members += [ idalg, addmuonpid, addrichpid, combinedll, assocpp ] DataOnDemandSvc().AlgMap.update({ "/Event/Rec/Track/" + trackcont: unpacker.getFullName(), "/Event/Rec/Track/" + outputLocation: smeartracks.getFullName(), "/Event/Rec/Rich/" + outputLocation: protoseq.getFullName(), "/Event/Rec/Muon/MuonPID/" + outputLocation: idalg.getFullName(), "/Event/Rec/ProtoP/" + trackcont + "ProtoPMaker": protoseq.getFullName(), "/Event/Relations/Rec/ProtoP/" + trackcont + "ProtoPMaker": protoseq.getFullName() })
def execute(simulation=True, turbo=True, decay_descriptor="J/psi(1S) -> mu- mu+"): # Configure all the unpacking, algorithms, tags and input files appConf = ApplicationMgr() appConf.ExtSvc += ['ToolSvc', 'DataOnDemandSvc', LoKiSvc()] ConfigTarFileAccessSvc().File = 'config.tar' dv = DaVinci() dv.DataType = "2012" lhcbApp = LHCbApp() lhcbApp.Simulation = simulation CondDB().Upgrade = False dtt = DecayTreeTuple("Early2015") if turbo: tesla_prefix = "Hlt2DiMuonJPsi" dtt.Inputs = ["/Event/" + tesla_prefix + "/Particles"] dtt.InputPrimaryVertices = "/Event/" + tesla_prefix + "/Primary" dtt.WriteP2PVRelations = False else: LHCbApp().DDDBtag = "dddb-20140729" polarity = "u" LHCbApp().CondDBtag = "sim-20140730-vc-m%s100" % polarity muons = AutomaticData(Location="Phys/StdAllLooseMuons/Particles") jpsi = CombineParticles('MyJPsi') jpsi.DecayDescriptors = [decay_descriptor] jpsi.CombinationCut = "(AM < 7100.0 *GeV)" jpsi.DaughtersCuts = {"": "ALL", "mu+": "ALL", "mu-": "ALL"} jpsi.MotherCut = "(VFASPF(VCHI2/VDOF) < 999999.0)" code = """ ('J/psi(1S)' == ID) & in_range(2.990*GeV, M, 3.210*GeV) & DECTREE('%s') & CHILDCUT(1, HASMUON & ISMUON) & CHILDCUT(2, HASMUON & ISMUON) & (MINTREE('mu+' == ABSID, PT) > 700*MeV) & (MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF) < 5) & (MINTREE(ISBASIC & HASTRACK, CLONEDIST) > 5000) & (VFASPF(VPCHI2) > 0.5/100) & (abs(BPV(VZ)) < 0.5*meter) & (BPV(vrho2) < (10*mm)**2) """ % (decay_descriptor) # similar to the HLT2 line code = """ (ADMASS('J/psi(1S)')< 120*MeV) & DECTREE('%s') & (PT>0*MeV) & (MAXTREE('mu-'==ABSID,TRCHI2DOF) < 4) & (MINTREE('mu-'==ABSID,PT)> 0*MeV) & (VFASPF(VCHI2PDOF)< 25) """ % (decay_descriptor) filter_jpsi = FilterDesktop( "MyFilterJPsi", Code=code, Preambulo=["vrho2 = VX**2 + VY**2"], ReFitPVs=True, #IgnoreP2PVFromInputLocations=True, #WriteP2PVRelations=True ) jpsi_sel = Selection("SelMyJPsi", Algorithm=jpsi, RequiredSelections=[muons]) filter_jpsi_sel = Selection("SelFilterMyJPsi", Algorithm=filter_jpsi, RequiredSelections=[jpsi_sel]) jpsi_seq = SelectionSequence("SeqMyJPsi", TopSelection=filter_jpsi_sel) dtt.Inputs = [jpsi_seq.outputLocation()] # Overwriting default list of TupleTools dtt.ToolList = [ "TupleToolKinematic", "TupleToolPid", "TupleToolEventInfo", "TupleToolMCBackgroundInfo", "TupleToolMCTruth", #"MCTupleToolHierarchy", #"MCTupleToolPID", "TupleToolGeometry", "TupleToolTISTOS", # with turbo this crashes #"TupleToolTrackInfo", "TupleToolTrigger", ] tlist = [ "L0HadronDecision", "L0MuonDecision", "L0DiMuonDecision", "L0ElectronDecision", "L0PhotonDecision", "Hlt1DiMuonHighMassDecision", "Hlt1DiMuonLowMassDecision", "Hlt1TrackMuonDecision", "Hlt1TrackAllL0Decision", "Hlt2DiMuonJPsiDecision", "Hlt2SingleMuonDecision", ] dtt.addTool(TupleToolTrigger, name="TupleToolTrigger") dtt.addTool(TupleToolTISTOS, name="TupleToolTISTOS") # Get trigger info dtt.TupleToolTrigger.Verbose = True dtt.TupleToolTrigger.TriggerList = tlist dtt.TupleToolTISTOS.Verbose = True dtt.TupleToolTISTOS.TriggerList = tlist from Configurables import TupleToolMCTruth, MCTupleToolHierarchy dtt.addTool(TupleToolMCBackgroundInfo, name="TupleToolMCBackgroundInfo") dtt.TupleToolMCBackgroundInfo.Verbose = True dtt.addTool(MCTupleToolHierarchy, name="MCTupleToolHierarchy") dtt.MCTupleToolHierarchy.Verbose = True dtt.addTool(TupleToolMCTruth, name="TupleToolMCTruth") dtt.TupleToolMCTruth.Verbose = True if turbo: assoc_seq = TeslaTruthUtils.associateSequence(tesla_prefix, False) ChargedPP2MC(tesla_prefix + "ProtoAssocPP").OutputLevel = 1 assoc_seq.Members.insert(0, PatLHCbID2MCParticle()) from Configurables import MuonCoord2MCParticleLink muon_coords = MuonCoord2MCParticleLink("TeslaMuonCoordLinker") assoc_seq.Members.insert(1, muon_coords) TrackAssociator("TeslaAssocTr").DecideUsingMuons = True relations = TeslaTruthUtils.getRelLoc(tesla_prefix) else: relations = "Relations/Rec/ProtoP/Charged" TeslaTruthUtils.makeTruth(dtt, relations, [ "MCTupleToolKinematic", "MCTupleToolHierarchy", "MCTupleToolPID", ]) dtt.Decay = mark(2, mark(3, decay_descriptor)) #"J/psi(1S) -> ^mu- ^mu+" dtt.addBranches({ "X": "^(%s)" % (decay_descriptor), "muplus": mark(3, decay_descriptor), #"J/psi(1S) -> mu- ^mu+", "muminus": mark(2, decay_descriptor), #"J/psi(1S) -> ^mu- mu+", }) x_preamble = [ "DZ = VFASPF(VZ) - BPV(VZ)", ] x_vars = { "ETA": "ETA", "Y": "Y", "PHI": "PHI", "VPCHI2": "VFASPF(VPCHI2)", "DELTAZ": "DZ", # DZ * M / PZ / c with c in units of mm/s # XXX should this be the PDG mass or measured mass? #"TZ": "DZ*M / PZ / 299792458000.0", #seconds "TZ": "DZ*3096.916 / PZ/299792458000.0*(10**12)", #ps "minpt": "MINTREE('mu+' == ABSID, PT)", "minclonedist": "MINTREE(ISBASIC & HASTRACK, CLONEDIST)", "maxtrchi2dof": "MAXTREE(ISBASIC & HASTRACK, TRCHI2DOF)", } muon_vars = { "ETA": "ETA", "Y": "Y", "PHI": "PHI", "CHARGE": "Q", "CLONEDIST": "CLONEDIST", "TRCHI2DOF": "TRCHI2DOF", } loki_X = dtt.X.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_X") loki_X.Variables = x_vars loki_X.Preambulo = x_preamble loki_mup = dtt.muplus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuPlus") loki_mup.Variables = muon_vars #dtt.muplus.addTupleTool("TupleToolGeometry") loki_mum = dtt.muminus.addTupleTool("LoKi::Hybrid::TupleTool/LoKi_MuMinus") loki_mum.Variables = muon_vars #dtt.muminus.addTupleTool("TupleToolGeometry") dv.TupleFile = "DVNtuples.root" if turbo: dv.UserAlgorithms = [assoc_seq, dtt] else: assocpp = ChargedPP2MC("TimsChargedPP2MC") assocpp.OutputLevel = 1 dv.UserAlgorithms = [jpsi_seq.sequence(), assocpp, dtt]