Пример #1
0
    def __init__(self,useLogger=True):
        self.f = None
        self.writer = writer.writer()
        self.P = process.process(makeDirs=False)
        self.gU= graphUtils.graphUtils()
        self.pip= pipath.pipath()

        self.requestedRuns = 'ALL'

        self.now = now = datetime.datetime.now()
        self.start_time = now
        fmt = '%Y%m%d_%H%M%S_%f'
        cnow = now.strftime(fmt)
        self.parentDir = 'Second/'+cnow+'/'
        self.logdir = self.parentDir + 'Log/'
        self.figdir = self.parentDir + 'Figures/'
        dirs = self.pip.fix( [self.parentDir, self.logdir, self.figdir] ) # make paths platform indepedent
        for d in dirs:
            if os.path.isdir(d):
                pass
            else:
                try:
                    os.mkdir(d)
                except IOError,e:
                    print 'second__init__',e
                else:
                    print 'second__init__ created',d
Пример #2
0
    def __init__(self):
        self.scalerTypes =  ['float32','float64','uint32']

        # used by unpackEvent, summary
        self.datasetNames = [ "Digitizer_1","Digitizer_2", "Event_Temp", "Event_Time", "QDC_1","QDC_2", "Scaler", "TDC"]
        
        self.QDCNames = [x for x in self.datasetNames if 'QDC' in x]
        self.TDCNames = [x for x in self.datasetNames if 'TDC' in x]
        self.WFDNames = [x for x in self.datasetNames if 'Digitizer' in x]
        #print 'reader.init QDCnames',self.QDCNames,'TDCNames',self.TDCNames,'WFDNames',self.WFDNames
        
        self.eventCalls = 0
        self.incompleteEvents = {}

        # used by unpackTrigger
        self.validTriggers = ['CT','M','LED','CT+M+LED'] # as of 20160106
        self.triggerOR     = ['CT+M+LED']
        self.uniqueTriggers = [x for x in self.validTriggers if x not in self.triggerOR]
        #print 'reader__init__ self.uniqueTriggers',self.uniqueTriggers
        
        self.gU = graphUtils.graphUtils()

        self.topLevelKeys = ['Run_Info','Events']
        
        print 'reader: initialized'
        return
Пример #3
0
 def __init__(self):
     #ROOT.gROOT.ProcessLine('.L langaus.C++')
     #self.lgfun = ROOT.langaufun
     self.gU = graphUtils.graphUtils()
     self.cAC = cutsAndConstants.cutsAndConstants()
     print 'gfit initialized'
     return
Пример #4
0
    def __init__(self):
        self.h = None
        self.f = None  # needed to keep histograms in scope
        self.gU = graphUtils.graphUtils()

        self.sr2pi = math.sqrt(2. * math.pi)

        return
Пример #5
0
 def __init__(self,mode):
     self.mode = mode
     self.fn = '/Users/djaffe/Documents/Neutrinos/LDRD2010/OneTonPrototypeIn2-224/Installation/HVscan_20151230.csv'
     if mode==1: self.fn = '/Users/djaffe/Documents/Neutrinos/LDRD2010/OneTonPrototypeIn2-224/Installation/HVscan_20160104.csv'
     self.figdir = 'Figures/HVscan/'
     self.columns = {}
     self.colhdrs = []
     self.sgnlhdrs= []
     self.gU = graphUtils.graphUtils()
     return
Пример #6
0
    def __init__(self):
        self.procLog = 'Logfiles/procWaveDump/'
        self.daqLog = '/Users/djaffe/work/WaveDumpData/logfiles/'
        self.cWD = get_filepaths.get_filepaths()
        self.rLF = readLogFile.readLogFile()
        self.gU = graphUtils.graphUtils()
        self.procLogList = self.cWD.get_filepaths(self.procLog)
        self.daqLogList = self.cWD.get_filepaths(self.daqLog)
        self.figdir = 'Figures/livetime/'

        print 'livetime Initialized'
        return
