Belle II Software  release-08-01-10
SVDGroupingPerformance Class Reference
Inheritance diagram for SVDGroupingPerformance:
Collaboration diagram for SVDGroupingPerformance:

Public Member Functions

def initialize (self)
 
def event (self)
 
def terminate (self)
 

Detailed Description

 check cluster grouping

Definition at line 109 of file svdGroupingPerformance.py.

Member Function Documentation

◆ event()

def event (   self)
 Event loop

Definition at line 387 of file svdGroupingPerformance.py.

387 
388  def event(self):
389  ''' Event loop'''
390 
391  EventT0 = Belle2.PyStoreObj('EventT0')
392  svdEventT0 = math.nan
393  cdcEventT0 = math.nan
394  svd = Belle2.Const.DetectorSet(Belle2.Const.SVD)
395  cdc = Belle2.Const.DetectorSet(Belle2.Const.CDC)
396  top = Belle2.Const.DetectorSet(Belle2.Const.TOP)
397  if EventT0.hasTemporaryEventT0(svd):
398  tmp = EventT0.getTemporaryEventT0s(Belle2.Const.SVD)
399  svdEventT0 = tmp.back().eventT0
400  if EventT0.hasTemporaryEventT0(cdc):
401  tmp = EventT0.getTemporaryEventT0s(Belle2.Const.CDC)
402  cdcEventT0 = tmp.back().eventT0
403 
404  if not math.isnan(svdEventT0):
405  self.TH1F_Store[self.TH1F_Index["th1f_svdEventT0"]].Fill(svdEventT0)
406  self.TH1F_Store[self.TH1F_Index["th1f_svdEventT0_State"]].Fill(1)
407  else:
408  self.TH1F_Store[self.TH1F_Index["th1f_svdEventT0_State"]].Fill(0)
409  if not math.isnan(cdcEventT0):
410  self.TH1F_Store[self.TH1F_Index["th1f_cdcEventT0"]].Fill(cdcEventT0)
411  self.TH1F_Store[self.TH1F_Index["th1f_cdcEventT0_State"]].Fill(1)
412  else:
413  self.TH1F_Store[self.TH1F_Index["th1f_cdcEventT0_State"]].Fill(0)
414 
415  if not math.isnan(svdEventT0) and not math.isnan(cdcEventT0):
416  self.TH2F_Store[self.TH2F_Index["th2f_svdEventT0_vs_cdcEventT0"]].Fill(svdEventT0, cdcEventT0)
417  self.TH2F_Store[self.TH2F_Index["th2f_svdEventT0_vs_cdcEventT0_rot45pos"]].Fill(
418  svdEventT0 * TMath.Cos(TMath.PiOver4()) + cdcEventT0 * TMath.Sin(TMath.PiOver4()),
419  - svdEventT0 * TMath.Sin(TMath.PiOver4()) + cdcEventT0 * TMath.Cos(TMath.PiOver4()))
420  self.TH2F_Store[self.TH2F_Index["th2f_svdEventT0_vs_cdcEventT0_rot45neg"]].Fill(
421  svdEventT0 * TMath.Cos(-TMath.PiOver4()) + cdcEventT0 * TMath.Sin(-TMath.PiOver4()),
422  - svdEventT0 * TMath.Sin(-TMath.PiOver4()) + cdcEventT0 * TMath.Cos(-TMath.PiOver4()))
423 
424  OnlineEventT0 = []
425  if not args.isMC:
426  OnlineEventT0 = Belle2.PyStoreArray('OnlineEventT0s')
427  topOnlineEventT0 = math.nan
428  for evt in OnlineEventT0:
429  if evt.getOnlineEventT0Detector() == top:
430  topOnlineEventT0 = evt.getOnlineEventT0()
431 
432  if not math.isnan(topOnlineEventT0) and not math.isnan(svdEventT0):
433  self.TH1F_Store[self.TH1F_Index["th1f_svdEventT0topRef"]].Fill(svdEventT0 - topOnlineEventT0)
434 
435  TRGECLData = []
436  if not args.isMC:
437  TRGECLData = Belle2.PyStoreArray('TRGECLUnpackerStores')
438  eclTCEmax = 0
439  for trgHit in TRGECLData:
440  hitWin = trgHit.getHitWin()
441  if hitWin != 3 and hitWin != 4:
442  continue
443  if trgHit.getTCEnergy() > eclTCEmax:
444  eclTCEmax = trgHit.getTCEnergy()
445 
446  if eclTCEmax:
447  self.TH1F_Store[self.TH1F_Index["th1f_eclTCEmax"]].Fill(eclTCEmax)
448  self.TH1F_Store[self.TH1F_Index["th1f_eclTCEmax_State"]].Fill(1)
449  if not math.isnan(topOnlineEventT0) and not math.isnan(svdEventT0):
450  self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index["reso_eclTCEmax_vs_svdEventT0TopRef"]].Fill(
451  eclTCEmax, svdEventT0 - topOnlineEventT0)
452  else:
453  self.TH1F_Store[self.TH1F_Index["th1f_eclTCEmax_State"]].Fill(0)
454 
455  # Pre Tracking
456 
457  clusterList = Belle2.PyStoreArray("SVDClusters")
458  if eclTCEmax:
459  self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index["reso_eclTCEmax_vs_totalClusters_PreTracking"]].Fill(
460  eclTCEmax, len(clusterList))
461  fillOnce = 0
462  for d in clusterList:
463  clsTime = d.getClsTime()
464 
465  self.TH1F_Store[self.TH1F_Index["th1f_clsTime_PreTracking"]].Fill(clsTime)
466  if not math.isnan(cdcEventT0):
467  self.TH1F_Store[self.TH1F_Index["th1f_clsTimeCdcRef_PreTracking"]].Fill(clsTime - cdcEventT0)
468  if not math.isnan(topOnlineEventT0) and eclTCEmax:
469  self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index["reso_eclTCEmax_vs_clsTimeTopRef_PreTracking"]].Fill(
470  eclTCEmax, clsTime - topOnlineEventT0)
471 
472  groupIds = d.getTimeGroupId()
473  groupInfo = d.getTimeGroupInfo()
474 
475  minId = 1000
476  par0 = -1000
477  par1 = -1000
478  par2 = -1000
479  for id in range(len(groupIds)):
480  gr = groupIds[id]
481  if gr < minId:
482  minId = gr
483  if len(groupInfo) > 0:
484  par0, par1, par2 = groupInfo[id]
485 
486  if len(groupIds) == 0:
487  minId = -1
488 
489  self.TH2F_Store[self.TH2F_Index["th2f_timeGr_vs_clsTime"]].Fill(clsTime, minId)
490  self.TH2F_Store[self.TH2F_Index["th2f_timeGr_vs_grAmp"]].Fill(par0, minId)
491  self.TH2F_Store[self.TH2F_Index["th2f_timeGr_vs_grCenter"]].Fill(par1, minId)
492  self.TH2F_Store[self.TH2F_Index["th2f_timeGr_vs_grWidth"]].Fill(par2, minId)
493 
494  if fillOnce == minId and fillOnce < 4:
495  if not math.isnan(cdcEventT0):
496  hname = "th2f_sig" + str(fillOnce) + "GrMean_vs_cdcEventT0"
497  self.TH2F_Store[self.TH2F_Index[hname]].Fill(par1, cdcEventT0)
498  hname = "th2f_sig" + str(fillOnce) + "GrMean_vs_cdcEventT0_rot45neg"
499  self.TH2F_Store[self.TH2F_Index[hname]].Fill(
500  par1 * TMath.Cos(-TMath.PiOver4()) + cdcEventT0 * TMath.Sin(-TMath.PiOver4()),
501  - par1 * TMath.Sin(-TMath.PiOver4()) + cdcEventT0 * TMath.Cos(-TMath.PiOver4()))
502  hname = "th2f_sig" + str(fillOnce) + "GrMean_vs_cdcEventT0_rot45pos"
503  self.TH2F_Store[self.TH2F_Index[hname]].Fill(
504  par1 * TMath.Cos(TMath.PiOver4()) + cdcEventT0 * TMath.Sin(TMath.PiOver4()),
505  - par1 * TMath.Sin(TMath.PiOver4()) + cdcEventT0 * TMath.Cos(TMath.PiOver4()))
506  fillOnce += 1
507 
508  if minId == 0:
509  self.TH1F_Store[self.TH1F_Index["th1f_sigClsTime_PreTracking"]].Fill(clsTime)
510  else:
511  self.TH1F_Store[self.TH1F_Index["th1f_bkgClsTime_PreTracking"]].Fill(clsTime)
512 
513  # Post Tracking
514 
515  recoTrackList = Belle2.PyStoreArray('RecoTracks')
516  nTracks = len(recoTrackList)
517  nClusters = 0
518  for recoTrk in recoTrackList:
519  if not recoTrk.wasFitSuccessful():
520  nTracks -= 1
521  continue
522 
523  trackList = recoTrk.getRelationsFrom('Tracks')
524  if len(trackList) == 0:
525  nTracks -= 1
526  continue
527  trkTime0 = trackList[0].getTrackTime()
528 
529  self.TH1F_Store[self.TH1F_Index["th1f_trackTime"]].Fill(trkTime0)
530  if not math.isnan(cdcEventT0):
531  self.TH1F_Store[self.TH1F_Index["th1f_trackTimeCDCRef"]].Fill(trkTime0 - cdcEventT0)
532 
533  clusterList = recoTrk.getRelationsFrom("SVDClusters")
534  nClusters += len(clusterList)
535  if len(clusterList) == 0:
536  continue
537 
538  trkTime = 0
539  for d in clusterList:
540  trkTime += d.getClsTime()
541  trkTime /= len(clusterList)
542 
543  for d in clusterList:
544  clsTime = d.getClsTime()
545  groupIds = d.getTimeGroupId()
546  groupInfo = d.getTimeGroupInfo()
547 
548  if not math.isnan(svdEventT0):
549  self.TH2F_Store[self.TH2F_Index["th2f_trkTime_vs_clsTime_inSVDEventT0"]].Fill(
550  trkTime0 - clsTime, svdEventT0 - trkTime0)
551  if not math.isnan(cdcEventT0):
552  self.TH2F_Store[self.TH2F_Index["th2f_trkTime_vs_clsTime_inCDCEventT0"]].Fill(
553  trkTime0 - clsTime, cdcEventT0 - trkTime0)
554  self.TH2F_Store[self.TH2F_Index["th2f_aveClsTimeInTrk_vs_cdcEventT0"]].Fill(trkTime, cdcEventT0)
555  if not math.isnan(svdEventT0):
556  self.TH2F_Store[self.TH2F_Index["th2f_aveClsTimeInTrk_vs_clsTime_inSVDEventT0"]].Fill(
557  trkTime - clsTime, svdEventT0 - trkTime)
558  if not math.isnan(cdcEventT0):
559  self.TH2F_Store[self.TH2F_Index["th2f_aveClsTimeInTrk_vs_clsTime_inCDCEventT0"]].Fill(
560  trkTime - clsTime, cdcEventT0 - trkTime)
561 
562  self.TH1F_Store[self.TH1F_Index["th1f_clsTime_PostTracking"]].Fill(clsTime)
563  if not math.isnan(cdcEventT0):
564  self.TH1F_Store[self.TH1F_Index["th1f_clsTimeCdcRef_PostTracking"]].Fill(clsTime - cdcEventT0)
565  if not math.isnan(topOnlineEventT0) and eclTCEmax:
566  self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index["reso_eclTCEmax_vs_clsTimeTopRef_PostTracking"]].Fill(
567  eclTCEmax, clsTime - topOnlineEventT0)
568 
569  minId = 1000
570  par0 = -1000
571  par1 = -1000
572  par2 = -1000
573  if len(groupIds) == 0:
574  minId = -1
575  for id in range(len(groupIds)):
576  gr = groupIds[id]
577  if gr < minId:
578  minId = gr
579  if len(groupInfo) > 0:
580  par0, par1, par2 = groupInfo[id]
581 
582  self.TH2F_Store[self.TH2F_Index["th2f_timeGr_vs_clsTime_PostTracking"]].Fill(clsTime, minId)
583 
584  if par1 > sigMin and par1 < sigMax:
585  self.TH1F_Store[self.TH1F_Index["th1f_sigClsTime_PostTracking"]].Fill(clsTime)
586  else:
587  self.TH1F_Store[self.TH1F_Index["th1f_bkgClsTime_PostTracking"]].Fill(clsTime)
588 
589  if eclTCEmax:
590  self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index["reso_eclTCEmax_vs_totalTracks"]].Fill(eclTCEmax, nTracks)
591  self.reso_TH2D_Histograms[self.reso_TH2D_Histogram_Index["reso_eclTCEmax_vs_totalClusters_PostTracking"]].Fill(
592  eclTCEmax, nClusters)
The DetectorSet class for sets of detector IDs in the form of EDetector values.
Definition: Const.h:71
A (simplified) python wrapper for StoreArray.
Definition: PyStoreArray.h:72
a (simplified) python wrapper for StoreObjPtr.
Definition: PyStoreObj.h:67

◆ initialize()

def initialize (   self)
define histograms

Definition at line 112 of file svdGroupingPerformance.py.

◆ terminate()

def terminate (   self)
write

Definition at line 593 of file svdGroupingPerformance.py.


The documentation for this class was generated from the following file: