Carrying branches from analysis stages

Hello,

I wanted to add some branches into the analysis files and carry them through multiple stages. So for example I want to have four momentum information stored as their respective branches like:

.Define(“selected_muons_px”, “ReconstructedParticle::get_px(selected_muons)”)
.Define(“selected_muons_py”, “ReconstructedParticle::get_py(selected_muons)”)
.Define(“selected_muons_pz”, “ReconstructedParticle::get_pz(selected_muons)”)

The first analysis file (analysis_stage1.py) contains lines defining “selected_muons” using the following lines:

.Alias(“Muon0”, “Muon#0.index”)
.Define(“muons”, “ReconstructedParticle::get(Muon0, ReconstructedParticles)”)
.Define(“selected_muons”, “ReconstructedParticle::sel_pt(0)(muons)”)

When carrying the momentum branches into the second analysis file would I simply use the same code to define selected_muons or is there something I am missing. It does not seem to like the .Alias line of the code and says Muon#0.index is an undefined column.

Thanks,
Hayden Shaddix

Hi Hayden,

the file in your second stage will only have whatever branches you save (“Snapshot”) in the first. However, there should not be a reason to do the same selection again in the second stage - just use “selected_muons” directly.
Cheers,
Valentin