/search.css" rel="stylesheet" type="text/css"/> /search.js">
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Public Member Functions | Public Attributes
TestCoinc::ADSinglesSource Class Reference
Inheritance diagram for TestCoinc::ADSinglesSource:
Inheritance graph
[legend]
Collaboration diagram for TestCoinc::ADSinglesSource:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def makeOneEventAtTime
def getNextTrigger
def currentTime
def queuedTriggers
def nextTriggerTime
def makeNextEvent
def sortTriggers
def makeNextEventTime
def makeCalibHeader
def makeCalibStats
def makeRecHeader
def constructTrigger
def constructAdTrigger
def constructPoolTrigger
def makeEmptyTrigger
def makeEmptyAdTrigger
def makeEmptyPoolTrigger

Public Attributes

 type
 detectorId
 probabilityHighEnergy
 name
 rate_Hz
 site
 sourceTime
 triggers
 count
 detectorLatency

Detailed Description

Definition at line 471 of file TestCoinc.py.


Constructor & Destructor Documentation

def TestCoinc::ADSinglesSource::__init__ (   self,
  name,
  rate 
)

Reimplemented from TestCoinc::EventSource.

Definition at line 473 of file TestCoinc.py.

00474                                 :
00475         EventSource.__init__(self,name,rate)
00476         self.type = "ADSingles"
00477         self.detectorId = gbl.DetectorId.kAD1
00478         self.probabilityHighEnergy = 0.0001
00479         return


Member Function Documentation

def TestCoinc::ADSinglesSource::makeOneEventAtTime (   self,
  time 
)

Reimplemented from TestCoinc::EventSource.

Definition at line 480 of file TestCoinc.py.

00481                                      :
00482         "Generate one event at the specified time"
00483         inputData = self.makeEmptyAdTrigger(time, self.site, self.detectorId)
00484         # Make event-specific modifications here
00485         inputData['adSimple']['energy'] = 1.0
00486         inputData['adSimple']['rawEvis'] = 1.0
00487         inputData['adScaled']['energy'] = 1.0
00488         inputData['adScaled']['rawEvis'] = 1.0
00489         # Randomly make a high-energy singles
00490         import random
00491         if random.random() < self.probabilityHighEnergy:
00492             # Make a singles that satisfies delayed energy cut
00493             inputData['adSimple']['energy'] = 7.0
00494             inputData['adSimple']['rawEvis'] = 7.0
00495             inputData['adScaled']['energy'] = 7.0
00496             inputData['adScaled']['rawEvis'] = 7.0
00497         # Hack: Put truth info into one of the unused variables... 
00498         inputData['calibStats']['nPulseSum'] = sourceId["ADSingles"]
00499         inputData['calibStats']['nPulseRMS'] = self.count
00500         triggerData = self.constructAdTrigger(inputData)
00501         self.triggers.append(triggerData)
00502         return SUCCESS
00503 
00504 # FIXME: Muon source only generates prompt muon triggers
#        (does not make retriggers, mu-decay, mu-capture, spallation products) 
def TestCoinc::EventSource::getNextTrigger (   self) [inherited]

Definition at line 99 of file TestCoinc.py.

00100                             :
00101         "Return the next trigger from this source"
00102         if len(self.triggers)<1:
00103             print "Error: No triggers from source",self.name
00104             return None
00105         nextTrigger = self.triggers[0]
00106         self.triggers = self.triggers[1:]
00107         return nextTrigger

def TestCoinc::EventSource::currentTime (   self) [inherited]

Definition at line 108 of file TestCoinc.py.

00109                          :
00110         "Return the current source internal clock time"
00111         return self.sourceTime

def TestCoinc::EventSource::queuedTriggers (   self) [inherited]

Definition at line 112 of file TestCoinc.py.

00113                             :
00114         "Return the number of triggers in the queue for this source"
00115         return len(self.triggers)

def TestCoinc::EventSource::nextTriggerTime (   self) [inherited]

Definition at line 116 of file TestCoinc.py.

00117                              :
00118         "Return the time of the next trigger from this source"
00119         if len(self.triggers)<1:
00120             print "Warning: Requesting triggers from source, but none exist."
00121             return TimeStamp.GetEOT()
00122         return self.triggers[0]['triggerTime']

def TestCoinc::EventSource::makeNextEvent (   self) [inherited]

Definition at line 123 of file TestCoinc.py.

00124                            :
00125         "Generate the next event from this source"
00126         nextEventTime = self.makeNextEventTime()
00127         status = self.makeOneEventAtTime(nextEventTime)
00128         if status.isFailure(): return status
00129         self.sortTriggers()
00130         self.sourceTime = nextEventTime
00131         self.count += 1
00132         return SUCCESS