Пример #7
0
    def __init__(self,Log=True,Speedy=False):


        self.gU = graphUtils.graphUtils(defMarkerSize=2)
        self.mTT= makeTTree.makeTTree()
        self.cAC= cutsAndConstants.cutsAndConstants()
        self.figdir = 'Figures/Speedy/'

        now = datetime.datetime.now()
        fmt = '%Y%m%d_%H%M%S_%f'
        self.start_time = cnow = now.strftime(fmt)

        self.outRootFile    =  'Speedy/Results/speedy_'+cnow+'.root'
        return
Пример #8
0
    def __init__(self,makeDirs=True):
        self.R = reader.reader()
        self.W = wfanal.wfanal()
        self.writer = writer.writer()
        self.cT = calibThermocouple.calibThermocouple()
        self.gU= graphUtils.graphUtils()
        self.pip= pipath.pipath()

        self.writeRecon = None
        self.overlaps = 0
        self.lastEventDumped = None
        
        self.Hists = {}
        self.TDChistnames = {}
        self.refTDCs = ['S2','H0']
        self.WFHists = []
        self.Times = []
        self.rawTemps = []
        self.calTemps = []
        self.AllTrigsfname = None
        self.rootpyEvts = None
        self.NoHists = False

        if makeDirs:
            now = datetime.datetime.now()
            self.start_time = now
            fmt = '%Y%m%d_%H%M%S_%f'
            cnow = now.strftime(fmt)
            parentDir = 'Results/'+cnow+'/'
            self.logdir = parentDir + 'Log/'
            self.figdir = parentDir + 'Figures/'
            self.WFfigdir = self.figdir + 'WF/'
            self.TDCfigdir= self.figdir + 'TDC/'
            self.outputdir= parentDir + 'Output/'
            # create list of platform-independent path
            dirs = self.pip.fix( [parentDir, self.logdir, self.figdir, self.WFfigdir, self.TDCfigdir, self.outputdir] )
            parentDir, self.logdir, self.figdir, self.WFfigdir, self.TDCfigdir, self.outputdir = dirs
            for d in dirs:
                if os.path.isdir(d):
                    pass
                else:
                    try:
                        os.makedirs(d)
                    except IOError,e:
                        print 'process__init__',e
                    else:
                        print 'process__init__ created',d
Пример #9
0
    def __init__(self):
        self.gU = graphUtils.graphUtils()
        self.graphs = {}
        self.graphSuffixes = ['raw','corr','exInt','cByr']
        self.TMG = {}
        self.icol = 1

        self.peakWidth = 5.0
        self.peakSideBand = 2.
        self.emissionWidth = 200. 

        self.figdir = 'Felix_Results/'

        self.fluors = ['bisMSB','POPOP','PPO']
        self.solvents = ['ETOH','CX','cyclo','LAB']

        return
Пример #10
0
    def __init__(self):
        self.gU = graphUtils.graphUtils()
        self.cGwE = ROOT.TF1("cGwE", self.convGwE, -10., 150.,
                             3)  # name,func,xmi,xma,Npar
        self.cGwE.SetParName(0, 'Amp')
        self.cGwE.SetParName(1, 'Lifetime')
        self.cGwE.SetParName(2, 'Sigma')

        self.cGwEN = ROOT.TF1("cGwEN", self.convGwEN, -10., 250., 7)
        self.cGwEN.SetParName(0, 'Amp')
        self.cGwEN.SetParName(1, 'Lifetime0')
        self.cGwEN.SetParName(2, 'Sigma')
        self.cGwEN.SetParName(3, 'frac1')
        self.cGwEN.SetParLimits(3, 0., 1.)
        self.cGwEN.SetParName(4, 'Lifetime1')
        self.cGwEN.SetParName(5, 'frac2')
        self.cGwEN.SetParLimits(5, 0., 1.)
        self.cGwEN.SetParName(6, 'Lifetime2')

        return
