Esempio n. 1
0
    def __init__(self, param=False, level=1, label="", **kargs):

        """
		DTOF Algorithm
		"""
        # self.m.log(1, 'Constructor()')

        ### GENERAL STUFF
        self.name = "DTOF"

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        ### PARAMETERS

        self.debug = self.ints["Debug"]  # used to stop program at key break points
        self.SCINT = self.strings["SCINTILLATOR"]
        self.INTER = self.strings["INTER"]  # cher or scint
        self.NINDEX = self.strings["NINDEX"]  # FIX or VAR refraction index

        self.profileROOT = self.strings["VELHIST"]  # ROOT file with vel hists
        if self.profileROOT != "None":
            rootFile = ROOT.TFile.Open(self.profileROOT, "read")
            rootFile.PhVelTime.Rebin2D(40, 40)
            self.profileVel = rootFile.PhVelTime.ProfileX()
            # Needed to avoid   'PyROOT_NoneType' object error
            self.profileVel.SetDirectory(0)
        else:
            self.profileVel = False
        self.vel = photonVelocity(self.profileVel, self.SCINT, self.NINDEX, self.INTER)

        if self.debug == 1:
            wait()
Esempio n. 2
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
        """

        self.name = 'BGMixer'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        try:
            self.odstname = self.strings["OUTPUT_DST_NAME"]

        except KeyError:
            self.odstname = "MixedBG.root"

        try:
            self.idstname1 = self.strings["INTPUT_DST_NAME_1"]

        except KeyError:
            self.m.fatalError("No input file defined!")

        try:
            self.idstname2 = self.strings["INTPUT_DST_NAME_2"]

        except KeyError:
            self.m.fatalError("No input file defined!")
Esempio n. 3
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
		Event Characterizer Algorithm
		"""
        #self.m.log(1, 'Constructor()')

        ### GENERAL STUFF
        self.name = 'goodExtremesFilter'
        #self.level = level
        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        ### PARAMETERS
        # Blob Radius
        try:
            self.blobRadius = self.doubles['blobRadius']
            self.m.log(1, "Blob Radius: %.1f mm" % (self.blobRadius))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'blobRadius' not defined.")
            exit(0)

        # Maximum Distance
        try:
            self.maxDist = self.doubles['maxDist']
            self.m.log(1, "Maximum Distance: %.1f mm" % (self.maxDist))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'maxDist' not defined.")
            exit(0)

# Flag to cut on segment fraction.
        try:
            self.par_sfrac_cut = self.ints['sfrac_cut']
            self.sfrac_cut = False
            if (self.par_sfrac_cut == 1):
                self.sfrac_cut = True
                self.m.log(
                    1, "Cut on segment fraction = {0}".format(self.sfrac_cut))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'sfrac_cut' not defined.")
            exit(0)

# Number of segments in numerator of segment fraction.
        try:
            self.sfrac_num = self.ints['sfrac_num']
            self.m.log(
                1, "Segments in numerator of segment fraction = {0}".format(
                    self.sfrac_num))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'sfrac_num' not defined.")
            exit(0)

# Minimum value of segment fraction to pass cut.
        try:
            self.sfrac_val = self.doubles['sfrac_val']
            self.m.log(
                1,
                "Minimum value of segment fraction to pass cut = {0}".format(
                    self.sfrac_val))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'sfrac_val' not defined.")
            exit(0)
Esempio n. 4
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		DTOF Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'NPhotons'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
		
		
		self.debug = self.ints["Debug"]  #used to stop program at key break points

		self.SCINT = self.strings["SCINTILLATOR"]

		#load coordinates of box and fiducial box

		if self.SCINT == "LXE":
			self.scint = LXe() #lxe properties
		elif self.SCINT == "LYSO":
			self.scint = LYSO()
		else:
			print "scintillator not yet implemented"
			sys.exit()

		if self.debug == 1:
			wait()
Esempio n. 5
0
    def __init__(self, param=False, level=1, label="", **kargs):

        """
        """

        self.name = "BGMixer"

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        try:
            self.odstname = self.strings["OUTPUT_DST_NAME"]

        except KeyError:
            self.odstname = "MixedBG.root"

        try:
            self.idstname1 = self.strings["INTPUT_DST_NAME_1"]

        except KeyError:
            self.m.fatalError("No input file defined!")

        try:
            self.idstname2 = self.strings["INTPUT_DST_NAME_2"]

        except KeyError:
            self.m.fatalError("No input file defined!")