def TestCoinc::EventSource::sortTriggers (   self) [inherited]

Definition at line 133 of file TestCoinc.py.

00134                           :
00135         "Sort the current trigger by trigger time"
00136         if len(self.triggers)<1: return
00137         self.triggers.sort(key=lambda trigger: trigger['triggerTime'])
00138         return

def TestCoinc::EventSource::makeNextEventTime (   self) [inherited]

Definition at line 139 of file TestCoinc.py.

00140                                :
00141         "Generate the time for the next event from this source"
00142         import random
00143         deltaT_s = random.expovariate(self.rate_Hz)
00144         nextTime = TimeStamp(self.sourceTime)
00145         nextTime.Add(deltaT_s)
00146         return nextTime

def TestCoinc::EventSource::makeCalibHeader (   self,
  inputData 
) [inherited]

Definition at line 152 of file TestCoinc.py.

00153                                        :
00154         "Make a Calibrated data header given input data"
00155         calibHeader = gbl.DayaBay.CalibReadoutHeader()
00156         gbl.SetOwnership(calibHeader,False)
00157         calibHeader.setContext(inputData['context'])
00158         calibHeader.setExecNumber(inputData['execNumber'])
00159         calibHeader.setEarliest(inputData['earliest'])
00160         calibHeader.setLatest(inputData['latest'])
00161         detectorId = inputData['context'].GetDetId()
00162         calibReadout = None
00163         if detectorId == DetectorId.kRPC:
00164             calibReadout = gbl.DayaBay.CalibReadoutRpcCrate()
00165             gbl.SetOwnership(calibReadout,False)
00166         elif detectorId>=DetectorId.kAD1 and detectorId<=DetectorId.kOWS:
00167             calibReadout = gbl.DayaBay.CalibReadoutPmtCrate()
00168             gbl.SetOwnership(calibReadout,False)
00169         else:
00170             print "Error: Making calib header for an invalid detector:", detectorId
00171             return None
00172         calibReadout.setTriggerType(inputData['triggerType'])
00173         calibHeader.setCalibReadout(calibReadout)
00174         return calibHeader

def TestCoinc::EventSource::makeCalibStats (   self,
  inputData 
) [inherited]

Definition at line 175 of file TestCoinc.py.

00176                                       :
00177         "Make a CalibStats data header given input data"
00178         calibStats = gbl.DayaBay.UserDataHeader()
00179         gbl.SetOwnership(calibStats,False)
00180         calibStats.setContext(inputData['context'])
00181         calibStats.setExecNumber(inputData['execNumber'])
00182         calibStats.setEarliest(inputData['earliest'])
00183         calibStats.setLatest(inputData['latest'])
00184         for inputHdr in inputData['inputHeaders']:
00185             calibStats.addInputHeader(inputHdr)
00186         detectorId = inputData['context'].GetDetId()
00187         defaultIntVars = {'nHit':-1}
00188         defaultFloatVars = {'nPESum':-1,
00189                             'nPERMS':-1,
00190                             'nPulseSum':-1,
00191                             'nPulseRMS':-1,
00192                             'tEarliest':-1,
00193                             'tLatest':-1,
00194                             'tMean':-1,
00195                             'EarlyCharge':-1,
00196                             'NominalCharge':1,
00197                             'LateCharge':-1,
00198                             'MaxQ':0,
00199                             'Quadrant':0,
00200                             'flasher_flag':0,
00201                             'time_PSD':0,
00202                             'time_PSD1':0,
00203                             'MaxQ_2inchPMT':0,
00204                             'dtLastAD1_ms':-1,
00205                             'dtLastAD2_ms':-1,
00206                             'dtLastAD3_ms':-1,
00207                             'dtLastAD4_ms':-1,
00208                             'dtLastIWS_ms':-1,
00209                             'dtLastOWS_ms':-1,
00210                             'dtLastRPC_ms':-1,
00211                             'dtNextAD1_ms':-1,
00212                             'dtNextAD2_ms':-1,
00213                             'dtNextAD3_ms':-1,
00214                             'dtNextAD4_ms':-1,
00215                             'dtNextIWS_ms':-1,
00216                             'dtNextOWS_ms':-1,
00217                             'dtNextRPC_ms':-1
00218                             }
00219         for varName in defaultIntVars:
00220             if varName in inputData:
00221                 calibStats.setInt(varName,inputData[varName])
00222             else:
00223                 calibStats.setInt(varName,defaultIntVars[varName])
00224         for varName in defaultFloatVars:
00225             if varName in inputData:
00226                 calibStats.setFloat(varName,inputData[varName])
00227             else:
00228                 calibStats.setFloat(varName,defaultFloatVars[varName])
00229         return calibStats

