# For + if chains for tau decays

``````	if(pdg_tau[l] == 15):                                                                       #if the resulting particle from the nu_tau CC interaction is a tau
for p in range(fdaughter_tau[l],ldaughter_tau[l]+1):                                #loop over the tau's first daughter to last daughter
energy_new = momentum_cast_tau[3::4][p]                                     #redefine energy so it's just for the tau's daughters			#momentum_x_tau = momentum_cast_tau[0::4][p]                                 #define x momentum				#momentum_y_tau = momentum_cast_tau[1::4][p]                                 #define y momentum 				#momentum_z_tau = momentum_cast_tau[2::4][p]                                 #define z momentum 				#beam2 = TVector3(0,0,1)                                                     #define beam in the z direction 				#momentum_vec_tau = TVector3(momentum_x_tau,momentum_y_tau,momentum_z_tau)   #create a three vector of the momentum component				#angle_tau = root.Math.VectorUtil.Angle(momentum_vec_tau,beam2)		    #angle between beam and momentum vector

if(pdg_tau[p] == 111):
hist_tau_energy.Fill(energy_new)       #fill the energy histogram
tau_mu_energy.append(energy_new)       #append the energy values to the array
for p in range()
if(pdg_tau[p] == 211)        # decay 1
hist_tau_energy.Fill(energy_new)       #fill the energy histogram#
tau_mu_energy.append(energy_new)       #append the energy values to the array
``````

The thing i need help with is trying the to make the for loops beyond the first not use all p, as my goal is to narrow down tau hadronic decays. How do I record which daughter it stopped on and how to exclude that p and those before it in the next for loop so i can “whittle down” the decay particles? Note the second for loop isnt complete because i am stuck as to how t approach this

Maybe @vpadulan can help with this

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.