Esempio n. 6
0
    def __init__(self,param=False,level = 1,label="",**kargs):
        """
            Initialize members and take input arguments
        """

        self.name = 'PTracksAna'
        AAlgo.__init__(self,param,level,self.name,0,label,kargs)
Esempio n. 7
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
		Sensors Algorithm
		"""
        #self.m.log(1, 'Constructor()')

        ### GENERAL STUFF
        self.name = 'Sensors'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        ### PARAMETERS
        self.debug = self.ints[
            "Debug"]  #used to stop program at key break points

        self.box1ID = self.vints["Box1Id"]  #ids of SiPMs in box1
        self.box2ID = self.vints["Box2Id"]

        #DataFrame
        self.csv = self.strings["CSVSensors"]
        self.csvFile = open(self.csv, 'w')
        dataEvt = 'sensorID,x,y,z,box\n'
        self.csvFile.write(dataEvt)

        if self.debug == 1:
            wait()
Esempio n. 8
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		CEvent Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'CEvent'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
    # Box coordinates

  		#print self.vdoubles
  		self.debug = self.ints["Debug"]
  		boxCoord1 =self.loadCoord("Box1V")
  		boxCoord2 =self.loadCoord("Box2V")

		self.box1 = Box(boxCoord1)
		self.box2 = Box(boxCoord2)
		
		self.m.log(2, "Box1 --", self.box1)
		self.m.log(2, "Box2 ---", self.box2)

		self.lxe = LXe() #lxe properties
		print self.lxe

		if self.debug == 1:
			wait()
Esempio n. 9
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
        """

        self.name = 'MCWaveform'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)
Esempio n. 10
0
    def __init__(self,param=False,level = 1,label="",**kargs):

        """
        """
        
        self.name='MCWaveform'
        
        AAlgo.__init__(self,param,level,self.name,0,label,kargs)
Esempio n. 11
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
		AFiducial  Algorithm
		"""

        self.name = 'AFiducial'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)
Esempio n. 12
0
  def __init__(self, param=False, level=1, label="", **kargs):

    """
    Energy Smearing Algorithm
    """
    #self.m.log(1, 'Constructor()')

    ### GENERAL STUFF
    self.name = 'MCHitSmearing'
    #self.level = level
    AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
    # MC hit z-sparsing
    try:
      self.sparse_width = self.ints['sparse_width']
      self.m.log(1, "z-sparsing is {0}".format(self.sparse_width))
    except KeyError:
      self.m.log(1, "WARNING!! Parameter: 'sparse_width' not defined.")
      exit(0)
    
    # MC hit x-y smearing
    try:
      self.xy_smearing = self.doubles['xy_smearing']
      self.m.log(1, "xy-smearing is {0} mm".format(self.xy_smearing))
    except KeyError:
      self.m.log(1, "WARNING!! Parameter: 'xy_smearing' not defined.")
      exit(0)
      
    # Flag to plot tracks.
    try:
        self.par_plt_tracks = self.ints['plt_tracks']
        self.plt_tracks = False
        if(self.par_plt_tracks == 1):
            self.plt_tracks = True
        self.m.log(1, "Plot tracks = {0}".format(self.plt_tracks))
    except KeyError:
        self.m.log(1, "WARNING!! Parameter: 'plt_tracks' not defined.")
        exit(0)
    
    # Plot base output directory.
    try:
        self.plt_base = self.strings['plt_base']
        self.m.log(1, "Plot base dir = {0}".format(self.plt_base))
    except KeyError:
        self.m.log(1, "WARNING!! Parameter: 'plt_base' not defined.")
        exit(0)
        
    # Plot output format.
    try:
        self.out_fmt = self.strings['out_fmt']
        self.m.log(1, "Plot output format = {0}".format(self.out_fmt))
    except KeyError:
        self.m.log(1, "WARNING!! Parameter: 'out_fmt' not defined.")
        exit(0)

    # Misc. options
    self.grdcol = 0.98
Esempio n. 13
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
    Energy Smearing Algorithm
    """
        #self.m.log(1, 'Constructor()')

        ### GENERAL STUFF
        self.name = 'MCHitSmearing'
        #self.level = level
        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        ### PARAMETERS
        # MC hit z-sparsing
        try:
            self.sparse_width = self.ints['sparse_width']
            self.m.log(1, "z-sparsing is {0}".format(self.sparse_width))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'sparse_width' not defined.")
            exit(0)

        # MC hit x-y smearing
        try:
            self.xy_smearing = self.doubles['xy_smearing']
            self.m.log(1, "xy-smearing is {0} mm".format(self.xy_smearing))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'xy_smearing' not defined.")
            exit(0)

        # Flag to plot tracks.
        try:
            self.par_plt_tracks = self.ints['plt_tracks']
            self.plt_tracks = False
            if (self.par_plt_tracks == 1):
                self.plt_tracks = True
            self.m.log(1, "Plot tracks = {0}".format(self.plt_tracks))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'plt_tracks' not defined.")
            exit(0)

        # Plot base output directory.
        try:
            self.plt_base = self.strings['plt_base']
            self.m.log(1, "Plot base dir = {0}".format(self.plt_base))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'plt_base' not defined.")
            exit(0)

        # Plot output format.
        try:
            self.out_fmt = self.strings['out_fmt']
            self.m.log(1, "Plot output format = {0}".format(self.out_fmt))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'out_fmt' not defined.")
            exit(0)

        # Misc. options
        self.grdcol = 0.98
