A young man who started a fire on a Luas during the Dublin riots, causing nearly €5m worth of damage, has been jailed for three years.