/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
DataQuality::Tools::TesToTreeAlg Class Reference
Inheritance diagram for DataQuality::Tools::TesToTreeAlg:
Inheritance graph
[legend]
Collaboration diagram for DataQuality::Tools::TesToTreeAlg:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def initialize
def initGenHeader
def initSimHeader
def initSimReadoutHeader
def initReadoutHeader
def initCalibReadoutHeader
def initRecHeader
def prepareRecResults
def execute
def writeGenHeader
def writeSimHeader
def writeSimReadoutHeader
def writeReadoutHeader
def writeCalibReadoutHeader
def writeRecHeader
def finalize

Public Attributes

 HeaderList
 ForceReconResults
 firstEntry
 tesTree
 hasGen
 genTimeSec
 genTimeNanoSec
 nGenParticles
 maxGenParticles
 genPdgid
 genStatus
 genX
 genY
 genZ
 genT
 genE
 hasSim
 simTimeSec
 simTimeNanoSec
 nSimHits
 maxSimHits
 simHitSite
 simHitDet
 simHitSensId
 simHitTime
 simHitWeight
 simHitX
 simHitY
 simHitZ
 simHitRing
 simHitColumn
 simHitWavelength
 simHitType
 simStat
 hasSimRo
 nSimRo
 hasRo
 roTimeSec
 roTimeNanoSec
 hasReadout
 roSite
 roDetector
 roTriggerNumber
 roTriggerTimeSec
 roTriggerTimeNanoSec
 nRoChannels
 nRoTdcs
 nRoAdcs
 maxRoChannels
 roChanId
 roBoard
 roConnector
 nRoChanTdc
 nRoChanAdc
 roChanAdcGain
 roChanFirstTdc
 roChanPeakAdc
 maxRoTdcs
 roTdc
 roTdcChanId
 maxRoAdcs
 roAdcClock
 roAdc
 roAdcChanId
 hasCro
 croTimeSec
 croTimeNanoSec
 hasCalibReadout
 croSite
 croDetector
 croTriggerNumber
 croTriggerTimeSec
 croTriggerTimeNanoSec
 nCroChannels
 nCroTdcs
 nCroAdcs
 maxCroChannels
 croChanId
 croBoard
 croConnector
 nCroChanTdc
 nCroChanAdc
 croChanAdcGain
 croChanFirstTdc
 croChanPeakAdc
 maxCroTdcs
 croTdc
 croTdcChanId
 maxCroAdcs
 croAdcClock
 croAdc
 croAdcChanId
 hasRec
 recTimeSec
 recTimeNanoSec
 hasRecTrigger
 recResults

Detailed Description

Definition at line 31 of file Tools.py.


Constructor & Destructor Documentation

def DataQuality::Tools::TesToTreeAlg::__init__ (   self,
  name 
)

Definition at line 33 of file Tools.py.

00034                            :
00035         DybPythonAlg.__init__(self,name)
00036         # List of headers in output tree
00037         self.HeaderList = ["Gen","Sim","SimReadout","Readout","CalibReadout",
00038                            "Rec"]
00039         self.ForceReconResults = ["AdSimple"]
00040         return


Member Function Documentation

def DataQuality::Tools::TesToTreeAlg::initialize (   self)

Definition at line 41 of file Tools.py.

00042                         :
00043         status = DybPythonAlg.initialize(self)
00044         if status.isFailure(): return status
00045         self.info("initialize")
00046 
00047         self.firstEntry = True
00048         
00049         self.tesTree= TTree("tesTree","TES converted to ROOT Tree")
00050 
00051         if "Gen" in self.HeaderList:
00052             self.initGenHeader()
00053         if "Sim" in self.HeaderList:
00054             self.initSimHeader()
00055         if "SimReadout" in self.HeaderList:
00056             self.initSimReadoutHeader()
00057         if "Readout" in self.HeaderList:
00058             self.initReadoutHeader()
00059         if "CalibReadout" in self.HeaderList:
00060             self.initCalibReadoutHeader()
00061         if "Rec" in self.HeaderList:
00062             self.initRecHeader()
00063 
00064         self.stats['/file0/tes/tesTree'] = self.tesTree
00065         return SUCCESS

def DataQuality::Tools::TesToTreeAlg::initGenHeader (   self)

Definition at line 66 of file Tools.py.

00067                            :
00068         # GenEvent Data
00069         self.hasGen = array('i',[0])
00070         self.genTimeSec = array('i',[0])
00071         self.genTimeNanoSec = array('i',[0])
00072         self.nGenParticles = array('i',[0])
00073         self.maxGenParticles = 256
00074         self.genPdgid = array('i',self.maxGenParticles*[0])
00075         self.genStatus = array('i',self.maxGenParticles*[0])
00076         self.genX = array('d',self.maxGenParticles*[0])
00077         self.genY = array('d',self.maxGenParticles*[0])
00078         self.genZ = array('d',self.maxGenParticles*[0])
00079         self.genT = array('d',self.maxGenParticles*[0])
00080         self.genE = array('d',self.maxGenParticles*[0])
00081 
00082         self.tesTree.Branch('hasGen',self.hasGen,'hasGen/I')
00083         self.tesTree.Branch('genTimeSec',self.genTimeSec,'genTimeSec/I')
00084         self.tesTree.Branch('genTimeNanoSec',self.genTimeNanoSec,
00085                             'genTimeNanoSec/I')
00086         self.tesTree.Branch('nGenParticles',self.nGenParticles,
00087                             'nGenParticles/I')
00088         self.tesTree.Branch('genPdgid',self.genPdgid,
00089                             'genPdgid[nGenParticles]/I')
00090         self.tesTree.Branch('genStatus',self.genStatus,
00091                             'genStatus[nGenParticles]/I')
00092         self.tesTree.Branch('genX',self.genX,'genX[nGenParticles]/D')
00093         self.tesTree.Branch('genY',self.genY,'genY[nGenParticles]/D')
00094         self.tesTree.Branch('genZ',self.genZ,'genZ[nGenParticles]/D')
00095         self.tesTree.Branch('genT',self.genT,'genT[nGenParticles]/D')
00096         self.tesTree.Branch('genE',self.genE,'genE[nGenParticles]/D')