Esempio n. 14
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		AFiducial  Algorithm
		"""
		
		self.name = 'AFiducial'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)
Esempio n. 15
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		CRT Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'CRT'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
    # Box coordinates

  		#print self.vdoubles
  		self.debug = self.ints["Debug"]
  		boxCoord1 =self.loadCoord("Box1V")
  		boxCoord2 =self.loadCoord("Box2V")
  		fboxCoord1 =self.loadCoord("FBox1V")
  		fboxCoord2 =self.loadCoord("FBox2V")
  		self.QE = self.doubles["QE"]  #quantum efficiency
  		self.SPTR = self.doubles["SPTR"]*ps  #single photon time resolution
  		self.ASIC= self.doubles["ASIC"]*ps  #ASIC contribution
  		 
  		self.NPE = self.ints["NPE"]   #number of pe for time average
  		self.NSIPM = self.ints["NSIPM"]   #number of SiPMs per box

  		#time jitter of SiPM + ASIC
  		self.TJ = sqrt(self.SPTR**2+self.ASIC**2)

  		self.box1ID=self.vints["Box1Id"]
  		self.box2ID=self.vints["Box2Id"] 

		self.box1 = Box(boxCoord1)
		self.box2 = Box(boxCoord2)
		self.fbox1 = Box(fboxCoord1)
		self.fbox2 = Box(fboxCoord2)
		
		self.m.log(1, "Box1 --", self.box1)
		self.m.log(1, "Box2 ---", self.box2)

		self.m.log(1, "Fiducial Box1 --", self.box1)
		self.m.log(1, "Fiducial Box2 ---", self.box2)
		self.m.log(1, "IDs Box1 --", self.box1ID)
		self.m.log(1, "IDs Box2 --", self.box2ID)

		self.m.log(1, "QE = %7.2f Time Jitter =%7.2f ps  --"%(self.QE, self.TJ/ps))

		self.lxe = LXe() #lxe properties
		print self.lxe

		if self.debug == 1:
			wait()
Esempio n. 16
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		ATimeMap Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'ATimeMap'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
		
		self.debug = self.ints["Debug"]  #used to stop program at key break points

  		self.SCINT = self.strings["SCINTILLATOR"]
  		self.BIN = self.doubles["BIN"] #time bin in the simulation in ps
  		self.QE = self.doubles["QE"]  #quantum efficiency
  		self.DTMAX = self.doubles["DTMAX"]*ps  #max diff wrt first pes
  		self.SPTR = self.doubles["SPTR"]*ps  #single photon time resolution
  		self.ASIC= self.doubles["ASIC"]*ps  #ASIC contribution
  		self.INTER = self.strings["INTER"]
  		self.NINDEX = self.strings["NINDEX"] # FIX or VAR refraction index
 	
  		self.NSIPM = self.ints["NSIPM"]   #number of SiPMs per box

  		#time jitter of SiPM + ASIC
  		self.TJ = sqrt(self.SPTR**2+self.ASIC**2)
  		self.box1ID=self.vints["Box1Id"]  #ids of SiPMs in box1
  		self.box2ID=self.vints["Box2Id"] 

  		self.HBOX = self.ints["HBOX"] # if 1 only box1 histos if 2 box1 and 2 if 0 no box histos
		self.m.log(1, "IDs Box1 --", self.box1ID)
		self.m.log(1, "IDs Box2 --", self.box2ID)
		self.m.log(1, "Scintillator --", self.SCINT)

		self.m.log(1, "QE = %7.2f Time Jitter =%7.2f ps  --"%(self.QE, self.TJ/ps))


                self.profileROOT = self.strings["VELHIST"] # ROOT file with vel hists
                if self.profileROOT != 'None':
                    rootFile = ROOT.TFile.Open(self.profileROOT, "read")
                    rootFile.PhVelTime.Rebin2D(40,40)
                    self.profileVel = rootFile.PhVelTime.ProfileX()
                    # Needed to avoid   'PyROOT_NoneType' object error
                    self.profileVel.SetDirectory(0)
                else:
                    self.profileVel = False
                self.vel = photonVelocity(self.profileVel, self.SCINT, self.NINDEX, self.INTER)

		if self.debug == 1:
			wait()
Esempio n. 17
0
    def __init__(self,param=False,level = 1,label="",**kargs):

        """
        """
        
        self.name='WaveInspector'
        
        AAlgo.__init__(self,param,level,self.name,0,label,kargs)
        
        try: self.sType = self.strings["SENSOR_TYPE"]
        
        except KeyError: self.sType = "" 
Esempio n. 18
0
    def __init__(self,param=False,level = 1,label="",**kargs):

        """
        
        Deal here with your parameters in param and kargs.
        If param is an instace of ParamManager, parameters
        will be set as algorithm parameters by AAlgo.
            
        """
        
        self.name='algo_example'
        AAlgo.__init__(self,param,level,self.name,0,label,kargs)
Esempio n. 19
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		MultiBlobFilter Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'MultiBlobFilter'
		#self.level = level
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

		### PARAMETERS
		# Blob Radius
		try:
			self.blobRadius = self.doubles['blobRadius']
			self.m.log(1, "Blob Radius: %.1f mm" %(self.blobRadius))
		except KeyError:
			self.m.log(1, "WARNING!! Parameter: 'blobRadius' not defined.")
			exit(0)

		# ROI Minimum Energy
		try:
			self.blobMinE = self.doubles['blobMinE']
			self.m.log(1, "Minimum Blob Energy: %.3f MeV." %(self.blobMinE/MeV))
		except KeyError:
			self.m.log(1, "WARNING!! Parameter: 'blobMinE' not defined.")
			exit(0)

		# Use MC truth
		try:
			self.useTruth_param = self.ints['useTruth']
                        if(self.useTruth_param == 1):
                            self.useTruth = True
                        else:
                            self.useTruth = False
			self.m.log(1, "Use MC truth = {0}".format(self.useTruth))
		except KeyError:
			self.m.log(1, "WARNING!! Parameter: 'useTruth' not defined.")
			exit(0)

                # Which track ordering method to use (only appicable if not using MC truth)
                # 0: Paolina
                # 1: momentum-based
                # 2: MST
                try:
                        self.trk_omethod = self.ints['trk_omethod']
                        self.m.log(1, "Track ordering method = {0}".format(self.trk_omethod))
                except KeyError:
                        self.m.log(1, "WARNING!! Parameter: 'trk_omethod' not defined.")
                        exit(0)
Esempio n. 20
0
	def __init__(self, param=False, level=1, label="", **kargs):

		
		self.name = 'Waveform'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
		
		self.debug = self.ints["Debug"]  #used to stop program at key break points
		self.TBIN = self.ints["TBIN"] #time bin (100 ns in NEW )

		if self.debug == 1:
			wait()
Esempio n. 21
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		DTOFAVG Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'DTOFAVG'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
		
		
		self.debug = self.ints["Debug"]  #used to stop program at key break points
		self.SCINT = self.strings["SCINTILLATOR"]
		self.INTER = self.strings["INTER"] # cher or scint
  		self.NINDEX = self.strings["NINDEX"] # FIX or VAR refraction index

		self.npe = self.ints["NPE"]  #number of pe to avg
		self.dts = self.vints["DTs"]  # time windows to avg

		self.xres = self.doubles["XRES"]  #X resolution
		self.yres = self.doubles["YRES"]  #X resolution
		self.zres = self.doubles["ZRES"]  #X resolution


		#load coordinates of box and fiducial box

		if self.SCINT == "LXE":
			self.scint = LXe() #lxe properties
			if self.NINDEX == "VAR":
				if self.INTER ==  "CHER":
					self.vel = 0.14/ps
				else:
					self.vel = 0.0886/ps
			else:
				self.vel = c_light/self.scint.RefractionIndex()
		elif self.SCINT == "LYSO":
			self.scint = LYSO()
                        self.vel = c_light/self.scint.RefractionIndex()
		else:
			print "scintillator not yet implemented"
			sys.exit()

		print self.scint

		if self.debug == 1:
			wait()
Esempio n. 22
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
        
        """

        self.name = 'SignalsAna'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        try:
            self.sType = self.strings["SENSOR_TYPE"]

        except KeyError:
            self.sType = "gate.PMT"
