Maybe this is what you intend, but I will comment since what you are filling is not what you have entitled this histogram.  You are filling in the number of gluons identified, which is usually either zero or one.  The histogram title implies you intend to fill the pt of the gluons.

The variable glulist is a list which you have filled with the pt value of all the gluons which satisfy your criteria.  The length of the list will most likely be zero or one.  You fill into the histogram the length, len(), of this list.

The correct way to get the pt spectrum of additional gluons in the even might be 

for j in range(tree.GetEntries()) :
   tree.GetEntry(j)
   iGlu = next( (i for i in range(len(tree.genPdgId)) if tree.genPdgId[i]==21 and tree.genMotherIndex[i]==4), None)
   if iGlu!=None : gluplot.Fill(tree.genP4[iGlu].pt())

I see you have made similar constructions for the rest of your histograms below.