def DataQuality::Tools::TesToTreeAlg::initSimHeader (   self)

Definition at line 97 of file Tools.py.

00098                            :
00099         # SimEvent Data
00100         self.hasSim = array('i',[0])
00101         self.simTimeSec = array('i',[0])
00102         self.simTimeNanoSec = array('i',[0])
00103         self.nSimHits = array('i',[0])
00104         self.maxSimHits = 4096
00105         self.simHitSite = array('i',self.maxSimHits*[0])
00106         self.simHitDet = array('i',self.maxSimHits*[0])
00107         self.simHitSensId = array('i',self.maxSimHits*[0])
00108         self.simHitTime = array('d',self.maxSimHits*[0])
00109         self.simHitWeight = array('d',self.maxSimHits*[0])
00110         self.simHitX = array('d',self.maxSimHits*[0])
00111         self.simHitY = array('d',self.maxSimHits*[0])
00112         self.simHitZ = array('d',self.maxSimHits*[0])
00113         self.simHitRing = array('i',self.maxSimHits*[0])
00114         self.simHitColumn = array('i',self.maxSimHits*[0])
00115         self.simHitWavelength = array('d',self.maxSimHits*[0])
00116         self.simHitType = array('i',self.maxSimHits*[0])
00117         self.simStat = {}
00118 
00119         self.tesTree.Branch('hasSim',self.hasSim,'hasSim/I')
00120         self.tesTree.Branch('simTimeSec',self.simTimeSec,'simTimeSec/I')
00121         self.tesTree.Branch('simTimeNanoSec',self.simTimeNanoSec,
00122                             'simTimeNanoSec/I')
00123         self.tesTree.Branch('nSimHits',self.nSimHits,'nSimHits/I')
00124         self.tesTree.Branch('simHitSite',self.simHitSite,
00125                             'simHitSite[nSimHits]/I')
00126         self.tesTree.Branch('simHitDet',self.simHitDet,'simHitDet[nSimHits]/I')
00127         self.tesTree.Branch('simHitSensId',self.simHitSensId,
00128                             'simHitSensId[nSimHits]/I')
00129         self.tesTree.Branch('simHitTime',self.simHitTime,
00130                             'simHitTime[nSimHits]/D')
00131         self.tesTree.Branch('simHitWeight',self.simHitWeight,
00132                             'simHitWeight[nSimHits]/D')
00133         self.tesTree.Branch('simHitX',self.simHitX,'simHitX[nSimHits]/D')
00134         self.tesTree.Branch('simHitY',self.simHitY,'simHitY[nSimHits]/D')
00135         self.tesTree.Branch('simHitZ',self.simHitZ,'simHitZ[nSimHits]/D')
00136         self.tesTree.Branch('simHitRing',self.simHitRing,
00137                             'simHitRing[nSimHits]/I')
00138         self.tesTree.Branch('simHitColumn',self.simHitColumn,
00139                             'simHitColumn[nSimHits]/I')
00140         self.tesTree.Branch('simHitWavelength',self.simHitWavelength,
00141                             'simHitWavelength[nSimHits]/D')
00142         self.tesTree.Branch('simHitType',self.simHitType,
00143                             'simHitType[nSimHits]/I')        

def DataQuality::Tools::TesToTreeAlg::initSimReadoutHeader (   self)

Definition at line 144 of file Tools.py.

00145                                   :
00146         # SimReadoutEvent Data
00147         self.hasSimRo = array('i',[0])
00148         self.nSimRo = array('i',[0])
00149 
00150         self.tesTree.Branch('hasSimRo',self.hasSimRo,'hasSimRo/I')
00151         self.tesTree.Branch('nSimRo',self.nSimRo,'nSimRo/I')

def DataQuality::Tools::TesToTreeAlg::initReadoutHeader (   self)

Definition at line 152 of file Tools.py.

