/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
Tagger::MuonTagger::SpallData::SpallData Class Reference
Inheritance diagram for Tagger::MuonTagger::SpallData::SpallData:
Inheritance graph
[legend]
Collaboration diagram for Tagger::MuonTagger::SpallData::SpallData:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def initTagList
def check
def recordPreviousMuon

Public Attributes

 promptMuonHeaders
 retriggerHeaders
 spallationHeaders
 lastMuonTimeStamp
 currentMuonTimeStamp
 isSimulation
 maxSpallTime
 runNumber
 coordSvc

Detailed Description

Definition at line 28 of file SpallData.py.


Constructor & Destructor Documentation

def Tagger::MuonTagger::SpallData::SpallData::__init__ (   self,
  name 
)

Definition at line 31 of file SpallData.py.

00032                             :
00033         UserTaggingAlg.__init__(self, name)
00034         self.promptMuonHeaders = []
00035         self.retriggerHeaders = []
00036         self.spallationHeaders = []
00037         self.lastMuonTimeStamp = None
00038         self.currentMuonTimeStamp = None
00039         self.isSimulation = False
00040         self.maxSpallTime = 0.2*units.second
00041         self.runNumber = None
        

Member Function Documentation

def Tagger::MuonTagger::SpallData::SpallData::initTagList (   self)

Definition at line 43 of file SpallData.py.

00044                          :
00045         self.coordSvc = self.svc('ICoordSysSvc','CoordSysSvc')
00046         if self.coordSvc == None:
00047             self.error("Failed to get ICoordSysSvc")
00048             return FAILURE
00049         
00050         # create Spallation Data
00051         dummyTag = self.addTag('Spallation', '')
00052         spallData = dummyTag.addData('Spallation' ,
00053                                      '/Event/Data/Muon/Spallation')
00054         spallData.addInt('runNumber') # Current Run Number
00055         spallData.addInt('tMu_s','tMu_ns') # Current Muon timestamp
00056         spallData.addFloat('dtLastMu_ms') # Previous Muon timestamp
00057         spallData.addFloat('dtNextMu_ms') # Next Muon timestamp
00058         # Prompt triggered detectors
00059         spallData.addInt('hitIWS','hitOWS','hitRPC',
00060                          'hitAD1','hitAD2','hitAD3','hitAD4')
00061         # Prompt trigger info
00062         spallData.addInt('triggerNumber_IWS','triggerNumber_OWS',
00063                          'triggerNumber_RPC','triggerNumber_AD1',
00064                          'triggerNumber_AD2','triggerNumber_AD3',
00065                          'triggerNumber_AD4')
00066         spallData.addInt('triggerType_IWS','triggerType_OWS',
00067                          'triggerType_RPC','triggerType_AD1',
00068                          'triggerType_AD2','triggerType_AD3',
00069                          'triggerType_AD4')
00070         # Time of prompt muon triggers relative to first trigger
00071         spallData.addFloat('dtIWS_ms','dtOWS_ms','dtRPC_ms',
00072                            'dtAD1_ms','dtAD2_ms','dtAD3_ms','dtAD4_ms')
00073         # Total charge/nHit of prompt muon triggers
00074         spallData.addFloat('calib_nPESum_IWS','calib_nPESum_OWS',
00075                            'calib_nPESum_AD1','calib_nPESum_AD2',
00076                            'calib_nPESum_AD3','calib_nPESum_AD4')
00077         spallData.addInt('calib_nHit_IWS','calib_nHit_OWS',
00078                          'calib_nHit_AD1','calib_nHit_AD2',
00079                          'calib_nHit_AD3','calib_nHit_AD4')
00080         # Retriggers in muon system
00081         spallData.addInt('nRetriggers')
00082         spallData.addIntArray('triggerNumber_rt',
00083                               'detectorId_rt',
00084                               'triggerType_rt')
00085         spallData.addFloatArray('dtRetrigger_ms','calib_nPESum_rt')
00086         # Possible spallation triggers in ADs
00087         spallData.addInt('nSpall')
00088         spallData.addIntArray('triggerNumber_sp',
00089                               'detectorId_sp',
00090                               'triggerType_sp',
00091                               'energyStatus_sp',
00092                               'positionStatus_sp')
00093         spallData.addFloatArray('dtSpall_ms',
00094                                 'energy_sp',
00095                                 'x_sp','y_sp','z_sp')
00096         if self.isSimulation:
00097             # add SimHeader Info
00098             for paraName in SimDataHelper.DATA_SUMMARY_INT:
00099                 spallData.addIntArray(paraName+'_sp')
00100             for paraName in SimDataHelper.DATA_NCAP_INT:
00101                 spallData.addIntArray(paraName+'_sp')
00102             for paraName in SimDataHelper.DATA_NCAP_FLOAT:
00103                 spallData.addFloatArray(paraName+'_sp')   
                             
