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

List of all members.

Public Member Functions

def __init__
def initTagList
def check

Public Attributes

 location
 calibStatslocation
 dtPromptCut
 dtRetriggerCut
 adChargeCut
 printTagInfo
 inputheaders
 lastMuonTime
 firstMuonTime
 lastTriggerTime
 startCounter

Detailed Description

Definition at line 24 of file MuonTag.py.


Constructor & Destructor Documentation

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

Definition at line 27 of file MuonTag.py.

00028                             :
00029         UserTaggingAlg.__init__(self, name)
00030 
00031         self.location = "/Event/CalibReadout/CalibReadoutHeader"
00032         self.calibStatslocation = "/Event/Data/CalibStats"
00033         self.dtPromptCut = 300*units.nanosecond
00034         self.dtRetriggerCut = 10*units.microsecond
00035         self.adChargeCut = 2500. # in photoelectrons
00036         self.printTagInfo = False
            

Member Function Documentation

def Tagger::MuonTagger::MuonTag::MuonTag::initTagList (   self)
Define Muon Tags 

Definition at line 38 of file MuonTag.py.

00039                          :
00040         """ Define Muon Tags """
00041         self.addTag('MuonAny' , '/Event/Tag/Muon/MuonAny')
00042         self.addTag('FirstMuonTrigger' , '/Event/Tag/Muon/FirstMuonTrigger')
00043         self.addTag('Retrigger' , '/Event/Tag/Muon/Retrigger')
00044         self.addTag('MuonAll' , '/Event/Tag/Muon/MuonAll')
00045         
00046         # Keep times of recent muons
00047         self.inputheaders = []
00048         self.lastMuonTime = {}
00049         self.firstMuonTime = None
00050         self.lastTriggerTime = None
00051         self.startCounter = False
        
def Tagger::MuonTagger::MuonTag::MuonTag::check (   self,
  evt 
)
Check and set Muon Tags 

Definition at line 53 of file MuonTag.py.