00153                                :
00154         # ReadoutEvent Data
00155         self.hasRo = array('i',[0])
00156         self.roTimeSec = array('i',[0])
00157         self.roTimeNanoSec = array('i',[0])
00158         self.hasReadout = array('i',[0])
00159         self.roSite = array('i',[0])
00160         self.roDetector = array('i',[0])
00161         self.roTriggerNumber = array('i',[0])
00162         self.roTriggerTimeSec = array('i',[0])
00163         self.roTriggerTimeNanoSec = array('i',[0])
00164         self.nRoChannels = array('i',[0])
00165         self.nRoTdcs = array('i',[0])
00166         self.nRoAdcs = array('i',[0])
00167         self.maxRoChannels = 512
00168         self.roChanId = array('i',self.maxRoChannels*[0])
00169         self.roBoard = array('i',self.maxRoChannels*[0])
00170         self.roConnector = array('i',self.maxRoChannels*[0])
00171         self.nRoChanTdc = array('i',self.maxRoChannels*[0])
00172         self.nRoChanAdc = array('i',self.maxRoChannels*[0])
00173         self.roChanAdcGain = array('i',self.maxRoChannels*[0])
00174         self.roChanFirstTdc = array('i',self.maxRoChannels*[0])
00175         self.roChanPeakAdc = array('i',self.maxRoChannels*[0])
00176         self.maxRoTdcs = 4096
00177         self.roTdc = array('i',self.maxRoTdcs*[0])
00178         self.roTdcChanId = array('i',self.maxRoTdcs*[0])
00179         self.maxRoAdcs = 4096
00180         self.roAdcClock = array('i',self.maxRoAdcs*[0])
00181         self.roAdc = array('i',self.maxRoAdcs*[0])
00182         self.roAdcChanId = array('i',self.maxRoAdcs*[0])
00183 
00184         self.tesTree.Branch('hasRo',self.hasRo,'hasRo/I')
00185         self.tesTree.Branch('roTimeSec',self.roTimeSec,'roTimeSec/I')
00186         self.tesTree.Branch('roTimeNanoSec',self.roTimeNanoSec,
00187                             'roTimeNanoSec/I')
00188         self.tesTree.Branch('hasReadout',self.hasReadout,'hasReadout/I')
00189         self.tesTree.Branch('roSite',self.roSite,'roSite/I')
00190         self.tesTree.Branch('roDetector',self.roDetector,'roDetector/I')
00191         self.tesTree.Branch('roTriggerNumber',self.roTriggerNumber,
00192                             'roTriggerNumber/I')
00193         self.tesTree.Branch('roTriggerTimeSec',self.roTriggerTimeSec,
00194                             'roTriggerTimeSec/I')
00195         self.tesTree.Branch('roTriggerTimeNanoSec',self.roTriggerTimeNanoSec,
00196                             'roTriggerTimeNanoSec/I')
00197         self.tesTree.Branch('nRoChannels',self.nRoChannels,'nRoChannels/I')
00198         self.tesTree.Branch('nRoTdcs',self.nRoTdcs,'nRoTdcs/I')
00199         self.tesTree.Branch('nRoAdcs',self.nRoAdcs,'nRoAdcs/I')
00200         self.tesTree.Branch('roChanId',self.roChanId,'roChanId[nRoChannels]/I')
00201         self.tesTree.Branch('roBoard',self.roBoard,'roBoard[nRoChannels]/I')
00202         self.tesTree.Branch('roConnector',self.roConnector,
00203                             'roConnector[nRoChannels]/I')
00204         self.tesTree.Branch('nRoChanTdc',self.nRoChanTdc,
00205                             'nRoChanTdc[nRoChannels]/I')
00206         self.tesTree.Branch('nRoChanAdc',self.nRoChanAdc,
00207                             'nRoChanAdc[nRoChannels]/I')
00208         self.tesTree.Branch('roChanAdcGain',self.roChanAdcGain,
00209                             'roChanAdcGain[nRoChannels]/I')
00210         self.tesTree.Branch('roChanFirstTdc',self.roChanFirstTdc,
00211                             'roChanFirstTdc[nRoChannels]/I')
00212         self.tesTree.Branch('roChanPeakAdc',self.roChanPeakAdc,
00213                             'roChanPeakAdc[nRoChannels]/I')
00214         self.tesTree.Branch('roTdc',self.roTdc,'roTdc[nRoTdcs]/I')
00215         self.tesTree.Branch('roTdcChanId',self.roTdcChanId,
00216                             'roTdcChanId[nRoTdcs]/I')
00217         self.tesTree.Branch('roAdcClock',self.roAdcClock,
00218                             'roAdcClock[nRoAdcs]/I')
00219         self.tesTree.Branch('roAdc',self.roAdc,'roAdc[nRoAdcs]/I')
00220         self.tesTree.Branch('roAdcChanId',self.roAdcChanId,
00221                             'roAdcChanId[nRoAdcs]/I')

def DataQuality::Tools::TesToTreeAlg::initCalibReadoutHeader (   self)

Definition at line 222 of file Tools.py.