def Tagger::MuonTagger::SpallData::SpallData::check (   self,
  evt 
)

Definition at line 105 of file SpallData.py.

00106                         :
00107         # Check if there is a muon, and record
00108         calibHdr = evt['/Event/CalibReadout/CalibReadoutHeader']
00109         calibStatsHdr = evt['/Event/Data/CalibStats']
00110         isMuon = evt['/Event/Tag/Muon/MuonAny']
00111         isFirstMuonTrigger = evt['/Event/Tag/Muon/FirstMuonTrigger']
00112         isRetrigger = evt['/Event/Tag/Muon/Retrigger']
00113 
00114         # Don't process SAB data
00115         if(calibHdr.context().GetSite() == Site.kSAB):
00116             return
00117 
00118         # Catch the current run number
00119         if not self.runNumber:
00120             readoutHdr = evt['/Event/Readout/ReadoutHeader']
00121             if not readoutHdr:
00122                 self.warning("Failed to get readout, setting run number to 0")
00123                 self.runNumber = 0
00124             else:
00125                 daqCrate = readoutHdr.daqCrate()
00126                 if not daqCrate:
00127                     self.warning("Failed to get daq crate, setting run number to 0")
00128                     self.runNumber = 0
00129                 else:    
00130                     self.runNumber = daqCrate.runNumber()
00131                 
00132         currentTimeStamp = calibHdr.timeStamp()
00133         detectorId = calibHdr.context().GetDetId()
00134 
00135         # Check time since current muon
00136         dtCurrentMuon = -1*units.second
00137         if self.currentMuonTimeStamp:
00138             dtCurrentMuonTS = TimeStamp( currentTimeStamp )
00139             dtCurrentMuonTS.Subtract( self.currentMuonTimeStamp )
00140             dtCurrentMuon = dtCurrentMuonTS.GetSeconds() * units.second
00141         
00142         if isFirstMuonTrigger or (dtCurrentMuon > self.maxSpallTime):
00143             # Save the data from the previous muon
00144             nextMuonTime = None
00145             if isFirstMuonTrigger:
00146                 nextMuonTime = currentTimeStamp
00147             self.recordPreviousMuon( nextMuonTime )
00148             self.promptMuonHeaders = []
00149             self.retriggerHeaders = []
00150             self.spallationHeaders = []
00151 
00152         if isFirstMuonTrigger:
00153             # Set times for new muon
00154             self.lastMuonTimeStamp = self.currentMuonTimeStamp
00155             self.currentMuonTimeStamp = TimeStamp( currentTimeStamp )
00156 
00157         if isMuon and not isRetrigger:
00158             # Record prompt muon
00159             self.promptMuonHeaders.append( [calibHdr,calibStatsHdr] )
00160         else:
00161             if isRetrigger:
00162                 # Keep handle to retrigger headers
00163                 self.retriggerHeaders.append( [calibHdr,calibStatsHdr] )
00164             if detectorId in [DetectorId.kAD1,DetectorId.kAD2,
00165                               DetectorId.kAD3,DetectorId.kAD4]:
00166                 # Keep handle to AD reconstructed data
00167                 recHdr = evt['/Event/Rec/AdSimple']
00168                 # calibStatsHdr: for PMT Flasher discriminator of "Spall" events
00169                 self.spallationHeaders.append( [recHdr, calibStatsHdr] )
00170 
00171         return
00172         

def Tagger::MuonTagger::SpallData::SpallData::recordPreviousMuon (   self,
  currentTimeStamp 
)
Record the spallation data from the previous muon

Definition at line 173 of file SpallData.py.

