~durga/maus/rel709

« back to all changes in this revision

Viewing changes to src/reduce/ReducePyTofCalib/ReducePyTofCalib.py

  • Committer: Durga Rajaram
  • Date: 2015-03-20 08:30:19 UTC
  • mfrom: (659.1.105 release-candidate)
  • Revision ID: durga@fnal.gov-20150320083019-6wbtnk33gvpmm2zx
Tags: MAUS-v0.9.4
MAUS-v0.9.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#pylint: disable = R0912, R0914, R0915
23
23
#pylint: disable = C0103
24
24
#pylint: disable = W0201, W0612, W0613
 
25
import os
25
26
import json
26
27
import ROOT
27
28
from array import array
52
53
        self.run_ended = False
53
54
        self.tdcPico = 1000.0
54
55
        self.calib_file = "tofcalibdata_"
 
56
        self.output_dir = ""
55
57
        if not self.__make_tree():
56
58
            print 'ReducePyTofCalib: Failed to make tree'
57
59
            return
65
67
        """
66
68
        # setup the root tree
67
69
        self.run_ended = False
 
70
        config_doc = json.loads(config_json)
 
71
        self.output_dir = config_doc["end_of_run_output_root_directory"]
68
72
        return True
69
73
 
70
74
 
315
319
        at death.
316
320
        @param self Object reference.
317
321
        """
318
 
        outfilename = self.calib_file + str(self.rnum) + ".root"
 
322
        
 
323
        outDir = str(self.output_dir) + str(self.rnum)
 
324
        outfilename = outDir + "/" + self.calib_file + str(self.rnum) + ".root"
 
325
        try:
 
326
            if not os.path.exists(outDir):
 
327
                os.makedirs(outDir)
 
328
            if not os.path.isdir(outDir):
 
329
                raise ValueError("image_directory is a file: %s" % outDir)
 
330
        except OSError:
 
331
            pass
319
332
        self.calibFile = ROOT.TFile(outfilename,"recreate")
320
333
        self.calibFile.cd()
321
334
        self.dataTree.Write()