Exemplo n.º 1
0
    def __init__(self, data_dir, run_number, config):
        Converter.__init__(self, data_dir, run_number, config)

        # DIRECTORIES
        self.EUDAQDir = self.SoftDir.joinpath(self.Config.get('SOFTWARE', 'eudaq2'))
        self.ProteusSoftDir = self.SoftDir.joinpath(self.Config.get('SOFTWARE', 'proteus'))
        self.ProteusDataDir = self.DataDir.joinpath('proteus')

        # FILENAMES
        self.ROOTFileName = join(self.SaveDir, 'run{:06d}.root'.format(self.RunNumber))
        self.AlignSteps = self.get_align_steps()
        self.TrackFileName = join(self.ProteusDataDir, 'track-{:04d}-data.root'.format(self.RunNumber))
        self.MatchFileName = join(self.ProteusDataDir, 'match-{:04d}-trees.root'.format(self.RunNumber))
        self.FinalFileName = join(self.SaveDir, 'run{:04d}.hdf5'.format(self.RunNumber))
        self.FileNames = [self.ROOTFileName] + self.get_align_files() + [self.TrackFileName, self.MatchFileName, self.FinalFileName]

        self.NSteps = len(self.FileNames)
        self.NTelPlanes = self.Config.getint('TELESCOPE', 'planes')
        self.NDUTPlanes = self.Config.getint('DUT', 'planes')

        # FILES
        self.F = None
        self.TrackFile = TFile()
        self.MatchFile = TFile()

        self.Draw = Draw()
Exemplo n.º 2
0
    def __init__(self, filename, plane, config, save_dir=None, first_run=None):

        Converter.__init__(self, filename, config)
        self.SaveDir = save_dir
        self.CalibrationDir = join(self.SaveDir, 'calibrations')
        self.RunNumber = basename(filename).strip('.root').split('_')[-1]
        self.FirstRun = first_run if first_run is not None else self.RunNumber

        self.OldFile = read_root_file(filename)
        self.OldTree = self.OldFile.Get('Plane{}'.format(6 +
                                                         plane)).Get('Hits')
        self.EventTree = self.OldFile.Get('Event')
        self.NewFile = self.create_new_file(filename, save_dir)
        self.NewTree = self.OldTree.CloneTree(0)

        # New Branches
        self.ScalarBranches = OrderedDict([('NCluster', array([0], 'u2')),
                                           ('TimeStamp', array([0], 'f8'))])
        self.VectorBranches = OrderedDict([('VCal', vector('float')()),
                                           ('ClusterSize',
                                            vector('unsigned short')()),
                                           ('ClusterX', vector('float')()),
                                           ('ClusterY', vector('float')()),
                                           ('ClusterVcal', vector('float')())])

        # Charge Fits
        self.FitParameters = zeros((52, 80, 4))
        self.Fit = TF1('ErFit', '[3] * (TMath::Erf((x - [0]) / [1]) + [2])',
                       -500, 255 * 7)
        self.get_fits()

        # Vars
        self.Hits = []
        self.ClusteredHits = []
        self.Clusters = []

        self.ProgressBar = None