from elena import * from array import array import ROOT def AddVect(t,name,vectType): vect = ROOT.vector(vectType)() t.Branch( name, vect ) return t, vect def AddVar(t,name,varType): var = array(varType[0],[-999]) t.Branch(name,var,name+"/"+varType.upper()) return t, var def PutToZero(var): if not isinstance(var, array): var.clear() else: var[0] = 0 def Push(leaf, value): if not isinstance(leaf, array): leaf.push_back(value) else: leaf[0] = value def wasFired(indexKids, detPoints, detPos, pointsVects=None, Ethr=0): def lookingForHits(detPoints,flag,nstat,nstat_eff,indexKids,Eloss,Ethr): for hit in detPoints: if (indexKids is None) or (hit.GetTrackID() in indexKids): #print RPChit.GetTrackID(), t_ID # check if it is in one of the considered active layer for pos in detPos: if pos[0]<=hit.GetZ()<=pos[1]: Eloss += hit.GetEnergyLoss() #print pos, hit.GetZ() if pointsVects is not None: pointsVects[0].push_back(hit.GetX()) pointsVects[1].push_back(hit.GetY()) pointsVects[2].push_back(hit.GetZ()) flag = True nstat+=1 #eff_val = gRandom.Uniform(0.,1.) #if eff_val<0.9: # flag_eff = flag_eff or True # nstat_eff+=1 #else: # flag_eff = flag_eff or False flag_Ethr = Eloss>=Ethr return flag, nstat, nstat_eff, Eloss, flag_Ethr # Now in partKidTrackID I should have the trackID connected to my charged particles #flag_eff = False flag = False nstat = 0 nstat_eff = 0 Eloss = 0 flag,nstat,nstat_eff,Eloss,flag_Ethr = lookingForHits(detPoints,flag,nstat,nstat_eff,indexKids,Eloss,Ethr) #if flag==False and checkOn: #print "To be study event %s"%entry #PrintEventPart(particles,pdg) #PrintRPChits(detPoints,pdg) #print #print #assert(False) #return flag, flag_eff, nstat, nstat_eff, flag_Ethr return flag, flag_Ethr