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

List of all members.

Public Member Functions

def __init__
def initTagList
def check

Public Attributes

 dTCut
 muonVetoTime
 location
 output
 outcome
 muonVeto
 numTag
 ADTagNames
 k
 lastmuontime
 deadtime
 num
 dtNano
 dtveto
 dtSec
 inputHeaders
 lastTimeStamp
 outputfile
 i
 t1
 t2
 t0
 t

Detailed Description

Definition at line 18 of file ADSingleTag.py.


Constructor & Destructor Documentation

def Tagger::SingleTagger::ADSingleTag::SingleTag::__init__ (   self,
  name 
)

Definition at line 21 of file ADSingleTag.py.

00022                             :
00023         UserTaggingAlg.__init__(self, name)
00024         
00025         self.dTCut = 300*units.microsecond
00026         self.muonVetoTime = 1000  #us
00027         self.location = "/Event/Rec/AdSimple"
00028         self.output = ''
00029         self.outcome = 'SingleTag'
00030         self.muonVeto = 1
        self.numTag = 1.0

Member Function Documentation

def Tagger::SingleTagger::ADSingleTag::SingleTag::initTagList (   self)

Definition at line 32 of file ADSingleTag.py.

00033                          :
00034         self.info("Single window: %.2f microsecond" % (
00035             self.dTCut/units.microsecond,))
00036             
00037         self.ADTagNames = { 
00038             gbl.DetectorId.kAD1 : 'AD1',
00039             gbl.DetectorId.kAD2 : 'AD2',
00040             gbl.DetectorId.kAD3 : 'AD3',
00041             gbl.DetectorId.kAD4 : 'AD4',
00042         }
00043         self.k=1
00044         self.lastmuontime = 0
00045         self.deadtime = 0
00046         self.num = 0
00047         self.dtNano = 0
00048         self.dtveto = 0
00049         self.dtSec = 0
00050         self.inputHeaders = {}
00051         self.lastTimeStamp = {} # hold the last timestamp of sub detectors (inluding IWS, OWS, RPC)
00052         # initialize AD Single Tags
00053         # initialize inputHeaders to hold the recHeaders of multiplets
00054         for tagName in self.ADTagNames.values():
00055             self.addTag(tagName , '/Event/Tag/Single/'+tagName+self.outcome
00056                 ).setBaseHeader(self.location)
00057             self.inputHeaders[tagName] = []
00058         if self.output != "":
            self.outputfile = file(self.output,'w')
def Tagger::SingleTagger::ADSingleTag::SingleTag::check (   self,
  evt 
)

Definition at line 60 of file ADSingleTag.py.