00223                                     :
00224         # CalibReadoutEvent Data
00225         self.hasCro = array('i',[0])
00226         self.croTimeSec = array('i',[0])
00227         self.croTimeNanoSec = array('i',[0])
00228         self.hasCalibReadout = array('i',[0])
00229         self.croSite = array('i',[0])
00230         self.croDetector = array('i',[0])
00231         self.croTriggerNumber = array('i',[0])
00232         self.croTriggerTimeSec = array('i',[0])
00233         self.croTriggerTimeNanoSec = array('i',[0])
00234         self.nCroChannels = array('i',[0])
00235         self.nCroTdcs = array('i',[0])
00236         self.nCroAdcs = array('i',[0])
00237         self.maxCroChannels = 512
00238         self.croChanId = array('i',self.maxCroChannels*[0])
00239         self.croBoard = array('i',self.maxCroChannels*[0])
00240         self.croConnector = array('i',self.maxCroChannels*[0])
00241         self.nCroChanTdc = array('i',self.maxCroChannels*[0])
00242         self.nCroChanAdc = array('i',self.maxCroChannels*[0])
00243         self.croChanAdcGain = array('i',self.maxCroChannels*[0])
00244         self.croChanFirstTdc = array('d',self.maxCroChannels*[0])
00245         self.croChanPeakAdc = array('d',self.maxCroChannels*[0])
00246         self.maxCroTdcs = 4096
00247         self.croTdc = array('d',self.maxCroTdcs*[0])
00248         self.croTdcChanId = array('i',self.maxCroTdcs*[0])
00249         self.maxCroAdcs = 4096
00250         self.croAdcClock = array('i',self.maxCroAdcs*[0])
00251         self.croAdc = array('d',self.maxCroAdcs*[0])
00252         self.croAdcChanId = array('i',self.maxCroAdcs*[0])
00253 
00254         self.tesTree.Branch('hasCro',self.hasCro,'hasCro/I')
00255         self.tesTree.Branch('croTimeSec',self.croTimeSec,'croTimeSec/I')
00256         self.tesTree.Branch('croTimeNanoSec',self.croTimeNanoSec,
00257                             'croTimeNanoSec/I')
00258         self.tesTree.Branch('hasCalibReadout',self.hasCalibReadout,
00259                             'hasCalibReadout/I')
00260         self.tesTree.Branch('croSite',self.croSite,'croSite/I')
00261         self.tesTree.Branch('croDetector',self.croDetector,'croDetector/I')
00262         self.tesTree.Branch('croTriggerNumber',self.croTriggerNumber,
00263                             'croTriggerNumber/I')
00264         self.tesTree.Branch('croTriggerTimeSec',self.croTriggerTimeSec,
00265                             'croTriggerTimeSec/I')
00266         self.tesTree.Branch('croTriggerTimeNanoSec',self.croTriggerTimeNanoSec,
00267                             'croTriggerTimeNanoSec/I')
00268         self.tesTree.Branch('nCroChannels',self.nCroChannels,'nCroChannels/I')
00269         self.tesTree.Branch('nCroTdcs',self.nCroTdcs,'nCroTdcs/I')
00270         self.tesTree.Branch('nCroAdcs',self.nCroAdcs,'nCroAdcs/I')
00271         self.tesTree.Branch('croChanId',self.croChanId,
00272                             'croChanId[nCroChannels]/I')
00273         self.tesTree.Branch('croBoard',self.croBoard,'croBoard[nCroChannels]/I')
00274         self.tesTree.Branch('croConnector',self.croConnector,
00275                             'croConnector[nCroChannels]/I')
00276         self.tesTree.Branch('nCroChanTdc',self.nCroChanTdc,
00277                             'nCroChanTdc[nCroChannels]/I')
00278         self.tesTree.Branch('nCroChanAdc',self.nCroChanAdc,
00279                             'nCroChanAdc[nCroChannels]/I')
00280         self.tesTree.Branch('croChanAdcGain',self.croChanAdcGain,
00281                             'croChanAdcGain[nCroChannels]/I')
00282         self.tesTree.Branch('croChanFirstTdc',self.croChanFirstTdc,
00283                             'croChanFirstTdc[nCroChannels]/D')
00284         self.tesTree.Branch('croChanPeakAdc',self.croChanPeakAdc,
00285                             'croChanPeakAdc[nCroChannels]/D')
00286         self.tesTree.Branch('croTdc',self.croTdc,'croTdc[nCroTdcs]/D')
00287         self.tesTree.Branch('croTdcChanId',self.croTdcChanId,
00288                             'croTdcChanId[nCroTdcs]/I')
00289         self.tesTree.Branch('croAdcClock',self.croAdcClock,
00290                             'croAdcClock[nCroAdcs]/I')
00291         self.tesTree.Branch('croAdc',self.croAdc,'croAdc[nCroAdcs]/D')
00292         self.tesTree.Branch('croAdcChanId',self.croAdcChanId,
00293                             'croAdcChanId[nCroAdcs]/I')

def DataQuality::Tools::TesToTreeAlg::initRecHeader (   self)

Definition at line 294 of file Tools.py.

00295                            :
00296         # RecEvent Data
00297         self.hasRec = array('i',[0])
00298         self.recTimeSec = array('i',[0])
00299         self.recTimeNanoSec = array('i',[0])
00300         self.hasRecTrigger = array('i',[0])
00301         self.recResults = {}
00302 
00303         self.tesTree.Branch('hasRec',self.hasRec,'hasRec/I')
00304         self.tesTree.Branch('recTimeSec',self.recTimeSec,'recTimeSec/I')
00305         self.tesTree.Branch('recTimeNanoSec',self.recTimeNanoSec,
00306                             'recTimeNanoSec/I')
00307         self.tesTree.Branch('hasRecTrigger',self.hasRecTrigger,
00308                             'hasRecTrigger/I')
00309         for recName in self.ForceReconResults:
00310             self.prepareRecResults(recName)

def DataQuality::Tools::TesToTreeAlg::prepareRecResults (   self,
  recName 
)

Definition at line 311 of file Tools.py.