00174                                                   :
00175         """Record the spallation data from the previous muon"""
00176         if len(self.promptMuonHeaders)<1:
00177             return
00178         spallData = self.getTag('Spallation').getData('Spallation')
00179         firstMuonHdrs = self.promptMuonHeaders[0]
00180         muonTimeStamp = firstMuonHdrs[0].timeStamp()
00181         # Muon set run number
00182         spallData.set('runNumber',self.runNumber)
00183         # Muon set time stamp
00184         spallData.set('tMu_s',muonTimeStamp.GetSec())
00185         spallData.set('tMu_ns',muonTimeStamp.GetNanoSec())
00186         # Time since last muon
00187         if self.lastMuonTimeStamp:
00188             dtLastMu = TimeStamp( muonTimeStamp )
00189             dtLastMu.Subtract( self.lastMuonTimeStamp )
00190             dtLastMu_ms = (dtLastMu.GetSeconds()*units.second)/units.ms
00191             spallData.set('dtLastMu_ms',dtLastMu_ms)
00192         else:
00193             spallData.set('dtLastMu_ms',0)
00194         # Time to next muon
00195         dtNextMu_ms = -1*units.second
00196         if currentTimeStamp:
00197             dtNextMu = TimeStamp( currentTimeStamp )
00198             dtNextMu.Subtract( muonTimeStamp )
00199             dtNextMu_ms = (dtNextMu.GetSeconds()*units.second)/units.ms
00200         spallData.set('dtNextMu_ms',dtNextMu_ms)
00201         # Record prompt muon trigger information
00202         for muonHdrs in self.promptMuonHeaders:
00203             muonCalibHdr = muonHdrs[0]
00204             muonCalibStatsHdr = muonHdrs[1]
00205             detectorId = muonCalibHdr.context().GetDetId()
00206             dtPrompt = TimeStamp( muonCalibHdr.timeStamp() )
00207             dtPrompt.Subtract( muonTimeStamp )
00208             dtPrompt_ms = (dtPrompt.GetSeconds()*units.second)/units.ms
00209             if muonCalibHdr.calibReadout():
00210                 triggerNumber = muonCalibHdr.calibReadout().triggerNumber()
00211                 triggerType = muonCalibHdr.calibReadout().triggerType()
00212             else:
00213                 triggerNumber = 0
00214                 triggerType = 0
00215             nPESumPrompt = muonCalibStatsHdr.getFloat("nPESum")
00216             nHitPrompt = muonCalibStatsHdr.getInt("nHit")
00217             if detectorId == DetectorId.kAD1:
00218                 spallData.set('hitAD1',1)
00219                 spallData.set('dtAD1_ms',dtPrompt_ms)
00220                 spallData.set('triggerNumber_AD1',triggerNumber)
00221                 spallData.set('triggerType_AD1',triggerType)
00222                 spallData.set('calib_nPESum_AD1',nPESumPrompt)
00223                 spallData.set('calib_nHit_AD1',nHitPrompt)
00224             elif detectorId == DetectorId.kAD2:
00225                 spallData.set('hitAD2',1)
00226                 spallData.set('dtAD2_ms',dtPrompt_ms)
00227                 spallData.set('triggerNumber_AD2',triggerNumber)
00228                 spallData.set('triggerType_AD2',triggerType)
00229                 spallData.set('calib_nPESum_AD2',nPESumPrompt)
00230                 spallData.set('calib_nHit_AD2',nHitPrompt)
00231             elif detectorId == DetectorId.kAD3:
00232                 spallData.set('hitAD3',1)
00233                 spallData.set('dtAD3_ms',dtPrompt_ms)
00234                 spallData.set('triggerNumber_AD3',triggerNumber)
00235                 spallData.set('triggerType_AD3',triggerType)
00236                 spallData.set('calib_nPESum_AD3',nPESumPrompt)
00237                 spallData.set('calib_nHit_AD3',nHitPrompt)
00238             elif detectorId == DetectorId.kAD4:
00239                 spallData.set('hitAD4',1)
00240                 spallData.set('dtAD4_ms',dtPrompt_ms)
00241                 spallData.set('triggerNumber_AD4',triggerNumber)
00242                 spallData.set('triggerType_AD4',triggerType)
00243                 spallData.set('calib_nPESum_AD4',nPESumPrompt)
00244                 spallData.set('calib_nHit_AD4',nHitPrompt)
00245             elif detectorId == DetectorId.kIWS:
00246                 spallData.set('hitIWS',1)
00247                 spallData.set('dtIWS_ms',dtPrompt_ms)
00248                 spallData.set('triggerNumber_IWS',triggerNumber)
00249                 spallData.set('triggerType_IWS',triggerType)
00250                 spallData.set('calib_nPESum_IWS',nPESumPrompt)
00251                 spallData.set('calib_nHit_IWS',nHitPrompt)
00252             elif detectorId == DetectorId.kOWS:
00253                 spallData.set('hitOWS',1)
00254                 spallData.set('dtOWS_ms',dtPrompt_ms)
00255                 spallData.set('triggerNumber_OWS',triggerNumber)
00256                 spallData.set('triggerType_OWS',triggerType)
00257                 spallData.set('calib_nPESum_OWS',nPESumPrompt)
00258                 spallData.set('calib_nHit_OWS',nHitPrompt)
00259             elif detectorId == DetectorId.kRPC:
00260                 spallData.set('hitRPC',1)
00261                 spallData.set('triggerNumber_RPC',triggerNumber)
00262                 spallData.set('triggerType_RPC',triggerType)
00263                 spallData.set('dtRPC_ms',dtPrompt_ms)
00264         # Record retrigger information
00265         nRetriggers = len(self.retriggerHeaders)
00266         spallData.set('nRetriggers',nRetriggers)
00267         for retrigHdrs in self.retriggerHeaders:
00268             retrigCalibHdr = retrigHdrs[0]
00269             retrigCalibStatsHdr = retrigHdrs[1]
00270             detectorId = retrigCalibHdr.context().GetDetId()
00271             dtRetrigger = TimeStamp( retrigCalibHdr.timeStamp() )
00272             dtRetrigger.Subtract( muonTimeStamp )
00273             dtRetrigger_ms = (dtRetrigger.GetSeconds()*units.second)/units.ms
00274             spallData.append('dtRetrigger_ms',dtRetrigger_ms)
00275             spallData.append('detectorId_rt',detectorId)
00276             if retrigCalibHdr.calibReadout():
00277                 spallData.append('triggerNumber_rt',
00278                                  retrigCalibHdr.calibReadout().triggerNumber())
00279                 spallData.append('triggerType_rt',
00280                                  retrigCalibHdr.calibReadout().triggerType())
00281             else:
00282                 spallData.append('triggerNumber_rt',0)
00283                 spallData.append('triggerType_rt',0)
00284             if detectorId!=DetectorId.kRPC:
00285                 spallData.append('calib_nPESum_rt',
00286                                  retrigCalibStatsHdr.getFloat("nPESum"))
00287             else:
00288                 spallData.append('calib_nPESum_rt',0)
00289         # Record AD spallation candidates
00290         nSpall = len(self.spallationHeaders)
00291         spallData.set('nSpall',nSpall)
00292         for spallHdrs in self.spallationHeaders:
00293             spallHdr = spallHdrs[0]
00294             spallCalibStatsHdr = spallHdrs[1]
00295             detectorId = spallHdr.context().GetDetId()
00296             dtSpall = TimeStamp( spallHdr.timeStamp() )
00297             dtSpall.Subtract( muonTimeStamp )
00298             dtSpall_ms = (dtSpall.GetSeconds()*units.second)/units.ms
00299             recTrigger = spallHdr.recTrigger()
00300             spallData.append('dtSpall_ms',dtSpall_ms)
00301             spallData.append('detectorId_sp',detectorId)
00302             spallData.append('triggerNumber_sp',recTrigger.triggerNumber())
00303             spallData.append('triggerType_sp',recTrigger.triggerType())
00304             spallData.append('energyStatus_sp',recTrigger.energyStatus())
00305             spallData.append('energy_sp',recTrigger.energy()/units.MeV)
00306             spallData.append('positionStatus_sp',recTrigger.positionStatus())
00307             spallData.append('x_sp',recTrigger.position().x()/units.mm)
00308             spallData.append('y_sp',recTrigger.position().y()/units.mm)
00309             spallData.append('z_sp',recTrigger.position().z()/units.mm)
00310 
00311             #PMT Flasher discriminators for "Spall" events
00312             spallData.append('middleTimeRMS_sp',spallCalibStatsHdr.getFloat("MiddleTimeRMS"))
00313             spallData.append('maxQ_sp',spallCalibStatsHdr.getFloat("MaxQ"))
00314             spallData.append('quadrant_sp',spallCalibStatsHdr.getFloat("Quadrant"))
00315             spallData.append('peakRMS_sp',spallCalibStatsHdr.getFloat("PeakRMS"))
00316             spallData.append('kurtosis_sp',spallCalibStatsHdr.getFloat("Kurtosis"))
00317             
00318         if self.isSimulation:
00319             for spallHdrs in self.spallationHeaders:
00320                 spallHdr = spallHdrs[0]
00321                 simHdrs = spallHdr.findHeaders(gbl.DayaBay.SimHeader.classID())
00322                 data = SimDataHelper.summary(simHdrs)
00323                 for paraName in SimDataHelper.DATA_SUMMARY_INT:
00324                     spallData.append(paraName+'_sp', data[paraName])
00325                 data = SimDataHelper.nCapture(self, spallHdr)
00326                 for paraName in SimDataHelper.DATA_NCAP_INT:
00327                     spallData.append(paraName+'_sp', data[paraName])
00328                 for paraName in SimDataHelper.DATA_NCAP_FLOAT:
00329                     spallData.append(paraName+'_sp', data[paraName])
00330         self.tagIt('Spallation')
00331         return
00332 
                

Member Data Documentation

Definition at line 31 of file SpallData.py.

Definition at line 31 of file SpallData.py.

Definition at line 31 of file SpallData.py.

Definition at line 31 of file SpallData.py.

Definition at line 31 of file SpallData.py.

Definition at line 31 of file SpallData.py.

Definition at line 31 of file SpallData.py.

Definition at line 31 of file SpallData.py.

Definition at line 43 of file SpallData.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 09:54:18 for Tagger by doxygen 1.7.4