def TestCoinc::EventSource::makeRecHeader (   self,
  inputData 
) [inherited]

Definition at line 230 of file TestCoinc.py.

00231                                      :
00232         "Make a Reconstructed data header given input data"
00233         recHeader = gbl.DayaBay.RecHeader()
00234         gbl.SetOwnership(recHeader,False)
00235         recHeader.setContext(inputData['context'])
00236         recHeader.setExecNumber(inputData['execNumber'])
00237         recHeader.setEarliest(inputData['earliest'])
00238         recHeader.setLatest(inputData['latest'])
00239         for inputHdr in inputData['inputHeaders']:
00240             recHeader.addInputHeader(inputHdr)
00241         defaultVars = {'triggerType':0,
00242                        'energy':0,
00243                        'rawEvis':0,
00244                        'x':0,
00245                        'y':0,
00246                        'z':0,
00247                        'energyStatus':1,
00248                        'positionStatus':1
00249                        }
00250         for varName in defaultVars:
00251             if varName in inputData:
00252                 defaultVars[varName] = inputData[varName]
00253         detectorId = inputData['context'].GetDetId()
00254         if detectorId == DetectorId.kRPC:
00255             pass
00256         elif detectorId>=DetectorId.kAD1 and detectorId<=DetectorId.kAD4:
00257             recTrigger = gbl.DayaBay.RecTrigger()
00258             recTrigger.setTriggerType(defaultVars['triggerType'])
00259             recTrigger.setEnergy(defaultVars['energy'])
00260             recTrigger.setEnergyStatus(defaultVars['energyStatus'])
00261             recTrigger.setRawEvis(defaultVars['rawEvis'])
00262             position = gbl.CLHEP.HepLorentzVector(defaultVars['x'],
00263                                                   defaultVars['y'],
00264                                                   defaultVars['z'])
00265             recTrigger.setPosition(position)
00266             recTrigger.setPositionStatus(defaultVars['positionStatus'])
00267             recHeader.setRecTrigger(recTrigger)
00268         elif detectorId>=DetectorId.kIWS and detectorId<=DetectorId.kOWS:
00269             pass
00270         else:
00271             print "Error: Making RecHeader for an invalid detector:", detectorId
00272             return None
00273         return recHeader

def TestCoinc::EventSource::constructTrigger (   self,
  inputData 
) [inherited]

Definition at line 274 of file TestCoinc.py.

00275                                         :
00276         "Construct the data objects needed for one trigger"
00277         triggerData = {}
00278         triggerData['triggerTime'] = inputData['time']
00279         triggerData['detectorId'] = inputData['detectorId']
00280         triggerData['site'] = inputData['site']
00281         headerData = {}
00282         # Calib Readout
00283         calibReadout = self.makeCalibHeader(inputData['calibHeader'])
00284         headerData['/Event/CalibReadout/CalibReadoutHeader'] = calibReadout
00285         # Calib Stats
00286         inputData['calibStats']['inputHeaders'] = [calibReadout]
00287         calibStats = self.makeCalibStats(inputData['calibStats'])
00288         headerData['/Event/Data/CalibStats'] = calibStats
00289         # Finish
00290         triggerData['headers'] = headerData
00291         return triggerData

def TestCoinc::EventSource::constructAdTrigger (   self,
  inputData 
) [inherited]

Definition at line 292 of file TestCoinc.py.

00293                                           :
00294         "Construct the data objects needed for one AD trigger"
00295         triggerData = self.constructTrigger(inputData)
00296         headerData = triggerData['headers']
00297         calibReadout = headerData['/Event/CalibReadout/CalibReadoutHeader']
00298         calibStats = headerData['/Event/Data/CalibStats']
00299         # AD Simple
00300         inputData['adSimple']['inputHeaders'] = [calibReadout,calibStats]
00301         adSimple = self.makeRecHeader(inputData['adSimple'])
00302         headerData['/Event/Rec/AdSimple'] = adSimple
00303         # AD Scaled
00304         inputData['adScaled']['inputHeaders'] = [calibReadout,calibStats]
00305         adScaled = self.makeRecHeader(inputData['adScaled'])
00306         headerData['/Event/Rec/AdScaled'] = adScaled
00307         # Finish
00308         return triggerData

def TestCoinc::EventSource::constructPoolTrigger (   self,
  inputData 
) [inherited]

Definition at line 309 of file TestCoinc.py.

