Newer
Older
TB_Chris / Kepler / options / ResStudies / .svn / text-base / restudies.py.svn-base
  1. # Configuration file for residual studies.
  2.  
  3. from os.path import join, abspath
  4. from sys import path
  5.  
  6. import pickle
  7.  
  8. from Gaudi.Configuration import *
  9. from Configurables import Kepler
  10.  
  11. cdir = "eos/lhcb/testbeam/velo/timepix3/LabData/TP/SurrogateParameterFiles/"
  12. cfile = {"W0009_J04" : [ cdir+"S20_Coarse64_26022015_SpidrTime_surrog_fitpars_perpix_NNsmoothingON.dat" ],
  13. "W0009_H08,W0009_D09,W0009_E09": [ cdir+"T2_200V_TestPulse_SpidrTime_130315_CHIP0_surrog_fitpars_perpix_NNsmoothingON.dat",
  14. cdir+"T2_200V_TestPulse_SpidrTime_130315_CHIP1_surrog_fitpars_perpix_NNsmoothingON.dat",
  15. cdir+"T2_200V_TestPulse_SpidrTime_130315_CHIP2_surrog_fitpars_perpix_NNsmoothingON.dat"]
  16. }
  17.  
  18. PATH_TO_OPTS= abspath('/afs/cern.ch/user/c/chombach/cmtuser/KEPLER/KEPLER_HEAD/Tb/Kepler/options/ResStudies/')
  19. path.append( PATH_TO_OPTS )
  20. from Runs import Runs
  21.  
  22. pickled_runs = PATH_TO_OPTS+'/Runs.pkl'
  23. runs = pickle.load( open( pickled_runs ) )
  24.  
  25. block = runs.BLOCKS[0]
  26. rdut = runs.RUNS[block][0].DUT
  27. #runs = Runs('A','run')
  28.  
  29. if runs.TYPE == 'survey':
  30. Kepler().Alignment = True
  31. Kepler().EvtMax = 100
  32.  
  33. from Configurables import TbClusterPlots
  34. # Set the reference plane.
  35. TbClusterPlots().ReferencePlane = 3
  36.  
  37. # Widen the range of the difference histograms if needed.
  38. TbClusterPlots().ParametersDifferenceXY = ('', -30., 30., 600)
  39. from Configurables import TbAlignment
  40. TbAlignment().AlignmentTechnique = "survey"
  41.  
  42. from Configurables import TbEventBuilder
  43. TbEventBuilder().MinPlanesWithHits = 5
  44.  
  45. elif runs.TYPE == 'mille':
  46. Kepler().Alignment = True
  47. Kepler().EvtMax = 100
  48. # List of devices under test
  49. duts = [4]
  50. from Configurables import TbTracking
  51. # Exclude DUTs from the pattern recognition.
  52. TbTracking().MaskedPlanes = duts
  53. # Require clusters on all telescope planes.
  54. TbTracking().MinNClusters = 8
  55. from Configurables import TbClusterPlots
  56. # Set the reference plane.
  57. TbClusterPlots().ReferencePlane = 3
  58. TbClusterPlots().ParametersDifferenceXY = ('', -10., 10., 200)
  59. from Configurables import TbAlignment
  60. # Set the number of tracks to process.
  61. TbAlignment().NTracks = 10000
  62. # Set the reference plane (fixed position).
  63. TbAlignment().ReferencePlane = 3
  64. # Set the degrees of freedom (x, y, z, rx, ry, rz).
  65. TbAlignment().DoFs = [1, 1, 0, 1, 1, 1]
  66. TbAlignment().ParametersResidualsXY = ("", -0.2, 0.2, 100)
  67. TbAlignment().MaskedPlanes = duts
  68. TbAlignment().PrintConfiguration = True
  69. TbAlignment().ResCutInit = 1.3
  70. TbAlignment().ResCut = 0.06
  71. TbAlignment().NIterations = 6
  72. TbAlignment().AlignmentTechnique = "Millepede"
  73.  
  74. from Configurables import TbMillepede
  75. TbMillepede().OutputLevel = 2
  76. from Configurables import TbEventBuilder
  77. TbEventBuilder().MinPlanesWithHits = 5
  78.  
  79. elif runs.TYPE == 'dut':
  80. Kepler().Alignment = True
  81. Kepler().EvtMax = 100
  82.  
  83. from Configurables import TbAlignment
  84. TbAlignment().AlignmentTechnique = "Millepede"
  85. TbAlignment().MilleDUT = True
  86. TbAlignment().DeviceToAlign = 4
  87. TbAlignment().DoFs = [1, 1, 0, 1, 1, 1]
  88. # Set the number of tracks to process.
  89. TbAlignment().NTracks = 10000
  90.  
  91. from Configurables import TbEventBuilder
  92. TbEventBuilder().MinPlanesWithHits = 5
  93. elif runs.TYPE == 'run':
  94. Kepler().Alignment = False
  95. Kepler().EvtMax = 1000
  96.  
  97. from Configurables import TbClustering
  98. TbClustering().PrintConfiguration = True
  99.  
  100. from Configurables import TbTracking
  101. TbTracking().PrintConfiguration = True
  102.  
  103. Kepler().PixelConfigFile = cfile[ rdut ]