Esempio n. 23
0
    def __init__(self,param=False,level = 1,label="",**kargs):

        """
        
        Deal here with your parameters in param and kargs.
        If param is an instace of ParamManager, parameters
        will be set as algorithm parameters by AAlgo.
            
        """
        
        # Branches variables must be declared as attributes of the class    
        self.name='algo_example'
        self.evtID = array('i',[0]) # Variables must be unidimensional arrays
        self.plane0 = array('f',10*[ 0. ]) # Arrays are arrays

        AAlgo.__init__(self,param,level,self.name,0,label,kargs)
Esempio n. 24
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		CEvent Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'CEvent'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
    # Box coordinates

  		#print self.vdoubles
  		self.debug = self.ints["Debug"]

		if self.debug == 1:
			wait()
Esempio n. 25
0
    def __init__(self,param=False,level = 1,label="",**kargs):

        """
        
        Deal here with your parameters in param and kargs.
        If param is an instace of ParamManager, parameters
        will be set as algorithm parameters by AAlgo.
            
        """
        
            
        self.name='MyPyPetExample'
        
        AAlgo.__init__(self,param,level,self.name,0,label,kargs)

        # deal with input parameters 
        
        try: self.mypar = self.ints["MyIntPar"]

        except KeyError: self.mypar = 0
Esempio n. 26
0
    def __init__(self,param=False,level = 1,label="",**kargs):

        """
        """
        
        self.name='WaveInspector'
        
        AAlgo.__init__(self,param,level,self.name,0,label,kargs)
        
        try: self.sType = self.strings["SENSOR_TYPE"]
        
        except KeyError: self.sType = "" 

        try: self.drawEach = self.ints["DRAW_EACH"]
        
        except KeyError: self.drawEach = False 
        
        try: self.trueHit = self.ints["TRUE_HIT"]
        
        except KeyError: self.trueHit = True 
Esempio n. 27
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
		TimeMapWL  Algorithm
		"""

        self.name = 'TimeMapWL'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        self.QE = self.doubles["QE"]  #quantum efficiency
        self.SPTR = self.doubles["SPTR"] * ps  #single photon time resolution
        self.ASIC = self.doubles["ASIC"] * ps  #ASIC contribution

        self.minWL = self.doubles["minWL"]  #Min wavelength
        self.maxWL = self.doubles["maxWL"]  #Max wavelength

        self.csv = self.strings["CSV"]
        self.csvFile = open(self.csv, 'w')
        dataEvt = 'evtID,vtx1X,vtx1Y,vtx1Z,vtx1T,vtx2X,vtx2Y,vtx2Z,vtx2T\n'
        self.csvFile.write(dataEvt)
Esempio n. 28
0
    def __init__(self, param=False, level=1, label="", **kargs):
        """
		DTOFWL Algorithm
		"""
        #self.m.log(1, 'Constructor()')

        ### GENERAL STUFF
        self.name = 'DTOFWL'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        ### PARAMETERS

        self.VEL = self.doubles[
            "VEL"]  #used to stop program at key break points

        self.debug = self.ints[
            "Debug"]  #used to stop program at key break points
        self.SCINT = self.strings["SCINTILLATOR"]
        self.INTER = self.strings["INTER"]  # cher or scint
        self.NINDEX = self.strings["NINDEX"]  # FIX or VAR refraction index

        self.csv = self.strings["CSV"]
        self.csvFile = open(self.csv, 'w')
        dataEvt = 'dt,dtg,dbox1,dbox2,wl1,wl2\n'
        self.csvFile.write(dataEvt)

        self.profileROOT = self.strings["VELHIST"]  # ROOT file with vel hists
        if self.profileROOT != 'None':
            rootFile = ROOT.TFile.Open(self.profileROOT, "read")
            rootFile.PhVelTime.Rebin2D(40, 40)
            self.profileVel = rootFile.PhVelTime.ProfileX()
            # Needed to avoid   'PyROOT_NoneType' object error
            self.profileVel.SetDirectory(0)
        else:
            self.profileVel = False
        #self.vel = photonVelocity(self.profileVel, self.SCINT, self.NINDEX, self.INTER)
        self.vel = self.VEL

        if self.debug == 1:
            wait()
Esempio n. 29
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		DCR Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'DCR'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
		
		self.debug = self.ints["Debug"]  #used to stop program at key break points

  		self.DCR = self.doubles["DCR"]  #Dark Count Rate in kHz

                self.waveforms = {} # Map {sensorID : waveform}, where waveform is a list [(bin,charge)]
 	
		if self.debug == 1:
			wait()
Esempio n. 30
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		CRT Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'CRT'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
		
		#self.FTREES = self.strings["FTREES"]
		self.debug = self.ints["Debug"]  #used to stop program at key break points

		#load coordinates of box and fiducial box

		boxCoord1 =self.loadCoord("Box1V")
  		boxCoord2 =self.loadCoord("Box2V")
  		fboxCoord1 =self.loadCoord("FBox1V")
  		fboxCoord2 =self.loadCoord("FBox2V")

  		self.SCINT = self.strings["SCINTILLATOR"]

  		self.QE = self.doubles["QE"]  #quantum efficiency
  		self.DTMAX = self.doubles["DTMAX"]*ps  #max diff wrt first pes
  		self.SPTR = self.doubles["SPTR"]*ps  #single photon time resolution
  		self.ASIC= self.doubles["ASIC"]*ps  #ASIC contribution
  		 
  		self.NPE = self.ints["NPE"]   #number of pe for time average
  		self.NSIPM = self.ints["NSIPM"]   #number of SiPMs per box

  		#time jitter of SiPM + ASIC
  		self.TJ = sqrt(self.SPTR**2+self.ASIC**2)

  		self.box1ID=self.vints["Box1Id"]  #ids of SiPMs in box1
  		self.box2ID=self.vints["Box2Id"] 

		self.box1 = Box(boxCoord1)
		self.box2 = Box(boxCoord2)
		self.fbox1 = Box(fboxCoord1)
		self.fbox2 = Box(fboxCoord2)
		
		self.m.log(1, "Box1 --", self.box1)
		self.m.log(1, "Box2 ---", self.box2)

		self.m.log(1, "Fiducial Box1 --", self.box1)
		self.m.log(1, "Fiducial Box2 ---", self.box2)
		self.m.log(1, "IDs Box1 --", self.box1ID)
		self.m.log(1, "IDs Box2 --", self.box2ID)
		self.m.log(1, "MATERIAL --", self.MATERIAL)

		self.m.log(1, "QE = %7.2f Time Jitter =%7.2f ps  --"%(self.QE, self.TJ/ps))

		if self.SCINT == "LXE"
			self.scint = LXe() #lxe properties
		elif self.SCINT == "LYSO"
			self.scint = LYSO()
		else:
			print "scintillator not yet implemented"
			sys.exit()

		print self.scint

		
		if self.debug == 1:
			wait()
Esempio n. 31
0
	def __init__(self, param=False, level=1, label="", **kargs):

		"""
		CRT Algorithm
		"""
		#self.m.log(1, 'Constructor()')

		### GENERAL STUFF
		self.name = 'CRT'
		
		AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

    ### PARAMETERS
    # Box coordinates

  		#print self.vdoubles
  		self.debug = self.ints["Debug"]
  		boxCoord1 =self.loadCoord("Box1V")
  		boxCoord2 =self.loadCoord("Box2V")
  		fboxCoord1 =self.loadCoord("FBox1V")
  		fboxCoord2 =self.loadCoord("FBox2V")
  		self.QE = self.doubles["QE"]  #quantum efficiency
  		self.DTMAX = self.doubles["DTMAX"]*ps  #max diff wrt first pes
  		self.SPTR = self.doubles["SPTR"]*ps  #single photon time resolution
  		self.ASIC= self.doubles["ASIC"]*ps  #ASIC contribution
  		 
  		self.NPE = self.ints["NPE"]   #number of pe for time average
  		self.NSIPM = self.ints["NSIPM"]   #number of SiPMs per box

  		#time jitter of SiPM + ASIC
  		self.TJ = sqrt(self.SPTR**2+self.ASIC**2)

  		self.box1ID=self.vints["Box1Id"]
  		self.box2ID=self.vints["Box2Id"] 

		self.box1 = Box(boxCoord1)
		self.box2 = Box(boxCoord2)
		self.fbox1 = Box(fboxCoord1)
		self.fbox2 = Box(fboxCoord2)
		
		self.m.log(1, "Box1 --", self.box1)
		self.m.log(1, "Box2 ---", self.box2)

		self.m.log(1, "Fiducial Box1 --", self.box1)
		self.m.log(1, "Fiducial Box2 ---", self.box2)
		self.m.log(1, "IDs Box1 --", self.box1ID)
		self.m.log(1, "IDs Box2 --", self.box2ID)

		self.m.log(1, "QE = %7.2f Time Jitter =%7.2f ps  --"%(self.QE, self.TJ/ps))

		self.lxe = LXe() #lxe properties
		print self.lxe

		if self.debug == 1:
			wait()

		fid = array.array('f',[0.]) #0,1 or 2 gammas found in boxes

		xb1= array.array('f',[0.])   # (x,y,z) vertex in box1
		yb1= array.array('f',[0.])
		zb1= array.array('f',[0.])
		tpb1= array.array('f',[0.])  # time of particle in box1
		photSiPMb1= array.array('f',[0.])  # photons/SiPM
		pesSiPMb1= array.array('f',[0.])  # photons/SiPM
		nPhotb1= array.array('f',[0.])  # total photons in b1
		nhitsb1 = array.array('f',[0.]) #number of SiPM with signal in box1
		tFstSiPMb1 = array.array('f',[0.]) #time of first SiPM in box1
		dVtxFstSiPMb1 = array.array('f',[0.]) #distance vertex-sipm in box1 1stpe
		tVtxFstSiPMb1 = array.array('f',[0.]) #time vertex- first SiPM

		xb2= array.array('f',[0.])   # (x,y,z) vertex in box2
		yb2= array.array('f',[0.])
		zb2= array.array('f',[0.])
		tpb2= array.array('f',[0.])  # time of particle in box2
		photSiPMb2= array.array('f',[0.])
		pesSiPMb2= array.array('f',[0.])  # photons/SiPM
		nPhotb2= array.array('f',[0.])
		nhitsb2 = array.array('f',[0.])
		tFstSiPMb2 = array.array('f',[0.])
		dVtxFstSiPMb2 = array.array('f',[0.])
		tVtxFstSiPMb2 = array.array('f',[0.])

		dtFstSiPM = array.array('f',[0.]) # Dt computed with first SiPM

		tman.book('CRT',"Coincidence Resoltion Time")
		tman.addBranch('CRT','fid',fid,dim=1)
		tman.addBranch('CRT','dtFstSiPM',dtFstSiPM,dim=1)

		tman.addBranch('CRT','xb1',xb1,dim=1)
		tman.addBranch('CRT','yb1',yb1,dim=1)
		tman.addBranch('CRT','zb1',zb1,dim=1)
		tman.addBranch('CRT','tpb1',tpb1,dim=1)
		tman.addBranch('CRT','photSiPMb1',photSiPMb1,dim=1)
		tman.addBranch('CRT','pesSiPMb1',pesSiPMb1,dim=1)
		tman.addBranch('CRT','tFstSiPMb1',tFstSiPMb1,dim=1)
		tman.addBranch('CRT','dVtxFstSiPMb1',dVtxFstSiPMb1,dim=1)
		tman.addBranch('CRT','tVtxFstSiPMb1',tVtxFstSiPMb1,dim=1)
		tman.addBranch('CRT','nPhotb1',nPhotb1,dim=1)
		tman.addBranch('CRT','nhitsb1',nhitsb1,dim=1)

		tman.addBranch('CRT','xb2',xb2,dim=1)
		tman.addBranch('CRT','yb2',yb2,dim=1)
		tman.addBranch('CRT','zb2',zb2,dim=1)
		tman.addBranch('CRT','tpb2',tpb2,dim=1)
		tman.addBranch('CRT','photSiPMb2',photSiPMb2,dim=1)
		tman.addBranch('CRT','pesSiPMb2',pesSiPMb2,dim=1)
		tman.addBranch('CRT','tFstSiPMb2',tFstSiPMb2,dim=1)
		tman.addBranch('CRT','dVtxFstSiPMb2',dVtxFstSiPMb2,dim=1)
		tman.addBranch('CRT','tVtxFstSiPMb2',tVtxFstSiPMb2,dim=1)
		tman.addBranch('CRT','nPhotb2',nPhotb2,dim=1)
		tman.addBranch('CRT','nhitsb2',nhitsb2,dim=1)
Esempio n. 32
0
    def __init__(self, param=False, level=1, label="", **kargs):

        self.name = 'mst'

        AAlgo.__init__(self, param, level, self.name, 0, label, kargs)

        ### PARAMETERS
        # Minimum number of voxels in a segment.
        try:
            self.min_path_voxels = self.ints['min_path_voxels']
            self.m.log(
                1, "Minimum voxels per segment = {0}".format(
                    self.min_path_voxels))
        except KeyError:
            self.m.log(1,
                       "WARNING!! Parameter: 'min_path_voxels' not defined.")
            exit(0)

        # Number of voxels allowed in segment overlap.
        try:
            self.path_overlap_tol = self.ints['path_overlap_tol']
            self.m.log(
                1,
                "Path overlap tolerance = {0}".format(self.path_overlap_tol))
        except KeyError:
            self.m.log(1,
                       "WARNING!! Parameter: 'path_overlap_tol' not defined.")
            exit(0)

        # Flag to use MC hits.
        try:
            self.par_use_voxels = self.ints['use_voxels']
            self.use_voxels = False
            if (self.par_use_voxels == 1):
                self.use_voxels = True
            self.m.log(1, "Use voxels = {0}".format(self.use_voxels))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'use_voxels' not defined.")
            exit(0)

        # Maximum distance between neighboring MC hits
        try:
            self.nbr_dist = self.doubles['nbr_dist']
            self.m.log(
                1, "Maximum distance between neighboring MC hits = {0}".format(
                    self.nbr_dist))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'nbr_dist' not defined.")
            exit(0)

        # Flag to plot tracks.
        try:
            self.par_plt_tracks = self.ints['plt_tracks']
            self.plt_tracks = False
            if (self.par_plt_tracks == 1):
                self.plt_tracks = True
            self.m.log(1, "Plot tracks = {0}".format(self.plt_tracks))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'plt_tracks' not defined.")
            exit(0)

        # Plot base output directory.
        try:
            self.plt_base = self.strings['plt_base']
            self.m.log(1, "Plot base dir = {0}".format(self.plt_base))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'plt_base' not defined.")
            exit(0)

        # Plot output format.
        try:
            self.out_fmt = self.strings['out_fmt']
            self.m.log(1, "Plot output format = {0}".format(self.out_fmt))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'out_fmt' not defined.")
            exit(0)

        # Misc. options
        self.grdcol = 0.98
Esempio n. 33
0
File: mst.py Progetto: jerenner/BEXT
    def __init__(self,param=False,level = 1,label="",**kargs):        
            
        self.name='mst'
        
        AAlgo.__init__(self,param,level,self.name,0,label,kargs)

        ### PARAMETERS
        # Minimum number of voxels in a segment.
        try:
            self.min_path_voxels = self.ints['min_path_voxels']
            self.m.log(1, "Minimum voxels per segment = {0}".format(self.min_path_voxels))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'min_path_voxels' not defined.")
            exit(0)
            
        # Number of voxels allowed in segment overlap.
        try:
            self.path_overlap_tol = self.ints['path_overlap_tol']
            self.m.log(1, "Path overlap tolerance = {0}".format(self.path_overlap_tol))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'path_overlap_tol' not defined.")
            exit(0)
            
        # Flag to use MC hits.
        try:
            self.par_use_voxels = self.ints['use_voxels']
            self.use_voxels = False
            if(self.par_use_voxels == 1):
                self.use_voxels = True
            self.m.log(1, "Use voxels = {0}".format(self.use_voxels))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'use_voxels' not defined.")
            exit(0)
            
        # Maximum distance between neighboring MC hits
        try:
            self.nbr_dist = self.doubles['nbr_dist']
            self.m.log(1, "Maximum distance between neighboring MC hits = {0}".format(self.nbr_dist))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'nbr_dist' not defined.")
            exit(0)
            
        # Flag to plot tracks.
        try:
            self.par_plt_tracks = self.ints['plt_tracks']
            self.plt_tracks = False
            if(self.par_plt_tracks == 1):
                self.plt_tracks = True
            self.m.log(1, "Plot tracks = {0}".format(self.plt_tracks))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'plt_tracks' not defined.")
            exit(0)
        
        # Plot base output directory.
        try:
            self.plt_base = self.strings['plt_base']
            self.m.log(1, "Plot base dir = {0}".format(self.plt_base))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'plt_base' not defined.")
            exit(0)
            
        # Plot output format.
        try:
            self.out_fmt = self.strings['out_fmt']
            self.m.log(1, "Plot output format = {0}".format(self.out_fmt))
        except KeyError:
            self.m.log(1, "WARNING!! Parameter: 'out_fmt' not defined.")
            exit(0)

        # Misc. options
        self.grdcol = 0.98