Пример #11
0
    def __init__(self,inputRFN=None):
        if inputRFN is None:
            sys.exit( 'spe_calc.__init__ NO INPUT ROOT FILE SPECIFIED')
        inputRootFileName = inputRFN
        self.GFIT = gfit.gfit()
        self.pip  = pipath.pipath()
        self.gU   = graphUtils.graphUtils()

        fmt = '%Y%m%d_%H%M%S_%f'
        cnow = datetime.datetime.now().strftime(fmt)
        d = outdir = os.path.join( 'FitResults', cnow )

        if os.path.isdir(d):
            pass
        else:
            try:
                os.mkdir(d)
            except IOError,e:
                print 'spe_calc__init__',e
            else:
Пример #12
0
    def __init__(self,graphIt=False):
        oven = [25.,  30., 40., 35., 30., 25., 15., 20.]
        tc   = [36.1, 40.5, 49.4, 45.2, 41.2, 36.7, 27.1, 31.1]
        if graphIt:
            gU = graphUtils.graphUtils()

            tmg = gU.makeTMultiGraph('Fit_line_and_measured_points')

            g = gU.makeTGraph(tc,oven,'thermocouple readback vs oven temp (C)','tc_v_oven')
            gU.color(g,0,0,setMarkerColor=True)
            g.SetLineColor(10) # white lines
            #gU.drawGraph(g)
            tmg.Add(g)


        x = tc
        y = oven
        Sx = sum(x)
        Sy = sum(y)
        Sxy = sum([a*b for a,b, in zip(x,y)])
        Sxx = sum([a*a for a in x])
        N = float(len(x))
        m = (Sx*Sy - N*Sxy)/(Sx*Sx - N*Sxx)
        b = (Sy - m*Sx)/N
        self.slope = m
        self.intercept = b

        if graphIt:
            U,V = [],[]
            for i in range(250,500):
                X = float(i)/10.
                Y = m*X+b
                U.append(X)
                V.append(Y)

            title = 'Tcalib = {0:.2f}*Treadback + {1:.2f}'.format(m,b)
            g = gU.makeTGraph(U,V,title,'fit')
            tmg.Add(g)
            gU.drawMultiGraph(tmg,abscissaIsTime=False,xAxisLabel='Thermocouple readback (C)', yAxisLabel='Oven temp (C)')
        return
Пример #13
0
    def __init__(self, Log=True, Speedy=False):

        self.gU = graphUtils.graphUtils()
        self.gfit = gfit.gfit()
        self.rLF = readLogFile.readLogFile()
        self.cAC = cutsAndConstants.cutsAndConstants()
        self.lt = livetime.livetime()
        self.gfp = get_filepaths.get_filepaths()
        self.mTT = makeTTree.makeTTree()
        self.twod = twod.twod()

        self.psdCut = self.cAC.psdCut
        self.lowChargeCut = self.cAC.lowChargeCut

        name = 'calibWaveDump'
        if Speedy: name = 'calibSpeedy'
        self.rootFileDir = '/Users/djaffe/work/WaveDumpData/rootfiles/'
        self.logFileDir = self.rootFileDir.replace('rootfiles', 'logfiles')
        self.outFileDir = 'Output/'
        if Speedy: self.outFileDir = 'Speedy/Output/'
        self.figdir = 'Figures/' + name + '/'
        self.perrunfigdir = self.figdir + 'perRun/'

        self.logdir = 'Logfiles/' + name + '/'
        now = datetime.datetime.now()
        fmt = '%Y%m%d_%H%M%S_%f'
        self.start_time = cnow = now.strftime(fmt)

        self.outTreeDir = 'CalibTrees/'
        if Speedy: self.outTreeDir = 'speedyTrees/'
        self.outTree = self.outTreeDir + 'tree_' + cnow + '.root'

        if Log:
            lfn = self.logdir + cnow + '.log'
            sys.stdout = Logger.Logger(fn=lfn)
            print 'procWaveDump__init__ Output directed to terminal and', lfn
            print 'procWaveDump__init__ Job start time', self.start_time

        return
Пример #14
0
 def __init__(self):
     self.rfiles = [
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01134_ts1499445083.root',
             '0deg'
         ],
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01137_ts1499451494.root',
             '180deg'
         ],
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01138_ts1499458474.root',
             '90deg'
         ],
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01139_ts1499460963.root',
             '0deg'
         ]
     ]
     self.gU = graphUtils.graphUtils()
     self.figdir = 'Figures/optical20170721/'
     return