00312                                         :
00313         # Prepare tree branches for a particular reconstruction type
00314         recSiteName = "rec_" + recName + "_site"
00315         recDetName = "rec_" + recName + "_det"
00316         recTrigNumName = "rec_" + recName + "_trigNum"
00317         recTrigTimeSecName = "rec_" + recName + "_trigTimeSec"
00318         recTrigTimeNanoSecName = "rec_" + recName + "_trigTimeNanoSec"
00319         recEnergyName = "rec_" + recName + "_energy"
00320         recPosName = "rec_" + recName + "_position"
00321         recDirName = "rec_" + recName + "_direction"
00322         recEnergyStatName = "rec_" + recName + "_energyStatus"
00323         recPosStatName = "rec_" + recName + "_positionStatus"
00324         recDirStatName = "rec_" + recName + "_directionStatus"
00325         recEnergyQualName = "rec_" + recName + "_energyQuality"
00326         recPosQualName = "rec_" + recName + "_positionQuality"
00327         recDirQualName = "rec_" + recName + "_directionQuality"
00328         if not self.recResults.has_key(recSiteName):
00329             self.recResults[recSiteName] = array('i',[0])
00330             self.recResults[recDetName] = array('i',[0])
00331             self.recResults[recTrigNumName] = array('i',[0])
00332             self.recResults[recTrigTimeSecName] = array('i',[0])
00333             self.recResults[recTrigTimeNanoSecName] = array('i',[0])
00334             self.recResults[recEnergyName] = array('d',[0])
00335             self.recResults[recPosName] = array('d',4*[0])
00336             self.recResults[recDirName] = array('d',4*[0])
00337             self.recResults[recEnergyStatName] = array('i',[0])
00338             self.recResults[recPosStatName] = array('i',[0])
00339             self.recResults[recDirStatName] = array('i',[0])
00340             self.recResults[recEnergyQualName] = array('d',[0])
00341             self.recResults[recPosQualName] = array('d',[0])
00342             self.recResults[recDirQualName] = array('d',[0])
00343             if self.firstEntry:
00344                 self.info("     Adding reconstruction "+recName)
00345                 self.tesTree.Branch(recSiteName,
00346                                     self.recResults[recSiteName],
00347                                     "%s/I" % recSiteName)
00348                 self.tesTree.Branch(recDetName,
00349                                     self.recResults[recDetName],
00350                                     "%s/I" % recDetName)
00351                 self.tesTree.Branch(recTrigNumName,
00352                                     self.recResults[recTrigNumName],
00353                                     "%s/I" % recTrigNumName)
00354                 self.tesTree.Branch(recTrigTimeSecName,
00355                                     self.recResults[recTrigTimeSecName],
00356                                     "%s/I" % recTrigTimeSecName)
00357                 self.tesTree.Branch(recTrigTimeNanoSecName,
00358                                     self.recResults[recTrigTimeNanoSecName],
00359                                     "%s/I" % recTrigTimeNanoSecName)
00360                 self.tesTree.Branch(recEnergyName,
00361                                     self.recResults[recEnergyName],
00362                                     "%s/D" % recEnergyName)
00363                 self.tesTree.Branch(recPosName,
00364                                     self.recResults[recPosName],
00365                                     "%s[4]/D" % recPosName)
00366                 self.tesTree.Branch(recDirName,
00367                                     self.recResults[recDirName],
00368                                     "%s[4]/D" % recDirName)
00369                 self.tesTree.Branch(recEnergyStatName,
00370                                     self.recResults[recEnergyStatName],
00371                                     "%s/I" % recEnergyStatName)
00372                 self.tesTree.Branch(recPosStatName,
00373                                     self.recResults[recPosStatName],
00374                                     "%s/I" % recPosStatName)
00375                 self.tesTree.Branch(recDirStatName,
00376                                     self.recResults[recDirStatName],
00377                                     "%s/I" % recDirStatName)
00378                 self.tesTree.Branch(recEnergyQualName,
00379                                     self.recResults[recEnergyQualName],
00380                                     "%s/D" % recEnergyQualName)
00381                 self.tesTree.Branch(recPosQualName,
00382                                     self.recResults[recPosQualName],
00383                                     "%s/D" % recPosQualName)
00384                 self.tesTree.Branch(recDirQualName,
00385                                     self.recResults[recDirQualName],
00386                                     "%s/D" % recDirQualName)
00387             else:
00388                 self.warning("Cannot add "+recName+" to tree after first entry")
00389         return

def DataQuality::Tools::TesToTreeAlg::execute (   self)

Definition at line 390 of file Tools.py.

00391                      :
00392         self.info("executing")
00393 
00394         if "Gen" in self.HeaderList:
00395             self.writeGenHeader()
00396         if "Sim" in self.HeaderList:
00397             self.writeSimHeader()
00398         if "SimReadout" in self.HeaderList:
00399             self.writeSimReadoutHeader()
00400         if "Readout" in self.HeaderList:
00401             self.writeReadoutHeader()
00402         if "CalibReadout" in self.HeaderList:
00403             self.writeCalibReadoutHeader()
00404         if "Rec" in self.HeaderList:
00405             self.writeRecHeader()
00406 
00407         self.tesTree.Fill()
00408         self.firstEntry = False
00409         return SUCCESS

def DataQuality::Tools::TesToTreeAlg::writeGenHeader (   self)

Definition at line 410 of file Tools.py.

00411                             :
00412         # GenEvent Data
00413         self.hasGen[0] = 0
00414         self.genTimeSec[0] = 0
00415         self.genTimeNanoSec[0] = 0
00416         self.nGenParticles[0] = 0
00417 
00418         evt = self.evtSvc()
00419         # GenEvent Data
00420         genHdr = evt["/Event/Gen/GenHeader"]
00421         if genHdr != None:
00422             self.genTimeSec[0] = genHdr.timeStamp().GetSec()
00423             self.genTimeNanoSec[0] = genHdr.timeStamp().GetNanoSec()
00424             genEvt = genHdr.event()
00425             if genEvt != None:
00426                 self.hasGen[0] = 1
00427                 nParticles = 0
00428                 for vertex in irange(genEvt.vertices_begin(),
00429                                      genEvt.vertices_end()):
00430                     pos = vertex.position()
00431                     #localPos = self.localCoord(pos)
00432                     for particle in irange(vertex.particles_out_const_begin(),
00433                                            vertex.particles_out_const_end()):
00434                         if nParticles >= self.maxGenParticles: break
00435                         self.genPdgid[nParticles] = particle.pdg_id()
00436                         self.genStatus[nParticles] = particle.status()
00437                         self.genX[nParticles] = pos.x()
00438                         self.genY[nParticles] = pos.y()
00439                         self.genZ[nParticles] = pos.z()
00440                         self.genT[nParticles] = pos.t()
00441                         self.genE[nParticles] = particle.momentum().e()
00442                         nParticles += 1
00443                 self.nGenParticles[0] = nParticles
00444         return

def DataQuality::Tools::TesToTreeAlg::writeSimHeader (   self)

Definition at line 445 of file Tools.py.

