diff --git a/Btof1285/davinci_Data_Btof1285.py b/Btof1285/davinci_Data_Btof1285.py new file mode 100755 index 0000000000000000000000000000000000000000..ba49b652b184cce99b8ead0ea644c2539703f165 --- /dev/null +++ b/Btof1285/davinci_Data_Btof1285.py @@ -0,0 +1,216 @@ +import GaudiKernel.SystemOfUnits as Units +from GaudiConfUtils import ConfigurableGenerators +from Configurables import PrintDecayTree, DecayTreeTuple, DaVinci, SelDSTWriter, FilterDesktop, FilterInTrees, LoKi__HDRFilter, FilterDesktop,CombineParticles +from PhysSelPython.Wrappers import AutomaticData, Selection, SelectionSequence, DataOnDemand +from DecayTreeTuple.Configuration import * +from Configurables import LoKi__Hybrid__TupleTool, TupleToolDecay, TupleToolVeto, TupleToolSubMass +from Configurables import LoKi__HDRFilter, LoKi__VertexFitter, LoKi__Hybrid__EvtTupleTool +from Configurables import GaudiSequencer, PrintDecayTree +from MVADictHelpers import * +#outTag = '/afs/ihep.ac.cn/users/z/zhangranyu/jobs/5T/' +outTag = '' +line = 'Buto5h_K4pi_exclLine' +doMC = False +data_type = '2011' +if doMC: + stream_loc = 'AllStreams' + evt_type = '12205011' +else: + stream_loc = 'Bhadron' + +from Configurables import FilterInTrees +from PhysSelPython.Wrappers import Selection, DataOnDemand +from PhysConf.Selections import CombineSelection + +if doMC: + Kaons = DataOnDemand('Phys/StdAllNoPIDsKaons/Particles') + Pions = DataOnDemand('Phys/StdAllNoPIDsPions/Particles') +else: + #tesLoc = '/Event/{0}/Phys/{1}/Particles'.format(stream_loc, line) + tesLoc = 'Phys/{0}/Particles'.format(line) + kaons_from_B = FilterInTrees('kaons_from_B_filter', Code="('K+' == ABSID)") + kaons_from_B_sel = Selection("kaons_from_B_sel", + Algorithm=kaons_from_B, + RequiredSelections=[DataOnDemand(Location=tesLoc)]) + pions_from_B = FilterInTrees('pions_from_B_filter', Code="('pi+' == ABSID)") + pions_from_B_sel = Selection("pions_from_B_sel", + Algorithm=pions_from_B, + RequiredSelections=[DataOnDemand(Location=tesLoc)]) + Kaons = kaons_from_B_sel + Pions = pions_from_B_sel + + +XX1 = CombineParticles('D0', + DecayDescriptor="f_1(1285) -> pi+ pi+ pi- pi-", + CombinationCut="(AM > 100.0*MeV)", + DaughtersCuts ={'pi+':'(PT > 150.0*MeV) & (TRCHI2DOF < 1.7) & (MIPCHI2DV(PRIMARY) > 6.0) & (TRGHP < 0.2)', + 'pi-':'(PT > 150.0*MeV) & (TRCHI2DOF < 1.7) & (MIPCHI2DV(PRIMARY) > 6.0) & (TRGHP < 0.2)' + }, + MotherCut='(PT > 100.0*MeV)') +XX1_sel = Selection('XX1_sel', + Algorithm=XX1, + RequiredSelections=[Pions]) + + +B_sel = CombineSelection( + 'Sel_B', + [XX1_sel,Kaons], + DecayDescriptor='[B+ -> f_1(1285) K+]cc', + CombinationCut='(AM < 5679.0*MeV) & (AM > 5000.0*MeV)', + DaughtersCuts ={ + 'K+':'(PT > 250.0*MeV) & (TRCHI2DOF < 1.7) & (MIPCHI2DV(PRIMARY) > 6.0) & (TRGHP < 0.2)', + 'K-':'(PT > 250.0*MeV) & (TRCHI2DOF < 1.7) & (MIPCHI2DV(PRIMARY) > 6.0) & (TRGHP < 0.2)'}, + MotherCut='(BPVDIRA > 0.9999) & (VFASPF(VCHI2) < 30.0) & (BPVIP()<0.06) & (PT >1000.0*MeV) & (BPVVDCHI2 > 100.0)' +) + +#-------------------- +#-------------------- + +decaydesc = "[B+ -> ^K+ ^(f_1(1285) -> ^pi+ ^pi+ ^pi- ^pi-)]CC" +branches={ + "B" : "[B+ -> K+ (f_1(1285) -> pi+ pi+ pi- pi-)]CC", + "K" : "[B+ -> ^K+ (f_1(1285) -> pi+ pi+ pi- pi-)]CC", + "f_1285" : "[B+ -> K+ ^(f_1(1285) -> pi+ pi+ pi- pi-)]CC", + "pi3" : "[B+ -> K+ (f_1(1285) -> ^pi+ pi+ pi- pi-)]CC", + "pi5" : "[B+ -> K+ (f_1(1285) -> pi+ ^pi+ pi- pi-)]CC", + "pi2" : "[B+ -> K+ (f_1(1285) -> pi+ pi+ ^pi- pi-)]CC", + "pi4" : "[B+ -> K+ (f_1(1285) -> pi+ pi+ pi- ^pi-)]CC", + } +tl = ["TupleToolKinematic", + "TupleToolPropertime", + "TupleToolPid", + "TupleToolTrackInfo", + "TupleToolPrimaries", + "TupleToolEventInfo", + "TupleToolTrackInfo", + "TupleToolRecoStats", + "TupleToolGeometry", + "TupleToolTISTOS", + "TupleToolL0Data", + "TupleToolL0Calo"] + +from PhysConf.Selections import TupleSelection +myTuple = TupleSelection( +'myTuple', +[B_sel], +Decay=decaydesc, +Branches=branches, +ToolList=tl, +) + +tg_list=["L0HadronDecision","Hlt1TrackAllL0Decision","Hlt1TrackMVADecision","Hlt1TwoTrackMVADecision","Hlt2Topo2BodyBBDTDecision","Hlt2Topo3BodyBBDTDecision","Hlt2Topo4BodyBBDTDecision"] +myTuple.B.addTupleTool("TupleToolTISTOS") +myTuple.B.TupleToolTISTOS.Verbose = True +myTuple.B.TupleToolTISTOS.TriggerList = tg_list + +if doMC: + myTuple.ToolList += ['TupleToolMCBackgroundInfo'] + myTuple.ToolList += ["TupleToolMCTruth/TupleToolMCTruth"] + myTuple.TupleToolMCTruth.ToolList+=["MCTupleToolHierarchy", "MCTupleToolReconstructed"] + + +from Configurables import TupleToolDecay +for particle in list(branches.keys()): + myTuple.addTool(TupleToolDecay, name=particle) +myTuple.ReFitPVs = True + + +from Configurables import TupleToolDecayTreeFitter +MassFit = TupleToolDecayTreeFitter("MassFit") +MassFit.constrainToOriginVertex = True +MassFit.Verbose = True +MassFit.UpdateDaughters = True +myTuple.B.addTool(MassFit) +myTuple.B.ToolList += ["TupleToolDecayTreeFitter/MassFit"] + +Dres = TupleToolDecayTreeFitter("Dres") +Dres.constrainToOriginVertex = True +Dres.UpdateDaughters = True +Dres.Verbose = True +myTuple.B.addTool(Dres) +myTuple.B.ToolList += ["TupleToolDecayTreeFitter/Dres"] +myTuple.B.Dres.Substitutions={ +'B+ -> K+ ^(f_1(1285) -> pi+ pi+ pi- pi-)' : 'D~0', +'B- -> K- ^(f_1(1285) -> pi- pi- pi+ pi+)' : 'D0' +} + + +if doMC: + from Configurables import TupleToolMCTruth + MCTruth = TupleToolMCTruth('Truth') + MCTruth.ToolList = ["MCTupleToolKinematic","MCTupleToolHierarchy", "MCTupleToolReconstructed"] + mct = MCDecayTreeTuple('truth') + if evt_type == '12205011': + mct1 = MCDecayTreeTuple('No_reso') + mct2 = MCDecayTreeTuple('f_1') + mct3 = MCDecayTreeTuple('f_2') + mct4 = MCDecayTreeTuple('f_0') + mct.Decay = "[[B+]CC ==> ^pi+ ^pi- ^pi+ ^pi- ^K+]CC" + mct1.Decay = "[[B+]CC => ^pi+ ^pi- ^pi+ ^pi- ^K+]CC" + mct2.Decay = "[[B+]CC => ^(f_1(1285) => ^(rho(770)0=> ^pi+ ^pi-) ^pi+ ^pi-) ^K+]CC" + mct3.Decay = "[[B+]CC => ^(f_2(1270) => ^pi+ ^pi- ^pi+ ^pi-) ^K+]CC" + mct4.Decay = "[[B+]CC => ^(f_0(1500) => ^pi+ ^pi- ^pi+ ^pi-) ^K+]CC" + if evt_type == '12165011': + mct.Decay = "[[B+]CC => ^(D~0 => ^pi+ ^pi- ^pi+ ^pi-) ^K+]CC" + if evt_type == '12165021': + mct.Decay = "[[B+]CC => ^(D~0 => ^pi+ ^pi- ^pi+ ^pi-) ^pi+]CC" + if evt_type == '12105011': + mct.Decay = "[[B+]CC => ^pi+ ^pi- ^pi+ ^pi- ^K+]CC" + mct.Branches = { + "B" : "[B+]CC" + } + mct.ToolList=['MCTupleToolHierarchy', + 'MCTupleToolKinematic', + 'MCTupleToolPrimaries'] +if doMC: + from Configurables import TrackSmearState as SMEAR + smear = SMEAR( 'Smear' ) + DaVinci().UserAlgorithms = [ smear ] +if not doMC: + from Configurables import TrackScaleState as SCALER + scaler = SCALER( 'Scaler' ) + DaVinci().UserAlgorithms = [ scaler ] +if doMC: + DaVinci().appendToMainSequence([mct]) + if evt_type == '12205011': + DaVinci().appendToMainSequence([mct1,mct2,mct3,mct4]) + +from Configurables import CheckPV +checkpv = CheckPV() +DaVinci().UserAlgorithms += [checkpv] +DaVinci().UserAlgorithms += [SelectionSequence("seq", myTuple).sequence()] +DaVinci().DataType = data_type +if not doMC: + from Configurables import CondDB + CondDB( LatestGlobalTagByDataType = data_type ) +DaVinci().Simulation = True if doMC else False +#-------------------- +#-------------------- +DaVinci().EvtMax = -1 # Number of events +#DaVinci().EvtMax = 2000 # Number of events +DaVinci().RootInTES = '/Event/{0}'.format(stream_loc) +if doMC: + DaVinci().InputType = 'DST' +else: + DaVinci().InputType = 'MDST' +DaVinci().PrintFreq = 1000 +DaVinci().SkipEvents = 0 # Events to skip +DaVinci().HistogramFile = outTag+"DVHistos_data1_X.root" # Histogram file +DaVinci().TupleFile = outTag+"Tuple_data1_X.root" # Ntuple1 + +if not doMC: + from PhysConf.Filters import LoKi_Filters + fltrs = LoKi_Filters ( + STRIP_Code = "HLT_PASS_RE('StrippingButo5h_K4pi_exclLineDecision')" + ) + DaVinci().EventPreFilters = fltrs.filters('Filters') + + +#from GaudiConf import IOHelper + +# Use the local input data +#IOHelper().inputFiles([ + #'/afs/ihep.ac.cn/users/z/zhangranyu/jobs/5T/f1285/12205011_test_00240113_00000015_1.AllStreams.dst' + #'/afs/ihep.ac.cn/users/z/zhangranyu/jobs/5T/f1285/00240134_00000010_1.AllStreams.dst' + #'/afs/ihep.ac.cn/users/z/zhangranyu/jobs/5T/f1285/00239594_00000022_1.AllStreams.dst' +#], clear=True) diff --git a/Btof1285/info.yaml b/Btof1285/info.yaml new file mode 100644 index 0000000000000000000000000000000000000000..a64f7e60f1b608555003c29464716c7ac6ee7b2c --- /dev/null +++ b/Btof1285/info.yaml @@ -0,0 +1,82 @@ +defaults: + application: DaVinci/v45r8 + wg: BnoC + automatically_configure: yes + inform: + - razhang@cern.ch + - dzhangg@cern.ch + output: Tuple_data1_X.root + +2011_MagDown: + input: + bk_query: /LHCb/Collision11/Beam3500GeV-VeloClosed-MagDown/Real Data/Reco14/Stripping21r1/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2011_MagUp: + input: + bk_query: /LHCb/Collision11/Beam3500GeV-VeloClosed-MagUp/Real Data/Reco14/Stripping21r1/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2012_MagDown: + input: + bk_query: /LHCb/Collision12/Beam4000GeV-VeloClosed-MagDown/Real Data/Reco14/Stripping21/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2012_MagUp: + input: + bk_query: /LHCb/Collision12/Beam4000GeV-VeloClosed-MagUp/Real Data/Reco14/Stripping21/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + + +2015_MagDown: + input: + bk_query: /LHCb/Collision15/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco15a/Stripping24r2/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2015_MagUp: + input: + bk_query: /LHCb/Collision15/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco15a/Stripping24r2/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2016_MagUp: + input: + bk_query: /LHCb/Collision16/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco16/Stripping28r2/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + + +2016_MagDown: + input: + bk_query: /LHCb/Collision16/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco16/Stripping28r2/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2017_MagUp: + input: + bk_query: /LHCb/Collision17/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco17/Stripping29r2/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2017_MagDown: + input: + bk_query: /LHCb/Collision17/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco17/Stripping29r2/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2018_MagUp: + input: + bk_query: /LHCb/Collision18/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco18/Stripping34/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py + +2018_MagDown: + input: + bk_query: /LHCb/Collision18/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco18/Stripping34/90000000/BHADRON.MDST + options: + - davinci_Data_Btof1285.py