Пример #15
0
 def __init__(self):
     self.rootprefix = '/Users/djaffe/work/WaveDumpData/rootfiles/'
     self.rfiles = [
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01134_ts1499445083.root',
             '0deg'
         ],
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01137_ts1499451494.root',
             '180deg'
         ],
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01138_ts1499458474.root',
             '90deg'
         ],
         [
             '/Users/djaffe/work/WaveDumpData/rootfiles/run01139_ts1499460963.root',
             '0deg'
         ]
     ]
     self.gU = graphUtils.graphUtils()
     self.figdir = 'Figures/nine20170829/'
     self.rLF = readLogFile.readLogFile()
     return
Пример #16
0
    def moreRealistic(self):
        '''
        more realistic comparison of true and measured distributions.
        Assume double exponential for scint time dist
        
        '''
        gU = graphUtils.graphUtils()
        Objects = []
        if 0:
            f1 = std.myfunc()
            Objects.append(f1)
            f2 = std.plotTimeDist()
            Objects.append(f2)

        t1,t2 = 1., 10.
        tmax = 10.*t2
        nbins = 100
        Ntrig = 100000
        icol = 0
        TMG = {}
        for f1 in [0.05, 0.25, 0.5, 0.75, 0.95]:
            truePE, bias, ebias = [],[],[]
            icol += 1
            for meanPE in [0.01, 0.03, 0.05, 0.10, 0.50, 1.0]:
                truePar = [t1,t2,f1]
                v = []
                for i in range(Ntrig):
                    t = std.earliestTime(meanPE,t1=t1,f1=f1,t2=t2)
                    if t is not None:
                        #print i,t
                        v.append(t)

                descrip = 't1_is_'+str(int(1000*t1))+'ps_t2_is_'+str(int(1000*t2))+'ps_f1_is_'+str(int(100*f1))+'percent_meanPE_is_'+str(int(1000*meanPE))+'mille_'+str(Ntrig)+'trigs'
                name = 'Meas_time_dist_'+descrip
                h = gU.makeTH1D(v,name.replace('_',' '),name,xmi=0.,xma=tmax,nx=nbins)
                Objects.append(h)


                name = 'True_time_dist_'+descrip
                f3 = std.plotTimeDist(name=name,t1=t1,t2=t2,f1=f1,norm=float(len(v)),tmax=tmax,nx=nbins)
                Objects.append(f3)

                name = 'Fitted_time_dist_'+descrip
                f4 = std.plotTimeDist(name=name,t1=t1,t2=t2,f1=f1,norm=float(len(v)),tmax=tmax,nx=nbins)
                gROOT.ProcessLine("gROOT->SetBatch()")  # no popup
                h.Fit(f4,"LQ")
                Objects.append(f4)
                #fitpar = []
                b,eb = [],[]
                for i in range(3):
                    #fitpar.append( f4.GetParameter(i) )
                    b.append(f4.GetParameter(i)-truePar[i])
                    eb.append(f4.GetParError(i))

                #print '%',f4.GetName(),fitpar
                truePE.append(meanPE)
                bias.append( b )
                ebias.append( eb )

                if 0:
                    KS = h.KolmogorovTest(f3.GetHistogram())
                    print 'KS',KS,descrip

            x,ex = truePE,[0. for g in range(len(truePE))]
            descrip = 't1_is_'+str(int(1000*t1))+'ps_t2_is_'+str(int(1000*t2))+'ps_f1_is_'+str(int(100*f1))+'percent_'+str(Ntrig)+'trigs'

            for i in range(len(truePar)):
                yname = f4.GetParName(i)
                y,ey = [],[]
                for b,eb in zip(bias,ebias):
                    y.append(b[i])
                    ey.append(eb[i])
                tmgname = yname + 'Bias_vs_muTrue'
                if tmgname not in TMG:
                    print 'tmgname',tmgname
                    TMG[tmgname] = gU.makeTMultiGraph(tmgname)
                name = tmgname+'_'+descrip
                g = gU.makeTGraph(x,y,name.replace('_',' '),name,ex=ex,ey=ey)
                gU.color(g,icol,icol,setMarkerColor=True)
                Objects.append(g)
                TMG[tmgname].Add(g)

        writeROOTFile = True
        if writeROOTFile:
            ofn = 'timedist.root'
            outfile = TFile(ofn,"RECREATE")
            for h in Objects:
                print "%",h.GetName()
                outfile.WriteTObject(h)
            for h in TMG:
                print "%Multigraph",TMG[h].GetName()
                outfile.WriteTObject(TMG[h])
            outfile.Close()
            print "%Wrote",len(Objects)+len(TMG),"objects to",ofn
        else:
            print '%NO ROOT FILE WRITTEN'

        # draw fitted distributions
        for h in Objects:
            if 'Meas' in h.GetName():
                gU.drawFit(h,SetLogy=True, figdir='Figures/')

        # mysteriously crashes when exitting after drawing multigraphs
        drawMG = False
        if drawMG: 
            for h in TMG:
                gU.drawMultiGraph(TMG[h], abscissaIsTime=False , figdir='Figures/')
                gU.drawMultiGraph(TMG[h], abscissaIsTime=False, SetLogx=True, figdir='Figures/')
        else:
            print "%NO MULTIGRAPHS DRAWN"

                
        return