00446                             :
00447         # SimEvent Data
00448         self.hasSim[0] = 0
00449         self.simTimeSec[0] = 0
00450         self.simTimeNanoSec[0] = 0
00451         self.nSimHits[0] = 0
00452         for name in self.simStat.keys():
00453             self.simStat[name][0] = 0
00454 
00455         evt = self.evtSvc()
00456         # SimEvent Data
00457         simHdr = evt["/Event/Sim/SimHeader"]
00458         if simHdr != None:
00459             self.hasSim[0] = 1
00460             self.simTimeSec[0] = simHdr.timeStamp().GetSec()
00461             self.simTimeNanoSec[0] = simHdr.timeStamp().GetNanoSec()
00462             shh = simHdr.hits()
00463             if shh != None:
00464                 nHits = 0
00465                 hitCollectionMap = shh.hitCollection()
00466                 for shcPair in irange(hitCollectionMap.begin(),
00467                                       hitCollectionMap.end()):
00468                     detectorInt = shcPair.first
00469                     hitCollection = shcPair.second
00470                     hits = hitCollection.collection()
00471                     detId = Detector(detectorInt<<16)
00472                     for hit in hits:
00473                         self.simHitSite[nHits] = detId.site()
00474                         self.simHitDet[nHits] = detId.detectorId()
00475                         self.simHitSensId[nHits] = hit.sensDetId()
00476                         self.simHitTime[nHits] = hit.hitTime()
00477                         self.simHitWeight[nHits] = hit.weight()
00478                         pos = hit.localPos()
00479                         self.simHitX[nHits] = pos.x()
00480                         self.simHitY[nHits] = pos.y()
00481                         self.simHitZ[nHits] = pos.z()
00482                         if (detId.detectorId() == DetectorId.kAD1
00483                             or detId.detectorId() == DetectorId.kAD2
00484                             or detId.detectorId() == DetectorId.kAD3
00485                             or detId.detectorId() == DetectorId.kAD4):
00486                             pmtId = AdPmtSensor(hit.sensDetId())
00487                             self.simHitRing[nHits] = pmtId.ring()
00488                             self.simHitColumn[nHits] = pmtId.column()
00489                             self.simHitWavelength[nHits] = hit.wavelength()
00490                             self.simHitType[nHits] = hit.type()
00491                         else:
00492                             self.simHitRing[nHits] = 0
00493                             self.simHitColumn[nHits] = 0
00494                             self.simHitWavelength[nHits] = 0
00495                             self.simHitType[nHits] = 0
00496                         nHits += 1
00497                 self.nSimHits[0] = nHits
00498             # Particle History
00499             particleHistory = simHdr.particleHistory()
00500             if particleHistory != None:
00501                 # Currently doesn't copy particle history
00502                 pass
00503             # Unobservable Statistics
00504             statsHdr = simHdr.unobservableStatistics()
00505             if statsHdr != None:
00506                 stats = statsHdr.stats()
00507                 if self.firstEntry: self.info("Adding unobservables to tree")
00508                 for statPair in irange(stats.begin(),stats.end()):
00509                     name = statPair.first
00510                     stat = statPair.second
00511                     countName = "simUnobs_"+name+"_count"
00512                     sumName = "simUnobs_"+name+"_sum"
00513                     sqSumName = "simUnobs_"+name+"_sqSum"
00514                     if not self.simStat.has_key(countName):
00515                         self.simStat[countName] = array('d',[0])
00516                         self.simStat[sumName] = array('d',[0])
00517                         self.simStat[sqSumName] = array('d',[0])
00518                         if self.firstEntry:
00519                             self.info("     Adding "+name)
00520                             self.tesTree.Branch(countName,
00521                                                 self.simStat[countName],
00522                                                 "%s/D" % countName)
00523                             self.tesTree.Branch(sumName,self.simStat[sumName],
00524                                                 "%s/D"%sumName)
00525                             self.tesTree.Branch(sqSumName,
00526                                                 self.simStat[sqSumName],
00527                                                 "%s/D"%sqSumName)
00528                         else:
00529                             self.warning("Too late to add unobservable "+name)
00530                     self.simStat[countName][0] = stat.count()
00531                     self.simStat[sumName][0] = stat.sum()
00532                     self.simStat[sqSumName][0] = stat.squaredsum()
00533         return

def DataQuality::Tools::TesToTreeAlg::writeSimReadoutHeader (   self)

Definition at line 534 of file Tools.py.

00535                                    :
00536         # SimReadoutEvent
00537         self.hasSimRo[0] = 0
00538         self.nSimRo[0] = 0
00539         
00540         evt = self.evtSvc()
00541         # SimReadoutEvent Data
00542         simRoHdr = evt["/Event/Sim/SimReadoutHeader"]
00543         if simRoHdr != None:
00544             self.hasSimRo[0] = 1
00545             self.nSimRo[0] = simRoHdr.readouts().size()
00546         return
00547 

def DataQuality::Tools::TesToTreeAlg::writeReadoutHeader (   self)

Definition at line 548 of file Tools.py.

