Skip to content
Snippets Groups Projects
Commit cea1f068 authored by Mengzhen Wang's avatar Mengzhen Wang Committed by Linxuan Zhu
Browse files

QQbar2MuMu 2024 block1 MC AP, 2024EndOct version

parent 98d1bcff
No related branches found
No related tags found
No related merge requests found
import os
import sys
sys.path.append(os.path.join(
os.environ['ANALYSIS_PRODUCTIONS_BASE'], 'QuarkoniaToMuMu2024'))
from helpers import dv_tree, dv_mctree
from DaVinci import Options, make_config
def main(options: Options):
decay_descriptor = {
"QQbar": "J/psi(1S) -> mu+ mu-",
"mup": "J/psi(1S) -> ^mu+ mu-",
"mum": "J/psi(1S) -> mu+ ^mu-",
}
decay_descriptor_mctree = {
"QQbar": "J/psi(1S) ==> mu+ mu-",
"mup": "J/psi(1S) ==> ^mu+ mu-",
"mum": "J/psi(1S) ==> mu+ ^mu-",
}
line_name = 'Hlt2_JpsiToMuMu'
my_filter = dv_tree.line_prefilter(line_name)
my_tuple = dv_tree.tree_template(decay_descriptor, line_name, True, [])
my_mctuple = dv_mctree.mctree_template(decay_descriptor_mctree)
user_algorithms = {
'Alg_tuple': [my_filter, my_tuple],
'Alg_mctuple': [my_mctuple],
}
return make_config(options, user_algorithms)
import os
import sys
sys.path.append(os.path.join(
os.environ['ANALYSIS_PRODUCTIONS_BASE'], 'QuarkoniaToMuMu2024'))
from helpers import dv_tree, dv_mctree
from DaVinci import Options, make_config
def main(options: Options):
decay_descriptor = {
"QQbar": "psi(2S) -> mu+ mu-",
"mup": "psi(2S) -> ^mu+ mu-",
"mum": "psi(2S) -> mu+ ^mu-",
}
decay_descriptor_mctree = {
"QQbar": "psi(2S) ==> mu+ mu-",
"mup": "psi(2S) ==> ^mu+ mu-",
"mum": "psi(2S) ==> mu+ ^mu-",
}
line_name = 'Hlt2_Psi2SToMuMu'
my_tuple = dv_tree.tree_template(decay_descriptor, line_name, True, [])
my_filter = dv_tree.line_prefilter(line_name)
my_mctuple = dv_mctree.mctree_template(decay_descriptor_mctree)
user_algorithms = {
'Alg_tuple': [my_filter, my_tuple],
'Alg_mctuple': [my_mctuple],
}
return make_config(options, user_algorithms)
import os
import sys
sys.path.append(os.path.join(
os.environ['ANALYSIS_PRODUCTIONS_BASE'], 'QuarkoniaToMuMu2024'))
from helpers import dv_tree, dv_mctree
from DaVinci import Options, make_config
def main(options: Options):
decay_descriptor = {
"QQbar": "Upsilon(1S) -> mu+ mu-",
"mup": "Upsilon(1S) -> ^mu+ mu-",
"mum": "Upsilon(1S) -> mu+ ^mu-",
}
decay_descriptor_mctree = {
"QQbar": "Upsilon(1S) ==> mu+ mu-",
"mup": "Upsilon(1S) ==> ^mu+ mu-",
"mum": "Upsilon(1S) ==> mu+ ^mu-",
}
line_name = 'Hlt2BandQ_UpsilonToMuMuEMTF'
my_tuple = dv_tree.tree_template(decay_descriptor, line_name, True, [])
my_filter = dv_tree.line_prefilter(line_name)
my_mctuple = dv_mctree.mctree_template(decay_descriptor_mctree)
user_algorithms = {
'Alg_tuple': [my_filter, my_tuple],
'Alg_mctuple': [my_mctuple],
}
return make_config(options, user_algorithms)
import os
import sys
sys.path.append(os.path.join(
os.environ['ANALYSIS_PRODUCTIONS_BASE'], 'QuarkoniaToMuMu2024'))
from helpers import dv_tree, dv_mctree
from DaVinci import Options, make_config
def main(options: Options):
decay_descriptor = {
"QQbar": "Upsilon(1S) -> mu+ mu-",
"mup": "Upsilon(1S) -> ^mu+ mu-",
"mum": "Upsilon(1S) -> mu+ ^mu-",
}
decay_descriptor_mctree = {
"QQbar": "Upsilon(2S) ==> mu+ mu-",
"mup": "Upsilon(2S) ==> ^mu+ mu-",
"mum": "Upsilon(2S) ==> mu+ ^mu-",
}
line_name = 'Hlt2BandQ_UpsilonToMuMuEMTF'
my_tuple = dv_tree.tree_template(decay_descriptor, line_name, True, [])
my_filter = dv_tree.line_prefilter(line_name)
my_mctuple = dv_mctree.mctree_template(decay_descriptor_mctree)
user_algorithms = {
'Alg_tuple': [my_filter, my_tuple],
'Alg_mctuple': [my_mctuple],
}
return make_config(options, user_algorithms)
import os
import sys
sys.path.append(os.path.join(
os.environ['ANALYSIS_PRODUCTIONS_BASE'], 'QuarkoniaToMuMu2024'))
from helpers import dv_tree, dv_mctree
from DaVinci import Options, make_config
def main(options: Options):
decay_descriptor = {
"QQbar": "Upsilon(1S) -> mu+ mu-",
"mup": "Upsilon(1S) -> ^mu+ mu-",
"mum": "Upsilon(1S) -> mu+ ^mu-",
}
decay_descriptor_mctree = {
"QQbar": "Upsilon(3S) ==> mu+ mu-",
"mup": "Upsilon(3S) ==> ^mu+ mu-",
"mum": "Upsilon(3S) ==> mu+ ^mu-",
}
line_name = 'Hlt2BandQ_UpsilonToMuMuEMTF'
my_tuple = dv_tree.tree_template(decay_descriptor, line_name, True, [])
my_filter = dv_tree.line_prefilter(line_name)
my_mctuple = dv_mctree.mctree_template(decay_descriptor_mctree)
user_algorithms = {
'Alg_tuple': [my_filter, my_tuple],
'Alg_mctuple': [my_mctuple],
}
return make_config(options, user_algorithms)
###############################################################################
# (c) Copyright 2022 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
"""
Read and process a .xgen file with the new DaVinci configuration.
rst_title: Run on XGEN files
rst_description: This example reads and process a `.xgen` file.
rst_running: lbexec DaVinciExamples.tupling.option_davinci_tupling_from_xgen:main $DAVINCIEXAMPLESROOT/example_data/Gauss_12143001_xgen.yaml
rst_yaml: ../DaVinciExamples/example_data/Gauss_12143001_xgen.yaml
"""
import Functors as F
import FunTuple.functorcollections as FC
from FunTuple import FunctorCollection, FunTuple_MCParticles as FuntupleMC
from PyConf.reading import get_particles, get_pvs, get_rec_summary
from PyConf.Algorithms import PrintMCTree
from DaVinci import Options, make_config
from DaVinci.algorithms import create_lines_filter
from DaVinciMCTools import MCTruthAndBkgCat
from FunTuple.functorcollections import MCHierarchy, MCPrimaries, MCPromptDecay, Kinematics, SelectionInfo, HltTisTos, MCVertexInfo, MCKinematics, ParticleID, EventInfo
from PyConf.reading import get_mc_particles, get_mc_header
from PyConf.reading import get_odin # get_decreports,
from DecayTreeFitter import DecayTreeFitter
def mctree_template(fields):
# FunTuple: define fields (branches)
#fields = {
# "QQbar": "J/psi(1S) ==> mu+ mu-",
# "mup": "J/psi(1S) ==> ^mu+ mu-",
# "mum": "J/psi(1S) ==> mu+ ^mu-",
#}
# FunTuple: define input data
QQbar2mumu_line = get_mc_particles("/Event/HLT2/MC/Particles")
pvs = get_pvs()
#define event level variables
odin = get_odin()
rec_sum=get_rec_summary()
event_info = FunctorCollection({
"nPVs": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nPVs"),
"nTTracks": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nTTracks"),
"nLongTracks": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nLongTracks"),
"nDownstreamTracks": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nDownstreamTracks"),
"nUpstreamTracks": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nUpstreamTracks"),
"nVeloTracks": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nVeloTracks"),
"nBackTracks": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nBackTracks"),
#"nGhosts": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nGhosts"),
"nRich1Hits": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nRich1Hits"),
"nRich2Hits": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nRich2Hits"),
#"nVeloClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nVeloClusters"),
"nVPClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nVPClusters"),
#"nITClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nITClusters"),
#"nTTClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nTTClusters"),
#"nUTClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nUTClusters"),
#"nOTClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nOTClusters"),
"nFTClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nFTClusters"),
#"nSPDhits": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nSPDhits"),
"eCalTot": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"eCalTot"),
"hCalTot": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"hCalTot"),
"nEcalClusters": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nEcalClusters"),
#"nMuonCoordsS0": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nMuonCoordsS0"),
#"nMuonCoordsS1": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nMuonCoordsS1"),
#"nMuonCoordsS2": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nMuonCoordsS2"),
#"nMuonCoordsS3": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nMuonCoordsS3"),
#"nMuonCoordsS4": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nMuonCoordsS4"),
#"nMuonTracks": F.VALUE_OR(-1) @F.RECSUMMARY_INFO(rec_sum,"nMuonTracks"),
})
MC_MOTHER_ID = lambda gen: F.VALUE_OR(0) @ F.MC_MOTHER(gen, F.PARTICLE_ID)
MC_MOTHER_KEY = lambda gen: F.VALUE_OR(-1) @ F.MC_MOTHER(gen, F.OBJECT_KEY)
# FunTuple: define variables for the J/psi
composite_variables = FunctorCollection(
{
"ETA": F.ETA,
"PHI": F.PHI,
"TAU": F.MC_LIFETIME,
"ORIGIN_VX": F.ORIGIN_VX,
"ORIGIN_VY": F.ORIGIN_VY,
"ORIGIN_VZ": F.ORIGIN_VZ,
"END_VX": F.END_VX,
"END_VY": F.END_VY,
"END_VZ": F.END_VZ,
"M": F.MASS,
"FOURMOMENTUM": F.FOURMOMENTUM,
"PT": F.PT,
"MC_MOTHER_ID": MC_MOTHER_ID(1),
"MC_MOTHER_KEY": MC_MOTHER_KEY(1),
"MC_GD_MOTHER_ID": MC_MOTHER_ID(2),
"MC_GD_MOTHER_KEY": MC_MOTHER_KEY(2),
"MC_GD_GD_MOTHER_ID": MC_MOTHER_ID(3),
"MC_GD_GD_MOTHER_KEY": MC_MOTHER_KEY(3),
}
)
# FunTuple: define variables for the muon
basic_variables = FunctorCollection(
{
"ETA": F.ETA,
"PHI": F.PHI,
"ORIGIN_VX": F.ORIGIN_VX,
"ORIGIN_VY": F.ORIGIN_VY,
"ORIGIN_VZ": F.ORIGIN_VZ,
"M": F.MASS,
"FOURMOMENTUM": F.FOURMOMENTUM,
"PT": F.PT,
"MC_MOTHER_ID": MC_MOTHER_ID(1),
"MC_MOTHER_KEY": MC_MOTHER_KEY(1),
"MC_GD_MOTHER_ID": MC_MOTHER_ID(2),
"MC_GD_MOTHER_KEY": MC_MOTHER_KEY(2),
"MC_GD_GD_MOTHER_ID": MC_MOTHER_ID(3),
"MC_GD_GD_MOTHER_KEY": MC_MOTHER_KEY(3),
"TAU": F.MC_LIFETIME,
"END_VX": F.END_VX,
"END_VY": F.END_VY,
"END_VZ": F.END_VZ,
}
)
# FunTuple: associate functor collections to field (branch) name
variables = {
"QQbar": composite_variables + FC.Kinematics(),
"mup": basic_variables + FC.Kinematics(),
"mum": basic_variables + FC.Kinematics(),
}
# FunTuple: define event-level variables using functor collections
mc_header = get_mc_header(extra_inputs=[QQbar2mumu_line])
evt_vars = event_info
#evt_vars = FC.MCPrimaries(mc_header=mc_header) + event_info
#printMC = PrintMCTree(
# MCParticles=QQbar2mumu_line, ParticleNames=["J/psi(1S)"], OutputLevel=4
#)
tuple_QQbar2mumu = FuntupleMC(
name="MCDecayTreeTuple",
tuple_name="MCDecayTree",
fields=fields,
variables=variables,
event_variables=evt_vars,
inputs=QQbar2mumu_line,
)
return tuple_QQbar2mumu
This diff is collapsed.
defaults:
application: DaVinci/v64r12
wg: BandQ
inform:
- mengzhen.wang@cern.ch
- zehua.xu@cern.ch
# mc configuration
{%- set entrypoints = [
("Jpsi", "Jpsi2mumu", "24142001", "Hlt2"),
("Psi2S", "Psi2S2mumu", "28142001", "Hlt2"),
("Upsilon1S", "Upsilon1S", "18112001", "Hlt2"),
("Upsilon2S", "Upsilon2S", "18112011", "Hlt2"),
("Upsilon3S", "Upsilon3S", "18112021", "Hlt2"),
]%}
{%- set MC_conditions = [
("MagUp", "MagUp", "6.3", "6_3", "dddb-20240427", "sim10-2024.Q3.4-v1.3-mu100", "24Block1_v1", "2024", "2024.W31.34", "Sim10d"),
]%}
{%- for module, channel, eventtype, dv_input_process in entrypoints %}
{%- for polarity_mc, polarity_mc_jobtitle, nu, n_u, dddb, conddb, mcversion_jobtitle, BKK_label1, BKK_label2, simversion in MC_conditions %}
MC_{{module}}_Nu{{n_u}}_{{polarity_mc_jobtitle}}_{{mcversion_jobtitle}}_ROOT:
application: "DaVinci/v64r12@x86_64_v3-el9-gcc13+detdesc-opt+g"
input:
bk_query: "/MC/{{BKK_label1}}/Beam6800GeV-{{BKK_label2}}-{{ polarity_mc }}-Nu{{ nu }}-25ns-Pythia8/{{simversion}}/HLT2-2024.W31.34/{{ eventtype }}/DST"
keep_running: true
output: QQbar2mumu_MC24_tuple.ROOT
options:
entrypoint: QuarkoniaToMuMu2024.dv_mc_{{channel}}:main
extra_options:
input_raw_format: 0.5
conddb_tag: {{ conddb }}
dddb_tag: {{ dddb }}
input_type: ROOT
simulation: True
data_type: "Upgrade"
input_process: "Hlt2"
input_stream: "bandq"
{%- endfor %}
{%- endfor %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment