/search.css" rel="stylesheet" type="text/css"/> /search.js">
00001 #!/usr/bin/env python 00002 # 00003 # Generate a random table of pmt properties 00004 # for use in the electronics simulation 00005 00006 import random 00007 00008 import makeFeeCableMap 00009 00010 def makePmtProperties(): 00011 "Return a list of PMTs and their properties" 00012 properties = [] 00013 pmtIds = makeFeeCableMap.getAllPmtIds() 00014 #print "nDetectors = ",len(pmtIds) 00015 detectors = pmtIds.keys() 00016 detectors.sort() 00017 for detector in detectors: 00018 #print "Detector",detector.detName(),"nPmts = ",len(pmtIds[detector]) 00019 for pmtId in pmtIds[detector]: 00020 properties.append( getProperties(pmtId) ) 00021 return properties 00022 00023 def getProperties(pmtId): 00024 "Generate simulation properties for this PMT" 00025 gain = -1 00026 sigmaGain = -1 00027 efficiency = -1 00028 timeSpread = -1 00029 timeOffset = -1 00030 prePulseProb = -1 00031 afterPulseProb = -1 00032 darkRate = -1 00033 00034 if pmtId.detName().find("AD") > 0 or pmtId.detName().find("WS") > 0: 00035 # Add PMT variation in AD 00036 while gain <= 0: 00037 gain = random.gauss(1, 0.06) 00038 00039 while sigmaGain <= 0: 00040 sigmaGain = random.gauss(0.30, 0.02) 00041 00042 while timeOffset <= 0: 00043 timeOffset = random.gauss(40.0, 3.0) 00044 00045 while timeSpread <= 0: 00046 timeSpread = random.gauss(2.0, 0.2) 00047 00048 while efficiency <= 0 or efficiency > 1.0: 00049 efficiency = random.gauss(0.90, 0.05) 00050 00051 while prePulseProb <= 0 or prePulseProb >=1.0: 00052 prePulseProb = random.gauss(0.004, 0.0004) 00053 00054 while afterPulseProb <= 0 or afterPulseProb >=1.0: 00055 afterPulseProb = random.gauss(0.016, 0.0016) 00056 00057 while darkRate <= 0: 00058 darkRate = random.gauss(3000., 1000.) 00059 00060 description = makeFeeCableMap.pmtDescription(pmtId) 00061 format = "%-2d %30s %-4.3f %-4.3f %-4.2f %-4.2f %-4.3f %-4.5f %-4.4f %-4.1f" 00062 line = format % (pmtId.fullPackedData(), 00063 description, 00064 gain, 00065 sigmaGain, 00066 timeOffset, 00067 timeSpread, 00068 efficiency, 00069 prePulseProb, 00070 afterPulseProb, 00071 darkRate) 00072 #print line 00073 return line 00074 else: 00075 return "" 00076 00077 def printPmtProperties(): 00078 "Print table of PMT properties" 00079 print "# Simulation input data for pmt properties" 00080 print "# PmtId description gain sigmaGain tOffset tSpread effic prePuls afterPuls darkRate" 00081 lines = makePmtProperties() 00082 for line in lines: 00083 print line 00084 00085 if __name__ == "__main__": 00086 printPmtProperties() 00087 00088