00549                                 :
00550         # ReadoutEvent Data
00551         self.hasRo[0] = 0
00552         self.roTimeSec[0] = 0
00553         self.roTimeNanoSec[0] = 0
00554         self.hasReadout[0] = 0
00555         self.roSite[0] = 0
00556         self.roDetector[0] = 0
00557         self.roTriggerNumber[0] = 0
00558         self.roTriggerTimeSec[0] = 0
00559         self.roTriggerTimeNanoSec[0] = 0
00560         self.nRoChannels[0] = 0
00561         self.nRoTdcs[0] = 0
00562         self.nRoAdcs[0] = 0
00563 
00564         evt = self.evtSvc()
00565         # ReadoutEvent Data
00566         roHdr = evt["/Event/Readout/ReadoutHeader"]
00567         if roHdr != None:
00568             self.hasRo[0] = 1
00569             self.roTimeSec[0] = roHdr.timeStamp().GetSec()
00570             self.roTimeNanoSec[0] = roHdr.timeStamp().GetNanoSec()
00571             readout = roHdr.readout()
00572             if readout != None:
00573                 self.hasReadout[0] = 1
00574                 self.roSite[0] = readout.detector().site()
00575                 detId = readout.detector().detectorId()
00576                 self.roDetector[0] = detId
00577                 self.roTriggerNumber[0] = readout.triggerNumber()
00578                 trigTime = readout.triggerTime()
00579                 self.roTriggerTimeSec[0] = trigTime.GetSec()
00580                 self.roTriggerTimeNanoSec[0] = trigTime.GetNanoSec()
00581                 if (detId == DetectorId.kAD1 or
00582                     detId == DetectorId.kAD2 or
00583                     detId == DetectorId.kAD3 or
00584                     detId == DetectorId.kAD4 or
00585                     detId == DetectorId.kIWS or
00586                     detId == DetectorId.kOWS or
00587                     detId == DetectorId.kUnknown):  # Catch unset detector
00588                     nRoChannels = 0
00589                     nRoTdcs = 0
00590                     nRoAdcs = 0
00591                     for channelPair in readout.channelReadout():
00592                         channel = channelPair.second
00593                         chanId = channel.channelId()
00594                         self.roChanId[nRoChannels] = chanId.fullPackedData()
00595                         self.roBoard[nRoChannels] = chanId.board()
00596                         self.roConnector[nRoChannels] = chanId.connector()
00597                         self.nRoChanTdc[nRoChannels] = channel.tdc().size()
00598                         self.nRoChanAdc[nRoChannels] = channel.adc().size()
00599                         self.roChanAdcGain[nRoChannels] = channel.adcGain()
00600                         firstTdc = 0
00601                         for tdc in channel.tdc():
00602                             self.roTdc[nRoTdcs] = tdc
00603                             self.roTdcChanId[nRoTdcs] = chanId.fullPackedData()
00604                             firstTdc = max(firstTdc, tdc)
00605                             nRoTdcs += 1
00606                         peakAdc = 0
00607                         for adcPair in irange(channel.adc().begin(),
00608                                               channel.adc().end()):
00609                             adcClock = adcPair.first
00610                             adc = adcPair.second
00611                             self.roAdcClock[nRoAdcs] = adcClock
00612                             self.roAdc[nRoAdcs] = adc
00613                             self.roAdcChanId[nRoAdcs] = chanId.fullPackedData()
00614                             peakAdc = max(peakAdc, adc)
00615                             nRoAdcs += 1
00616                         self.roChanFirstTdc[nRoChannels] = firstTdc
00617                         self.roChanPeakAdc[nRoChannels] = peakAdc
00618                         nRoChannels += 1
00619                     self.nRoChannels[0] = nRoChannels
00620                     self.nRoTdcs[0] = nRoTdcs
00621                     self.nRoAdcs[0] = nRoAdcs
00622         return

def DataQuality::Tools::TesToTreeAlg::writeCalibReadoutHeader (   self)

Definition at line 623 of file Tools.py.

00624                                      :
00625         # CalibReadoutEvent Data
00626         self.hasCro[0] = 0
00627         self.croTimeSec[0] = 0
00628         self.croTimeNanoSec[0] = 0
00629         self.hasCalibReadout[0] = 0
00630         self.croSite[0] = 0
00631         self.croDetector[0] = 0
00632         self.croTriggerNumber[0] = 0
00633         self.croTriggerTimeSec[0] = 0
00634         self.croTriggerTimeNanoSec[0] = 0
00635         self.nCroChannels[0] = 0
00636         self.nCroTdcs[0] = 0
00637         self.nCroAdcs[0] = 0
00638         
00639         evt = self.evtSvc()
00640         # CalibReadoutEvent Data
00641         croHdr = evt["/Event/CalibReadout/CalibReadoutHeader"]
00642         if croHdr != None:
00643             self.hasCro[0] = 1
00644             self.croTimeSec[0] = croHdr.timeStamp().GetSec()
00645             self.croTimeNanoSec[0] = croHdr.timeStamp().GetNanoSec()
00646             readout = croHdr.calibReadout()
00647             if readout != None:
00648                 self.hasCalibReadout[0] = 1
00649                 self.croSite[0] = readout.detector().site()
00650                 detId = readout.detector().detectorId()
00651                 self.croDetector[0] = detId
00652                 self.croTriggerNumber[0] = readout.triggerNumber()
00653                 trigTime = readout.triggerTime()
00654                 self.croTriggerTimeSec[0] = trigTime.GetSec()
00655                 self.croTriggerTimeNanoSec[0] = trigTime.GetNanoSec()
00656                 if (detId == DetectorId.kAD1 or
00657                     detId == DetectorId.kAD2 or
00658                     detId == DetectorId.kAD3 or
00659                     detId == DetectorId.kAD4 or
00660                     detId == DetectorId.kIWS or
00661                     detId == DetectorId.kOWS):
00662                     nCroChannels = 0
00663                     nCroTdcs = 0
00664                     nCroAdcs = 0
00665                     for channelPair in readout.channelReadout():
00666                         channel = channelPair.second
00667                         chanId = channel.channelId()
00668                         self.croChanId[nCroChannels] = chanId.fullPackedData()
00669                         self.croBoard[nCroChannels] = chanId.board()
00670                         self.croConnector[nCroChannels] = chanId.connector()
00671                         self.nCroChanTdc[nCroChannels] = channel.tdc().size()
00672                         self.nCroChanAdc[nCroChannels] = channel.adc().size()
00673                         self.croChanAdcGain[nCroChannels] = channel.adcGain()
00674                         for tdc in channel.tdc():
00675                             self.croTdc[nCroTdcs] = tdc
00676                             self.croTdcChanId[nCroTdcs]= chanId.fullPackedData()
00677                             nCroTdcs += 1
00678                         for adcPair in irange(channel.adc().begin(),
00679                                               channel.adc().end()):
00680                             adcClock = adcPair.first
00681                             adc = adcPair.second
00682                             self.croAdcClock[nCroAdcs] = adcClock
00683                             self.croAdc[nCroAdcs] = adc
00684                             self.croAdcChanId[nCroAdcs]= chanId.fullPackedData()
00685                             nCroAdcs += 1
00686                         self.croChanFirstTdc[nCroChannels] = channel.firstTdc()
00687                         self.croChanPeakAdc[nCroChannels] = channel.peakAdc()
00688                         nCroChannels += 1
00689                     self.nCroChannels[0] = nCroChannels
00690                     self.nCroTdcs[0] = nCroTdcs
00691                     self.nCroAdcs[0] = nCroAdcs
00692         return

