B2 analysis code