Пример #17
0
    def simple(self,Ntries=10):
        '''
        study bias in lifetime and mean PE estimator for single exponential
        run Ntries toy experiments for each combination of #of triggers(Nexpts) and meanPE
        20151030
        '''
        gU = graphUtils.graphUtils()

        makeTable = True
        Graphs = {}
        Hists  = {}
        icol = 0
        name = 'tauMeas_vs_muTrue'
        tmg1 = Graphs[name] = gU.makeTMultiGraph(name)
        name = 'tauMeas_vs_muMeas'
        tmg2 = Graphs[name] = gU.makeTMultiGraph(name)
        name = 'muMeas_vs_muTrue'
        tmg3 = Graphs[name] = gU.makeTMultiGraph(name)
        name = 'tauBias_vs_muTrue'
        tmg4 = Graphs[name] = gU.makeTMultiGraph(name)
        name = 'muBias_vs_muTrue'
        tmg5 = Graphs[name] = gU.makeTMultiGraph(name)
        decayTime = 1.
        #Ntries = 100
        if makeTable: print 'Ntrig & True mean & bias(mean) & bias(time) \\\\ '
        for Nexpts in [ 10000, 50000, 100000, 500000]:
            tauMeas,muMeas,muTrue = [],[],[]
            dtM, dmM, dmT = [],[],[]
            tauB, muB, dtauB, dmuB,goodPE = [],[],[],[],[]
            if makeTable: print ' \\hline '
            for meanPE in [0.001, 0.01, 0.02, 0.03, 0.05, 0.1, 0.3, 1.]:
                tBias,muBias,tBias2,muBias2 = [],[],[],[]
                for tries in range(Ntries):
                    ave,Nevt,sgm = std.getAve(meanPE,Nexpts=Nexpts,decayTime=decayTime)
                    if Nevt<Nexpts:
                        eff = float(Nevt)/float(Nexpts)
                        mu = -math.log(1.-eff)
                        dmu = 0.
                        if eff<1.: dmu = math.sqrt(eff/Nexpts/(1.-eff))
                        #print Nexpts, meanPE,'mu',mu,dmu,'tau',ave,sgm

                        tauMeas.append(ave)
                        dtM.append(sgm)
                        muMeas.append(mu)
                        dmM.append(dmu)
                        muTrue.append(meanPE)
                        dmT.append(0.)
                        tBias.append(ave-decayTime)
                        tBias2.append(math.pow(ave-decayTime,2))
                        muBias.append(mu-meanPE)
                        muBias2.append(math.pow(mu-meanPE,2))
                name = 'tauBias_meanPE_'+str(int(meanPE*1000))+'mille_'+str(Nexpts)+'trigs'
                Hists[name] = gU.makeTH1D(tBias,name.replace('_',' '),name,nx=Ntries)
                name = 'muBias_meanPE_'+str(int(meanPE*1000))+'mille_'+str(Nexpts)+'trigs'
                Hists[name] = gU.makeTH1D(muBias,name.replace('_',' '),name,nx=Ntries)
                NN = float(len(tBias))
                if NN>1.:
                    tB = sum(tBias)/NN
                    stB= sum(tBias2)/NN
                    stB= math.sqrt(NN/(NN-1.)*(stB-tB*tB))/NN
                    NN = float(len(muBias))
                    mB = sum(muBias)/NN
                    smB= sum(muBias2)/NN
                    smB= math.sqrt(NN/(NN-1.)*(smB-mB*mB))/NN
                    if makeTable:
                        print '{0:d} & {1:.4f} & {2:.4f} $\\pm$ {3:.4f} & {4:.4f} $\\pm$ {5:.4f} \\\\'.format(Nexpts,meanPE,mB,smB,tB,stB)
                    else:                
                        print 'Nexpts {0:d} meanPE {1:.4f} bias(meanPE) {2:.4f}+-{3:.4f} bias(tau) {4:.4f}+-{5:.4f}'.format(Nexpts,meanPE,mB,smB,tB,stB)
                    tauB.append(tB)
                    dtauB.append(stB)
                    muB.append(mB)
                    dmuB.append(smB)
                    goodPE.append(meanPE)


            icol += 1

            x,ex = goodPE,[0. for q in range(len(goodPE))]
            y,ey = tauB,dtauB
            name = 'tauBias_vs_muTrue_'+str(Nexpts)+'trigs'
            g = Graphs[name] = gU.makeTGraph(x,y,name.replace('_',' '),name,ex=ex,ey=ey)
            gU.color(g,icol,icol,setMarkerColor=True)
            tmg4.Add(g)

            y,ey = muB,dmuB
            name = 'muBias_vs_muTrue_'+str(Nexpts)+'trigs'
            g = Graphs[name] = gU.makeTGraph(x,y,name.replace('_',' '),name,ex=ex,ey=ey)
            gU.color(g,icol,icol,setMarkerColor=True)
            tmg5.Add(g)

            x,ex = muTrue,dmT
            y,ey = tauMeas,dtM
            name = 'tauMeas_vs_muTrue_'+str(Nexpts)+'trigs'
            title = name.replace('_',' ')
            g = Graphs[name] = gU.makeTGraph(x,y,title,name,ex=ex,ey=ey)
            gU.color(g,icol,icol,setMarkerColor=True)
            tmg1.Add(g)

            x,ex = muMeas,dmM
            y,ex = tauMeas,dtM
            name = 'tauMeas_vs_muMeas_'+str(Nexpts)+'trigs'
            title = name.replace('_',' ')
            g = Graphs[name] = gU.makeTGraph(x,y,title,name,ex=ex,ey=ey)
            gU.color(g,icol,icol,setMarkerColor=True)
            tmg2.Add(g)

            x,ex = muTrue,dmT
            y,ey = muMeas,dmM
            name = 'muMeas_vs_muTrue_'+str(Nexpts)+'trigs'
            title = name.replace('_',' ')
            g = Graphs[name] = gU.makeTGraph(x,y,title,name,ex=ex,ey=ey)
            gU.color(g,icol,icol,setMarkerColor=True)
            tmg3.Add(g)

        ofn = "std.root"
        outfile = TFile(ofn,"RECREATE")
        for g in Graphs: outfile.WriteTObject( Graphs[g] )
        for h in Hists:  outfile.WriteTObject( Hists[h] )
        outfile.Close()
        print "%Wrote",len(Graphs),"graphs and",len(Hists),"hists to",ofn

        for tmg in [tmg1,tmg2,tmg3,tmg4,tmg5]:
            gU.drawMultiGraph(tmg, SetLogx=True, abscissaIsTime = False, drawLines=False)
        gU.drawMultiGraph(tmg3, SetLogx=True, SetLogy=True, abscissaIsTime = False, drawLines=False)

        return