def DataQuality::Tools::TesToTreeAlg::writeRecHeader (   self)

Definition at line 693 of file Tools.py.

00694                             :
00695         # RecEvent Data
00696         self.hasRec[0] = 0
00697         self.recTimeSec[0] = 0
00698         self.recTimeNanoSec[0] = 0
00699         self.hasRecTrigger[0] = 0
00700         for name in self.recResults.keys():
00701             for fieldIdx in range(len(self.recResults[name])):
00702                 self.recResults[name][fieldIdx] = 0
00703         
00704         evt = self.evtSvc()
00705         # RecEvent Data
00706         recHdr = evt["/Event/Rec/RecHeader"]
00707         if recHdr != None:
00708             self.hasRec[0] = 1
00709             self.recTimeSec[0] = recHdr.timeStamp().GetSec()
00710             self.recTimeNanoSec[0] = recHdr.timeStamp().GetNanoSec()
00711             for recPair in irange(recHdr.recResults().begin(),
00712                                   recHdr.recResults().end()):
00713                 self.hasRecTrigger[0] = 1
00714                 recTrigger = recPair.second
00715                 recName = recTrigger.name()
00716                 recSiteName = "rec_" + recName + "_site"
00717                 recDetName = "rec_" + recName + "_det"
00718                 recTrigNumName = "rec_" + recName + "_trigNum"
00719                 recTrigTimeSecName = "rec_" + recName + "_trigTimeSec"
00720                 recTrigTimeNanoSecName = "rec_" + recName + "_trigTimeNanoSec"
00721                 recEnergyName = "rec_" + recName + "_energy"
00722                 recPosName = "rec_" + recName + "_position"
00723                 recDirName = "rec_" + recName + "_direction"
00724                 recEnergyStatName = "rec_" + recName + "_energyStatus"
00725                 recPosStatName = "rec_" + recName + "_positionStatus"
00726                 recDirStatName = "rec_" + recName + "_directionStatus"
00727                 recEnergyQualName = "rec_" + recName + "_energyQuality"
00728                 recPosQualName = "rec_" + recName + "_positionQuality"
00729                 recDirQualName = "rec_" + recName + "_directionQuality"
00730                 if not self.recResults.has_key(recSiteName):
00731                     self.prepareRecResults(recName)
00732                 self.recResults[recSiteName][0] = recTrigger.detector().site()
00733                 self.recResults[recDetName][0] = recTrigger.detector().detectorId()
00734                 self.recResults[recTrigNumName][0] = recTrigger.triggerNumber()
00735                 self.recResults[recTrigTimeSecName][0] = recTrigger.triggerTime().GetSec()
00736                 self.recResults[recTrigTimeNanoSecName][0] = recTrigger.triggerTime().GetNanoSec()
00737                 self.recResults[recEnergyName][0] = recTrigger.energy()
00738                 self.recResults[recPosName][0] = recTrigger.position().x()
00739                 self.recResults[recPosName][1] = recTrigger.position().y()
00740                 self.recResults[recPosName][2] = recTrigger.position().z()
00741                 self.recResults[recPosName][3] = recTrigger.position().t()
00742                 self.recResults[recDirName][0] = recTrigger.direction().x()
00743                 self.recResults[recDirName][1] = recTrigger.direction().y()
00744                 self.recResults[recDirName][2] = recTrigger.direction().z()
00745                 self.recResults[recDirName][3] = recTrigger.direction().t()
00746                 self.recResults[recEnergyStatName][0] = recTrigger.energyStatus()
00747                 self.recResults[recPosStatName][0] = recTrigger.positionStatus()
00748                 self.recResults[recDirStatName][0]= recTrigger.directionStatus()
00749                 self.recResults[recEnergyQualName][0]=recTrigger.energyQuality()
00750                 self.recResults[recPosQualName][0]= recTrigger.positionQuality()
00751                 self.recResults[recDirQualName][0]=recTrigger.directionQuality()
00752         return
00753 
        
def DataQuality::Tools::TesToTreeAlg::finalize (   self)

Definition at line 754 of file Tools.py.

00754                       :        
00755         self.info("finalizing")
00756         status = DybPythonAlg.finalize(self)
00757         return status
00758 

Member Data Documentation

Definition at line 33 of file Tools.py.

Definition at line 33 of file Tools.py.

Definition at line 41 of file Tools.py.

Definition at line 41 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 66 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 97 of file Tools.py.

Definition at line 144 of file Tools.py.

Definition at line 144 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 152 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 222 of file Tools.py.

Definition at line 294 of file Tools.py.

Definition at line 294 of file Tools.py.

Definition at line 294 of file Tools.py.

Definition at line 294 of file Tools.py.

Definition at line 294 of file Tools.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:06:20 for DataQuality by doxygen 1.7.4