91   def ExecuteEvent(self,event):
   92       h = self.M.h
   93       proj = self.proj
   94       geo = self.M.snd_geo
   95       detSize = self.detSize
   96       N = self.M.EventNumber
   97       options = self.options
   98 
   99       nav = ROOT.gGeoManager.GetCurrentNavigator()
  100       if options.goodEvents and not self.goodEvent(event): return
  101       if options.withTrack:
  102              self.trackTask.ExecuteTask()
  103              ntracks = self.M.Reco_MuonTracks.GetEntries()
  104              uniqueTracks = self.M.Reco_MuonTracks 
  105              if len(uniqueTracks)<options.nTracks: return
  106 
  107              for aTrack in self.M.Reco_MuonTracks:
  108                   mom    = aTrack.getFittedState().getMom()
  109                   pos      = aTrack.getFittedState().getPos()
  110                   if aTrack.GetUniqueID()==3: tt = 'DS'
  111                   else: tt='Scifi'
  112                   print(tt+' track direction:  X %5.2Fmrad  Y %5.2Fmrad'%(mom.X()/mom.Z()*1000,mom.Y()/mom.Z()*1000))
  113                   print('   track position:   X %5.2Fcm  Y %5.2Fcm '%(pos.X(),pos.Y()))
  114 
  115       digis = []
  116       if event.FindBranch("Digi_ScifiHits"): digis.append(event.Digi_ScifiHits)
  117       if event.FindBranch("Digi_MuFilterHits"): digis.append(event.Digi_MuFilterHits)
  118       empty = True
  119       for x in digis:
  120           if x.GetEntries()>0:
  121              if empty: print( "event -> %i"%N)
  122              empty = False
  123       if empty: return
  124       h['hitCollectionX']= {'Scifi':[0,ROOT.TGraphErrors()],'DS':[0,ROOT.TGraphErrors()]}
  125       h['hitCollectionY']= {'Veto':[0,ROOT.TGraphErrors()],'Scifi':[0,ROOT.TGraphErrors()],'US':[0,ROOT.TGraphErrors()],'DS':[0,ROOT.TGraphErrors()]}
  126       h['firedChannelsX']= {'Scifi':[0,0,0],'DS':[0,0,0]}
  127       h['firedChannelsY']= {'Veto':[0,0,0,0],'Scifi':[0,0,0],'US':[0,0,0,0],'DS':[0,0,0,0]}
  128       systems = {1:'Veto',2:'US',3:'DS',0:'Scifi'}
  129       for collection in ['hitCollectionX','hitCollectionY']:
  130          for c in h[collection]:
  131             rc=h[collection][c][1].SetName(c)
  132             rc=h[collection][c][1].Set(0)
  133 
  134       for p in proj:
  135          rc = h[ 'simpleDisplay'].cd(p)
  136          h[proj[p]].Draw('b')
  137          self.emptyNodes()
  138          self.drawDetectors()
  139       for D in digis:
  140         for digi in D:
  141            detID = digi.GetDetectorID()
  142            sipmMult = 1
  143            if digi.GetName()  == 'MuFilterHit':
  144               system = digi.GetSystem()
  145               geo.modules['MuFilter'].GetPosition(detID,A,B)
  146               sipmMult = len(digi.GetAllSignals())
  147               if sipmMult<self.minSipmMult and (system==1 or system==2): continue
  148            else:
  149               geo.modules['Scifi'].GetSiPMPosition(detID,A,B)
  150               system = 0
  151            curPath = nav.GetPath()
  152            tmp = curPath.rfind('/')
  153            nav.cd(curPath[:tmp])
  154            globA,locA = array('d',[A[0],A[1],A[2]]),array('d',[A[0],A[1],A[2]])
  155            if self.trans2local:   nav.MasterToLocal(globA,locA)
  156            Z = A[2]
  157            if digi.isVertical():
  158                   collection = 'hitCollectionX'
  159                   Y = locA[0]
  160                   sY = detSize[system][0]
  161            else:                         
  162                   collection = 'hitCollectionY'
  163                   Y = locA[1]
  164                   sY = detSize[system][1]
  165            c = h[collection][systems[system]]
  166            rc = c[1].SetPoint(c[0],Z, Y)
  167            rc = c[1].SetPointError(c[0],detSize[system][2],sY)
  168            c[0]+=1 
  169 
  170            self.fillNode(curPath)
  171 
  172            if digi.isVertical():  F = 'firedChannelsX'
  173            else:                     F = 'firedChannelsY'
  174            ns = max(1,digi.GetnSides())
  175            for side in range(ns):
  176               for m in  range(digi.GetnSiPMs()):
  177                   qdc = digi.GetSignal(m+side*digi.GetnSiPMs())
  178                   if qdc < 0 and qdc > -900:  h[F][systems[system]][1]+=1
  179                   elif not qdc<0:   
  180                       h[F][systems[system]][0]+=1
  181                       
  182       h['hitCollectionY']['Scifi'][1].SetMarkerColor(ROOT.kBlue+2)
  183       h['hitCollectionX']['Scifi'][1].SetMarkerColor(ROOT.kBlue+2)
  184       k = 1
  185       for collection in ['hitCollectionX','hitCollectionY']:
  186          h[ 'simpleDisplay'].cd(k)
  187          self.drawInfo(h[ 'simpleDisplay'], k, N, event)
  188          k+=1
  189          for c in h[collection]:
  190             F = collection.replace('hitCollection','firedChannels')
  191             pj = collection.split('ion')[1]
  192             if pj =="X" or c=="Scifi":
  193                 print( "%1s %5s %3i  +:%3i -:%3i qdc :%5.1F"%(pj,c,h[collection][c][1].GetN(),h[F][c][0],h[F][c][1],h[F][c][2]))
  194             else:
  195                 print( "%1s %5s %3i  +:%3i -:%3i qdcL:%5.1F qdcR:%5.1F"%(pj,c,h[collection][c][1].GetN(),h[F][c][0],h[F][c][1],h[F][c][2],h[F][c][3]))
  196             if h[collection][c][1].GetN()<1: continue
  197             if c=='Scifi':
  198               h[collection][c][1].SetMarkerStyle(20)
  199               h[collection][c][1].SetMarkerSize(1.5)
  200               rc=h[collection][c][1].Draw('sameP')
  201               h['display:'+c]=h[collection][c][1]
  202       if options.withTrack: self.addTrack()
  203       h[ 'simpleDisplay'].Update()
  204       if options.save: h['simpleDisplay'].Print('event_'+"{:04d}".format(N)+'.png')
  205       if options.interactive:  
  206           rc = input("hit return for next event ")
  207       else:
  208           self.M.myPrint(h[ 'simpleDisplay'],'event'+str(N%10),subdir='eventdisplay')
  209