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

List of all members.

Public Member Functions

def __init__
def initTagList
def check

Public Attributes

 location
 daqDetailsSvc
 myTag
 myData

Detailed Description

Definition at line 19 of file SpallB12.py.


Constructor & Destructor Documentation

def Tagger::MuonTagger::SpallB12::SpallB12Tagging::__init__ (   self,
  name 
)

Definition at line 22 of file SpallB12.py.

00023                             :
00024         UserTaggingAlg.__init__(self, name)
00025         
        self.location = '/Events/Rec/AdSimple'

Member Function Documentation

def Tagger::MuonTagger::SpallB12::SpallB12Tagging::initTagList (   self)

Definition at line 27 of file SpallB12.py.

00027                          :        
00028         self.daqDetailsSvc = self.svc('IDaqDetailsSvc','DetailsFromRecordSvc')
00029         
00030         if self.daqDetailsSvc == None: 
00031             self.error("Failed to get IDaqDetailsSvc") 
00032             return FAILURE 
00033         
00034         self.myTag = self.addTag('SpallB12', '/Event/Tag/SpallB12'
00035             ).setBaseHeader(self.location)
00036             
00037         self.myData = self.myTag.addData('SpallB12', '/Event/Data/SpallB12')
00038         self.myData.addInt('runNo', 'fileNo', 'nMuon'
00039             ).addFloatArray('dtLastMuon_ms', 'muon_nPESum')
00040         for paraName in RecDataHelper.DATA_SUMMARY_INT:
00041             self.myData.addInt(paraName)
00042         for paraName in RecDataHelper.DATA_SUMMARY_FLOAT:
00043             self.myData.addFloat(paraName)
00044 
00045         # add CalibStats info
00046         for paraName in CalibDataHelper.DATA_STATS_INT:
00047             self.myData.addInt('calib_'+paraName)
00048         for paraName in CalibDataHelper.DATA_STATS_FLOAT:
00049             self.myData.addFloat('calib_'+paraName)
00050                    
def Tagger::MuonTagger::SpallB12::SpallB12Tagging::check (   self,
  evt 
)

Definition at line 52 of file SpallB12.py.

00052                         :     
00053         recHdr = evt[self.location]
00054         if not recHdr:
00055             self.warning('cannot find header at ' + self.location)
00056             return FAILURE
00057 
00058         detId = recHdr.context().GetDetId()
00059         if not (detId == 1 or detId == 2):
00060             return False
00061         
00062         data = RecDataHelper.summary(recHdr)                  
00063         if not (4 < data['e'] < 20): 
00064             return False
00065 
00066         # self.info('energy ' + str(data['e']) + ', det ' + str(detId))
00067 
00068         timeStamp = recHdr.timeStamp()
00069         dtLastMuon_ms = []
00070         muon_nPESum = []
00071         aes = self.getAES('/Event/Data/CalibStats')
00072         for i in range(1, len(aes)):
00073             aes_header = aes[i]
00074             dt = gbl.TimeStamp(timeStamp)
00075             dt.Subtract(aes_header.timeStamp())
00076             
00077             # only save last 500 ms 
00078             if dt.GetSeconds()>0.5:
00079                 break  
00080             
00081             # veto 1 ms after an AD muon
00082             aes_detId = aes_header.context().GetDetId()    
00083             aes_nPESum = aes_header.getFloat('nPESum')
00084             if dt.GetSeconds()<1e-3 and aes_nPESum>3.5e4 and aes_detId == detId:
00085                 break
00086             
00087             # muon need to be on same AD
00088             if not (aes_detId == detId):
00089                 # self.info('skip aes: aesdet:%d det:%d' % (aes_detId, detId))
00090                 continue
00091                         
00092             # deposit muon energy in AD need to be large
00093             if (aes_nPESum < 3e5):
00094                 # self.info('skip: npe' + str(aes_nPESum))
00095                 continue
00096                 
00097             # found a related muon!
00098             dtLastMuon_ms.append(dt.GetSeconds()*1e3)
00099             muon_nPESum.append(aes_nPESum)
00100 
00101         
00102         nMuon = len(dtLastMuon_ms)
00103         if nMuon == 0: 
00104             # no related muon, skip tagging
00105             return False
00106         
00107         self.myTag.tagIt()
00108         
00109         # save User Data
00110         self.myData.set("nMuon", nMuon)
00111         for i in range(nMuon):
00112             self.myData.append("dtLastMuon_ms", dtLastMuon_ms[i])
00113             self.myData.append("muon_nPESum", muon_nPESum[i])
00114 
00115         for paraName in RecDataHelper.DATA_SUMMARY_INT + RecDataHelper.DATA_SUMMARY_FLOAT:
00116             self.myData.set(paraName, data[paraName])
00117         
00118         calibStats = evt['/Event/Data/CalibStats']
00119         if calibStats:
00120             for paraName in CalibDataHelper.DATA_STATS_INT:
00121                 self.myData.set('calib_'+paraName, calibStats.getInt(paraName))
00122             for paraName in CalibDataHelper.DATA_STATS_FLOAT:
00123                 self.myData.set('calib_'+paraName, calibStats.getFloat(paraName))
00124         else:
00125             self.warning("no calibStats at /Event/Data/CalibStats")
00126 
00127         svcMode = ServiceMode(recHdr.context(), 0)
00128         runDetails = self.daqDetailsSvc.runDetails(svcMode)
00129         if runDetails:
00130             runNo = runDetails.runNumber()
00131         else:
00132             runNo = -1
00133         fileDetails = self.daqDetailsSvc.fileDetails(svcMode)
00134         if fileDetails:
00135             fileNo = fileDetails.fileNumber()
00136         else:
00137             fileNo = -1
00138         self.myData.set("runNo", runNo)
00139         self.myData.set("fileNo", fileNo)
00140         
00141         
00142         

Member Data Documentation

Definition at line 22 of file SpallB12.py.

Definition at line 27 of file SpallB12.py.

Definition at line 27 of file SpallB12.py.

Definition at line 27 of file SpallB12.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