#######################################################
# Assumption: Only the particles coming from (0,0,z) 
# Question 1: How many hits belong to these particles?
# Question 2: What is the score limit?
#######################################################

require(data.table)

path='../input/train_1/'

cat("Evaluation\n")
cat("------------------------------------------\n")
sc=1:4 # 1:100
pr=1:4 # 1:100
for(i in 0:3){ # 0:99
  nev=1000+i
  dft=fread(paste0(path,'event00000',nev,'-truth.csv'),stringsAsFactors = T)
  dfp=fread(paste0(path,'event00000',nev,'-particles.csv'))
  part00Z <-dfp[abs(vx)<0.05 & abs(vy)<0.05,particle_id]
  dft[,s1:=ifelse(particle_id %in% part00Z,1,0)]
  score <- sum(dft[s1==1,weight])
  perc <- mean(dft$s1)*100
  cat("score",score,", no. of hits:",perc,"%\n")
  sc[i+1]=score
  pr[i+1]=perc
}
cat("------------------------------------------\n")
cat("score",mean(sc),", no. of hits:",mean(pr),"%\n")
