From 158d12a68b608647a0ac59dc2ee834cf61ae468d Mon Sep 17 00:00:00 2001 From: Miguel <miguel.fernandez.gomez@cern.ch> Date: Mon, 9 Dec 2024 22:37:31 +0100 Subject: [PATCH 1/2] Restore EtaDecays from v1r2252 --- EtaDecays/README.md | 4 ++ EtaDecays/__init__.py | 0 EtaDecays/ds3piphi_data.py | 135 +++++++++++++++++++++++++++++++++++++ EtaDecays/ds3piphi_mc.py | 133 ++++++++++++++++++++++++++++++++++++ EtaDecays/info.yaml | 69 +++++++++++++++++++ 5 files changed, 341 insertions(+) create mode 100644 EtaDecays/README.md create mode 100644 EtaDecays/__init__.py create mode 100644 EtaDecays/ds3piphi_data.py create mode 100644 EtaDecays/ds3piphi_mc.py create mode 100644 EtaDecays/info.yaml diff --git a/EtaDecays/README.md b/EtaDecays/README.md new file mode 100644 index 0000000000..408312ba8e --- /dev/null +++ b/EtaDecays/README.md @@ -0,0 +1,4 @@ +# Add n-tuples to EtaDecays for BDT systematic computations + +Create the n-tuples for $D_s^+\to(\phi\to\mu\mu) \pi\pi\pi$ to compute the BDT systematics +of $\pi\pi\mu\mu$ channels. \ No newline at end of file diff --git a/EtaDecays/__init__.py b/EtaDecays/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/EtaDecays/ds3piphi_data.py b/EtaDecays/ds3piphi_data.py new file mode 100644 index 0000000000..f842cc70aa --- /dev/null +++ b/EtaDecays/ds3piphi_data.py @@ -0,0 +1,135 @@ +from Configurables import DecayTreeTuple, GaudiSequencer, DaVinci +from Configurables import LoKi__Hybrid__DTFDict as DTFDict +from Configurables import LoKi__Hybrid__Dict2Tuple +from Configurables import LoKi__Hybrid__DictOfFunctors +from DecayTreeTuple.Configuration import addBranches + + +def add_dtf_branches(dtt): + DictTuple = dtt.Ds.addTupleTool(LoKi__Hybrid__Dict2Tuple, "DTFTuple") + DictTuple.addTool(DTFDict, "DTF") + DictTuple.Source = "LoKi::Hybrid::DTFDict/DTF" + DictTuple.NumVar = 10 + DictTuple.DTF.constrainToOriginVertex = True + DictTuple.DTF.daughtersToConstrain = ["D_s+"] + + DictTuple.DTF.addTool(LoKi__Hybrid__DictOfFunctors, "dict") + DictTuple.DTF.Source = "LoKi::Hybrid::DictOfFunctors/dict" + DictTuple.DTF.dict.Variables = { + "DTFDict_Ds_PT" : "PT", + "DTFDict_Ds_M" : "M", + "DTFDict_phi_PT": "CHILD(PT,1)", + "DTFDict_CHI2" : "DTF_CHI2(True)", + "DTFDict_NDOF" : "DTF_NDOF(True)" + } + for key in ["M", "PX", "PY", "PZ"]: + DictTuple.DTF.dict.Variables.update({ + "DTFDict_phi_"+key: "CHILD({0}, 'D_s+ -> pi+ pi- pi+ ^(phi(1020) -> mu+ mu-)')"\ + .format(key)}) + + +def add_mother_branches(mother, LoKi_Ds, parname): + ''' + Function to add branches to the mother particle + + :ntuple: DecayTreeTuple, ntuple object to configure + :LoKi_Ds: dict, contains the tuple tools of all different particles + ''' + LoKi_Ds[parname] = mother.addTupleTool("LoKi__Hybrid__TupleTool/LoKi_"+parname) + LoKi_Ds[parname].Variables = {"VCHI2PERDOF": "VFASPF(VCHI2/VDOF)", + "ETA" : "ETA", "PHI": "PHI", + "ADMASS" : "ADMASS('D_s+')", + "BPVIPCHI2" : "BPVIPCHI2()", + "BPVDIRA" : "BPVDIRA", + "BPVVDCHI2" : "BPVVDCHI2", + "DOCA" : "DOCAMAX", + "DOCACHI2" : "DOCACHI2MAX", + } + + +def add_particle_branches(par, LoKi_Ds, parname): + ''' + Function to add branches to the daughter particles + + :ntuple: DecayTreeTuple, ntuple object to configure + :LoKi_Ds: dict, contains the tuple tools of all different particles + ''' + LoKi_Ds[parname] = par.addTupleTool("LoKi__Hybrid__TupleTool/LoKi_"+parname) + LoKi_Ds[parname].Variables = {"ETA": "ETA", "PHI": "PHI", + "PCOV11" : "PCOV2(1,1)", + "PCOV12" : "PCOV2(1,2)", + "PCOV13" : "PCOV2(1,3)", + "PCOV22" : "PCOV2(2,2)", + "PCOV23" : "PCOV2(2,3)", + "PCOV33" : "PCOV2(3,3)", + "PERR2" : "PERR2", + "PTERR2" : "PTERR2", + "M2ERR2" : "M2ERR2", + "TRCHI2DOF": "TRCHI2DOF", + "MIPCHI2DV": "MIPCHI2DV(PRIMARY)"} + + +def add_general_branches(ntuple): + ''' + Function to add branches to all particles + + :ntuple: DecayTreeTuple, ntuple object to configure + :strip: ConfigureStripping, object containing the stripping config info + ''' + ntuple.ToolList = ["TupleToolEventInfo", + "TupleToolPropertime", + "TupleToolTrackInfo", + "TupleToolPid", + "TupleToolANNPID", + "TupleToolMuonPid", + "TupleToolGeometry", + "TupleToolKinematic", + "TupleToolRecoStats"] + + LoKi_Ds = {} + for par in ["Ds", "phi"]: + add_mother_branches(getattr(ntuple, par), LoKi_Ds, par) + + for par in ["pip", "pim", "pi", "mup", "mum"]: + add_particle_branches(getattr(ntuple, par), LoKi_Ds, par) + + +def add_trigger_branches(ntuple): + ''' + Function to add trigger branches + + :ntuple: DecayTreeTuple, ntuple object to configure + ''' + mytriggerlist = ["L0HadronDecision", "L0MuonDecision", "Hlt1TwoTrackMVADecision", + "Hlt2TopoMu3BodyDecision", "Hlt2TopoMuMu2BodyDecision", + "Hlt2DiMuonDetachedDecision"] + ntuple.addTupleTool("TupleToolTISTOS/TISTOSTool") + ntuple.TISTOSTool.VerboseL0 = True + ntuple.TISTOSTool.VerboseHlt1 = True + ntuple.TISTOSTool.VerboseHlt2 = True + ntuple.TISTOSTool.TriggerList = mytriggerlist + + +dtt = DecayTreeTuple("DTTDsPi3PhiStrip") +dtt.Decay = "D_s+ -> ^pi+ ^pi- ^pi+ ^(phi(1020) -> ^mu+ ^mu-)" +dtt.Inputs = ["Charm/Phys/Etap2pipimumuDs2PhiLine/Particles"] +dtt.addBranches({"Ds": "D_s+ -> pi+ pi- pi+ (phi(1020) -> mu+ mu-)", + "pip": "D_s+ -> ^pi+ pi- pi+ (phi(1020) -> mu+ mu-)", + "pim": "D_s+ -> pi+ ^pi- pi+ (phi(1020) -> mu+ mu-)", + "pi" : "D_s+ -> pi+ pi- ^pi+ (phi(1020) -> mu+ mu-)", + "phi": "D_s+ -> pi+ pi- pi+ ^(phi(1020) -> mu+ mu-)", + "mup": "D_s+ -> pi+ pi- pi+ (phi(1020) -> ^mu+ mu-)", + "mum": "D_s+ -> pi+ pi- pi+ (phi(1020) -> mu+ ^mu-)"}) + +add_dtf_branches(dtt) + +add_general_branches(dtt) + +add_trigger_branches(dtt) + +gs = GaudiSequencer("myseq") +gs.Members += [dtt] + +DaVinci().UserAlgorithms += [gs] +#DaVinci().DataType = "2016" +#DaVinci().Simulation = True diff --git a/EtaDecays/ds3piphi_mc.py b/EtaDecays/ds3piphi_mc.py new file mode 100644 index 0000000000..53629e3b8e --- /dev/null +++ b/EtaDecays/ds3piphi_mc.py @@ -0,0 +1,133 @@ +from Configurables import DecayTreeTuple, GaudiSequencer, DaVinci +from Configurables import LoKi__Hybrid__DTFDict as DTFDict +from Configurables import LoKi__Hybrid__Dict2Tuple +from Configurables import LoKi__Hybrid__DictOfFunctors +from DecayTreeTuple.Configuration import addBranches + + +def add_dtf_branches(dtt): + DictTuple = dtt.Ds.addTupleTool(LoKi__Hybrid__Dict2Tuple, "DTFTuple") + DictTuple.addTool(DTFDict, "DTF") + DictTuple.Source = "LoKi::Hybrid::DTFDict/DTF" + DictTuple.NumVar = 10 + DictTuple.DTF.constrainToOriginVertex = True + DictTuple.DTF.daughtersToConstrain = ["D_s+"] + + DictTuple.DTF.addTool(LoKi__Hybrid__DictOfFunctors, "dict") + DictTuple.DTF.Source = "LoKi::Hybrid::DictOfFunctors/dict" + DictTuple.DTF.dict.Variables = { + "DTFDict_Ds_PT" : "PT", + "DTFDict_Ds_M" : "M", + "DTFDict_phi_PT": "CHILD(PT,1)", + "DTFDict_CHI2" : "DTF_CHI2(True)", + "DTFDict_NDOF" : "DTF_NDOF(True)" + } + for key in ["M", "PX", "PY", "PZ"]: + DictTuple.DTF.dict.Variables.update({ + "DTFDict_phi_"+key: "CHILD({0}, 'D_s+ -> pi+ pi- pi+ ^(phi(1020) -> mu+ mu-)')"\ + .format(key)}) + + +def add_mother_branches(mother, LoKi_Ds, parname): + ''' + Function to add branches to the mother particle + + :ntuple: DecayTreeTuple, ntuple object to configure + :LoKi_Ds: dict, contains the tuple tools of all different particles + ''' + LoKi_Ds[parname] = mother.addTupleTool("LoKi__Hybrid__TupleTool/LoKi_"+parname) + LoKi_Ds[parname].Variables = {"VCHI2PERDOF": "VFASPF(VCHI2/VDOF)", + "ETA" : "ETA", "PHI": "PHI", + "ADMASS" : "ADMASS('D_s+')", + "BPVIPCHI2" : "BPVIPCHI2()", + "BPVDIRA" : "BPVDIRA", + "BPVVDCHI2" : "BPVVDCHI2", + "DOCA" : "DOCAMAX", + "DOCACHI2" : "DOCACHI2MAX", + } + + +def add_particle_branches(par, LoKi_Ds, parname): + ''' + Function to add branches to the daughter particles + + :ntuple: DecayTreeTuple, ntuple object to configure + :LoKi_Ds: dict, contains the tuple tools of all different particles + ''' + LoKi_Ds[parname] = par.addTupleTool("LoKi__Hybrid__TupleTool/LoKi_"+parname) + LoKi_Ds[parname].Variables = {"ETA": "ETA", "PHI": "PHI", + "PCOV11" : "PCOV2(1,1)", + "PCOV12" : "PCOV2(1,2)", + "PCOV13" : "PCOV2(1,3)", + "PCOV22" : "PCOV2(2,2)", + "PCOV23" : "PCOV2(2,3)", + "PCOV33" : "PCOV2(3,3)", + "PERR2" : "PERR2", + "PTERR2" : "PTERR2", + "M2ERR2" : "M2ERR2", + "TRCHI2DOF": "TRCHI2DOF", + "MIPCHI2DV": "MIPCHI2DV(PRIMARY)"} + + +def add_general_branches(ntuple): + ''' + Function to add branches to all particles + + :ntuple: DecayTreeTuple, ntuple object to configure + :strip: ConfigureStripping, object containing the stripping config info + ''' + ntuple.ToolList = ["TupleToolEventInfo", + "TupleToolPropertime", + "TupleToolTrackInfo", + "TupleToolPid", + "TupleToolANNPID", + "TupleToolMuonPid", + "TupleToolGeometry", + "TupleToolKinematic", + "TupleToolRecoStats"] + + LoKi_Ds = {} + for par in ["Ds", "phi"]: + add_mother_branches(getattr(ntuple, par), LoKi_Ds, par) + + for par in ["pip", "pim", "pi", "mup", "mum"]: + add_particle_branches(getattr(ntuple, par), LoKi_Ds, par) + + +def add_trigger_branches(ntuple): + ''' + Function to add trigger branches + + :ntuple: DecayTreeTuple, ntuple object to configure + ''' + mytriggerlist = ["L0HadronDecision", "L0MuonDecision", "Hlt1TwoTrackMVADecision", + "Hlt2TopoMu3BodyDecision", "Hlt2TopoMuMu2BodyDecision", + "Hlt2DiMuonDetachedDecision"] + ntuple.addTupleTool("TupleToolTISTOS/TISTOSTool") + ntuple.TISTOSTool.VerboseL0 = True + ntuple.TISTOSTool.VerboseHlt1 = True + ntuple.TISTOSTool.VerboseHlt2 = True + ntuple.TISTOSTool.TriggerList = mytriggerlist + + +dtt = DecayTreeTuple("DTTDsPi3PhiStrip") +dtt.Decay = "D_s+ -> ^pi+ ^pi- ^pi+ ^(phi(1020) -> ^mu+ ^mu-)" +dtt.Inputs = ["AllStreams/Phys/Etap2pipimumuDs2PhiLine/Particles"] +dtt.addBranches({"Ds": "D_s+ -> pi+ pi- pi+ (phi(1020) -> mu+ mu-)", + "pip": "D_s+ -> ^pi+ pi- pi+ (phi(1020) -> mu+ mu-)", + "pim": "D_s+ -> pi+ ^pi- pi+ (phi(1020) -> mu+ mu-)", + "pi" : "D_s+ -> pi+ pi- ^pi+ (phi(1020) -> mu+ mu-)", + "phi": "D_s+ -> pi+ pi- pi+ ^(phi(1020) -> mu+ mu-)", + "mup": "D_s+ -> pi+ pi- pi+ (phi(1020) -> ^mu+ mu-)", + "mum": "D_s+ -> pi+ pi- pi+ (phi(1020) -> mu+ ^mu-)"}) + +add_dtf_branches(dtt) + +add_general_branches(dtt) + +add_trigger_branches(dtt) + +gs = GaudiSequencer("myseq") +gs.Members += [dtt] + +DaVinci().UserAlgorithms += [gs] diff --git a/EtaDecays/info.yaml b/EtaDecays/info.yaml new file mode 100644 index 0000000000..394ed7eb44 --- /dev/null +++ b/EtaDecays/info.yaml @@ -0,0 +1,69 @@ +MCDs3PiPhi2016_Down: + application: DaVinci/v44r10p5 + input: + bk_query: /MC/2016/Beam6500GeV-2016-MagDown-Nu1.6-25ns-Pythia8/Sim09h/Trig0x6139160F/Reco16/Turbo03a/Stripping28r2NoPrescalingFlagged/23175001/ALLSTREAMS.DST + options: + - ds3piphi_mc.py + output: MCDs3PiPhi.root + +MCDs3PiPhi2016_Up: + application: DaVinci/v44r10p5 + input: + bk_query: /MC/2016/Beam6500GeV-2016-MagUp-Nu1.6-25ns-Pythia8/Sim09h/Trig0x6139160F/Reco16/Turbo03a/Stripping28r2NoPrescalingFlagged/23175001/ALLSTREAMS.DST + options: + - ds3piphi_mc.py + output: MCDs3PiPhi.root + +DataDs3PiPhi2016_Up: + application: DaVinci/v44r10p5 + input: + bk_query: /LHCb/Collision16/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco16/Stripping28r2/90000000/CHARM.MDST + options: + - ds3piphi_data.py + output: DataDs3PiPhi.root + +DataDs3PiPhi2016_Down: + application: DaVinci/v44r10p5 + input: + bk_query: /LHCb/Collision16/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco16/Stripping28r2/90000000/CHARM.MDST + options: + - ds3piphi_data.py + output: DataDs3PiPhi.root + +DataDs3PiPhi2017_Down: + application: DaVinci/v42r11p2 + input: + bk_query: /LHCb/Collision17/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco17/Stripping29r2p1/90000000/CHARM.MDST + options: + - ds3piphi_data.py + output: DataDs3PiPhi.root + +DataDs3PiPhi2017_Up: + application: DaVinci/v42r11p2 + input: + bk_query: /LHCb/Collision17/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco17/Stripping29r2p1/90000000/CHARM.MDST + options: + - ds3piphi_data.py + output: DataDs3PiPhi.root + +Data2Pi2Mu2018_Down: + application: DaVinci/v44r11p1 + input: + bk_query: /LHCb/Collision18/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco18/Stripping34r0p1/90000000/CHARM.MDST + options: + - ds3piphi_data.py + output: DataDs3PiPhi.root + +Data2Pi2Mu2018_Up: + application: DaVinci/v44r11p1 + input: + bk_query: /LHCb/Collision18/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco18/Stripping34r0p1/90000000/CHARM.MDST + options: + - ds3piphi_data.py + output: DataDs3PiPhi.root + + +defaults: + inform: miguel.fernandez.gomez@cern.ch + wg: Charm + automatically_configure: true -- GitLab From 3b9b02337829bd04bfa9737129109553b3f82fd9 Mon Sep 17 00:00:00 2001 From: Miguel <miguel.fernandez.gomez@cern.ch> Date: Mon, 9 Dec 2024 22:49:34 +0100 Subject: [PATCH 2/2] Recommitting after bug found in AProds --- EtaDecays/ds3piphi_data.py | 5 +++-- EtaDecays/ds3piphi_mc.py | 18 ++++++++++++++---- EtaDecays/info.yaml | 4 ++-- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/EtaDecays/ds3piphi_data.py b/EtaDecays/ds3piphi_data.py index f842cc70aa..3c8b389c31 100644 --- a/EtaDecays/ds3piphi_data.py +++ b/EtaDecays/ds3piphi_data.py @@ -100,9 +100,10 @@ def add_trigger_branches(ntuple): :ntuple: DecayTreeTuple, ntuple object to configure ''' - mytriggerlist = ["L0HadronDecision", "L0MuonDecision", "Hlt1TwoTrackMVADecision", + mytriggerlist = ["L0HadronDecision", "L0MuonDecision", + "Hlt1TrackMVADecision", "Hlt1TwoTrackMVADecision", "Hlt2TopoMu3BodyDecision", "Hlt2TopoMuMu2BodyDecision", - "Hlt2DiMuonDetachedDecision"] + "Hlt2DiMuonDetachedDecision", "Hlt2TopoMu2BodyDecision"] ntuple.addTupleTool("TupleToolTISTOS/TISTOSTool") ntuple.TISTOSTool.VerboseL0 = True ntuple.TISTOSTool.VerboseHlt1 = True diff --git a/EtaDecays/ds3piphi_mc.py b/EtaDecays/ds3piphi_mc.py index 53629e3b8e..d429798f23 100644 --- a/EtaDecays/ds3piphi_mc.py +++ b/EtaDecays/ds3piphi_mc.py @@ -1,4 +1,4 @@ -from Configurables import DecayTreeTuple, GaudiSequencer, DaVinci +from Configurables import DecayTreeTuple, GaudiSequencer, DaVinci, MCDecayTreeTuple from Configurables import LoKi__Hybrid__DTFDict as DTFDict from Configurables import LoKi__Hybrid__Dict2Tuple from Configurables import LoKi__Hybrid__DictOfFunctors @@ -100,15 +100,25 @@ def add_trigger_branches(ntuple): :ntuple: DecayTreeTuple, ntuple object to configure ''' - mytriggerlist = ["L0HadronDecision", "L0MuonDecision", "Hlt1TwoTrackMVADecision", + mytriggerlist = ["L0HadronDecision", "L0MuonDecision", + "Hlt1TrackMVADecision", "Hlt1TwoTrackMVADecision", "Hlt2TopoMu3BodyDecision", "Hlt2TopoMuMu2BodyDecision", - "Hlt2DiMuonDetachedDecision"] + "Hlt2DiMuonDetachedDecision", "Hlt2TopoMu2BodyDecision"] ntuple.addTupleTool("TupleToolTISTOS/TISTOSTool") ntuple.TISTOSTool.VerboseL0 = True ntuple.TISTOSTool.VerboseHlt1 = True ntuple.TISTOSTool.VerboseHlt2 = True ntuple.TISTOSTool.TriggerList = mytriggerlist +mcdtt = MCDecayTreeTuple("MCDecayTreeTuple") +mcdtt.Decay = "D_s+ => ^pi+ ^pi- ^pi+ ^(phi(1020) ==> ^mu+ ^mu-)" +mcdtt.addBranches({"Ds": "D_s+ => pi+ pi- pi+ (phi(1020) ==> mu+ mu-)", + "pip": "D_s+ => ^pi+ pi- pi+ (phi(1020) ==> mu+ mu-)", + "pim": "D_s+ => pi+ ^pi- pi+ (phi(1020) ==> mu+ mu-)", + "pi" : "D_s+ => pi+ pi- ^pi+ (phi(1020) ==> mu+ mu-)", + "phi": "D_s+ => pi+ pi- pi+ ^(phi(1020) ==> mu+ mu-)", + "mup": "D_s+ => pi+ pi- pi+ (phi(1020) ==> ^mu+ mu-)", + "mum": "D_s+ => pi+ pi- pi+ (phi(1020) ==> mu+ ^mu-)"}) dtt = DecayTreeTuple("DTTDsPi3PhiStrip") dtt.Decay = "D_s+ -> ^pi+ ^pi- ^pi+ ^(phi(1020) -> ^mu+ ^mu-)" @@ -128,6 +138,6 @@ add_general_branches(dtt) add_trigger_branches(dtt) gs = GaudiSequencer("myseq") -gs.Members += [dtt] +gs.Members += [mcdtt, dtt] DaVinci().UserAlgorithms += [gs] diff --git a/EtaDecays/info.yaml b/EtaDecays/info.yaml index 394ed7eb44..f73b762a1a 100644 --- a/EtaDecays/info.yaml +++ b/EtaDecays/info.yaml @@ -46,7 +46,7 @@ DataDs3PiPhi2017_Up: - ds3piphi_data.py output: DataDs3PiPhi.root -Data2Pi2Mu2018_Down: +DataDs3PiPhi2018_Down: application: DaVinci/v44r11p1 input: bk_query: /LHCb/Collision18/Beam6500GeV-VeloClosed-MagDown/Real Data/Reco18/Stripping34r0p1/90000000/CHARM.MDST @@ -54,7 +54,7 @@ Data2Pi2Mu2018_Down: - ds3piphi_data.py output: DataDs3PiPhi.root -Data2Pi2Mu2018_Up: +DataDs3PiPhi2018_Up: application: DaVinci/v44r11p1 input: bk_query: /LHCb/Collision18/Beam6500GeV-VeloClosed-MagUp/Real Data/Reco18/Stripping34r0p1/90000000/CHARM.MDST -- GitLab