Newer
Older
TB_Chris / Kepler / options / .svn / text-base / efficiency.py.svn-base
  1. # Basic configuration file.
  2. # Execute with: gaudirun.py $KEPLERROOT/options/example.py
  3. from Gaudi.Configuration import *
  4. from Configurables import Kepler
  5. import pickle
  6. import ROOT
  7.  
  8. # Set the path to the directory/files to be processed
  9. path = 'eos/lhcb/testbeam/velo/timepix3/'
  10. RUN = '9110'
  11. # if int(RUN) < 2000:
  12. # path += 'July'
  13. # elif int(RUN) < 2815:
  14. # path += 'Oct'
  15. # elif int(RUN) < 4000:
  16. # path += 'Nov'
  17. # else:
  18. # path += 'Dec'
  19. # path += '2014'
  20.  
  21. path += 'July2015'
  22.  
  23. Kepler().InputFiles = [path + '/RawData/Run' + RUN + '/']
  24. Kepler().PixelConfigFile = ["eos/lhcb/testbeam/velo/timepix3/July2014/RootFiles/Run1236/Conditions/PixelConfig.dat"]
  25. Kepler().AlignmentFile = path + '/RootFiles/Run' + RUN + '/Conditions/Alignment' + RUN + 'mille.dat'
  26. #Kepler().AlignmentFile = 'ResStudies/Alignments/dut/Alignment2509.dat'
  27. Kepler().HistogramFile= 'Kepler_histos_' + RUN + '.root'
  28. # Set the number of events to run over
  29. Kepler().EvtMax = 11000000
  30. #Kepler().TimingConfigFile = "myTimingConfig.dat"
  31.  
  32. # Set the configuration of the individual algorithms, e. g.
  33. from Configurables import TbEventBuilder
  34. #TbEventBuilder().MinPlanesWithHits = 5
  35.  
  36. from Configurables import TbClustering
  37. TbClustering().PrintConfiguration = True
  38.  
  39. from Configurables import TbSimpleTracking
  40. TbSimpleTracking().PrintConfiguration = True
  41.  
  42. from Configurables import TbVisualiserOutput
  43. TbVisualiserOutput().PrintConfiguration = True
  44. TbVisualiserOutput().ViewerEvent = 1049
  45. Kepler().UserAlgorithms = [TbVisualiserOutput()]
  46.  
  47. DUT_id = pickle.load( open( "DUTnum.p", "rb" ) )
  48. #DUT_id = 3
  49.  
  50.  
  51. fResiduals = ROOT.TFile("UnbiasedLocalResolutionsPerPlane.root")
  52. gx = fResiduals.Get("xPerPlane")
  53. gy = fResiduals.Get("yPerPlane")
  54. scaling = 15
  55. print ((gx.GetBinContent(DUT_id+1)**2 + gy.GetBinContent(DUT_id+1)**2)**0.5)
  56. allowance = scaling * ((gx.GetBinContent(DUT_id+1)**2 + gy.GetBinContent(DUT_id+1)**2)**0.5)
  57. print 'DUT_id', DUT_id
  58. print 'allowance:', allowance
  59.  
  60. def egRun():
  61. from Configurables import TbEventBuilder, TbTrackPlots, TbCalibration, TbVisualiserOutput
  62. from Configurables import TbClustering, TbClusterPlots, TbSimpleTracking, TbHitMonitor
  63. from Configurables import TbClusterAssociator, TbEfficiency, TbDUTMonitor
  64. TbEventBuilder().PrintFreq = 10
  65. TbSimpleTracking().TimeWindow = 6
  66. TbSimpleTracking().MaxDistance = 0
  67. TbSimpleTracking().MinPlanes = 7
  68. TbSimpleTracking().MaskedPlanes = [DUT_id, 4]
  69. TbSimpleTracking().MaxOpeningAngle = 0.005
  70. TbSimpleTracking().RecheckTrack = True
  71. TbSimpleTracking().ChargeCutLow = 0
  72. TbSimpleTracking().DoOccupancyCut = True
  73. TbSimpleTracking().MaxClusterSize = 20
  74. TbSimpleTracking().MaxOccupancy = 7 # not inclusive
  75. TbTrackPlots().MaskedPlanes = [DUT_id, 4]
  76. TbClusterAssociator().DUTs = [DUT_id]
  77. TbDUTMonitor().DUTs = [DUT_id]
  78. TbClusterAssociator().TimeWindow = 10
  79. TbClusterAssociator().XWindow = allowance
  80. TbEfficiency().CheckHitDUT = True
  81. TbEfficiency().CheckHitAlivePixel = True
  82. TbEfficiency().DUT = DUT_id
  83. TbEfficiency().TakeDeadPixelsFromFile = True
  84. TbEfficiency().nTotalTracks =500000
  85. TbEfficiency().MaxChi = 2
  86. seq = GaudiSequencer("Telescope")
  87. seq.Members = [TbEventBuilder(), TbClustering(), TbSimpleTracking(), TbClusterAssociator(), TbEfficiency()]
  88. #seq.Members = [TbEventBuilder()]
  89. seq = GaudiSequencer("Monitoring")
  90. from Configurables import TbHitMonitor, TbClusterPlots, TbTrackPlots
  91. #seq.Members = [TbHitMonitor(), TbClusterPlots(), TbTrackPlots(), TbDUTMonitor(), TbVisualiserOutput()]
  92. seq.Members = [TbDUTMonitor()]
  93. appendPostConfigAction(egRun)