diff --git a/DrellYan_Track_v1/DV_MC_TRK_LM.py b/DrellYan_Track_v1/DV_MC_TRK_LM.py new file mode 100644 index 0000000000000000000000000000000000000000..4a48b487809111156f54b17a72b62cfa0e4faaed --- /dev/null +++ b/DrellYan_Track_v1/DV_MC_TRK_LM.py @@ -0,0 +1,238 @@ +from os import environ +from GaudiKernel.SystemOfUnits import * +from Gaudi.Configuration import * +from Configurables import GaudiSequencer, CombineParticles +from Configurables import DecayTreeTuple, EventTuple, TupleToolTrigger, TupleToolTISTOS +from Configurables import BackgroundCategory, TupleToolDecay, TupleToolVtxIsoln,TupleToolPid,EventCountHisto,TupleToolRecoStats,TupleToolDecayTreeFitter +from Configurables import LoKi__Hybrid__TupleTool, TupleToolVeto +from PhysConf.Selections import TupleSelection, CombineSelection +from DecayTreeTuple.Configuration import * +from PhysSelPython.Wrappers import AutomaticData,SelectionSequence +from Configurables import GaudiSequencer + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +## trigger lines +mtl = [ + # L0 lines + 'L0MuonDecision', + 'L0DiMuonDecision', + 'L0MuonEWDecision', + + # Hlt1 lines + "Hlt1DiMuonHighMassDecision", + "Hlt1DiMuonLowMassDecision", + "Hlt1DiMuonNoIPDecision", + "Hlt1SingleMuonNoIPDecision", + "Hlt1SingleMuonHighPTDecision", + "Hlt1TrackMuonDecision", + + # Hlt2 lines + "Hlt2SingleMuonDecision", + "Hlt2SingleMuonHighPTDecision", + "Hlt2SingleMuonVHighPTDecision", + "Hlt2DiMuonZDecision", + "Hlt2EWSingleMuonHighPtDecision", + "Hlt2EWSingleMuonLowPtDecision", + "Hlt2EWSingleMuonVHighPtDecision", + "Hlt2EWDiMuonDY1Decision", + "Hlt2EWDiMuonDY2Decision", + "Hlt2EWDiMuonDY3Decision", + "Hlt2EWDiMuonDY4Decision", + "Hlt2EWDiMuonDYSSDecision" + "Hlt2EWDiMuonZDecision" + ] + +tl= [ + "TupleToolBremInfo", + "TupleToolAngles", + "TupleToolTrigger", + "TupleToolKinematic", + "TupleToolPid" , + "TupleToolTrackInfo" , + "TupleToolPrimaries" , + #"TupleToolPropertime", + "TupleToolEventInfo" , + "TupleToolRecoStats" , + "TupleToolGeometry" , + "TupleToolTrackIsolation", + "TupleToolTrackPosition", + "TupleToolConeIsolation", + "TupleToolVtxIsoln", + "TupleToolVeto", + ] +z_decay = "Z0-> ^mu+ ^mu-" +upsilon_decay = "Upsilon(1S) -> ^mu+ ^mu-" +z_branches = { + "mup" : "Z0 -> ^mu+ mu-", + "mum" : "Z0 -> mu+ ^mu-", + "ZBoson" : "Z0 -> mu+ mu-", +} +upsilon_branches = { + "mup" : "Upsilon(1S) -> ^mu+ mu-", + "mum" : "Upsilon(1S) -> mu+ ^mu-", + "ZBoson" : "Upsilon(1S) -> mu+ mu-", +} + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +""" + Lines of interest: + + TrackEffMuonTT_JpsiLine1 : Jpsi-> mu mu, long: minus, muonTT: plus + TrackEffMuonTT_JpsiLine2 : Jpsi-> mu mu, long: plus, muonTT: minus + + TrackEffMuonTT_UpsilonLine1 : Upsilon-> mu mu, long: minus, muonTT: plus + TrackEffMuonTT_UpsilonLine2 : Upsilon-> mu mu, long: plus, muonTT: minus + + TrackEffMuonTT_ZLine1 : Z-> mu mu, long: minus, muonTT: plus + TrackEffMuonTT_ZLine2 : Z-> mu mu, long: plus, muonTT: minus + +""" +## W: reco from StdAllLooseMuons +ZLine1_location="/Event/AllStreams/Phys/TrackEffMuonTT_ZLine1/Particles" +ZLine2_location="/Event/AllStreams/Phys/TrackEffMuonTT_ZLine2/Particles" +UpsilonLine1_location="/Event/AllStreams/Phys/TrackEffMuonTT_UpsilonLine1/Particles" +UpsilonLine2_location="/Event/AllStreams/Phys/TrackEffMuonTT_UpsilonLine2/Particles" +ZLine1_input = AutomaticData(ZLine1_location) +ZLine2_input = AutomaticData(ZLine2_location) +UpsilonLine1_input = AutomaticData(UpsilonLine1_location) +UpsilonLine2_input = AutomaticData(UpsilonLine2_location) +## ------------------------------------------------------------------------- ## +## DY: +tuple_ZLine1 = TupleSelection( + "ZLine1", + [ZLine1_input], + Decay = z_decay, + Branches = z_branches ) +tuple_ZLine2 = TupleSelection( + "ZLine2", + [ZLine2_input], + Decay = z_decay, + Branches = z_branches ) +tuple_UpsilonLine1 = TupleSelection( + "UpsilonLine1", + [UpsilonLine1_input], + Decay = upsilon_decay, + Branches = upsilon_branches ) +tuple_UpsilonLine2 = TupleSelection( + "UpsilonLine2", + [UpsilonLine2_input], + Decay = upsilon_decay, + Branches = upsilon_branches ) + +## define a list of tuples +ztuples = [ tuple_ZLine1, tuple_ZLine2, tuple_UpsilonLine1, tuple_UpsilonLine2 ] + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +## add algorithms +for tpm in ztuples: + tpm.ToolList += tl + + tool = tpm.addTupleTool(TupleToolTISTOS) + tool.Verbose=True + tool.VerboseL0=True + tool.VerboseHlt1=True + tool.VerboseHlt2= True + tool.FillL0 = True + tool.FillHlt1 = True + tool.FillHlt2 = True + tool.OutputLevel = INFO + tool.TriggerList = mtl + + # solve TISTOS problems[2] 2017/9/14 10:00 + from Configurables import TriggerTisTos + #tool = tpm.addTupleTool(TupleToolTISTOS) + tool.addTool(TriggerTisTos()) + + ## disable CALO hit matching + tool.TriggerTisTos.TOSFracEcal = 0. + tool.TriggerTisTos.TOSFracHcal = 0. + tool.TriggerTisTos.PropertiesPrint = True + ## disable muon hit matching (change TOSFracMu) + tool.TriggerTisTos.TOSFracMuon = 0. + tool.TriggerTisTos.PropertiesPrint = True + + from Configurables import LoKi__Hybrid__TupleTool + LoKi_All = LoKi__Hybrid__TupleTool( 'LoKi_All') + LoKi_All.Preambulo = ["from LoKiTracks.decorators import *"] + LoKi_All.Variables = { + 'ETA' : 'ETA', + 'PHI' : 'PHI', + + } + + tpm.mup.addTupleTool(LoKi_All) + tpm.mum.addTupleTool(LoKi_All) + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +seq_ZLine1 = SelectionSequence('SEQ_ZLine1', tuple_ZLine1) +seq_ZLine2 = SelectionSequence('SEQ_ZLine2', tuple_ZLine2) +seq_UpsilonLine1 = SelectionSequence('SEQ_UpsilonLine1', tuple_UpsilonLine1) +seq_UpsilonLine2 = SelectionSequence('SEQ_UpsilonLine2', tuple_UpsilonLine2) +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +#fill the truth information +mct = MCDecayTreeTuple('mct') +mct.Decay = "Z0-> ^mu+ ^mu-" +mct.Branches = { + "mup" : "Z0 -> ^mu+ mu-", + "mum" : "Z0 -> mu+ ^mu-", + "ZBoson" : "Z0 -> mu+ mu-", + } + + +mctl=[ 'LoKi::Hybrid::MCTupleTool/MCLoKiTool', + 'MCTupleToolAngles', + 'MCTupleToolHierarchy', + 'MCTupleToolKinematic', + 'MCTupleToolPrimaries', + 'MCTupleToolReconstructed', + 'MCTupleToolInteractions' ] +mct.ToolList=mctl +from Configurables import LoKi__Hybrid__MCTupleTool +MCLoKiTool = LoKi__Hybrid__MCTupleTool( 'MCLoKiTool' ) +mct.addTool( MCLoKiTool, name = 'MCLoKiTool') +mct.MCLoKiTool.Variables = { + 'TRUEID' : 'MCID', + 'TRUEETA' : 'MCETA', + 'TRUEPHI' : 'MCPHI', + 'TRUEP' : 'MCP' +} + + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +## DaVinci +from Configurables import DaVinci +DaVinci().EvtMax = -1 # Number of events +DaVinci().PrintFreq = 5000 +DaVinci().SkipEvents = 0 # Events to skip +#DaVinci().InputType = 'DST' +#DaVinci().DataType = "2018" +#DaVinci().Lumi = False +#DaVinci().Simulation = True +#DaVinci().DDDBtag="dddb-20170721-3" +#DaVinci().CondDBtag="sim-20190430-vc-md100" +#DaVinci().TupleFile = "Tuple.root" # Ntuple +DaVinci().UserAlgorithms = [ seq_ZLine1.sequence(), seq_ZLine2.sequence(), seq_UpsilonLine1.sequence(), seq_UpsilonLine2.sequence(),mct] + + +#from GaudiConf import IOHelper +######################### Test ################################################## +''' +# Use the local input data +if DaVinci().Simulation == True: + DaVinci().EvtMax = 1000 + IOHelper().inputFiles([ + '/afs/cern.ch/user/s/sunyi/eos/18/MC_DY_5GeV_dst/00120488_00000004_7.AllStreams.dst' + ], clear=True) + # '/afs/cern.ch/user/d/duliu/eos/Duanqing_work/xia_bookkeeping/test_DaVinci/00098349_00000001_1.b2dh.strip.dst' + # ], clear=True) +else: + IOHelper().inputFiles([ + '/afs/cern.ch/user/d/duliu/eos/Duanqing_work/xia_bookkeeping/test_DaVinci/2018_Data.bhadroncompleteevent.dst' + ], clear=True) +''' diff --git a/DrellYan_Track_v1/DV_MC_TRK_LM_mct.py b/DrellYan_Track_v1/DV_MC_TRK_LM_mct.py new file mode 100644 index 0000000000000000000000000000000000000000..160e9ef2fa3baa0caffafae2ce50e6dcf01936d0 --- /dev/null +++ b/DrellYan_Track_v1/DV_MC_TRK_LM_mct.py @@ -0,0 +1,108 @@ +from os import environ +from GaudiKernel.SystemOfUnits import * +from Gaudi.Configuration import * +from Configurables import GaudiSequencer, CombineParticles +from Configurables import DecayTreeTuple, EventTuple, TupleToolTrigger, TupleToolTISTOS +from Configurables import BackgroundCategory, TupleToolDecay, TupleToolVtxIsoln,TupleToolPid,EventCountHisto,TupleToolRecoStats,TupleToolDecayTreeFitter +from Configurables import LoKi__Hybrid__TupleTool, TupleToolVeto +from PhysConf.Selections import TupleSelection, CombineSelection +from DecayTreeTuple.Configuration import * +from PhysSelPython.Wrappers import AutomaticData,SelectionSequence +from Configurables import GaudiSequencer + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +## trigger lines +mtl = [ + # L0 lines + 'L0MuonDecision', + 'L0DiMuonDecision', + 'L0MuonEWDecision', + + # Hlt1 lines + "Hlt1DiMuonHighMassDecision", + "Hlt1DiMuonLowMassDecision", + "Hlt1DiMuonNoIPDecision", + "Hlt1SingleMuonNoIPDecision", + "Hlt1SingleMuonHighPTDecision", + "Hlt1TrackMuonDecision", + + # Hlt2 lines + "Hlt2SingleMuonDecision", + "Hlt2SingleMuonHighPTDecision", + "Hlt2SingleMuonVHighPTDecision", + "Hlt2DiMuonZDecision", + "Hlt2EWSingleMuonHighPtDecision", + "Hlt2EWSingleMuonLowPtDecision", + "Hlt2EWSingleMuonVHighPtDecision", + "Hlt2EWDiMuonDY1Decision", + "Hlt2EWDiMuonDY2Decision", + "Hlt2EWDiMuonDY3Decision", + "Hlt2EWDiMuonDY4Decision", + "Hlt2EWDiMuonDYSSDecision" + "Hlt2EWDiMuonZDecision" + ] + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +#fill the truth information +mct = MCDecayTreeTuple('mct') +mct.Decay = "Z0-> ^mu+ ^mu-" +mct.Branches = { + "mup" : "Z0 -> ^mu+ mu-", + "mum" : "Z0 -> mu+ ^mu-", + "ZBoson" : "Z0 -> mu+ mu-", + } + + +mctl=[ 'LoKi::Hybrid::MCTupleTool/MCLoKiTool', + 'MCTupleToolAngles', + 'MCTupleToolHierarchy', + 'MCTupleToolKinematic', + 'MCTupleToolPrimaries', + 'MCTupleToolReconstructed', + 'MCTupleToolInteractions' ] +mct.ToolList=mctl +from Configurables import LoKi__Hybrid__MCTupleTool +MCLoKiTool = LoKi__Hybrid__MCTupleTool( 'MCLoKiTool' ) +mct.addTool( MCLoKiTool, name = 'MCLoKiTool') +mct.MCLoKiTool.Variables = { + 'TRUEID' : 'MCID', + 'TRUEETA' : 'MCETA', + 'TRUEPHI' : 'MCPHI', + 'TRUEP' : 'MCP' +} + +## ------------------------------------------------------------------------- ## +## ------------------------------------------------------------------------- ## +## DaVinci +from Configurables import DaVinci +DaVinci().EvtMax = -1 # Number of events +DaVinci().PrintFreq = 5000 +DaVinci().SkipEvents = 0 # Events to skip +#DaVinci().InputType = 'DST' +#DaVinci().DataType = "2018" +#DaVinci().Lumi = False +#DaVinci().Simulation = True +#DaVinci().DDDBtag="dddb-20170721-3" +#DaVinci().CondDBtag="sim-20190430-vc-md100" +#DaVinci().TupleFile = "Tuple.root" # Ntuple +DaVinci().UserAlgorithms = [mct] + + +#from GaudiConf import IOHelper +######################### Test ################################################## +''' +# Use the local input data +if DaVinci().Simulation == True: + DaVinci().EvtMax = 1000 + IOHelper().inputFiles([ + '/afs/cern.ch/user/s/sunyi/eos/18/MC_DY_5GeV_dst/00120488_00000004_7.AllStreams.dst' + ], clear=True) + # '/afs/cern.ch/user/d/duliu/eos/Duanqing_work/xia_bookkeeping/test_DaVinci/00098349_00000001_1.b2dh.strip.dst' + # ], clear=True) +else: + IOHelper().inputFiles([ + '/afs/cern.ch/user/d/duliu/eos/Duanqing_work/xia_bookkeeping/test_DaVinci/2018_Data.bhadroncompleteevent.dst' + ], clear=True) +''' diff --git a/DrellYan_Track_v1/info.yaml b/DrellYan_Track_v1/info.yaml new file mode 100644 index 0000000000000000000000000000000000000000..55c9861b94a3884371207ab804908703f9fceead --- /dev/null +++ b/DrellYan_Track_v1/info.yaml @@ -0,0 +1,25 @@ +defaults: + application: DaVinci/v46r10 + wg: QEE + automatically_configure: yes + inform: + - sunyi@cern.ch + + +{%- set DY_MC = [ + ('DY_5', '42112012'), + ('DY_10', '42112011'), + ('DY_2040', '42112015'), +]%} +{%- for MCtype, Decay_mode in DY_MC %} + {%- for polarity in ['MagDown', 'MagUp'] %} + +MC_{{MCtype}}_{{polarity}}_tuple: + input: + bk_query: /MC/2018/Beam6500GeV-2018-{{polarity}}-Nu1.6-25ns-Pythia8/Sim09j/Trig0x617d18a4/Reco18/Turbo05-WithTurcal/Stripping34NoPrescalingFlagged/{{Decay_mode}}/ALLSTREAMS.DST + output: TRK_MC.root + options: + - DV_MC_TRK_LM_mct.py + {%- endfor %} +{%- endfor %} +