00310                                             :
00311         "Construct the data objects needed for one AD trigger"
00312         triggerData = self.constructTrigger(inputData)
00313         headerData = triggerData['headers']
00314         calibReadout = headerData['/Event/CalibReadout/CalibReadoutHeader']
00315         calibStats = headerData['/Event/Data/CalibStats']
00316         # AD Simple
00317         inputData['adSimple']['inputHeaders'] = [calibReadout,calibStats]
00318         adSimple = self.makeRecHeader(inputData['adSimple'])
00319         headerData['/Event/Rec/AdSimple'] = adSimple
00320         # AD Scaled
00321         inputData['adScaled']['inputHeaders'] = [calibReadout,calibStats]
00322         adScaled = self.makeRecHeader(inputData['adScaled'])
00323         headerData['/Event/Rec/AdScaled'] = adScaled
00324         return triggerData

def TestCoinc::EventSource::makeEmptyTrigger (   self,
  time,
  site,
  detectorId 
) [inherited]

Definition at line 325 of file TestCoinc.py.

00326                                                       :
00327         "Make an empty skeleton for AD trigger data"
00328         inputData = {}
00329         triggerTime = TimeStamp(time)
00330         triggerTime.Add(self.detectorLatency[detectorId])
00331         inputData['time']=triggerTime
00332         inputData['detectorId']=detectorId
00333         inputData['site']=site
00334         context = gbl.Context(site, 0, triggerTime, detectorId)
00335         earliest = TimeStamp(time)
00336         earliest.Add(-1.0e-6) # subtract 1us
00337         latest = TimeStamp(time)
00338         latest.Add(1.0e-6) # add 1us
00339 
00340         inputCalibHdr = {"context":context,
00341                          "earliest":earliest,
00342                          "latest":latest,
00343                          "execNumber":0,
00344                          "triggerType":0
00345                          }
00346 
00347         inputCalibStats = {"context":context,
00348                            "earliest":earliest,
00349                            "latest":latest,
00350                            "execNumber":0
00351                            }
00352         inputData['calibHeader'] = inputCalibHdr
00353         inputData['calibStats'] = inputCalibStats
00354         return inputData

def TestCoinc::EventSource::makeEmptyAdTrigger (   self,
  time,
  site,
  detectorId 
) [inherited]

Definition at line 355 of file TestCoinc.py.

00356                                                         :
00357         "Make an empty skeleton for AD trigger data"
00358         inputData = self.makeEmptyTrigger(time, site, detectorId)
00359         inputAdSimple = {"context":inputData['calibHeader']['context'],
00360                          "earliest":inputData['calibHeader']['earliest'],
00361                          "latest":inputData['calibHeader']['latest'],
00362                          "execNumber":0,
00363                          "triggerType":0
00364                          }
00365 
00366         inputAdScaled = {"context":inputData['calibHeader']['context'],
00367                          "earliest":inputData['calibHeader']['earliest'],
00368                          "latest":inputData['calibHeader']['latest'],
00369                          "execNumber":0,
00370                          "triggerType":0
00371                          }
00372 
00373         inputData['adSimple'] = inputAdSimple
00374         inputData['adScaled'] = inputAdScaled
00375         return inputData

def TestCoinc::EventSource::makeEmptyPoolTrigger (   self,
  time,
  site,
  detectorId 
) [inherited]

Definition at line 376 of file TestCoinc.py.

00377                                                           :
00378         "Make an empty skeleton for Water Pool trigger data"
00379         inputData = self.makeEmptyTrigger(time, site, detectorId)
00380         # Still need to make empty reconstructed data headers for Pool events
00381         inputAdSimple = {"context":inputData['calibHeader']['context'],
00382                          "earliest":inputData['calibHeader']['earliest'],
00383                          "latest":inputData['calibHeader']['latest'],
00384                          "execNumber":0,
00385                          "triggerType":0
00386                          }
00387 
00388         inputAdScaled = {"context":inputData['calibHeader']['context'],
00389                          "earliest":inputData['calibHeader']['earliest'],
00390                          "latest":inputData['calibHeader']['latest'],
00391                          "execNumber":0,
00392                          "triggerType":0
00393                          }
00394 
00395         inputData['adSimple'] = inputAdSimple
00396         inputData['adScaled'] = inputAdScaled
        return inputData

Member Data Documentation

Reimplemented from TestCoinc::EventSource.

Definition at line 473 of file TestCoinc.py.

Definition at line 473 of file TestCoinc.py.

Definition at line 473 of file TestCoinc.py.

Definition at line 81 of file TestCoinc.py.

Definition at line 81 of file TestCoinc.py.

Reimplemented in TestCoinc::MuonSource.

Definition at line 81 of file TestCoinc.py.

Definition at line 81 of file TestCoinc.py.

Definition at line 81 of file TestCoinc.py.

Definition at line 81 of file TestCoinc.py.

Definition at line 81 of file TestCoinc.py.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Fri May 16 2014 10:10:46 for ADCoincTagging by doxygen 1.7.4