00061                         :
00062         header = evt[self.location]
00063         if not header:
00064             self.debug('cannot find header at ' + self.location)
00065             return SUCCESS
00066         self.i=1
00067         timeStamp = header.timeStamp()
00068         detectorId = header.context().GetDetId() 
00069         self.t1=timeStamp.GetSec()
00070         self.t2=timeStamp.GetNanoSec()
00071         if self.k==1:
00072            self.t0=self.t1
00073         self.t=(self.t1-self.t0)*1e9+self.t2
00074        # print "good ", self.t1, self.t2,  self.t, self.t0, detectorId
00075          
00076         self.debug("executing #%d, Det=%d, TS=%.6f ms" % (
00077             self.execNumber, detectorId, timeStamp.GetSeconds()*1e3))
00078         lastTimeStamp = self.lastTimeStamp.get(detectorId, timeStamp)
00079         self.lastTimeStamp[detectorId] = timeStamp
00080         
00081         muonList1 = self.getAES("/Event/Tag/Muon/MuonAny")
00082         if muonList1:
00083             for muon in muonList1:
00084                if self.i==1:
00085                   muontimeSec1=muon.timeStamp().GetSec()
00086                   muontimeNano1=muon.timeStamp().GetNanoSec()
00087                   muontime=(muontimeSec1-self.t0)*1e9+muontimeNano1
00088                 #  print "good1 ", muontimeSec1,muontimeNano1,muontime,self.i  
00089                   if self.t==muontime:
00090                 #     print "muon ", self.t,self.t1,self.t2,muontime,muontimeSec1,muontimeNano1 
00091                      if (muontime-self.lastmuontime)>1000000:
00092                         self.deadtime=self.deadtime+1000000
00093                  #       self.f.write(str(self.t)+' '+str(muontime)+' '+str(self.deadtime)+'\n')
00094                         self.i=self.i+1
00095                         self.lastmuontime=muontime
00096                      else:
00097                         self.deadtime=self.deadtime+muontime-self.lastmuontime
00098                 #        self.f.write(str(self.t)+' '+str(muontime)+' '+str(self.deadtime)+'\n')
00099                         self.i=self.i+1
00100                         self.lastmuontime=muontime
00101         if self.output != "":
00102             self.outputfile.write(str(self.t)+' '+str(self.t1)+' '+str(self.t2)+' '+str(self.deadtime)+'\n')
00103        # print " T and deadtime ", self.t, self.deadtime
00104         t3=lastTimeStamp.GetSec()
00105         t4=lastTimeStamp.GetNanoSec()
00106         tagName = self.ADTagNames.get(detectorId, '')
00107         if not tagName: return  # IWS/OWS/RPC
00108        
00109         dt = gbl.TimeStamp(timeStamp)
00110         dt.Subtract(lastTimeStamp)
00111         if dt.GetSeconds()*units.second > self.dTCut:
00112             multiplicity = len(self.inputHeaders[tagName])
00113             if multiplicity > 1:
00114                 # found Coincidence, clear the inputHeaders
00115                 self.inputHeaders[tagName] = []
00116             else:
00117                 # found a gap, save last conincidence's multiplets         
00118                 # self.info('#%d: found one coinc event in %s, multiplicity %d' % 
00119                 #     (self.execNumber, tagName, multiplicity))
00120                if self.muonVeto > 0:
00121               # if True:
00122                   muonList = self.getAES("/Event/Tag/Muon/MuonAny")
00123                   if muonList:
00124               #       for muon in muonList:
00125              #        print "muontime", muon.timeStamp().GetNanoSec()
00126                      for muon in muonList:
00127                         muontimeSec=muon.timeStamp().GetSec()
00128                         muontimeNano=muon.timeStamp().GetNanoSec()
00129                         lasttimeSec=lastTimeStamp.GetSec()
00130                         lasttimeNano=lastTimeStamp.GetNanoSec()
00131                         self.dtSec=lasttimeSec-muontimeSec
00132                         self.dtNano=lasttimeNano-muontimeNano
00133                   #      print "time", self.dtNano, muontimeNano, lasttimeNano
00134                         if self.dtNano >= 0:
00135                            self.dtveto=self.dtNano/1e3
00136                            lastU=muontimeSec*1e9+muontimeNano         
00137                            break   
00138                  # print "bijiao", self.dtveto, self.muonVetoTime 
00139                   if self.dtveto > self.muonVetoTime:
00140                   #   print "single", t3, t4/1e3
00141                      self.num = self.num + 1
00142                      b = (self.num % self.numTag)
00143                      if b==0:
00144                    #     print "numTag", b
00145                         myTag = self.getTag(tagName)
00146                         myTag.setInputHeaders(self.inputHeaders[tagName])
00147                   
00148                         # clear the inputHeaders
00149                         self.inputHeaders[tagName] = []
00150                   
00151                         # trigger the actual saving process
00152                      
00153                         myTag.tagIt()
00154                      else:
00155                         self.inputHeaders[tagName] = []
00156                      
00157                   else:
00158                      self.inputHeaders[tagName] = []
00159                else:
00160                    self.num = self.num + 1
00161                    b = (self.num % self.numTag)
00162                    if b==0:
00163                       myTag = self.getTag(tagName)
00164                       myTag.setInputHeaders(self.inputHeaders[tagName])
00165                   
00166                       # clear the inputHeaders
00167                       self.inputHeaders[tagName] = []
00168                   
00169                       # trigger the actual saving process
00170                       myTag.tagIt()
00171                    else:
00172                       self.inputHeaders[tagName] = []
00173         self.inputHeaders[tagName].append(header)    
        self.k=self.k+1

Member Data Documentation

Definition at line 21 of file ADSingleTag.py.

Definition at line 21 of file ADSingleTag.py.

Definition at line 21 of file ADSingleTag.py.

Definition at line 21 of file ADSingleTag.py.

Definition at line 21 of file ADSingleTag.py.

Definition at line 21 of file ADSingleTag.py.

Definition at line 21 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 32 of file ADSingleTag.py.

Definition at line 60 of file ADSingleTag.py.

Definition at line 60 of file ADSingleTag.py.

Definition at line 60 of file ADSingleTag.py.

Definition at line 60 of file ADSingleTag.py.

Definition at line 60 of file ADSingleTag.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