Пример #18
0
with open(fn,'r') as csvfile:
    for l in csv.reader(csvfile):
        if len(headers)==0:
            headers = l
            for h in headers: data[h] = []
        else:
            for h,x in zip(headers,l):
                data[h].append(float(x))
                ymin = min(ymin,float(x))
                if h=='Wavelength':
                    wavelength.append(float(x))
                    

ymin = 1.001*ymin # no zeros
                    
gU = graphUtils.graphUtils()
ph = photons.photons()
pmp = ProcessMaterialProperty.ProcessMaterialProperty()

tmg = TMultiGraph()
tmg.SetName('tmg')
tmg.SetTitle('#splitline{Absorbance in 10cm cell}{Adjusted to be non-zero}')
amg = TMultiGraph()
amg.SetName('amg')
amg.SetTitle('Attenuation length (cm)')
bmg = TMultiGraph()
bmg.SetName('bmg')
bmg.SetTitle('#splitline{Effective effy for}{100cm path length}')
cmg = TMultiGraph()
cmg.SetName('cmg')
cmg.SetTitle('Attenuation in 100cm')
Пример #19
0
    def __init__(self, fn=None, Speedy=False):
        if fn is None: sys.exit('procWaveDump__init__ ERROR No input filename')

        # create prefix for log file for this job
        bn = os.path.basename(fn)
        runnumber = int((bn.split('_')[0]).replace('run', ''))
        lfprefix = bn.replace('.root', '')

        # input, output directories
        self.rootFileDir = '/Users/djaffe/work/WaveDumpData/rootfiles/'
        self.logFileDir = self.rootFileDir.replace('rootfiles', 'logfiles')
        self.outFileDir = 'Output/'
        if Speedy: self.outFileDir = 'Speedy/Output/'

        # graphing using root
        self.gU = graphUtils.graphUtils()

        # manipulation of root tree contents
        self.eventDict = {}
        self.tree = None
        self.entries = None
        self.miniTree = None
        self.miniOrder = None
        self.miniOrderIndices = None
        self.usemOI = False
        self.miniFake = None

        # initialize cuts, constraints
        # 20170417 add run number dependence to constants
        self.cAC = cutsAndConstants.cutsAndConstants(runnumber=runnumber)

        self.Po215halflife = self.cAC.Po215halflife
        self.Po215lifetime = self.cAC.Po215lifetime
        self.tOffset = self.cAC.tOffset

        self.Qmax = self.cAC.Qmax
        self.psdCut = self.cAC.psdCut
        self.lifeRange = self.cAC.lifeRange
        self.lowChargeCut = self.cAC.lowChargeCut
        self.promptChargeCut = self.cAC.promptChargeCut
        self.delayChargeCut = self.cAC.delayChargeCut
        self.maxTimeWindow = self.cAC.maxTimeWindow

        # defined for each file
        self.runTime = None

        # dict of all histograms
        self.hists = {}

        #output directories, job start time, start logging to file and terminal
        name = 'procWaveDump'
        if Speedy: name = 'Speedy'
        self.figdir = 'Figures/' + name + '/'
        self.logdir = 'Logfiles/' + name + '/'
        now = datetime.datetime.now()
        fmt = '%Y%m%d_%H%M%S_%f'
        self.start_time = cnow = now.strftime(fmt)

        lfn = self.logdir + lfprefix + '_' + cnow + '.log'
        sys.stdout = Logger.Logger(fn=lfn)
        print 'procWaveDump__init__ Output directed to terminal and', lfn
        print 'procWaveDump__init__ Job start time', self.start_time

        makeSubDir = False
        if makeSubDir:
            self.figdir = self.figdir + cnow + '/'
            if os.path.isdir(self.figdir):
                pass
            else:
                try:
                    os.makedirs(self.figdir)
                except IOError, e:
                    print name + '__init__', e
                else:
                    print name + '__init__ created', self.figdir