00054                         :
00055         """ Check and set Muon Tags """
00056         header = evt[self.location]
00057         if not header:
00058             self.warning('cannot find header at ' + self.location)
00059             return FAILURE
00060 
00061         calibStats = evt[self.calibStatslocation]
00062         if not calibStats:
00063             self.warning('cannot find header at ' + self.calibStatslocation)
00064             return FAILURE
00065 
00066         isMuon = False
00067         detectorId = header.context().GetDetId()
00068         if detectorId == DetectorId.kIWS:
00069             # Tag all IWS events as Muon
00070             isMuon = True
00071         elif detectorId == DetectorId.kOWS:
00072             # Tag all OWS events as Muon
00073             isMuon = True
00074         elif detectorId == DetectorId.kRPC:
00075             # Tag all RPC events as Muon
00076             isMuon = True
00077         elif detectorId in [DetectorId.kAD1,
00078                             DetectorId.kAD2,
00079                             DetectorId.kAD3,
00080                             DetectorId.kAD4]:
00081             # Only tag high-energy AD events as Muon
00082             #calibStats = evt["/Event/Data/CalibStats"]
00083             #if not calibStats:
00084             #    self.error("Failed to get /Event/Data/CalibStats")
00085             #    return FAILURE
00086             nPESum = calibStats.getFloat("nPESum")
00087             #NPESum = 0.
00088             #readout = header.calibReadout()
00089             #for channel in readout.channelReadout():
00090             #    sensorId = channel.pmtSensorId()
00091             #    pmtId = gbl.DayaBay.AdPmtSensor(sensorId.fullPackedData())
00092             #    if pmtId.ring() == 0: continue  # exclude 2'' PMTs
00093             #    for i in range(channel.size()):
00094             #        charge = channel.charge(i)
00095             #        NPESum += charge
00096             if nPESum > self.adChargeCut:
00097                 isMuon = True
00098 
00099         if isMuon:
00100             # Tag it as muon
00101             myTag = self.getTag('MuonAny')
00102             myTag.setInputHeaders( [header, calibStats] )
00103             myTag.tagIt()
00104 
00105         # Possible Retriggering?
00106         isRetrigger = False
00107         if self.lastMuonTime.has_key(detectorId):
00108             # Tag as retriggering if within time window after initial muon
00109             dtMuon = TimeStamp( header.timeStamp() )
00110             dtMuon.Subtract( self.lastMuonTime[detectorId] )
00111             if dtMuon.GetSeconds()*units.second < self.dtRetriggerCut:
00112                 myTag = self.getTag('Retrigger')
00113                 myTag.setInputHeaders( [header] )
00114                 myTag.tagIt()
00115                 isRetrigger = True
00116             
00117         # collecting all the muon prompt triggers from the previous muon
00118         isPreviousMuFinished = False
00119 
00120         if self.firstMuonTime and self.startCounter:
00121             dtMuon = TimeStamp( header.timeStamp() )
00122             dtMuon.Subtract( self.firstMuonTime )
00123             if dtMuon.GetSeconds()*units.second > self.dtPromptCut:
00124                 if len(self.inputheaders)>0:
00125                     myTag = self.getTag('MuonAll')
00126                     myTag.setInputHeaders( self.inputheaders )
00127                     myTag.tagIt()
00128                     self.startCounter = False
00129                     self.inputheaders = []
00130                     isPreviousMuFinished = True
00131 
00132         # Catch and tag first trigger of a new muon
00133         
00134         isFirstMuonTrigger = False
00135                
00136         if isMuon and not isRetrigger:
00137             self.inputheaders += [ self.getTag('MuonAny').header ]
00138 
00139             if not self.firstMuonTime:
00140                 isFirstMuonTrigger = True
00141             else:
00142                 dtMuon = TimeStamp( header.timeStamp() )
00143                 dtMuon.Subtract( self.firstMuonTime )
00144                 if dtMuon.GetSeconds()*units.second > self.dtPromptCut:
00145                     # Not part of previous muon
00146                     isFirstMuonTrigger = True
00147                                       
00148             if isFirstMuonTrigger:
00149                 myTag = self.getTag('FirstMuonTrigger')
00150                 myTag.setInputHeaders( [header] )
00151                 myTag.tagIt()
00152                 self.startCounter = True
00153                 
00154         if self.printTagInfo:
00155             dtTrig = 0
00156             if self.lastTriggerTime:
00157                 dtMuon = TimeStamp( header.timeStamp() )
00158                 dtMuon.Subtract( self.lastTriggerTime )
00159                 dtTrig = (dtMuon.GetSeconds()*units.second)/units.microsecond
00160             tagInfo = "%6.3f %d" % (dtTrig, detectorId)
00161             if isFirstMuonTrigger:
00162                 tagInfo += " FirstMu"
00163             if isMuon:
00164                 tagInfo += " AnyMu"
00165             if isRetrigger:
00166                 tagInfo += " Retrigger"
00167             if isPreviousMuFinished:
00168                 tagInfo += " PreviousMuFinished"
00169             self.info(tagInfo)
00170 
00171         # Update time since last non-ringing muon
00172         if isMuon and not isRetrigger:
00173             self.lastMuonTime[detectorId] = TimeStamp( header.timeStamp() )
00174             if isFirstMuonTrigger:
00175                 self.firstMuonTime = TimeStamp( header.timeStamp() )
00176         self.lastTriggerTime = TimeStamp( header.timeStamp() )
00177         return
00178 
        

Member Data Documentation

Definition at line 27 of file MuonTag.py.

Definition at line 27 of file MuonTag.py.

Definition at line 27 of file MuonTag.py.

Definition at line 27 of file MuonTag.py.

Definition at line 27 of file MuonTag.py.

Definition at line 27 of file MuonTag.py.

Definition at line 38 of file MuonTag.py.

Definition at line 38 of file MuonTag.py.

Definition at line 38 of file MuonTag.py.

Definition at line 38 of file MuonTag.py.

Definition at line 38 of file MuonTag.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